text
stringlengths
3.09k
13.9k
use std::cmp::Ord; use ironsea_index::IndexedDestructured; use serde::Deserialize; use serde::Serialize; use super::space::Coordinate; use super::space::Position; use super::space::Shape; use super::IterPositions; #[derive(Clone, Debug, Hash)] pub struct SpaceSetObject { space_id: String, position: Position,...
// https://github.com/async-rs/async-std extern crate console; extern crate dotenv; // extern crate serde; // extern crate serde_json; extern crate lettre; // https://docs.rs/mime/0.3.13/mime/index.html extern crate mime; extern crate uuid; use dotenv::dotenv; use std::env; use console::Style; use std::fs; use lettre...
// Copyright 2017 Databricks, Inc. // 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] #![no_main] #![feature(asm)] use panic_halt as _; use rtt_target::{rprintln, rtt_init_print}; use cortex_m_rt::entry; use mos6502::Cpu; use pet::Ram; mod keyboard; mod storage; mod video; use storage::FlashStorage; use stm32f1xx_hal::spi::{Mode, Phase, Polarity, Spi}; use stm32f1xx_hal::{pac, prelude::*...
// Copyright 2021 lowRISC 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 // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or ag...
use core::mem; use std::mem::ManuallyDrop; use gfx_hal::{ adapter::PhysicalDevice, Backend, buffer, device::Device, memory::{Properties, Segment}, }; use gfx_hal::command::CommandBuffer; pub trait BufferData { fn layout() -> Vec<u32>; } pub struct Buffer<B: Backend, T: BufferData> { data:...
//! This module contains a virtual filesystem backed by a SLF file. #![allow(dead_code)] use std::convert::TryFrom; use std::fmt; use std::io; use std::io::{Seek, SeekFrom}; use std::path::{Path, PathBuf}; use std::sync::{Arc, Mutex}; use crate::file_formats::slf::{SlfEntryState, SlfHeader}; use crate::fs::File; use ...
use super::header::BlockHeader; use crate::{ consensus::difficulty::{canonical_difficulty, BlockDifficultyBombData}, models::{switch_is_active, BlockNumber, ChainSpec, SealVerificationParams, EMPTY_LIST_HASH}, }; use std::fmt::Debug; pub trait HeaderSliceVerifier: Send + Sync + Debug { fn verify_link( ...
use crate::pb::*; use std::convert::{TryFrom, TryInto}; use tract_core::internal::*; use tract_core::*; impl TryFrom<TensorProto_DataType> for DatumType { type Error = TractError; fn try_from(t: TensorProto_DataType) -> TractResult<DatumType> { use self::TensorProto_DataType::*; match t { ...
//////////////////////////////////////////////////////////////////////////////// // // Copyright (c) 2018, the Perspective Authors. // // This file is part of the Perspective library, distributed under the terms // of the Apache License 2.0. The full license can be found in the LICENSE // file. extern crate perspecti...
use std::env; use std::ops::AddAssign; use std::sync::{Arc, RwLock}; use ec_gpu_gen::multiexp::MultiexpKernel; use ec_gpu_gen::multiexp_cpu::{multiexp_cpu, FullDensity}; use ec_gpu_gen::rust_gpu_tools::Device; use ec_gpu_gen::threadpool::Worker; use ec_gpu_gen::EcResult; use ff::PrimeField; use group::{prime::PrimeCur...
#![allow(dead_code)] extern crate rand; extern crate regex; extern crate pancurses; use pancurses::{Window, Input}; mod byte; mod dungeon; mod fov; mod geometry; mod grid; mod item; mod log; mod memory; mod monster; mod player; mod speech; mod spell; mod sprite; mod tile; mod timer; mod util; mod view; mod world; us...
use super::controls; use super::super::model::*; use super::super::standard_tools::*; use flo_ui::*; use flo_binding::*; use flo_animation::*; use desync::*; use futures::*; use futures::executor; use futures::executor::Spawn; use std::sync::*; use std::collections::HashSet; /// /// The menu controller for the sele...
// Standard Library Imports use std::error::Error; use std::iter::Iterator; use std::result::Result; use core::str::Split; use std::fmt; // External imports use crate::config::{ConfigOptions, ConfigOption}; use crate::logger::Logger; // Command modules mod cd; mod config; mod download; pub mod elevate; pub mod getprivs...
use super::{OpenxrSwapchain, XrContext}; use alvr_common::{glam::UVec2, prelude::*}; use alvr_graphics::{ ash::{ self, vk::{self, Handle}, }, convert::{ self, GraphicsContextVulkanInitDesc, SwapchainCreateData, SwapchainCreateInfo, TextureType, TARGET_VULKAN_VERSION, }, ...
extern crate image; extern crate hibitset; extern crate gilrs; extern crate winit; extern crate specs; extern crate nphysics2d; extern crate ncollide2d; extern crate alga; extern crate fnv; #[macro_use] extern crate derive_deref; #[macro_use] extern crate vulkano; #[macro_use] extern crate vulkano_shader_derive; extern...
// Copyright (C) 2020 <NAME>. Distributed under the zlib license. use parity_scale_codec::{Encode, OptionBool}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use std::{ error::Error, fmt::Debug, }; fn roundtrips<T>(v: &T) -> Result<(), Box<dyn Error>> where T: Debug + Serialize + DeserializeO...
use alloc::boxed::Box; use core::cell::UnsafeCell; use core::fmt; use core::marker::PhantomData; use core::ptr; use std::panic::{RefUnwindSafe, UnwindSafe}; use super::{Id, Shared}; use crate::ffi; use crate::Message; /// A pointer type for a weak reference to an Objective-C reference counted /// object. /// /// Allo...
use std::collections::HashMap; use std::fs; use std::iter::Iterator; use std::path::PathBuf; use log::info; use tantivy::directory::MmapDirectory; use tantivy::schema::Schema; use tantivy::Index; use crate::handle::{IndexHandle, LocalIndex}; use crate::query::Request; use crate::results::*; use crate::settings::Setti...
//! The `compute_leader_finality_service` module implements the tools necessary //! to generate a thread which regularly calculates the last finality times //! observed by the leader use bank::Bank; use service::Service; use solana_metrics::{influxdb, submit}; use solana_sdk::timing; use std::result; use std::sync::a...
#![allow(warnings)] use super::{constants, hit::DigestTypes}; use rand::{self, Rng}; use rand_chacha::rand_core::{CryptoRng, RngCore, SeedableRng}; use rand_chacha::ChaChaRng; pub struct PuzzleSolver<'a, u8: 'a>(pub &'a mut [u8], pub &'a mut [u8]); impl<'a> PuzzleSolver<'a, u8> { pub fn ltrunc(&mut self, bytestr...
//! Module to read the list of test suites from disk. use super::{Harness, Locale, Phase, Test, TestSuite, IGNORED}; use fxhash::FxHashMap; use serde::Deserialize; use std::{fs, io, path::Path, str::FromStr}; /// Representation of the YAML metadata in Test262 tests. #[derive(Debug, Clone, Deserialize)] pub(super) str...
use crate::actor::{Hub, Mail}; use crate::db; use crate::dev::*; use actix::prelude::*; use actix_web::web; use handlebars::{Handlebars, RenderError}; use ignore::WalkBuilder; use r2d2_postgres::postgres::NoTls; use r2d2_postgres::PostgresConnectionManager; use serde::Serialize; use std::collections::HashMap; use std::...
//! Perform random operations on fastq files, using unix streaming. //! Secure your analysis with Fasten! //! # Synopsis //! ## read metrics //! ```text //! //! $ cat testdata/R1.fastq testdata/R2.fastq | \ //! fasten_shuffle | fasten_metrics | column -t //! totalLength numReads avgReadLength avgQual //! 800 ...
/*! `easy_flag` is a simple command line flag parser. This library contains functions for handling command line flags. # Example ```rust use easy_flag::FlagSet; fn main() -> Result<(), String>{ let mut help = false; let mut my_flag = String::from("default value"); let args: Vec<String> = std::env::args(...
use super::*; use std::collections::VecDeque; use std::io; use std::net::TcpListener as StdTcpListener; use std::pin::Pin; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpStream; use tokio::sync::{mpsc, oneshot}; use tokio::task::JoinH...
//! Main class for performing Dijkstra's algorithm. //! //! The idea of this class is to process a graph and yield all its elements in //! order of distance. //! //! # Examples //! ``` //! use graph::Graph; //! //The actual way to create such an iterator is through the 'GraphTrait' trait; //! use graph::GraphTrait; //!...
use alloc::BTreeMap; use core::cell::RefCell; use arch::paging::{ActivePageTable,InactivePageTable}; use super::*; #[derive(Debug)] pub struct Processor { active_table: RefCell<ActivePageTable>, procs: BTreeMap<Pid, Process>, current_pid: Pid, } impl Processor { pub fn new(act: ActivePageTable) -> Sel...
use cumulus_primitives_core::ParaId; use sc_service::ChainType; use arctic_runtime::{ wasm_binary_unwrap, AccountId,AirdropConfig, AuraConfig, AuraId, Balance, BalancesConfig, CollatorSelectionConfig, EVMConfig, GenesisConfig, ParachainInfoConfig, CouncilConfig, SessionConfig, Signature, SudoConfig, SystemC...
//! Entity reference. //! //! See [`EntityRef`] in the XML spec. //! //! [`EntityRef`]: https://www.w3.org/TR/REC-xml/#NT-EntityRef use std::convert::TryFrom; use crate::{ name::plain::{parse_raw as parse_name, ParseResult as NameResult}, parser::{Partial, PartialMapWithStr}, reference::{ParseResult, Refe...
#![cfg_attr(not(feature = "std"), no_std)] use crate::evm::EvmAddress; use bstringify::bstringify; use codec::{Decode, Encode}; use sp_runtime::RuntimeDebug; use sp_std::{ convert::{Into, TryFrom, TryInto}, prelude::*, }; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; macro_rules! create_currency_id ...
//! Common Go specific definitions without dependencies to any file format use std::fmt::{Debug, Formatter, Display}; use std::fmt; use crate::go::GoMove::PlaceStone; #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum PlayerColor { Black, White, } #[derive(Clone, Copy, Eq, PartialEq)] pub struct BoardCoord...
//! Oneof-related codegen functions. use code_writer::CodeWriter; use field::FieldElem; use field::FieldGen; use message::MessageGen; use protobuf::descriptor::field_descriptor_proto; use scope::{OneofVariantWithContext, FieldWithContext}; use scope::OneofWithContext; use scope::WithScope; use rust_types_values::RustT...
use core::fmt::{Debug, Display, Formatter}; use core::marker::PhantomData; use core::result::Result; use std::cell::RefCell; use std::rc::Rc; extern crate alloc; use alloc::vec::Vec; use crate::event_bus; use crate::timer; #[derive(Debug)] pub enum Error<E, T> where E: Display + Debug, T: Display + Debug, { ...
use std::io::Write; use std::path::Path; use std::process::Command; use crate::{ lint_message::LintMessage, log_utils::{ensure_output, log_files}, path::{path_relative_from, AbsPath}, }; use anyhow::{anyhow, bail, ensure, Context, Result}; use glob::{MatchOptions, Pattern}; use log::{debug, info}; pub str...
use crate::midi::MidiMessage; use std::num::NonZeroU16; use std::time::Duration; /// All instructions the MIDI event track VM can run. #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub enum TrackEvent { /// Outputs a `MidiMessage` along the output port. SendMessage{ message : MidiMessage, ...
//! Serde Integration for InfluxDB. Provides deserialization of query returns. //! //! When querying multiple series in the same query (e.g. with a regex query), it might be desirable to flat map //! the resulting series into a single `Vec` like so. The example assumes, that there are weather readings in multiple //! s...
extern crate heck; extern crate json; extern crate reqwest; use heck::TitleCase; use regex::Regex; use serde_json::Value; use serenity::prelude::*; use serenity::model::prelude::*; use serenity::framework::standard::{ CommandError, CommandResult, macros::command, }; use serenity::model::id::ChannelId; ...
#[macro_use] extern crate lazy_static; use crate::day01::day1_part2; mod day01; fn day01() { assert_eq!(4943994, day1_part2()); } use crate::day02::{day2_part1, day2_part2}; mod day02; fn day02() { assert_eq!(3516593, day2_part1()); assert_eq!(7749, day2_part2()); } use crate::day03::{day3_part1, day3_pa...
use crate::primitive::{Primitive, Point, Line, Ellipse}; use std::f32; use crate::music::Music; pub struct Intro { current_primitive: usize, phase: f32, p_fade: f32, line_1_0: Line, line_1_1: Line, line_5_0: Line, line_5_1: Line, } impl Intro { pub const fn new() -> Self { Int...
#![deny(warnings)] pub mod dto; mod login; mod registry; mod docker_registry; use structopt::StructOpt; use std::path::PathBuf; use serde::{Deserialize, Serialize}; use dto::{addons,BuildInstruction}; use log::{info, debug, warn, error}; use env_logger::Env; use console::{style, Emoji}; use std::str::FromStr; pub...
#[cfg(target_os = "redox")] use redox_users::All; use std::{ collections::VecDeque, env::{self, set_current_dir}, io, path::{Component, Path, PathBuf}, }; use thiserror::Error; #[cfg(not(target_os = "redox"))] use users::os::unix::UserExt; #[derive(Debug, Error)] pub enum DirStackError { #[error("i...
#![allow(dead_code)] fn main() { // puzzle::triangle(); // digit::check_digit(); message::print_digit(); } mod puzzle { use num::abs; pub fn triangle() { for i in 0..7 { for _ in 0..(4 - abs(4 - i)) { print!("#"); } println!(); } ...
use chrono::prelude::*; use regex::Regex; use std::env; use std::fs::File; use std::io::prelude::*; use std::io::BufReader; mod dateformat; fn main() -> std::io::Result<()> { let mut args = env::args().skip(1); // https://stackoverflow.com/a/49964042/516188 let is_piped_input = !atty::is(atty::Stream::Stdi...
//! Simple Ansi Colors (strives for ~=0 cost) //! ```rust //! use scolor::ColorExt; //! # #[cfg(not(feature="zero-cost"))] //! # { //! println!("{}", "hello".red().bold().underline()); //! println!("{}", "world".green().red_bg().italic()); //! //! use scolor::{Color, CustomStyle, ColorDesc, Effect}; //! const LIGHT_BLU...
use bit_field::BitField; use crate::error::HvResult; use crate::memory::{addr::virt_to_phys, AlignedPage, Frame, PhysAddr}; pub(super) struct VmxRegion { frame: Frame, } impl VmxRegion { pub fn new(revision_id: u32, shadow_indicator: bool) -> HvResult<Self> { let frame = Frame::new()?; unsafe...
extern crate polygon; extern crate vcdim; extern crate rand; use polygon::*; use polygon::generate::Mode; use vcdim::*; use rand::distributions::{IndependentSample, Range}; use std::fs::File; use std::io::Write; fn minimize_w_subset(polygon: &Polygon, sh_set: &[Point]) -> VcDim { let mut vcd = VcDim::new(polygon....
// dots.rs use gift::{Encoder, Step}; use pix::{ gray::{Gray, Gray8}, rgb::{Rgb, SRgb8}, Palette, Raster, }; use std::error::Error; use std::fs::File; use std::io::BufWriter; fn page1(p: &mut Palette) -> Raster<Gray8> { let amber = SRgb8::new(255, 208, 0); let red = SRgb8::new(255, 0, 0); let m...
use std::{ env, sync::{Arc, RwLock}, }; use async_std::{ fs::File, io::{BufReader, BufWriter}, path::{Path, PathBuf}, stream::StreamExt, }; use bincode::serialize; use clap::{Arg, App}; use futures::{ AsyncWriteExt, future::join_all, }; use itertools::Itertools; use ldraw::{ color::...
use std::any::Any; use std::process; use std::rc::Rc; use crate::class::{Class, Table}; use crate::object::{downcast, new_module, Exception, FnResult, Interface, Object, VARIADIC}; use crate::vm::{Env, RTE}; fn exit(env: &mut Env, _pself: &Object, argv: &[Object]) -> FnResult { match argv.len() { 0 => { ...
// Copyright 2020 Twitter, Inc. // Licensed under the Apache License, Version 2.0 // http://www.apache.org/licenses/LICENSE-2.0 use crate::Heatmap; use crate::HeatmapError; use core::sync::atomic::AtomicU64; use core::sync::atomic::AtomicUsize; use rustcommon_atomics::{Atomic, Ordering}; use rustcommon_histogram::{At...
use std::sync::mpsc::{Sender, Receiver, channel}; use std::sync::Arc; use {Allocate, Data, Push, Pull}; use allocator::{Message, Process}; use networking::MessageHeader; // A communicator intended for binary channels (networking, pipes, shared memory) pub struct Binary { pub inner: Process, // inner Proce...
use crate::containers::{self, Container}; use std::mem; // Number of elements that defines the limit between a sparse and dense chunk. const SPARSE_CHUNK_THRESHOLD: usize = 4_096; /// A chunk header, providing key and cardinality handling. pub(super) trait Header { type Key; /// Returns the chunk's key. ...
use std::collections::{HashMap, VecDeque}; use std::fmt; use super::flow_graph::FlowGraph; use super::il::*; use crate::util::BitVec; #[derive(Clone)] pub struct BlockDominators { blocks: BitVec<MilBlockId> } impl BlockDominators { pub fn new() -> BlockDominators { BlockDominators { block...
extern crate regex; fn is_valid_fen(fen: &str) -> bool { use regex::Regex; let fen_regex = r"\s*([rnbqkpRNBQKP1-8]+/){7}([rnbqkpRNBQKP1-8]+)\s[bw-]\s(([a-hkqA-HKQ]{1,4})|(-))\s(([a-h][36])|(-))\s\d+\s\d+\s*"; let re = Regex::new(fen_regex).unwrap(); re.is_match(fen) } type ChessBoardLine = [char; 8]; type ChessBo...
#![no_std] #![no_main] use panic_abort as _; use cortex_m::asm; use cortex_m_rt::{entry, exception, ExceptionFrame}; use hal::{ gpio::{gpioa::PA15, Floating, Input}, interrupt, pac, prelude::*, serial::{Serial, Tx}, spi::Spi, timer::{self, Timer}, watchdog::IndependentWatchDog, }; use infr...
// Copyright 2015-2020 Parity Technologies (UK) Ltd. // This file is part of Open Ethereum. // Open Ethereum 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 o...
use crate::globals::{TERM_ERR, USER_AGENT}; use anyhow::{Context, Result}; use cfg_if::cfg_if; use dialoguer::Confirmation; use indicatif::ProgressBar; use lazy_static::lazy_static; use reqwest::blocking::ClientBuilder; use semver::{SemVerError, Version}; use serde::Deserialize; use std::{ convert::{TryFrom, TryInt...
#[doc = "Reader of register STAT"] pub type R = crate::R<u32, super::STAT>; #[doc = "Writer for register STAT"] pub type W = crate::W<u32, super::STAT>; #[doc = "Register STAT `reset()`'s with value 0"] impl crate::ResetValue for super::STAT { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
#![cfg(any( feature = "fruits", all(feature = "osu", not(feature = "no_sliders_no_leniency")) ))] use crate::{ math_util, parse::{PathType, Pos2}, }; const BEZIER_TOLERANCE: f32 = 0.25; const CATMULL_DETAIL: f32 = 50.0; pub(crate) enum Points { Single(Pos2), Multi(Vec<Pos2>), } impl Points {...
// Copyright 2016 Mozilla Foundation // // 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...
// All words are taken from // http://ohsir-the-insult-simulator.wikia.com/wiki/All_of_the_words_in_Oh... // Sir!!_The_Insult_Simulator // // What is referred to as "word" is actually not a word by the way. // It's a part of a sentence. #[macro_use] extern crate failure; extern crate rand; use rand::Rng; use std::fmt...
use log::error; use std::io; use beserial::{Deserialize, Serialize}; use nimiq_bls::AggregatePublicKey; use nimiq_hash::{Blake2sHash, Hash, SerializeContent}; use nimiq_hash_derive::SerializeContent; use nimiq_primitives::policy::TWO_F_PLUS_ONE; use nimiq_primitives::slots::Validators; use crate::signed::{ Messag...
pub const WGS84_SEMI_MAJOR_AXIS_METERS: f64 = 6378137.0; pub const WGS84_FLATTENING: f64 = 298.257223563; pub const WGS72_SEMI_MAJOR_AXIS_METERS: f64 = 6378135.0; pub const WGS72_FLATTENING: f64 = 298.26; pub const WGS66_SEMI_MAJOR_AXIS_METERS: f64 = 6378145.0; pub const WGS66_FLATTENING: f64 = 298.25; pub const WGS60_...
#[macro_use] extern crate text_io; use std::cmp::min; use std::collections::BinaryHeap; use std::collections::VecDeque; mod orders; use orders::{order_from_str, Order, Side, Trade}; fn main() { let mut asks = BinaryHeap::<Order>::new(); let mut bids = BinaryHeap::<Order>::new(); loop { let line:...
#![allow(proc_macro_derive_resolution_fallback)] use std::time::SystemTime; use chrono::{DateTime, Utc}; use std::borrow::ToOwned; use std::hash::{Hash, Hasher}; use xmlrpc::Value; use crate::db::*; use crate::local::Local; #[table_name = "memo"] #[derive(Insertable, Queryable)] #[derive(Debug, Clone, Par...
/// This module holds the supported parsers and formats. Common formats are Fen, ACN, DCN and PGN use crate::core::Figure; use crate::core::Board; use crate::core::Piece; use crate::core::Square; use crate::core::Color; /// Returns an Option of Board if fen_string is a valid Fen-encoded position /// /// # Argument...
#![cfg_attr(not(feature = "std"), no_std)] #[cfg(not(feature = "std"))] use alloc::vec::Vec; #[cfg(not(feature = "std"))] use core::result::Result; #[cfg(not(feature = "std"))] use core::convert::AsRef; use bitvec::prelude::BitSlice; pub fn get_root<HashType>( key: &BitSlice, leaf_hash: HashType, proof...
// Copyright (C) 2020 <NAME> <<EMAIL>> // This file is subject to the terms and conditions defined in // file 'LICENSE', which is part of this source code package. use anyhow::Result; use std::convert::TryFrom; use std::process::ExitStatus; use std::process::Stdio; use tokio::process::Command; use tokio::time; use tok...
//! A flexible walk function suitable for arbitrary sorting/filtering. mod dir_entry; mod index_path; mod iterators; mod ordered; mod ordered_queue; mod read_dir; use rayon::iter::ParallelBridge; use rayon::prelude::*; use rayon::ThreadPoolBuilder; use std::io::{Error, Result}; use std::path::PathBuf; use std::sync::...
/**/ use thiserror::Error; use crate::common::*; #[derive(Debug, PartialEq, Eq)] pub enum Token { // Single-character tokens. ParenLeft, ParenRight, BraceLeft, BraceRight, BracketLeft, BracketRight, Plus, Minus, Times, Divide, Colon, Semicolon, Comma, Assignment, // = // Double-character tokens. Eq...
use wasm_bindgen::prelude::*; use crate::p5_wasm::P5Wasm; use super::color::Color; use wasm_bindgen::JsValue; // color/creating_reading.js #[wasm_bindgen] impl P5Wasm { pub fn color(&self, v1: JsValue, v2: JsValue, v3: JsValue, v4: JsValue) -> Color { Color::new(self, v1, v2, v3, v4) } pub fn red(&self, c: &Colo...
// // Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved. // // 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 // use crate::re...
extern crate bindgen; #[macro_use] extern crate log; extern crate docopt; #[macro_use] extern crate rustc_serialize; extern crate env_logger; use bindgen::{Builder, LinkType}; use std::io::{self, Write}; use std::fs::File; use std::process::exit; const USAGE: &'static str = " Generate C bindings for Rust. Usage: b...
//! Mocks for the debit module. #![cfg(test)] use frame_support::{impl_outer_origin, parameter_types}; use primitives::H256; use sp_runtime::{testing::Header, traits::IdentityLookup, Perbill}; use orml_traits::PriceProvider; use support::{AuctionManager, ExchangeRate, Price, Rate, Ratio}; use super::*; impl_outer_...
//! # Rust-locked localtime implementation //! //! ## Crate abandoned //! //! **This crate is abandoned** because there's a pure Rust implemenation - [`tz-rs`](https://docs.rs/tz-rs/). //! The code is up for archival purposes only. //! //! ## About //! //! **Warning:** this crate is currently proof-of-concept and it wa...
use crate::err::*; use std::fs; use std::path::{Path, PathBuf}; use log::*; use std::io::Write; use std::process::Output; pub struct PublicKey { pub fingerprint: String, } impl PublicKey { pub fn new(fingerprint: String) -> PublicKey { //TODO check length, no blanks, valid format PublicKey ...
//! # RTWins Widget tests extern crate rtwins; use rtwins::widget::*; use rtwins::widget_impl::*; use rtwins::colors::*; #[rustfmt::skip] #[repr(u16)] enum Id { WndTest = WIDGET_ID_NONE + 1, BtnToaster, PgControl, PageVer, PanelVersions, LabelFwVersi...
use aho_corasick::{AhoCorasick, AhoCorasickBuilder, MatchKind}; use lazy_static::lazy_static; use memchr::memrchr; use crate::ast::NodeData; use crate::common::gen::codepoints::TAG_NAME_CHAR; use crate::common::spec::tag::ns::Namespace; use crate::common::spec::tag::omission::{can_omit_as_before, can_omit_as_last_node...
//! Derive `Read`. use crate::internal::get_root_path; use proc_macro2::TokenStream; use quote::{quote, quote_spanned, ToTokens}; use syn::{ parse::{Parse, ParseStream, Result as ParseResult}, parse_quote, spanned::Spanned, Data, DeriveInput, Fields, GenericParam, Generics, Ident, Path, }; pub struct D...
use crate::relay::eth_relay::wait_header_sync_success; use crate::server::proof_relayer::db::{ self, update_eth_to_ckb_status, CkbToEthRecord, EthToCkbRecord, }; use crate::transfer::to_ckb::{generate_eth_spv_proof_json, send_eth_spv_proof_tx}; use crate::transfer::to_eth::{get_ckb_proof_info, unlock, wait_block_su...
use image::{ImageBuffer, Rgb}; use std::collections::BTreeMap; use std::io::BufRead; fn main() { if std::env::args() .nth(1) .map(|v| v == "images") .unwrap_or(false) { println!("generating images..."); generate_images(24 * 10, std::io::stdin().lock()); } else { ...
use std::{ borrow::Borrow, collections::{HashMap, HashSet}, path::PathBuf, }; use crate::{ dependency_graph::{ExportName, ImportName}, module_visitor::{ModuleVisitor, Scope, ScopeId}, parsing::module_from_source, }; use anyhow::Context; use pretty_assertions::assert_eq; use swc_atoms::JsWord; ...
// Copyright 2020 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://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 di...
use std::env; use std::fs::File; use std::io::{BufReader, Read, Seek, SeekFrom}; use std::process::exit; use crate::FailureReason::{FileIoFailure, FileTypeMismatch, InvalidRange}; use image::{GrayImage, ImageFormat}; const IMAGE_FILE: u32 = 2051; const LABEL_FILE: u32 = 2049; const BYTES_PER_IMAGE: u32 = 28 * 28; typ...
// Copyright 2021 <NAME>. // This file is part of ConcreteSTV. // ConcreteSTV is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. // Concr...
extern crate sim; use sim::core::connection::mesh; use sim::core::connection::simple_connection; use sim::core::events::text_event; use sim::core::id_mngmnt::id_registrar::IdRegistrar; use sim::core::id_mngmnt::id_types::GateId; use sim::core::id_mngmnt::id_types::ModuleId; use sim::core::id_mngmnt::id_types::PortId; ...
use core::fmt; use core::iter::FromIterator; use std::collections::BTreeMap; use serde::{Deserialize, Serialize}; //use crate::{CmRDT, Dot, Identifier, OrdDot, VClock}; use super::traits::CmRDT; use super::dot::{Dot, OrdDot}; use super::identifier::Identifier; use super::vclock::VClock; //use super::dot::OrdDot; ///...
// OAM (Object Attribute Memory), contains sprite info use bitflags::bitflags; const LO_TABLE_SIZE: usize = 512; const NUM_OBJECTS: usize = 128; bitflags!{ #[derive(Default)] struct ObjectAttributes: u8 { const Y_FLIP = bit!(7); const X_FLIP = bit!(6); const PRIORITY ...
use std::str::FromStr; use num_traits::identities::Zero; use pest::iterators::Pair; use pest::prec_climber::{Assoc, Operator, PrecClimber}; use pest::Parser; use yolol_number::YololNumber; use crate::ast::{InfixOp, PrefixOp, YolkExpr, YolkProgram, YolkStmt}; use crate::error::YolkError; #[cfg(test)] mod tests; lazy...
use proc_macro::{ Delimiter::*, Group, Ident, Literal, Punct, Spacing::*, Span, TokenStream, TokenTree, }; use crate::*; macro_rules! tt { (Literal::$ty:tt($($args:expr),*)) => { TokenTree::Literal(Literal::$ty($($args),*)) }; ($ty:tt($($args:expr),*)) => { TokenTree::$ty($ty::new($($a...
#![allow(dead_code)] use super::types::{SystemMatrix, MeasurementMatrix}; use kalmanfilter::nt; use na::DMatrix; pub fn is_observable(mat_f : &SystemMatrix, mat_c : &MeasurementMatrix, eps: f64) -> bool { kalman_observability_index(mat_f, mat_c, eps).is_some() } pub fn is_observable2(mat_f : &SystemMatrix, mat_c...
use crate::models::*; use crate::schema::accounts::dsl::*; use clap::ArgMatches; use clap::{App, Arg, ArgGroup, SubCommand}; use diesel::prelude::*; use log::info; use prettytable::{cell, row, Table}; use std::io; pub fn build() -> App<'static, 'static> { SubCommand::with_name("account") .about("Account M...
// https://www.python.org/dev/peps/pep-0350/ use super::Finder; use lazy_static::lazy_static; use regex::Regex; use std::collections::HashSet; use std::ops::Range; lazy_static! { static ref DEFAULT_MNEMONICS: HashSet<String> = { [ // todo "TODO", "MILESTONE", "MLSTN", "DONE", ...
mod tbqueue; mod tchan; mod tqueue; mod tvecdequeue; use crate::{StmResult, Transaction}; /// Transactional queue-like structure. /// /// This is a common interface between the various implementations in <NAME>'s book. pub trait TQueueLike<T>: Clone + Send { /// Pop the head of the queue, or retry until there is ...
extern crate delivery; use delivery::delivery_config::{BuildCookbookLocation, DeliveryConfig, DeliveryConfigV1}; use std::collections::HashMap; use support::paths::fixture_file; macro_rules! setup { () => {}; } mod v1 { use super::*; test!(load_config { let source_dir = fixture_file("test_v1_repo...
mod utils; mod ai; use std::fmt; extern crate web_sys; use wasm_bindgen::prelude::*; // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator. #[cfg(feature = "wee_alloc")] #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[wasm_bindgen] extern "C" { ...
use crate::{ file_storage::{self, FileStorage}, git::Repo, index::Index, markdown::MarkdownRenderer, serde::SeparatedList, user_storage::{self, UserAccount}, }; use anyhow::Context as AnyhowContext; use std::{ net::{IpAddr, Ipv4Addr}, path::{Path, PathBuf}, sync::Arc, }; #[derive(de...
/// 3.2.4 Object: Imp /// /// This object describes an ad placement or impression being auctioned. A single bid request can /// include multiple Imp objects, a use case for which might be an exchange that supports selling /// all ad positions on a given page. Each Imp object has a required ID so that bids can reference...
// Copyright 2019 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 { component_manager_lib::{capability::*, model::*}, fidl::endpoints::ServerEnd, fidl_fuchsia_test_hub as fhub, fuchsia_async as fasync, fuc...