text
stringlengths
3.09k
13.9k
//! This module implements a subset of the two phase commit specification presented in the paper //! ["Consensus on Transaction Commit"](https://www.microsoft.com/en-us/research/wp-content/uploads/2016/02/tr-2003-96.pdf) //! by <NAME> and <NAME>. use clap::*; use stateright::*; use stateright::checker::*; use staterig...
use anyhow::Context; use chef::{CookArgs, DefaultFeatures, OptimisationProfile, Recipe, TargetArgs}; use clap::crate_version; use clap::Clap; use fs_err as fs; use std::collections::HashSet; use std::path::PathBuf; /// Cache the dependencies of your Rust project. #[derive(Clap)] #[clap( bin_name = "cargo", ver...
//! Retained layout that supports substring queries. use std::ops::Range; use harfbuzz::sys::{hb_script_t, HB_SCRIPT_COMMON, HB_SCRIPT_INHERITED, HB_SCRIPT_UNKNOWN}; use pathfinder_geometry::vector::Vector2F; use crate::hb_layout::layout_fragment; use crate::unicode_funcs::lookup_script; use crate::{FontCollection,...
// Copyright 2021 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or d...
use crate::{ id::{InfoHash, NodeId}, routing::table::RoutingTable, worker::{DhtHandler, OneshotTask, Socket, StartLookup}, }; use futures_util::Stream; use std::{ collections::HashSet, io, net::SocketAddr, pin::Pin, task::{Context, Poll}, }; use tokio::{ net::UdpSocket, sync::{mp...
mod any; mod array; mod boolean; mod class; mod file; mod float; mod function; mod generic; mod integer; mod method; mod nullable; mod object; mod string; use crate::parser::Code; use crate::runtime::engine::Engine; use crate::runtime::gc::{ GcRef, GcTrace }; use crate::runtime::primitives::{ Class, Generic, GenericPr...
// Copyright (c) 2021, <NAME>, <NAME> 10, bus 2452, B-3001 Leuven-Heverlee, Belgium. // Copyright (c) 2021, Cosmian Tech SAS, 53-55 rue La Boétie, Paris, France. #![warn(clippy::all)] #![allow(clippy::trivial_regex)] #![deny(rust_2018_idioms)] use parse_display::{Display, FromStr}; use scasm::asm::Body; use scasm::Co...
use advent::helpers; use anyhow::{Context, Result}; use itertools::Itertools; type NumType = u32; type Numbers = Vec<NumType>; type NumberHistoryMap = std::collections::HashMap<NumType, NumType>; fn parse_numbers(s: &str) -> Result<Numbers, std::num::ParseIntError> { s.trim() .split(',') .map(|n| n...
//! Cipher defined with libsodium use std::sync::{ONCE_INIT, Once}; use bytes::{BufMut, BytesMut}; use crypto::{CipherResult, CipherType, StreamCipher}; use libc::{c_ulonglong, uint32_t}; use libsodium_ffi::{crypto_stream_chacha20_ietf_xor_ic, crypto_stream_chacha20_xor_ic, crypto_stream_salsa20_xor_ic, ...
use fancy_regex::Regex; lazy_static! { static ref REGISTRY: Regex = Regex::new( &[ r"(?mxi)", r"(?!^.*?(?:\^.*$", r"|\[\d\-\d\]|\{\d*\,\d*\}))((^[^\n]*?)((^\\*|\\+)", r"(HK(EY|LM|CU|U|CC|CR))", r"(\\+|_[^\n]+?\\+)|", r"^(BCD[-\n]+|", ...
extern crate unicode_segmentation; use self::unicode_segmentation::UnicodeSegmentation; use std::path::Path; use std::collections::HashMap; use std::io::{BufRead, BufReader}; use std::fs::File; use std::collections::BinaryHeap; //////////////////////////////////////////////////////////////////////////////// #[derive...
extern crate graphics; extern crate intel8080cpu; extern crate opengl_graphics; extern crate piston; extern crate piston_window; use self::intel8080cpu::*; use self::opengl_graphics::OpenGL; use self::piston::input::MouseButton; use self::piston_window::*; use super::failure::Error; use super::io_devices::*; use super...
#![crate_name = "tzbot"] #![crate_type = "lib"] extern crate hourglass; extern crate regex; extern crate time; use hourglass::Timezone; use regex::Regex; use std::collections::HashMap; use std::option::Option; use std::vec::Vec; fn format_output(tz: String, hours: String, minutes: String, ampm: String, lookup: Hash...
use logos::Logos; use num_enum::{IntoPrimitive, TryFromPrimitive}; #[derive(Debug, Logos, Copy, Clone, PartialEq, IntoPrimitive, TryFromPrimitive)] #[repr(u16)] pub(crate) enum SyntaxKind { #[token("let")] LetKw, #[token("if")] IfKw, #[token("then")] ThenKw, #[token("else")] ElseKw, ...
#[allow(unused_imports)] use crate::log; use crate::shader::range::Range; use crate::shader::attributes::{Format, Type}; use web_sys::{WebGl2RenderingContext, WebGlTexture}; use wasm_bindgen::{JsValue}; use js_sys::Object; use crate::webgl_wrapper::WebGlWrapper; // TODO: context loss? pub struct DataTexture<T> { ...
use std::mem; use crate::chopper::error::Result; use crate::chopper::types::{FieldType, FieldValue, Header, Row}; use crate::cli::util::YesNoAuto; use crate::source::csv_input_config::CSVInputConfig; use crate::source::csv_timestamp_util::{self, TimestampCol, TimestampFmt}; use crate::source::source::Source; use crate...
use super::*; use crate::r#const::FLOOR; use crate::r#const::COLOR_DARK_GROUND; // Object in the game #[derive(Serialize, Deserialize, Debug)] pub struct Object { pub x: i32, pub y: i32, pub char: char, pub color: Color, pub name: String, pub blocks: bool, pub alive: bool, pub fighter:...
// Symphonia // Copyright (c) 2019 The Project Symphonia Developers. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. use symphonia_core::support_format; use sym...
mod cli; mod tui; use async_std::task::block_on; use roomba::{api, Client}; use serde::{Deserialize, Serialize}; use std::io::Write; use structopt::StructOpt; const ROOMBA_CFG: &str = "roomba.toml"; #[derive(Serialize, Deserialize, Default)] struct Config { hostname: Option<String>, username: Option<String>,...
use crate::types::*; use crate::utils::*; const UNITS: [StaticStr; 10] = [ "", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", ]; const TENS: [StaticStr; 10] = [ "", "ten", "twenty", "thirty", "forty", "fifty", "sixty", "seventy", "eighty", "ninety", ]; const TEENS: [StaticStr; 10] = ...
use crate::{ panic, sync::OnceLock, sync::{ atomic::{AtomicUsize, Ordering::SeqCst}, mpsc::channel, }, thread, }; fn spawn_and_wait<R: Send + 'static>(f: impl FnOnce() -> R + Send + 'static) -> R { thread::spawn(f).join().unwrap() } #[test] #[cfg_attr(target_os = "emscripten", ...
use tui::style::Color; use crate::colorscheme::ColorScheme; use crate::colorscheme::nord::ColorPalette::*; #[allow(dead_code)] enum ColorPalette { Nord0, Nord1, Nord2, Nord3, Nord4, Nord5, Nord6, Nord7, Nord8, Nord9, Nord10, Nord11, Nord12, Nord13, Nord14, ...
extern crate needletail; extern crate rdxsort; use super::structs::*; use needletail::{parse_fastx_file, FastxReader}; use rdxsort::*; // std sort was too slow for large vecs const A: u8 = 0x41; const C: u8 = 0x43; const G: u8 = 0x47; const T: u8 = 0x54; const AA: u8 = 0x61; const CC: u8 = 0x63; const GG: u8 = 0x67; ...
//! Traits and code for emitting high-level structures as low-level, raw wasm //! structures. E.g. translating from globally unique identifiers down to the //! raw wasm structure's index spaces. use crate::encode::{Encoder, MAX_U32_LENGTH}; use crate::ir::Local; use crate::map::{IdHashMap, IdHashSet}; use crate::{Code...
use crossterm::{cursor, execute, queue, style, terminal}; //use log::debug; use std::error::Error; use std::io::{stdout, Stdout, Write}; const TITLE: &str = "Hash Bang"; lazy_static! { static ref COLORS: Vec<style::Color> = vec![style::Color::Grey, style::Color::Yellow, style::Color::Cyan]; } pub struct ...
use blip_buf::BlipBuf; use crate::settings::{ CLOCK_RATE, EFFECT_FADEOUT, EFFECT_NONE, EFFECT_SLIDE, EFFECT_VIBRATO, NOISE_VOLUME_FACTOR, NUM_CLOCKS_PER_TICK, OSCILLATOR_RESOLUTION, PULSE_VOLUME_FACTOR, SQUARE_VOLUME_FACTOR, TONE_NOISE, TONE_PULSE, TONE_SQUARE, TONE_TRIANGLE, TRIANGLE_VOLUME_FACTOR, VIBRAT...
//! WARNING: DO NOT USE ANY ADDRESS THAT MAPS TO THE SAME P4 ENTRY AS THE ONE //! USED FOR THE RECURSIVE PAGE TABLE ENTRY (CURRENTLY 510). //! Currently, that would be any address that starts with 0xFFFF_FF0*_****_****, //! so do not use that virtual address range for anything!! //! Current P4 (top-level page table) ...
use regex::Regex; use std::collections::HashMap; use std::fs; use std::fs::File; use std::io::{self, BufRead, Error}; use std::path::Path; // The output is wrapped in a Result to allow matching on errors // Returns an Iterator to the Reader of the lines of the file. #[allow(dead_code)] fn read_lines<P>(filename: P) ->...
use std::cell::Cell; use std::path::{Path, PathBuf}; use std::io::{Error, ErrorKind, Read}; use std::fs::File; use std::sync::{Once, ONCE_INIT}; pub static mut INST: Option<Config> = None; static INST_ONCE: Once = ONCE_INIT; macro_rules! is_nightly_channel { () => { option_env!("CFG_RELEASE_CHANNEL") ...
//! This module tries to flatten expressions as far as possible without the intervention of more //! complex evaluation rules. Flattening might be used as a "first pass" to normalize an expression, //! or by a more complex rule for the same reason. //! //! # Examples //! //! ## Targets of this module //! //! ```text //...
#![allow(dead_code)] use std::collections::HashMap; use bevy::prelude::*; use bevy_networking_turbulence::{ConnectionHandle, NetworkResource}; use instant::{Duration, Instant}; use shared::{ message::{FrameInfo, ServerMessage}, FrameDiff, FrameNumber, PlayerHandle, GAME_LENGTH, }; use crate::resource::{Frame...
// Copyright 2020 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 { super::metrics, crate::args, fidl_fuchsia_update_installer_ext::Options, fuchsia_url::pkg_url::PkgUrl, std::time::{Instant, Syste...
use std::fmt; use std::iter::Peekable; use std::ops::Range; use crate::search::MatchRangeIter; use crate::terminal; use crate::terminal::{Style, Terminal}; use crate::truncatedstrview::TruncatedStrView; // This module is responsible for highlighting text in the // appropriate colors when we print it out. // // We use...
use anyhow::{bail, Result}; use num_bigint::*; use num_traits::cast::ToPrimitive; use std::fs::File; use std::io::prelude::*; #[derive(Debug)] enum Technique { NewStack, Cut(isize), Incr(usize), } fn load_techniques(data: &str) -> Result<Vec<Technique>> { let mut result = Vec::new(); for tech_str...
// Copyright 2020 <NAME> // SPDX-License-Identifier: Apache-2.0 // https://en.bitcoin.it/wiki/BIP_0039 // https://doc.rust-lang.org/std/primitive.str.html // "String slices are always valid UTF-8." type Mnemonic = str; type Passphrase = str; type Seed = [u8; 64]; extern crate alloc; use alloc::string::{String, ToStr...
use std::io; use std::ops::Range; use serde::{Deserialize, Serialize}; use crate::error::DataCorruption; use crate::termdict::sstable_termdict::sstable::common_prefix_len; #[derive(Default, Debug, Serialize, Deserialize)] pub struct SSTableIndex { blocks: Vec<BlockMeta>, } impl SSTableIndex { pub(crate) fn ...
use std::sync::Arc; use serenity::{ builder::EditMessage, http::Http, model::{ interactions::{ application_command::ApplicationCommandInteraction, message_component::{ButtonStyle, MessageComponentInteraction}, InteractionApplicationCommandCallbackDataFlags, ...
use unicode_segmentation::UnicodeSegmentation; use unicode_width::UnicodeWidthStr; use widgets::{Block, Widget}; use buffer::Buffer; use layout::Rect; use style::{Color, Modifier, Style}; /// A widget to display some text. You can specify colors using commands embedded in /// the text such as "{[color] [text]}". /// ...
use super::error::ErrorKind; use super::scalars::BlockCount; use super::{Block, Context}; use blockcfg::{self, HeaderHash}; use juniper::{FieldResult, ParseScalarResult, ParseScalarValue, Value}; use std::convert::TryFrom; #[derive(Clone)] pub struct BlockCursor(blockcfg::ChainLength); juniper::graphql_scalar!(BlockC...
use crate::error::SpanreedError; use crate::config::{Site, Element, Config, Function}; use std::collections::HashMap; use futures::future; use scraper::html::Html; use scraper::Selector; use scraper::element_ref::ElementRef; use mlua::prelude::Lua; /// Scrapes websites described in `config` pub async fn scrape(config:...
pub use crate::errors::{OperationError, OperationErrorInfo}; use crate::thumbnail::operations::Operation; use crate::{BoxPosition, StaticThumbnail}; use image::{DynamicImage, GenericImageView}; use std::fmt; use std::fmt::Formatter; #[derive(Clone)] /// Representation of the combine operation as a struct pub struct Co...
use crate::avm1; use crate::dictionary::CharacterId; use crate::sound; use std::collections::BTreeMap; use std::ops::Add; use std::str; use swf_types as swf; #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Depth(pub u16); #[derive(Copy, Clone, Default, Debug, PartialEq, Eq, PartialOrd, ...
use std::{ collections::VecDeque, fs::File, io::{BufRead, BufReader, Lines, Result}, path::Path, time::Instant, }; const HI: usize = 1; const LO: usize = 0; const FILES_PATH: [&str; 13] = [ "./ip_list_filter_test_cases/casoenunciado.txt", "./ip_list_filter_test_cases/cohen01.txt", "./ip...
#[macro_use(FromPrimitive, ToPrimitive)] extern crate num_derive; #[macro_use(lazy_static)] extern crate lazy_static; #[macro_use(Getters, Setters)] extern crate getset; mod decode; pub use decode::DecodeError; mod dns; pub use dns::{Dns, Flags}; mod domain_name; pub use domain_name::{DomainError, DomainName}; mod ...
// Copyright 2018-2021 Cargill Incorporated // // 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...
use crate::{ stakes::{create_and_add_stakes, StakerInfo}, unlocks::UnlockInfo, }; use solana_sdk::{genesis_config::GenesisConfig, native_token::LAMPORTS_PER_SOL}; // 9 month schedule is 100% after 9 months const UNLOCKS_ALL_AT_9_MONTHS: UnlockInfo = UnlockInfo { cliff_fraction: 1.0, cliff_years: 0.75, ...
use std::io; use std::io::BufRead; use std::fs; use std::fs::File; use glob::glob; use sysconf::raw::sysconf; use sysconf::raw::SysconfVariable; use std::time::Duration; use shuteye::sleep; extern crate shuteye; extern crate glob; extern crate sysconf; #[macro_use]extern crate collectd_plugin; #[macro_use]extern crate...
use std::path::PathBuf; use palmrs::database::{ header::DatabaseHeader, info::ExtraInfoRecord, record::DatabaseRecord, DatabaseFormat, PalmDatabase, PdbWithCategoriesDatabase, PrcDatabase, }; use pretty_hex::{config_hex, HexConfig}; use stable_eyre::eyre::{eyre, Report, WrapErr}; use structopt::StructOpt; /// ...
use std::net::{IpAddr, SocketAddr}; use std::time::{Duration, Instant}; use failure::{bail, Error}; use futures::prelude::*; use futures::try_ready; use futures_timer::Interval; use log::{info, warn}; use crate::connected::Connected; use crate::crypto::CryptoManager; use crate::packet::{ CipherType, ControlPacket...
use std::fs::{metadata, File, OpenOptions, create_dir_all}; use std::io::Write; use std::path::{Path, PathBuf}; use crate::sender::{Sender, string_from}; use crate::error::GenError; use serde_json::Value; /// the struct which implements the Sender trait and allows /// to save a generated json to folder /// It include...
// Copyright 2022 <NAME> // // 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 serde::{Deserialize, Serialize}; use std::iter::Iterator; use yew::agent::AgentLink; use yew::services::storage::{Area, StorageService}; use yewtil::store::{Store, StoreWrapper}; use yew::services::Task; use yew::services::fetch::{Request as HttpRequest, Response as HttpResponse, FetchService}; use yew::format::Jso...
mod interactable_objects; use interactable_objects::*; use std::{fmt::Debug, collections::VecDeque, fs::File, io::{self, Read}}; use specs_derive::Component; use specs::prelude::*; use sdl2::rect::{Rect, Point}; use rand::distributions::{Standard, Distribution}; use rand::Rng; use io::{Lines, BufRead, BufReader}; use ...
use std::borrow::BorrowMut; use crate::core::checkpoint::{Checkpoint, CheckpointHandle, FunctionSnapshotContext}; use crate::core::element::Element; use crate::core::operator::DefaultStreamOperator; use crate::core::runtime::{OperatorId, TaskId}; use crate::core::watermark::{ TimestampAssigner, Watermark, Watermar...
#![allow(incomplete_features)] #![feature(specialization)] use crate::tensors::{Input, Output}; use ndarray::ArrayView; use num_traits::{One, Zero}; use std::{ io::Read, ops::{AddAssign, Mul, MulAssign}, }; #[macro_use] pub extern crate ndarray; pub extern crate npy; extern crate npy_derive; pub mod layers; ...
extern crate rand; use spin::{Spin, SpinConfiguration, IsingSpin, IsingSpinConfiguration}; use exchange_matrix::ExchangeMatrix; use self::rand::Rng; use lattice::{Site, Lattice}; use energy::{calculate_ising_energy, boltzmann_factor, running_total, average, running_total_squared}; use std::thread; use std::sync::mpsc;...
//! Solution to Advent of Code 2019 [Day 20](https://adventofcode.com/2019/day/20). use aoc::geom::{self, Dimensions, Vector2D}; use itertools::Itertools; use std::cmp::Reverse; use std::collections::{BinaryHeap, HashMap, HashSet}; const DAY20_INPUT: &str = include_str!("input/day20_input.txt"); fn main() { prin...
extern crate es_core; extern crate es_data; use self::es_core::optimizer::ScoreLogger; use self::es_data::dataset::types::{MetaType, Metadata}; use crate::l2r::scorer::parameters::*; use crate::l2r::scorer::utils::*; /// Scorer for basic binary indicator /// Can be used to bury or boost based on a field #[derive(Deb...
mod tls; mod base64; mod log { #[inline] pub fn warn(args: std::fmt::Arguments<'_>) { eprintln!("\x1b[1;33mwarning:\x1b[0m {}", args); } #[inline] pub fn error(args: std::fmt::Arguments<'_>) { eprintln!("\x1b[1;31merror:\x1b[0m {}", args); } #[inline] pub fn fatal(args: std::fmt::Arguments<'_>) -> ! { ...
use ansi_term::Colour::Red; use itertools::Itertools; use std::{ env, fmt, fs::File, io::{BufRead, BufReader}, }; #[derive(Clone, Copy, PartialEq, Eq, Debug)] enum BingoGridNumber { Marked(u32), Unmarked(u32), } impl BingoGridNumber { fn mark(&mut self, number: u32) -> bool { match *se...
use makepad_micro_serde::{DeBin, DeBinErr, SerBin}; use { crate::{ delta::{Delta, Operation}, position::Position, range::Range, size::Size, }, std::{fmt, iter, mem, ops::AddAssign}, }; #[derive(Clone, Debug, Eq, Hash, PartialEq, SerBin, DeBin)] pub struct Text { lines: V...
#[derive(Clone, Debug, Hash, PartialEq, Eq)] pub enum ArithmeticKind { Add, Sub, Mul, Div, } #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub enum ComparisonKind { Eq, Ne, Lt, Le, Gt, Ge, } #[derive(Clone, Debug, Hash, PartialEq, Eq)] pub enum Expr { Arithmetic(Box<Expr>, A...
/* * Copyright 2020 Draphar * * 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 writi...
use crate::lang::execution_context::CommandContext; use crate::{ lang::errors::CrushError, lang::{data::table::Row, value::Value, value::ValueType}, }; use std::io::{BufReader, Read, Write}; use crate::lang::command::OutputType::Unknown; use crate::lang::errors::{error, mandate, to_crush_error, CrushResult}; u...
use std::fmt; use std::sync::Arc; use crate::rules::{Grammar, Production, Rule}; #[derive(Debug, Clone, PartialEq)] pub struct LR0 { pub rule: Arc<Rule>, pub pos: usize, } impl LR0 { pub fn new(rule: &Arc<Rule>) -> Self { Self { rule: rule.clone(), pos: 0, } } pub fn is_active(&self) -...
use crate::RecoveryResult; use crate::{error::RecoveryError, RecoveryArgs}; use clap::Parser; use ic_base_types::SubnetId; use ic_types::ReplicaVersion; use slog::{warn, Logger}; use std::net::IpAddr; use strum::IntoEnumIterator; use strum_macros::EnumIter; use crate::{NeuronArgs, Recovery, Step}; #[derive(Debug, Cop...
use cell::{Alignment, Cell, string_width}; use {RowPosition, TableStyle}; use std::cmp::max; use wcwidth::{char_width}; /// A set of table cells pub struct Row<'data> { pub cells: Vec<Cell<'data>>, } impl<'data> Row<'data> { pub fn new<T>(cells: Vec<T>) -> Row<'data> where T: Into<Cell<'data>>, ...
pub const TOPIC_SEPARATOR: char = '/'; pub const MULTI_LEVEL_WILDCARD: char = '#'; pub const MULTI_LEVEL_WILDCARD_STR: &str = "#"; pub const SINGLE_LEVEL_WILDCARD: char = '+'; pub const SINGLE_LEVEL_WILDCARD_STR: &str = "+"; pub const SHARED_SUBSCRIPTION_PREFIX: &str = "$share/"; pub const MAX_TOPIC_LEN_BYTES: usiz...
use async_std::fs::OpenOptions; use async_std::io::prelude::*; use async_std::fs::File; use async_std::io::SeekFrom; use async_std::sync::{channel, Sender}; use async_std::task; use futures::{future::{FutureExt}, select}; use std::path::PathBuf; use glob::glob; #[async_std::main] async fn main() { let mut magn...
use std::fs::File; use std::io::{self, Read}; use std::path::Path; use ihex::{Reader, ReaderError, Record}; use log::*; use thiserror::Error; #[derive(Debug, Error)] pub enum LoadError { #[error("IO error when opening file")] FailedOpen(#[source] io::Error), #[error("IO error when reading file")] Fail...
#![crate_name = "enclave"] #![crate_type = "staticlib"] #![cfg_attr(not(target_env = "sgx"), no_std)] #![cfg_attr(target_env = "sgx", feature(rustc_private))] #![feature(alloc)] extern crate base64; extern crate num; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; #[cfg(not(target...
use crate::util::{parse_lines, read_file_maybe_test, split_parse, BResult, Boom}; use std::str::FromStr; struct CardTemplate<T> where T: Copy + Default, { values: [[T; 5]; 5], } type Card = CardTemplate<i32>; impl<T: Copy + Default> CardTemplate<T> { pub fn new() -> CardTemplate<T> { CardTemplate...
//! based on the proof of concept at ../../src/poc/menu.c // FIXME: has bugs, doesn't work well // probably related to the arrays or the strings... use libnotcurses_sys::{widgets::*, *}; fn main() -> NcResult<()> { let mut nc = unsafe { Nc::new()? }; nc.mice_enable(NcMiceEvents::All)?; let mut demo_item...
use std::collections::BTreeMap; use std::str::FromStr; use num::NumCast; use super::{File, Value}; /// An interface for converting from `Value` variants. pub trait FromValue: Sized { /// Returns `Some` if the conversion was successful, `None` otherwise. fn from_value(value: &Value) -> Option<Self>; } impl F...
use std::collections::HashMap; use std::error::Error; use crate::collectors::helpers::{ collector_preamble, collector_request_get, make_metric, make_metric_preamble, }; pub fn metrics( metric_prefix: &str, name: &str, value: &str, labels: &str, metric_type: &str, help: &str, unit: &str...
use std::convert::TryInto; use std::error::Error; use std::fmt; use std::fs::{self, File}; use std::io::{self, Write}; use std::path::PathBuf; use chrono::NaiveDate; use clap::{clap_app, value_t}; use rustyline::Editor; use import::profile::{DEFAULT_PROFILE_NAME, PROFILE_NAMES}; use import::shape::SmoothMode; use imp...
use crate::{ target_device, gpio, calibration, }; use nb::{self, block}; pub struct ADC { adc: target_device::ADC, } impl ADC { pub fn init(pm: &mut target_device::PM, _clock: crate::clock::AdcClock, adc: target_device::ADC) -> Self { adc.calib.modify(|_, w| { unsafe { ...
//! Advent of Code 2021: Day 22 //! https://adventofcode.com/2021/day/22 use std::collections::HashSet; use std::fs; use std::io; use std::ops::Range; use std::ops::RangeInclusive; use std::path::Path; const INITIALIZATION_RANGE: RangeInclusive<i32> = -50..=50; type Cuboid = [RangeInclusive<i32>; 3]; fn main() { ...
use blake2::digest::{consts::U32, generic_array::GenericArray}; use crate::{ field_elem::FieldElement, CanonicalSer, Evaluation, FriCommitment, FriError, MerkleError, MerkleTree, Polynomial, }; #[derive(Debug)] /// All of the witnesses needed to verify a Fri commitment. pub struct FriOpenings<F>(pub Vec<FriRo...
/// Positional updates are a kind of operation (patch) which is larger than traversals but /// retains temporal information. So, we know when each change happened relative to all other /// changes. /// /// Updates are made up of a series of insert / delete components, each at some position. use smartstring::alias::{St...
use crate::HashCount; use derive_more::Display; use neu_parser::{TextRange, TokenKind}; #[derive(Debug, PartialEq, Clone, Copy, Display)] pub enum Token { #[display(fmt = "error")] Error, #[display(fmt = "` `, `\t`")] Whitespace, #[display(fmt = "`\n`, `\r\n`")] LineEnd, #[display(fmt = ...
// Copyright (c) 2014-2016 <NAME> <<EMAIL>> // // 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...
use std::convert::TryInto; #[aoc(day23, part1)] pub fn part1(input: &str) -> String { #[allow(dead_code)] const EXAMPLE: &str = "389125467"; // let input = EXAMPLE; let mut cups: Vec<u32> = input.chars().map(|x| x.to_digit(10).unwrap()).collect(); let mut current_cup = cups[0]; for _ in 0..100...
use ariadne::{Config, Label, Report, ReportKind, Source}; use serde::{Deserialize, Serialize}; use std::error::Error as StdError; use std::fmt::{self, Debug, Display, Formatter, Write}; use std::ops::{Add, Range}; use crate::parser::PestError; #[derive(Debug, Clone, PartialEq, Copy, Serialize, Deserialize)] pub struct...
/*- * SPDX-License-Identifier: BSD-2-Clause * * BSD 2-Clause License * * Copyright (c) 2021, <NAME>. * All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: * * 1. Redistributions of source cod...
use std::fmt::{ Display, Formatter, Result as FmtResult, }; use std::io::Write; use std::result::Result as StdResult; use std::str::FromStr; use byteorder::{ NetworkEndian, ReadBytesExt, WriteBytesExt, }; use { Error, Result, }; /// [MAC address](https://en.wikipedia.org/wiki/MAC_addr...
extern crate wasm_bindgen; #[macro_use] extern crate log; mod twitter; mod utils; use anyhow::{anyhow, Result}; use chrono::{SecondsFormat, Utc}; use js_sys::Promise; use serde_json::json; use ssi::{ blakesig::hash_public_key, jwk::{Algorithm, JWK}, jws::verify_bytes, one_or_many::OneOrMany, tzke...
/////////////////////////////////////////////////////////////////////////////// // // Copyright 2018-2019 Airalab <<EMAIL>> // // 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 // // ...
#![allow(dead_code)] use crate::nkgc::{SymID, SymIDInt}; use crate::chasm::ASMOp; use crate::sintern::SIntern; use crate::nuke::NkSum; use binwrite::{BinWrite, WriterOption}; use binread::{BinRead, ReadOptions}; use std::{convert::TryInto, io}; /* use crate::{chasm::Lbl, error::Error, nkgc::SymID, nuke::NkSum, r8vm::...
use crate::{AsName, InFile, Name}; use mun_syntax::ast; use mun_syntax::ast::{NameOwner, PathSegmentKind}; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct Path { pub kind: PathKind, pub segments: Vec<Name>, } #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum PathKind { Plain, // `self` is ...
use util::rand; use vec3::Vec3; use ray::Ray; use aabb::AABB; use material::Material; use std::cmp::Ordering::Equal; #[derive(Debug, Clone)] pub struct Intersection { /// The distance along the ray at which the intersection occured pub t: f64, /// The intersecting ray pub ray: Ray, /// The point of...
#![recursion_limit = "128"] #[macro_use] extern crate error_chain; mod database; mod errors; mod game; mod linker; mod settings; use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; use database::Database; use errors::*; use game::Game; use settings::Settings; use std::path::Path; fn get_command_line_matches()...
use bytes::BytesMut; use nix::unistd::{fork, ForkResult}; use std::collections::HashMap; use std::fs::File; use std::io::Write; use std::time::{Duration, SystemTime}; use tokio_util::codec::Encoder; use crate::keys; use memds_proto::memds_api::{ CountRes, MemdsMessage, MemdsMessage_MsgType, OpResult, OpType, TimeR...
use crate::acme::{duration_until_renewal_attempt, order, ACME_TLS_ALPN_NAME}; use crate::persist::{read_if_exist, write}; use async_rustls::rustls::sign::{any_ecdsa_type, CertifiedKey}; use async_rustls::rustls::Certificate as RustlsCertificate; use async_rustls::rustls::{ClientHello, PrivateKey, ResolvesServerCert}; u...
use std::collections::HashMap; use std::fmt; use std::fmt::Display; use std::fmt::Formatter; use std::fs::DirEntry; use std::fs::File; use std::fs::OpenOptions; use std::fs::Permissions; use std::fs::read_dir; use std::io; use std::io::ErrorKind; use std::io::Read; use std::os::unix::fs::PermissionsExt; use std::path::...
//! WebAssembly trap handling, which is built on top of the lower-level //! signalhandling mechanisms. use crate::trap_registry::get_trap_registry; use crate::trap_registry::TrapDescription; use crate::vmcontext::{VMContext, VMFunctionBody}; use cranelift_codegen::ir; use std::cell::Cell; use std::ptr; extern "C" { ...
//! Example 05. Simple scene. //! //! Difficulty: Easy. //! //! This example shows how to load simple scene made in [rusty-editor](https://github.com/mrDIMAS/rusty-editor) //! //! It is almost the same as Example 01, even easier. extern crate rg3d; pub mod shared; use crate::shared::create_camera; use rg3d::scene::b...
// Copyright 2020 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 anyhow::format_err; use async_trait::async_trait; use fidl_fuchsia_media::*; use fidl_fuchsia_sysmem as sysmem; use fuchsia_zircon as zx; use h264_stre...
use crate::{ ast::Ast::{self, *}, grammar::{ FormPat::{self, *}, SynEnv, }, name::*, util::mbe::EnvMBE, }; fn node_names_mentioned(pat: &FormPat) -> Vec<Name> { match *pat { Named(n, ref body) => { let mut res = node_names_mentioned(&*body); res.p...
//! Components for collections of Hardware Accelerators. //! //! Usage //! ----- //! ```rust //! let _mux_otbn = crate::otbn::AccelMuxComponent::new(&peripherals.otbn) //! .finalize(otbn_mux_component_helper!()); //! //! peripherals.otbn.initialise( //! dynamic_deferred_caller //! .r...