text
stringlengths
8
4.13M
use bitwise::base64; use bitwise::hex_rep::ToHexRep; use challengeinfo::challenge::{Challenge, ChallengeInfo}; pub const INFO1: ChallengeInfo<'static> = ChallengeInfo { set_number: 1, challenge_number: 1, title: "Convert hex to base64", description: "", url: "http://cryptopals.com/sets/1/challenge...
fn high_and_low(numbers: &str) { use std::cmp; let f = |(max, min), x| (cmp::max(max, x), cmp::min(min, x)); let answer = numbers.split_whitespace().map(|x| x.parse::<i32>().unwrap()).fold((i32::min_value(), i32::max_value()), f); format!("{} {}", answer.0, answer.1); } fn main() { print!(high_and...
use super::*; use crate::{alloc::Allocator, containers::String}; macro_rules! impl_primitive_ser { ($type:ty, $method:ident) => { impl Serialize for $type { fn serialize<S: Serializer>(&self, s: S) -> Result<S::Ok, S::Err> { s.$method(*self) } ...
extern crate rand; extern crate rand_xoshiro; extern crate suffix_utils; use rand::seq::SliceRandom; use rand::{Rng, SeedableRng}; use rand_xoshiro::Xoroshiro128StarStar; #[test] fn sa_is_works() { let mut rng: Xoroshiro128StarStar = SeedableRng::seed_from_u64(329); let alphabet = b"ACGT"; let seq: Vec<_> ...
pub mod heap; pub mod vm;
#![cfg_attr(feature = "unstable", feature(test))] // Launch program : cargo run --release < input/input.txt // Launch benchmark : cargo +nightly bench --features "unstable" /* Benchmark results: running 5 tests test tests::test_part_1 ... ignored test tests::test_part_2 ... ignored test bench::bench_...
use duktape2::prelude::*; use super::super::super::context::{Context as CrawlContext}; use super::super::super::error::CrawlResult; use vfs::physical::PhysicalFS; use conveyor_work::{package::Package}; use super::super::super::work::WorkOutput; use conveyor::{Result, ConveyorError}; pub(crate) static REQUIRE_JS: &'sta...
#[doc = "Register `CR2` reader"] pub type R = crate::R<CR2_SPEC>; #[doc = "Register `CR2` writer"] pub type W = crate::W<CR2_SPEC>; #[doc = "Field `TAMP1NOER` reader - TAMP1NOER"] pub type TAMP1NOER_R = crate::BitReader<TAMP1NOER_A>; #[doc = "TAMP1NOER\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)]...
extern crate pest; #[macro_use] extern crate pest_derive; mod binary_tree; mod binary_tree_2; mod chapter_1; mod chapter_2_1; mod chapter_2_2; mod chapter_2_3; mod cons; mod languages; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }
use rocket::{get, routes}; use rocket::http::Status; use rocket::request::{self, FromRequest, Request, State}; use rocket_contrib::json::Json; use serde::{Serialize, Deserialize}; use mongodb::bson::{doc}; use std::error::Error; use crate::{db::DB}; use rocket::response::status::BadRequest; #[derive(Serialize,...
use std::collections::HashMap; macro_rules! impl_json_value { ({ $($name:tt($for_type:ty)),* $(,)? }) => { #[derive(Debug)] pub enum JsonValue { $($name($for_type),)* } $(impl From<$for_type> for JsonValue { fn from(value: $for_type) -> Self { ...
use serde_json::Value; use std::{collections::HashMap, time::Duration}; pub const GUARDIAN_DELAY: Duration = Duration::from_millis(100); #[derive(Default, Debug, Clone, PartialEq, serde_derive::Serialize, serde_derive::Deserialize)] #[serde(rename_all = "camelCase")] pub struct SectionsRoot { pub response: Sectio...
use crate::rectangle; use amethyst::{ assets::PrefabData, core::{math, Transform}, derive::PrefabData, ecs::{Component, DenseVecStorage, Entity, WriteStorage}, Error, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Copy, Clone, Serialize, PrefabData)] #[prefab(Component)] pub s...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. #[non_exhaustive] #[derive(std::fmt::Debug)] pub enum Error { CodeSigningConfigNotFoundError(crate::error::CodeSigningConfigNotFoundError), CodeStorageExceededError(crate::error::CodeStorageExceededError), CodeVerificationFaile...
use std::fmt; #[derive(Debug)] pub struct Error { message: String, } impl Error { pub fn new(s: &str) -> Self { Error { message: String::from(s), } } } impl From<serde_json::Error> for Error { fn from(error: serde_json::Error) -> Self { let errstr = error.to_string...
use rand::Rng; use crate::entity::Entity; use crate::physics::{Bounds, Vector2D}; #[derive(Debug, PartialEq)] pub enum ParticleType { BLUE = 0, RED = 1, GREEN = 2, ORANGE = 3, BROWN = 4, WHITE = 5, PURPLE = 6, PINK = 7 } pub struct Particle { bounds: Bounds, velocity: Vector2D,...
use std::fs::{read_to_string, OpenOptions}; use std::io::Write; use std::path::Path; use serde::ser::Serialize; use serde_json::{from_str, to_string_pretty}; use super::Error; use crate::Config; pub fn load<P>(path: P) -> Result<Config, Error> where P: AsRef<Path>, { let string = read_to_string(path)?; l...
use std::cell::Cell; pub type Callback = Box<dyn Fn(usize) -> bool>; trait CallbackFunc { fn call(&self) -> Option<bool>; } impl CallbackFunc for () { fn call(&self) -> Option<bool> { None } } pub(crate) struct EvaluationProgress { instruction_count: Cell<usize>, callback: Option<Callbac...
extern crate nalgebra as na; extern crate nalgebra_glm as glm; pub mod camera; pub mod lights; pub mod gltf; use crate::figure::FigureSet; use crate::scene::camera::ViewAndProject; use crate::scene::lights::Light; use std::fmt::Debug; use std::sync::Arc; use std::sync::Mutex; #[derive(Debug, Clone)] pub struct Scene...
#[macro_use] extern crate easybuffers; extern crate time; use easybuffers::helper::{ Table, HyperHelper }; #[derive(PartialEq,Clone,Default,Debug)] struct TestMessage { field_0: Option<String>, field_1: Option<String>, field_2: Option<bool>, field_3: Option<String>, field_4: Option<bool>, fiel...
fn basic_match(num: i32) { print!("Tell me about {}\n -- ", num); match num { 1 => println!("One!"), 2 | 3 | 5 | 7 | 11 => println!("This is a prime"), 13..=19 => println!("A teen"), _ => println!("Ain't special") } } fn return_match() { let boolean = true; let bina...
/* Copyright 2021 Al Liu (https://github.com/al8n). Licensed under Apache-2.0. * * Copyright 2017 The Hashicorp's Raft repository authors(https://github.com/hashicorp/raft) authors. Licensed under MPL-2.0. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in com...
use crate::shabal256::{shabal256_deadline_fast, shabal256_hash_fast}; use core::{u32, u64}; use sp_std::mem::transmute; const SCOOP_SIZE: usize = 64; pub fn calculate_scoop(height: u64, gensig: &[u8; 32]) -> u32 { let mut data: [u8; 64] = [0; 64]; let height_bytes: [u8; 8] = unsafe { transmute(height.to_be()) }; ...
use raylib::prelude::*; use specs::prelude::*; pub const CHUNK_SIZE : usize = 64; type BlockData = bool; pub struct ChunkData([BlockData; CHUNK_SIZE*CHUNK_SIZE*CHUNK_SIZE]); impl ChunkData { pub fn new() -> Self { return ChunkData([false; CHUNK_SIZE*CHUNK_SIZE*CHUNK_SIZE]); } pub fn from_array(...
#[doc = "Register `RCC_IDR` reader"] pub type R = crate::R<RCC_IDR_SPEC>; #[doc = "Field `ID` reader - ID"] pub type ID_R = crate::FieldReader<u32>; impl R { #[doc = "Bits 0:31 - ID"] #[inline(always)] pub fn id(&self) -> ID_R { ID_R::new(self.bits) } } #[doc = "This register gives the unique id...
use aoc::*; fn main() -> Result<()> { let mut world = World { computer: Computer::load("15.txt")?, map: vec![vec![255; 50]; 50], position: Point::new(25, 25), oxygen: None, }; world.dfs(); world.bfs(); world.draw(); Ok(()) } struct World { computer: Comput...
extern crate libc; extern crate libpulse_sys; mod context; mod error; mod ffi; mod mainloop; mod mainloop_api; mod operation; mod stream; mod threaded_mainloop; mod time_event; pub use context::Context; pub use error::ErrorCode; pub use mainloop::Mainloop; pub use mainloop_api::MainloopApi; pub use operation::Operati...
#![warn(rust_2018_idioms)] use std::cell::RefCell; use std::rc::Rc; use futures::channel::mpsc; use js_sys::Uint8Array; use rand::rngs::OsRng; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use web_sys::{BinaryType, ErrorEvent, MessageEvent, WebSocket}; use netholdem_game::model; use netholdem_game::protoco...
// Copyright (c) 2018, Maarten de Vries <maarten@de-vri.es> // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions ...
use super::Canvas; use crate::{ terminal::SIZE, util::{Color, Point, Size}, }; mod bucket; impl Canvas { /// Sets the terminal cursor accordingly and then draws a block. pub fn block_at(&mut self, point: Point, color: Color) { self.terminal.set_cursor(Point { y: point.y / 2, ...
extern crate dotenv; use crate::errors::ServiceError; use crate::graphql::input::movie::MovieFilter; use crate::graphql::Context; use crate::models::movie::Movie; use diesel::prelude::*; pub fn movies(context: &Context, filter: Option<MovieFilter>) -> Result<Vec<Movie>, ServiceError> { use crate::schema::movies::d...
//! Provides the selection sort feature /// Triggers one step of the selection sort pub fn iterate_over_selection_sort( array: &mut [u8; 50], index: &mut usize, ) { let mut min = *index; let start = *index + 1; for i in start..50 { if array[i] < array[min] { min = i; ...
use crate::*; use std::collections::BTreeMap; use std::sync::Arc; use tracing; const COUNT_PER_ROW: u32 = 20; const SCATTER_SYMBOL_NOT_TESTED_YET: char = '.'; const SCATTER_SYMBOL_PASSED: char = 'O'; const SCATTER_SYMBOL_FAILED: char = 'X'; const SCATTER_SYMBOL_PREPARE_FAILED: char = '-'; const SCATTER_SYMBOL_HANDSHAK...
use test::res::module; #[test] pub fn load() { unsafe { module::all_module() }.unwrap(); } #[test] pub fn verify_names() { let module = unsafe { module::all_module() }.unwrap(); let (module_list, module_map, _) = module.destructure(); assert_eq!(module_list.len(), 1); for module in module_list { ...
use utils; use std::collections::HashSet; fn consecutive_quadratic_primes(a: i64, b: i64, primes: &HashSet<u64>) -> u64{ let mut n = 0; let mut prime_candidate: i64 = n * n + a * n + b; while (prime_candidate > 1) &primes.contains(&(prime_candidate as u64)){ n += 1; prime_candidate = n * ...
//! symrs - As symbolic mathematics libary for Rust. #![feature(box_syntax)] #![feature(core_intrinsics)] // Included Modules pub mod core; pub mod errors; pub mod expressions; // Re-export common modules. pub use crate::core::Expression; pub use crate::errors::*; pub use crate::expressions::irreducibles::*; pub use...
fn returns_five() -> u8 { 5 } fn main() { // These parantheses create a block with a new scope and exp_var // is expecting a value to be returned from that block. let exp_var = { let x = 12; // omitting a semi-colon turns this into an // expression from a statment. Unlike a func...
//! urot13.rs //! //! Perform a Unicode-aware rot13 transformation. //! //! last update: 2016-09-25 //! //! This program manages to perform rot13 on a large number of precomposed //! Unicode characters by decomposing said character into a base character //! and a series of combining characters, rot13ing the base charac...
use std::io::{BufRead, Read}; // Constant declarations pub const TAB: char = '\t'; pub const NEW_LINE: char = '\n'; pub const SPACE: char = ' '; #[derive(Debug, PartialEq, Eq)] enum Ops { ADD, SUB, MUL, DIV, INVALID, } impl From<char> for Ops { fn from(c: char) -> Self { match c { ...
use hyper::{Body, Response}; use nails::error::NailsError; use nails::Preroute; use serde::Serialize; use crate::context::AppCtx; #[derive(Debug, Preroute)] #[nails(path = "/api/articles")] pub(crate) struct ListArticlesRequest { tag: Option<String>, author: Option<String>, favorited: Option<String>, ...
#![macro_use] //! Registers a function to be called before main (if an executable) or when loaded (if a dynamic //! library). //! **Using this is a bad idea.** You can do this in a way that isn't abysmally fragile. //! //! Example //! ======= //! //! ``` //! # #[macro_use] extern crate constructor; //! pub static mut...
pub use super::blob::{Blob, BlobBlockType, BlockList, BlockListType}; pub use super::container::PublicAccess; pub use crate::blob::clients::{ AsBlobClient, AsBlobLeaseClient, AsContainerClient, AsContainerLeaseClient, BlobClient, BlobLeaseClient, ContainerClient, ContainerLeaseClient, }; pub use crate::{ Ac...
pub mod sqlite_database_cleaner; pub mod util; pub use util::*; use apllodb_test_support::setup::setup_test_logger; /// general test setup sequence pub fn test_setup() { setup_test_logger(); }
// http://judge.u-aizu.ac.jp/onlinejudge/description.jsp?id=ITP1_9_A fn main() { let mut target_word = String::new(); std::io::stdin().read_line(&mut target_word).unwrap(); let target_word = String::from(target_word.trim().to_lowercase()); let mut count = 0; loop { let mut buf = String::n...
// q0019_remove_nth_node_from_end_of_list struct Solution; use crate::util::ListNode; impl Solution { pub fn remove_nth_from_end(head: Option<Box<ListNode>>, n: i32) -> Option<Box<ListNode>> { let mut buf = vec![]; let mut node = head; while let Some(l) = node { buf.push(l.val...
use crate::models::*; use crate::test::*; use crate::service::*; use crate::dao::*; use serde::{Serialize, Deserialize}; use actix_web::{get, post, put, delete, web, Responder, HttpResponse, Scope}; pub fn user_scope() -> Scope{ web::scope("/user") .service(get_user_by_email) .service(create_new_user)...
// use std::io; // use std::fmt::Display; use rand::Rng; fn main() { println!("Hello, world!"); let lucky_number = rand::thread_rng().gen_range(1, 101); println!("Lucky Number : {}",lucky_number); }
use crate::player::PlayerMarker; use crate::walls::{WallDeathMarker, WallMarker}; use crate::world::{ BounceMarker, CharType, DefaultSize, Force, Location, MaterialResource, ObjectMarker, Velocity, }; use bevy::prelude::*; use bevy::sprite::collide_aabb::{collide, Collision}; use rand::distributions::Uniform; use r...
use termion::cursor::*; use crate::editor::Editor; use crate::editor::Mode; // TODO: Scrolling when traveling up or down // TODO: Scrolling command history when moving up/down in command mode impl Editor { // TODO: Use cursor_pos function once // https://github.com/ticki/termion/issues/136 is fixed /// Ge...
use std::env; use std::error::Error; use std::fs::File; mod account; mod amount; mod engine; mod transaction; mod transaction_row; /// Helper function to parse and validate the required args /// We expect one argument and this should be an .csv file. fn get_file_name_to_process() -> Result<String, Box<dyn Error>> { ...
#[macro_use] extern crate failure; pub mod error; pub mod secp256k1;
use core::mem; #[cfg(not(feature = "std"))] use alloc::boxed::Box; // ************************************************************************************************* // Record // ************************************************************************************************* /// A wrapper type that prepends an in...
pub fn is_pangram(string: &str) -> bool { let mut alphabet = "abcdefghijklmnopqrstuvwxyz".chars(); let string = string.to_lowercase(); alphabet.all(|x| string.contains(x)) }
/* * Copyright (C) 2019-2021 TON Labs. All Rights Reserved. * * Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use * this file except in compliance with the License. * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an ...
fn main() { let b = Box::new(5); let s = Box::new("string"); println!("b = {}", b); println!("b = {}", &b); println!("b = {}", &s); // type of data println!("b = {}", s); }
use std::env; use std::fs; use tempfile; use utils::fixture; use wasm_pack::binaries; use wasm_pack::command::{self, build, test, Command}; use wasm_pack::logger; #[test] fn it_can_run_node_tests() { let fixture = fixture::wbg_test_node(); fixture.install_local_wasm_bindgen(); let cmd = Command::Test(test:...
use actix_web::HttpResponse; use std::fs::OpenOptions; use std::io::{BufReader, Read}; use std::process::Stdio; use std::sync::Arc; use std::time::Duration; use regex::{Regex, RegexBuilder}; use tokio::process::Command; use tokio::time::timeout; use actix_web::{client, http}; use handlebars::Handlebars; use super...
pub mod app; use serde::Deserialize; #[derive(Clone, Debug, Deserialize)] pub struct ControllerConfig { /// The namespace in which the topics get created pub topic_namespace: String, /// The resource name of the Kafka cluster. /// /// This will be used as the `strimzi.io/cluster` label value. ...
use envconfig::Envconfig; use lazy_static::lazy_static; mod agent; mod experiments; mod maze; mod mcc; mod neat; mod neatns; lazy_static! { pub static ref EXPERIMENTS: experiments::Config = experiments::Config::init().unwrap(); pub static ref MCC: mcc::Config = mcc::Config::init().unwrap(); pub static re...
use crate::profile::Profile; use crate::types::{decode_date_time, tag_deserializer, tag_types, ICCDateTime}; use crate::{ColorSpace, ICCTag, ICCTagType, Intent, ProfileClass, S15Fixed16}; use byteorder::{ByteOrder, ReadBytesExt, BE}; use cgmath::num_traits::{FromPrimitive, ToPrimitive}; use std::collections::HashMap; u...
use crate::hittable::{aabb::Aabb, HitRecord, Hittable, Hittables}; use crate::ray::Ray; use crate::vec::Vec3; use rand::prelude::*; use rand::rngs::SmallRng; #[derive(Debug, Clone)] pub struct HittableList { pub hittables: Vec<Hittables>, } impl HittableList { #[allow(dead_code)] pub fn new() -> Hittables...
#[doc = "Register `PRIVCFGR2` reader"] pub type R = crate::R<PRIVCFGR2_SPEC>; #[doc = "Register `PRIVCFGR2` writer"] pub type W = crate::W<PRIVCFGR2_SPEC>; #[doc = "Field `PRIV32` reader - PRIV32"] pub type PRIV32_R = crate::BitReader; #[doc = "Field `PRIV32` writer - PRIV32"] pub type PRIV32_W<'a, REG, const O: u8> = ...
use std::collections::HashMap; use std::sync::Arc; use lambda_http::http; use tracing::info; use tracing::instrument; use htsget_http::{get as htsget_get, Endpoint}; use htsget_search::htsget::HtsGet; use crate::handlers::handle_response; use crate::{Body, Response}; /// Get request reads endpoint #[instrument(skip...
fn main() { let mut x = 5; println!("The value of X is {}", x); x = 6; println!("The new value of X is {}", x); const MAX_POINTS: u32 = 100_000; println!("The maximum ammount of points is {}", MAX_POINTS); let spaces = " "; let spaces = spaces.len(); }
mod error; mod darwinia_tracker; use service::{Service, Message}; use darwinia::Darwinia; use darwinia_tracker::DarwiniaBlockTracker; #[macro_use] extern crate log; pub type Error = error::Error; pub type Result<T> = std::result::Result<T, Error>; pub struct DarwiniaRelayerService { url: &'static str, scan_from: ...
pub mod chain_spec; pub mod service; pub mod puzzle_rpc; pub mod rpc;
#[path = "../linux/dir.rs"] pub(crate) mod dir; #[path = "../linux/fadvise.rs"] pub(crate) mod fadvise; #[path = "../linux/file.rs"] pub(crate) mod file; use crate::dir::SeekLoc; use std::convert::TryInto; use std::io::{Error, Result}; impl SeekLoc { pub unsafe fn from_raw(loc: i64) -> Result<Self> { // T...
use crate::object::{Object, CompiledFunction, Builtin}; use crate::code::{Instructions, InstructionsFns, Op, make_instruction}; use crate::parser::parse; use crate::ast; use crate::token::Token; use std::{error, fmt}; use std::fmt::Display; use std::rc::Rc; use std::cell::RefCell; use std::borrow::Borrow; use hashbrown...
use std::fs; use std::path::PathBuf; use structopt::StructOpt; use sequence::{Options, transcribe_sequence}; fn main() { let strand = Seq::from_args(); match strand { Seq::Transcribe {file, is_dna, seq_len} => { let contents = fs::read_to_string(&file).unwrap(); println!("count:...
pub mod token_kind; pub mod types; use token_kind::*; use types::*; use logos::Logos; pub struct Lexer<'input> { input: &'input str, generated: logos::SpannedIter<'input, LogosToken>, eof: bool, } impl<'input> Lexer<'input> { pub fn new(input: &'input str) -> Self { Self { ...
use nu::{ serve_plugin, CallInfo, Plugin, Primitive, ReturnSuccess, ReturnValue, ShellError, Signature, SyntaxShape, Tag, Tagged, TaggedDictBuilder, Value, }; struct Embed { field: Option<String>, values: Vec<Tagged<Value>>, } impl Embed { fn new() -> Embed { Embed { field: None...
#![allow(unsafe_code)] #![allow(unused)] //use super::smol_stack::{Blob}; use smoltcp::phy::{self, Device, DeviceCapabilities, Medium}; use smoltcp::time::Instant; use smoltcp::{Error}; use std::cell::RefCell; use std::collections::VecDeque; use std::io; use std::rc::Rc; use std::sync::{Arc, Condvar, Mutex}; use std::...
// Problem 32 - Pandigital products // // We shall say that an n-digit number is pandigital if it makes use of all the // digits 1 to n exactly once; for example, the 5-digit number, 15234, is 1 // through 5 pandigital. // // The product 7254 is unusual, as the identity, 39 × 186 = 7254, containing // multiplicand, mul...
use chrono::{DateTime, Utc}; use crate::event::{Event, ToEvent}; use crate::result::Result; #[derive(Debug)] pub struct AggregateRoot<ID, E> { id: ID, created_at: DateTime<Utc>, updated_at: Option<DateTime<Utc>>, deleted_at: Option<DateTime<Utc>>, events: Vec<E>, } impl<ID, E> AggregateRoot<ID, E...
use crate::input::keyboard::Key; use crate::input::InputPreprocessor; use crate::tool::{DocumentToolData, Fsm, ToolActionHandlerData}; use crate::{document::DocumentMessageHandler, message_prelude::*}; use glam::DAffine2; use graphene::{layers::style, Operation}; use super::resize::*; #[derive(Default)] pub struct El...
pub fn str_str(haystack: String, needle: String) -> i32 { if needle.len() == 0 { return 0 } if haystack.len() == 0 { return -1 } let n = needle.len(); let h_vec: Vec<char> = haystack.chars().collect(); let n_vec: Vec<char> = needle.chars().collect(); let mut failure_tab...
#![feature(plugin)] #![plugin(ronat)] /// This is a text misssspell. pub fn main() { }
use envconfig::Envconfig; #[derive(Envconfig)] pub struct Config { #[envconfig(from = "mutate_weight", default = "0.6")] pub mutate_weight: f64, #[envconfig(from = "add_connection", default = "0.1")] pub add_connection: f64, #[envconfig(from = "add_neuron", default = "0.01")] pub add_neuron: ...
#[doc = "Master 0 protection context control\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify`](crate::generic::Reg::modify). See [API](https://docs.rs/svd2rust/...
// --- paritytech --- use pallet_utility::Config; // --- darwinia-network --- use crate::{weights::pallet_utility::WeightInfo, *}; impl Config for Runtime { type Event = Event; type Call = Call; type WeightInfo = WeightInfo<Runtime>; }
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ use std::collections::BTreeMap; use std::sync::Arc; use bytes::Bytes; use bytes::BytesMut; use fut...
use std::fs; use std::fs::File; use std::io::{Read, SeekFrom, Seek}; use crate::error::Error; use crate::utils::*; const ELF_MAGIC: [u8; 4] = [0x7F, 0x45, 0x4c, 0x46]; const ELF_HEADER_SIZE: u16 = 0x40; const ELF_SHENT_SIZE: u16 = 0x40; const ELF_PHENT_SIZE: u16 = 0x38; pub(crate) const ELF_SYMBOL_SIZE: u64 = 0x18; ...
/*! ```rudra-poc [target] crate = "quick-protobuf" version = "0.8.0" indexed_version = "0.7.0" [report] issue_url = "https://github.com/tafia/quick-protobuf/issues/186" issue_date = 2021-01-30 [[bugs]] analyzer = "UnsafeDataflow" bug_class = "UninitExposure" rudra_report_locations = ["src/reader.rs:552:5: 560:6"] ```...
#[cfg(test)] #[path = "../../../../tests/unit/solver/mutation/local/exchange_inter_route_test.rs"] mod exchange_inter_route_test; use crate::construction::heuristics::*; use crate::models::problem::Job; use crate::solver::mutation::{select_seed_job, LocalOperator}; use crate::solver::RefinementContext; use crate::util...
use super::super::context::Context; use super::super::error::*; use super::super::traits::WorkType; use super::super::utils::station_fn_ctx2; use super::super::work::{WorkBox, WorkOutput}; use conveyor::{into_box, station_fn}; use conveyor_work::package::Package; use std::fmt; use std::sync::Arc; #[derive(Serialize, D...
/// An enum to represent all characters in the PhoneticExtensions block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum PhoneticExtensions { /// \u{1d00}: 'ᴀ' LatinLetterSmallCapitalA, /// \u{1d01}: 'ᴁ' LatinLetterSmallCapitalAe, /// \u{1d02}: 'ᴂ' LatinSmallLetterTurnedAe, /// ...
pub mod vec3;
//! Evaluate expressions as integer, rational or floating point. //! //! At present, everything is converted to f64. //! But `PI.sin()` should be zero. //! But `(PI/2).sin()` should be one. use crate::error::{Error, Result}; use crate::visitor::Visitor; use crate::Expression; use crate::Evaluateable; use std::convert...
use std::ptr; use std::mem; const max_values_per_leaf: usize = 4; /* A pivot is a key and a node of the subtree of values >= that key. */ struct Pivot<K, V> { min_key: K, child: Box<Node<K, V>> } struct LeafNode<K, V> { elements: [(K, V); max_values_per_leaf], // must be <= max_values_per_leaf le...
use super::blockchain::{BlockChain}; use super::contract::{Contract}; use std::thread; use std::sync::mpsc::{self}; use std::sync::{Arc, Mutex}; pub enum ApiMessage { StartSync, StopSync, ImmediateSync, } pub struct ContextHandle { api_sender: channel::Sender<ApiMessage>, } impl ContextHandle { ...
use std::fs; mod report_repair; fn get_inputs () -> Vec<i32> { let inputs: Vec<i32> = (match fs::read_to_string("./src/data/day_one") { Ok(s) => s, Err(e) => panic!("Could not read file: {}", e) }) .split("\n") .collect::<Vec<&str>>() .iter().map(|&s| match s.parse::<...
use std::collections::HashMap; use std::collections::HashSet; fn main() { proconio::input! { s1: String, s2: String, s3: String } let cs1_org: Vec<char> = s1.chars().rev().collect(); let cs2_org: Vec<char> = s2.chars().rev().collect(); let cs3_org: Vec<char> = s3.chars().re...
use crate::{ gui::{BuildContext, Ui, UiMessage, UiNode}, send_sync_message, sidebar::{make_section, make_text_mark, COLUMN_WIDTH, ROW_HEIGHT}, Message, }; use rg3d::{ core::{pool::Handle, scope_profile}, gui::{ button::ButtonBuilder, grid::{Column, GridBuilder, Row}, mess...
extern crate bit_set; use bit_set::BitSet; #[derive(Clone)] pub struct Chromosome { pub alleles: BitSet, pub inverted: bool, } pub type Individual = [Chromosome; 2]; pub type Population = Vec<Individual>;
//! Signals are like variables that update their dependencies. use std::{ cell::{Ref, RefCell, RefMut}, collections::HashSet, hash::Hash, rc::{self, Rc}, }; #[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use crate::clone; type SharedState<T> = Rc<State<T>>; type WeakSharedState<T> = r...
use std::fmt; use anyhow::Error; use crate::error::ErrorKind; const ENTROPY_OFFSET: usize = 8; /// Determines the number of words that will be present in a [`Mnemonic`][Mnemonic] phrase /// /// Also directly affects the amount of entropy that will be used to create a [`Mnemonic`][Mnemonic], /// and therefore the cryp...
use std::io::{self, BufRead, Write}; #[macro_use] extern crate lrlex; #[macro_use] extern crate lrpar; // Using `lrlex_mod!` brings the lexer for `calc.l` into scope. lrlex_mod!(calc_l); // Using `lrpar_mod!` brings the lexer for `calc.l` into scope. lrpar_mod!(calc_y); fn main() { // We need to get a `LexerDef`...
#[derive(Debug, Copy, Clone)] pub enum Compression { NONE = 0, GZIP = 1, SNAPPY = 2 } impl Default for Compression { fn default() -> Self { Compression::NONE } }
use rand::Rng; pub fn from(id: u8) -> crate::Text { let url = format!( "http://tazzon.free.fr/dactylotest/dactylotest/new_text.php?t=26&l=fr&force={}", id ); let text = reqwest::get(&url).unwrap().text().unwrap(); let mut text = text.split("###").skip(1); let source = format!("Text ...
//! Organizational module for Hydroflow Send/RecvCtx structs and Input/OutputPort structs. use std::cell::RefMut; use std::marker::PhantomData; use ref_cast::RefCast; use sealed::sealed; use super::HandoffId; use crate::scheduled::handoff::{CanReceive, Handoff, TryCanReceive}; /// An empty trait used to denote [`Pol...