text stringlengths 3.09k 13.9k |
|---|
/*!
This create provides weak pointers for [`Pin`]`<`[`Rc<T>`]`>` and [`Pin`]`<`[`Arc<T>`]`>`
## Motivation
[`Pin`]`<`[`Rc<T>`]`>` and [`Pin`]`<`[`Arc<T>`]`>` cannot be converted safely to
their `Weak<T>` equivalent if `T` does not implement [`Unpin`].
That's because it would otherwise be possible to do something l... |
use crate::IntoDarlingError;
use darling::FromMeta;
use proc_macro::TokenStream;
use proc_macro2::Span;
use query_tests_setup::ConnectorTag;
use quote::quote;
use std::convert::TryFrom;
use syn::{spanned::Spanned, Ident, Meta, Path};
#[derive(Debug, FromMeta)]
pub struct ConnectorTestArgs {
#[darling(default)]
... |
// Based on: https://github.com/tomaka/glium/blob/master/examples/support/camera.rs
extern crate cgmath;
use self::cgmath::{Matrix4, Point3, Vector3};
use self::cgmath::prelude::*;
use glium::glutin::ElementState::*;
use glium::glutin::Event;
use glium::glutin::VirtualKeyCode as KeyCode;
pub struct Camera {
aspe... |
mod args;
mod cmd;
mod mktemp;
mod range_specs;
use anyhow::{bail, Result};
use async_std::task::block_on;
use daemonize::Daemonize;
use nix::{sys::stat, unistd};
use std::{env, fs};
use crate::{
args::{Args, Mode},
cmd::{faces::faces, fifo::fifo, range_specs::range_specs},
mktemp::{temp_dir, temp_file, temp_id},
... |
//! Get the tags for an economic data series
//!
//! [https://research.stlouisfed.org/docs/api/fred/series_tags.html](https://research.stlouisfed.org/docs/api/fred/series_tags.html)
//!
//! ```
//! use fred_rs::client::FredClient;
//! use fred_rs::series::tags::{Builder, SortOrder, OrderBy};
//! use fred_rs::tags::Re... |
#![feature(exact_size_is_empty)]
use std::env::args;
use std::fmt::{self, Display, Formatter};
use std::fs::{self, File};
use std::io::{self, stdin, Read};
pub use m4_language_server::parser::{self, ParseError};
#[derive(Debug)]
enum Error {
RuntimeError(String),
ParseError(ParseError),
IoError(io::Error... |
use std::collections::HashSet;
use std::sync::Arc;
use futures::{Future, pin_mut};
use futures::StreamExt;
use tokio::sync::{Mutex, RwLock};
use tokio::time::{Duration, Instant};
use crate::errors::ServerResult;
use crate::metadata::compaction::CompactionCache;
use crate::metadata::correlation::CorrelationMetadataCac... |
#![feature(slice_concat_ext)]
#[macro_use]
extern crate failure;
#[macro_use]
extern crate pest_derive;
#[macro_use]
extern crate serde_derive;
use failure::Error;
use inflector::Inflector;
use pest::Parser;
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::stdin;
use std::slice::SliceConcatEx... |
use std::path::PathBuf;
use bytes::Bytes;
use primitive_types::{H160, U256};
use revm::{Database, EVMData, Gas, Inspector, Return, OPCODE_JUMPMAP};
use termwiz::lineedit::*;
use super::cli::CtrlCli;
#[derive(Debug)]
pub enum Ctrl {
Exit,
None,
Step,
//StepIn,
//StepOut,
Continue,
Restar... |
use std::collections::HashMap;
use allsorts::context::Glyph;
use allsorts::glyph_position::{GlyphLayout, GlyphPosition, TextDirection};
use allsorts::gpos::Info;
use allsorts::outline::{OutlineBuilder, OutlineSink};
use allsorts::pathfinder_geometry::line_segment::LineSegment2F;
use allsorts::pathfinder_geometry::tran... |
use JNIEnv;
use errors::*;
use objects::JClass;
use objects::JMethodID;
use objects::JObject;
use signature::JavaType;
use signature::Primitive;
/// Wrapper for JObjects that implement `java/util/Map`. Provides methods to get
/// and set entries and a way to iterate over key/value pairs.
///
/// Looks up the class ... |
use lexical_parse_float::float::{self, RawFloat};
use lexical_parse_float::limits::ExactFloat;
use lexical_util::num::Float;
#[test]
fn exponent_fast_path_test() {
assert_eq!(f32::min_exponent_fast_path(10), -10);
assert_eq!(f32::max_exponent_fast_path(10), 10);
assert_eq!(f32::max_exponent_disguised_fast_... |
use crate::share::List;
use crate::Syscalls;
// -----------------------------------------------------------------------------
// `Subscribe` struct
// -----------------------------------------------------------------------------
/// A `Subscribe` instance allows safe code to call Tock's Subscribe system
/// call, by ... |
use std::collections::HashMap;
use v1::json::*;
/// Extension specific data structures for `Root`.
pub mod extensions {
/// Header format for binary glTF (without the initial magic string).
#[cfg(feature = "KHR_binary_glTF")]
#[derive(Clone, Debug)]
#[repr(C)]
pub struct KhrBinaryGltfHeader {
... |
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use futures::future::FutureObj;
use futures::FutureExt;
use std::cell::UnsafeCell;
use std::sync::atomic::AtomicUsize;
use std::sync::atomic::Ordering::{Ac... |
use crc::Crc;
use std::io::{BufReader, BufWriter, Read, Write};
use std::fs::File;
#[derive(Debug, PartialEq, Clone)]
pub enum ChunkLocation {
Start,
End,
Unknown
}
#[derive(Debug, Clone)]
pub struct ChunkProperties {
pub ancillary: bool,
pub private: bool,
pub reserved: bool,
pub safe_to_copy: bool
}
impl... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
//! Utilities to interact with the `Litani` build accumulator.
use pulldown_cmark::escape::StrWrite;
use serde::Deserialize;
use std::collections::HashMap;
use std::path::Path;
use std::process::{Child, ... |
use bytes::Bytes;
use chrono::{DateTime, Utc};
use futures::{sink::SinkExt, FutureExt};
use http::{header::AUTHORIZATION, HeaderValue, Uri};
use serde::{Deserialize, Serialize};
use crate::{
config::{AcknowledgementsConfig, Input, SinkConfig, SinkContext, SinkDescription},
event::{Event, Metric, MetricValue},
... |
//! 16550 serial adapter driver for malta board
use super::SerialDriver;
use crate::drivers::device_tree::{DEVICE_TREE_INTC, DEVICE_TREE_REGISTRY};
use crate::drivers::IRQ_MANAGER;
use crate::drivers::SERIAL_DRIVERS;
use crate::drivers::{DeviceType, Driver, DRIVERS};
use crate::sync::SpinLock as Mutex;
use crate::{
... |
use std::collections::HashMap;
use std::net::{IpAddr, Ipv4Addr};
use std::sync::{Arc, Mutex};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::Receiver;
use std::thread::JoinHandle;
use std::time::Instant;
use pnet::datalink;
use pnet::datalink::Channel::Ethernet;
use pnet::datalink::NetworkInterfa... |
use bevy::{
math::{IVec2},
prelude::*,
utils::HashSet,
};
use bevy_ascii_terminal::Side;
use rand::{prelude::{StdRng, ThreadRng}, Rng, SeedableRng};
use sark_grids::Grid;
use crate::{config::{MapGenSettings}, monster::MonsterBundle, player::{Player}, shapes::Rect, GAME_SIZE, movement::Position};
pub struc... |
use amethyst::{
core::math::Vector3,
ecs::{Join, Read, ReadStorage, System, World, WriteStorage},
renderer::camera::Camera,
shred::{ResourceId, SystemData},
};
use camera_model::play::{CameraTargetCoordinates, CameraTracked, CameraZoomDimensions};
use derivative::Derivative;
use derive_new::new;
use kin... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::not_implemented;
use crate::signals::{Signal, SignalAction, UncheckedSignal};
use crate::syscalls::{SyscallContext, SyscallResult, SUCCESS};
use... |
mod address;
pub use address::*;
mod breakpoint;
pub use breakpoint::*;
mod memory_map;
pub use memory_map::*;
mod ptrace;
pub use ptrace::*;
mod registers;
pub use registers::*;
use elf::ELF;
const SEPARATOR: &str = concat!(
"----------------------------------------",
"---------------------------------------... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
anyhow::{anyhow, Context, Result},
clap::{App, Arg},
scrutiny_config::{Config, LoggingConfig, ModelConfig, PluginConfig, RuntimeConfig},
... |
#[allow(unused)]
const WHITELIST_FUNCTION: &'static [&'static str] = &["bpf_.*", "bcc_.*", "perf_reader_.*"];
#[allow(unused)]
const WHITELIST_TYPES: &'static [&'static str] = &[
"bcc_symbol",
"perf_reader",
"__sk_buff",
"xdp_action",
"xdp_md",
"sk_action",
"bpf_.*",
];
#[allow(unused)]
co... |
//! Common utility funcitons used across different modules
use std::{
collections::VecDeque,
io::{BufRead, Read, Write},
};
/// Clamp value to the value between `min` and `max`
#[inline]
pub fn clamp<T>(val: T, min: T, max: T) -> T
where
T: PartialOrd,
{
if val < min {
min
} else if val > m... |
use crate::raw::RawPoint;
use crate::simd::f32x4;
use alloc::vec::*;
#[derive(Copy, Clone, Debug, PartialEq)]
struct Curve {
a: Point,
b: Point,
c: Point,
}
impl Curve {
fn new(a: Point, b: Point, c: Point) -> Curve {
Curve {
a,
b,
c,
}
}
fn... |
use std::ops::{Deref, DerefMut};
use codespan_reporting::diagnostic;
use crate::{DiagnosticMessage, Label, Note, Severity, Span};
#[derive(Debug, Clone, PartialEq)]
pub struct Diagnostic {
severity: Severity,
code: usize,
message: String,
labels: Vec<Label>,
notes: Vec<Note>,
}
impl Diagnostic {... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
use {
fidl_fuchsia_diagnostics::{Interest, StringSelector},
fidl_fuchsia_logger::{LogInterestSelector, LogSinkControlHandle},
fidl_fuchsia_sys_int... |
extern crate cargo;
#[macro_use]
extern crate failure;
extern crate docopt;
extern crate env_logger;
extern crate semver;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate tabwriter;
extern crate tempdir;
#[cfg(feature = "debug")]
extern crate termcolor;
extern crate toml;
#[macro_use]
mod macro... |
use fc_blackbox::{BlackboxReader, BlackboxRecord};
use itertools::izip;
use nalgebra::{Rotation, Vector3};
use crate::util::sliding_average;
#[derive(Clone)]
pub struct GyroData {
pub timestep: f64,
pub time: Vec<f64>,
pub pitch: Vec<f64>,
pub yaw: Vec<f64>,
pub roll: Vec<f64>,
}
impl GyroData {
... |
/* Device tree blob parsing and writing
*
* Unit tests
*
* TODO: Generate DTBs on the fly from qemu and parse them
*
* (c) <NAME>, 2020.
*
* See LICENSE for usage and copying.
*/
use std::path::Path;
use std::fs::read;
use super::{DeviceTree, DeviceTreeBlob};
struct DeviceTrees
{
pub rv32: DeviceTree,
... |
#![forbid(unsafe_code)]
#![deny(clippy::unwrap_used, clippy::trivially_copy_pass_by_ref)]
#![warn(clippy::unwrap_in_result, clippy::missing_const_for_fn)]
use std::time::Duration;
use comm::serial::{SerialEvent, SerialSubscription};
use element::instrument::{
data_view::{Accelerometer, DataView, Magnetometer, Tem... |
use std::cmp::Ordering;
use std::collections::HashSet;
use std::ffi::OsStr;
use std::path::{Path, PathBuf};
use std::{fmt, iter};
use redscript::ast::Pos;
use redscript::error::Error;
use walkdir::WalkDir;
#[derive(Debug, Default)]
pub struct Files {
files: Vec<File>,
}
impl Files {
pub fn new() -> Self {
... |
use anyhow::{anyhow, Result};
use std::collections::HashMap;
use std::fmt::Display;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::ops::{Add, Sub};
pub fn solve_part1(f: File) -> Result<usize> {
let lines = BufReader::new(f)
.lines()
.map(|l| anyhow::Ok(parse_line(&l?))?)
.filter(|l| {
... |
mod args;
mod error;
mod git;
mod manifest;
mod process;
mod threadpool;
use args::{Args, Command};
use colored::*;
use error::{Error, Result};
use git::Git;
use manifest::GlProjects;
use std::path::Path;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::channel;
use std::sync::{Arc, Mutex};
use thre... |
use crate::git::version::{Version, Versions};
use crate::git::{Commit, ScanRange};
use anyhow::*;
use git2::Repository;
use std::str::FromStr;
pub(super) trait Findable<T, R> {
fn find_by(&self, v: &T) -> Result<R>;
}
impl Findable<Version, Commit> for Repository {
// TODO chang return type to more simple typ... |
extern crate clap;
extern crate apnotes_lib;
#[macro_use]
extern crate log;
extern crate diesel;
extern crate colored;
extern crate itertools;
extern crate flexi_logger;
extern crate apnotes_bin;
extern crate serde_json;
use clap::{ArgMatches};
use colored::Colorize;
use itertools::*;
use apnotes_lib::AppleNotes;
use ... |
use crate::draw::{Dimension, Position};
use crate::prelude::*;
use crate::widget::CrossAxisAlignment;
#[derive(Debug, Clone, Widget)]
#[carbide_exclude(Layout)]
pub struct HStack {
id: Uuid,
children: Vec<Box<dyn Widget>>,
position: Position,
dimension: Dimension,
spacing: Scalar,
}
impl HStack {
... |
use crate::borders::{Point, Size};
use crate::utils;
use image::codecs::jpeg::JpegEncoder;
use image::error::{ImageError};
use image::io::Reader as ImageReader;
use image::{DynamicImage, ImageBuffer, Pixel, Rgba, RgbaImage};
use std::cmp::{max, min};
use std::env;
use std::fs::File;
use std::io::{Error as IOError, Erro... |
use std::fmt::Debug;
use std::ops::Add;
// use types::{Function, Function1};
use crate::{Function1, Function};
/// Define a line search method, i.e., choosing an appropriate step width.
pub trait LineSearch: Debug {
/// Performs the actual line search given the current `position` `x` and a `direction` to go to.
... |
#![allow(dead_code)]
use anyhow::{anyhow, Result};
use crossbeam_channel::{select, unbounded, Receiver, Sender};
use std::{marker::PhantomData, thread::spawn};
struct Channel<To> {
pub rx: Receiver<u32>,
pub tx: Sender<u32>,
_ph: PhantomData<To>,
}
fn mk_chan<A, B>() -> (Channel<B>, Channel<A>) {
let... |
// Copyright (c) Meta Platforms, Inc. and affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use crate::special_names;
use arena_collections::list::List;
use names::FileSummary;
use obr::{
decl_parser_options::DeclParserOpt... |
use std::io::BufRead;
use std::io::BufReader;
use std::ops::Add;
use std::sync::{Arc, mpsc, Mutex};
use std::thread;
use std::time::{Duration, Instant};
use chrono::{Datelike, DateTime, NaiveDateTime, TimeZone, Utc};
use clap::{App, AppSettings, Arg};
use csv;
use nmea::Nmea;
use serde::Serialize;
use serialport::{Dat... |
use std::cmp;
use std::io::Read;
use std::io::Result;
#[derive(Debug)]
pub enum RBErrorKind {
Empty,
PeekReachedWrap,
NotEnoughBytesAvail,
}
pub type RBResult<T> = std::result::Result<T, RBErrorKind>;
#[derive(Debug)]
pub struct RingBuffer<const SIZE: usize> {
buf: [u8; SIZE],
peek_buffer: [u8; S... |
//! Adds a word or phrase to the broadcaster’s list of blocked terms. These are the terms that broadcasters don’t want used in their chat room.
//! [`add-blocked-term`](https://dev.twitch.tv/docs/api/reference#add-blocked-term)
//!
//! # Accessing the endpoint
//!
//! ## Request: [AddBlockedTermRequest]
//!
//! To use ... |
#![allow(dead_code)]
use anyhow::{bail, Result};
use ast::types::{
fn_dec::FnDecl,
literal::Literal,
node::Node,
type_annotation::TypeAnnotation,
var_dec::VarDecl,
};
use inkwell::{
builder::Builder,
context::Context,
module::Module,
passes::PassManager,
types::{AnyTypeEnum, BasicMetadataTypeEnum, BasicTypeE... |
use alloc::collections::BTreeMap;
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use smoltcp::phy::{Device, DeviceCapabilities, RxToken, TxToken};
use smoltcp::time::Instant;
use smoltcp::wire::*;
use stm32f7_discovery::{ethernet::EthernetDevice, system_clock};
use super::arp::ArpResponses;
pub type Stat... |
//! Code to convert from internal models to common models.
use std::ops::Mul;
use num_traits::ToPrimitive;
use rust_decimal::Decimal;
use chrono::{NaiveDateTime, DateTime, Utc};
use common::{trade, asset};
use model::{TradeHistory, TradeMatchItem};
lazy_static! {
/// Warning: This value here is a bug. Keeping i... |
use std::collections::HashMap;
use std::env::current_dir;
use std::io::prelude::*;
use std::path::PathBuf;
use std::{fs, io};
use ansi_term::{Color, Style};
use handlebars::template::TemplateElement;
use handlebars::{Handlebars, Template};
use handlebars_misc_helpers::setup_handlebars;
use crate::cli::Command;
impl ... |
#![allow(unused_variables)]
use std::fmt::Display;
use std::str::FromStr;
use std::time::Duration;
use chrono::prelude::*;
use serde::de::{self, Deserialize, Deserializer};
use serde_json::Number;
use json_uuid::Uuid;
#[derive(Debug, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case", deny_unknown_fields)]
p... |
//! A dropdown widget.
use druid::theme;
use druid::widget::prelude::*;
use druid::widget::{Flex, Label, LabelText};
use druid::{Affine, Data, Insets, LinearGradient, Point, Rect, RenderContext, Selector, UnitPoint, Widget, WidgetExt};
use crate::widget::common::Button;
use super::overlay;
const LABEL_INSETS: Insets... |
use std::vec::Vec;
use std::ops::Range;
use std::collections::HashMap;
use std::fs::File;
use std::io::{BufReader, BufRead};
use linked_hash_map::LinkedHashMap;
use rust_htslib::bam::record::Cigar;
use rust_htslib::bam::record::CigarStringView;
use rust_htslib::bam::Read;
use rust_htslib::bam::IndexedReader;
use anyhow... |
use serde::{Deserialize, Serialize};
use crate::model::{
ship::Ship,
status::Status,
class::Class,
point::Point,
impact::Impact,
impact::Impact::{Hit, Miss},
status::Status::Defeated,
gameerror::GameError,
gameerror::GameError::ShipAlreadyPlaced,
occupation::Occupation
};
use std... |
use crate::WSClient;
use std::sync::{Arc, Mutex};
use std::{collections::HashMap, time::Duration};
use super::{
utils::CHANNEL_PAIR_DELIMITER,
ws_client_internal::{MiscMessage, WSClientInternal},
Candlestick, OrderBook, OrderBookSnapshot, Ticker, Trade, BBO,
};
use log::*;
use serde_json::Value;
pub(super... |
use crate::*;
use mmrbi::*;
use mmrbi::cargo::metadata::Package;
use mmrbi::cargo::toml::package;
use mmrbi::fs::write_if_modified_with as wimw;
use std::collections::*;
use std::ffi::*;
use std::io::{self, BufRead, Write};
use std::path::*;
use std::process::Command;
pub fn dot_container(meta: &ContainerToml) -> ... |
mod utils;
extern crate js_sys;
extern crate web_sys;
// Macro to provide println!(..)-style syntax for logging to the javascript console.
macro_rules! log {
( $( $t:tt )* ) => {
web_sys::console::log_1(&format!( $( $t )* ).into());
}
}
extern crate derive_more;
use derive_more::{DerefMut,Display};
... |
use ggez::{graphics, mint::Point2, Context, GameError};
use semeion::*;
use super::{Cell, Kind};
use crate::env;
/// Constructs a new mesh for the Ant.
pub fn mesh(ctx: &mut Context) -> Result<graphics::Mesh, GameError> {
let mut mesh = graphics::MeshBuilder::new();
let center = Point2 { x: 0.0, y: 0.0 };
... |
// Copyright 2018 <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 in writi... |
//! Similar to the `Rectangle` widget however is drawn with rounded corners.
//!
//! The roundedness of the corners is specified with a `radius`. This indicates the radius of the
//! circle used to draw the corners.
use {Color, Colorable, Dimensions, Point, Positionable, Range, Rect, Scalar, Sizeable, Theme,
Widg... |
#![warn(clippy::pedantic)]
#![allow(dead_code)]
#![allow(unused_imports)]
use serde::Deserialize;
use serde_json::Result;
use std::env;
use std::fs::File;
use std::io::BufReader;
mod champions;
mod items;
use champions::*;
use items::Items::*;
use items::*;
#[derive(Debug, Deserialize)]
// Lists the players in the ... |
use pairing::{
Engine,
Field
};
use bellman::{
LinearCombination,
SynthesisError,
ConstraintSystem
};
use std::collections::HashMap;
#[derive(Debug, Copy, Clone)]
pub enum Variable {
Input(usize),
Aux(usize)
}
#[derive(Debug)]
enum NamedObject {
Constraint(usize),
Var(Variable),
... |
use reqwest::{Method, RequestBuilder};
use serde::{Deserialize, Serialize};
use crate::{ApiRequest, PixClient};
pub struct CobEndpoint<'a> {
inner: &'a PixClient,
}
#[derive(Debug, Copy, Clone, PartialEq, Serialize, Deserialize)]
#[allow(non_camel_case_types)]
pub enum CobrancaStatus {
ATIVA,
CONCLUIDA,
... |
// Copyright (c) 2016 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be ... |
use std::hash::{Hash, Hasher};
use std::path::{Path, PathBuf};
use std::sync::mpsc::{channel, Receiver};
use std::time::Duration;
use iced_futures::{futures, BoxStream};
use notify::{watcher, DebouncedEvent, RecommendedWatcher, RecursiveMode, Watcher};
const BUFFER_SIZE: usize = 10;
pub enum State {
/// The file... |
use async_trait::async_trait;
use futures::StreamExt;
use serde::{Deserialize, Serialize};
use tracing::{instrument, error};
use std::process::Stdio;
use std::sync::Arc;
use tokio::sync::Mutex;
use tokio::{
io::{AsyncBufReadExt, BufReader},
process::Child,
};
use tokio_stream::wrappers::LinesStream;
use uuid::U... |
use lru::{LruCache as LRU};
use crate::{Tree,TreeId,tree,Error,Point,Value,Storage,RA,SetupFields,EyrosErrorKind};
use std::collections::{HashMap,HashSet};
use async_std::{sync::{Arc,Mutex,RwLock}};
#[cfg(not(feature="wasm"))] use async_std::task::spawn;
#[cfg(feature="wasm")] use async_std::task::{spawn_local as spawn... |
use std::path::Path;
use std::fs::File;
use std::error::Error;
use std::io::Read;
use decode::decode_utf16_le;
use decode::decode_windows_1257;
use decode::decode_utf16_be;
use std::collections::HashMap;
use std::fs::read_dir;
use std::collections::HashSet;
#[derive(Debug, Serialize)]
pub struct DictEntry {
pub na... |
use std::str::FromStr;
use nekoton::core::models::TokenWalletVersion;
use nekoton_utils::pack_std_smc_addr;
use serde::{Deserialize, Serialize};
use ton_block::{AccountState, MsgAddressInt};
use crate::models::{Address, AddressDb};
#[derive(Debug, Deserialize, Serialize, Clone, opg::OpgModel, Eq, PartialEq, sqlx::Ty... |
//! Contains structs and methods for calculating estimated time
//! needed to crack a given password.
//!
//! # Example
//! ```rust
//! # use std::error::Error;
//! #
//! # fn main() -> Result<(), Box<dyn Error>> {
//! use zxcvbn::zxcvbn;
//! use zxcvbn::time_estimates::CrackTimes;
//!
//! let entropy = zxcvbn("<PASSWO... |
#[derive(Clone)]
pub enum Chunk {
Chain(usize, usize),
Chain3(usize, usize, usize),
Ref(usize),
Alt(Box<Chunk>, Box<Chunk>),
Lit(u8),
}
fn compile(data: &str) -> Chunk {
let sep = data.find(" | ");
if let Some(p) = sep {
let (head, tail) = data.split_at(p);
let (_, tail) = t... |
use rand;
use rand::RngCore;
use std::borrow::Borrow;
use std::cmp::max;
use std::hash::{Hash, Hasher};
use siphasher::sip::SipHasher13;
type FastHasher = SipHasher13;
use std::marker::PhantomData;
use std::mem;
macro_rules! cms_define {
($CountMinSketch:ident, $Counter:ty) => {
pub struct $CountMinSket... |
use std::{cell::RefCell, collections::HashMap};
use blirssa::{code::{BlockRef, FunctionRef},
typ::Type,
value::{Instruction, LabelValue}};
use inkwell::{basic_block::BasicBlock, values::FunctionValue};
use crate::{value::{lower_value, LLVMValue},
ModuleContext, typ::lower_integ... |
#![allow(dead_code)]
use crate::prelude::*;
use getopts::Options;
mod askpass;
mod base64;
mod buf;
mod nom;
mod prelude;
mod pubkey;
mod seckey;
mod sshbox;
fn usage(progname: &str, opts: Options, status: i32) {
let brief =
format!("usage: {} {{-c|-d|-e|-l}} [options] [files]", progname);
print!("{}"... |
use std::arch::x86_64::*;
use core::mem::transmute;
#[inline(always)]
pub fn odd_backslash_sequences(input: [__m256i; 2], prev_ov: &mut u64) -> u64 {
const EVEN_BITS: u64 = 0x5555_5555_5555_5555;
const ODD_BITS: u64 = 0xAAAA_AAAA_AAAA_AAAA;
let backslashes = unsafe {
let backslash_mask = br"\\\\\\... |
use serde::de;
use std::fmt;
use serde::de::{MapAccess, SeqAccess, Deserializer, Visitor};
use std::cell::Cell;
use serde::{Serialize, Deserialize, Serializer};
use serde::ser::SerializeStruct;
use yaxpeax_arch::Address;
use petgraph::graphmap::{GraphMap, NodeTrait};
use std::hash::Hash;
use std::collections::HashMap... |
use crate::log_file::LogFile;
use crate::{
Level, Opt, DEFAULT_LOG_LEVEL, DEFAULT_RETENTION_DAYS, DEFAULT_TIMEOUT_SECS, OPT_STATE, SEQ,
};
use chrono::{Date, Duration, Local, TimeZone};
use regex::Regex;
use std::fs;
use std::fs::{File, OpenOptions};
use std::ops::Add;
use std::path::Path;
use std::sync::Mutex;
la... |
//! platina is a simple parameterized golden file testing library.
//!
//! # Usage
//!
//! First, create a test by implementing [`Testable`] for a struct.
//! Then, create a new [`TestFile`], with the path to a platina test file.
//! Finally, run your tests.
//!
//! [`Testable`]: ../platina/trait.Testable.html
//! [`Te... |
use mpstthree::binary::struct_trait::end::End;
use mpstthree::binary::struct_trait::recv::Recv;
use mpstthree::binary::struct_trait::send::Send;
use mpstthree::role::broadcast::RoleBroadcast;
use mpstthree::role::end::RoleEnd;
use mpstthree::{checker_concat, create_meshedchannels, create_multiple_normal_role};
use pe... |
use crate::{
addresses::PROTOCOLS,
traits::Inspector,
types::{actions::Transfer, Classification, Inspection, Protocol},
DefiProtocol, ProtocolContracts,
};
use crate::model::{CallClassification, EventLog, InternalCall};
use crate::types::actions::{SpecificAction, Trade};
use crate::types::{Action, Tran... |
use crate::types::*;
use crate::error::KaramelErrorType;
pub struct NumberParser;
impl NumberParser {
fn increase(&self, tokinizer: &mut Tokinizer) -> char {
tokinizer.increase_index();
tokinizer.get_char()
}
fn get_digits(&self, tokinizer: &mut Tokinizer) -> (u8, u64) {
let mut n... |
#[doc = "Reader of register IDR"]
pub type R = crate::R<u32, super::IDR>;
#[doc = "Reader of field `ID15`"]
pub type ID15_R = crate::R<bool, bool>;
#[doc = "Reader of field `ID14`"]
pub type ID14_R = crate::R<bool, bool>;
#[doc = "Reader of field `ID13`"]
pub type ID13_R = crate::R<bool, bool>;
#[doc = "Reader of field... |
use std::convert::TryFrom;
use std::sync::{Arc, Weak};
#[cfg(feature="validator")]
use validator::validator::Validator;
use consensus::{
Consensus as AbstractConsensus,
AlbatrossConsensusProtocol,
};
use database::Environment;
use network::{NetworkConfig, Network as GenericNetwork};
use mempool::Mempool as Gen... |
use fltk::{
app::*,
dialog::*,
menu::*,
text::{TextBuffer, TextEditor},
window::Window,
};
use std::ops::{Deref, DerefMut};
use std::{fs, path};
#[derive(Debug, Clone)]
pub struct Editor {
pub editor: TextEditor,
filename: String,
}
impl Editor {
pub fn new(buf: TextBuffer) -> Editor {... |
use crate::{BPError, BPResult, Msg, NodeFunction, NodeIndex, Probability};
use std::cmp::Eq;
use std::fmt::Debug;
use std::hash::Hash;
#[derive(Clone)]
pub enum InputNeed {
AlwaysExceptFirst,
Always,
NeverExceptFirst,
Never,
}
#[derive(Clone)]
pub struct VariableNode<T, MsgT: Msg<T>> {
//TODO:
... |
use crate::{
error::{ConfigError, JsonType},
processors::{EventPatterns, PatternColor, StateProcessor},
};
use ansi_term::Color;
use regex::Regex;
use serde_json;
use std::{fs::File, io::BufReader};
type Result<T> = std::result::Result<T, ConfigError>;
#[derive(Debug)]
pub struct Config {
pub pattern_colo... |
use super::{constants, error::Error, roll::Roll, Result};
use std::cmp::{max, min};
const MAX_LENGTH: usize = 64;
const INSERT_COST: u32 = 1;
const REMOVE_COST: u32 = 1;
const REPLACE_COST: u32 = 2;
fn compute_distance(s1: &[u8], s2: &[u8]) -> u32 {
let mut t1: Vec<u32> = vec![0; MAX_LENGTH + 1];
let mut t2: ... |
use std::fmt;
use std::ops;
use std::str;
use crate::lex::Token;
use crate::parser;
pub struct Ast {
pub tok: Token,
pub children: Vec<Ast>,
grouped: bool,
}
#[doc(hidden)]
pub fn eval(ast: &Ast) -> f64 {
match ast.children.len() {
// numeric types
0 => match ast.tok {
Tok... |
//! The internal representation of a program.
use std::collections::HashMap;
use crate::parsing::{AbstractSyntaxTree, ConditionalID, Statement};
/// A basic, internal representation of the code. This is a series of basic blocks
#[derive(Debug)]
pub struct ControlFlowGraph {
blocks: Vec<BasicBlock>,
}
/// A basi... |
// TLE. Should work in release mode
struct Solution;
#[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)]
struct Balls(u64);
impl std::fmt::Display for Balls {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:064b} [", self.0)?;
for i in 0..22 {
let c = ... |
use crate::error::Result;
use arc_swap::ArcSwap;
use chrono::{DateTime, Utc};
use notify::{watcher, RecursiveMode, Watcher};
use serde_json::Value;
use std::collections::HashMap;
use std::sync::{mpsc::channel, Arc};
use std::thread;
use std::time::Duration;
use tera::{Result as TeraResult, Tera};
/// Holds all data re... |
pub mod date;
pub mod duration;
use rand::prelude::*;
use rocket::serde::Serialize;
use scylla::cql_to_rust::{FromCqlVal, FromCqlValError};
use scylla::frame::response::result::CqlValue;
use scylla::frame::value::{Value, ValueTooBig};
use scylla::FromRow;
use scylla::{BufMut, ValueList};
use struct_field_names::Struct... |
extern crate utils;
type Vec2 = utils::Vec2<isize>;
use itertools::Itertools;
use std::{
cmp::{max, min},
collections::HashSet,
fmt::{Debug, Display},
};
#[derive(Clone, Copy, PartialEq)]
enum Pixel {
Dark,
Lit,
}
impl Pixel {
fn other(self) -> Self {
match self {
Pixel:... |
#[macro_use] extern crate lazy_static;
use std::collections::HashMap;
use std::str::FromStr;
use regex::Regex;
use std::fmt::Formatter;
use std::error::Error;
use std::io::{BufReader, BufRead};
pub fn read_lines(path: &str) -> std::io::Result<Vec<String>> {
let file = std::fs::File::open(path)?;
BufReader::n... |
use super::*;
use parking_lot::Mutex;
#[derive(Default, Debug)]
pub struct Forwarder {
/// a id, mosly used for logging
id: usize,
/// The mutable data...
data: Mutex<ForwarderMutable>,
}
/// This is the mutable part of the Forwarder
#[derive(Debug, SmartDefault)]
pub struct ForwarderMutable {
///... |
use crate::scrapers;
use gtk::gdk::prelude::*;
use gtk::glib::{self, clone, MainContext, PRIORITY_DEFAULT};
use gtk::{gdk_pixbuf, Adjustment, Align, Picture};
use gtk::{prelude::*, Box, Orientation, ScrolledWindow};
use gtk::{ApplicationWindow, GestureZoom, Scale};
use gtk4 as gtk;
use std::cell::RefCell;
use std::fs::... |
use std::io;
use pssst::{Client, ClientReplyHandler, Server};
extern crate hex;
use rand_core::{OsRng, RngCore};
const KX_PUB_LEN: usize = 32;
fn get_msg() -> (String, Option<Vec<u8>>) {
let mut line = String::new();
io::stdin()
.read_line(&mut line)
.expect("Failed to read input line");
... |
use std::boxed::Box;
use std::cell::RefCell;
use std::error::Error;
use std::io::{self, Write};
use std::ops::Add;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use chrono::{DateTime, Utc};
use curl::easy::{Easy, HttpVersion, List, ReadError};
use curl_sys::{curl_easy_setopt, CURLoption};
use structopt::StructOpt... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.