text
stringlengths
8
4.13M
lazy_static! { static ref PROFILER_MESSAGE_QUEUE: std::sync::Mutex<std::collections::VecDeque<String>> = std::sync::Mutex::new(std::collections::VecDeque::new()); } pub struct Profiler { pub name: std::string::String, start: std::time::Instant, } impl Profiler { /* if you recieve none from this functi...
/// GPGKey a user GPG key to sign commit and tag in repository #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct GpgKey { pub can_certify: Option<bool>, pub can_encrypt_comms: Option<bool>, pub can_encrypt_storage: Option<bool>, pub can_sign: Option<bool>, pub created_at: Option<S...
//! ALPaCA //! //! A library to implement the ALPaCA defense to Website Fingerprinting //! attacks. #![warn(missing_docs)] extern crate rand; pub mod pad; pub mod objects; pub mod parsing; pub mod morphing; pub mod distribution;
pub mod auth; pub mod control; pub mod ddl; pub mod index; pub mod intern; pub mod modify; pub mod rows; pub mod select; pub mod tables;
//! Runtime registry for domains use crate::pallet::{NextRuntimeId, RuntimeRegistry, ScheduledRuntimeUpgrades}; use crate::{Config, Event}; use codec::{Decode, Encode}; use frame_support::PalletError; use scale_info::TypeInfo; use sp_core::Hasher; use sp_domains::{DomainsDigestItem, RuntimeId, RuntimeType}; use sp_run...
use wasm_bindgen::JsValue; use wasm_bindgen_test::*; use js_sys::*; // TODO: not much you can do with `MapIterator` types yet :( #[wasm_bindgen_test] fn entries() { let map = Map::new(); assert!(JsValue::from(map.entries()).is_object()); } #[wasm_bindgen_test] fn keys() { let map = Map::new(); assert...
#[doc = "Register `APB4LPENR` reader"] pub type R = crate::R<APB4LPENR_SPEC>; #[doc = "Register `APB4LPENR` writer"] pub type W = crate::W<APB4LPENR_SPEC>; #[doc = "Field `SYSCFGLPEN` reader - SYSCFG peripheral clock enable during CSleep mode Set and reset by software."] pub type SYSCFGLPEN_R = crate::BitReader<SYSCFGL...
#![allow(dead_code)] use std::cell::RefCell; mod opcode; use super::memory::*; use crate::log; use opcode::*; use std::sync::{Arc,Mutex}; pub const CARRY_MASK: u8 = 0x01; pub const ZERO_MASK: u8 = 0x02; pub const IRQ_DISABLE_MASK: u8 = 0x04; pub const DEC_MODE: u8 = 0x08; pub const OVERFLOW_MASK: u8 = 0x20; pub c...
use lazy_static::lazy_static; use regex::Regex; use std::collections::HashMap; use std::str::FromStr; use std::{fs, io}; static EYECOLORS: &[&str; 7] = &["amb", "blu", "brn", "gry", "grn", "hzl", "oth"]; lazy_static! { static ref HEIGHT: Regex = Regex::new(r"^(\d+)(in|cm)$").unwrap(); static ref HAIRCOLORS: R...
use crate::models::user::UserAuth; use crate::utils::jwt::Token; use actix_identity::RequestIdentity; use actix_web::{ dev::Payload, web::{HttpRequest, HttpResponse}, Error, FromRequest, }; use futures::future::{err, ok, Ready}; impl FromRequest for UserAuth { type Error = Error; type Config = ();...
//! module ed25519 implements the Ed25519 signature algorithm. See [https://ed25519.cr.yp.to/][1] //! //! [1]: https://ed25519.cr.yp.to/ use std::convert::TryFrom; use std::io::{self, Read}; use ed25519_dalek::{Keypair, SecretKey, Signature, SignatureError}; /// PUBLIC_KEY_LEN is the size, in bytes, of public keys a...
//! Ataxia game engine library code #![deny( missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unused_import_braces, unused_qualifications, clippy::all, clippy::pedantic, clippy::perf, clippy::style )] #![forbid(un...
#[doc = "Register `HPTXSTS` reader"] pub type R = crate::R<HPTXSTS_SPEC>; #[doc = "Register `HPTXSTS` writer"] pub type W = crate::W<HPTXSTS_SPEC>; #[doc = "Field `PTXFSAVL` reader - Periodic transmit data FIFO space available"] pub type PTXFSAVL_R = crate::FieldReader<u16>; #[doc = "Field `PTXFSAVL` writer - Periodic ...
#[doc(hidden)] #[macro_export] macro_rules! benches { ($params:path) => { #[cfg(all(test, feature = "bench"))] mod bench { #![allow(unused_qualifications, unused_imports)] extern crate test; use self::test::Bencher; use super::*; use has...
use std::ops::Add; #[allow(unused_mut)] fn main() { // loop, labeled fn loop_labels() { 'outer: for x in 0..10 { 'inner: for y in 5..15 { if x % 2 == 0 { continue 'outer; } if y % 2 == 0 { continue 'inner; } println!("x: {}, y: {}", x, y); } } } // match let num = 2; // as expression let...
fn main() {} fn is_hello<T: Into<Vec<u8>>>(s: T) { let bytes = b"hello".to_vec(); assert_eq!(bytes, s.into()); } fn into_test() { is_hello("hello".to_string()); }
use super::types::*; use crate::network::Error; impl NetworkRegistrationStat { pub fn is_access_alive(&self) -> bool { matches!( self, NetworkRegistrationStat::Registered | NetworkRegistrationStat::RegisteredRoaming ) } pub fn registration_ok(self) -> Result<Self, E...
#![deny(warnings)] extern crate hyper; extern crate futures; extern crate tokio_core; extern crate pretty_env_logger; use std::io::{self, Read, Write}; use std::net::TcpListener; use std::thread; use std::time::Duration; use hyper::client::{Client, Request, HttpConnector}; use hyper::{Method, StatusCode}; use future...
#[doc = "Register `C2IMR1` reader"] pub type R = crate::R<C2IMR1_SPEC>; #[doc = "Register `C2IMR1` writer"] pub type W = crate::W<C2IMR1_SPEC>; #[doc = "Field `IM0` reader - CPU(m) wakeup with interrupt Mask on Event input"] pub type IM0_R = crate::BitReader; #[doc = "Field `IM0` writer - CPU(m) wakeup with interrupt M...
use std::collections::HashMap; use std::env; use std::fs::File; use std::io::Read; use std::path::PathBuf; use std::process::Command; use crate::makefile::{FinalRule, MakeFile}; // define a consistent message to produce on EOF const EOF_MESSAGE: &str = "Unexpected EOF"; #[derive(Debug, Clone, Eq, PartialEq)] enum Va...
use crate::error::{NiaServerError, NiaServerResult}; use crate::protocol::{DeviceInfo, NiaGetDevicesRequest, Serializable}; use crate::server::Server; use std::sync::MutexGuard; #[derive(Debug, Clone)] pub struct NiaGetDevicesResponse { devices_result: Result<Vec<DeviceInfo>, NiaServerError>, } impl NiaGetDevices...
use crate::Result; use std::{ fs, io::prelude::*, path::PathBuf, sync::{ atomic::{AtomicU64, Ordering}, Arc, }, }; static DEFAULT_FILE_NAME: &'static str = ".tso"; /// A TimestampOracle #[derive(Clone)] pub struct TimestampOracle { inner: Arc<AtomicU64>, path: PathBuf, } i...
// local imports use charts::Chart; use charts::utils::{highest, lowest}; // Ichimoku Kinkō Hyō pub struct Ichimoku<'chart> { chart: &'chart Chart, // params turning_line_period: usize, standard_line_period: usize, span_b_period: usize, lagging_span_displacement: usize, } impl<'chart> Ichim...
#[doc = "Reader of register INIT_CONFIG"] pub type R = crate::R<u32, super::INIT_CONFIG>; #[doc = "Writer for register INIT_CONFIG"] pub type W = crate::W<u32, super::INIT_CONFIG>; #[doc = "Register INIT_CONFIG `reset()`'s with value 0"] impl crate::ResetValue for super::INIT_CONFIG { type Type = u32; #[inline(...
/*! Defines the AST for conditional compilation expressions. */ use WinVersion; use features::{Architectures, Partitions, is_important_define}; use super::eval::Value; /** A single node in a CC expression AST. */ #[derive(Clone, Debug, Eq, PartialEq)] pub enum Node { /// An integer literal. IntLit(u32), /...
use acid_list::{AcidList, Header}; use std::io; fn main() -> io::Result<()> { let mut args = std::env::args(); args.next(); // skip program name let path = args.next().ok_or(io::ErrorKind::InvalidInput)?; let nodes = args .next() .ok_or(io::ErrorKind::InvalidInput)? .parse() ...
extern crate serde; extern crate serde_json; use std::cell::RefCell; use std::rc::Rc; use std::sync::Arc; use serde::{Deserialize, Serialize}; use std::time::Duration; use actix::prelude::*; use actix_files::NamedFile; use chrono::Local; use futures::prelude::*; mod passage; mod route_fragment; mod route_fragment_...
//https://ptrace.fefe.de/wp/wpopt.rs // gcc -o lines lines.c // tar xzf llvm-8.0.0.src.tar.xz // find llvm-8.0.0.src -type f | xargs cat | tr -sc 'a-zA-Z0-9_' '\n' | perl -ne 'print unless length($_) > 1000;' | ./lines > words.txt use std::collections::HashMap; use std::fmt::Write; use std::io; use std::iter::FromIte...
use super::*; #[derive(StructOpt, Debug, Clone)] pub struct RipGrepForerunner { /// Specify the working directory of CMD #[structopt(long = "cmd-dir", parse(from_os_str))] cmd_dir: Option<PathBuf>, /// Specify the threshold for writing the output of command to a tempfile. #[structopt(long = "outpu...
#[derive(Debug)] enum List { // Cons(i32, List), Cons(i32, Box<List>), Nil, } pub fn list_main() { let list = List::Cons(1, Box::new(List::Cons(2, Box::new(List::Nil)))); println!("{:?}", list); }
// Copyright 2020 <盏一 w@hidva.com> // 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 in writing,...
use super::ApiError; use super::{Client, FileList, FileUpdate, Queriable}; use crate::cache::{Cache, Cacheable, FileData, UpdateStatus}; use crate::config::PathType; use crate::Config; use crate::Messages; use std::collections::BinaryHeap; use std::sync::atomic::Ordering; use std::sync::Arc; use tokio::task; #[deriv...
struct Circle { x: f64, y: f64, radius: f64 } impl Circle { fn new(x: f64, y: f64, radius: f64) -> Circle { Circle { x: x, y: y, radius: radius } } fn area(&self) -> f64 { std::f64::consts::PI * (self.radius * self.radius) } } fn...
//! Tessellation features. //! //! # Tessellation mode //! //! Tessellation is geometric information. Currently, several kinds of tessellation are supported: //! //! - *point clouds*; //! - *lines*; //! - *line strips*; //! - *triangles*; //! - *triangle fans*; //! - *triangle strips*. //! //! Those kinds of tessellati...
use azure_core::AddAsHeader; use http::request::Builder; create_enum!( AccessTier, (Hot, "Hot"), (Cool, "Cool"), (Archive, "Archive") ); impl AddAsHeader for AccessTier { fn add_as_header(&self, builder: Builder) -> Builder { builder.header(azure_core::headers::BLOB_ACCESS_TIER, self.as_re...
use std::convert::{TryFrom, TryInto}; use std::fmt; use serde::de::{self, Deserialize, Deserializer, Visitor}; use serde::ser::{Serialize, Serializer}; use url::Url; use crate::repo::RepoUrl; #[derive(Debug, serde::Deserialize, Clone, PartialEq, Eq, Hash, Default)] #[cfg_attr(feature = "poem-openapi", derive(poem_op...
extern crate serde_yaml; use std::error::Error; use std::fs::File; use std::fs::OpenOptions; use std::io::prelude::*; use std::env; use serde_json::{Value, Map}; fn main() { let args: Vec<String> = env::args().collect(); let mode = &args[1]; match mode.as_str() { "yaml" => yaml_to_json().unwrap_or_else...
use crate::api; use actix_web::{http::StatusCode, ResponseError}; use thiserror::Error; #[derive(Debug, Error)] pub enum Error { #[error("Player not found")] NoPlayer, #[error("No skin available")] NoSkin, #[error("{0}")] Base64( #[from] #[source] base64::DecodeError, ...
// https://www.codewars.com/kata/57eb8fcdf670e99 use std::cmp::Ordering; fn high(input: &str) -> &str { let mut word_lengths = input.split(' ').enumerate().map(|indexed_word|{ (indexed_word.0,indexed_word.1.as_bytes().iter().fold(0,|accum,i| accum + (*i as u64) - 96),indexed_word.1) }).collect::<Vec<(u...
use super::traits::{Allocate, Update}; use super::bufferobject; #[derive(Debug, Default)] pub struct Vao { id: gl::types::GLuint, num_indices: i32, num_vertex: i32 } impl Vao { pub fn new() -> Vao { unsafe { let mut id = std::mem::zeroed(); gl::GenVertex...
use chrono::Local; use clap::{crate_version, App, AppSettings, Arg, SubCommand}; use env_logger::Builder; use log::LevelFilter; use std::io::Write; mod subcommands; fn main() { // log time stamp Builder::new() .format(|buf, record| { writeln!( buf, "{} [{}] ...
use futures::task::{Context, Poll}; use futures::AsyncWrite; use std::io; use std::pin::Pin; use tokio::prelude::*; pub(crate) struct ConnectionWriter { connection: tokio::net::TcpStream, } impl ConnectionWriter { pub(crate) fn new(connection: tokio::net::TcpStream) -> Self { ConnectionWriter { connec...
#![doc = include_str!("../README.md")] pub mod c_lib; pub mod util; pub use c_lib as c; use lazy_static::lazy_static; use std::collections::HashSet; use std::sync::atomic::{AtomicUsize, Ordering}; use std::{iter, mem, ops, str, usize}; use thiserror::Error; use tree_sitter::{ Language, LossyUtf8, Node, Parser, Po...
use rand::rngs::ThreadRng; use super::Texture; use crate::perlin::Noise; use crate::vec3::{Color, Point3}; pub struct Perlin { noise: Noise, scale: f64, depth: i32, } impl Perlin { pub fn new(scale: f64, depth: i32, rng: &mut ThreadRng) -> Self { Self { noise: Noise::new(rng), ...
use std::fmt; use std::fs; extern crate nom; use std::collections::{HashMap, HashSet}; use std::iter::FromIterator; use nom::{ branch::alt, bytes::complete::tag, character::complete::char, character::complete::{digit1, space0}, combinator::map_res, multi::many0, sequence::{delimited, pair}...
pub mod admin; pub mod view_board_threads; pub mod post_editor; pub mod view_thread;
pub mod api; pub mod models; pub async fn sync() {}
use std::collections::{HashMap, HashSet}; use color::Color; extern crate rayon; use board::rayon::prelude::*; #[derive(Clone)] pub(crate) struct Board { pub(crate) colors : HashMap<(usize, usize), Option<Color>>, pub(crate) size : (usize, usize), } impl Board { pub(crate) fn new(size : (usize, usize)) ->...
fn main(){ enum Temp{ hot, normal, cold, } impl Temp { fn calc_temp(&self) -> i32{ match self { &Temp::hot => 39, &Temp::normal => 36, _ => 34, } } } let temp = Temp::cold; println!("{}", temp.calc_temp()); }
use crate::Shape::*; pub struct Circle { pub radius: u32, pub x: i32, pub y: i32, pub traits: Shape } impl ShapeContract for Circle { }
fn main() { proconio::input! { N: u64 } let mut N = N; for i in (1..13).rev() { let keta = std::num::pow(10, i); if N < keta { continue; } } }
use siro::prelude::*; use wasm_bindgen::prelude::*; use wee_alloc::WeeAlloc; #[global_allocator] static ALLOC: WeeAlloc = WeeAlloc::INIT; // ==== model ==== #[derive(Default)] struct Model { name: String, password: String, password_again: String, } // ==== update ==== enum Msg { Name(String), P...
use std::cmp; use parser::{FileHash, Function, Range, Type, Unit, Variable}; use crate::filter; use crate::print::{ self, DiffState, MergeIterator, MergeResult, Print, PrintState, SortList, ValuePrinter, }; use crate::{Options, Result, Sort}; pub(crate) fn merged_types<'a, 'input>( hash_a: &FileHash, uni...
//! This example demonstrates using the [`Color`] [setting](tabled::settings) to //! stylize text, backgrounds, and borders. //! //! * 🚩 This example requires the `color` feature. //! //! * Note how [`Format::content()`] is used to break out [`CellOption`] //! specifications. This is helpful for organizing extensive [...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use crate::typing_env_types::Env; use arena_trait::Arena; use naming_special_names_rust::typehints; use oxidized::aast::{Hint, Hint_}; u...
#[macro_use] extern crate lazy_static; #[macro_use] extern crate log; #[macro_use] extern crate mysql; use std::collections::HashMap; use std::env; use std::fs; use std::fs::File; use std::io; use std::io::{BufRead, BufReader, BufWriter, Read, Write}; use std::iter; use std::net::{Shutdown, TcpListener, TcpStream}; ...
use std::sync::Arc; use crate::framework::Runnable; use crate::pinouts::analog::input::AnalogInput; use crate::status::current::GlobalCurrentState; use rocket::config::Array; use crate::robot_map::BROWN_CURRENT; /// Monitors current and updates it's state accordingly. pub struct CurrentMonitor { input: Box<Analog...
use core::ptr::NonNull; use alloc::sync::Arc; use fermium::SDL_GameController; use crate::{sdl_get_error, Initialization, SdlError}; pub struct Controller { nn: NonNull<SDL_GameController>, // Note(Lokathor): As long as the window lives, we have to also keep SDL // itself alive. #[allow(dead_code)] init: ...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct ExtendedIdentifierUids { ext: Option<ExtendedIdentifierUidsExt>, } #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct ExtendedIdentifierUidsExt {}
//! JSON API for glacio data. //! //! This crate uses the `glacio` crate to fetch glacier research data, and turns it into a JSON API //! for the web. #![deny(missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, unsafe_code, unstable_features, unused_...
use clap::{clap_app, crate_authors, crate_description, crate_name, crate_version}; use fantoccini::ClientBuilder; use std::env; use tokio::fs; use std::process::{Command, Stdio}; use once_cell::sync::Lazy; struct TemporaryProcess(std::process::Child); impl Drop for TemporaryProcess { fn drop(&mut self) { ...
use std::fs::File; use std::io::{BufRead, BufReader}; use std::collections::HashMap; pub fn exercise() { let data = load_data(); let distribution: HashMap<i32,i32> = HashMap::new(); let built_in_adapter = data.iter().max().unwrap() + 3; let mut adapters = data.clone(); adapters.push(built_in_adapter); printl...
//! Convex cone use crate::solver::LinAlg; /// Convex cone trait. /// /// <script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script> /// <script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-svg.js"></script> pub trait Cone<L: LinAlg> { /// Calculates \\...
mod problem; mod problem_set; fn main() { let eddy = problem_set::eddy(); let soln = eddy.solve(); println!("{}", soln); let ica = problem_set::in_class_a(); let soln = ica.solve(); println!("{}", soln); let icb = problem_set::in_class_b(); let soln = icb.solve(); println!("{}", soln); }
fn fibonacci(n: i32) -> i32 { if n < 2 { n } else { fibonacci(n-1) + fibonacci(n-2) } } fn another_fibonacci(n: i32) -> i32 { if n < 2 { return n; } return another_fibonacci(n-1) + another_fibonacci(n-2); } fn third_fibonacci(n: i32) -> i32 { match n { 0 => ...
// Copyright 2018 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 bytes::{Buf, BufMut}; use futures::io::{AsyncRead, AsyncWrite, Initializer}; use futures::task; use futures::{Async, Future, Poll, Stream}; use libc; u...
use specs::{Entity, Join, ReadStorage, System, WriteStorage}; use components::*; pub struct CameraSystem { player_entity: Entity, } impl CameraSystem { pub fn new(player_entity: Entity) -> Self { CameraSystem { player_entity: player_entity, } } } impl<'a> System<'a> for Camer...
use math::*; use math::geom::{plane, Plane, PlaneTestResult}; use std::{i32, u16, default}; use std::f32; use bsp; // TODO: this is a gnarly mess #[derive(Copy, Clone, Debug)] pub struct HalfEdge { pub id: i32, pub v: i32, pub adj: i32, pub next: i32, pub prev: i32, pub face: i32 } impl defaul...
use models::blocks::Block; use serde::Deserialize; use serde::Serialize; #[derive(Debug, Deserialize)] pub struct SlackRequest { pub token: String, pub user_name: String, pub response_url: String, } #[derive(Debug, Deserialize)] pub struct SlackAction { pub action_id: String, pub value: String, } ...
use crate::block::proposer::genesis as proposer_genesis; use crate::block::voter::genesis as voter_genesis; use crate::block::Block; use crate::config::*; use crate::crypto::hash::{Hashable, H256}; use bincode::{deserialize, serialize}; use rocksdb::{self, ColumnFamilyDescriptor, Options, SliceTransform, DB}; use std::...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub enum MetricId { #[serde(rename = "requests/count")] RequestsCount, #[serde(rename = "requests/duration")] ...
use std::prelude::v1::*; use num_traits::{Zero, One}; use totsu_core::solver::{Solver, SliceLike, Operator, Cone}; use totsu_core::{LinAlgEx, MatOp, ConeSOC, ConeZero, splitm, splitm_mut}; use crate::MatBuild; // pub struct ProbSOCPOpC<'a, L: LinAlgEx> { vec_f: MatOp<'a, L>, } impl<'a, L: LinAlgEx> ...
fn main() { use std::collections::{HashMap, HashSet}; use std::io::{self, BufRead}; let mut h:HashMap<char, (HashSet<char>, HashSet<char>)> = HashMap::new(); let stdin = io::stdin(); for line in stdin.lock().lines() { let first_letters = line.unwrap().split(" ").map(|s| s.chars().next().u...
//! Common errors shared across the library. use std::fmt::{self, Display}; use thiserror::Error; pub(crate) const FEATURE_REQUEST_URL: &str = "https://github.com/V0ldek/rsonpath/issues/new?template=feature_request.md"; pub(crate) const BUG_REPORT_URL: &str = "https://github.com/V0ldek/rsonpath/issues/new?template...
use super::interface; use std::cell::RefCell; use std::rc::Rc; use std::{ fmt, io, time::{SystemTime, UNIX_EPOCH}, }; pub mod ErrorHandler; pub fn getnow() -> std::time::Duration { let start = SystemTime::now(); let since_epoch = start .duration_since(UNIX_EPOCH) .expect("error time went...
use std::io::{self, Read, Write}; use byteorder::{ReadBytesExt, LittleEndian}; mod brr; fn main() { let mut buf: [u8; 512] = [0x00; 512]; let mut block_buf: [i16; 16] = [0; 16]; let mut encoder = brr::Encoder::new(); let mut stdin = io::stdin(); let mut total_bytes = 0; let mut first_block = tr...
use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use anyhow::anyhow; pub async fn fetch_root_key_if_needed(env: &dyn Environment) -> DfxResult { let agent = env .get_agent() .ok_or_else(|| anyhow!("Cannot get HTTP client from environment."))?; if !env .get_n...
//! # Handlebars Switch Helper //! //! This provides a [Handlebars](http://handlebarsjs.com/) `{{#switch}}` helper to //! the already incredible [handlebars-rust](https://github.com/sunng87/handlebars-rust) //! crate. //! //! Links of interest: //! //! - [Documentation](https://docs.rs/handlebars_switch) //! - [handleb...
use anyhow::Result; use assert_cmd::prelude::*; use predicates::prelude::*; use std::process::Command; #[test] fn file_doesnt_exist() -> Result<()> { let mut cmd = Command::cargo_bin("adparse")?; cmd.arg("test/file/doesnt/exist"); cmd.assert() .failure() .stderr(predicate::str::contains("N...
use carboxyl::Signal; #[derive(Clone, Copy)] pub struct Vector2D { x: f32, y: f32, } impl Vector2D { pub fn _new(x: f32, y: f32) -> Vector2D { Vector2D { x: x, y: y } } } #[derive(Clone, Copy)] pub struct Momentum(Vector2D); impl Momentum { pub fn _new(x: f32, y: f32) -> Momentum { ...
fn print_admiration(name: String) { println!("Wow, {} really makes you think.", name); } fn main() { let value = "Artwork"; print_admiration(value.to_string()); }
#[doc = "Register `MPCBB2_VCTR3` reader"] pub type R = crate::R<MPCBB2_VCTR3_SPEC>; #[doc = "Register `MPCBB2_VCTR3` writer"] pub type W = crate::W<MPCBB2_VCTR3_SPEC>; #[doc = "Field `B96` reader - B96"] pub type B96_R = crate::BitReader; #[doc = "Field `B96` writer - B96"] pub type B96_W<'a, REG, const O: u8> = crate:...
use crate::intcode::IntCode; use std::collections::HashMap; #[derive(Copy, Clone, Debug, PartialEq, Eq)] enum Direction { Up, Down, Left, Right, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] enum TileContent { Scaffold, Robot(Direction), Empty, } impl From<char> for TileContent { fn ...
mod descriptor; #[derive(Copy, Clone, FromPrimitive, ToPrimitive, Eq, PartialEq)] pub enum VmdkKind { TwoGbSparse, // VMware Workstation multi-extent dynamic disk TwoGbFlat, // VMware Workstation multi-extent pre-allocated disk MonolithicSparse, // VMware Workstation single-file dynamic d...
use crate::Error; use common::rsip::{self, prelude::*}; use std::net::SocketAddr; //incoming pub fn apply_request_defaults( mut request: rsip::Request, peer: SocketAddr, _transport: rsip::Transport, ) -> Result<rsip::SipMessage, Error> { use super::uas::*; apply_received_value(request.via_header_m...
#[doc = "Register `GICD_SPISR7` reader"] pub type R = crate::R<GICD_SPISR7_SPEC>; #[doc = "Field `SPISR7` reader - SPISR7"] pub type SPISR7_R = crate::FieldReader<u32>; impl R { #[doc = "Bits 0:31 - SPISR7"] #[inline(always)] pub fn spisr7(&self) -> SPISR7_R { SPISR7_R::new(self.bits) } } #[doc ...
// // Copyright 2018 The Project Oak 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 required by applicable law o...
extern crate asn1_der; use ::asn1_der::{ Asn1DerError, DerValue }; const RANDOM: &[u8] = include_bytes!("rand.dat"); #[test] fn test_ok() { // Test deserialization let deserialized = DerValue::deserialize(RANDOM.iter(), RANDOM.len()).unwrap(); // Test length prediction assert_eq!(deserialized.serialized_len(),...
use minish; fn main() { minish::run(); }
use log::{error, info}; use serenity::{model::channel::Message, prelude::*}; // Users commonly message things like "^^^ what he said", this will check if there's a "^ " in the message and will ignore it if it's found. pub fn prefix_space_check(ctx: &mut Context, msg: &Message, unknown_command_name: &str) { if msg....
use crate::rpc::{create_eth_rpc, EthDeps}; use crate::service::{ new_frontier_partial, spawn_frontier_tasks, EthConfiguration, FrontierPartialComponents, }; use clap::Parser; use domain_runtime_primitives::{Balance, Index}; use domain_service::providers::{BlockImportProvider, DefaultProvider, RpcProvider}; use doma...
use std::sync::Arc; use common::event::{EventPublisher, EventSubscriber}; use common::result::Result; use crate::domain::role::RoleRepository; use crate::domain::token::{TokenEncoder, TokenRepository, TokenService}; use crate::domain::user::{ AuthenticationService, AuthorizationService, PasswordHasher, UserReposi...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub mod blockchain_members { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub...
/// Fast field module /// /// Fast fields are the equivalent of `DocValues` in `Lucene`. /// Fast fields are stored in column-oriented fashion and allow fast /// random access given a `DocId`. /// /// Their performance is comparable to that of an array lookup. /// They are useful when a field is required for all or mos...
use std::borrow::Cow; use std::fmt::Debug; use speedy::{Readable, Writable}; #[derive(PartialEq, Debug, Readable, Writable)] struct DerivedStruct { /// A doc comment. a: u8, b: u16, c: u32 } #[derive(PartialEq, Debug, Readable, Writable)] struct DerivedTupleStruct( u8, u16, u32 ); #[derive(PartialEq...
//! Radius accounting //! //! RFC 2865: Remote Authentication Dial In User Service (RADIUS) //! RFC 2866: RADIUS Accounting use crate::radius_attr::*; use nom::bytes::streaming::take; use nom::combinator::{complete, cond, map, map_parser}; use nom::multi::many1; use nom::number::streaming::{be_u16, be_u8}; use nom::IR...
/** --- Part Two --- During the second Go / No Go poll, the Elf in charge of the Rocket Equation Double-Checker stops the launch sequence. Apparently, you forgot to include additional fuel for the fuel you just added. Fuel itself requires fuel just like a module - take its mass, divide by three, round down, and subtra...
use crate::{ node::{Node, Tickable}, status::Status, }; /// A node that repeats its child until the child fails. /// /// This node will return that it is running until the child fails. It can /// potentially have a finite reset limit. If the child ever returns that it /// fails, this node returns that it *succ...
use crate::plot::gnuplot_backend::{gnuplot_escape, Colors, DEFAULT_FONT, LINEWIDTH, SIZE}; use crate::plot::Size; use crate::plot::{FilledCurve as FilledArea, VerticalLine}; use crate::report::BenchmarkId; use criterion_plot::prelude::*; pub fn t_test( colors: &Colors, id: &BenchmarkId, size: Opti...
#[cfg(test)] mod tests { use rstate::*; use std::hash::Hash; #[derive(Copy, Clone, Debug)] enum Action { Toggle, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] enum State { Active, Inactive, } #[derive(Debug, Clone, Copy)] struct Context { ...