text
stringlengths
8
4.13M
// Copyright 2020 Datafuse Labs. // // 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 ...
use crate::{DocBase, VarType}; const DESCRIPTION: &'static str = r#" The CCI (commodity channel index) is calculated as the difference between the typical price of a commodity and its simple moving average, divided by the mean absolute deviation of the typical price. The index is scaled by an inverse factor of 0.015 t...
mod disassembler; mod cpu; use std::env; use cpu::Cpu; use disassembler::disassemble; use raylib::prelude::*; fn main() { let args: Vec<String> = env::args().collect(); if args.len() < 2 { panic!("rom path not provided"); } let instructions = disassemble(&args[1]); let mut cpu = Cpu { m...
extern crate serde; mod test_utils; use flexi_logger::LoggerHandle; use hdbconnect::HdbResult; use log::*; use std::time::Instant; #[test] fn test_012_connect_other_user() -> HdbResult<()> { let mut log_handle = test_utils::init_logger(); let start = Instant::now(); connect_other_user(&mut log_handle)?; ...
pub mod names; pub mod sectors; pub mod business; pub mod world; pub mod stocks;
use super::super::class::class::Class; use super::super::gc::gc::GcType; use super::jit::*; use super::{ frame::{Array, ObjectBody, VariableType}, vm::RuntimeEnvironment, }; use llvm; use llvm::{core::*, prelude::*}; use rustc_hash::FxHashMap; use std::ffi::CString; #[rustfmt::skip] pub unsafe fn native_functi...
extern crate amethyst; use amethyst::prelude::*; struct MenuState { } impl SimpleState for MenuState { }
//! libc syscalls supporting `rustix::rand`. #[cfg(linux_kernel)] use {crate::backend::c, crate::backend::conv::ret_usize, crate::io, crate::rand::GetRandomFlags}; #[cfg(linux_kernel)] pub(crate) fn getrandom(buf: &mut [u8], flags: GetRandomFlags) -> io::Result<usize> { // `getrandom` wasn't supported in glibc un...
use crate::libbb::getopt32::getopt32; use libc; use libc::getutxent; use libc::localtime; use libc::sysinfo; use libc::time; // When reading the utmp entries with getuxent, this identifies // a user entry. const UTMP_USER_PROCESS: libc::c_short = 7; fn get_users() -> u32 { let mut users = 0; unsafe { while le...
mod api; mod components; mod containers; mod router; mod state; mod ui; mod utils; use common::User; use seed::{prelude::*, App}; use crate::containers::app; use crate::state::{update, Model, ModelEvent}; #[wasm_bindgen] pub fn start() { seed::log!("Booting client application."); let mut model = Model::defau...
#![cfg(target_arch = "x86_64")] use std::arch::x86_64::*; use crate::detail::sse::{rcp_nr1}; use crate::detail::sandwich::{sw02, sw32, sw_l2}; use crate::util::ApplyTo; use crate::{Line, Plane, Point}; /// \defgroup translator Translators /// /// A translator represents a rigid-body displacement along a normalized a...
use crate::linked_list::{LinkedList, Node}; use crate::loom::sync::atomic::{AtomicIsize, Ordering}; use crate::loom::sync::Mutex; use crate::loom::thread; use crate::parker::Parker; use crate::tag::Tag; use std::mem; use std::ptr; /// The type of the prelude function. pub(super) type Prelude = dyn Fn() + Send + 'stati...
pub mod rectangable; pub mod relative;
use legion::prelude::Entity; #[derive(Clone, Copy, Debug, PartialEq)] pub struct Attacking { pub range: f32, pub reload_time: f32, pub wind_up_time: f32, pub state: AttackingState, pub attacking_type: AttackingType, pub timer: f32, pub target: Option<Entity>, } impl Attacking { pub fn ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type SpatialGestureRecognizer = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct SpatialGestureSettings(pub u32); impl SpatialGestureSettings { ...
use dataflow::ops::filter::FilterCondition; use node::{MirNode, MirNodeType}; use query::MirQuery; use MirNodeRef; use std::collections::HashMap; pub fn optimize(q: MirQuery) -> MirQuery { //remove_extraneous_projections(&mut q); q } pub fn optimize_post_reuse(_q: &mut MirQuery) { // find_and_merge_filte...
use base64::Engine; pub mod options; pub fn basic_header(username: &str, password: &str)->String{ base64::engine::general_purpose::STANDARD.encode( format!( "{}:{}", username, password ) ) }
fn main(){ proconio::input!{n:u64,m:i64,l:[(i64,i64);n]} println!("{}",l.iter().filter(|(x,y)|x*x+y*y<=m*m).count()) }
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use std::collections::hash_map::Entry; use std::collections::HashMap; use std::hash::Hash; use fuchsia_async as fasync; use futures::channel::mpsc::Unboun...
//! Delay use crate::hal::blocking::delay::{DelayMs, DelayUs}; use crate::hal::timer::{Cancel, CountDown}; use crate::pac::hstimer::HSTIMER; use crate::{ ccu::{Ccu, Clocks}, timer::Timer, }; use cortex_a::asm; use embedded_time::{ duration::{Duration, Microseconds, Milliseconds}, rate::Hertz, }; use nb...
use std::sync::mpsc::Receiver; use crate::backup_file::BackupFile; use crate::chunk::Chunk; pub fn run(destinations: &mut Vec<BackupFile>, write_queue_consume: Receiver<(usize, Chunk)>) { while let Ok((device_number, chunk)) = write_queue_consume.recv() { destinations[device_number].write_chunk(chunk); ...
/* * @lc app=leetcode.cn id=93 lang=rust * * [93] 复原IP地址 * * https://leetcode-cn.com/problems/restore-ip-addresses/description/ * * algorithms * Medium (42.77%) * Total Accepted: 6.3K * Total Submissions: 14.7K * Testcase Example: '"25525511135"' * * 给定一个只包含数字的字符串,复原它并返回所有可能的 IP 地址格式。 * * 示例: * * 输...
use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use std::str::FromStr; use std::hash::{Hash, Hasher}; use crate::class_file::validated::Instruction; use crate::class_file::unvalidated::AccessFlags; use crate::class_file::unvalidated::{ClassFile as UnvalidatedClassFile}; use crate::class_file::v...
use super::VarResult; use crate::ast::syntax_type::{FunctionType, FunctionTypes, SimpleSyntaxType, SyntaxType}; use crate::helper::err_msgs::*; use crate::helper::str_replace; use crate::helper::{ move_element, pine_ref_to_bool, pine_ref_to_color, pine_ref_to_f64, pine_ref_to_i64, pine_ref_to_string, }; use cra...
use crate::{Fields, Field, Value}; use std::fmt; pub trait Structable { fn fields(&self) -> Fields; // fn field_by_name(&self, name: &str) -> Option<Field>; fn get(&self, field: &Field) -> Option<Value<'_>>; } pub(crate) fn debug(value: &dyn Structable, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { ...
use std::net::Ipv4Addr; use std::net::SocketAddrV6; use ed25519_dalek::PublicKey; use tokio_util::codec::{Decoder, Encoder}; use bytes::BytesMut; use nanocurrency_types::*; use Message; use NanoCurrencyCodec; /// A list of blocks for testing fn get_test_blocks() -> Vec<Block> { let header = BlockHeader { ...
use gccjit::{RValue, ToRValue, Type}; use rustc_ast::ast::{InlineAsmOptions, InlineAsmTemplatePiece}; use rustc_codegen_ssa::mir::operand::OperandValue; use rustc_codegen_ssa::mir::place::PlaceRef; use rustc_codegen_ssa::traits::{AsmBuilderMethods, AsmMethods, BaseTypeMethods, BuilderMethods, GlobalAsmOperandRef, Inlin...
use std::str::FromStr; use argonautica::{ self, config::{Variant, Version}, {Hasher, Verifier}, input::SecretKey, }; use crate::error::{Error, ErrorKind, ParseError}; use failure::format_err; const SALT_SIZE : usize = 32; enum HashVersion { V1, } /// Hash Version v1 impl HashVersion { pub fn from_hash(hash: &...
use cpu::CPU; use std::mem::swap; /// Swap the contents of register pairs HL with DE /// /// # Cycles /// /// 5 /// /// # Arguments /// /// * `cpu` - The cpu to perform the swap in /// pub fn xchg(cpu: &mut CPU) -> u8 { swap(&mut cpu.h, &mut cpu.d); swap(&mut cpu.l, &mut cpu.e); 5 } /// Swap the contents...
use chrono::{DateTime, Duration, TimeZone, Utc}; use std::fmt; use std::str::FromStr; use {Error, Result}; /// A UTC timestamp. Used for serialization to and from the plist date type. #[derive(Clone, Debug, PartialEq)] pub struct Date { inner: DateTime<Utc>, } impl Date { #[doc(hidden)] pub fn from_secon...
#![feature(rustc_attrs)] #![feature(c_unwind)] mod atoms; mod symbols; extern "C" { /// The target-defined entry point for the generated executable. /// /// Each target has its own runtime crate, with its own entry point /// exposed as `firefly_entry`, the core runtime (this crate) calls /// into ...
use bigneon_db::models::UserEditableAttributes; use validator::Validate; #[derive(Default, Deserialize, Validate)] pub struct UserProfileAttributes { pub first_name: Option<String>, pub last_name: Option<String>, #[validate(email)] pub email: Option<String>, pub phone: Option<String>, #[validat...
extern crate proconio; use proconio::input; mod mint { use std::ops::{Add, Div, Mul, Sub}; type Int = i64; pub const MOD: Int = 1_000_000_000 + 7; #[derive(Clone, Copy)] pub struct Mint { x: Int, } impl Mint { pub fn new(x: Int) -> Mint { Mint { ...
pub mod extract; use std::collections::HashMap; use crate::datastore::prelude::*; use crate::datastore::value::ValueType; use chrono::prelude::*; use googapis::google::datastore::v1::Value; use juniper::ID; use prost_types::Timestamp; pub enum DbValue<'a> { /// ID of the entity Id(&'a Entity), /// field-...
//! A minheap that separates values from priorities. //! Intended for use in astar. use std::cmp::Ordering; use std::collections::BinaryHeap; pub struct MinHeap<V: Eq, P: Ord>(BinaryHeap<MinHeapItem<V, P>>); #[derive(Eq, PartialEq)] struct MinHeapItem<V: Eq, P: Ord> { value: V, priority: P, } impl<V: Eq, P:...
#![cfg(feature = "macros")] #![allow(clippy::let_unit_value)] use std::{ pin::Pin, sync::{ atomic::{AtomicUsize, Ordering}, Arc, }, task::{Context as StdContext, Poll}, time::Duration, }; use actix::prelude::*; use actix_rt::time::{interval_at, sleep, Instant}; use futures_core::st...
use std::collections::HashMap; // The base data and measure of "completed-ness" required to be // useable inside of a lattice machine pub trait NodeType { // returns the UUID of the NodeType to be used by the NodeOpt fn uuid(&self) -> String; // returns if the base data type is completed fn is_complete...
use crate::heap::{ DisplayWithSymbolTable, Function, HirId, InlineData, InlineObject, SymbolId, SymbolTable, }; use crate::{fiber::InstructionPointer, heap::Heap}; use candy_frontend::hir; use candy_frontend::rich_ir::ReferenceKey; use candy_frontend::{ mir::Id, module::Module, rich_ir::{RichIr, RichIrB...
use super::grouped::{GroupedOperation, GroupedOperator}; use nom_sql::SqlType; use serde::Deserialize; use std::collections::HashMap; use std::convert::{TryFrom, TryInto}; use prelude::*; // Grouping UDF third attempt // // Grouping udf second attempt // Ohua UDF, first attempt
pub use functional_tests::compiler::*;
use crate::compiling::v1::assemble::prelude::*; use crate::query::BuiltInMacro; /// Compile an expression. impl Assemble for ast::Expr { fn assemble(&self, c: &mut Compiler<'_>, needs: Needs) -> CompileResult<Asm> { let span = self.span(); log::trace!("Expr => {:?}", c.source.source(span)); ...
//! A compositor that can composite [`source`](crate::source)s mod compositor_2d; pub use compositor_2d::Compositor2D;
use super::attributes::{AttributeSchema, BUILTIN_SCHEMAS}; use super::errors::Error; use super::*; use crate::lexer::Span; use regex::Regex; use std::collections::HashMap; use std::convert::TryFrom; pub fn validate_file(file: &File) -> Vec<Error> { let mut validator = Validator::new(); validator.validate(file)...
#[doc = "Reader of register RGCFR"] pub type R = crate::R<u32, super::RGCFR>; #[doc = "Writer for register RGCFR"] pub type W = crate::W<u32, super::RGCFR>; #[doc = "Register RGCFR `reset()`'s with value 0"] impl crate::ResetValue for super::RGCFR { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use super::*; impl<A: Array> iter::Extend<A::Item> for StackVec<A> { #[inline] fn extend<Iterable: IntoIterator<Item = A::Item>> ( self: &mut Self, iterable: Iterable, ) { // This is currently the most optimized `extend` implementation, // branching-prediction-wise ...
#![warn(clippy::all)] #![warn(clippy::pedantic)] fn main() { run(); } #[allow(clippy::cast_possible_truncation)] fn run() { let start = std::time::Instant::now(); // code goes here let limit = 28123; let abundants: Vec<u64> = (1..=limit).filter(|&v| d(v) > v).collect(); let mut abundant_sums = vec![fals...
extern crate sdl2; extern crate cgmath; use cgmath::Vector2; use cgmath::Vector3; use cgmath::InnerSpace; use sdl2::render::Canvas; use sdl2::render::Texture; use sdl2::rect::Rect; use sdl2::keyboard::Keycode; use std::collections::HashSet; use crate::data::WorldMap; use crate::textures::TextureManager; use crate::...
use super::{FunctionData, Value, Location, Map, Type, TypeInfo, Instruction, Cast}; struct TypeContext { creators: Map<Value, Location>, type_info: TypeInfo, } impl TypeContext { fn get_type(&self, value: Value) -> Type { self.type_info.get(&value).copied().unwrap() } } impl FunctionData { ...
//! Functions and data-structures to load descriptor tables. use core::mem::size_of; use current::irq::IdtEntry; use shared::segmentation::SegmentDescriptor; /// A struct describing a pointer to a descriptor table (GDT / IDT). /// This is in a format suitable for giving to 'lgdt' or 'lidt'. #[derive(Debug)] #[repr(C...
use serde::{Deserialize, Serialize}; pub const MAXMIND_CITY_URI: &str = "https://geoip.maxmind.com/geoip/v2.1/city"; /// An API key that can be used to access MaxMind services. #[derive(Serialize, Deserialize, Debug, Clone)] pub struct MaxMindAPIKey { username: String, password: String, } impl MaxMindAPIKey ...
use bytes::{Buf, Bytes}; use crate::error::Error; use crate::io::BufExt; pub trait MssqlBufExt: Buf { fn get_utf16_str(&mut self, n: usize) -> Result<String, Error>; fn get_b_varchar(&mut self) -> Result<String, Error>; fn get_us_varchar(&mut self) -> Result<String, Error>; fn get_b_varbyte(&mut se...
#[cfg(test)] extern crate ftp; use ftp::FtpStream; use std::io::Cursor; #[test] fn test_ftp() { let mut ftp_stream = FtpStream::connect("127.0.0.1:21").unwrap(); println!("Welcome message: {:?}", ftp_stream.get_welcome_msg()); let _ = ftp_stream.login("Doe", "mumble").unwrap(); ftp_stream.mkdir("te...
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use funfsm::constraints::{self, Constraints}; use haret::vr::{VrCtx, VrTypes, VrMsg, VrEnvelope, FsmOutput}; pub fn constraints() -> Constraints<VrTypes> { let mut c = Constraints::new(); invariants(&mut c); ...
use crate::extractors::amp_spectrum; pub fn compute(signal: &Vec<f64>) -> f64 { let amp_spec: Vec<f64> = amp_spectrum::compute(signal); let fraction = amp_spec .iter() .fold((0.0, 0.0), |acc, &x| (acc.0 + x.ln(), acc.1 + x)); (fraction.0 / amp_spec.len() as f64).exp() * amp_spec.len() as ...
#![allow(collapsible_if)] use super::*; use castle; use color::Color; use moves::*; use piece::*; use kind::*; impl Position { pub fn is_pseudo_legal(&self, mv: Move) -> bool { // Source square must not be vacant. let from = mv.from.mask(); let piece = self.board.get_piece(from); i...
/* Heru Handika 19 September 2020 Vector operation modules */ // use std::f64; pub mod vector { pub fn vector_ones(vec_size: usize) -> Vec<i32> { let mut vec_ones: Vec<i32> = Vec::with_capacity(vec_size); for _ in 0..vec_size { vec_ones.push(1); } vec_ones } pub...
use std::ops::Deref; fn main() { let b = Box::new("sample".to_string()); let r1 = b.capacity(); let r2 = b.deref().capacity(); assert_eq!(r1, r2); println!("{}", r1); }
#![feature(used)] pub mod foo { #[no_mangle] #[used] pub static STATIC: [u32; 10] = [1; 10]; pub fn hello() {} } pub fn bar() { foo::hello(); // STATIC not present if commented out }
use std::marker::PhantomData; use super::Key; use super::Session; use super::SessionStore; /// The sessioning middleware. /// /// `Sessions` middleware is given a key-generating function and a /// data store to use for sessioning. /// /// The key is used to select a session from the store. /// No session is actually ...
use challenges::{chal28::*, chal29::*}; fn main() { println!("🔓 Challenge 29"); let mac = SecretPrefixMac::new(); let key_size = deduce_key_size(&mac).unwrap(); let original_msg = "comment1=cooking%20MCs;userdata=foo;comment2=%20like%20a%20pound%20of%20bacon".as_bytes(); let padding = get...
use Action::*; use std::ops::Add; fn main() { let actions = include_str!("input").lines().map(str::parse).map(|x| x.unwrap()); let mut pos = Position { x: 0, daim: 0, real_depth: 0 }; for act in actions { pos = pos + act; }; println!("Part one: {}", pos.x*pos.d...
use crate::{EitherOsStr, IntoOsString, ToOsStr}; use core::{fmt, mem::transmute, ptr::NonNull, slice, str}; #[cfg(feature = "std")] use std::{ffi, os::unix::ffi::OsStrExt}; #[cfg(not(feature = "std"))] extern "C" { /// Yeah, I had to copy this from std #[cfg(not(target_os = "dragonfly"))] #[cfg_attr( ...
//! Bitswap protocol implementation #[macro_use] extern crate tracing; mod behaviour; mod block; mod error; mod ledger; mod prefix; mod protocol; pub use self::behaviour::{Bitswap, BitswapEvent, Stats}; pub use self::block::Block; pub use self::error::BitswapError; pub use self::ledger::Priority; mod bitswap_pb { ...
use num::integer::lcm; #[derive(Clone)] struct Moon { pos: [i64; 3], vel: [i64; 3], } impl Moon { fn new(x: i64, y: i64, z: i64) -> Moon { Moon { pos: [x, y, z], vel: [0, 0, 0] } } fn adjust_vel(&mut self, om: &Moon) { for i in 0..3 { if self.pos[i] != om.pos[i] { ...
extern crate serde; mod test_utils; use flexi_logger::LoggerHandle; use hdbconnect_async::{time::HanaDate, Connection, HdbResult, ToHana}; use log::{debug, info, trace}; use time::{format_description::FormatItem, macros::format_description, Date, Month}; #[tokio::test] // cargo test --test test_024_daydate pub async...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; #[native_implemented::function(maps:values/1)] pub fn result(process: &Process, map: Term) -> exception::Result<Term> { let boxed_ma...
#[cfg(test)] #[path = "./player_tests.rs"] pub mod player_tests; use game::{State, MAX_TRAVERSABLE}; use map::{adj_rooms_to, is_adj}; use map::{RoomNum, NUM_OF_ROOMS}; use message; use std::cell::Cell; use util::{print, read_line, read_sanitized_line}; pub const ARROW_CAPACITY: u8 = 5; #[derive(Debug, Clone, Partial...
//! This example renders a cube to an SVG file using both a perspective camera //! and an orthographic camera. use cam_geom::*; use nalgebra::{ allocator::Allocator, storage::Storage, DefaultAllocator, Dim, Matrix, SMatrix, Unit, Vector3, U1, U2, U3, }; /// Create a perspective camera. fn get_perspective_cam(...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type ConditionForceEffect = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct ConditionForceEffectKind(pub i32); impl ConditionForceEffectKind { ...
use std::cmp::{Ord, Ordering, PartialOrd}; use std::hash::{Hash, Hasher}; use chrono::prelude::*; use failure::Fail; use super::prelude::*; use util::format_error_with_causes; #[derive(Clone, Debug)] pub struct ErrorMessage { pub id: MessageID, pub channel_id: ChannelID, pub text: String, } impl Hash fo...
use lazy_static::lazy_static; use regex::Regex; lazy_static! { static ref NATIONAL_CODE_REGEX: Regex = Regex::new(r"^\d{10}$").unwrap(); } pub fn verify_iranian_national_code<T: AsRef<str>>(code: T) -> bool { let code = code.as_ref(); if !NATIONAL_CODE_REGEX.is_match(code) { return false; } ...
/*! A very simple application that show how to use a flexbox layout. Requires the following features: `cargo run --example flexbox_d --features "flexbox"` */ extern crate native_windows_gui as nwg; extern crate native_windows_derive as nwd; use nwd::NwgUi; use nwg::NativeUi; // Stretch style use nwg::stretc...
use std::any::Any; use crate::mutators::tuples::{RefTypes, TupleMutator, TupleStructure}; use crate::Mutator; pub enum NeverMutator {} impl<T: Clone + 'static> Mutator<T> for NeverMutator { #[doc(hidden)] type Cache = (); #[doc(hidden)] type MutationStep = (); #[doc(hidden)] type ArbitrarySte...
mod utils; fn main() { let data = utils::load_input("./data/day_1.txt").unwrap(); let mut data: Vec<u32> = data .lines() .map(|l| l.trim().parse::<u32>().unwrap()) .collect(); let mut answer_not_found = true; let mut answer_1 = 0; let mut answer_2 = 0; while answer_no...
#[doc = "Reader of register MPCBB2_VCTR46"] pub type R = crate::R<u32, super::MPCBB2_VCTR46>; #[doc = "Writer for register MPCBB2_VCTR46"] pub type W = crate::W<u32, super::MPCBB2_VCTR46>; #[doc = "Register MPCBB2_VCTR46 `reset()`'s with value 0"] impl crate::ResetValue for super::MPCBB2_VCTR46 { type Type = u32; ...
//! Lock file management //! //! When dealing with server software, it is often necessary to make sure that only one instance //! is running at a time. Lock files are a common way to do that. This module provides a //! convenient abstraction over low-level commands for lock file management. All magic is done //! inside...
/// Jika kita mencantumkan semua bilangan asli di bawah 10 yang merupakan kelipatan 3 atau 5, /// kita mendapatkan 3, 5, 6 dan 9. Jumlah kelipatan ini adalah 23. /// Temukan jumlah semua kelipatan 3 atau 5 di bawah 1000. /// bil yg merupakan kelipatan 3 adalah yg habis dibagi 3 fn main() { let mut res = 0; for...
use std::collections::HashMap; use crate::common::{Board, Coordinate, Player}; use crate::strategy::Strategy; use wasm_bindgen::prelude::*; #[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = console)] fn log(s: &str); } pub struct MinMaxStrategy { player: Player, depth: i32, // for memoization b...
extern crate rand; extern crate zktx; extern crate tokio_core; extern crate web3; extern crate protobuf; extern crate rustc_hex; use rand::{Rng, thread_rng}; use zktx::base::*; use zktx::c2p::*; use zktx::p2c::*; use zktx::contract::*; use web3::api::Cita; use web3::transports::Http; use web3::types::{H256, H160, Filt...
//! Ffi-safe equivalents of `std::io::{ErrorKind, Error, SeekFrom}`. #![allow(clippy::missing_const_for_fn)] use std::{ error::Error as ErrorTrait, fmt::{self, Debug, Display}, io::{Error as ioError, ErrorKind, SeekFrom}, }; #[allow(unused_imports)] use core_extensions::SelfOps; use crate::{ std_type...
//! `Mapper` implementation for the hadoop-rs project. extern crate hadoop_rs; use hadoop_rs::mappers::PageRankMapper; fn main() { // execute the mapping phase efflux::run_mapper(PageRankMapper); }
use std::alloc::Layout; use std::mem; use std::ptr::{self, NonNull}; use std::sync::Arc; use crate::borrow::CloneToProcess; use crate::erts::fragment::HeapFragment; use crate::erts::process::alloc::TermAlloc; use crate::erts::process::trace::Trace; use crate::erts::term::prelude::*; use super::AllocResult; /// The r...
use std::process::Command; use std::env; use std::fs; fn main() { let mut args = env::args(); args.next().expect("program name"); match args.next() { Some(ref s) if s == "pgo" => { match args.next() { Some(ref s) if s == "instr" => { match args.next()...
use csv; use std::error; use std::fmt; #[derive(Debug)] struct MultiFrameError {} impl fmt::Display for MultiFrameError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "error that signifies multiple frames were present in file parsing") } } impl error::Error for Mul...
use time::Duration; use nickel_session::{Store}; use nickel_cookies::{SecretKey, KeyProvider}; pub struct ServerData; pub static SECRET_KEY: &'static SecretKey = &SecretKey([0; 32]); impl KeyProvider for ServerData { fn key(&self) -> SecretKey { SECRET_KEY.clone() } } impl Store for ServerData { ty...
pub mod array_strings_are_equal; pub mod balanced_string_split; pub mod binary_search; pub mod buddy_strings; pub mod check_inclusion; pub mod check_perfect_number; pub mod common_chars; pub mod count_consistent_strings; pub mod count_good_triplets; pub mod count_points; pub mod count_primes; pub mod decompress_rl_elis...
#![allow(clippy::cast_possible_truncation)] #![allow(clippy::cast_precision_loss)] #![allow(clippy::cast_lossless)] #![allow(clippy::too_many_lines)] #![allow(clippy::module_name_repetitions)] #![allow(clippy::similar_names)] //! Utility to retreive and format weather data from openweathermap.org //! //! ```bash //! P...
use std; use std::{ptr, slice}; use std::old_io::{timer}; use std::num::{Int}; use std::raw::{Slice}; use std::mem::{transmute}; use std::time::{Duration}; use std::path::{PathBuf}; use std::ffi::{OsStr}; use std::os::unix::{OsStrExt, OsStringExt}; use comm::{self, spsc}; use core::ll::*; use core::{Address, ClientId...
use crate::rr_tools_lib::rrxml::parcel::Parcel; use std::path::PathBuf; pub type Checks = Vec<Parcel>; pub type SuccesfullRrXmls = Vec<PathBuf>; pub type Merged = Option<Result<PathBuf, PathBuf>>; #[derive(Clone)] pub enum Message { UpdateLabel(String), CheckCompleted(Checks), ToDxfCompleted(SuccesfullRrX...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - DMA mode register"] pub dmamr: DMAMR, #[doc = "0x04 - System bus mode register"] pub dmasbmr: DMASBMR, #[doc = "0x08 - Interrupt status register"] pub dmaisr: DMAISR, #[doc = "0x0c - Debug status register"] ...
use game_core::GameStage; use game_lib::{ bevy::{ecs as bevy_ecs, prelude::*}, tracing::{self, instrument}, }; use std::time::Duration; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Debug, Hash)] pub struct Timed(Duration); impl Timed { pub fn new(lifetime: Duration) -> Self { Timed(lifeti...
//! CM3's Private Peripheral Bus pub mod scb; pub mod systmr; pub mod nvic; pub mod mpu;
//! Test suite for the Web and headless browsers. #![cfg(target_arch = "wasm32")] // Necessary for the assert_eq! which now fails clippy #![allow(clippy::eq_op)] extern crate wasm_bindgen_test; use wasm_bindgen_test::*; wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn pass() { assert_eq!(1 ...
/// tests for this pallet use super::*; use itertools::Itertools; use log; use more_asserts::*; use quickcheck::{QuickCheck, TestResult}; use rand::{thread_rng, Rng}; use std::sync::atomic::{AtomicU64, Ordering}; use frame_support::{assert_ok, impl_outer_origin, parameter_types, weights::Weight}; use sp_core::H256; us...
use chrono::Utc; use serde_derive::{Deserialize, Serialize}; #[derive(Debug, Serialize)] pub struct Budget { pub id: i32, pub name: String, pub open: chrono::DateTime<Utc>, pub close: chrono::DateTime<Utc>, } impl Budget { pub fn new( id: i32, name: &String, open: chrono::D...
//! Syntax highlighting for buffer contents via [tree-sitter]. //! //! # Notes about `Range` //! //! This module uses tree-sitter's convenient `Range` type for representing regions of the buffer, //! but it differs slightly from the other geometric types used by the editor: //! //! - Ranges are endpoint-exclusive only ...
use conrod; #[derive(Debug, Clone, Copy)] pub struct Color { r: f32, g: f32, b: f32, a: f32, } pub const LIGHT_BLUE: Color = Color { r: 0.203, g: 0.59375, b: 0.85547, a: 1.0, }; pub const DARK_BLUE: Color = Color { r: 0.1601, g: 0.5, b: 0.72265, a: 1.0, }; pub const L...
#![allow(unused_variables, dead_code)] use azul_css::{ StyleTextAlignmentHorz, StyleTextAlignmentVert, ScrollbarInfo, }; pub use webrender::api::{ GlyphInstance, LayoutSize, LayoutRect, LayoutPoint, }; pub use harfbuzz_sys::{hb_glyph_info_t as GlyphInfo, hb_glyph_position_t as GlyphPosition}; pub type WordInd...
// Copyright 2013-2017, The Gtk-rs Project Developers. // See the COPYRIGHT file at the top-level directory of this distribution. // Licensed under the MIT license, see the LICENSE file or <http://opensource.org/licenses/MIT> #![allow(unused_imports)] #[macro_use] extern crate bitflags; #[macro_use] extern crate lazy_...
use std::ops::Deref; use std::str; use ::bytes::{Bytes, BytesMut, IntoBuf, Buf, BufMut, BigEndian}; use ::enum_primitive::FromPrimitive; use super::types::*; use super::Header; use ::errors::{Result, ErrorKind, ResultExt}; pub struct ConnectFlags(ConnFlags); impl From<ConnFlags> for ConnectFlags { fn from(flags: ...