text
stringlengths
8
4.13M
use super::{utils::*, CommandCounter, ShardManagerContainer, TrackOwner}; use serenity::{ builder::CreateMessage, client::{bridge::gateway::ShardId, Context}, framework::standard::{macros::command, CommandResult}, model::{channel::Message, id}, }; use std::time::Instant; #[command] #[aliases("s")] #[de...
#[repr(u8)] #[derive(Debug, Clone, Copy)] pub enum Fg { Black = 30, Red, Green, Yellow, Blue, Magenta, Cyan, White, Reset = 39, BrightBlack = 90, BrightRed, BrightGreen, BrightBlue, BrightMagenta, BrightCyan, BrightWhite, } impl std::fmt::Display for Fg {...
use kompact::component::AbstractComponent; use kompact::prelude::*; use time::*; use crate::control::Control; use crate::data::*; use crate::prelude::*; use std::collections::HashMap; use std::collections::VecDeque; use std::ops::ControlFlow; use std::ops::FromResidual; use std::ops::Try; use std::sync::Arc; use std:...
use crate::utils::input_validator; use crate::Result; use reqwest::Client; use serde_json::Value; /// Checks for consistency of given hashes, not part of the public api pub async fn check_consistency(client: Client, uri: String, hashes: Vec<String>) -> Result<Value> { for hash in &hashes { ensure!( ...
use carmen_core::gridstore::*; use test_utils::*; use fixedbitset::FixedBitSet; const ALL_LANGUAGES: u128 = u128::max_value(); #[test] fn coalesce_single_test_proximity_quadrants() { let directory: tempfile::TempDir = tempfile::tempdir().unwrap(); let mut builder = GridStoreBuilder::new(directory.path()).unw...
use std::cell::RefCell; use std::io::{stdout, Write}; use std::rc::Rc; use super::window::TermionWindow; use crate::event_controller::window::{Layout, Window, WindowPosition, WindowSize}; use termion::clear; use termion::color::DetectColors; use termion::raw::IntoRawMode; use termion::screen::AlternateScreen; const ...
/// Refers to a part of a span #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct Segment { /// ID of the span this segment refers to pub span_id: usize, /// Beginning of this segment within the span (included) pub start: usize, /// End of this segment within the span (excluded) pub end: u...
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. #[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate futures; #[macro_use] extern crate serde_json; extern crate clap; extern crate deno; mod ansi; pub mod compiler; pub mod deno_dir; pub mod errors; p...
use plugin_interface; use plugin_interface::{PluginResult, PuszRow, PuszRowIdentifier, PuszRowBuilder}; #[derive(Debug)] struct CalcPlugin { } impl plugin_interface::Plugin for CalcPlugin { fn query(&mut self, query: &str) -> PluginResult { match meval::eval_str(&query) { Ok(result) => { ...
#![cfg_attr(not(feature = "std"), no_std)] use frame_support::{Parameter, decl_module, decl_event, decl_storage, decl_error, ensure, dispatch}; use sp_runtime::traits::{Member, AtLeast32Bit, Zero, StaticLookup, MaybeSerializeDeserialize}; use codec::{Codec}; use frame_system::{self as system, ensure_signed}; /// The ...
use serde::Serialize; use crate::domain::catalogue::{Author, Catalogue, Category, Publication, Statistics}; #[derive(Serialize)] pub struct StatisticsDto { pub views: u32, pub unique_views: u32, pub readings: u32, pub likes: u32, pub reviews: u32, pub stars: f32, } impl From<&Statistics> for ...
use entry::Entry; use rand::Rng; use rand::XorShiftRng; use std::ops::{Add, Index, IndexMut, Sub}; use treap::node::Node; use treap::tree; /// An ordered map implemented using a treap. /// /// A treap is a tree that satisfies both the binary search tree property and a heap property. Each /// node has a key, a value, a...
//! JSON generation use {items, utils}; use serde_json; use std::{self, io}; /// The result type for JSON errors. pub type JsonResult<T> = std::result::Result<T, JsonError>; /// Errors that may occur during JSON operations. #[derive(Debug)] pub enum JsonError { FailedToCreateDirectory(io::Error), FailedToCreateJs...
#[doc = "Register `BRR` writer"] pub type W = crate::W<BRR_SPEC>; #[doc = "Port x Reset bit y (y= 0 .. 15)\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum BR0W_AW { #[doc = "0: No action on the corresponding ODx bit"] NoAction = 0, #[doc = "1: Reset the ODx bit"] Reset = 1, ...
//! Gameboard controller. use piston::input::GenericEvent; use taquin::state::State; use taquin::reducer::Reducer; use std::collections::VecDeque; use time::PreciseTime; /// Handles events for Fifteen puzzle game. pub struct GameboardController { /// Stores the gameboard state. pub gameboard: State, /// ...
use hacspec_hmac::*; use hacspec_lib::prelude::*; struct HMACTestVectors<'a> { key: &'a str, txt: &'a str, expected: &'a str, } // https://tools.ietf.org/html/rfc4231 const HMAC_KAT: [HMACTestVectors; 5] = [ HMACTestVectors { key: "0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b0b", txt: "48692...
use std::env; use std::path::PathBuf; fn main() { println!("cargo:rerun-if-changed=laszip/src/laszip_dll.cpp"); println!("cargo:rerun-if-changed=laszip/dll/laszip_api.c"); println!("cargo:rerun-if-changed=laszip/include/laszip/laszip_api.h"); // build laszip library let dst = cmake::Config::new("l...
#![allow(dead_code, unused_imports, unused_variables)] use std::collections::{BTreeSet,HashMap,HashSet}; const DATA: &'static str = include_str!("../../../data/08"); type Input = Vec<usize>; #[derive(Debug)] struct Node { children: Vec<Node>, metadata: Vec<usize>, } impl Node { fn parse(input: &mut imp...
use std; use std::error::Error; use std::collections::HashMap; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(rename_all = "PascalCase")] //Labels, HostConfig pub struct Container { pub id: String, pub image: String, pub status: String, pub command: String, pub created: u64, pub names:...
use std::sync::Arc; use apllodb_storage_engine_interface::{ test_support::test_models::{Body, People, Pet}, Row, }; use crate::{ aliaser::Aliaser, records::{record::Record, record_schema::RecordSchema}, }; impl RecordSchema { pub fn fx_people() -> Self { Self::from_row_schema(&People::sch...
/**********************************************************\ | | | hprose | | | | Official WebSite: http://www.hprose.com/ | | ...
//! Support for collecting keys and counting the records that contributed them. use std::fs::File; use std::path::Path; #[cfg(test)] use std::mem::drop; use arrow2::datatypes::{DataType, Field, Schema}; use arrow2::io::parquet::write::{FileWriter, WriteOptions}; use log::*; use parquet2::write::Version; use polars::p...
pub use text_io::*;
// 1. start // 2. poll until update finished // 3. stop use std::{thread, time}; use std::process::{Command, Stdio}; struct Dropbox(); #[derive(Debug, PartialEq)] enum DropboxStatus { NotRunning, UpToDate, Starting, Connecting, Else(String) } impl Dropbox { fn run(&self, cmd: &str) -> String...
use embedded_hal::digital::v2::{OutputPin, InputPin}; use stm32f1xx_hal::{pac, prelude::*, timer::Timer}; pub fn read_gpio() -> ! { let dp = pac::Peripherals::take().unwrap(); // 关于RCC https://www.cnblogs.com/zc110747/p/4692379.html let mut rcc = dp.RCC.constrain(); // 控制GPIO 需要使用 PCLK2:外设2区域时钟(通过APB...
mod container; mod domain; pub use self::domain::*; pub use container::*;
use std::io::prelude::*; use std::fs::File; fn consume(mut file: File) -> String { let mut s = String::new(); file.read_to_string(&mut s); // Do something crazy with string and return it. s // file goes now out of scope and gets also closed! } fn main() { let file = File::open("consume-file.rs...
use day_21::{full_fight_won_by_player, get_weapons_armors_rings, Character, Item, ItemEnum}; use std::collections::HashMap; use std::io::{self}; fn main() -> io::Result<()> { let files_results = vec![("input.txt", 121, 201)]; for (f, result_1, result_2) in files_results.into_iter() { println!("File: {}...
/// Inserts two zero-bits before any two bits of `val` pub fn expand_bits_by_3(mut val: u64) -> u64 { val &= 0x1FFFFF; //Truncate to 21 bits val = (val | (val << 32)) & 0x00FF00000000FFFF; val = (val | (val << 16)) & 0x00FF0000FF0000FF; val = (val | (val << 8)) & 0xF00F00F00F00F00F; val = (val | (va...
use bimap::BiMap; use std::iter::FromIterator; #[derive(Copy, Clone, PartialEq, Eq, Hash)] pub enum Token { Add, Subtract, Multiply, Divide, Modulo, Not, Greater, Right, Left, Up, Down, Random, HorizontalIf, VerticalIf, StringMode, Duplicate, Swap, ...
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
//! A collection of various utility helpers. mod comparison; pub use self::comparison::*; mod environment; pub use self::environment::*; mod iterators; pub use self::iterators::CollectGroupBy; mod mutability; pub use self::mutability::*; mod parallel; pub use self::parallel::*; mod random; pub use self::random::*...
use super::MapVisualization; use super::Table; impl<'c> Table<'c, MapVisualization> { pub async fn by_dataset(&self, dataset: i32) -> Result<MapVisualization, sqlx::Error> { sqlx::query_as("SELECT * FROM map_visualization WHERE dataset = $1") .bind(dataset) .fetch_one(&*self.pool) ...
//! Task State Segment //! //! When transitioning back to ring0, the processor must load a stack for the //! kernel to use. This stack pointer is defined in the Task State Segment. //! //! Upon an interrupt or syscall the Task Register is read, which is used as an //! offset into the GDT to find the TSS and use the rsp...
use std::collections::BitSet; use incidence_vector::IncidenceVector; /// [Incidence Matrix](http://mathworld.wolfram.com/IncidenceMatrix.html) pub struct IncidenceMatrix { /// Matrix dimensions in the form (m,n) or (# of rows, # of columns). pub dims: (usize, usize), entries: BitSet, } impl IncidenceMatrix {...
use yew::prelude::*; use crate::components::card::Card; #[function_component(NotFound)] pub fn not_found() -> Html { use_context::<Callback<String>>() .unwrap() .emit("找不到页面".into()); html! { <Card title={"Welcome!"}> <p>{ "404 NOT FOUND,换个地址试试看?" }</p> </Card> } }
use std::fmt; use crate::Coord; #[derive(Eq, PartialEq, Hash, Debug, Copy, Clone, Ord, PartialOrd)] pub struct Area { pub position: Coord, pub size: Coord, } impl Area { pub fn new(position: Coord, size: Coord) -> Area { Area { position, size } } pub fn center(&self) -> Coord { ( ...
#![feature(futures_api, async_await, await_macro)] mod api; pub mod config; use {crate::config::Opt, tide::App}; pub fn make_app(opt: Opt) -> App<Opt> { let mut app = tide::App::new(opt); app.middleware(tide::middleware::RootLogger::new()); app.at("/ping").get(async move |_| "OK"); app.at("/hello/:na...
//! This project is used for explaining the linear phase property of digital //! filters. Here we have a low-pass filter represented by h array. First its //! FFT is calculated using the arm_cfft_f32 function. Then the magnitude and //! phase of the FFT are stored in Mag and Phase arrays. //! //! Runs entirely locally ...
use std::net::SocketAddr; use smoltcp::{ wire::{ Ipv4Packet, Ipv6Packet, TcpPacket, IpProtocol as Protocol, }, }; use std::hash::{Hash, Hasher}; use std::collections::hash_map::DefaultHasher; pub type IdAddrs = (SocketAddr, SocketAddr); #[derive(Debug, Clone)] /// Convenience wrapper around IPv4/IPv6 ...
mod dataset; mod itemset; mod datasets; use std::{ collections::HashSet, fmt::Debug, hash::Hash }; use crate::{DataSet, Support}; use self::datasets::TestDataSet; /// Test the sequential implementation with the given test dataset. fn test_sequential<D>(dataset: &TestDataSet<D>) where D: DataSet, D::ItemSet: D...
//! AT&T Assembler Syntax Tree. #![feature(try_from)] #[macro_use] extern crate pest_derive; extern crate pest; #[macro_use] pub mod parser; pub mod ast;
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// SyntheticsDevice : Object describing the device used to perform the Synthetic test. #[derive(Clon...
use rocket_contrib::{Json, Value}; use models::Hero; #[post("/", data = "<hero>")] pub fn create(hero: Json<Hero>) -> Json<Hero> { hero } #[get("/")] pub fn get_all() -> Json<Value> { Json(json!([ "hero 1", "hero 2" ])) } #[put("/<id>", data = "<hero>")] pub fn update(id: u32, hero: Json...
//! All functions in this module operate on raw bytes for performance reasons. //! It is easy to combine these with `std::str::from_utf8` family of functions, //! to lift them to operate on `str`. use crate::Osm; use std::ops::Range; /// Returns an iterator over tags specified by `range`. /// /// When searching for a...
use std::thread; fn f1 (a : u64, b : u64, c : u64, d : u64) -> u64 { let mut primitive_count = 0; for triangle in [[a - 2*b + 2*c, 2*a - b + 2*c, 2*a - 2*b + 3*c], [a + 2*b + 2*c, 2*a + b + 2*c, 2*a + 2*b + 3*c], [2*b + 2*c - a, b + 2*c - 2*a, 2*b + 3*c - 2*a]] .iter...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub mod accounts { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub async fn ...
use core::arch::x86_64::*; use std::mem; /// Create PoT proof with checkpoints #[target_feature(enable = "aes")] pub(super) unsafe fn create( seed: &[u8; 16], key: &[u8; 16], num_checkpoints: u8, checkpoint_iterations: u32, ) -> Vec<[u8; 16]> { let mut checkpoints = Vec::with_capacity(usize::from(n...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ pub mod file_util; pub use file_util::*; #[allow(clippy::module_inception)] pub mod utils; pub use utils::*; pub mod bit_vec_extension; pub use bit_vec_extension::*; pub mod rayon_util; pub use rayon_util::*; pub ...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use rocksdb::SliceTransform; pub struct FixedPrefixSliceTransform { pub prefix_len: usize, } impl FixedPrefixSliceTransform { pub fn new(prefix_len: usize) -> FixedPrefixSliceTransform { FixedPrefixSliceTransform {...
use std::collections::HashMap; use super::type_table::{TypeTableEntry, TypeTableType}; pub struct GlobalMessage { table: TypeTableType } impl TypeTableEntry for GlobalMessage { fn get(&self, key: u16) -> String { let result = self.table.get(&key); match result { Some(r) => r.clone...
/// The sequence number of a message. The first message in the file has `SeqNum(0)`. #[derive(Debug, PartialEq, Copy, Clone, PartialOrd)] pub struct SeqNum(pub u64); /// A byte offset into the file. #[derive(Debug, PartialEq, Copy, Clone)] pub struct ByteOffset(pub u64); #[derive(Debug, PartialEq, Clone, Copy)] pub s...
mod cmd; mod config; mod error; pub use cmd::*; pub use config::*; pub use error::make_generic as make_generic_error;
use super::GetFlag; use super::{Gender, GetFlag::*, Results}; use serde::Deserialize; /// All valid flags for get staff method pub const STAFF_FLAGS: [GetFlag; 5] = [Basic, Details, Aliases, Vns, Voiced]; /// Results returned from get staff method #[derive(Deserialize, Debug, PartialEq)] pub struct GetStaffResults { ...
// Copyright 2019-2020 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) a...
// This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at http://mozilla.org/MPL/2.0/. use core::{mem, slice}; use crate::{lmem}; #[allow(non_camel_case_types)] #[derive(Pod, Copy, Clone)] #[repr(transpa...
// El discurso de Zoe // // Copyright (C) 2016 GUL UC3M // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Th...
use super::{ Load, property::Property, fun::Fun, local::Local, MemmyGenerator }; use ir::{ Chunk, hir::HIRInstruction }; use core::pos::BiPos; use ir_traits::{ ReadInstruction }; use notices::{ DiagnosticSourceBuilder, DiagnosticLevel }; #[derive(Debug, Clone)] pub struct Statement<'a>{...
use crate::bytecode::{CodeObject, LibraryObject, Op}; use crate::error::{CompileError, Error, ErrorContext, ErrorKind, Result}; use crate::objectify::Translate; use crate::primitive::{Arity, RuntimePrimitive}; use crate::scm::Scm; use crate::symbol::Symbol; use crate::syntax::definition::GlobalDefine; use crate::syntax...
use std::collections::HashMap; /// An implementation of Heeren's algorithm for type inference. use std::fmt::Debug; use std::rc::Rc; /// Constraints help deduce the actual type of a type variables. /// there are a few types.i #[derive(Clone, PartialEq)] pub enum Constraint<T> where T: Clone + PartialEq + Debug, { ...
// unihernandez22 // https://codeforces.com/problemset/problem/1335/A // math use std::io; fn main() { let mut t = String::new(); io::stdin().read_line(&mut t).unwrap(); let t: i64 = t.trim().parse().unwrap(); for _ in 0..t { let mut n = String::new(); io::stdin().read_line(&mut n).un...
use ckb_tool::ckb_types::{ packed::{CellInput, OutPoint}, prelude::*, H256, }; #[derive(Hash, Eq, PartialEq, Debug, Clone)] pub struct LiveCell { pub tx_hash: H256, pub index: u32, pub capacity: u64, pub mature: bool, } impl LiveCell { pub fn out_point(&self) -> OutPoint { OutP...
use crate::{ btree::{BTree, BTreeKey}, checkpoint, read_block, read_obj_phys, superblock::NxSuperblock, BlockAddr, ObjPhys, ObjectIdentifier, ObjectTypeAndFlags, TransactionIdentifier, }; use fal::parsing::{read_u32, read_u64}; use std::{cmp::Ordering, collections::HashMap}; use bitflags::bitflags; #...
use crate::{BotResult, CommandData, Context}; use std::sync::Arc; #[command] #[short_desc("https://youtu.be/hjGZLnja1o8?t=41")] #[bucket("songs")] #[aliases("1273")] #[no_typing()] pub async fn rockefeller(ctx: Arc<Context>, data: CommandData) -> BotResult<()> { let (lyrics, delay) = _rockefeller(); super::s...
use util::{bitfields, primitive_enum}; #[derive(Copy, Clone, Default)] pub struct DMARegisters { pub source: DMAAddress, pub destination: DMAAddress, pub count: u16, pub control: DMAControl, } bitfields! { pub struct DMAAddress: u32 { [0,15] lo, set_lo: u16, [16,31] hi, set_hi: u1...
use oxygengine::prelude::*; use serde::{Deserialize, Serialize}; #[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum ItemKind { Star, Shield, } impl Prefab for ItemKind {} impl PrefabComponent for ItemKind {} impl ItemKind { pub fn image(self) -> &'static str { match sel...
use core::ops::AddAssign; use super::drawable::Drawable; use super::image::Image; use super::canvas::Canvas; /// Use a Sprite for an object on your game which can move. /// /// # Example /// /// ```rust /// use wasm_game_lib::graphics::image::Image; /// use wasm_game_lib::graphics::sprite::Sprite; /// # use wasm_gam...
use std::io::prelude::*; use std::net::TcpStream; fn main() { let mut stream = TcpStream::connect("127.0.0.1:4369") .expect("Couldn't connect to the server..."); connect(&mut stream); // ask_port(&mut stream); // let mut stream2 = TcpStream::connect("127.0.0.1:4369") // .expect("Cou...
pub mod black_hole; mod accretion;
#[macro_use] extern crate lazy_static; extern crate wars_8_api; use std::sync::{Mutex, MutexGuard}; use gfx::{ColorPallete, print, printh, rectfill}; use wars_8_api::*; lazy_static! { static ref LINES: Mutex<Vec<(ColorPallete, String)>> = Mutex::new(Vec::new()); static ref CRS_OFFSET: Mutex<i32> = Mutex::new...
use std::collections::HashMap; use reqwest::header; use std::thread; fn main() { let content = lane::fs::read_content("./orders.txt"); // println!("{:?}", content); let ves: Vec<&str> = content.split(",").collect(); let per_vec = lane::slice_per_vec(ves, 50); // println!("总计: {}", per_vec.len())...
use std::fmt; #[derive(Eq, PartialEq, Hash, Clone)] pub enum Yaku { Poetry, Flowers, Purple, Inoshikachou, Moon, Salamander, Gramps, Month, None, } impl fmt::Display for Yaku { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { let value = match self { &...
// We can use generics to create defintions for items like function signatures // or structs, which we can then use with many diff concrete data types // ***In Function Definitions** // Place generics in the signature of the function where we would usually // specify the data types of the parameters and the return val...
use std::fs::File; use std::io::{BufReader, BufWriter}; use crate::cartridge::{MirrorMode, Rom, RomMapper}; use crate::savable::Savable; use super::Mapper; pub struct Mapper7 { rom: Rom, bank: usize, mirror_mode: MirrorMode, } impl Mapper7 { pub fn new(rom: Rom) -> Self { Self { ...
#[doc = "Register `CR` reader"] pub type R = crate::R<CR_SPEC>; #[doc = "Register `CR` writer"] pub type W = crate::W<CR_SPEC>; #[doc = "Field `LPSDSR` reader - Low-power deepsleep/Sleep/Low-power run"] pub type LPSDSR_R = crate::BitReader<LPSDSR_A>; #[doc = "Low-power deepsleep/Sleep/Low-power run\n\nValue on reset: 0...
const PI: f32 = 3.16; const MAX_POINTS: u32 = 100_000; fn err() { let _x = 5; // _x = 6; // error! } #[allow(unused_variables)] #[allow(unused_assignments)] fn ok() { let mut x = 5; x = 6; // no problem! // it’s not so much that the value at _x is changing, // but that the binding changed from one i32 to anot...
extern crate gocar; extern crate toml; fn load_config() -> gocar::Project { use std::io::Read; let mut config = Vec::new(); std::fs::File::open("Gocar.toml") .unwrap() .read_to_end(&mut config) .unwrap(); let mut config = toml::from_slice::<gocar::Project>(&config).unwrap(); ...
use crate::commands::ledger::{get_icpts_from_args, send_and_notify}; use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use crate::lib::nns_types::account_identifier::Subaccount; use crate::lib::nns_types::icpts::{ICPTs, TRANSACTION_FEE}; use crate::lib::nns_types::{CyclesResponse, Memo}; use ...
// #![cfg(feature = "cbor")] // #![cfg(feature = "json")] // #![cfg(not(feature = "lsp"))] // #[macro_use] // extern crate log; // use cddl::{ // cddl_from_str, parser::root_type_name_from_cddl_str, validate_cbor_from_slice, // validate_json_from_str, // }; // use clap::{ArgGroup, Args, Parser, Subcommand}; // u...
use bincode::{deserialize, serialize}; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use entry::Entry; use lsm_tree::{Error, Result}; use probabilistic_collections::bloom::BloomFilter; use rand::{thread_rng, Rng}; use serde::de::{self, Deserialize, DeserializeOwned, Deserializer}; use serde::ser::{Serialize,...
#[cfg(feature = "python")] pub mod py; mod test; /// The ideal single-chain model. pub mod ideal; /// The freely-jointed chain (FJC) single-chain model. pub mod fjc; /// The extensible freely-jointed chain (EFJC) single-chain model. pub mod efjc; /// The square-well freely-jointed chain (SWFJC) singl...
#[cfg(test)] mod test; use crate::{ bson::{doc, Document}, cmap::{Command, RawCommandResponse, StreamDescription}, cursor::CursorSpecification, error::{ErrorKind, Result}, operation::{ append_options, CursorBody, OperationWithDefaults, Retryability, SERVER_4_...
// list of volume submodules pub mod knitting; pub mod point_cloud; pub mod surface; pub mod voxel;
use nannou::prelude::*; use blend::*; struct Model { shapes: Vec<Shape>, shape_index: usize } fn main() { nannou::app(model).update(update).run(); } fn model(app: &App) -> Model { app.new_window().size(1920,1080).view(view).build().unwrap(); let square = blend::Shape::square_simple( pt2(0.0,0.0)...
use anyhow::{anyhow, Result}; use itertools::Itertools; use std::{collections::VecDeque, fs}; fn find_abberation(input: &Vec<u64>, preamble_length: usize) -> u64 { let mut ring = VecDeque::<u64>::new(); input .iter() .enumerate() .find_map(|(index, n)| { if index < preamble_...
// Copyright (C) 2015-2021 Swift Navigation Inc. // Contact: https://support.swiftnav.com // // This source is subject to the license found in the file 'LICENSE' which must // be be distributed together with this source. All other rights reserved. // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ...
#[cfg(test)] mod tests; pub fn func(x: u32) { match x { 0 => {} 1 => {} 2 => {} _ => {} } } #[test] fn test() { func(1); func(3); member1::func(0); member2::func(0); }
use crate::error::RPCError; use ckb_jsonrpc_types::{BannedAddr, Node, NodeAddress, Timestamp}; use ckb_network::{MultiaddrExt, NetworkController}; use faketime::unix_time_as_millis; use jsonrpc_core::Result; use jsonrpc_derive::rpc; use std::collections::HashMap; const MAX_ADDRS: usize = 50; const DEFAULT_BAN_DURATION...
use gamesession::InternalState; use std::collections::HashMap; use player::*; use slog::Logger; const LINCH_PERCENTAGE : f32 = 0.4; #[derive(PartialEq,Debug)] enum LynchState { Picked, Abstained, } #[derive(Debug)] struct LynchPlayerState { picked: usize, state: LynchState, } pub struct MorningState<'...
use std::fmt::{Debug, Formatter}; use ndarray::Array1; pub type ActivationFn = fn(&Array1<f32>) -> Array1<f32>; pub type DerivationFn = fn(&Array1<f32>) -> Array1<f32>; #[derive(Clone, Copy)] pub struct Activation { activation: ActivationFn, derivation: DerivationFn, } impl Debug for Activation { fn fmt...
use crate::constants::{CURVE_ORDER, GROUP_G2_SIZE, FIELD_ORDER_ELEMENT_SIZE}; use crate::errors::{SerzDeserzError, ValueError}; use crate::curve_order_elem::{CurveOrderElement, CurveOrderElementVector}; use crate::group_elem::{GroupElement, GroupElementVector}; use crate::types::{GroupG2, FP2, BigNum}; use crate::utils...
#![feature(slice_patterns)] #![feature(advanced_slice_patterns)] fn main() { normal(); overlap(); destructure(); pattern_guards(); } fn overlap() { let x = 4; match x { 3...10 => println!("big"), 0...6 => println!("small"), _ => println!("error") } } fn normal()...
#[doc = "Register `DDRCTRL_MSTR` reader"] pub type R = crate::R<DDRCTRL_MSTR_SPEC>; #[doc = "Register `DDRCTRL_MSTR` writer"] pub type W = crate::W<DDRCTRL_MSTR_SPEC>; #[doc = "Field `DDR3` reader - DDR3"] pub type DDR3_R = crate::BitReader; #[doc = "Field `DDR3` writer - DDR3"] pub type DDR3_W<'a, REG, const O: u8> = ...
/// An enum to represent all characters in the NyiakengPuachueHmong block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum NyiakengPuachueHmong { /// \u{1e100}: '𞄀' LetterMa, /// \u{1e101}: '𞄁' LetterTsa, /// \u{1e102}: '𞄂' LetterNta, /// \u{1e103}: '𞄃' LetterTa, ///...
enum_impl! { /// Object Format ObjFmt { /// Unknown format Unknown => "unknown", /// GOFF (IBM OS/360) GOFF => "goff", /// COFF Common Object File Format (Unix System V R4, Windows) COFF => "coff", /// ELF Executable and Linkable Format ELF => "el...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// GroupWidgetDefinition : The groups widget allows you to keep similar graphs together on your timeboa...
pub mod managers; pub mod renderer; pub use crate::renderer::managers::*; pub use crate::renderer::renderer::*;
//! Auto solvers automatically find which of their child solvers is installed on //! the user's computer and uses it. The [AllSolvers] solvers tries all the supported solvers. use crate::lp_format::{LpObjective, LpProblem}; use crate::problem::{Problem, StrExpression, Variable}; #[cfg(feature = "cplex")] use crate::so...
use rand::Rng; use::minifb::{ Key, Window }; use crate::ram::Ram; use crate::PROGRAM_START_ADDR; use crate::NUM_GPR; use crate::HEIGHT; use crate::WIDTH; use crate::PX_OFF; use crate::PX_ON; pub struct Cpu { // 16 8 bit general purpose registers reg_gpr: [u8; NUM_GPR], // 1 16 bit register, i ...
fn main() { /// - Shared Borrowing: Piece of data shared by single or multiple variable, can't be altered /// - Mutable Borrowing: Piece of data shared by single variable that can alter its value (not accessible for other variables) let x = 10; let mut y = 13; // Shared Borrow let a = &x; ...