text
stringlengths
3.09k
13.9k
// Copyright (c) 2021-present, Cruise LLC // // This source code is licensed under the Apache License, Version 2.0, // found in the LICENSE-APACHE file in the root directory of this source tree. // You may not use this file except in compliance with the License. use crate::env::{Env, Sym, VarKind}; use crate::ident::{...
use anyhow::Result; use hyper::{ body::{self, Buf}, Client, Uri, }; use hyper_tls::HttpsConnector; use rayon::iter::{ParallelBridge, ParallelIterator}; use std::{borrow::Cow, fs, io::Read, path::Path}; use html5ever::{ parse_document, tendril::TendrilSink, tree_builder::TreeBuilderOpts, Attribute, ParseOpt...
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. mod util; use cop_datatype::FieldTypeTp; use tipb::expression::ScalarFuncSig; use tipb_helper::ExprDefBuilder; use crate::util::{BenchCase, FixtureBuilder}; fn bench_top_n_1_order_by_impl( columns: usize, n: usize, b: &mut criterion::Ben...
#![deny(missing_docs)] #![cfg_attr(test, deny(warnings))] #![deny(missing_debug_implementations)] #![doc(html_root_url = "https://docs.rs/futures-fs/0.0.5")] //! A thread pool to handle file IO operations. //! //! # Examples //! //! ```rust //! extern crate futures; //! extern crate futures_fs; //! //! use futures::{F...
use std::fs::File; use std::path::{Path, PathBuf}; use std::string; use std::{io, io::Read}; use thiserror::Error; pub struct Cartridge { title: String, cart_type: CartType, ram_size: u8, gb: GBType, sgb: bool, data: Vec<u8>, path: Option<PathBuf>, } impl Cartridge { pub fn new() -> Se...
use std::cell::RefCell; use std::os::unix::io::AsRawFd; use crate::{Reaction, Reactor, Result}; // use crate::signals::{Sender, Receiver, signal}; mod identities; mod epoll; pub(crate) mod evented; pub(crate) mod timer; use identities::Identities; use epoll::Flags; pub use epoll::Interest; // ----------------------...
use std::path::PathBuf; use image::{self, DynamicImage}; use serde::{Deserialize, Serialize}; #[cfg(target_os = "windows")] use winit::platform::windows::{IconExtWindows, WindowBuilderExtWindows}; use winit::{ dpi::Size, window::{Fullscreen, Icon, WindowAttributes, WindowBuilder}, }; use crate::monitor::{Moni...
use crate::ui; use std::{ io::{BufReader, Cursor}, num::NonZeroU32, sync::Arc, thread::JoinHandle, }; use tokio::sync::watch; use twitch::Message; pub const TTS_REQUESTS_PER_MINUTE: u32 = 5; pub const RETRY_ATTEMPTS: u8 = 3; pub const API_TIMEOUT_SECONDS: u64 = 180; pub const API_URL: &str = "https://m...
// Copyright 2016 The Cartographer Authors // // 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...
use std::path::{Path, PathBuf}; use std::sync::RwLock; use jni::{ errors::{ErrorKind, Result}, objects::{JObject, JString, JValue}, JNIEnv, }; use lazy_static::lazy_static; use ndk::asset::AssetManager; struct GlobalJNIEnv(pub *mut jni::sys::JNIEnv); unsafe impl Sync for GlobalJNIEnv {} unsafe impl Send...
use std::thread; use std::rc::Rc; #[derive(Debug)] struct Foo; trait Bar { fn baz(&self); } impl Bar for Foo { fn baz(&self) { println!("{:?}", self) } } fn static_dispatch<T>(t: &T) where T: Bar { t.baz(); } fn dynamic_dispatch(t: &dyn Bar) { t.baz(); } use std::fmt::Debug; pub trait Fly { ...
use clap::*; use intspan::*; use petgraph::prelude::NodeIndex; use petgraph::*; use std::collections::{HashMap, HashSet}; use std::io::BufRead; // Create clap subcommand arguments pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("merge") .about("Merge overlapped ranges via overlappin...
use super::super::{ZxError, ZxResult}; use super::config::PciConfig; use super::nodes::PcieDeviceType; use alloc::boxed::Box; use core::convert::TryFrom; use kernel_hal::InterruptManager; use spin::*; #[derive(Debug)] pub enum PciCapacity { Msi(PciCapacityStd, PciCapacityMsi), Pcie(PciCapacityStd, PciCapPcie),...
use std::fs; use std::ops::Add; use std::path::Path; use anyhow::{anyhow, Result}; use lazy_static::lazy_static; use log::{error, info, warn}; use pathdiff::diff_paths; use regex::RegexBuilder; // NOTE [DartPostCObjectFnType] was originally [*mut DartCObject] but I changed it to [*mut c_void] // because cannot automa...
use nom::{ bytes::complete::take, combinator::{map, verify}, error::context, multi::count, number::complete::{le_u128, le_u32, le_u64, le_u8}, sequence::{terminated, tuple}, Offset, }; use crate::bytecode_file_format::{ ByteCodeOptions, BytecodeFile, CjsModuleTableEntry, FileHeader, Fun...
use cgmath::{Point2, Point3}; use clap::value_t; use collision::{Aabb, Aabb2, Aabb3}; use point_viewer::color::{Color, TRANSPARENT, WHITE}; use point_viewer::octree::octree_from_directory; use std::error::Error; use std::path::Path; use xray::generation::{ xray_from_points, ColoringStrategyArgument, ColoringStrateg...
use crate::contract::*; use cosmwasm_std::testing::{ mock_dependencies, mock_env, mock_info, MockApi, MockQuerier, MockStorage, }; use cosmwasm_std::{attr, from_binary, to_binary, OwnedDeps}; use protocol_cosmwasm::error::ContractError; use protocol_cosmwasm::structs::BridgeAddrResponse; use protocol_cosmwasm::tok...
use futures::future; use futures::future::Future; use futures::stream; use futures::stream::Stream; use futures_grpc::*; use error::Error; use iter::GrpcIterator; use result; use proto::metadata::Metadata; /// Either stream item or trailing metadata. pub enum ItemOrMetadata<T: Send + 'static> { Item(T), Tra...
extern crate divans; use ::std::io::{ErrorKind, BufReader, Result}; use std::env; use std::collections::HashMap; use divans::CDF16; use divans::BaseCDF; use std::vec; fn determine_cost(cdf: &divans::DefaultCDF16, nibble: u8) -> f64 { let pdf = cdf.pdf(nibble); let prob = (pdf as f64) / (cdf.ma...
use platform_types::{ScreenSpaceRect, ScrollXY}; use macros::{d}; use std::borrow::Cow; pub type Res<T> = Result<T, Box<dyn std::error::Error>>; #[derive(Clone, Copy, Debug, Default)] pub struct Point { pub x: f32, pub y: f32, } #[derive(Clone, Copy, Debug, Default)] pub struct TexCoords { pub min: Poin...
//! Block validator //! //! The block validator checks whether all the deploys included in the proto block exist, either //! locally or on the network. //! //! When multiple requests are made to validate the same proto block, they will eagerly return true //! if valid, but only fail if all sources have been exhausted. ...
//! # PolkaBTC Treasury Module //! Based on the [specification](https://interlay.gitlab.io/polkabtc-spec/spec/treasury.html). #![deny(warnings)] #![cfg_attr(test, feature(proc_macro_hygiene))] #![cfg_attr(not(feature = "std"), no_std)] #[cfg(test)] mod mock; #[cfg(test)] mod tests; #[cfg(test)] extern crate mocktopu...
use failure::Error; use log::info; use std::collections::BTreeMap; mod server; pub use crate::workload_type::server::{ReplicatedServer, SingletonServer}; mod task; pub use crate::workload_type::task::{ReplicatedTask, SingletonTask}; mod worker; pub use crate::workload_type::worker::{ReplicatedWorker, SingletonWorker...
//! Simple benchmark to test per-entity draw overhead. //! //! To measure performance realistically, be sure to run this in release mode. //! `cargo run --example many_cubes --release` //! //! By default, this arranges the meshes in a cubical pattern, where the number of visible meshes //! varies with the viewing angle...
use std::cmp::{PartialOrd, Ordering}; use super::node::Node; use super::ArgNames; /// Describes the lifetime of a variable. /// When a lifetime `a` > `b` it means `a` outlives `b`. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Lifetime { /// Return value with optional list of arguments that outlives other argume...
// Copyright 2019 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or d...
pub mod monster; pub mod solver; pub mod tile; use std::collections::HashMap; use std::fs; use crate::tile::*; fn main() { println!("part 1 result: {:?}", part1(&read_input_file())); println!("part 2 result: {:?}", part2(&read_input_file())); } fn read_input_file() -> String { return fs::read_to_string(...
#![allow(dead_code)] use crate::kbc::KBC; use crate::pic::PIC8259; use lazy_static::lazy_static; use pc_keyboard::{layouts::Us104Key, DecodedKey, Keyboard, ScancodeSet1}; use spin::Mutex; use x86_64::structures::idt::ExceptionStackFrame; // // Global state // lazy_static! { pub static ref KEYBOARD: Mutex<Keyboar...
#[derive(Debug)] pub enum TocVisit { EnteringChildren, LeavingChildren, Node(gst::TocEntry), } impl PartialEq for TocVisit { fn eq(&self, other: &TocVisit) -> bool { match *self { TocVisit::EnteringChildren => matches!(*other, TocVisit::EnteringChildren), TocVisit::Leavi...
// 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. mod constants; use self::constants::{ CHARACTERISTIC_NUMBERS, CUSTOM_SERVICE_UUIDS, DESCRIPTOR_NUMBERS, SERVICE_UUIDS, }; /// An assigned ...
use clap::Arg; use crate::exporters::*; use crate::sensors::{Record, Sensor, Topology}; use std::collections::HashMap; use std::thread; use std::time::{Duration, Instant}; /// An Exporter that displays power consumption data of the host /// and its processes on the standard output of the terminal. pub struct StdoutEx...
use std::collections::HashMap; use serde::{Deserialize, Deserializer}; use serde_json; use serde_urlencoded; use aws_lambda; use http; #[derive(Debug, Clone, PartialEq, Deserialize, Serialize)] pub struct ShortApiGatewayProxyRequest { pub path: String, #[serde(rename = "httpMethod")] pub http_method: Str...
mod channel_type; mod datetime_range; mod int64_range; mod literal_or_regex; use self::channel_type::ChannelType; use self::datetime_range::DateTimeRange; use self::int64_range::Int64Range; use self::literal_or_regex::{Int32OrRegex, StringOrRegex}; use crate::program::{Program, Video}; use num_traits::ToPrimitive; use...
use arduino_uno::prelude::*; use arduino_uno::hal::port::{Pin, mode::Output}; use super::DotScreen; /// The address of the register on the DotDisplay chip. #[derive(Clone, Copy)] #[repr(u8)] enum RegisterAddress { Column1 = 0x1, Column2 = 0x2, Column3 = 0x3, Column4 = 0x4, Column5 = 0x5, Colum...
// wasm-pack is full of crazy complexity, talk about uploading // to NPM, downloading binaries from internet whenever, and // littering ~/.cache when I prefer things to be more contained. // I'm sure somebody felt it was needed, but all I'm doing is // serving a wasm file to browser. // // I simply have no faith in was...
use std::convert::TryInto; use crate::FixedLengthHasher; const K: [u32; 64] = [ 0xd76aa478, 0xe8c7b756, 0x242070db, 0xc1bdceee, 0xf57c0faf, 0x4787c62a, 0xa8304613, 0xfd469501, 0x698098d8, 0x8b44f7af, 0xffff5bb1, 0x895cd7be, 0x6b901122, 0xfd987193, 0xa679438e, 0x49b40821, 0xf61e2562, 0xc040b340, 0x265e5a51...
use std::collections::BTreeMap; use std::mem; use std::sync::Arc; use std::time::Duration; use async_recursion::async_recursion; use color_eyre::eyre::Result; use rusoto_core::RusotoError; use rusoto_logs::{ CloudWatchLogs, CreateLogStreamRequest, InputLogEvent, PutLogEventsError, PutLogEventsRequest, }; use stop...
/** * programs, * * * * * */ use std::collections::BTreeMap; use nannou_osc::{Message, Type}; use crate::{Parameter, ParameterEnd, ParameterEndpoint, ParameterFactory, ParameterStore}; pub type Interpolator = fn(f32) -> f32; pub type Pid = u32; // list of interpolation mappings const INTERPOLATIONS : [...
use std::env; use std::io::Write; use std::path::{Path, PathBuf}; use std::process::{Command, Stdio}; use log::debug; use failure::format_err; use crate::errors::*; pub struct Git { pub host: String, pub token: String, repo_dir: PathBuf, } impl Git { pub fn new(host: &str, token: &str, repo_dir: &Pa...
use crate::config::ConfigRef; use crate::database::Database; use crate::database::DatabaseClient; use crate::database::Hierarchy as DbHierarchy; use crate::database::Region as DbRegion; use crate::handler::error::HandlerError; use crate::handler::error::HandlerResult; use crate::handler::util::handle_request; use crate...
// -*- mode: rust; -*- // // This file is part of `fancy-garbling`. // Copyright © 2019 Galois, Inc. // See LICENSE for licensing information. //! Provides objects and functions for statically garbling and evaluating a //! circuit. use crate::circuit::Circuit; use crate::error::{EvaluatorError, GarblerError}; use cra...
mod convert; pub mod alg; pub mod utils; use self::utils::{Orientation, HexShape}; /* Arbretrary 'Key' type for use in dictionary storage Must be unique for every coordinate within a given system */ #[derive(Clone, Copy, Hash, Eq, PartialEq, Default)] pub struct CoordKey(i32, i32, i32); impl F...
#![warn(clippy::all)] use chrono::NaiveTime; use clap::{App, Arg}; use regex::Regex; use std::fs::File; use std::io::Read; use std::path::PathBuf; use std::process::Command; #[derive(Debug, Clone)] struct Config { framerate: f32, input_aud: PathBuf, output_aud: PathBuf, input_avs: PathBuf, verbose...
extern crate micro_changelog; use core_model::*; use micro_changelog::repo::redis_key::*; use micro_changelog::stream::*; use micro_changelog::*; use move_model::*; use redis::{Client, Commands}; use std::collections::HashMap; use std::rc::Rc; use std::thread; use std::time::Duration; use uuid::Uuid; const GAME_STATES...
use super::{ Error, OneOrMany::{self, Many}, Structure, }; use chrono::{DateTime, NaiveDateTime, TimeZone}; use chrono_tz::Tz; use common::model::Opportunity; use once_cell::sync::Lazy; use serde_json::{from_value, Value}; pub static UID: Lazy<uuid::Uuid> = Lazy::new(|| uuid::Uuid::parse_str("a844e7ee-...
//! Referenced from: //! https://github.com/P3KI/bendy/blob/master/examples/decode_torrent.rs use bendy::{ decoding::{Error, FromBencode, Object, ResultExt}, encoding::AsString, }; /// Main struct containing all required information. /// /// Based on: [http://fileformats.wikia.com/wiki/Torrent_file]. /// /// ...
//! SNMPv3 Parser //! //! SNMPv3 is defined in the following RFCs: //! - [RFC2570](https://tools.ietf.org/html/rfc2570): Introduction to SNMP v3 //! - [RFC3412](https://tools.ietf.org/html/rfc3412): Message Processing and Dispatching for the //! Simple Network Management Protocol (SNMP) //! //! See also: //! ...
use crate::prelude::*; use std::ops::Range; use serde::{Deserialize, Serialize}; use slotmap::SlotMap; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum SelectionFragment { Range(Range<u32>), Single(u32), } #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub enum Selectio...
#[macro_use] extern crate clap; extern crate ncbitaxonomy; use std::path::Path; use std::process; use ncbitaxonomy::{NcbiTaxonomy, NcbiSqliteTaxonomy}; use std::process::exit; fn common_ancestor_distance(taxonomy: &dyn NcbiTaxonomy, name1: &str, name2: &str, only_canonical: bool) { match taxonomy.get_distance_to_...
// String are implemented as a collection of bytes, plus some methods to provide useful functionality // when those bytes are interpreted as tex. // // Rust has only one string type in the core language, which is the string slice `str` that is // usually seen in its borrowed form `&str`. // // The `String` type, which ...
use super::wrapping_number::{sequence_greater_than, sequence_less_than}; /// Used to index packets that have been sent & received pub type SequenceNumber = u16; /// Collection to store data of any kind. #[derive(Debug)] pub struct SequenceBuffer<T> { sequence_num: SequenceNumber, entry_sequences: Box<[Option<...
// Copyright (c) 2018-2020 MobileCoin Inc. //! MetadataStore - an LMDB database that stores metadata about the database. Right now this is //! limited to versioning information. use displaydoc::Display; use lmdb::{ Database, DatabaseFlags, Environment, Error as LmdbError, RwTransaction, Transaction, WriteFlag...
use crate::{ColumnInfo, Comparison, Formatter, TimeUnit}; use flexstr::{flex_fmt, FlexStr, IntoFlex, ToCase, ToFlexStr}; use indexmap::IndexMap; const CT_URL: &str = "https://github.com/nu11ptr/criterion-table"; // *** NOTE: These are in _bytes_, not _chars_ - since ASCII right now this is ok *** // Width of making a...
//! # Feed list //! //! Mock component to implement the feed list /** * MIT License * * tuifeed - Copyright (c) 2021 <NAME> * * 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 r...
use bytes::BytesMut; use std::{ fmt::Debug, io, marker::PhantomData, pin::Pin, task::{Context, Poll}, }; use futures::{Sink, Stream}; use log::error; use crate::{ codecs::NetlinkMessageCodec, sys::{AsyncSocket, SocketAddr}, }; use netlink_packet_core::{NetlinkDeserializable, NetlinkMessage...
use std::pin::Pin; use std::sync::Arc; use std::time::{Duration, SystemTime}; use futures::future::BoxFuture; use futures::task::{Context, Poll}; use futures::{ready, FutureExt, Stream}; use parking_lot::RwLock; use tokio::time; use block::{ForkProof, MicroBlock, ViewChange, ViewChangeProof}; use block_production::Bl...
use super::{Artifact, ArtifactCreator}; use crate::Error; use std::fs; use std::path::{Path, PathBuf}; use std::str::FromStr; use nom::{ branch::alt, bytes::complete::{is_not, tag, tag_no_case, take_until}, character::complete::{alpha1, alphanumeric1, char, multispace0, multispace1}, combinator::{map, ...
#[macro_use] extern crate criterion; extern crate flat_projection; use criterion::Criterion; use flat_projection::FlatProjection; use std::f64; const AACHEN: (f64, f64) = (6.186389, 50.823194); const MEIERSBERG: (f64, f64) = (6.953333, 51.301389); fn flat_distance(p1: (f64, f64), p2: (f64, f64)) -> f64 { let pro...
//! This crate provides a safe interface to the [Discord Game SDK]. //! //! *This crate is not official, it is not supported by the Discord Game SDK Developers.* //! //! The [Discord Game SDK] provides features such as, but not limited to: //! //! - Activities (Rich Presence) //! - Users, Avatars and Relationships //! ...
use std::str::Chars; #[derive(Debug, Clone)] pub struct Token { pub kind: TokenKind, pub span: Span, } #[derive(Debug, Clone, PartialEq)] pub enum TokenKind { OpenParen, CloseParen, Dot, Str(String), // e.g. "Hello, world!" Ident(String), // e.g. define Quote, True, False, ...
use screen_writer::{ScreenInfo, PIXEL_RGBA}; use dimension::Rect; pub trait Sprite<'a> { fn draw(&mut self, fixed_rect: &Rect, screen_info: &ScreenInfo); fn render( &mut self, parent_node_frame: &Rect, node_frame: &Rect, clip_to_bounds: bool, screen_info: &ScreenInfo, ...
/*! # System This module provides the tools for packages to communicate with the language runtimes. ### What can be sent to the language runtimes Calls to language runtimes are of two main types: 1) Distributed - These calls mean that batches of agents are worked on in multiple workers 2) Centralized - A...
use std::f32::consts::{FRAC_PI_2, FRAC_PI_3, FRAC_PI_4, PI}; use bevy::{ ecs::component::Component, input::{mouse::MouseButtonInput, ElementState}, math::Vec3Swizzles, utils::HashMap, }; use bitworks::*; use bevy_egui::{egui, EguiContext, EguiPlugin}; use bevy_mod_picking::*; use bevy_mod_raycast::*; ...
use std::collections::HashMap; use std::error::Error; use std::net::IpAddr; use std::sync::Arc; use ipnetwork::IpNetwork; use log::{debug, info, warn}; use tokio::{ self, net::TcpListener, sync::{mpsc, watch, RwLock}, }; use super::codec::{MessageCodec, MessageProtocol}; use super::{Poller, PollerTx, Sess...
#![no_std] use defmt_rtt as _; // global logger use panic_probe as _; // panic handler // Re-export dependencies, so test suite can use them. pub extern crate defmt; pub extern crate lpc8xx_hal; pub extern crate rotary_encoder_hal; pub extern crate stepper; use core::fmt::Debug; use lpc8xx_hal::{ cortex_m::asm,...
use ecamo_fastlyce::access_log::EcamoCustomLogLine; use ecamo_fastlyce::error::Error; use ecamo_fastlyce::key_bucket::FastlyPublicKeyBucket; const PROXY_ENDPOINT_PREFIX: &str = "/.ecamo/v1/p/"; const PUBLIC_KEY_DICTIONARY_NAME: &str = "ecamo_public_keys"; const LOG_ENDPOINT: &str = "ecamo_log"; const ACCESS_LOG_ENDPO...
use bincode; use dataflow::backlog::SingleReadHandle; use dataflow::prelude::*; use dataflow::Readers; use futures::future::{self, Either}; use std::cell::RefCell; use std::collections::HashMap; use std::{mem, time}; use tokio; use tokio::prelude::*; use noria::{ReadQuery, ReadReply}; /// If a blocking reader finds i...
use crate::common::{Addressable, Shared, shared, join_bytes}; use crate::apu::Apu; use crate::controllers::Controllers; use crate::memory::PpuMem; // TODO: this and PPUSCROLL status are somehow the same thing, but I'm really confused about how. enum AddressLatchStatus { Empty, HoldingHighByte(u8), } pub type ...
#!/usr/bin/env run-cargo-script // cargo-deps: ndarray, num #[macro_use(array)] extern crate ndarray; extern crate num; use ndarray::Array; fn vector_sum() { let a = Array::from_vec(vec![1., 2., 3., 4., 5.]); let b = Array::from_vec(vec![5., 4., 3., 2., 1.]); let mut c = Array::from_vec(vec![1., 2., 3., ...
// 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...
//! Implementation of the simple path according to the Rust spec as well as helpers in regards to //! this crate to make easy use of the path. use std::{ fmt::{self, Display}, str::FromStr, }; use unicode_xid::UnicodeXID; use crate::STD_CRATES; /// Errors that can happen when parsing a [`SimplePath`]. #[der...
// 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. #![recursion_limit = "256"] mod hci; mod types; use { anyhow::{Context, Error}, argh::FromArgs, fuchsia_async as fasync, futures::StreamE...
//! Generator-based streams for Rust and futures 0.3. //! //! ## What is this for? //! Rust ecosystem is currently moving towards asynchronous computation based on [Future](https://doc.rust-lang.org/nightly/std/future/trait.Future.html) trait and friends. One part of this is enabling us to write Futures-based code in s...
use rand::distributions::{Distribution, UniformClosedOpen, UniformClosedOpen01}; use rand::rngs::Rng; use super::Problem; pub fn genetic_algorithm<R, P, const D: usize>( rng: &mut R, number_of_iterations: usize, population_size: usize, tournament_size: usize, crossover_probability: f64, mutati...
use crate::config::Config; use crate::config::CONFIGURATION_SECTION; use crate::documents::Document; use crate::url_interner::UrlInterner; use crate::utils; use futures::stream::futures_unordered::FuturesUnordered; use futures::StreamExt; use parking_lot::RwLock; use rome_analyze::RuleCategories; use rome_diagnostics:...
#![cfg_attr(test, feature(test))] #[macro_use] extern crate log; #[macro_use] extern crate lazy_static; extern crate dirs; extern crate glob; extern crate nix; extern crate structopt; #[macro_use] extern crate failure; extern crate pest; #[macro_use] extern crate pest_derive; extern crate backtrace; #[cfg(test)] #[ma...
use std::collections::HashMap; use std::fmt::{Display, Formatter}; use itertools::Itertools; use crate::days::day_23::amphipod::Amphipod; use crate::days::day_23::consts::{EXTRA_LINES, HALLWAY_Y, is_not_in_front_of_a_room, ROOM_DEPTH_PART1, ROOM_DEPTH_PART2, STRIDE}; use crate::days::day_23::displacement::Displacemen...
use std::collections::{HashMap, HashSet}; use crate::node::Node; use crate::db::TrieDB; use crate::{Hash, NULL_HASH, hash}; pub trait Trie { fn get(&mut self, key: Vec<u8>) -> Vec<u8>; fn put(&mut self, key: Vec<u8>, value: Vec<u8>); } pub struct TrieCaptureFraudProof { root: Node, db: TrieDB, //...
use crate::app::Request; use crate::DAP2_PACKET_SIZE; use hs_probe_bsp::otg_hs::{UsbBus, UsbBusType}; use hs_probe_bsp::rcc::Clocks; use stm32ral::{otg_hs_device, otg_hs_global, otg_hs_pwrclk, usbphyc}; use usb_device::bus::UsbBusAllocator; use usb_device::prelude::*; use usbd_serial::SerialPort; mod dap_v1; mod dap_v...
//! # JWT //! //! `jwt` is a collection of utilities to parse JWTs (Json Web Tokens) //! //! ## Examples //! //! To parse a given JWT as a string: //! //! ```rust //! use jwtinfo::{jwt}; //! //! let token_str = "<KEY>"; //! match jwt::parse(token_str) { //! Ok(token) => { //! // do something with token //! as...
use std::ops::Range; use std::collections::{ HashMap, hash_map::Entry }; use crate::feature::Rnum; /// Maps the features of an ajacency representation to cursors within a /// string representation. #[derive(Debug,PartialEq)] pub struct Trace { atoms: Vec<Range<usize>>, bonds: HashMap<(usize, usize), usize>, ...
use std::convert::From; use std::error; use std::fmt; use std::io; use std::num; use std::result; use std::str; use std::string; use chrono::format; use rustc_serialize::base64; use xml::reader; /// The errors that can occur when parsing a property list. #[derive(Debug)] pub enum Error { /// The binary property li...
pub mod edges; pub mod graph; use crate::{ configs, defaults, helpers::err, network::{Graph, MetricIdx}, }; use log::info; use progressing::{bernoulli::Bar as BernoulliBar, Baring}; use std::io::Write; fn write_edges_to_file<W: Write>( writer: &mut W, graph: &Graph, writing_cfg: &crate::config...
extern crate libpulse_binding as pulse; extern crate libpulse_simple_binding as psimple; mod logger; use crypto::aead::AeadDecryptor; use crypto::aes::KeySize; use crypto::aes_gcm::AesGcm; use crypto::digest::Digest; use crypto::sha3::Sha3; use logger::Logger; use openssl::derive::Deriver; use openssl::pkey::PKey; us...
#![feature(proc_macro_quote)] use proc_macro::quote; use proc_macro::TokenStream; use proc_macro2::TokenTree; use syn::{parse_macro_input, Ident, LitInt, Token}; #[derive(Clone)] struct Seq { ident: Ident, start_range: LitInt, end_range: LitInt, body: Vec<proc_macro2::TokenTree>, inclusive: bool, }...
//! Defines the [`Event`] enum and related types. use std::sync::Arc; use std::time::Instant; use crate::invocation::CoordNumOf; use crate::invocation::EffectOf; use crate::invocation::Invocation; use crate::invocation::LogEntryOf; use crate::invocation::NodeOf; use crate::invocation::RoundNumOf; use crate...
// 当且仅当测试套件运行时,才条件编译 `test` 模块。 extern crate pi_lib; use pi_lib::ordmap::{OrdMap}; use pi_lib::sbtree::{Tree, new}; use pi_lib::atom::Atom; #[test] fn atom() { let a = Atom::from("aaa"); let b = Atom::from(String::from("aaa")); assert!(*a == String::from("aaa")); assert!(*a == *b); } // 需要一个辅助函数 fn show(t: &Ord...
// Implementation note: hyper's API is not adapted to async/await at all, and there's // unfortunately a lot of boilerplate here that could be removed once/if it gets reworked. // // Additionally, despite the fact that hyper is capable of performing requests to multiple different // servers through the same `hyper::Cli...
//! Benchmarks the variance of measures on the GPU. use futures::sync::oneshot; use futures::Future; use itertools::Itertools; use log::*; use std::sync::Mutex; use std::time::Duration; use telamon::device::Context; use telamon::explorer::local_selection; use telamon::{device, explorer}; use telamon_cuda as cuda; use t...
extern crate grt_amd as geobacter_runtime_amd; use std::mem::{size_of, }; use std::ops::*; use std::time::Instant; use rand::rngs::SmallRng; use rand::{Rng, SeedableRng, }; use grt_core::context::{Context, }; use grt_amd::{HsaAmdGpuAccel, GeobacterDeps, }; use grt_amd::alloc::*; use grt_amd::module::*; use grt_amd:...
extern crate itertools; extern crate clap; use std::process::exit; use std::io::{self,BufRead,BufReader,Write}; use std::fs::File; use std::fmt; use std::error::Error; use itertools::Itertools; use itertools::EitherOrBoth::{Both, Right, Left}; use clap::Arg; #[derive(Debug)] struct Difference { line: usize, ...
use bytes::BufMut; #[derive(Copy, Clone)] pub enum ServerType { Dedicated, NonDedicated, SourceTVRelay } #[derive(Copy, Clone)] pub enum OS { Linux, Windows, Mac } #[derive(Clone)] /// Information about a server returned by an A2FS_INFO request. pub struct Response { /// Protocol version...
use super::*; #[derive(Clone, Debug)] pub struct EnvVarsMapping { /// Size limit of the entity LFU cache. /// /// Set by the environment variable `GRAPH_ENTITY_CACHE_SIZE` (expressed in /// kilobytes). The default value is 10 megabytes. pub entity_cache_size: usize, /// Set by the environment v...
use std::iter; use crate::analysis::{Analysis, Api, Matchup, PlayoffMatchup, Seed}; use crate::markdown::*; use crate::nhlapi::{self, schedule::Date, schedule::Game, standings::TeamRecord, teams::Team}; use crate::simulation; pub struct MarkdownGenerator<'a> { api: &'a Api, an: &'a Analysis<'a>, schedule:...
#![deny( missing_docs, trivial_casts, trivial_numeric_casts, unstable_features, unused_import_braces, unused_qualifications, clippy::unwrap_used )] #![allow(clippy::type_complexity)] /*! A simple networking plugin for Bevy designed to work with Bevy's event architecture. Using this plugin ...
// // sg_voice.rs // Musical Sound Generator Framework // Sing Voice Class // // Created by <NAME> on 2022/03/15. // Copyright (c) 2022 <NAME>. // Released under the MIT license // https://opensource.org/licenses/mit-license.php // use std::rc::Rc; use std::cell::Cell; use crate::msgf_if; use crate::core::*; ...
//! Tokenize the input. pub mod parse; use std::ops; use std::str; use intcode_error::span::{s, S}; use intcode_error::{Error, Result}; /// The type of token yielded by the lexer. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Token { /// `:` Colon, /// `,` Comma, /// `#` Hash, /// `+` ...
pub mod models; pub mod schema; use crate::config::CONFIG; use crate::diesel; use crate::diesel::prelude::*; use crate::error::Error; use crate::filter::filter_movies; use crate::jsonwebtoken::{encode, Header}; use crate::types::data::{RateData, SigninData, SignupData}; use crate::types::query::MoviesQuery; use crate:...
// Copyright (c) 2020 DDN. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. extern crate iml_device; use chrono::{DateTime, Utc}; use device_types::{ mount::{FsType, Mount, MountOpts, MountPoint}, DevicePath, }; use iml_device::update...
#![allow(dead_code)] use rust_stemmers::{Algorithm, Stemmer}; use super::{CharClass, PartOfSpeech}; use super::Lang; use super::constants::CHAR_CLASSES_LATIN; use PartOfSpeech::{ Article, Preposition, Conjunction, Particle, }; const FUNCTION_WORDS: &[(PartOfSpeech, &'static str)] = &[ (Article, ...