text
stringlengths
3.09k
13.9k
//! # Account Filter Pallet //! //! The Account Filter Pallet provides functionality to restrict extrinsic submission to a set of //! allowed accounts. The filtering of accounts is done during the transaction queue validation. #![cfg_attr(not(feature = "std"), no_std)] use parity_scale_codec::{Decode, Encode}; use fr...
use std::collections::HashSet; use std::fs::{create_dir_all, File}; use std::io::{BufRead, BufReader, Write}; use std::path::{Path, PathBuf}; use heed::types::{ByteSlice, Str}; use heed::{CompactionOption, Database, Env, EnvOpenOptions}; use serde::{Deserialize, Serialize}; use uuid::Uuid; use super::error::{IndexRes...
use anyhow::{anyhow, bail, ensure, Error}; use object::elf::*; use object::endian::{BigEndian, Endian, Endianness, LittleEndian}; use object::read::elf::{FileHeader, SectionHeader}; use object::{ File, NativeEndian as NE, Object, ObjectSection, ObjectSymbol, RelocationEncoding, RelocationKind, RelocationTarget,...
use indexmap::IndexSet; use std::ops::{Deref, DerefMut}; use vec::Vec; use common::DebugAbbrevOffset; use constants; use write::{Result, Section, SectionId, Writer}; /// A table of abbreviations that will be stored in a `.debug_abbrev` section. // Requirements: // - values are `Abbreviation` // - insertion returns an...
extern crate cryptopals; use cryptopals::block_ciphers::AESBlockMode; const BS: usize = 16; fn do_cbc_mac(p: &[u8], key: &[u8], iv: &[u8; 16]) -> Vec<u8> { let ct = cryptopals::block_ciphers::aes_encrypt(p, key, Some(*iv), AESBlockMode::CBC); ct[ct.len() - BS..].to_vec() } struct BankServer { key: [u8; ...
#![deny(warnings)] #[macro_use] extern crate clap; extern crate svgbob; use svgbob::Settings; use clap::ArgMatches; use std::error::Error; use std::fs::{self, File}; use std::io::Read; use std::path::{Path, PathBuf}; use std::process::exit; use std::str::FromStr; fn main() { use clap::{App, Arg, SubCommand}; ...
#![allow(dead_code)] use std::fmt; use std::cell::{ RefCell }; use super::Ecs; //use crate::App; //############################################################################# // Store different types of System executors. enum Executor{ Fn{ exe: SysFn }, Tr{ exe: Box< RefCell< System > > }, // Need to store th...
//! Cross-platform mouse, keyboard (and gamepads soon) module. use crate::get_context; use crate::prelude::screen_height; use crate::prelude::screen_width; use crate::Vec2; pub use miniquad::{KeyCode, MouseButton}; #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum TouchPhase { Started, Stationary, Mov...
//! Extends the ```chip::systick``` module. //! See [4.4. System timer, SysTick](http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/Babieigh.html) use bobbin_bits::*; use bobbin_hal::timer::*; use bobbin_mcu::clock::ClockFor; use systick::*; pub fn enable_systick_internal<C: ClockFor<Systick>>(clk:...
#![allow(non_snake_case)] use rand::{thread_rng, Rng}; use bincode; use bincode::rustc_serialize::encode; use bincode::SizeLimit::Infinite; use sha3::{Digest, Keccak256}; use bn::{Fr, Group, G1, AffineG1}; use crate::ciphertext::*; use crate::public::*; use crate::errors::ConversionError; /// Secret key is a scala...
//! Rendering utilities. use std::io::{self, Result as IoResult, Write}; pub use crate::types::Color::{self, Dark as QrDark, Light as QrLight}; use crossterm::style::Stylize; use crate::matrix::Matrix; /// QR barcode terminal renderer intended for terminals. #[derive(Debug, Default)] pub struct RendererTerminal {} ...
/*! Hyphenating iterators over strings. */ use std::borrow::Cow; use std::iter::{Cloned, IntoIterator, ExactSizeIterator}; use std::slice; use std::vec; use hyphenator::*; use extended::*; /// A hyphenating iterator that breaks text into segments delimited by word /// breaks, and marks them with a hyphen where appr...
use error::*; use crate::rwset::builder::TxRwSet; use crate::rwset::key::{self, PubAndHashUpdates}; use crate::statedb::{self, Height, UpdateBatch, VersionedDB}; use silk_proto::*; use std::collections::HashMap; use std::convert::TryFrom; pub struct Validator<V: VersionedDB> { vdb: V, } impl<V: VersionedDB> Vali...
use modules::collation::body::Body; use modules::collation::chunk::Chunk; use modules::collation::collation::Collation; use modules::message::Message; use modules::client_thread::Command; use modules::primitives::{ ShardIdHash, ChunkRootHash, ChunkPeriodHash, NotaryIdHash, ProposerAddress }; use st...
//! \#\[derive(Read, Write, Seek, BufRead)\] for enums. //! //! # Examples //! //! ```rust //! use std::{ //! fs::File, //! io::{self, Write}, //! path::Path, //! }; //! //! use io_enum::*; //! //! #[derive(Read, Write, Seek, BufRead)] //! enum Either<A, B> { //! A(A), //! B(B), //! } //! //! fn fun...
//! Evergreen Project are the top level configuration for an Evergreen landscape. //! //! See Evergreen's //! [documentation](https://github.com/evergreen-ci/evergreen/wiki/Project-Configuration-Files) //! for more details on how a projects configuration. use crate::models::builtin::EvgCommandType; use crate::models::c...
use crate::{Ordering, TestName, TestResult, TestedResult}; use console::style; use std::{ fmt, io::{self, Write}, iter::FromIterator, }; pub struct Progress<O> { output: O, indent: usize, } #[derive(Debug)] pub enum Report { Grouped { reports: Vec<Report>, }, Test { nam...
use std::time::Duration; use tracing::{error, info}; use anyhow::Context; use async_trait::async_trait; use rand::rngs::StdRng; use std::sync::Arc; use tokio::signal; use crate::{ customer::{ cli::Watch, database::{ zkchannels_state::{self, ZkChannelState}, ChannelDetails, ...
use eyre::Result; use glium::glutin::window::CursorIcon; use lyon::math::Angle; use lyon::path::Path; use rgb::RGBA8; use crate::visual::colors::WHITE; use crate::visual::gui::layer::GblTf; use crate::visual::render::atlas::{Atlas, AtlasHandle}; use crate::visual::render::texture::{TexStore, TextureLayer}; use crate::...
use std::{env, io, thread}; use std::io::Write; use std::time::Duration; use crate::locked::Keys; use crate::ossh_privkey::parse_keystr; use crate::proto::{Identity, Message, to_bytes}; use crate::sshsock::SshSock; mod proto; mod prelude; mod api; mod error; mod locked; mod identity; mod cipher; mod sshbuf; mod cip...
extern crate time; use std::env; use std::f32; use std::ops::{Add, Sub, Mul, Div}; use std::fs::File; use std::io::Read; use time::PreciseTime; #[derive(Copy, Clone, Debug)] struct Measure { x: f32, y: f32, } impl Measure { pub fn new(x: f32, y: f32) -> Measure { Measure { x: x, y: y } } ...
use bstr::BString; use std::error; use std::fmt; use std::hint; use crate::string; use crate::sys; use crate::value::Value; use crate::{Artichoke, ValueLike}; #[derive(Debug)] pub struct Exception(Box<dyn RubyException>); impl RubyException for Exception { fn message(&self) -> &[u8] { self.0.message() ...
use core::prelude::*; use core::mem; use collections::vec::Vec; use android::log::{ANDROID_LOG_INFO}; use libc::{c_char, c_int}; use point::ShaderPaintPoint; use point::ShaderPointEvent::{Move, Down, Up, NoEvent}; use glpoint; use glpoint::MotionEventConsumer; use glinit::GLInit; use drawevent::Events; use lua_geom::r...
use super::{get_config, send_event_msg}; use crate::database::{get_event_by_name, insert_event, remove_event}; use crate::discord::{ get_draft_event, schedule_event, send_dm_message, send_draft_event, update_draft_event, }; use crate::INTERESTED_EMOJI; use chrono::offset::TimeZone; use chrono::{Datelike, NaiveDateT...
use core::{alloc::Layout, convert::TryInto}; use rand::{ distributions::{Distribution, Uniform}, seq::IteratorRandom, }; use rand_chacha::ChaCha20Rng; use usize_conversions::IntoUsize; use x86_64::{ structures::paging::{Page, PageTableIndex, Size4KiB}, PhysAddr, VirtAddr, }; use xmas_elf::program::Progr...
#![allow(non_snake_case)] use std::mem::ManuallyDrop; use crate::aliases::WinResult; use crate::com::iunknown::{ComPtr, IUnknownT, IUnknownVT}; use crate::com::shell::ishellitem::IShellItem; use crate::ffi::{HRESULT, PCVOID, PVOID}; use crate::privs::hr_to_winresult; /// [`IShellItemArray`](crate::shell::I...
//! Vote program //! Receive and processes votes from validators use crate::id; use crate::vote_state::{self, Vote, VoteState}; use bincode::deserialize; use log::*; use serde_derive::{Deserialize, Serialize}; use solana_metrics::datapoint_warn; use solana_sdk::account::KeyedAccount; use solana_sdk::instruction::{Acco...
/* artifact: the requirements tracking tool made for developers * Copyright (C) 2018 <NAME> <@vitiral, <EMAIL>> * * The source code is Licensed under either of * * * Apache License, Version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or * http://www.apache.org/licenses/LICENSE-2.0) * * MIT license ([LICENSE-MIT](L...
// 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 to those terms. use crate::constant...
use regex::Regex; use std::collections::HashMap; pub mod converter { use std::iter::FromIterator; fn convert_oldish_char(c: char) -> Option<char> { match c { '零' => Some('〇'), '壱' => Some('一'), '壹' => Some('一'), '弐' => Some('二'), '貳' => Some('...
use crate::error::{Error, MigraResult}; use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use std::{env, fs}; //===========================================================================// // Internal Config Utils / Macros // //============================...
// The Computer Language Benchmarks Game // https://salsa.debian.org/benchmarksgame-team/benchmarksgame/ // // Contributed by <NAME> // Converted from C to Rust by <NAME> // // Adapted to 32bits by kubkon. use std::io::Write; use std::ops::{Add, Mul, Sub}; #[allow(non_camel_case_types)] #[derive(Clone, Copy)] struct ...
use crate::{ endpoint::BoxEndpoint, error::{NotFoundError, RouteError}, http::header, route::{check_result, internal::trie::Trie}, Endpoint, EndpointExt, IntoEndpoint, Request, Response, Result, }; /// Routing object for `HOST` header /// /// # Errors /// /// - [`NotFoundError`] /// /// # Example /...
//! The chat service consumer. //! Configuration is performed via the public configure function. This is the only public exposure. //! //! The theory of operation is that this component cooperates with other components to form a chat service. //! This is the consumer component, which is wired between the coordinator an...
// Copyright 2018 The Grin Developers // Modifications Copyright 2019 The Gotts Developers // // 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...
// Copyright 2017-2019 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) a...
use std::convert::TryFrom; use ::tokio::net::TcpStream; use ::tokio::prelude::*; use ::tokio::sync::mpsc::{self, Receiver}; use crate::num_traits::FromPrimitive; use super::protocol::*; const HS_IN: &'static [u8] = b"Vivat Sicher, Rock'n'Roll forever!!!"; const HS_OUT: &'static [u8] = b"Enter, my son, please..."; ...
use core::future::Future; use core::pin::Pin; use core::sync::atomic::{AtomicUsize, Ordering}; use core::time::Duration; use crate::builder::{Builder, BuilderFnContainer, Config}; use crate::context::ContextMessage; use crate::interval::IntervalFutureSet; use crate::receiver::Receiver; use crate::sender::Sender; use c...
use std::io; pub struct TeXFileReader<T: io::Read> { reader: T, } const FIXNUM_SIGN_MASK: u32 = 0b1000_0000_0000_0000_0000_0000_0000_0000; const FIXNUM_INT_MASK: u32 = 0b0111_1111_1111_0000_0000_0000_0000_0000; const FIXNUM_FRAC_MASK: u32 = 0b0000_0000_0000_1111_1111_1111_1111_1111; impl<T: io::Read> TeXFileRead...
use grammar::CmpOperator; use std::i64; /// An internal representation of something that can be compared /// /// Only numbers and strings can be compared for now. /// /// Use `into()` conversion to make the value. #[derive(Debug)] // TODO(tailhook) make normal debug pub struct Comparable<'a>(ComparableInner<'a>); #...
use crate::util::{RandomSignal, SinSignal, StatefulList, TabsState}; use std::error::Error; use std::sync::mpsc; use std::time::{Duration, Instant}; use clipboard::{ClipboardContext, ClipboardProvider}; pub struct Signal<S: Iterator> { source: S, pub points: Vec<S::Item>, tick_rate: usize, } impl<S> Sig...
use groestlcoin::{ hashes::{hex::ToHex, Hash}, TxMerkleNode, Txid, }; pub(crate) struct Proof { proof: Vec<TxMerkleNode>, position: usize, } impl Proof { pub(crate) fn create(txids: &[Txid], position: usize) -> Self { assert!(position < txids.len()); let mut offset = position; ...
use std::f32::consts::PI; use bevy::{log, prelude::*, sprite::TextureAtlas}; use hex2d::{Coordinate, Spacing}; use rand::{thread_rng, Rng}; use crate::{ daytime::TickEvent, field::SIZE, overwait_particles::StartOverwaitEmitter, ui::ChangeMoneyEvent, }; pub struct Worker { pub home: Coordinate, pub coffee...
use std::collections::VecDeque; use std::iter::FromIterator; use crate::behaviour::{CheckTaskEvent, Task}; use crate::buildings::spawn_stockpile; use crate::hexagon::HexagonBuilder; use crate::plants::Tree; use crate::residence::CreatureJoinedVillageEvent; use crate::tree_cutting::TaskQue; use crate::village::LivingSp...
//! Pandoc LaTeX acronym filter //! //! This filter translates certain codes in plain markdown text (such as `(+pod)`) //! into a LaTeX acronym use (`\ac{pod}`). The process is independent from the //! actual acronym vocabulary, but the full document should provide it for the //! final compilation to work as intended....
use crate::{ModularUnaryOps, DivExact}; /// Pre-computation for fast divisibility check. /// /// This struct stores the modular inverse of a divisor, and a limit for divisibility check. /// See <https://math.stackexchange.com/a/1251328> for the explanation of the trick #[derive(Debug, Clone, Copy)] pub struct PreInv...
// 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 in the LICENSE-APACHE file or at: // https://www.apache.org/licenses/LICENSE-2.0 //! Simple calculator example (lots of buttons, grid layout...
/* * Copyright (c) 2016-2018 Boucher, Antoni <<EMAIL>> * * Permission is hereby granted, free of charge, to any person obtaining a copy of * this software and associated documentation files (the "Software"), to deal in * the Software without restriction, including without limitation the rights to * use, copy, mod...
use axum::{ extract::{Extension, Form, Query}, http::{HeaderMap, StatusCode}, response::Html, routing, AddExtensionLayer, Router, }; use redis::AsyncCommands; use serde::{Deserialize, Serialize}; use uuid::Uuid; const SESSION_ID_COOKIE_NAME: &str = "axum_rs_session_id"; const SESSION_KEY_PREFIX: &str =...
use crate::{ Msbt, traits::{CalculatesSize, Updates}, updater::Updater, }; use super::Section; use std::{ borrow::Cow, ptr::NonNull, }; #[derive(Debug)] pub struct Lbl1 { pub(crate) msbt: NonNull<Msbt>, pub(crate) section: Section, pub(crate) group_count: u32, pub(crate) groups: Vec<Group>, pub(cr...
// Copyright 2021 <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 writi...
#![no_std] pub use atsamd_hal as hal; #[cfg(feature = "rt")] pub use cortex_m_rt::entry; use hal::clock::GenericClockController; pub use hal::ehal; pub use hal::pac; use hal::sercom::{ v2::{uart, Sercom0, Sercom4}, I2CMaster0, }; use hal::time::Hertz; #[cfg(feature = "usb")] use hal::usb::{usb_device::bus::Usb...
use std::io; use crate::{ block::MAX_BLOCK_BYTES, primitives::Groth16Proof, serialization::{ serde_helpers, SerializationError, TrustedPreallocate, ZcashDeserialize, ZcashSerialize, }, }; use super::{commitment, keys, note}; /// A _Output Description_, as described in [protocol specification ...
use crate::{impl_helper::*, impl_local_shared_both, prelude::*}; /// An Observable that combines from two other two Observables. /// /// This struct is created by the with_latest_from method on /// [Observable](Observable::with_latest_from). See its documentation for more. #[derive(Clone)] pub struct WithLatestFromOp<...
use crate::alignments::*; use crate::models::{AlignmentFactory, BasedAlignedDim, DimAlignFactory, ChainAlignFactory, Representation}; use crate::readers::RAReader; use fnv::FnvHashMap; use petgraph::prelude::*; use petgraph::visit::{depth_first_search, Control, DfsEvent}; pub struct BasicAlignmentInference<'a> { rep...
use std::collections::LinkedList; use std::fs; use std::path::{Path, PathBuf}; use std::process::Command; /// Configurable compiler path. By default it will use the downloaded executeable or assume it is in PATH. pub static mut COMPILER_PATH: Option<PathBuf> = None; pub static mut GENERATED_PREFIX: Option<String> = No...
use crate::intcode::{self, State}; use std::cmp::max; use std::collections::{HashMap, HashSet, VecDeque}; use std::convert::{TryFrom, TryInto}; pub fn main() { let program = intcode::read_program("data/day15.txt").expect("failed to read program"); let mut droid = Droid::new(&program); let map = explore(&m...
use crate::librapay_instruction; use language_e2e_tests::account::AccountResource; use log::*; use solana_move_loader_api::account_state::{pubkey_to_address, LibraAccountState}; use solana_move_loader_api::data_store::DataStore; use solana_sdk::client::Client; use solana_sdk::hash::Hash; use solana_sdk::pubkey::Pubkey;...
use std::mem; use std::ptr::null_mut; use std::{ffi::c_void}; use winapi::shared::minwindef::*; use winapi::shared::windef::*; use winapi::um::libloaderapi::GetModuleHandleW; use winapi::um::wingdi::*; use winapi::um::winuser::*; use crate::system::traits::{Fabric, SystemDrawableWindow}; use crate::traits::{w_str}; ...
struct Point { x: i32, y: i32, } fn main() { if_let(); while_let(); match_var(); deconstruction_struct(); deconstruction_enum(); } fn if_let() { let favoriter_color: Option<&str> = None; let is_tuesday = false; let age: Result<u8, _> = "34".parse(); if let Some(color) = fa...
#![no_std] #![no_main] #![feature(alloc_error_handler)] extern crate alloc; mod player; use cortex_m::asm; use cortex_m_rt::entry; use panic_semihosting as _; use stm32f1xx_hal::{delay::Delay, pac, prelude::*, serial::{Config, Serial}}; //use cortex_m_semihosting::hprintln; //半主机功能 use alloc::string::String; use allo...
// Copyright 2020 Hyperledger Ursa Contributors // // 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 la...
#[macro_use] extern crate clap; use clap::{App, Arg}; use hxgm30noise::common::{Opts, Resolution}; use hxgm30noise::gen::caves; use log; use twyg; fn main() { // Default values ///////////////////////////////////////// let default_opts: Opts = Opts { log_level: &String::from("debug"), output: ...
use std::hint::unreachable_unchecked; use std::sync::mpsc::{channel, Receiver}; use image::Bgra; use thiserror::Error; use windows::core::{IInspectable, Interface}; use windows::Foundation::TypedEventHandler; use windows::Graphics::Capture::{ Direct3D11CaptureFramePool, GraphicsCaptureItem, GraphicsCaptureSession,...
use std::io; use std::thread; use std::time::Duration; use std::sync::{atomic, Arc, Mutex}; use slab::Slab; use poll::{Events, Token}; use {EXIT_EVENTUALLY, EXIT_IMMEDIATE, NO_EXIT}; use {Listener, PoolBuilder}; pub(crate) fn worker_main<L, C, S, R, E>( name_pfx: &str, i: usize, pool: &PoolBuilder<L, C, S...
use crate::math::{ field, fft, polynom }; use crate::processor::opcodes; use crate::stark::{ hash_acc::STATE_WIDTH as ACC_STATE_WIDTH }; use super::{ TraceState, decoder, stack, NUM_OP_BITS }; // TYPES AND INTERFACES // ================================================================================================ pu...
//! Receives strings by a message channel, queues them and displays them //! one by one in popup alert windows. use crate::config::CONFIG_PATH; use crate::VERSION; use lazy_static::lazy_static; use msgbox::IconType; use std::env; use std::path::PathBuf; use std::sync::mpsc::sync_channel; use std::sync::mpsc::Receiver;...
#![feature(conservative_impl_trait)] #![allow(unused_imports, dead_code)] #[macro_use] extern crate futures; #[macro_use] extern crate tokio_core; extern crate postgres_protocol; extern crate tk_bufstream; extern crate linear_map; #[macro_use] extern crate log; extern crate fallible_iterator; use futures::{Async, Bo...
use embedded_hal_mock::i2c::{Mock as I2cMock, Transaction as I2cTrans}; use veml6075::{ Calibration, DynamicSetting as DS, IntegrationTime as IT, Measurement, Mode, Veml6075, }; const DEVICE_ADDRESS: u8 = 0x10; struct Register; impl Register { const CONFIG: u8 = 0x00; const UVA: u8 = 0x07; const UVB: u...
//! Short ID implementation. //! A 6-byte transaction ID, specified for a given nonce and a context (u64-sized slice). //! //! 1. Initialize [SipHash-2-4](https://131002.net/siphash/) with k0 set to nonce, k1 set to the little-endian u64 read from the context string. //! 2. Feed transaction ID as an input to SipHash. /...
#![allow(clippy::type_repetition_in_bounds)] use crate::ids::FunctionId; use crate::input::{SourceRoot, SourceRootId}; use crate::item_tree::{self, ItemTree}; use crate::name_resolution::Namespace; use crate::ty::lower::LowerBatchResult; use crate::ty::{CallableDef, FnSig, Ty, TypableDef}; use crate::{ adt::{Struc...
use ccl::dhashmap::DHashMap; use game_tree::{GameTreeNode, NodeState}; use ordered_float::OrderedFloat; use rand::seq::{IteratorRandom, SliceRandom}; use rayon::prelude::*; use std::collections::hash_map::DefaultHasher; use std::hash::Hasher; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::Arc; use std::ti...
//! TODO: Doc use std::cell::RefCell; use std::rc::Rc; use wayland_server::protocol::wl_keyboard::KeymapFormat; use wayland_server::protocol::wl_seat::WlSeat; use wayland_server::protocol::wl_surface::WlSurface; use wayland_server::{Client, Display, Filter, Global, Main}; use crate::backend::input::KeyState; use cra...
use futures::{future::join_all, Future}; use ilp_node::InterledgerNode; use reqwest::r#async::Client; use serde_json::{self, json}; use tokio::runtime::Builder as RuntimeBuilder; mod redis_helpers; use redis_helpers::*; mod test_helpers; use test_helpers::*; #[test] fn prometheus() { // Nodes 1 and 2 are peers, ...
/* AUTO GENERATED FILE DO NOT EDIT codegen/elder_dragon_quicktype.py */ use serde::{Serialize, Deserialize}; extern crate serde_json; use self::serde_json::Error; pub fn serialize(json: &str) -> Result<ItemJson,Error>{ serde_json::from_str(json) } use std::collections::HashMap; #[deriv...
use std::collections::HashMap; use std::sync::{Arc, Mutex}; use std::time::SystemTime; use crate::network::server::Handle as ServerHandle; use crate::blockchain::Blockchain; use crate::signedtrans::{generate_random_signedtrans, SignedTrans}; use crate::network::message::Message; use crate::mempool::Mempool; use log::...
use embedded_graphics::{ mono_font::{ascii::FONT_6X10, MonoTextStyle, MonoTextStyleBuilder}, prelude::*, text::Text, }; // 64 character long string static FILLER_STRING: &str = " "; pub struct Terminal<'f, C, S> { config: TerminalConfig<'f, C,...
// Copyright 2022 pyke.io // 2019-2021 Tauri Programme within The Commons Conservancy // [https://tauri.studio/] // // 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...
use super::executor::Executor; use super::task::{Task, TaskError, TaskType}; use std::future::Future; use std::sync::atomic::{AtomicBool, AtomicIsize, AtomicUsize, Ordering}; use std::sync::mpsc::{Receiver, Sender}; use std::sync::{Arc, Mutex}; use std::thread::JoinHandle; pub type WorkerResult<T> = Result<T, TaskErr...
use crate::{ vector::Vector, error, enums::Axis }; #[derive(Debug, Clone)] pub struct Matrix { m: Vec<f64> } impl Matrix { pub fn default() -> Matrix { Matrix{ m:vec![0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, ...
// Copyright <NAME>, Inc. and contributors. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the A...
use std::hash::Hash; use std::fmt::{self, Debug}; use bittyset::BitSet; use indexmap::IndexSet; use super::dfa_builder::DfaBuilder; use crate::{Map, Set}; #[derive(Debug, Clone)] pub struct Dfa<A, V> { pub start: u32, pub transitions: Map<(State, A), State>, pub accept_states: Map<State, V>, } #[derive(PartialE...
use crate::dag::Dag; use crate::dag_parsing::{DagConfigParser, YamlDagConfigParser}; use crate::errors::YoshiError; use crate::runners::string_to_runner_type; use crate::task_definition::{string_to_definition_type, DefinitionArguments}; use crate::task_node::TaskNode; use crate::type_definition::{FilePath, NodeId}; use...
use crate::api::auth::TokenUserId; use crate::db::models; use crate::db::DbConn; use crate::discord::management::check_guild_user; use crate::discord::management::PermissionError; use crate::discord::player; use crate::discord::player::PlayError as DiscordPlayError; use crate::discord::recorder::Recorder; use crate::di...
mod renderer_wrapper; use std::{ sync::{ atomic::{AtomicBool, Ordering}, Arc, }, time::Duration, }; use crate::manager::backend::Renderer; use cpal::{ traits::{DeviceTrait, HostTrait, StreamTrait}, Device, Stream, StreamConfig, StreamError, }; use ringbuf::{Consumer, RingBuffer}; use super::super::Error; u...
use std::fs::File; use std::io::prelude::*; use std::io::BufReader; use std::env; use std::iter::FromIterator; fn swap_position(password: &mut Vec<char>, a: usize, b: usize) { password.swap(a, b); } fn swap_letter(password: &mut Vec<char>, a: char, b: char) { for c in password.iter_mut() { if *c == a ...
// This is for parsing lemmings LVL files. // https://www.camanis.net/lemmings/files/docs/lemmings_lvl_file_format.txt use std::io::{Error, ErrorKind, Result}; use std::slice::Iter; use lemmings::models::*; impl ObjectModifier { fn from_lvl(lvl: u8) -> ObjectModifier { if lvl == 0x80 { return...
// Copyright (C) 2018 Red Hat, Inc. // // Permission is hereby granted, free of charge, to any // person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the // Software without restriction, including without // limitation the rights to use, copy, modify, merge, // pu...
use std::ops::Div; use hex::{decode, encode}; use log::warn; use monero::Block; use monero::consensus::deserialize; use monero::cryptonote::hash::Hashable; use num_bigint::{BigInt, Sign}; use sha3::{Digest, Keccak256}; use crate::structs::Config; pub fn keccak(input: Vec<u8>, size: usize) -> Vec<u8> { assert_eq!...
mod testutil; use std::io::{Cursor, Seek, Write}; use parser::{csv, ErrorThreshold, Input, ParseConfig}; use testutil::run_test; #[test] fn no_tolerance_for_errors_test() { let mut csv = EphemeralCsv::default(); let config = csv.parse_config(None); csv.write_rows(1, &|_i| "n,n_squared".to_owned()); ...
use crate::config::SiteConfig; use crate::markdown::MarkdownRenderer; use crate::page::{Page, PageMetadata}; use anyhow::{Context, Result}; use serde_derive::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use tera::Tera; pub struct BuildContext { pub output_dir: PathBuf, pub content_dir: PathBuf, ...
use tui::buffer::Buffer; use tui::layout::{Constraint, Direction, Layout, Rect}; use tui::style::{Modifier, Style}; use tui::text::{Span, Text}; use tui::widgets::{Block, BorderType, Borders, List, ListItem, ListState, StatefulWidget}; use crate::graph::JackGraph; use crate::model::ItemKey; #[derive(Debug, Default)] ...
use std::cmp::Ordering; use std::collections::hash_map::Entry; use std::collections::BinaryHeap; use std::collections::HashMap; use std::collections::VecDeque; use std::hash::Hash; // A trait for structures that represent unweighted graphs // with nodes of type `N`. pub trait UnweightedGraph<N> where N: Eq + Hash ...
#![allow(dead_code)] use crate::errors::*; use std::collections::HashMap; use reqwest::Response; use std::io::Read; use std::io::prelude::*; use std::fs::File; use regex::Regex; use super::UrlContentProvider; pub struct Youtube { /// The 11-character video id pub id: String, /// The duration of the stream...
#![allow(missing_docs)] use env; use std::path::PathBuf; use std::str::FromStr; /// Appveyor CI /// /// # References /// /// - <https://docs.travis-ci.com/user/environment-variables/#Default-Environment-Variables> /// - <https://github.com/codecov/codecov-bash/blob/0c5cebde9e0c640c8f737a843309df15a9509e26/codecov#L65...
use std::convert::TryInto; use std::fmt; use serde::de::{Deserializer, Error, Unexpected, Visitor}; pub fn deserialize<'de, D>(deserializer: D) -> Result<Option<u64>, D::Error> where D: Deserializer<'de>, { deserializer.deserialize_any(HumanNumberVisitor) } struct HumanNumberVisitor; impl<'de> Visitor<'de> ...
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering}; use std::sync::Arc; use anyhow::Result; use rand::Rng; use ton_api::{ton, IntoBoxed}; use super::encoder::*; use super::TransferId; use crate::utils::*; pub struct OutgoingTransfer<'a> { data: &'a [u8], buffer: Vec<u8>, encoder: Option<RaptorQEnco...
use hacspec_lib::*; const U32_BITS: usize = 4 * 8; const N_QUEUES: usize = 20; const N_THREADS: usize = 30; const SENTINEL: u8 = 0xFFu8; #[derive(Clone, Copy, Debug)] pub struct RunqueueId(u8); #[derive(Clone, Copy, Debug)] pub struct ThreadId(u8); public_bytes!(Tail, N_QUEUES); public_bytes!(NextIds, N_THREADS); #...
use crate::{PrivateKey, PrivateKeyGenerator, PublicKey, Seed, Signature}; use rand::rngs::OsRng; use std::convert::Infallible; pub struct Ed25519Seed([i8; 32]); #[derive(Default)] pub struct Ed25519PrivateKeyGeneratorBuilder {} pub struct Ed25519PrivateKeyGenerator {} pub struct Ed25519PrivateKey { private_key:...
use std::convert::TryInto; use std::net::TcpStream; use std::str::FromStr; use failure::{format_err, Context, Error, ResultExt}; use futures::Future; use hyper::client::connect::{Connect, Destination}; use hyper::Uri; use hyper_proxy::{Intercept, Proxy, ProxyConnector}; use hyper_tls::HttpsConnector; use typed_headers...