text stringlengths 3.09k 13.9k |
|---|
use crate::exporter::model::{annotation::Annotation, endpoint::Endpoint};
use serde::Serialize;
use std::collections::HashMap;
#[derive(Clone, Debug, Serialize)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")]
pub(crate) enum Kind {
Client,
Server,
Producer,
Consumer,
}
#[derive(TypedBuilder, Clone, Deb... |
// Copyright 2018 Parity Technologies (UK) Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, mer... |
use crate::{CoordinateType, LineString, Polygon, EQUATORIAL_EARTH_RADIUS};
use num_traits::Float;
/// Calculate the signed approximate geodesic area of a `Geometry`.
///
/// # Units
///
/// - return value: meters²
///
/// # References
///
/// * <NAME> and <NAME>, "Some Algorithms for Polygons on a Sphere",
///
/// J... |
// Copyright (c) Microsoft. All rights reserved.
use std::convert::TryFrom;
#[cfg(not(test))]
use aziot_identity_client_async::Client as IdentityClient;
#[cfg(test)]
use edgelet_test_utils::clients::IdentityClient;
pub(crate) struct Route<M>
where
M: edgelet_core::ModuleRuntime + Send + Sync,
{
client: std:... |
use crate::managers::brains_manager::BrainsManager;
use crate::managers::food_manager::FoodManager;
use crate::managers::items_manager::{ItemsManager, Named};
use crate::managers::physics_manager::body::{BodyID, Vec2};
use crate::managers::physics_manager::PhysicsManager;
use crate::managers::renderables_manager::rende... |
use std::any::{TypeId, Any, type_name};
use serde::{ser, Deserialize};
use serde::de;
use serde::{Serialize, Deserializer};
use crate::{AnySerializerDefault, AnyDeserializer, BoxAnySerde, AnySerde};
use std::fmt;
use std::fmt::Formatter;
use serde::de::{Visitor, MapAccess, DeserializeSeed, Error};
use crate::tag::{Type... |
use crate::prelude::*;
#[derive(Debug, PartialEq, Eq, Hash, Clone, strum::Display)]
pub enum MediaType {
#[strum(to_string = "all")] All,
#[strum(to_string = "print")] Print,
#[strum(to_string = "screen")] Screen,
#[strum(to_string = "speech")] Speech,
}
#[derive(Debug, PartialEq, Eq, Hash, Clone, strum::Display)... |
use crate::{
core::scope_profile,
engine::resource_manager::TimedEntry,
renderer::{
batch::InstanceData,
framework::{
geometry_buffer::{
AttributeDefinition, AttributeKind, BufferBuilder, ElementKind, GeometryBuffer,
GeometryBufferBuilder, Geometry... |
use std::env;
use std::fmt;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::io::{self, Read};
use std::path::{Path, PathBuf};
use std::process;
use std::str::FromStr;
use std::sync::atomic;
use std::time::Duration;
use crate::Csv;
static QSV_INTEGRATION_TEST_DIR: &str = "xit";
static NEXT_ID: atomic::At... |
use crate::prelude::*;
use std::marker::PhantomData;
#[derive(Copy, Clone, Debug)]
pub struct NapiThreadsafeFunction<Data, const N: usize>(
NapiEnv,
napi_threadsafe_function,
PhantomData<Data>,
);
unsafe impl<Data, const N: usize> Send for NapiThreadsafeFunction<Data, N> {}
unsafe impl<Data, const N: usiz... |
//! PKCS#8 encrypted private key document.
use crate::{EncryptedPrivateKeyInfo, Error, Result};
use alloc::{borrow::ToOwned, vec::Vec};
use core::{
convert::{TryFrom, TryInto},
fmt,
};
use der::Encodable;
use zeroize::{Zeroize, Zeroizing};
#[cfg(feature = "encryption")]
use crate::PrivateKeyDocument;
#[cfg(f... |
use super::*;
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Nonprim {
Tuple,
Cntr,
Seq,
Map,
None,
}
/// This only matches `Inline` and `Concise` variants. Looks ahead to guess type
/// based on opening delimiters and field naming. _Always_ returns the original
/// input.
pub(super) fn pattern... |
use std::collections::HashMap;
use xmltree::Element;
use crate::elementext::ElementExt;
use crate::encode::Encode;
use crate::error::*;
use crate::new_element;
use crate::svd::endian::Endian;
use crate::types::Parse;
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[derive(Clone, Debug,... |
// x11-rs: Rust bindings for X11 libraries
// The X11 libraries are available under the MIT license.
// These bindings are public domain.
use std::os::raw::{
c_char,
c_float,
c_int,
c_uchar,
c_uint,
c_ulong,
c_ushort,
};
use ::xlib::{
Bool,
Display,
Time,
Window,
XEvent,
};
//
// functions
/... |
//! Intermediate representation of the input document that is used by the query engine to build
//! query ASTs and validate the incoming data.
//!
//! Helps decoupling the incoming protocol layer from the query engine, i.e. allows the query engine
//! to be agnostic to the actual protocol that is used on upper layers, ... |
use std::{
ffi::OsString,
fs::File,
path::{Path, PathBuf},
str::FromStr,
};
use tempfile::{NamedTempFile, PersistError};
use tedge_users::UserManager;
const ETC_PATH: &str = "/etc";
pub const TEDGE_ETC_DIR: &str = "tedge";
pub const TEDGE_HOME_DIR: &str = ".tedge";
#[derive(thiserror::Error, Debug)]... |
use std::{collections::HashMap, path::Path};
use anyhow::*;
use serde::{Deserialize, Serialize};
use sodiumoxide::crypto::hash::sha256::{self, Digest};
use sodiumoxide::{
crypto::{
box_,
box_::{PublicKey, SecretKey},
sealedbox,
},
hex,
};
/// Environment variable name containing th... |
//! Intel 10Gb Network Adapter 82599 i.e. ixgbe network driver
//! Datasheet: https://www.intel.com/content/dam/www/public/us/en/documents/datasheets/82599-10-gbe-controller-datasheet.pdf
use alloc::string::String;
use alloc::sync::Arc;
use alloc::vec::Vec;
use alloc::collections::BTreeMap;
use isomorphic_drivers::ne... |
use crate::header::Format;
use crate::header::LintHeader;
use crate::header::BLOCK_SIZE;
use crate::issues::Hint;
use crate::issues::Issue;
use crate::lint::lint_nul_field;
use crate::lint::ERROR;
use std::collections::BTreeSet;
use std::io::Read;
use std::io::Result;
pub struct Dump {
pub bytes: [u8; BLOCK_SIZE],... |
use crate::{
api::{patch_task::PatchTask, AuthResponse, TaskResponse},
components::atoms::bb_select::SelectOption,
};
use gloo::console;
use js_sys::Date;
use serde::{Deserialize, Serialize};
use yewdux::prelude::*;
pub type StoreDispatch = Dispatch<StoreType>;
pub type StoreType = PersistentStore<Store>;
#[d... |
use std::io;
use actix::fut;
use actix::prelude::*;
use futures::{stream, Future, Stream};
use rand::{thread_rng, Rng, ThreadRng};
use tokio_postgres::{connect, Client, Statement, TlsMode};
use models::{Fortune, World};
/// Postgres interface
pub struct PgConnection {
cl: Option<Client>,
fortune: Option<Stat... |
use ndarray::{Array, ArrayBase, Data, Ix2};
use num_traits::{Float, FromPrimitive};
use petal_neighbors::{
distance::{Euclidean, Metric},
BallTree,
};
use rayon::prelude::*;
use serde::{Deserialize, Serialize};
use std::collections::{HashMap, HashSet};
use std::ops::{AddAssign, DivAssign};
use super::Fit;
///... |
use clap::{crate_version, Arg, ArgMatches, Command};
use mdbook::{
errors::Error,
preprocess::{CmdPreprocessor, Preprocessor},
};
use mdbook_admonish::Admonish;
use std::{io, process};
pub fn make_app() -> Command<'static> {
let mut command = Command::new("mdbook-admonish")
.version(crate_version!(... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
extern crate classes;
extern crate termion;
extern crate eventual;
extern crate termios;
use eventual::{Future, Async};
use termion::color;
use termion::clear;
use std::time::{Instant, Duration};
use termios::{Termios, TCSANOW, ECHO, ICANON, tcsetattr};
use std::io;
use std::io::Read;
use std::io::Write;
use std::cha... |
extern crate goscript_parser as fe;
extern crate goscript_types as types;
use regex::Regex;
use std::collections::HashMap;
use std::fs;
use std::fs::File;
use std::io::{self, BufRead};
use std::path::Path;
#[derive(Debug)]
struct ErrInfo {
text: String,
regex: Regex,
checked: bool,
line: usize,
}
impl... |
//! Mina Schnorr signature scheme
//!
//! An implementation of the singer interface for the Mina signature algorithm
//!
//! Details: <https://github.com/MinaProtocol/mina/blob/develop/docs/specs/signatures/description.md>
use ark_ec::{
AffineCurve, // for prime_subgroup_generator()
ProjectiveCurve, // for... |
/*******************************************************************************
* (c) 2021 Zondax GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/lic... |
//! This crate is x86_64's little brother. It provides i386 specific functions
//! and data structures, and access to various system registers.
#![cfg(any(target_arch = "x86", test, rustdoc))]
#![allow(dead_code)]
pub mod instructions {
//! Low level functions for special i386 instructions.
pub mod tables {
... |
extern crate openssl;
mod how_about_a_nice_game_of_chess {
mod hashing {
use ::openssl::hash::{Hasher, MessageDigest};
/// Iterator over the interesting hashes of door_id starting at index zero.
pub struct InterestingHashFinder<'a> {
door_id: &'a [u8],
index: u64,
... |
extern crate term;
use std::{collections::HashMap, str::FromStr, fs::File};
use regex::Regex;
use crate::options;
pub struct Context {
// It would be great to have such generic iterator here, as commented below
// We could store there iterator over stdin or file and iterate like this:
// for line in conte... |
use std::collections::HashMap;
use std::os::raw::c_int;
use geo::algorithm::euclidean_distance::EuclideanDistance;
use geo_types::{Coordinate, LineString, Polygon, Point};
use h3ron_h3_sys::{
destroyLinkedPolygon,
H3Index,
h3SetToLinkedGeo,
LinkedGeoPolygon,
radsToDegs,
};
use crate::algorithm::s... |
use ark_crypto_primitives::prf::blake2s::constraints::evaluate_blake2s_with_parameters;
use ark_crypto_primitives::prf::Blake2sWithParameterBlock;
use ark_ff::{One, PrimeField};
use ark_mnt4_753::Fr as MNT4Fr;
use ark_mnt6_753::constraints::G1Var;
use ark_mnt6_753::G1Affine;
use ark_r1cs_std::fields::fp::FpVar;
use ark... |
// External deps
use zkdpos_crypto::franklin_crypto::{
bellman::pairing::{
bn256::{Bn256, Fr},
ff::{Field, PrimeField},
},
rescue::RescueEngine,
};
// Workspace deps
use zkdpos_crypto::{
circuit::{
account::CircuitAccountTree,
utils::{append_be_fixed_width, le_bit_vector_... |
//! --- Part Two ---
//!
//! It turns out that this circuit is very timing-sensitive; you actually need to minimize the
//! signal delay.
//!
//! To do this, calculate the number of steps each wire takes to reach each intersection; choose
//! the intersection where the sum of both wires' steps is lowest. If a wire visi... |
use crate::{
alphabets, auth_urls,
clients::{mutex::Mutex, BaseClient, OAuthClient},
generate_random_string,
http::{Form, HttpClient},
join_scopes, params, ClientResult, Config, Credentials, OAuth, Token,
};
use std::collections::HashMap;
use std::sync::Arc;
use maybe_async::maybe_async;
use sha2:... |
use super::{
cst::{self, Cst, CstKind},
rcst::Rcst,
string_to_rcst::StringToRcst,
};
use crate::input::Input;
use std::sync::Arc;
#[salsa::query_group(RcstToCstStorage)]
pub trait RcstToCst: StringToRcst {
fn cst(&self, input: Input) -> Option<Arc<Vec<Cst>>>;
}
fn cst(db: &dyn RcstToCst, input: Input)... |
use super::{
ast,
error::{
MBQLError,
MBQLErrorKind,
},
Position,
};
use crate::{
search::SearchContext,
ArtifactId,
MBError,
MindBase,
Symbol,
};
use std::{
collections::BTreeMap,
io::Cursor,
sync::Mutex,
};
struct ArtifactVarMapItem {
offset: usize,... |
extern crate sdl2;
use sdl2::pixels::Color;
use sdl2::rect::Rect;
use sdl2::event::Event;
use crate::view_components::{ViewComponent, IntoViewComponent};
use crate::backend::system::window::Window;
use crate::colors;
use crate::Orientation;
use super::{Widget, WidgetState};
use super::Text;
pub struct ScrollBar<T> {... |
use std::fmt::{self, Display, Formatter};
use ton_block::{
Message, EnqueuedMsg, MsgEnvelope, AccountIdPrefixFull, OutMsgQueueKey,
Deserializable, Grams, ShardIdent, ConfigParams, AddSub,
};
use ton_executor::{CalcMsgFwdFees};
use ton_types::{error, fail, Result, AccountId, Cell, SliceData, UInt256};
#[derive(... |
//! Spawns child process from a MessageHeader
#![allow(dead_code)]
use std::ffi::OsStr;
use std::io;
use std::process::{Child, Command, Stdio};
use chrono::{DateTime, Utc};
use sameold::{MessageHeader, UnrecognizedEventCode};
/// Spawn a child process to handle the given message
///
/// The child process will recei... |
#![feature(const_fn)]
use std::io::ErrorKind;
use std::env;
use std::sync::Arc;
use anyhow::{anyhow, bail, Context};
use atk::prelude::*;
use directories::ProjectDirs;
use env_logger::Env;
use gdk::keys::constants as keys;
use gdk::{Screen, WindowTypeHint};
use gio::prelude::*;
use glib::clone;
use gtk::prelude::*;
u... |
//! Response types
use http::{
header::{HeaderMap, HeaderValue, CONTENT_TYPE},
Response,
};
use serde::{
ser::{Error as SerError, SerializeMap},
Serializer,
};
use serde_derive::Serialize;
use crate::body::Body;
/// Representation of API Gateway response
#[derive(Serialize, Debug)]
#[serde(rename_all... |
// Copyright 2021, 2022 <NAME>
//! Print messages and progress bars on the terminal.
use std::time::Instant;
use ::console::{style, StyledObject};
use anyhow::Result;
use indicatif::{ProgressBar, ProgressStyle};
use crate::lab::Scenario;
use crate::mutate::Mutation;
use crate::outcome::{Outcome, Phase};
use crate::... |
// vim: tw=80
pub use crate::cache::{Cacheable, CacheRef};
use crate::{
writeback::Credit,
types::*,
util::*
};
use divbuf::DivBufShared;
use futures::Future;
#[cfg(test)] use mockall::automock;
use serde_derive::{Deserialize, Serialize};
use std::{
num::NonZeroU8,
pin::Pin
};
/// Compression mode... |
use std::{
fmt::{self, Display},
io,
net::SocketAddr,
pin::Pin,
task::{Context, Poll},
};
use pin_project::pin_project;
use tokio::{
io::{AsyncRead, AsyncWrite, ReadBuf},
net::{TcpListener, TcpStream},
};
#[derive(Debug, Clone)]
pub enum Endpoint {
Tcp(SocketAddr),
#[cfg(unix)]
... |
use curve25519_dalek::{
constants::{ED25519_BASEPOINT_POINT, ED25519_BASEPOINT_TABLE},
edwards::{CompressedEdwardsY, EdwardsPoint},
scalar::Scalar,
traits::{Identity, IsIdentity, MultiscalarMul, VartimeMultiscalarMul},
};
use rand_core::{CryptoRng, RngCore};
use core::convert::TryInto;
use crate::grou... |
use bevy::{input::mouse::*, prelude::*};
use bevy_prototype_lyon::prelude::*;
use crate::top_down_camera::{screen_to_world, TopDownCamera};
#[derive(Component)]
pub struct Selectable {
pub width: f32,
pub height: f32,
}
#[derive(Component, Default, Debug)]
pub struct SelectionRect {
pub first_x: Option<... |
pub mod half_life;
use flagset::{flags, FlagSet};
use serde::{de::Visitor, Deserialize, Serialize};
use serde_with::DeserializeFromStr;
use std::hash::Hash;
use crate::error::Error;
use crate::regex;
#[rustfmt::skip]
#[derive(Debug, Hash, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum Symbol {
SF,... |
// Copyright 2020 Netwarps Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, dis... |
use std::mem::ManuallyDrop;
use std::ptr;
use gfx_hal::{
adapter::Adapter,
command,
format::{self as hal_format},
pool::CommandPoolCreateFlags,
prelude::*,
pso::{Rect, Viewport},
queue::{family},
window as hal_window, Backend, Features, Instance,
};
use winit::{
dpi::{LogicalSize, P... |
use crate::callback::OptionalCallback;
use crate::transport::TransportType;
use crate::error::{Error, Result};
use crate::packet::{HandshakePacket, Packet, PacketId, Payload};
use bytes::Bytes;
use std::convert::TryFrom;
use std::sync::RwLock;
use std::{fmt::Debug, sync::atomic::Ordering};
use std::{
sync::{atomic... |
use std::io::{Error, ErrorKind};
use std::str::FromStr;
use log::info;
use crate::datastore::Datastore;
use crate::migration::rename_backups_to_dumps::RenameBackupsToDump;
use crate::migration::update_version_number::UpdateVersionNumber;
use crate::utils::get_replibyte_version;
pub mod rename_backups_to_dumps;
pub m... |
//! `syms` utility
//!
//! Read symbol information from DLLs, SOs, Dylibs, and o/obj object files.
// Useful list from:
// https://github.com/rust-unofficial/patterns/blob/master/anti_patterns/deny-warnings.md
#![deny(
missing_debug_implementations,
missing_copy_implementations,
missing_docs,
trivial_c... |
use crate::link::utils::task_park::*;
use crate::{link::QueueStream, HStream, Link};
use crossbeam::atomic::AtomicCell;
use crossbeam::crossbeam_channel;
use crossbeam::crossbeam_channel::{Receiver, Sender};
use futures::prelude::*;
use futures::ready;
use futures::task::{Context, Poll};
use std::pin::Pin;
use std::syn... |
use std::{collections::HashMap, sync::Arc};
use crossbeam::channel::Sender;
use locutus_node::{
either::Either, ClientRequest, HostResponse, PeerKey, RequestError, SqlitePool,
};
use locutus_runtime::{prelude::*, ContractRuntimeError};
use crate::DynError;
type Response = Result<HostResponse, Either<RequestError... |
#![feature(custom_derive)]
#![feature(fn_traits)]
#![feature(associated_type_defaults)]
#[macro_use] extern crate log;
#[macro_use] extern crate mydht_base;
#[macro_use] extern crate serde_derive;
extern crate readwrite_comp;
extern crate serde;
extern crate serde_json;
extern crate bincode;
extern crate byteorder;
ex... |
//! Pedersen hash functions and helpers.
use bitvec::prelude::*;
use rand_core::{CryptoRng, RngCore};
use super::super::keys::find_group_hash;
/// I_i
///
/// Expects i to be 1-indexed from the loop it's called in.
///
/// https://zips.z.cash/protocol/protocol.pdf#concretepedersenhash
#[allow(non_snake_case)]
fn I_i... |
//! The HTTP listener.
use std::io;
use std::convert::Infallible;
use std::future::Future;
use std::net::{SocketAddr, TcpListener as StdListener};
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use futures::pin_mut;
use futures::future::{pending, select_all};
use hyper::Server;
use hyper::serve... |
//! Module implementing the tensor product of graphs.
#![allow(type_alias_bounds)]
use std::borrow::Borrow;
use super::sparse;
use itertools::{Itertools, Product};
use crate::{Digraph, InGraph, OutGraph};
#[allow(missing_docs)]
pub type Vert<G0: Digraph, G1: Digraph> = (G0::Vert, G1::Vert);
#[allow(missing_docs)]... |
use std::{cell::RefCell, collections::HashMap, rc::Rc};
use crevice::{glsl::GlslStruct, std140::AsStd140};
use nalgebra::{Point2, Vector2};
use crate::{
data::{Mesh, Sprite, SpriteVertex},
geom::Rect,
gl::{
self, DrawParams, DrawUnit, Framebuffer, NewFramebufferError, Texture, TextureParams,
... |
use crate::pixel::Pixel;
use getset::Getters;
use itertools::Itertools;
use std::collections::HashMap;
use std::net::SocketAddrV4;
use std::io::Write;
use std::num::Wrapping;
use num_traits::Zero;
use std::net::UdpSocket;
use speedy::Writable;
use zerocopy::AsBytes;
#[derive(Writable)]
struct PacketHeader {
cid: u... |
extern crate clap;
extern crate csv;
extern crate futures;
extern crate ipnet;
extern crate itertools;
extern crate log;
extern crate reqwest;
extern crate serde;
extern crate serde_json;
extern crate simplelog;
extern crate tokio;
mod delegation;
mod tree;
use clap::{values_t_or_exit, App, Arg, ArgGroup};
use ipnet:... |
//! Serialization and de-serialization for TAC code.
use std::{fmt::Display, writeln};
use ty::FuncTy;
use util::ListFormatter;
use crate::*;
pub trait FormatContext<C> {
fn fmt_ctx(&self, f: &mut std::fmt::Formatter<'_>, ctx: C) -> std::fmt::Result;
}
impl<T, C> FormatContext<C> for &T
where
T: FormatConte... |
use std::fs::File;
use std::io::prelude::*;
mod vector;
use vector::{Vec2f, Vec3f};
#[derive(Copy, Clone)]
struct Material {
diffuse_color: Vec3f,
albedo: Vec2f,
specular_exponent: f32,
}
impl Material {
fn new(albedo: Vec2f, diffuse_color: Vec3f, specular_exponent: f32) -> Self {
Self {
... |
//! This module contains the logic for the `rtlola-analyze` binary.
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::path::PathBuf;
use clap::{App, Arg, SubCommand};
use pest::Parser;
use simplelog::*;
use crate::analysis;
use crate::ir::lowering::Lowering;
use crate::parse::{LolaParser, R... |
/*
Copyright (C) 2018-2019 <EMAIL>
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, su... |
#[macro_use] extern crate serde_derive;
extern crate serde;
extern crate serde_yaml;
extern crate csv;
extern crate tina;
#[macro_use] extern crate slog;
#[macro_use] extern crate slog_scope;
extern crate slog_term;
mod config;
use std::io::stdout;
use std::env;
use std::fs::OpenOptions;
use std::sync::mpsc::sync_cha... |
use super::*;
/// Builds "where" argument.
pub(crate) fn where_argument(ctx: &mut BuilderContext, model: &ModelRef) -> InputField {
let where_object = filter_objects::where_object_type(ctx, model);
input_field("where", InputType::object(where_object), None).optional()
}
/// Builds "where" argument which inpu... |
// Copyright 2018 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in ... |
#![crate_name = "lagoinha"]
//! Lagoinha is a library that retrieves Addresses from the Brazilian Postal Code (CEP) using multiple APIs asynchronously, and returns the result from the first one to respond.
//! It uses async/.await and the Futures library for its asyncronous features, and can be used with most runtimes.... |
use std::path::PathBuf;
use log::info;
use markovian_core::generator_wrapper::generate_words;
use markovian_core::symbol::{SymbolTable, SymbolTableEntry, TableEncoding};
use markovian_core::symboltable_wrapper::SymbolTableWrapper;
use structopt::StructOpt;
use super::improve_symbols::{improve_symbol_table, ImproveSym... |
use crate::core::eval::ast;
use crate::core::eval::error::*;
use std::collections::HashMap;
pub(crate) struct Parser<'a> {
tokens: Vec<ast::Token<'a>>,
pos: usize,
infix_op: HashMap<ast::Operator, u16>,
prefix_op: HashMap<ast::Operator, u16>,
}
impl<'a> Parser<'a> {
pub(crate) fn new(tokens: Vec<a... |
pub struct Asset {
owner: Option<usize>, // usize is a reference to a players turn_idx
house_num: u32,
has_hotel: bool,
is_mortgaged: bool
}
#[derive(PartialEq, Eq, Hash, Debug)]
pub struct Player {
name: String,
position: usize, // the index of the board square
turn_idx: usize, // idx in t... |
#[macro_use]
extern crate log;
mod winapi;
extern crate widestring;
use std::ptr::{null_mut, null, read};
use widestring::WideCString;
use winapi::*;
#[derive(Clone,Default,Debug)]
pub struct CodeSigned {
pub path: String,
pub signed: Option<bool>,
pub catalog: bool,
pub issuer_name: String,
pub... |
use crate::name::{name, Name};
use std::fmt;
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum Signedness {
Signed,
Unsigned,
}
impl Signedness {
pub fn is_signed(self) -> bool {
self == Signedness::Signed
}
}
#[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)]
pub enum IntBitness {
... |
//! Abstract functionality used by keygen, sign, etc.
use tofn::{
collections::TypedUsize,
sdk::api::{Protocol, ProtocolOutput, Round},
};
// tonic cruft
use super::{proto, ProtocolCommunication};
use tokio::sync::mpsc::{UnboundedReceiver, UnboundedSender};
// logging
use tracing::{debug, error, span, warn, ... |
use std::ffi::OsString;
use std::os::windows::ffi::OsStringExt;
use std::path::PathBuf;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::{mem, ptr};
use winapi::ctypes::c_void;
use winapi::shared::guiddef::REFIID;
use winapi::shared::minwindef::{DWORD, MAX_PATH, UINT, ULONG};
use winapi::shared::windef::{HWND,... |
use failure::Error;
use std::cell::RefCell;
use std::fmt::{self, Debug};
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use crate::{AnyFunction, DataGenOutput, DynFun, ProgramContext, RunnableFunction};
pub struct Resetter {
value: AtomicBool,
bytes: AtomicBool,
}
impl Resetter {
fn new() ... |
mod annotation;
mod authorization_policy;
mod server_authorization;
use crate::{defaults::DefaultPolicy, index::*, server_authorization::ServerSelector, ClusterInfo};
use ahash::AHashMap as HashMap;
use kubert::index::IndexNamespacedResource;
use linkerd_policy_controller_core::{
AuthorizationRef, ClientAuthentica... |
use crate::prelude::*;
use mw_common::grid::map::CompactMapCoordExt;
use mw_common::game::{ProdState, MineKind, MapDataInit, TileKind, MapDescriptor};
use mw_common::plid::PlayerId;
use mw_common::grid::*;
use crate::assets::TileAssets;
use crate::AppGlobalState;
use self::tileid::CoordTileids;
pub enum MapLabels {... |
/*
fn longest_str(x: &str, y: &str) -> &str{ // throws compilation error
if x.len() > y.len() {
x
} else {
y
}
}
// function returns a reference and this reference is one of the input parameters.
// at compile time, compiler cannot infer which block in the "if-else" statement will be execute... |
use std::cmp::*;
use std::ops::Deref;
use failure::{bail, ensure, format_err, Error, Fail, Fallible};
macro_rules! return_err {
($e: expr) => {
return Err(Error::from($e));
};
}
#[derive(Debug, Fail)]
enum NodeErr {
#[fail(display = "node => {} is not dir", _0)]
NotDir(String),
#[fail(dis... |
use futures::{self, Future, Stream};
use ignore::WalkBuilder;
use parking_lot::Mutex;
use std::char::decode_utf16;
use std::ffi::OsString;
use std::fs;
use std::io::{self, Read, Seek, SeekFrom, Write};
use std::os::unix::fs::MetadataExt;
use std::path::PathBuf;
use std::sync::Arc;
use std::thread;
use xray_core::buffer... |
//! The main server structure and implementation.
use ws::{
Sender,
Handler,
Result,
CloseCode,
Handshake,
Message,
};
use rand::thread_rng;
use rand::seq::SliceRandom;
use crate::socket_message::SocketMessage;
use crate::message_action::MessageAction;
/// Contains the web socket output send... |
/*!
Book builder
*/
pub mod cache;
pub mod convert;
pub mod visit;
use std::{fs, path::Path};
use anyhow::*;
use futures::executor::block_on;
use crate::{
book::{walk, BookStructure},
build::{cache::CacheIndex, visit::AdocBookBuilder},
};
/// Builds an `adbook` structure into a site directory, making use o... |
use bracket_algorithm_traits::prelude::Algorithm2D;
use bracket_geometry::prelude::Point;
use num_rational::Rational32;
use std::{collections::HashSet, iter::Map, ops::RangeInclusive};
enum Cardinal {
North,
East,
South,
West,
}
struct Quadrant {
cardinal: Cardinal,
origin: Point,
}
impl Qu... |
use crate::visibility::Light;
pub use crate::world::{
explosion_spec,
player::{self, Player},
spatial::{Layer, Location},
};
use direction::CardinalDirection;
use entity_table::declare_entity_module;
use grid_2d::coord_2d::Axis;
use rgb_int::Rgb24;
use serde::{Deserialize, Serialize};
declare_entity_module... |
use futures::{future, ready, Stream};
use std::sync::{Arc, Weak};
use std::task::{Context, Poll};
use std::{fmt, future::Future, mem, pin::Pin};
use tokio::sync::{mpsc, AcquireError, OwnedSemaphorePermit as Permit, Semaphore};
use self::error::{SendError, TrySendError};
pub use tokio::sync::mpsc::error;
pub mod into_... |
use std::io::BufRead;
use crate::{cli, Day, PartResult, util, util::vec2d::Vec2d};
use std::error::Error;
use std::time::Instant;
use std::collections::{BinaryHeap, HashMap};
pub struct Day9;
fn up(point: (usize, usize)) -> (usize, usize) { (point.0.overflowing_sub(1).0, point.1) }
fn down(point: (usize, usize)) -> (... |
extern crate chrono;
extern crate postgres;
const POSTGRESQL_URL: &'static str = "postgresql://admin@localhost:5432/youtube";
const QUERY: &'static str = "SELECT time, channel_id, subs, views, videos FROM youtube.stats.metrics ORDER BY time ASC limit 1";
const DELETE: &'static str = "DELETE FROM youtube.stats.metrics ... |
use crate::cipher;
use crate::mapping::Mapping;
use crate::util;
use hamming;
use std::io::{Error, ErrorKind};
/// Attempts to decrypt a buffer encrypted with Vigenere XOR, using a key of
/// unknown size. Uses the given number of consecutive blocks to determine
/// potential key sizes, and tries the specified number ... |
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::{DiskExt, DiskType};
use std::ffi::{OsStr, OsString};
use std::mem::size_of;
use std::path::Path;
use winapi::ctypes::c_void;
use winapi::shared::minwindef::{DWORD, MAX_PATH};
use winapi::um::fileapi::{
CreateFileW, GetDis... |
use rocket::http::Status;
use rocket::response::{self, Responder, Response};
use rocket::Request;
use thiserror::Error;
use diesel::result::Error::NotFound;
use lettre::Message;
use std::io::Cursor;
use std::sync::mpsc::{SendError, TrySendError};
use validator::ValidationErrors;
#[derive(Error, Debug)]
pub enum Zauth... |
/*
* Copyright 2019-2021 <NAME>
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to ... |
use rusty_usn::record::{UsnRecord, UsnEntry};
use rusty_usn::usn::{UsnParser, IntoIterFileChunks};
// Python Libs
use pyo3::prelude::*;
use pyo3::types::PyDict;
use pyo3::PyIterProtocol;
use pyo3::types::PyString;
use pyo3::exceptions::RuntimeError;
// Python Filelike
use pyo3_file::PyFileLikeObject;
// Standard Lib... |
// This file is part of yash, an extended POSIX shell.
// Copyright (C) 2021 <NAME>
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) ... |
use std::sync::Arc;
use crate::advanced::text_handler;
use crate::api::BotApi;
use crate::listener::Lout;
use crate::types::*;
use crate::vision::*;
pub fn handle(api: BotApi, lout: &Arc<Lout>, raw: &RawMessage, is_edited: bool) {
let message = to_message(raw, is_edited);
macro_rules! maybe_field {
($name:i... |
use building_blocks_core::prelude::*;
/// 2D grid traversal algorithm by Amanatides and Woo.
pub struct GridRayTraversal2 {
// The current pixel position.
current_pixel: Point2i,
// Either -1 or +1 in each axis. The direction we step along each axis.
step: Point2i,
// The amount of time it takes to... |
use crate::utils::*;
use web_sys::*;
use wasm_bindgen::JsCast;
use std::cell::RefCell;
use std::collections::{HashMap, HashSet};
use std::convert::{TryFrom};
use std::rc::{Rc};
#[derive(Debug, Clone, Copy)]
pub struct Touch {
pub identifier : i32,
pub screen_x : i32,
pub screen_y : i32,
pub client_x ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.