text
stringlengths
3.09k
13.9k
//! Z80 CPU module use utils::*; use z80::*; use z80::opcodes::*; /// Z80 Processor struct pub struct Z80 { /// Contains Z80 registers data pub regs: Regs, /// active if Z80 waiting for interrupt pub halted: bool, /// enabled if interrupt check will be skipped nex time pub skip_interrupt: bool...
use std::{ cmp::Ordering, collections::{BinaryHeap, HashMap}, env, io, io::prelude::*, isize, }; fn main() { let args: Vec<String> = env::args().collect(); let part = args.get(1).cloned().unwrap_or(String::from("1")); let reader = io::stdin(); let lines = reader.lock().lines(); ...
use crate::error::InvalidArgument; use crate::utils::number; use nom::bytes::complete::tag; use nom::character::complete::digit1; use nom::combinator::map; use nom::sequence::terminated; use nom::sequence::tuple; use std::fmt; use std::str::FromStr; use std::time::Duration; #[derive(Debug, PartialEq, Eq, Clone, Defaul...
//! Code shared between multiple exporters. use common_failures::prelude::*; use common_failures::io::{Operation, Target}; use std::convert::AsRef; use std::default::Default; use std::io::Write; use std::ffi::OsStr; use std::fmt::Write as fmt_Write; use std::fs; use std::path::{Path, PathBuf}; use align::align_availa...
//! Const evaluated utf8 to utf16 conversion functions. //! //! # Use //! //! ``` //! # #[macro_use] //! # extern crate const_utf16; //! # fn main() {} //! const HELLO_WORLD_UTF16: &[u16] = const_utf16::encode!("Hello, world!"); //! ``` #![no_std] #![deny(missing_docs)] /// Encode a &str as a utf16 buffer. #[macro_exp...
// Copyright 2018-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 formatters::AggFormatter; use std::net::UdpSocket; use std::sync::mpsc::Receiver; use std::time::Duration; use config::Settings; pub enum PublisherCredentials { Udp(String), Kafka(Vec<String>, Duration, String), } pub fn get_publisher_credentials(settings: &Settings) -> Result<PublisherCredentials, Strin...
//! Keeping track of multiple files. //! use std::{ collections::{BTreeMap, BTreeSet}, env::current_dir, path::{Path, PathBuf}, }; use anyhow::{format_err, Context}; use log::debug; use super::OpenApi; use crate::Result; /// Resolve all `$includedFiles` that appear in `base`, recursively. pub fn resolve_...
// Copyright (C) 2020 <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 acco...
/* Sudoku solver written in Rust BSD 2-Clause License Copyright (c) 2019, <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 code must retain the above copyrigh...
use super::Visitor; use crate::ast::{Atom, BinaryArithmetic, BinaryOp, Expr, FunctionCall, UnaryArithmetic, UnaryOp}; use crate::symbols::{SymbolError, SymbolTable}; use std::f64::consts; pub type Func<T> = fn(Vec<T>) -> T; #[derive(Debug)] pub struct Calculator { variables: SymbolTable<f64>, functions: Symbo...
use proc_macro::TokenStream; use proc_macro_error::*; use proc_macro2::Span; use syn::{Ident, ItemEnum}; use std::ops::Not; use sana_core::RuleSet; use sana_core::{Rule, regex::Regex}; use parser::{parse_attr, TokenAttr, RegexAttr, SanaAttr}; mod parser; mod generator; #[derive(Debug, Clone)] struct Spanned<T> { ...
// Copyright 2017-2021 <NAME>. // // 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...
use std::{ ffi::{OsStr, OsString}, fs, io::{Read, Write}, path::PathBuf, process::Stdio, str::FromStr, }; use clap::Parser; mod cli; use cli::*; fn main() { let args = Cli::parse(); // Config folder check let config_dir_path: PathBuf = { if let Ok(path) = std::env::var("TMU...
// Copyright 2020 EinsteinDB Project Authors & WHTCORPS INC. Licensed under Apache-2.0. use engine_lmdb::LmdbSnapshot; use violetabft::evioletabft_timeshare::MessageType; use violetabftstore::store::*; use std::time::*; use test_violetabftstore::*; /// Allow lost situation. #[derive(PartialEq, Eq, Clone, Copy)] enum ...
use std::{ collections::HashMap, env, error::Error, io::{self, Write}, path, time::Instant, }; use clap::{App, Arg, ArgMatches}; use sasl::frontend::{lexer::Lexer, parser::Parser, visualize::Visualizer}; use sasl::load_source_file; use sasl::{ backend::{abstractor::compile, reduction::Reduc...
use log::{debug, info}; use native_dialog::FileDialog; use regex::Regex; use simplelog::{Config, LevelFilter, WriteLogger}; use std::env::temp_dir; use std::ffi::OsStr; use std::fs::File; use std::io; use std::io::{Read, Write}; use std::path::PathBuf; use std::process::{exit, Command}; use std::str::from_utf8; const ...
use crate::app_download::AppDownloadRequest; use crate::device_manager::{get_bl_version, get_cert, get_firmware_version, get_se_id, get_sn}; use crate::error::ImkeyError; use crate::ServiceResponse; use crate::{Result, TsmService}; use common::utility::hex_to_bytes; use common::{constants, https}; use serde::{Deseriali...
//! This module defines the element that is used for entering attacks. use crate::gui::style; use critfail::{AdvState, ParseError, Roll, RollExpression, RollOutcome}; use iced::{ button, text_input, Align, Button, Column, Element, HorizontalAlignment, Length, Row, Text, TextInput, VerticalAlignment, }; #[deriv...
use crate::animation::PathCompletion; use crate::appearance::{GetOpacity, Opacity, SetOpacity}; use crate::arena::Object; use crate::consts::*; use crate::draw::Draw; use crate::geom; use crate::geom::{dimension, Dimension, GetDimension, SetDimension}; use crate::geom::{point_at, GetOrientation, GetPosition, SetOrienta...
use std::collections::HashMap; use cosmwasm_std::testing::MockQuerier; use cosmwasm_std::{ from_binary, from_slice, to_binary, ContractResult, Decimal, Querier, QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, WasmQuery, }; use cw20::{BalanceResponse, Cw20QueryMsg}; use terra_cosmwasm::{TaxCapR...
#![warn(rust_2018_idioms)] #![allow(clippy::wildcard_imports)] use seed::{prelude::*, *}; use std::iter; /// Number of **explicitly stored** significand bits for IEEE754 binary64. const BINARY_64_SIGNIFICAND_BITS: usize = 52; const BINARY_64_EXPONENT_BITS: usize = 11; const BINARY_64_BIAS: usize = 1023; #[wasm_bind...
use crate::apt_repo::fetch_repo; use crate::deb_file::{visit_files, DebVisitor}; use std::collections::HashMap; use std::fs::{File, OpenOptions}; use std::io::{copy, Read, Result, Write}; use std::path::PathBuf; use std::sync::Arc; use std::thread; use std::vec::Vec; use zip::write::{FileOptions, ZipWriter}; struct Te...
use crate::constructors::build_graph_from_integers; use super::*; use indicatif::ParallelProgressIterator; use num_traits::Pow; use rayon::prelude::*; use std::convert::TryFrom; pub enum Distance { L2, Cosine, } impl TryFrom<&str> for Distance { type Error = String; fn try_from(value: &str) -> std::...
use proc_macro::TokenStream; use quote::quote; use wit_bindgen_gen_core::{wit_parser::Interface, Direction, Files, Generator}; use wit_bindgen_gen_rust_wasm::RustWasm; /// The entrypoint to a Spin HTTP component written in Rust. #[proc_macro_attribute] pub fn http_component(_attr: TokenStream, item: TokenStream) -> To...
//! This module implements the Property Descriptor. //! //! The Property Descriptor type is used to explain the manipulation and reification of Object property attributes. //! Values of the Property Descriptor type are Records. Each field's name is an attribute name //! and its value is a corresponding attribute value ...
#![cfg(test)] use super::*; use crate as swap; use currencies::BasicCurrencyAdapter; use frame_support::pallet_prelude::GenesisBuild; use frame_support::traits::Nothing; use frame_support::{construct_runtime, parameter_types, PalletId}; use orml_traits::parameter_type_with_key; use primitives::Amount; use sp_core::H25...
use crate::CycleList::{CycleCons, CycleNil}; use crate::List::{Cons, Nil}; use crate::RcCList::{RcCCons, RcCNil}; use crate::RcList::{RcCons, RcNil}; use std::fmt; use std::ops::Deref; use std::rc::{Rc, Weak}; #[derive(Debug)] enum List<T: Default + Copy + std::fmt::Display> { Cons(T, Box<List<T>>), Nil, } i...
//! The Cairo backend for the Piet 2D graphics abstraction. use cairo::{Context, LineCap, LineJoin}; use kurbo::{PathEl, QuadBez, Shape, Vec2}; use piet::{FillRule, RenderContext, RoundInto}; pub struct CairoRenderContext<'a> { // Cairo has this as Clone and with &self methods, but we do this to avoid // co...
use serde::de::{self, Error}; use serde::ser::{self, SerializeTuple}; use std::cell::RefCell; use std::fmt; #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Default)] pub struct Point { /// Stop point in seconds. May be positive to be distance from the beginning and negative to /// be distance from the en...
use nix::sys::ptrace; use nix::sys::signal; use nix::sys::wait::{waitpid, WaitPidFlag, WaitStatus}; use nix::unistd::Pid; use std::process::Child; use std::process::Command; use std::os::unix::process::CommandExt; use crate::dwarf_data::DwarfData; use std::mem::size_of; use std::collections::HashMap; fn align_addr_to_...
use crate::{CryptoRng, RngCore}; use num::pow::pow; use num::{BigUint, FromPrimitive}; use num_bigint::RandBigInt; use crate::PrimeField; use crate::{LinearSharingScheme, ThresholdSecretSharingScheme}; /// A trait marking a special instance of a additive linear threshold secret sharing scheme invented by <NAME>. A /...
// // Copyright 2016 ihex Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://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...
use super::{Float, Matrix4, Vector3, Vector4}; use core::ops; #[derive(Clone, Copy, PartialEq, PartialOrd, Debug)] pub struct Quaternion { pub x: f32, pub y: f32, pub z: f32, pub w: f32, } impl Quaternion { pub fn axis(axis: Vector3, angle: f32) -> Self { let axis_vec = axis * (angle / 2.)...
use proc_macro2::{Span, TokenStream}; use quote::quote; use syn::parse::{Parse, ParseStream, Result}; use syn::punctuated::Punctuated; use syn::spanned::Spanned; use syn::{bracketed, parenthesized, token, Error, Expr, Ident, Pat, Token}; #[derive(Debug, Clone)] struct ChildrenBranch { pattern_span: Span, patte...
// Copyright (c) 2018 <NAME> // [This program is licensed under the "MIT License"] // Please see the file LICENSE.md in the // source distribution of this software for license terms. //! `rusty-saw-view` is a Rust program that helps visualize blockchain data from //! [Hyperledger Sawtooth](https://www.hyperledger.org...
// Copyright 2018 <NAME> // Part of the vasp-poscar crate. // // 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 distri...
/* Common CHIP-8 display: Black and white Slower-than-my-brain refresh rate 8-bit Run-over atari quality My IQ is bigger than the vMemory */ const WIDTH: usize = 64; const HEIGHT: usize = 32; pub struct Display { pub memory: [u8; 2048], } impl Display { pub fn new() -> Display { Display{ ...
use crate::serde::{PercentDecoded, ProcessError, Thunk}; use serde::{Deserialize, Serialize}; use std::{ borrow::Cow, fmt::{Display, Formatter}, }; mod internal { use crate::model::song::NewgroundsSong; include!(concat!(env!("OUT_DIR"), "/newgrounds_song.boilerplate")); } /// Struct modelling a [`New...
use sdl2::event::Event; use sdl2::image::InitFlag; use sdl2::joystick::Joystick; use sdl2::keyboard::Keycode; use sdl2::mixer::{AUDIO_S16LSB, DEFAULT_CHANNELS}; use sdl2::Sdl; use std::thread; use std::time::{Duration, SystemTime}; use galangua_common::framework::{AppTrait, VKey}; use crate::sdl::sdl_renderer::SdlRen...
use crate::rendering::splatted_triplanar_pbr_pass::{ArrayMaterialId, ArrayMaterialIndex}; pub mod asset_loader; pub mod bundle; pub mod chunk_cache_compressor; pub mod chunk_cache_flusher; pub mod chunk_processor; pub mod double_buffer; pub mod map_file; //pub mod map_generators; pub mod meshing; pub mod search; use ...
use crate::algorithms::determinize::divisors::CommonDivisor; use crate::algorithms::determinize::DeterminizeFsaOp; use crate::algorithms::lazy::{LazyFst, SimpleHashMapCache}; use crate::fst_properties::FstProperties; use crate::fst_traits::{AllocableFst, CoreFst, Fst, FstIterator, MutableFst, StateIterator}; use crate:...
mod args; mod template_file; use crate::templates::template_file::{Template, TemplateInfoOnly}; use crate::{log_error, log_warn, Logged}; use fxhash::FxHashMap; use std::ffi::OsString; use std::path::PathBuf; type IndexMapString<V> = indexmap::IndexMap<String, V, fxhash::FxBuildHasher>; fn get_template_paths() -> Ve...
use tauri::api::path::{cache_dir, home_dir}; use futures_util::StreamExt; use std::io::Write; use std::fs::{metadata, remove_dir_all, remove_file, File}; use std::path::{Path, PathBuf}; /// build new reqwest client with custom header pub fn build_client() -> reqwest::Client { return reqwest::Client::builder() ...
use super::Mapper; use crate::cartridge::MirroringType; enum ControlBits { Mirroring = 0b00011, PrgRomBankMode = 0b01100, ChrRomBankMode = 0b10000, } bitfield!(Control, ControlBits, u8); pub struct Mapper001 { #[allow(dead_code)] chr_ram: Vec<u8>, prg_ram: [u8; 0x1FFF], shift_register: u8...
use std::collections::HashMap; use std::io::Write; use std::process; use std::process::Stdio; use ansi_term::Color::Fixed; use strfmt::Format; use crate::config::defaults::Defaults; use crate::config::model::{Command, Config}; use crate::error::{Error, Result}; use crate::selector::CommandSelector; pub struct FzfSel...
extern crate home; extern crate text_io; mod util; fn main() { use std::env; use std::fs::{File, OpenOptions}; use std::io::prelude::*; use util::{colors, terminal}; let mut running: bool = true; let args: Vec<String> = env::args().collect(); // print help if not enough args if args....
//! Common implementation help for [`PartialOrd`] and [`Ord`]. use proc_macro2::TokenStream; use quote::quote; use crate::{Data, DeriveTrait, Item}; /// Build signature for [`PartialOrd`] and [`Ord`]. pub fn build_ord_signature(item: &Item, trait_: &DeriveTrait, body: &TokenStream) -> TokenStream { use DeriveTrait:...
bitflags! { /// Pipeline stages flags. /// See Vulkan docs for detailed info: /// <https://www.khronos.org/registry/vulkan/specs/1.1/html/vkspec.html#synchronization-pipeline-stages> /// Man page: <https://www.khronos.org/registry/vulkan/specs/1.1-extensions/man/html/VkPipelineStageFlagBits.html> #[...
/*! nphysics ======== **nphysics** is a 2 and 3-dimensional physics engine for games and animations. It uses [ncollide](http://ncollide.org) for collision detection, and [nalgebra](http://nalgebra.org) for vector/matrix math. Its most distinctive feature is its genericity wrt the simulation dimension. That means you c...
//! This pallet manages changes in the committee responsible for producing blocks and establishing consensus. //! Currently, it's PoA where the validators are set by the root account. In the future, a new //! version for DPoS elections will replace the current one. //! //! ### Terminology //! For definition of session,...
#[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ attr, to_binary, Binary, Decimal, Deps, DepsMut, Env, MessageInfo, Response, StdError, StdResult, }; use crate::math::decimal_division; use crate::state::{ read_config, read_feeder, read_price, read_prices, store_config, s...
// Copyright 2018-2019 Cryptape Technologies LLC. // // 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 // ...
use cosmwasm_std::testing::{MockApi, MockQuerier, MockStorage, MOCK_CONTRACT_ADDR}; use cosmwasm_std::{ from_binary, from_slice, to_binary, Addr, Api, Binary, Coin, ContractResult, Decimal, OwnedDeps, Querier, QuerierResult, QueryRequest, SystemError, SystemResult, Uint128, WasmQuery, }; use schemars::JsonSchem...
// Copyright 2020-2021 the Tectonic Project // Licensed under the MIT License. //! Connecting the Tectonic document model to the engines. //! //! This module extends the document model types provided by the //! `tectonic_docmodel` crate with the actual document-processing capabilities //! provided by the processing en...
extern crate unbase; use std::{thread, time}; #[test] fn init_blackhole() { let net = unbase::Network::create_new_system(); let blackhole = unbase::network::transport::Blackhole::new(); net.add_transport( Box::new(blackhole) ); { let slab_a = unbase::Slab::new(&net); let _context_a = s...
// Copyright 2019 Pants project contributors (see CONTRIBUTORS.md). // Licensed under the Apache License, Version 2.0 (see LICENSE). #![deny(warnings)] // Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to...
use eth2::lighthouse_vc::{PK_LEN, SECRET_PREFIX as PK_PREFIX}; use rand::thread_rng; use ring::digest::{digest, SHA256}; use secp256k1::{Message, PublicKey, SecretKey}; use std::fs; use std::path::Path; use warp::Filter; /// The name of the file which stores the secret key. /// /// It is purposefully opaque to prevent...
use super::proc::Proc; use super::raw_types; use super::value::Value; use crate::runtime::DMResult; use dashmap::mapref::entry::Entry; use dashmap::DashMap; use detour::RawDetour; use std::ffi::c_void; use std::os::raw::c_char; use std::{cell::RefCell, ffi::CStr}; #[doc(hidden)] pub struct CompileTimeHook { pub proc_...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
use std::fs; use std::collections::HashMap; use std::rc::Rc; use priority_queue::PriorityQueue; #[derive(Clone, Copy, Hash, PartialEq, Eq)] struct Coord(usize, usize); struct Grid { values: Vec<Vec<i32>>, xs: usize, ys: usize, } fn between(low: usize, val: usize, high: usize) -> bool { return low <= ...
use std::{borrow::Borrow, cmp::Ordering, mem}; const T: usize = 2; const MAX_LEN: usize = 2 * T - 1; const MID: usize = T - 1; const RIGHT: usize = MID + 1; #[derive(Debug)] struct KeyValue<K, V> { key: K, value: V, } impl<K: Ord, V> PartialEq for KeyValue<K, V> { fn eq(&self, other: &KeyValue<K, V>) -> ...
// Copyright 2018 The Exonum Team // // 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 i...
use crate::error::{Result, UrbitAPIError}; use crate::graph::{Node, NodeContents}; use crate::Channel; use crossbeam::channel::{unbounded, Receiver}; use json::JsonValue; use std::thread; use std::time::Duration; /// A struct that represents a message that is to be submitted to Urbit. /// `Message` provides methods to...
// Copyright 2020 the Deno authors. All rights reserved. MIT license. use super::Context; use super::LintRule; use swc_ecma_ast::{ ArrayPat, Expr, Ident, Lit, ObjectPat, Pat, TsAsExpr, TsLit, TsType, TsTypeAssertion, VarDecl, }; use swc_ecma_visit::Node; use swc_ecma_visit::Visit; pub struct PreferAsConst; impl L...
//! Interface for reading object files. use crate::alloc::vec::Vec; use crate::common::{RelocationEncoding, RelocationKind, SectionKind, SymbolKind, SymbolScope}; mod any; pub use any::*; mod coff; pub use coff::*; mod elf; pub use elf::*; mod macho; pub use macho::*; mod pe; pub use pe::*; mod traits; pub use t...
mod build; mod entity; use quick_xml::{ events::{BytesStart, BytesText, Event}, Error as QXError, Reader, }; use tracing::warn; use std::{ fs::File, io::{BufRead, BufReader}, num::ParseIntError, path::Path, str::{FromStr, Utf8Error}, }; pub use entity::{Anime, TitleVariation}; use build:...
#![cfg_attr(feature = "cargo-clippy", deny(clippy::all))] macro_rules! day { ($module:ident, $p1:tt,$p2:tt) => { DayRunner { num: day_num(stringify!($module)), container: Box::new(<$module::solution::Container>::new()), part_1_expected: $p1, part_2_expected: ...
use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::ops::RangeInclusive; use std::str::FromStr; use svd_parser::{ addressblock::AddressBlock, bitrange::BitRangeType, cpu::CpuBuilder, device::DeviceBuilder, endian::Endian, fieldinfo::FieldInfoBuilder, peripheral::PeripheralBuilde...
use std::path::PathBuf; use crate::{commands::dataframe::utils::parse_polars_error, prelude::*}; use nu_engine::WholeStreamCommand; use nu_errors::ShellError; use nu_protocol::{ dataframe::NuDataFrame, Primitive, Signature, SyntaxShape, UntaggedValue, Value, }; use nu_source::Tagged; use polars::prelude::{CsvEnco...
// Copyright 2018-2022 Parity Technologies (UK) Ltd. // // 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 applicab...
// Copyright (c) 2018-2021 The MobileCoin Foundation //! Traits and support for EPID-based remote attestation. #![deny(missing_docs)] use bitflags::bitflags; use mc_sgx_core_types::{Report, Result as SgxResult, SgxStatusToResult, TargetInfo}; use mc_sgx_core_types_sys::{SGX_ERROR_UPDATE_NEEDED, SGX_SUCCESS}; use mc_...
use core::mem::size_of; #[cfg(feature = "std")] use std::io::{self, Write}; use bytemuck::{bytes_of, Pod, Zeroable}; #[cfg(feature = "std")] use crate::std430::Writer; /// Trait implemented for all `std430` primitives. Generally should not be /// implemented outside this crate. pub unsafe trait Std430: Copy + Zeroab...
use crate::parser::tree::Params; use bytes::BytesMut; use smallvec::SmallVec; use std::collections::HashMap; use std::{fmt, io, str}; pub trait RequestWithParams { fn set_params(&mut self, _: Params); fn get_params<'a>(&'a self) -> &'a Params; } pub trait ThrusterRequest { fn method(&self) -> &str; fn...
// Copyright 2020 - 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 i...
#![doc = include_str!("../README.md")] pub mod handler; use std::collections::BinaryHeap; use std::future::Future; use std::net::{SocketAddr}; use test_context::AsyncTestContext; use tokio::sync::oneshot::{Receiver, Sender}; use tokio::task::JoinHandle; use hyper::{Server, StatusCode, Uri}; use hyper::service::{make_s...
use std::str::FromStr; use chrono::{Timelike, Utc}; use log::debug; use mongodb::bson::oid::ObjectId; use redis::aio::ConnectionManager; use redis::{AsyncCommands, Client, Value}; use crate::db::MongoDbClient; use crate::dto::PlanetMessage; use crate::errors::CustomError; use crate::errors::CustomError::{RedisError, ...
mod file_map; pub use file_map::{File, FileId, FileMap}; pub mod util; use std::{ collections::HashMap, path::{Path, PathBuf}, }; pub use util::*; pub const FILE_EXTENSION: &'static str = "nr"; // XXX: Create a trait for file io /// An enum to differentiate between the root file /// which the compiler starts...
// Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed /...
//! Router Component. use crate::{ agent::{RouteAgentBridge, RouteRequest}, route::Route, RouteState, Switch, }; use std::{ fmt::{self, Debug, Error as FmtError, Formatter}, rc::Rc, }; use yew::{html, virtual_dom::VNode, Component, Context, Html, Properties}; /// Any state that can be managed by t...
//! FIXME: write short doc here use std::sync::Arc; use ra_cfg::CfgOptions; use ra_db::{CrateName, FileSet, SourceRoot, VfsPath}; use test_utils::{ extract_annotations, extract_range_or_offset, Fixture, RangeOrOffset, CURSOR_MARKER, }; use crate::{ Analysis, AnalysisChange, AnalysisHost, CrateGraph, Edition, ...
// <NAME> licenses this file to you 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 writ...
// 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...
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Version ID Register"] pub verid: crate::Reg<verid::VERID_SPEC>, #[doc = "0x04 - Parameter Register"] pub param: crate::Reg<param::PARAM_SPEC>, _reserved2: [u8; 0x08], #[doc = "0x10 - Clock Status Register"] pub ...
extern crate nom; use nom::branch::*; use nom::bytes::complete::*; use nom::multi::separated_list; use nom::sequence::*; use nom::*; extern crate indexmap; use indexmap::IndexMap; use std::str; use crate::commands::Token; fn match_word(i: &str) -> IResult<&str, &str> { take_till(|c| c == ' ' || c == '\n')(i) } ...
mod pipeline; use vulkan::{prelude::*, utilities::FPSLimiter, Context, Framebuffer, Queue, Swapchain, VkThread, PipelineType}; use winit::event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent}; use winit::event_loop::{ControlFlow, EventLoop}; use pipeline::{Pipeline, Vertex}; use std::sync::Arc; fn...
//! Types and functions to manipulate the contents microarchitecture data file. //! //! These are encoding the rules of the corresponding schema as Rust data types //! with the help of `serde` deserialization. use serde::de; use serde::{Deserialize, Deserializer}; use std::collections::HashMap; use std::marker::Phanto...
extern crate rand; extern crate rustbox; use rand::Rng; use rustbox::Color; use rustbox::Key; use rustbox::RustBox; use std::default::Default; use std::error::Error; use std::time::Duration; #[derive(Clone, Copy, Debug)] pub struct Screen { pub width: i16, pub height: i16, } #[derive(Clone, Copy, Debug)] pub ...
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; const BAR_LEN: usize = 70; #[derive(Debug)] struct LeadingNode { children: Vec<Rc<RefCell<NormalNode>>>, } #[derive(Debug)] struct NormalNode { span: minitrace::Span, ...
//! Implementation of the best master clock algorithm [Bmca] use super::{ dataset_comparison::{ComparisonDataset, DatasetOrdering, DefaultDS}, foreign_master::ForeignMasterList, }; use crate::{ datastructures::{ common::{PortIdentity, TimeInterval, Timestamp}, messages::AnnounceMessage, ...
use crypto_market_type::MarketType; use serde::{Deserialize, Serialize}; use strum_macros::{Display, EnumString}; use crate::order::Order; /// The type of a message /// /// Copied from crypto_crawler::MessageType #[derive(Copy, Clone, PartialEq, Serialize, Deserialize, Display, Debug, EnumString)] #[serde(rename_all ...
//! # Keystore files key derivation function use super::Error; use super::prf::Prf; use crypto::pbkdf2::pbkdf2; //TODO: solve `mmap` call on windows for `rust-scrypt` #[cfg(target_os = "windows")] use crypto::scrypt::{ScryptParams, scrypt}; #[cfg(all(unix))] use rust_scrypt::{ScryptParams, scrypt}; use std::fmt; us...
use std::error::Error; use std::convert::Infallible; use serde::{Deserialize, Serialize}; use warp::{Filter, Rejection, Reply, reply, reject}; use warp::http::StatusCode; use warp::reject::Reject; use regex::RegexBuilder; use futures::future; use rss::{ChannelBuilder, ItemBuilder, CategoryBuilder, GuidBuilder}; use rss...
#![recursion_limit = "1024"] #[macro_use] extern crate error_chain; mod errors { error_chain! {} } use byteorder::{LittleEndian, ReadBytesExt}; use clap::{App, Arg}; use errors::*; use pcap::Capture; use std::io::Cursor; const VERSION: &'static str = env!("CARGO_PKG_VERSION"); const AUTHOR: &'static str = concat!...
use crate::math::{Isometry, Point}; use crate::query::algorithms::{gjk, CSOPoint}; use crate::query::{PointQuery, PointQueryWithLocation}; use crate::shape::{Segment, SegmentPointLocation, Triangle, TrianglePointLocation}; use na::{self, RealField}; /// A simplex of dimension up to 2 using Voronoï regions for computin...
//! Primitives for daemon client inter-process communication. pub mod install; pub mod update; use crate::{ServerInfo, ServerType}; use ipc_channel::ipc::IpcSender; use semver::Version; /// Commands sent from the client to the daemon. /// The expected responses are (/will be) documented in a separate document. #[der...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under both the MIT license found in the // LICENSE-MIT file in the root directory of this source tree and the Apache // License, Version 2.0 found in the LICENSE-APACHE file in the root directory // of this source tree. use akd::ecv...
use std::collections::HashMap; use nickel::{ identifier::Ident, position::TermPos, term::{MetaValue, RichTerm, Term}, typecheck::{ linearization::{ Building, Completed, Environment, Linearization, LinearizationItem, Linearizer, ScopeId, TermKind, Unresolved, }, ...
use std::env; pub const BEGINNER: &str = "beginner"; pub const INTERMEDIATE: &str = "intermediate"; pub const EXPERT: &str = "expert"; /** * Minesweeper configuration options. * * minesweeper level [beginner|intermediate|expert] * * Its a bit messy, but the goal is to have everything compile down to constants. T...