text
stringlengths
8
4.13M
// https://rustcc.gitbooks.io/rustprimer/content/module/module.html pub mod a; fn main() { println!("Hello, world!"); a::b::c::d::print_ddd(); test_reexport(); test_use(); } fn test_reexport() { a::d::print_ddd(); } fn test_use() { use a::b::c::d; d::print_ddd(); }
#![no_std] pub struct And<A, B>(pub A, pub B); macro_rules! define { ( $( pub struct $name:ident / $lower:ident ( pub $ty:ty ) ; )* ) => { $( #[repr(transparent)] #[derive(Clone)] pub struct $name(pub $ty); pub fn $lower(target: &$ty) -> &$name { ...
// Variables in rust are immutable by default // Rust is a block-scoped language pub fn run() { let name = "Haardik"; // The following will lead to an error // cannot assign twice to immutable variable // let age = 21; // age = 22 let mut age = 21; println!("My name is {} and I am {}", na...
#[doc = "Register `EXTSCR` reader"] pub type R = crate::R<EXTSCR_SPEC>; #[doc = "Register `EXTSCR` writer"] pub type W = crate::W<EXTSCR_SPEC>; #[doc = "Clear CPU1 Stop Standby flags\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum C1CSSFW_AW { #[doc = "1: Setting this bit clears the C1S...
// This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // 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 F...
//! This module handles the parsing of a [template](`super::Template`). #[cfg(test)] mod tests; use color_eyre::eyre::{eyre, Result}; use color_eyre::Report; use super::block::{Block, BlockHint, If, IfExpr, IfOp, Var, VarEnv, VarEnvSet}; use super::diagnostic::{Diagnostic, DiagnosticBuilder, DiagnosticLevel}; use su...
//! Copied for `hyper::header::shared`; pub use self::charset::Charset; pub use self::encoding::Encoding; pub use self::entity::EntityTag; pub use self::httpdate::HttpDate; pub use language_tags::LanguageTag; pub use self::quality_item::{Quality, QualityItem, qitem, q}; mod charset; mod entity; mod encoding; mod http...
use std::io; use std::future::Future; use std::net::SocketAddr; use std::pin::Pin; use std::sync::Arc; use std::task::{Context, Poll}; use rustls::internal::pemfile; use rustls::{Certificate, PrivateKey, ServerConfig}; use tokio::net::{TcpListener, TcpStream}; use tokio_rustls::{TlsAcceptor, Accept, server::TlsStream}...
//! Wrapper around the raw Lua context. These define safe methods that ensure //! correct use of the Lua stack. use lua_sys::*; use std::path::PathBuf; use std::ffi::{CString, CStr}; use std::ops::{Deref, DerefMut}; const ALREADY_DEFINED: i32 = 0; /// Wrapper around the raw Lua context. When necessary, the raw Lua ...
// Copyright 2020 The VectorDB Authors. // // Code is licensed under Apache License, Version 2.0. use crate::errors::{Error, SQLError}; use crate::{expressions::*, planners::*}; pub fn planner_to_expression(planner: Planner) -> Result<Expression, Error> { match planner { Planner::Constant(v) => Ok(Express...
// pp-exact enum color { red = 1, green, blue, imaginary = -1, } fn main() { test_color(red, 1, "red"); test_color(green, 2, "green"); test_color(blue, 3, "blue"); test_color(imaginary, -1, "imaginary"); } fn test_color(color: color, val: int, name: str) { assert (color as int == val); assert...
#[doc = "Register `HWCFGR0` reader"] pub type R = crate::R<HWCFGR0_SPEC>; #[doc = "Field `NUM_CHAN_24` reader - NUM_CHAN_24"] pub type NUM_CHAN_24_R = crate::FieldReader; #[doc = "Field `EXTRA_AWDS` reader - Extra analog watchdog"] pub type EXTRA_AWDS_R = crate::FieldReader; #[doc = "Field `OVS` reader - Oversampling"]...
use std::sync::MutexGuard; use nia_interpreter_core::Interpreter; use nia_interpreter_core::NiaInterpreterCommand; use nia_interpreter_core::NiaInterpreterCommandResult; use nia_interpreter_core::{EventLoopHandle, NiaDefineActionCommandResult}; use crate::error::{NiaServerError, NiaServerResult}; use crate::protocol...
#![allow(dead_code)] //! //! Easy interface for changes in music time. //! use super::{ music_time::MusicTime, music_time_counter::MusicTimeCounter, time_signature::TimeSignature, }; use std::time::{Duration, SystemTime}; const STRING_PANIC_TIME_FLOW: &str = "Hello John Titor, you reversed time!"; /// This trait ...
#[no_mangle] extern "C" fn loop_forever(label: i32) -> i32 { loop { println!("Label {}", label); } } #[no_mangle] extern "C" fn print_stuff() { println!("stuff"); }
use wasm_bindgen::JsCast; pub struct TexstureLayer { element: web_sys::HtmlCanvasElement, context: web_sys::CanvasRenderingContext2d, } #[allow(dead_code)] impl TexstureLayer { pub fn new(size: &[u32; 2]) -> Self { let element = web_sys::window() .unwrap() .document() ...
pub mod saving_parameters; pub use saving_parameters::SavingParameters;
//! create a ping and a pong services that can be used for testing //! the different operations available in term of intercom and //! monitoring how the start and shutdown process works //! use async_trait::async_trait; use organix::{ service, IntercomMsg, Organix, Service, ServiceIdentifier, ServiceState, Watchdo...
use super::*; use smallvec::SmallVec; const SMALLVEC_ARRAY_LEN: usize = 8; type SmallVecArray<V> = [V; SMALLVEC_ARRAY_LEN]; /// A collection of invalidities resulting from a validation /// /// Collects invalidities that are detected while performing /// a validation. #[derive(Clone, Debug)] #[cfg_attr(test, derive(...
#![allow(dead_code)] pub const MSTATUS_MPP_MASK: u64 = 6144; pub const MSTATUS_MPP_M: u64 = 6144; pub const MSTATUS_MPP_S: u64 = 2048; pub const MSTATUS_MPP_U: u64 = 0; pub const MSTATUS_MIE: u64 = 8; pub const SSTATUS_SIE: u64 = 2; #[inline] pub fn r_sstatus() -> u64 { let mut x: u64; unsafe { llvm_a...
// =============================================================================== // Authors: AFRL/RQQA // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division // // Copyright (c) 2017 Government of the United State of America, as represented by // the Secretary of th...
use grid::Grid; pub mod part1; pub mod part2; pub fn run() { part1::run(); part2::run(); } pub fn default_input() -> &'static str{ include_str!("input") } pub fn parse_input(input : &str) -> Grid<char> { let init :Vec<_> = input.lines().next().unwrap().chars().collect(); let len = &init.len(); ...
#[cfg(test)] mod tests { use kingslayer::Cli; #[test] fn player_equip() { let cli = Cli::from_file("worlds/test_world.ron"); cli.ask("n"); cli.ask("take iron sword"); assert!(cli.ask("i").contains("iron sword") && !cli.ask("i").contains("Main hand")); assert!(cli.as...
#[macro_use(lazy_static)] extern crate lazy_static; extern crate regex; use std::collections::hash_map::HashMap; use std::env; use std::fs; use std::process; use regex::Regex; type Minute = u8; type GuardIdentifier = u32; type GuardSleepingPeriods = Vec<GuardSleepPeriod>; type GuardSleepingSummary = HashMap<GuardIde...
//! Driver for the FT6202 Touch Panel. //! //! I2C Interface //! //! <http://www.tvielectronics.com/ocart/download/controller/FT6206.pdf> //! //! The syscall interface is described in [lsm303dlhc.md](https://github.com/tock/tock/tree/master/doc/syscalls/70006_lsm303dlhc.md) //! //! Usage //! ----- //! //! ```rust //! l...
/* This is part of mktcb - which is under the MIT License ********************/ use std::io::Write; use std::path::PathBuf; use crate::error::Result; use crate::error; use crate::decompress; use crate::util; use indicatif::{ProgressBar, ProgressStyle}; use snafu::{ResultExt, ensure}; use log::*; use curl::easy::Eas...
extern crate openssl; #[macro_use] extern crate serde; pub mod config; pub mod res; pub mod routes; pub mod server; pub use config::Config; pub use res::*; use artell_infra::pg::Postgres; #[tokio::main] async fn main() { pretty_env_logger::init(); openssl_probe::init_ssl_cert_env_vars(); let db_url = g...
extern crate aoc_2022; extern crate aoc_runner; extern crate aoc_runner_derive; use aoc_runner_derive::aoc_main; aoc_main! { lib = aoc_2022 }
// This file is part of Substrate. // Copyright (C) 2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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://...
#[derive(Clone, Debug)] pub struct UserData { pub name: String, pub value: UserDataValue, } #[derive(Clone, Debug)] pub enum UserDataValue { Int (i32), Float (f32), String (String), }
use std::fmt::Debug; // #[syntex_modifier] turns into #[derive(Clone)] #[syntex_modifier] struct S<'a>(&'a str); fn main() { // syntex_macro!() turns into "hello world" let s = S(syntex_macro!()); assert_debug::<S>(); println!("{}", s.0); } fn assert_debug<T: Debug>() {}
#[doc = "Register `FMC_CSQICR` writer"] pub type W = crate::W<FMC_CSQICR_SPEC>; #[doc = "Field `CTCF` writer - CTCF"] pub type CTCF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CSCF` writer - CSCF"] pub type CSCF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CSEF` wr...
use std::{ fmt::{Display, Formatter, Result as FmtResult}, str::FromStr, }; /// Represents a period of time relative to now. #[derive(Debug, Clone, PartialEq, Eq)] pub enum Period { /// The period of time that began at the start of the first tracked event. All, /// The period of time that began at ...
use std::{ collections::{btree_map, BTreeMap}, iter::FromIterator, fmt, }; use log::Level::{Debug, Trace}; use crate::{ContextHandle, Contextual, Multiplicity, DotId, FiringSet, AcesError, AcesErrorKind}; #[derive(Clone, Debug)] pub struct State { context: ContextHandle, tokens: BTreeMap<DotId, Mu...
use std::cmp::min; use std::sync::mpsc::Receiver; use crate::channel_state::{ChannelState, Voice}; use crate::channel_state::channel_state::{EnvelopeState, Note, PortaToNoteState, TremoloState, VibratoState, WaveControl, Panning, clamp, VibratoEnvelopeState}; use crate::instrument::{LoopType, Instrument}; use crate::m...
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // 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 http://opensource.org/licenses/MIT>,...
fn longest_consecutive(nums: Vec<i32>) -> i32 { use std::collections::{HashMap, HashSet}; let mut hm: HashMap<i32, i32> = HashMap::new(); let hs: HashSet<i32> = nums.into_iter().collect(); for n in &hs { if !hs.contains(&(*n - 1)) { hm.entry(*n).or_insert(1); for i in ...
use std::sync::{Arc, RwLock}; use std::time::{Duration, Instant}; use crate::frame::Frame; pub trait Animation { fn next_frame(&mut self, frame: &mut Frame); fn reset(&mut self); fn with_fps(self, fps: f32) -> FixedFPSAnimation<Self> where Self: Sized, { FixedFPSAnimation { ...
extern crate criterion; use buffered_index_writer::*; use criterion::{Criterion, *}; use directory::RamDirectory; fn pseudo_rand(i: u32) -> u32 { if i % 2 == 0 { ((i as u64 * i as u64) % 16_000) as u32 } else { i % 3 } } fn criterion_benchmark(c: &mut Criterion) { let plot_config = P...
//! This is the documentation for the SE library. //! //! * Developped by Georg Bramm //! * Type: encryption (structured) //! * Setting: PRP, PRF //! * Date: 12/2019 //! #![allow(dead_code)] #[macro_use] extern crate serde_derive; extern crate serde; extern crate serde_json; extern crate crypto; extern crate bincode; e...
pub mod bisect { pub fn bisect_left(a: &Vec<i32>, x: i32) -> usize { let mut lower = 0; let mut higher = a.len(); while lower < higher { let s = (higher + lower) / 2; if a[s] < x { lower = s + 1; } else { higher ...
pub trait DataType: Sized + Copy { type Signed: num::traits::Signed + Sized + Copy; type Unsigned: num::traits::Unsigned + Sized + Copy; fn byte_len(self) -> usize { std::mem::size_of::<Self>() } fn signed(self) -> Self::Signed; fn unsigned(self) -> Self::Unsigned; fn store_signed(&...
use lapin::{ Connection, ConnectionProperties, Channel, ExchangeKind, Queue, options::{ExchangeDeclareOptions, QueueBindOptions, QueueDeclareOptions} }; use amq_protocol_types::FieldTable; mod consumer_options; mod consumer; mod publisher_options; mod publisher; pub use consumer_op...
use crate::utils; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn get_web_cam() { let _document = utils::get_document(); }
/* * 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 */ /// MetricMetadata : Object with all metric related metadata. #[derive(Clone, Debug, PartialEq, Seria...
use std; fn main () { let data = "abracadabra"; // let _x = str::windowed(3u, data); let _y = str::lines_iter(data, {|x| io::println(x)}); let _z = str::words_iter(data, {|x| io::println(x)}); let _a = str::all(data, char::is_uppercase); let _b = str::any(data, char::is_uppercase); // let _c = str::map(data, char:...
use super::ECCurve::big::BIG; use super::ECCurve::dbig::DBIG; use super::ECCurve::ecp::ECP; pub type BigNum = BIG; pub type DoubleBigNum = DBIG; pub type GroupG1 = ECP;
/*===============================================================================================*/ // Copyright 2016 Kyle Finlay // // 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 // // ...
use anyhow::{anyhow, Result}; use rusoto_core::{region, HttpClient}; use rusoto_credential::ProfileProvider; use rusoto_ec2::Ec2Client; use rusoto_ecs::EcsClient; use structopt::StructOpt; mod application; mod domain; mod settings; mod ui; /// Connect to AWS EC2 hosts via a Bastion / Jump host #[derive(StructOpt)] #[...
//! This crate is responsible for doing the binary encoding for SVM transactions. //! It code is compiled as a single WASM file and it should be integrated by clients (e.g `smapp / CLI Wallet`). //! //! By doing that, a client can locally encode a binary transaction without having to re-implement all the logic //! of t...
use wasm_bindgen::prelude::*; use js_sys::{Array}; #[wasm_bindgen] pub fn calculation(x:i32,y:i32) -> i32{ x+y }
use std::io::Error as IoError; use rustc_serialize::base64::FromBase64Error; use rustc_serialize::json::{EncoderError, /*DecoderError*/}; use mongodb::error::Error as MongoError; use storage::error::StorageError; #[derive(Debug)] pub enum CommandError { Io(IoError), Mongo(MongoError), MissingField(String)...
// #[no_mangle] keeps Rust from "mangling" the name of the exported functoin // extern "C" means to use the C ABI to expose this function, allowing C# to pull it in #[no_mangle] pub extern "C" fn multiply(a: i32, b: i32) -> i32 { a * b } #[no_mangle] pub extern "C" fn hamming_distance(a: u32, b: u32) -> u32 { ...
use std::collections::HashSet; use std::io::{self}; fn main() -> io::Result<()> { let f = "input.txt"; let vec: Vec<i32> = std::fs::read_to_string(f)? .lines() .map(|x| x.parse::<i32>().unwrap()) .collect(); let mut numbers = HashSet::new(); for my_int in &vec { if numb...
pub mod codec; pub mod convert; pub mod error; pub mod hash; pub mod ipld; pub use cid;
#[doc = "Reader of register UARTDR"] pub type R = crate::R<u32, super::UARTDR>; #[doc = "Writer for register UARTDR"] pub type W = crate::W<u32, super::UARTDR>; #[doc = "Register UARTDR `reset()`'s with value 0"] impl crate::ResetValue for super::UARTDR { type Type = u32; #[inline(always)] fn reset_value() ...
#[doc = "Reader of register LL_CONTROL"] pub type R = crate::R<u32, super::LL_CONTROL>; #[doc = "Writer for register LL_CONTROL"] pub type W = crate::W<u32, super::LL_CONTROL>; #[doc = "Register LL_CONTROL `reset()`'s with value 0x02"] impl crate::ResetValue for super::LL_CONTROL { type Type = u32; #[inline(alw...
// error-pattern:sequence in for each loop not a call fn main() { for each p in 1 { } }
fn get_area(k: i128, factor: i128) -> Option<i128> { let area_squared = (3 * k + factor) * k * k * (k + factor); let area = (area_squared as f64).sqrt(); if (area == (area as u128) as f64) && ((area as i128) * (area as i128) == area_squared) { return Some(area as i128); } None } fn main() ...
fn main() { nested(); } // 嵌套函数 fn nested() { // 初始化嵌套函数multi, 它是一个函数类型的变量 fn multi(x: i32) -> i32 { x * 2 } // 输出变量multi结果 assert_eq!(14, multi(7)); // 变量传递multi - bar let bar: fn(i32) -> i32 = multi; assert_eq!(14, bar(7)); }
#![allow(while_true)] #[path = "libs/utils.rs"] mod utils; pub fn execute(numero_max_cidades: &u8, matriz_distancias: &Vec<Vec<u16>>) { let tamanho_array: usize = (*numero_max_cidades + 1) as usize; let limite_destino_final: usize = *numero_max_cidades as usize; let mut cidade_inicial: i8 = -1; while...
use super::*; use syn::{ Lit, Ident }; use crate::util::{ lit_from_meta_attribute }; use proc_macro2::TokenStream; //This gets the attributes of the parent enum pub fn get_enum_attributes(attrs : &Vec<syn::Attribute>, parent_data_type : &ParentDataType) -> EnumDiscriminant { let discriminant_data_type : FieldData...
use std::fmt::Debug; use crate::{ version::repository::VersionRepository, version_revision_resolver::{vrr_id::VrrId, VersionRevisionResolver}, vtable::repository::VTableRepository, }; /// Types that must be implemented in an infrastructure layer. pub trait ImmutableSchemaAbstractTypes: Debug + Sized { ...
//! Cortex-M Security Extensions //! //! This module provides several helper functions to support Armv8-M and Armv8.1-M Security //! Extensions. //! Most of this implementation is directly inspired by the "Armv8-M Security Extensions: //! Requirements on Development Tools" document available here: //! https://developer...
use diesel::RunQueryDsl; use radmin::diesel::PgConnection; use radmin::serde::{Deserialize, Serialize}; use crate::models::Email; use crate::schema::email_addresses; #[derive(Debug, PartialEq, Clone, Serialize, Deserialize, Insertable)] #[table_name = "email_addresses"] pub struct EmailFactory { pub account: Stri...
use super::readers::{ReadAllFn, ReadFn}; use super::writers::{FlushFn, WriteFn}; use duktape::prelude::*; pub(crate) fn build_readwriter<'a>(ctx: &'a Context) -> DukResult<Function<'a>> { let mut readwriter = class::build(); readwriter .name("ReadWriter") .method( "write", ...
// id number A unique numeric ID that can be used to // identify and reference an action. // status string The current status of the action. This can // be "in-progress", "completed", or "errored". // type string This is the type of action that the object /...
use core::cell::UnsafeCell; use core::marker::{PhantomData, PhantomPinned}; use core::pin::Pin; use embassy::interrupt::{Interrupt, InterruptExt}; pub trait PeripheralState { type Interrupt: Interrupt; fn on_interrupt(&mut self); } pub struct PeripheralMutex<S: PeripheralState> { state: UnsafeCell<S>, ...
#[cfg(feature = "backend_session_logind")] pub mod logind;
mod instruction; mod operation; use instruction::Instruction; #[derive(Debug, Clone)] pub struct State{ input: Vec<i64>, output: Vec<i64>, address: i64, opcodes: Vec<i64>, relative_base: i64 } #[derive(Debug)] pub enum HaltState{ WaitingForInput, Done } pub fn address_counter(opcodes: &V...
#![cfg_attr(not(feature = "std"), no_std)] //! A circle buffer for use with [std::io::Read] //! ``` //! # use jcirclebuffer::CircleBuffer; //! use std::io::Read; //! let mut some_read = std::io::Cursor::new(b"banana"); //! //! let mut my_buf = CircleBuffer::default(); //! let read_zone: &mut [u8] = my_buf.get_fillable...
use {user_fn, free_fn, ast_fn, Context, State}; // Keep these here for when you want to build huge changes // pub fn load_all<T>(_: T) {} // pub fn load_debug<T>(_: T) {} pub mod arithmetic; pub mod math; pub mod core; pub mod types; pub mod list; pub mod logical; pub mod map; pub mod debugger; pub mod option; pub ...
mod builder; mod genesis; pub mod handlers; pub mod helpers; pub mod networker; mod pool; pub mod requests; mod runner; mod types; pub use self::builder::PoolBuilder; pub use self::genesis::PoolTransactions; pub use self::pool::{LocalPool, Pool, PoolImpl, SharedPool}; pub use self::requests::{RequestResult, RequestTar...
use kiss3d::camera::ArcBall; use kiss3d::light::Light; use kiss3d::nalgebra::{Point3, Translation3, UnitQuaternion, Vector3}; use kiss3d::scene::SceneNode; use kiss3d::window::Window; const POLE_HALF_LENGTH: f32 = 1.0; const POLE_LENGTH: f32 = 2.0 * POLE_HALF_LENGTH; const POLE_Z_SHIFT: f32 = POLE_HALF_LENGTH + 0.11; ...
//! Combat must happen AFTER states have been calcualted so that we aren't in combat with a //! unit that got cleaned up at the end of the last loop // TODO unit timers on how fast combat should happen use bevy::prelude::*; use crate::*; pub fn unit_melee_system( mut unit_events: ResMut<Events<UnitInteractionEv...
//! # The level (`*.lvl`) file format //! //! This module can be used to read the level file format //! used in the game LEGO Universe. pub mod file; pub mod parser; pub mod reader;
use std::{convert::TryInto, io::Write}; use anyhow::Result; use byteorder::{LittleEndian, WriteBytesExt}; use pasture_core::nalgebra::Vector3; use super::BitAttributes; /// Writes the given world space position as a LAS position to the given `writer` pub(crate) fn write_position_as_las_position<T: Write>( world_...
pub fn square(s: u32) -> u64 { if s<1 || s>64 { panic!("Square must be between 1 and 64"); } 1u64 << (s-1) } pub fn total() -> u64 { u64::max_value() }
use rocket::{ Rocket, Request, Data, Response }; use rocket::http::{ Method, Status, ContentType }; use rocket::fairing::{ Fairing, Info, Kind }; #[derive(Default)] pub struct Logger {} impl Fairing for Logger { fn info(&self) -> Info { Info { name: "Logger Fairing", kind: Kind::Launch | Kind::Request | Kind...
use serde::{Deserialize, Serialize}; // Topology shows us the current state of the overall Nym network #[derive(Serialize, Deserialize, Debug)] pub struct Topology { pub validators: Vec<Validator>, pub mix_nodes: Vec<MixNode>, pub service_providers: Vec<ServiceProvider>, } #[derive(Serialize, Deserialize,...
extern crate regex; use regex::Regex; use std::fs::File; use std::io::prelude::*; fn read_data(filepath: &str) -> std::io::Result<String> { let mut file = File::open(filepath)?; let mut contents: String = String::new(); file.read_to_string(&mut contents)?; Ok(contents.trim().to_string()) } fn sol1() ...
pub struct Link <T> { source: T, target: T, root_as_source: T, left_as_source: T, right_as_source: T, size_as_soucre: T, root_as_target: T, left_as_target: T, right_as_target: T, size_as_target: T }
//! Experiments with parallel processing //! //! The provided functions focus on the possibility of //! returning results while the parser proceeds. Sequences are processesd in //! batches (`RecordSet`) because sending across channels has a performance //! impact. FASTA/FASTQ records can be accessed in both the 'worker...
use chrono::NaiveDateTime; use sqlx::FromRow; #[derive(Debug, FromRow)] pub struct Submit { pub id: i64, pub user_id: i64, pub problem_id: i64, pub path: String, pub status: String, pub point: Option<i32>, pub execution_time: Option<i32>, pub execution_memory: Option<i32>, pub compil...
use std::{env, fs::{create_dir, remove_dir_all}}; use std::str; use std::vec::Vec; use std::fs::File; use libc; use quick_xml::{Reader, events::{BytesStart, Event}}; use std::{ffi::CString, io::prelude::*}; use std::sync::{Arc, Mutex, atomic::{AtomicBool, AtomicI32, Ordering}}; use curl::easy::Easy; fn process_ovf_xml...
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved. //! This module contains shared functions for use by tests. use std::sync::Arc; use hash::HashMap; use hash::HashSet; use ir_core::constant::Constant; use ir_core::instr; use ir_core::BlockId; use ir_core::Func; use ir_core::FuncBuilder; use ir...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use super::{models, API_VERSION}; #[non_exhaustive] #[derive(Debug, thiserror :: Error)] #[allow(non_camel_case_types)] pub enum Error { #[error(transparent)] CheckServiceProviderAvailability(#[fr...
use amethyst::{assets::PrefabLoader, core::Transform, ecs::prelude::*, prelude::*, renderer::*}; use amethyst_gltf::{GltfPrefab, GltfSceneFormat, GltfSceneOptions}; use components::*; use core::math::*; use core::ServerMessageBody; use {state::MainState, GltfCache, PlayerLookup, ReadConnection}; /// Game state that wa...
use crate::backend::RequestOptions; use crate::{ backend::{Backend, BackendInformation, Token}, components::placeholder::Placeholder, data::{SharedDataBridge, SharedDataOps}, error::error, page::AppPage, preferences::Preferences, }; use anyhow::Error; use chrono::{DateTime, Utc}; use drogue_clou...
use num_bigint::BigUint; use num_traits::cast::{FromPrimitive, ToPrimitive}; use orion::aead; #[allow(dead_code)] use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::io::prelude::*; use blake2::{Blake2b, Digest}; use zeroize::Zeroize; const ENCRYPTION_SALT: [u8; 64] = [ 0xe3, 0x1a, 0x0c, 0...
//! 🦇 BATS! 🦇 #![doc( html_logo_url = "https://raw.githubusercontent.com/tarcieri/bats/batcave/img/cutebat.png", html_root_url = "https://docs.rs/bats/0.10.31" )] #![warn(missing_docs, rust_2018_idioms)] use crossterm::{cursor, terminal}; use gumdrop::Options; use rand::{thread_rng, Rng}; use std::{thread::...
use crate::emoji; use crate::user::User; pub fn whoami(user: &User) { let user = &user.data; println!( "{} You are logged with the email '{}'.", emoji::WAVING, user.email ); }
#[doc = "Reader of register CLK_CAL_CNT2"] pub type R = crate::R<u32, super::CLK_CAL_CNT2>; #[doc = "Reader of field `CAL_COUNTER2`"] pub type CAL_COUNTER2_R = crate::R<u32, u32>; impl R { #[doc = "Bits 0:23 - Up-counter clocked on fast DDFT output #1 (see TST_DDFT_FAST_CTL). When CLK_CAL_CNT1.CAL_COUNTER_DONE==1, ...
#![no_std] #![allow(non_snake_case)] #![allow(unused)] #![allow(non_camel_case_types)] // GEN CUT HERE include!(concat!(env!("OUT_DIR"), "/src/lib_inner.rs"));
#[doc = "Register `WISR` reader"] pub type R = crate::R<WISR_SPEC>; #[doc = "Field `TEIF` reader - TEIF"] pub type TEIF_R = crate::BitReader; #[doc = "Field `ERIF` reader - ERIF"] pub type ERIF_R = crate::BitReader; #[doc = "Field `BUSY` reader - BUSY"] pub type BUSY_R = crate::BitReader; #[doc = "Field `PLLLS` reader ...
use sudo_test::{Command, Env, TextFile}; use crate::{ visudo::{CHMOD_EXEC, DEFAULT_EDITOR, EDITOR_TRUE, ETC_SUDOERS, LOGS_PATH, TMP_SUDOERS}, Result, SUDOERS_ALL_ALL_NOPASSWD, SUDOERS_ROOT_ALL, USERNAME, }; macro_rules! assert_snapshot { ($($tt:tt)*) => { insta::with_settings!({ filter...
pub const ANSI_R_F: &'static str = "\u001b[31m" ; pub const ANSI_B_F: &'static str = "\u001b[34m" ; pub const ANSI_G_F: &'static str = "\u001b[32m" ; pub const ANSI_Y_F: &'static str = "\u001b[33m" ; pub const ANSI_M_F: &'static str = "\u001b[35m" ; pub const ANSI_C_F: &'static str = "\u001b[36m" ; pub const ANSI_W_F: ...
use crate::data::Symbol; // use crate::cli::Listable; const DEFAULT: [&str; 10] = [ "SPY", "TSLA", "DIS", "AMD", "NVDA", "AAPL", "MSFT", "FB", "GOOG", "AMZN", ]; pub fn get_watch_list(s: &[Symbol]) -> Vec<Symbol> { s.to_vec() .into_iter() .filter(|s| DEFAUL...
use nb::block; use embedded_hal::digital::v2::OutputPin; use stm32f1xx_hal::{pac, prelude::*, timer::Timer}; pub fn blink() -> ! { let cp = cortex_m::Peripherals::take().unwrap(); let dp = pac::Peripherals::take().unwrap(); let mut flash = dp.FLASH.constrain(); let mut rcc = dp.RCC.constrain(); ...
extern crate metric; use std::fmt::Debug; use metric::temperature::*; /// will determine whether a given temperature is in danger of /// reaching the freezing point of water pub fn in_danger_of_freezing<T>(temp: &T) -> bool where T: PartialOrd<Celsius> { *temp < Celsius(5.0) } pub fn print_danger<T>(temp: T) ...