text
stringlengths
3.09k
13.9k
use std::collections::HashSet; use itertools::all; use ndarray::{s, Array2}; // TODO: fix unused warning, and keep available for tests use crate::types::{AdventResult, Answer, Day, DayPart}; /// A number on a Day 4 bingo card type BingoCardNumber = u8; /// Holds one bingo card and the numbers on it. /// /// This is...
use crate::{FromInner, Inner, IntoInner}; use std::ffi::CStr; use std::net::SocketAddr; use uv::{uv_getnameinfo, uv_getnameinfo_t}; callbacks! { pub GetNameInfoCB( req: GetNameInfoReq, status: crate::Result<u32>, hostname: String, service: String ); } /// Additional data stored...
use super::util::{grow_array, grow_capacity}; use super::value::{free_value_array, Value, ValueArray}; pub const OP_CONSTANT: u8 = 0; pub const OP_RETURN: u8 = 1; pub const OP_NEGATIVE: u8 = 2; pub const OP_ADD: u8 = 3; pub const OP_SUBTRACT: u8 = 4; pub const OP_MULTIPLY: u8 = 5; pub const OP_DIVIDE: u8 = 6; pub typ...
use std::fs; use serde::Deserialize; use toml; #[allow(non_camel_case_types)] type ms = u64; #[serde(rename_all = "kebab-case")] #[derive(Deserialize, Clone, Debug)] pub struct CursedConfig { /// Phone type. Mainly affects which inputs control dialing. /// See table for supported values. /// /// |Typ...
use super::types::BufferState; use super::types::GpuGlobals; use super::types::SceneGlobals; use super::util; use tessellation_util::artifacts::TessellationData; use winit::event::VirtualKeyCode; use winit::window::Window; pub struct State { pub surface: wgpu::Surface, pub device: wgpu::Device, pub queue: ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Configuration register 0 for unit %s"] pub u0_conf0: crate::Reg<u_conf0::U_CONF0_SPEC>, #[doc = "0x04 - Configuration register 1 for unit %s"] pub u0_conf1: crate::Reg<u_conf1::U_CONF1_SPEC>, #[doc = "0x08 - Configurati...
//! hist //! //! This module provides implementation to draw histograms on a Display //! use crate::{FindRange, Range, Ring}; use embedded_graphics::geometry::{Point, Size}; use embedded_graphics::prelude::{DrawTarget, PixelColor, Primitive}; use embedded_graphics::primitives::{Line, PrimitiveStyle}; use embedded_grap...
#![cfg_attr( feature = "system_alloc", feature(alloc_system, allocator_api) )] #![cfg_attr(feature = "clippy", feature(plugin))] #![cfg_attr(feature = "clippy", plugin(clippy))] #[cfg(feature = "system_alloc")] extern crate alloc_system; #[cfg(feature = "system_alloc")] use alloc_system::System; #[cfg(featur...
use anyhow::{anyhow, Result}; use std::{ convert::TryInto, fs::{self, File}, io::{Read, Write}, path::{Path, PathBuf}, process::Command, }; //#region Constants const CLIENT_OUT_DIR: &str = "client/src/backend/wasm"; const OUT_DIR: &str = "server/build"; const MOD_DIR: &str = "server/worker"; const ...
use std::ops::Add; use std::cmp; #[derive(Clone, Debug, Copy)] enum Token { BracketL, BracketR, Comma, Num(usize), } impl Add for Token { type Output = Self; fn add(self, other: Self) -> Self { num_to_token(token_to_num(self) + token_to_num(other)) } } impl std::fmt::Display for T...
use std::marker::PhantomData; use query::{Query, Operand, WeightingOperator}; use perlin_core::utils::seeking_iterator::PeekableSeekable; use perlin_core::index::posting::{Posting, DocId}; pub type Pipeline<Out, T> = Box<Fn(DocId, &mut T, &str) -> PhantomData<Out> + Sync + Send>; pub type QueryPipeline<T> = Box<f...
//! PCAP file format //! //! See //! [https://wiki.wireshark.org/Development/LibpcapFileFormat](https://wiki.wireshark.org/Development/LibpcapFileFormat) //! for details. //! //! There are 2 main ways of parsing a PCAP file. The first method is to use //! [`parse_pcap`](fn.parse_pcap.html). This method requires to load...
//! Lifetime Interval //! //! See `Linear Scan Registry Allocation on SSA Form` by <NAME> and <NAME>. //! The livetime interval analyzer is passed the generated assembly code that still uses virtual //! registers. It returns a lifetime interval for each block + virtual register which tells during //! which operations t...
use hyper::{ header::{HeaderValue, AUTHORIZATION}, Request, }; use parking_lot::RwLock; use tracing::{info, trace}; use std::{fmt, future::Future, pin::Pin, sync::{Arc, Mutex}, task::{self, Poll}, time::{Duration, Instant}}; use crate::{token::Error, Credentials, Token, TokenSource}; pub struct AddAuthorizat...
use std::fmt; use crate::diagnostic::Diagnostic; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub enum Game { Th06, Th07, Th08, Th09, Th095, Th10, Alcostg, Th11, Th12, Th125, Th128, Th13, Th14, Th143, Th15, Th16, Th165, Th17, Th18, } macro_rules! max_game_str { () => { "th18" }; } impl...
use crate::experiments::{Assignee, CapLints, DeferredCrateSelect, Mode}; use crate::toolchain::Toolchain; use failure::{self, Fallible}; #[derive(Debug, Fail)] #[cfg_attr(test, derive(PartialEq, Eq))] pub enum CommandParseError { #[fail(display = "missing command")] MissingCommand, #[fail(display = "invali...
use std::fmt; /// Returns the quotient and remainder of `a` divided by `b`. pub(crate) fn quotient_and_remainder<T>(a: T, b: T) -> (T, T) where T: std::ops::Div<Output = T> + std::ops::Rem<Output = T> + Copy { (a / b, a % b) } pub(crate) struct Punctuated<'a, T> { vals: &'a [T], sep: &'static str, se...
use crate::utils; use iterative_methods::*; use std::cmp; use std::collections::HashMap; use std::env; use std::fs; use std::io::Write; use std::process::Command; use std::str::FromStr; use streaming_iterator::*; /// Write the full stream and a sequence of reservoir samples /// to yaml files. The stream /// is enumera...
//! All the physical units //! //! External links: //! - <https://en.wikipedia.org/wiki/International_System_of_Units> //! - <https://en.wikipedia.org/wiki/SI_unit> //! - <https://en.wikipedia.org/wiki/Order_of_magnitude> use crate::Magnitude; use core::fmt; // Base quantities // // - https://en.wikipedia.org/wiki/In...
use aoc::*; use std::cmp::Ordering; use std::collections::HashMap; use std::collections::HashSet; #[derive(Clone, Debug, Eq, PartialEq)] struct Step { name: char, prerequisites: HashSet<char>, } // Well, what did you expect? :D #[derive(Clone, Debug)] struct SantaLittleHelper { id: i32, last_worked_on...
use super::RunConfig; use crate::chunked_genome::{Chunk, ChunkedGenome}; use crate::coverage::{count_homopolymers_in_bam, BaseCounts}; use rayon::prelude::*; use std::io::Write; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::sync::Mutex; pub fn run_quantify_homopolymers(config: RunConfig) -> Result<(), (...
use super::errors::*; use super::{ dead_list_key, DatasetId, DeadListData, Generation, Object, ObjectPointer, ObjectRef, TreeInner, }; use crate::allocator::{Action, SegmentAllocator, SegmentId, SEGMENT_SIZE}; use crate::atomic_option::AtomicOption; use crate::cow_bytes::SlicedCowBytes; use crate::data_management::...
use std::collections::HashMap; use anyhow::Result; use gw_common::{CKB_SUDT_SCRIPT_ARGS, H256}; use gw_rpc_client::rpc_client::{QueryResult, RPCClient}; use gw_types::{ bytes::Bytes, core::ScriptHashType, offchain::{CollectedCustodianCells, DepositInfo, RollupContext, WithdrawalsAmount}, packed::{CellO...
// Copyright 2018 int08h, LLC all rights reserved. // // 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...
use std::str::FromStr; use std::env; pub use self::innards::Feature; #[cfg(target_arch = "x86_64")] pub use self::innards::Feature::{Baseline, MMX, SSE, SSE2, SSE3, SSSE3, SSE41, SSE42, AVX, AVX2}; #[cfg(target_arch = "arm")] pub use self::innards::Feature::{Baseline, NEON}; lazy_sta...
#![no_std] #![no_main] #[derive(PartialEq)] enum UsartInstance { USART1, USART2, } // pick a panicking behavior extern crate panic_halt; // you can put a breakpoint on `rust_begin_unwind` to catch panics // extern crate panic_abort; // requires nightly // exte...
//! Character models. use super::{ LodestoneInfo, id::{CharacterId, FreeCompanyId}, }; use chrono::{DateTime, Utc}; use ffxiv_types::World; use url::Url; use std::collections::BTreeMap; #[derive(Debug, Deserialize)] #[serde(rename_all = "PascalCase")] pub struct Character { #[serde(rename = "ID")] pub id:...
use data::ast; use std; use std::collections::HashMap; pub fn optimize(ast: &mut ast::AttrProgram) { inline_constants(ast); } //TODO: after add mid-step to translator, i.e. using simular to LLVM IR, make more advanced optimizations on it fn inline_constants(ast: &mut ast::AttrProgram) { fn inline_stmt(stmt: ...
use std::{ collections::BTreeMap, sync::mpsc::{Receiver, Sender}, thread::JoinHandle, }; use merge::Merge; use pallas::ouroboros::network::handshake::{MAINNET_MAGIC, TESTNET_MAGIC}; use serde_derive::{Deserialize, Serialize}; use strum_macros::Display; pub type Error = Box<dyn std::error::Error>; #[deri...
//! FUSE kernel driver communication //! //! Raw communication channel to the FUSE kernel driver. #[cfg(feature = "libfuse2")] mod fuse2; #[cfg(any(feature = "libfuse", test))] mod fuse2_sys; #[cfg(feature = "libfuse3")] mod fuse3; #[cfg(feature = "libfuse3")] mod fuse3_sys; #[cfg(not(feature = "libfuse"))] mod fuse_...
// wengwengweng use std::rc::Rc; use std::marker::PhantomData; use glow::HasContext; use super::*; use crate::Result; #[derive(Clone, Copy, Debug)] pub struct BlendDesc { pub src: BlendFac, pub dest: BlendFac, pub op: BlendOp, } #[derive(Clone, Copy, Debug)] pub struct BlendState { pub color: BlendDesc, pub a...
use crate::vec::{f32x3, f64x3}; use crate::ray::Ray; #[derive(Debug, Copy, Clone, PartialEq)] pub struct AABB { pub min_p: f32x3, pub max_p: f32x3, } impl AABB { pub fn new(min_p: f32x3, max_p: f32x3) -> Self { AABB{min_p, max_p} } pub fn update(&self, bbox: &AABB) -> AABB { AABB...
use { crate::{error_unless, wrapping_sum_of_bytes, Error, Fadt, Result}, accessor::{single, Mapper}, core::{ convert::{TryFrom, TryInto}, mem::size_of, }, x86_64::PhysAddr, }; #[derive(Debug)] pub struct Xsdt<M> where M: Mapper + Clone, { pub header: Header<M>, pub entry...
use std::fmt; use num_traits::{Float, Num, NumCast, One, ToPrimitive, Zero}; use crate::{ ops::{Exp, Pow, Round, Signed, Trig}, Finite, InfiniteError, IsFinite, IsNan, NanError, Real, ToOrd, }; #[derive(Debug)] pub enum FromStrError<P, C> { Parse(P), Check(C), } impl<P: fmt::Display, C: fmt::Display>...
// Copyright 2019 Twitter, Inc. // Licensed under the Apache License, Version 2.0 // http://www.apache.org/licenses/LICENSE-2.0 use crate::metrics::*; use serde_derive::{Deserialize, Serialize}; use strum_macros::{EnumIter, EnumString, IntoStaticStr}; #[derive( Clone, Copy, Debug, Deserialize, Enu...
use crate::{ crypto::{BatchMerkleProof, MerkleTree}, math::{field, polynom, quartic}, stark::ProofOptions, }; use sp_std::mem; use super::{utils, FriLayer, FriProof}; use alloc::string::String; use sp_std::vec::Vec; // VERIFIER // ===========================================================================...
use std::{convert::Infallible, net::SocketAddr}; use std::{ collections::HashMap, sync::{Arc, RwLock}, time::Duration, }; use axum::{ body::{Bytes, Full}, error_handling::HandleErrorLayer, extract::{Extension, Path, Query}, handler::Handler, http::{Response, StatusCode}, response::...
//! The example TOTP authenticator of this tutorial. //! //! While not a requirement from Trussed®, we use a pattern of declaring //! command/request inputs (`Register` and `Authenticate`) as Rust structs. //! //! This pushes (or can help to push) the question of lower-level protocol //! encodings outside of the "app",...
//! String processing algorithms. use std::cmp::min; use std::collections::{hash_map::Entry, HashMap, VecDeque}; mod kmp; mod z_algo; mod suffix_array; pub use kmp::*; pub use z_algo::*; pub use suffix_array::*; /// Prefix trie, easily augmentable by adding more fields and/or methods pub struct Trie<C: std::hash::Has...
use super::bind_error::*; use crate::meta::*; use crate::exec::*; use smallvec::*; use std::sync::*; use std::convert::*; use std::result::{Result}; /// /// Compiles a statement once it has been bound by bind_statement /// pub fn compile_statement(source: CellRef) -> Result<CompiledActions, BindError> { let mut ...
use std::iter::Iterator; use std::str::Chars; #[derive(Debug)] pub enum TokenType { // Single-character tokens. LeftParen, RightParen, LeftBrace, RightBrace, Comma, Dot, Minus, Plus, Semicolon, Slash, Star, // One or two character tokens. Bang, BangEqual, ...
use crate::alloc::{Allocator, Global}; use core::fmt; use core::iter::{FusedIterator, TrustedLen}; use core::mem::{self}; use core::ptr::{self, NonNull}; use core::slice::{self}; use super::Vec; /// A draining iterator for `Vec<T>`. /// /// This `struct` is created by [`Vec::drain`]. /// See its documentation for mor...
use crate::convert::{AttrChoice, AttrEnum, AttrField, AttrRecord, AttrTemplate, AttrType, AttrVariant}; use daml_lf::element::{ DamlAbsoluteTyCon, DamlChoice, DamlEnum, DamlField, DamlKind, DamlLocalTyCon, DamlRecord, DamlTemplate, DamlTyCon, DamlTyConName, DamlType, DamlTypeVarWithKind, DamlVariant, }; use std...
use std::collections::HashMap; use std::rc::Rc; use crate::ast::TypeDef; use crate::run::{BuiltinFunction, CompiledFunction, CompiledProgram, Inst, Instance, InstanceClass, Value}; #[derive(Debug, Clone)] pub enum RuntimeError { StackUnderflow, UndefinedName(String), Custom(String), } pub struct Runtime ...
//! //! The Zargo package manager `call` subcommand. //! pub mod error; use std::convert::TryFrom; use std::path::PathBuf; use std::str::FromStr; use colored::Colorize; use reqwest::Client as HttpClient; use reqwest::Method; use reqwest::Url; use serde_json::Value as JsonValue; use structopt::StructOpt; use zksync:...
//! This module implements lexing for string literals used in the JavaScript programing language. use super::{Cursor, Error, Tokenizer}; use crate::{ profiler::BoaProfiler, syntax::{ ast::{Position, Span}, lexer::{Token, TokenKind}, }, }; use std::{ io::{self, ErrorKind, Read}, str,...
use crate::{ AssumeRoleWithWebIdentityError, AssumeRoleWithWebIdentityRequest, AssumeRoleWithWebIdentityResponse, Sts, StsClient, }; use futures::{Async, Future, Poll}; use rusoto_core::credential::{ AwsCredentials, CredentialsError, ProvideAwsCredentials, Secret, Variable, }; use rusoto_core::request::Http...
use crate::imp::structs::root_value::RootValue; use crate::imp::structs::list_def_obj::{ ListDefMap}; use crate::imp::structs::list_value::ListDefValue; use crate::imp::structs::ref_def_obj::RefDefMap; use crate::imp::structs::param_type::ParamType; use crate::imp::structs::var_type::VarType; use crate::HashM; unsafe ...
#![feature(async_await)] use mayastor::bdev::nexus::nexus_label::{GPTHeader, GptEntry}; use std::io::{Cursor, Read}; const HDR_GUID: &str = "322974ae-5711-874b-bfbd-1a74df4dd714"; const PART0_GUID: &str = "ea2872a6-02ce-3f4b-82c4-c2147f76e3ff"; const PART1_GUID: &str = "a0ff1b47-2890-eb4c-a837-01df152f9442"; const CR...
use glutin::dpi::*; use glutin::GlContext; use glutin::GlRequest; use glutin::GlProfile; use std::mem; use std::ptr; use std::ffi::CStr; use crate::shader::*; use crate::cxdrawing::*; use crate::cxshaders::*; use crate::cxfonts::*; use crate::cxtextures::*; use crate::cxturtle::*; #[derive(Clone)] pub struct Cx{ ...
extern crate js_sys; use wasm_bindgen::prelude::*; use crate::math::{Vec2, vec2}; use crate::draw; use std::f64::consts::PI; use core::iter; use crate::utils::IndicesHelper; const G: f64 = 1.; const DENSITY: f64 = 1.; #[derive(PartialEq, Copy, Clone)] pub struct Body { position: Vec2, velocity: Vec2, mass...
#![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(dead_code)] #![cfg(windows)] extern crate libc; extern crate winapi; extern crate ws2_32; extern crate kernel32; extern crate widestring; #[allow(unused_imports)] use log::*; use self::widestring::WideString; use std...
use std::ffi::OsStr; use std::io::Write; use std::panic; use std::process::{Command, Stdio}; use std::time::Instant; #[cfg(any(feature = "png", feature = "jpeg"))] use imagefmt::ColFmt; #[cfg(any(feature = "png", feature = "jpeg"))] use itertools::{iproduct, Itertools}; use structopt::clap::Format; use structopt::St...
// btleplug Source Code File // // Copyright 2020 Nonpolynomial Labs LLC. All rights reserved. // // Licensed under the BSD 3-Clause license. See LICENSE file in the project root // for full license information. // // Some portions of this file are taken and/or modified from Rumble // (https://github.com/mwylde/rumble)...
//! Dummy configuration. use std::collections::HashMap; use std::convert::{TryFrom, TryInto}; use std::fmt::Display; use std::str::FromStr; use std::time::Duration; use config::{Config, ConfigError}; use libcdp::comm::sensor_broker::SensorType; use rand::Rng; use rand::prelude::{SliceRandom, ThreadRng}; use serde::{S...
use nalgebra::Vector3; use rand::distributions::{Distribution, Standard}; use rand::rngs::SmallRng; use rand::{Rng, SeedableRng}; use std::iter::repeat_with; use std::ops::{Add, AddAssign}; use glium::*; use space::*; const POINTS: usize = 1000; const CACHE_SIZE: usize = POINTS * 2; const THETA2: f32 = 0.01; const EP...
use probe_rs_rtt::RttChannel; use std::io::{Read, Seek, Write}; use termion::{ cursor::Goto, event::Key, raw::{IntoRawMode, RawTerminal}, screen::AlternateScreen, }; use tui::{ backend::TermionBackend, layout::{Constraint, Direction, Layout}, style::{Color, Modifier, Style}, widgets::{Bl...
use crate::bigint::{biguint_to_bits_le, biguint_to_bytes_be}; use crate::fields::Field256; use crate::proofs::binary::BinaryProof; use crate::secp256k1::{pedersen_commitment, point_mul, Point}; use crate::serialization::{Deserialize, Serialize}; use num_bigint::BigUint; use num_traits::identities::Zero; use num_traits:...
use rppal::gpio::{Gpio}; use rppal::spi::{Bus, Mode, SlaveSelect, Spi}; use std::thread; use std::time::Duration; use dw3000::{ self, hl, Config, time::Instant }; use nb::block; fn main() -> ! { /******************************************************* */ /************ BASIC CONFIGURATION **...
use std::{fmt, io::Read, str}; use crate::{global::flags::Flags, utils::read_public_key}; use ed25519_dalek as esdalek; use super::{error::InternalError, result::InternalResult}; /// Used to configure and give extra information to the [`Archive`](crate::archive::Archive) loader. /// Used exclusively in archive sour...
use std::fmt; use std::fmt::Write; use regex::Regex; use crate::bracket::br; use crate::chars::{LF, SP, TB, VO}; use crate::enums::Brac; lazy_static! { static ref LINEFEED: Regex = Regex::new(r"\n").unwrap(); static ref COMMA: Regex = Regex::new(r",").unwrap(); } pub trait Concat: IntoIterator { fn join...
use crate::data; use std::cmp; use std::mem; use indicatif::ProgressBar; use indicatif::ProgressStyle; use rand::rngs::SmallRng; use rand::seq::SliceRandom; use rand::FromEntropy; use rand::Rng; use rayon::iter::IntoParallelRefIterator; use rayon::prelude::ParallelIterator; use std::collections::hash_map::DefaultH...
use std::cmp::{min, max}; use std::rc::Rc; use std::fmt::{Display, Formatter}; use colored::*; #[derive(Clone, PartialOrd, PartialEq, Ord, Eq, Debug)] pub struct Source { pub src: String, } impl Source { pub fn simple() -> Source { Source { src: String::from("") } } pub fn new(src: String) -> ...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - control register"] pub rtccon: crate::Reg<rtccon::RTCCON_SPEC>, #[doc = "0x04 - Interrupt Mask register"] pub rtcinte: crate::Reg<rtcinte::RTCINTE_SPEC>, #[doc = "0x08 - Interrupt Pending register"] pub rtcintp: cra...
use std::vec::Vec; fn check_csv_length(values: &[Vec<String>], line_length: usize) -> Result<(), String> { if values.iter().all(|line| line.len() == line_length) { Ok(()) } else { Err("Values have inconsistent number of columns".to_string()) } } fn csv_sum(csv: &str) -> Result<Vec<Vec<Stri...
bitflags::bitflags! { struct Language: u32 { const SPIRV = 0x1; const METAL = 0x2; const GLSL = 0x4; } } #[derive(Hash, PartialEq, Eq, serde::Deserialize)] enum Stage { Vertex, Fragment, Compute, } #[derive(Hash, PartialEq, Eq, serde::Deserialize)] struct BindSource { s...
#![feature(duration_as_u128, test)] #[macro_use] extern crate log; extern crate env_logger; extern crate smoltcp; extern crate net2; extern crate rand; #[cfg(test)] extern crate test; use net2::raw_socket::{ LinkLayer, RawSocket, BufferReader }; use smoltcp::wire::{ self, EthernetFrame, EthernetProtocol, ...
use crate::errors::AppError; use crate::models::schema::alerts; use crate::models::schema::alerts::dsl::{_name, alerts as dsl_alerts, host_uuid, id}; use crate::ConnType; use diesel::*; use serde::{Deserialize, Serialize}; use std::path::PathBuf; use walkdir::WalkDir; #[derive(Identifiable, Insertable, Queryable, Deb...
extern crate commoncrypto_sys; extern crate hex; use hex::ToHex; const TO_HASH: &'static str = "The quick brown fox jumps over the lazy dog"; const TO_HASH_MD5: &'static str = "9e107d9d372bb6826bd81d3542a419d6"; const TO_HASH_SHA1: &'static str = "2fd4e1c67a2d28fced849ee1bb76e7391b93eb12"; const TO_HASH_SHA256: &'sta...
use std::sync::atomic::{AtomicI32}; use std::sync::atomic::Ordering::{Relaxed}; use std::sync::{Mutex}; use std::fmt::{Debug, Formatter}; use tokio::net::TcpStream; use tracing::{warn}; use crate::riverdb::{Result}; use crate::riverdb::server::{Connections, Connection}; use crate::riverdb::pg::{BackendConn, Isolatio...
// Copyright Rivtower Technologies 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
#![no_std] //! //! Driver crate for the Texas Instruments ADS1292 24-bit 2-channel low-power analog front end for ECG applications. //! //! This initial version supports the ADS1292 (for the most part), but it's a goal to support the ADS1291 and ADS1292R as well. //! //! Usage: //! //! ```norun //!// spi: spi interfac...
mod common; use crate::common::TracingTest; use crate::common::ValueExt; use serde_json::{json, Value}; use std::collections::HashSet; use std::path::Path; use std::time::Duration; use tower::BoxError; #[tokio::test(flavor = "multi_thread")] async fn test_jaeger_tracing() -> Result<(), BoxError> { let tracer = op...
use std::fmt::Debug; use std::marker::PhantomData; use generic_array::{arr, ArrayLength, functional::FunctionalSequence, GenericArray}; use generic_array::typenum::{U1, UInt, UTerm}; use generic_array::typenum::bit::{B0, B1}; use sqlx::{ColumnIndex, Database, Decode, Encode, Error, MySql, Row, Type}; use sqlx::types::...
use amcl_wrapper::errors::SerzDeserzError; use amcl_wrapper::group_elem::GroupElement; use amcl_wrapper::group_elem_g1::G1; use amcl_wrapper::group_elem_g2::G2; use amcl_wrapper::extension_field_gt::GT; use super::common::{SigKey, VerKey, Keypair}; use super::simple::Signature; // This is an older but FASTER way of ...
// SPDX-License-Identifier: Apache-2.0 OR MIT use anyhow::{bail, Context, Result}; use bitcoin::hash_types::PubkeyHash; use bitcoin::hashes::Hash; use bitcoin::secp256k1; use bitcoin::util::misc::{signed_msg_hash, MessageSignature}; use bitcoin::util::{address, base58, key::PrivateKey}; use bitcoin::{Address, Network};...
use std::collections::HashSet; use std::convert::TryInto; use std::ops::{Deref, DerefMut}; use std::sync::Arc; use async_trait::async_trait; use futures::future::join_all; use log::debug; use uuid::Uuid; use crate::error; use crate::lock::RwLock; use crate::scalar::value::link::PathSegment; use crate::transaction::lo...
//! Text input (demonstrates two-way data binding) use std::ops::Range; use azul_core::{ callbacks::{Redraw, DontRedraw}, dom::{Dom, EventFilter, FocusEventFilter, TabIndex}, window::{FakeWindow, VirtualKeyCode}, callbacks::{ StackCheckedPointer, DefaultCallbackInfo, DefaultCallbackInfo...
use std::cmp::Ordering; struct Avl<K, V> { key: K, v: V, balance: i8, // -1 -> left biased, +1 -> right biased right: AvlTree<K,V>, left: AvlTree<K,V> } type AvlTree<K, V> = Option<Box<Avl<K,V>>>; enum Path<K, V> { Top, LNode { t: AvlTree<K, V>, key: K, v: V, balance: i8, p: Box<Path<K, V...
#![cfg_attr(not(feature = "std"), no_std)] pub use pallet::*; pub mod types; use frame_support::ensure; use types::*; #[cfg(test)] mod tests; #[frame_support::pallet] pub mod pallet { use super::*; use frame_support::pallet_prelude::*; use frame_system::pallet_prelude::*; /// Configure the pallet by specifyin...
// Copyright (c) Facebook, Inc. and its affiliates. // SPDX-License-Identifier: Apache-2.0 extern crate csv; #[cfg(not(target_arch = "wasm32"))] use crypto::eccipher::ECRistrettoParallel as ECRistretto; #[cfg(target_arch = "wasm32")] use crypto::eccipher::ECRistrettoSequential as ECRistretto; use crypto::{ ecci...
use super::{AbnfParser, ParserOutput, ParserOutputValue}; use std::collections::HashMap; use abnf::types::{Rule, Node}; use nom::Parser; /// Rule Name parser. Takes a rule and a HashMap of rule names to parsers and returns a parser /// that will call the correct sub parser for this rule's rule_name reference and retur...
use std::io::Read; use std::sync::{Arc, Mutex}; use rouille; use serde; use serde_json; use project::Project; use vfs::{VfsSession, VfsChange}; use rbx::RbxInstance; use plugin::PluginChain; static MAX_BODY_SIZE: usize = 25 * 1024 * 1024; // 25 MiB /// The set of configuration the web server needs to start. pub str...
//! A serve example to run actix web based on: https://github.com/actix/examples/blob/master/basics/src/main.rs //! Form processing based on: https://github.com/actix/examples/blob/master/form/src/main.rs //! To run: cargo run --example serve //! To build release: cargo build --example serve --release //! Copy the temp...
// Copyright 2020 <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 writing,...
//! Register mapping /// LPS25HB Registers #[allow(non_camel_case_types)] #[derive(Clone, Copy)] // to do: do the registers and bitmasks need to be public to work? // pub (crate) enum Registers { // USE THIS IN THE FINAL VERSION pub enum Registers { /// Reference pressure register. REF_P_XL = 0x08, /// R...
#![recursion_limit = "128"] #[macro_use] extern crate syn; extern crate proc_macro; extern crate proc_macro2; #[macro_use] extern crate quote; type TokenStream = proc_macro::TokenStream; mod attr; mod builder; mod field; mod r#struct; mod model; mod queryable; use crate::{model::*, queryable::*, builder::*, r#stru...
use super::{CurrencyCode, NewPrice, NewPriceHistory, PatchPrice, Price, PriceField, PriceHistory}; use crate::graphql::model::PriceOrderBy; use crate::graphql::utils::Direction; use crate::model::{Crud, DbInsert, HistoryEntry}; use crate::schema::{price, price_history}; use crate::{crud_methods, db_insert}; use diesel:...
use crate::models::PageInfo; use anyhow::{anyhow, Result}; use crossbeam::channel::unbounded; use lazy_static::lazy_static; use log::{debug, error, info, warn}; use regex::Regex; use roxmltree::Document; use rusqlite::{params, Connection}; use std::{ io::{BufRead, BufReader}, process::Child, thread, }; con...
use std::convert::TryInto; use std::error::Error; use std::fs; use std::fs::File; use std::fs::OpenOptions; use std::io::{BufRead, BufReader, BufWriter, Read, Write}; use std::path::Path; use clap::ArgMatches; use rpassword; use crypto::{Cipher, Share}; use error::*; pub mod crypto; pub mod error; pub mod math; ///...
use std::{fmt::Write, iter}; use anyhow::{anyhow, bail, Result}; use clap::{Arg, ArgMatches, SubCommand}; use color::ColorFormat; use super::{util, Cmd}; use crate::{ color::{self, Color, ColorSpace}, terminal::{self, stdin}, State, }; #[derive(Debug, Clone)] pub struct Mix { colors: Vec<(Color, Colo...
const MY_CONST: i32 = 100; use hello::{do_stuff_mutable_reference, do_stuff_owner, do_stuff_reference, greet}; use rand::prelude::*; use std::collections::HashMap; use std::fs::File; use std::{thread, time}; fn main() { let mut rng = thread_rng(); let rng_val: f64 = rng.gen(); println!("Range val = {}", rn...
use crate::utils::{ cargo, crates::{Upgrader, Versions}, normalize, Error, Result, INTERNAL_ERR, }; use cargo_metadata::{Metadata, Package}; use clap::{crate_version, Parser}; use oclif::term::{OUT_YELLOW, TERM_OUT}; use semver::Version; use std::{ env::{current_dir, var_os}, fs::{create_dir_all, ...
// Terminal Minesweeper extern crate rand; use rand::{thread_rng, Rng}; use std::fmt; use std::io::Write; const MIN_DIMENSION: isize = 8; const MAX_DIMENSION: isize = 16; const BOMB_PROBABILITY: f64 = 1.0 / 10.0; pub struct Cell { is_flag: bool, is_visible: bool, is_mine: bool, neighbors: usize, } i...
use crate::data::hashmap::{Entry, HashMap}; use crate::data::MaybeSerializableData; use crate::geometry::contact_generator::{ ContactGenerationContext, ContactGeneratorWorkspace, PrimitiveContactGenerationContext, PrimitiveContactGenerator, }; #[cfg(feature = "dim2")] use crate::geometry::Capsule; use crate::ge...
use std::sync::Mutex; use std::sync::Arc; use std::sync::RwLock; use std::collections::HashMap; use std::thread; use std::time; use std::path::Path; use std::fs; use std::fs::File; use std::io::Read; use std::io::Write; use std::io::Seek; use std::io::BufWriter; //use std::slice::bytes; use super::version::*; us...
use crate::core::*; use crate::renderer::*; /// /// Similar to [Model], except it is possible to render many instances of the same model efficiently. /// pub struct InstancedModel<M: ForwardMaterial> { context: Context, mesh: Mesh, instance_count: u32, instance_buffer1: InstanceBuffer, instance_buf...
use std::io; use std::io::prelude::*; use std::collections::HashSet; fn main() -> io::Result<()> { let stdin = io::stdin(); let mut input = String::new(); stdin.lock().read_to_string(&mut input)?; let tokens = split_query(&input); let out = make_lines(tokens); let mut longest = 0; for i in ...
// https://github.com/AndreyAkinshin/perfolizer/blob/master/src/Perfolizer/Perfolizer/Mathematics/QuantileEstimators/P2QuantileEstimator.cs #[derive(Debug)] #[cfg_attr(feature = "with_serde", derive(serde::Serialize, serde::Deserialize))] pub struct P2 { p: f64, n: [i32; 5], // marker positions ns: [f64; ...
macro_rules! impl_hex16_base_type { ($type_name:ident, $argument_name:ident, $error_variant:ident) => { impl std::fmt::Display for $type_name { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { use dbtype::hex16::to_hex_string; let &$type_name(ref ...