text
stringlengths
8
4.13M
use super::traits::{Category, ComplexType, DataType, PineType, SecondType, SimpleType}; use std::cell::RefCell; use std::ops::{Deref, DerefMut}; use std::rc::Rc; // PineRef contain the pointer to pine type object. #[derive(Debug)] pub enum PineRef<'a> { Box(Box<dyn PineType<'a> + 'a>), Rc(Rc<RefCell<dyn PineTy...
extern crate grpc; use rand_service; use std::thread; fn main() { let tls = false; let port = if !tls { 50051 } else { 50052 }; let mut server = grpc::ServerBuilder::new_plain(); server.http.set_port(port); server.add_service(rand_service::rand_grpc::RandServer::new_service_def( ...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless ...
pub mod runner_proto;
// camera.rs // // Copyright (c) 2019, Univerisity of Minnesota // // Author: Bridger Herman (herma582@umn.edu) //! Scene camera (FPS-style) use std::f32::consts; use glam::{Mat4, Quat, Vec2, Vec3}; use crate::traits::Update; use crate::transform::Transform; const ANGULAR_VELOCITY: f32 = 0.007; const LINEAR_VELOCI...
use core::{Color, DisplayBuffer, Face, Renderable}; use na::{Vector2, Vector3}; /// Get barycentric coordinates for a point P with respect to a triangle ABC /// /// # Arguments /// /// * 'a' Vertex A of the triangle ABC /// * 'b' Vertex B of the triangle ABC /// * 'c' Vertex C of the triangle ABC /// * 'p' Point P for...
//! Database for the querier that contains all namespaces. use crate::{ cache::CatalogCache, ingester::IngesterConnection, namespace::{QuerierNamespace, QuerierNamespaceArgs}, parquet::ChunkAdapter, query_log::QueryLog, table::PruneMetrics, }; use async_trait::async_trait; use backoff::{Backoff...
use serde::{Deserialize, Serialize}; use wasm_bindgen::prelude::*; #[derive(Debug, Default, Serialize, Deserialize)] struct MetaScreenshot { pub id: String, #[serde(default)] pub preview: bool, } #[derive(Debug, Default, Serialize, Deserialize)] struct MetaScreenshotResponse { pub id: String, pub ...
//https://leetcode.com/problems/minimum-operations-to-make-the-array-increasing/submissions/ impl Solution { pub fn min_operations(mut nums: Vec<i32>) -> i32 { let mut num_of_operations = 0; for i in 1..nums.len() { num_of_operations += 0.max(nums[i-1] - nums[i] + 1); ...
fn fahrenheit_to_celsius(value: f32) -> f32 { return (value - 32.0) / 1.8 } fn main() { let fahrenheit: f32 = 96.0; println!("{} degrees fahrenheit is {} degrees celsius!", fahrenheit, fahrenheit_to_celsius(fahrenheit)); }
// 模块化 module mod front_of_house { pub mod hosting { pub fn add_to_wait_list() {} fn seat_at_table() { } } mod serving { fn take_order() {} pub fn serve_order() {} fn take_payment() {} } pub mod back_of_house { fn fix_incorrect_order() { ...
extern crate quickersort; pub mod statests; pub struct MT { state : [u64; 624], index: u32 } impl MT { pub fn new() -> MT { MT {state: [0;624], index: 0} } pub fn seed(self: &mut MT, seed: u64) { self.state[0] = seed & 0xffffffff ; for i in 1..624 { let x = i...
extern crate fuel_requirements; use fuel_requirements::*; fn main() { let sum: isize = data::data().into_iter() .flat_map(Fuel) .sum(); println!("{}", sum); }
extern crate seedlink; extern crate miniseed; use seedlink::SeedLinkClient; #[test] #[ignore] fn read() { let mut slc = SeedLinkClient::new("rtserve.iris.washington.edu",18000); let mut data = vec![0u8;2048]; // Say Hello slc.hello().expect("bad write"); // Read Response let n = slc.read(...
use std::collections::HashMap; use std::convert::TryFrom; use anyhow::anyhow; use anyhow::ensure; use anyhow::Result; use insideout::InsideOut; use rusqlite::types::ToSql; use rusqlite::OptionalExtension; use crate::nexus::AttachmentStatus; use crate::nexus::Doc; type Cache = (&'static str, HashMap<String, i64>); p...
use crate::{ error::Error::{Indeterminate, OverFlow}, Result, }; use num::{ bigint::Sign, integer::{gcd, ExtendedGcd}, traits::Pow, BigInt, BigUint, Integer, One, ToPrimitive, Zero, }; pub fn power_iu(a: &BigInt, b: &BigUint) -> Result<BigInt> { if a.is_zero() && b.is_zero() { retur...
use super::cpu; use super::memory; pub struct NES { cpu: cpu::Cpu, } impl NES { pub fn new(rom: Vec<u8>) -> NES{ let memory = memory::Memory::new(rom); NES { cpu: cpu::Cpu::new(memory) } } pub fn power_on_reset(&mut self){ self.cpu.power_on_reset(); } ...
use serde::Deserialize; impl ToString for WeaponType { fn to_string(&self) -> String { match self { WeaponType::WeaponBow => { "Bow".to_owned() } WeaponType::WeaponCatalyst => { "Catalyst".to_owned() } WeaponType::W...
use std::time::SystemTime; struct EventLoop { initial_time_offset: i32 } impl EventLoop { pub fn new() -> EventLoop { EventLoop { initial_time_offset: 0 } } pub fn init() { } pub fn shutdown() { } pub fn get_event() { loop { } } ...
use crate::compiling::v1::assemble::prelude::*; /// Compile a `yield` expression. impl Assemble for ast::ExprYield { fn assemble(&self, c: &mut Compiler<'_>, needs: Needs) -> CompileResult<Asm> { let span = self.span(); log::trace!("ExprYield => {:?}", c.source.source(span)); if let Some(e...
//! An implementation of the segmented sieve of Eratosthenes. use std::cmp::min; use std::slice::from_raw_parts_mut; use iterator::SieveIterator; use segment::set_off; use wheel::Wheel30; const MODULUS: u64 = 240; const SEGMENT_LEN: usize = 32768; const SEGMENT_SIZE: u64 = MODULUS * SEGMENT_LEN as u64; /// Returns ...
/* Project Euler Problem 7: By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. What is the 10 001st prime number? */ fn is_prime(x: i64) -> bool { if x == 2 || x == 3 { return true; } else if x % 2 == 0 || x % 3 == 0 { return false; } ...
//! Rust Builder for [Mongo DB](https://github.com/mongo-db/mongo). //! //! This crate is intended for use with //! [rub](https://github.com/rust-builder/rub). //! //! If you don't have `rub` installed, visit https://github.com/rust-builder/rub //! for installation instructions. //! //! # Rub Options //! <pre> //! $ ru...
use std::rc::Rc; use screen::dimension::Dimension; use screen::layout::hlayout::HLayout; use screen::layout::vlayout::VLayout; use screen::screen::Screen; use screen::layout::str_layout::StrLayout; pub type LayoutRc = Rc<dyn Layout>; pub trait Layout where Self: Dimension, { fn to_screen(&self, x: usize, y: ...
//! Compute expected value for the optimal strategy in every state of //! Super Yahtzee. Takes between 100 and 140 minutes to compute. extern crate yahtzeevalue; extern crate byteorder; use std::{io, fs}; use byteorder::{LittleEndian, WriteBytesExt}; use yahtzeevalue::compute_state_value; fn main() { let file =...
use std::fmt; use std::cmp; use rand::thread_rng; use rand::Rng; use model::sectors::Sector; pub type Ticker = String; #[derive(Debug)] pub struct Business { /// Legal name of this business pub name: String, pub ticker: Ticker, /// 0 to 1 estimate of the quality of management leadership: f32, ...
// Copyright 2022 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 ...
extern crate tcod; extern crate rand; use util::{Point}; use util::Contains::{ DoesContain, DoesNotContain }; use game::Game; use traits::Updates; use self::tcod::input::KeyCode; use self::rand::{ thread_rng, Rng }; use self::tcod::console::{ Console, Root, BackgroundFlag }; pub struct NPC { pub position: Point, ...
use bitcoin::{Transaction, Script, TxOut, TxIn, OutPoint}; pub(crate) use inner::Weight; // ensure explicit constructor mod inner { use std::ops::{Add, Sub, AddAssign, SubAssign, Mul, Div}; use crate::fee_rate::FeeRate; /// Represents virtual transaction size #[derive(Debug, Copy, Clone, Eq, PartialE...
//! Parsers recognizing numbers #![allow(clippy::match_same_arms)] pub mod bits; #[cfg(test)] mod tests; use crate::combinator::repeat; use crate::error::ErrMode; use crate::error::ErrorKind; use crate::error::Needed; use crate::error::ParserError; use crate::lib::std::ops::{Add, Shl}; use crate::stream::Accumulate...
// temporary, need to figure out why applying this before the include doesn't work #![cfg_attr(feature = "cargo-clippy", allow(suspicious_else_formatting, single_match, cyclomatic_complexity, unit_arg, naive_bytecount, len_zero))] #[derive(Serialize)] pub enum RootTypes { Scalar(DataModelScalarDeclaration), Ty...
//! Truth tables. use crate::ir; use fxhash::FxHashMap; use itertools::Itertools; use log::debug; use std; use std::collections::hash_map; use utils::*; /// Lists the rules to apply for each combinaison of input. #[derive(Debug)] struct TruthTable { values: Vec<(usize, Vec<ir::ValueSet>)>, rules: NDArray<Cell>...
use proconio::{input, marker::Bytes}; use rolling_hash::RollingHash; fn main() { input! { n: usize, t: Bytes, }; let mut rt = t.clone(); rt.reverse(); let t: Vec<u64> = t.into_iter().map(|b| u64::from(b)).collect(); let rt: Vec<u64> = rt.into_iter().map(|b| u64::from(b)).collec...
fn main() { println!("Usage: cargo run --bin (produce|consume)"); }
#[doc = r"Value read from the register"] pub struct R { bits: u8, } #[doc = r"Value to write to the register"] pub struct W { bits: u8, } impl super::RXCSRH4 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
//https://rust-lang-nursery.github.io/rust-cookbook/science/mathematics/statistics.html fn main() { let data = [3, 1, 6, 1, 5, 8, 1, 8, 10, 11]; let sum = data.iter().sum::<i32>() as f32; let count = data.len(); let mean = match count { positive if positive > 0 => Some( sum / count as f32), ...
use std::collections::HashMap; use super::{common::SocketId, socket::Socket}; #[derive(Default)] pub struct Sockets { sockets: HashMap<SocketId, Box<dyn Socket>>, } impl Sockets { pub fn add(&mut self, socket: Box<dyn Socket>) { self.sockets.insert(socket.get_id(), socket); } pub fn get(&sel...
//! Compressor mod //! All compressors going to be here pub mod compressed; pub mod uncompressed; use serde_derive::Deserialize; use std::boxed::Box; use std::path::Path; use crate::backup::backup::Backup; use crate::compressors::compressed::Zip; use crate::compressors::uncompressed::Uncompressed; /// The type of c...
use ahash::AHashMap; use cogs_gamedev::grids::{Direction4, ICoord}; use crate::simulator::transport::{Cable, TransferError}; use super::{ board::Board, solutions::Metrics, transport::{Port, Resource}, }; /// This lets us do a floodfill over several frames. #[derive(Clone, Debug)] pub struct ...
use std::env; use std::error::Error; use std::fs; pub fn pattern_count(text: &str, pattern: &str) -> u64 { let overlap = text.len() - pattern.len() + 1; let mut count = 0; for i in 0..overlap { let start = i; let end = i + pattern.len(); if &text[start..end] == pattern { ...
pub mod null; //pub mod sled; pub mod sqlite; //pub mod rocks; use blake3::hash; use std::borrow::Cow; use thiserror::Error; use crate::commit; use crate::key; use crate::key::TypedKey; use crate::Keyish; use crate::Object; #[derive(Debug, Error)] pub enum CanonicalizeError { #[error("Invalid object id '{_0}'"...
#![allow(clippy::wildcard_imports)] use image::{DynamicImage, ImageFormat}; use rand::seq::SliceRandom; use rand::thread_rng; use seed::{prelude::*, *}; use std::collections::BTreeMap; use ulid::Ulid; use web_sys::{self, DragEvent, Event, FileList}; const THUMB_SIZE: u32 = 250; const COLUMNS_NUMBER: usize = 6; const ...
#![allow(dead_code)] pub struct Computer { mem: Vec<i32>, ip: i32, } enum State { Input(i32), Output(i32), Continue, Halt, Error, } const OP_ADD: i32 = 1; const OP_MULTIPLY: i32 = 2; const OP_STORE_INPUT: i32 = 3; const OP_EMIT_OUTPUT: i32 = 4; const OP_JUMP_TRUE: i32 = 5; const OP_JUMP_FALSE: i32 = 6;...
use std::collections::HashMap; use ::FieldReference; pub mod parser; pub mod printer; mod value_helpers; #[derive(Debug, Clone)] pub struct Block { pub statements: Vec<Statement>, } #[derive(Debug, Clone)] pub struct Statement { pub attributes: HashMap<String, Value>, pub items: Vec<Value>, } #[derive(...
use tower_lsp::lsp_types::*; pub fn keyword_completions(keywords: &[(&str, &str)]) -> Vec<CompletionItem> { let mut items: Vec<CompletionItem> = Vec::new(); for key in keywords { if key.1.is_empty() { items.push(CompletionItem { label: key.0.to_string(), kind...
fn main() { let input = include_str!("day6.txt"); let split = input.split("\n"); let v: Vec<&str> = split.collect(); let alphabet: Vec<char> = vec!['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']; let mut vsub: Vec<&st...
#[cfg(test)] mod test; mod background; pub(crate) mod conn; mod establish; pub(crate) mod options; mod wait_queue; use std::{sync::Arc, time::Duration}; use derivative::Derivative; use tokio::sync::Mutex; pub use self::conn::ConnectionInfo; pub(crate) use self::conn::{Command, CommandResponse, Connection, StreamDes...
pub mod prelude { pub use super::header; pub use super::navigation; pub use super::footer; } use maud::{ DOCTYPE, Markup }; pub fn header(title_opt: Option<&str>) -> Markup { html! { (DOCTYPE); head { meta charset="utf-8"; title { (compose_title(title_opt)) } ...
use std::fs; use std::time::Instant; use std::collections::{HashMap}; fn part1(numbers: Vec<u64>) -> u64 { let size: usize = 25; let mut map: HashMap<u64, u32> = HashMap::new(); for i in 0..25 { for j in 0..25 { if i != j { let sum = numbers.get(i).unwrap() + numbers.get...
pub mod hosting; pub mod serving { fn take_order() {} pub fn serve_order() {} pub fn take_payment() {} }
extern crate chrono; extern crate cpd; #[macro_use] extern crate failure; extern crate las; #[macro_use] extern crate log; extern crate nalgebra; type Matrix3D = nalgebra::MatrixMN<f64, nalgebra::Dynamic, nalgebra::U3>; type Vector4 = nalgebra::MatrixN<f64, nalgebra::U4>; #[macro_use] extern crate serde_derive; #[mac...
extern crate nannou; extern crate rand; mod field; mod cow; mod evolution; mod ui; mod traits; use nannou::prelude::*; use nannou::event::SimpleWindowEvent; use ui::UserInterface; use evolution::Evolver; fn main() { nannou::app(model, event, view).run(); } struct Model { evolver: Evolver, ui: UserInterf...
use std::collections::HashMap; use std::env; use std::io; use std::ops; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] struct Point3d { x: i64, y: i64, z: i64, } impl Point3d { pub fn new(x: i64, y: i64, z: i64) -> Self { return Self { x, y, z }; } pub fn neighbours(&self) -> impl ...
mod add_iterable; mod add_self; mod create; mod deref; mod extend; mod from_iterator; mod index; mod intersection; mod into_iterator; mod sub_iterable; mod sub_self; mod union;
extern crate reqwest; extern crate url; extern crate prettytable; mod cli; mod api; mod benchmark; use observer_ward::{scan, strings_to_urls, read_file_to_target, download_fingerprints_from_github}; use api::{api_server}; use cli::{WardArgs}; use std::process; use std::io::{self, Read}; use std::thread; use colored::...
pub enum Tile { GrassTile, SandTile, } pub enum Structure { } pub struct Map { tiles: Vec<Vec<Tile>> } impl Map { fn fromFile(path: &str) -> Map { } }
use std::cell::{Ref, RefCell}; use std::collections::BTreeMap; use std::ops::{Index, IndexMut}; use std::rc::Rc; use cranelift_entity::{EntityRef, PrimaryMap, SecondaryMap}; use intrusive_collections::UnsafeRef; use firefly_diagnostics::{SourceSpan, Span}; use firefly_intern::Symbol; use firefly_syntax_base::*; use ...
mod player_movement; pub mod animations; pub use self::player_movement::PlayerSystem;
use crate::comms::{CommsMessage, CommsVerifier}; use crate::manager::AccountStatus; use crate::primitives::{Account, AccountType, ChallengeStatus, NetAccount, Result}; use crate::Database; use strsim::jaro; pub const VIOLATIONS_CAP: usize = 5; pub struct DisplayNameHandler { db: Database, comms: CommsVerifier...
use std::{net::SocketAddr, sync::Arc}; use thiserror::Error; use bevy::prelude::{AppBuilder, Plugin}; use quinn::{crypto::rustls::TlsSession, generic::Incoming}; use bevy::prelude::IntoQuerySystem; use futures::StreamExt; use tokio::sync::mpsc::{unbounded_channel, UnboundedSender}; use tracing::info; use crate::netwo...
use std::convert::TryInto; use crate::{ generation::WorldGenerator, Region, RegionWorldPosition, Tile, TileWorldCoordinate, TileWorldPosition, }; #[derive(Clone, Copy, Debug, Hash)] pub struct FlatWorldGenerator { fill: Tile, fill_height: Option<TileWorldCoordinate>, } impl FlatWorldGenerator { p...
use crate::rocket::State; use crate::rocket_contrib::json; use crate::todos::{MaybeTodo, Todo}; use crate::Connection; #[get("/todos")] pub fn get_todos(connection: State<Connection>) -> json::JsonValue { let conn = connection.lock().unwrap(); json! {Todo::get_all(&conn)} } #[post("/todo", data = "<todo>")] p...
use { bench_minplus_convolutions::*, criterion::{ criterion_group, criterion_main, AxisScale, BenchmarkId, Criterion, PlotConfiguration, Throughput, }, rand::{prelude::StdRng, SeedableRng}, }; fn minplus_convolutions(c: &mut Criterion) { let plot_config = PlotConfiguration::default(...
use super::filer::{read_dir_entries, FilerItem, FilerItemWithoutIcon}; use super::Direction; use crate::stdio_server::handler::{CachedPreviewImpl, Preview, PreviewTarget}; use crate::stdio_server::input::{KeyEvent, KeyEventType}; use crate::stdio_server::provider::{ClapProvider, Context, SearcherControl}; use crate::st...
use ted_interface::TerrainSprite; use gvec::*; use id_types::*; pub const CHUNK_WIDTH: i64=10; pub const SQUARE_SIZE: f64=40.0; pub const CHUNK_WIDTH_PIXELS: f64=(CHUNK_WIDTH as f64)*SQUARE_SIZE; pub struct Terrain{ pub sprite: TerrainSprite } pub struct DamageableTerrain{ pub damageable_id: DamageableID } #[de...
// 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 ...
mod device; mod iokit; mod iterator; mod manager; mod traits; pub use self::device::IoKitDevice; pub use self::iterator::IoKitIterator; pub use self::manager::IoKitManager; #[cfg(test)] mod tests;
mod error; mod checksum; mod cmd_line; use std::fs::{OpenOptions, File}; use std::io::{Write, BufRead, BufReader, Read}; use std::path::{PathBuf, Path}; use std::sync::mpsc::channel; use anyhow::Result; use itertools::{join, Itertools}; use structopt::StructOpt; use threadpool::ThreadPool; use walkdir::{WalkDir, DirE...
use boards::print::{print}; use Semaphore; use Kernel; pub fn post_b1(_: Option<Semaphore>) { print("task posting button1"); return Kernel::os_post(Semaphore::Button1); }
use std::time::Duration; use std::sync::mpsc::{Receiver,Sender, channel}; use std::thread; use std::thread::{Builder,sleep}; use def::*; //--------------------------------------------------------- //Auxiliar functions pub fn to_hex_string(bytes: &Vec<u8>) -> String { let strs: Vec<String> = bytes.iter() ...
use clippy_utils::diagnostics::{span_lint_and_sugg, span_lint_and_then}; use clippy_utils::higher::VecArgs; use clippy_utils::source::snippet_opt; use clippy_utils::usage::local_used_after_expr; use clippy_utils::{get_enclosing_loop_or_closure, higher, path_to_local, path_to_local_id}; use if_chain::if_chain; use rustc...
// Copyright 2018 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 ...
use csv::Reader; use csv::{ByteRecord, ByteRecordsIntoIter}; use encoding::all::ISO_8859_1; use encoding::{DecoderTrap, EncodingRef}; use std::clone::Clone; use std::fs::File; use std::iter::FromIterator; use super::Row; fn decode(data: ByteRecord, encoding: EncodingRef) -> Row { let mut row = Row::with_capacity(...
use std::ops::Index; pub struct SmallBitSet(u32); const TRUE: bool = true; const FALSE: bool = false; impl Index<usize> for SmallBitSet { type Output = bool; fn index(&self, index: usize) -> &bool { if self.0 & (1 << index) != 0 { &TRUE } else { &FALSE } } ...
fn main() { use text_grid::*; let mut g = GridBuilder::new(); g.push(|b| { b.push("A"); b.push("B"); b.push("C"); }); g.push(|b| { b.push("AAA"); b.push("BBB"); b.push("CCC"); }); g.set_column_separators(vec![true, true]); println!("{:?}", ...
//! A randomised, globally unique identifier of a single ingester instance. //! //! The value of this ID is expected to change between restarts of the ingester. use std::fmt::Display; use uuid::Uuid; /// A unique, random, opaque UUID assigned at startup of an ingester. /// /// This [`IngesterId`] uniquely identifies...
#[doc = "Reader of register MPCBB1_VCTR61"] pub type R = crate::R<u32, super::MPCBB1_VCTR61>; #[doc = "Writer for register MPCBB1_VCTR61"] pub type W = crate::W<u32, super::MPCBB1_VCTR61>; #[doc = "Register MPCBB1_VCTR61 `reset()`'s with value 0"] impl crate::ResetValue for super::MPCBB1_VCTR61 { type Type = u32; ...
pub use bevy::{prelude::*, reflect::TypeRegistry, utils::Duration}; ///System for loading scenes. Should be based on a saveGame scene id pub fn load_scene_system() { } ///System for saving Scenes. Should open up a UI that shows past save games unless autosave pub fn save_scene_system() { //will make a scene for...
extern crate interpolate; extern crate num; pub mod vector; pub mod rect; pub mod circle; pub mod grid; pub mod wrapping_grid; pub use vector::Vec2; pub use rect::Rect; pub use circle::Circle; pub use grid::Grid; pub use wrapping_grid::WrappingGrid;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion, Throughput}; use lever::table::prelude::*; use std::sync::Arc; const MAX_THREADS: usize = 8; const OP_RANGES: &'static [usize] = &[100, 300, 500, 700, 1000, 3000, 5000]; fn pure_read(lotable: Arc<LOTable<String, u64>>, key: String, op_count: us...
use bytes::Buf; use futures::{Async, Poll}; use http::HeaderMap; use super::internal::{FullDataArg, FullDataRet}; /// This trait represents a streaming body of a `Request` or `Response`. /// /// The built-in implementation of this trait is [`Body`](::Body), in case you /// don't need to customize a send stream for yo...
use std::error::Error; use crate::ecs::Ecs; type BoxedSystem<AD> = Box<dyn FnMut(&mut Ecs, &mut AD) -> SystemResult>; pub type SystemResult = Result<(), Box<dyn Error>>; pub struct SystemBundle<AD> { systems: Vec<BoxedSystem<AD>>, } impl<AD> SystemBundle<AD> { pub fn add_system<T, S: IntoSystem<T, AD>>(&mut...
test_stdout!( without_environment_runs_function_in_child_process, "from_fun\n" ); test_stdout!( with_environment_runs_function_in_child_process, "from_environment\n" );
extern crate sdl2; use crate::cpu::Cpu; use crate::png; use crate::ppu; use crate::ppu::Ppu; use crate::record; use std::time::Instant; use sdl2::audio::AudioSpecDesired; use sdl2::controller::Button; use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::pixels::Color; use sdl2::rect::Rect; use sdl2::render...
#[doc = "Reader of register C13ISR"] pub type R = crate::R<u32, super::C13ISR>; #[doc = "Reader of field `TEIF13`"] pub type TEIF13_R = crate::R<bool, bool>; #[doc = "Reader of field `CTCIF13`"] pub type CTCIF13_R = crate::R<bool, bool>; #[doc = "Reader of field `BRTIF13`"] pub type BRTIF13_R = crate::R<bool, bool>; #[...
fn helloworld() { println!(0xff) }
// Copyright 2020-2021, The Tremor Team // // 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 agr...
use super::Eye; use super::Side; use super::Vive; use std::f32; const INVALID_POSITION: (f32, f32, f32) = (f32::NAN, f32::NAN, f32::NAN); const INVALID_ROTATION: (f32, f32, f32) = (f32::NAN, f32::NAN, f32::NAN); pub struct Head { pub left_eye: Eye, pub right_eye: Eye, pub position: (f32, f32, f32), pu...
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Start TWI receive sequence"] pub tasks_startrx: TASKS_STARTRX, _reserved1: [u8; 4usize], #[doc = "0x08 - Start TWI transmit sequence"] pub tasks_starttx: TASKS_STARTTX, _reserved2: [u8; 8usize], #[doc = "0x14 -...
/* origin: FreeBSD /usr/src/lib/msun/src/s_tanf.c */ /* * Conversion to float by Ian Lance Taylor, Cygnus Support, ian@cygnus.com. * Optimized by Bruce D. Evans. */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPr...
use crate::semantic; use crate::semantic::column_class; use yew::prelude::*; use super::model; use yew::{Component, ComponentLink, Html}; #[derive(PartialEq, Clone, Properties)] pub struct Score { pub score: Vec<(model::Team, model::Score)>, } impl Component for Score { type Message = (); type Propertie...
impl Solution { pub fn num_jewels_in_stones(jewels: String, stones: String) -> i32 { let mut valid_chars = [false; 123]; for c in jewels.chars() { valid_chars[c as usize] = true; } let mut ans = 0; for c in stones.chars() { ans += mat...
use std::convert::TryInto; use std::net::Shutdown; use byteorder::NetworkEndian; use futures_channel::mpsc::UnboundedSender; use crate::io::{Buf, BufStream, MaybeTlsStream}; use crate::postgres::protocol::{Message, NotificationResponse, Response, Write}; use crate::postgres::PgError; use crate::url::Url; use futures...
// Copyright 2018 Evgeniy Reizner // // 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>, at your // option. This file may not be copied, modified, or distributed // except according...
use async_trait::async_trait; use crate::protobuf::Command; /// State-machine interface that Raft uses to deliver commands to the replicated state-machine #[async_trait] pub trait StateMachine { /// Delivers the replicated command (eg. an order request) to the state machine async fn apply_command(&self, comma...
//============================================================================== // Notes //============================================================================== // drivers::log.rs // The logger library is meant to be a scrolling circular buffer of entries. // The log can be updated in the background in real-t...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - OPAMP1 control/status register"] pub opamp1_csr: OPAMP1_CSR, #[doc = "0x04 - OPAMP1 offset trimming register in normal mode"] pub opamp1_otr: OPAMP1_OTR, #[doc = "0x08 - OPAMP1 offset trimming register in low-power mode...
{{#>loop_nest loop_nest~}} {{#with filter_ref.Inline~}} {{#each rules~}} {{>rule}} trace!("inline filter restricts to {:?}", values); {{/each~}} {{/with~}} {{#with filter_ref.Call~}} let filter_res = {{choice}}::filter_{{id}}({{>choice.arg_names}}ir_instance, ...
use std::collections::BTreeMap; use std::convert::TryFrom; use std::fmt; use std::io::{Cursor, Read}; use std::net::Ipv4Addr; use byteorder::{NetworkEndian, ReadBytesExt}; use thiserror::Error; pub use options::DhcpOption; use super::id::Mac; pub mod encode; pub mod options; #[derive(Error, Debug)] pub enum Error ...
use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::ty::is_type_diagnostic_item; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::intravisit::{walk_expr, NestedVisitorMap, Visitor}; use rustc_hir::{Arm, Expr, ExprKind, MatchSource, PatKind}; use rustc_lint::{LateContext, Lat...