text
stringlengths
3.09k
13.9k
//! Parser for `docker://` URLs. //! //! This module provides support for parsing image references. //! //! ## Example //! //! ```rust //! # extern crate dkregistry; //! # fn main() { //! # fn run() -> dkregistry::errors::Result<()> { //! # //! use std::str::FromStr; //! use dkregistry::reference::Reference; //! //! //...
use inflector::string::pluralize; use std::collections::BTreeMap; use std::rc::Rc; pub(crate) fn get_default_modifiers() -> BTreeMap<String, Rc<dyn Fn(&str) -> String>> { let mut modifiers = BTreeMap::new(); let capitalize = |s: &str| { let mut iter = s.chars(); let u = iter.next().map(|c| c.t...
use std::collections::HashMap; // ================================================== STRUCTS ================================================== type Code = String; type Digit = u64; pub struct EntryProblem { map_codes: HashMap<Code, Vec<Digit>>, output_codes: Vec<Code>, output: Vec<Option<...
use std::{collections::HashMap, sync::Arc}; use crate::{ devices, ids::{DeviceId, NodeId, PortId}, node::*, }; use arc_swap::ArcSwap; use rivulet::{circular_buffer::Sink, View, ViewMut}; use tokio::sync::Mutex; pub struct Output { id: NodeId, inputs: PortStorage, outputs: PortStorage, sink...
//! Schema syntax tree traversal. //! //! Each method of [`SchemaVisitor`] is a hook that can be overridden to customize the behavior when //! visiting the corresponding type of node. By default, the methods don't do anything. The actual //! walking of the ast is done by the `walk_*` functions. So to run a visitor over...
use super::{ Error, OneOrMany::{self, Many}, PartnerInfo, Structure, }; use chrono::{DateTime, TimeZone, Utc}; use common::model::{opportunity::EntityType, Opportunity}; use common::ToFixedOffset; use serde_json::Value; #[derive(Debug)] pub struct EventsJson<Tz: TimeZone>(pub PartnerInfo<Tz>); #[derive(se...
mod listen; mod workspaces; pub mod xwindows; pub use self::listen::listen; pub use self::workspaces::*; use crate::wm::atom; use xcb_util::ewmh; pub fn connect_ewmh() -> Result<(ewmh::Connection, i32), &'static str> { let (connection, screen_num) = xcb::Connection::connect(None) .map_err(|_| "could not ...
use crate::config::Configuration; use crate::emitters::metrics_emitter::MetricsEmitter; use crate::structs::{Container, WorkloadDefinition}; use crate::traits::EventEmitter; use clap::crate_version; use cri::console::ConsoleSocket; use cri::container::{CreateArgs, DeleteArgs, Runc}; use node_metrics::metrics_manager::M...
use futures::{SinkExt, StreamExt, channel::{mpsc, oneshot}, join, select, stream::FuturesUnordered}; use tokio::{ sync::watch, time::{interval, sleep, Duration}, }; use tokio_stream::wrappers::{IntervalStream, WatchStream}; use tracing::instrument; #[derive(Debug)] enum Request { Echo(oneshot::Sender<u32>,...
//! `NdSlice` wraps `&[T]` to represent an immutable n-dimensional array use std::ops::Index; use std::slice; use crate::addressing::{Order, address}; use crate::errors::ShapeError; #[derive(Debug, Clone)] /// `NdSlice` wraps `&[T]` to represent an immutable n-dimensional array /// /// ``` /// # use nd_slice::{NdSlic...
use crate::proto::message_out::{ criminal_list::{criminal::CrimeType, Criminal}, CriminalList, }; use tofn::collections::TypedUsize; use tofn::gg20::keygen::malicious::Behaviour::{self, *}; use super::super::{run_test_cases, TestCase}; use super::{Disrupt, MaliciousData, Timeout}; use tracing_test::traced_te...
use std::fmt; use std::ops::{Deref, DerefMut}; use std::str::FromStr; use crate::types::{DecryptionKey, EncryptionMethod, ProtocolVersion}; use crate::utils::tag; use crate::{Error, RequiredVersion}; /// # [4.3.4.5. EXT-X-SESSION-KEY] /// The [`ExtXSessionKey`] tag allows encryption keys from [`Media Playlist`]s /// ...
use std::result; use chrono::Duration; use futures::Future as _Future; use futures::*; use http::{header::USER_AGENT, HeaderMap, HeaderValue}; use hyper::{Body, Client, Uri}; use hyper_tls::HttpsConnector; use reqwest::ClientBuilder; use semver::Version; use serde_json::Value; use crate::ps::agent::config; use crate:...
extern crate z80e_core_rust; extern crate goss; mod mmu; mod stdio_dev; mod disk; mod debug; use mmu::{ Memory, MMU }; use stdio_dev::{ StdioDevice }; use disk::{ Disk, Protection }; use z80e_core_rust::Cpu; use debug::DebugDevice; use std::io::{ Read, Write }; use std::str::FromStr; use std::env; use std::fs::Fil...
// https://rust-lang.github.io/rust-clippy/stable/index.html #![warn(clippy::pedantic)] // This lint is too noisy and enforces a style that reduces readability in many cases. #![allow(clippy::module_name_repetitions)] mod cli; use cargo_metadata::MetadataCommand; use clap::ArgMatches; use libcnb_cargo::cross_compile::...
//! [`defmt`](https://github.com/knurling-rs/defmt) global logger over RTT. //! //! NOTE when using this crate it's not possible to use (link to) the `rtt-target` crate //! //! To use this crate, link to it by importing it somewhere in your project. //! //! ``` //! // src/main.rs or src/bin/my-app.rs //! use defmt_rtt ...
//! This example shows two ways to set up logging in games, using the `log` crate macros with `fern` //! frontend, to display neatly formatted console output and write same output to a file. //! //! Output in question is a trace of app's initialization, and keyboard presses when it's running. //! //! `fern` provides a ...
use super::{owned::*, AVResult}; use crate::ffi::*; use std::fmt::Debug; use std::path::Path; #[derive(Copy, Clone, Default, Debug)] pub struct FrameInfo { pub codec_id: AVCodecID, pub codec_type: AVMediaType, } pub struct FrameIter<'a> { reader: &'a mut SimpleReader, frame_infos: Vec<FrameInfo>, } i...
use pom::parser::*; use crate::ast::*; use crate::ast::Ast::*; use std::iter::FromIterator; fn comment<'a>() -> Parser<'a, char, ()> { let comment_text = not_a(|c| c == '\r' || c == '\n' || c == ';').repeat(0..).convert(|com| { let ct: String = com.into_iter().collect(); match &ct[..] { ...
use core::hash::Hash; use std::{collections::HashSet, rc::Rc}; use awsm_web::audio::AudioClipOptions; use components::audio::mixer::{AudioHandle, AudioPath, AUDIO_MIXER}; use dominator::{clone, html, Dom}; use crate::edit::sidebar::settings::{ actions::{set_active_popup, update_jig_settings}, dom::STR_BACK_TO...
use robo::Robo; use ctl::RoboCtl; use config::*; use std::sync::{Arc, Mutex, RwLock, Barrier, RwLockReadGuard}; use std::sync::mpsc::{Receiver, Sender, channel}; use std::thread; use std::time::Instant; use std::fmt::Debug; pub struct Bullet { pub pos: Vector2, pub vel: Vector2, pub power: f64, } pub str...
use std::fmt::{self, Write}; use std::ops::{Deref, DerefMut}; use crate::arguments::Arguments; use crate::encode::{Encode, IsNull}; use crate::error::Error; use crate::ext::ustr::UStr; use crate::postgres::{PgConnection, PgTypeInfo, Postgres}; use crate::types::Type; // TODO: buf.patch(|| ...) is a poor name, can we ...
const WIDTH: usize = 64; const HEIGHT: usize = 32; pub const NUM_PIXELS: usize = HEIGHT * WIDTH; pub struct Display { memory: [bool; NUM_PIXELS], fontset: [u8; 80] } impl Display { pub fn new() -> Display { Display { memory: [false; NUM_PIXELS], fontset: [ 0...
use crate::certificate::{PoolId, PoolRegistration}; use crate::header::Epoch; use crate::value::Value; use imhamt::Hamt; use std::collections::hash_map::DefaultHasher; use std::fmt::{self, Debug}; use std::sync::Arc; /// A structure that keeps track of stake keys and stake pools. #[derive(Clone, PartialEq, Eq)] pub st...
use serde::{Deserialize, Serialize}; use std::error::Error; use std::net::Ipv4Addr; use warp::{http, Filter}; mod db; use db::{Book, BooksMgr}; const LISTEN_ADDRESS: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1); const LISTEN_PORT: u16 = 8181; const RSC_VERSION: &str = "v1"; const RSC_NAME: &str = "books"; const PAYLOAD_L...
pub(in crate::erts) mod atom; pub mod binary; mod boxed; mod closure; mod float; pub mod index; mod integer; pub mod list; mod map; pub mod pid; mod port; pub mod reference; pub mod resource; mod term; pub(in crate::erts) mod tuple; mod typed_term; pub use atom::*; pub use binary::*; pub use boxed::*; pub use closure:...
//! # Shortest path problem use std::fmt::{Display, Formatter, Result as FormatResult}; use std::fmt; use std::ops::{Add, AddAssign}; use crate::algorithm::two_phase::matrix_provider::column::Column; use crate::algorithm::two_phase::matrix_provider::MatrixProvider; use crate::data::linear_algebra::matrix::{ColumnMajor...
//! AWS Regions and helper functions. //! //! Mostly used for translating the Region enum to a string AWS accepts. //! //! For example: `UsEast1` to "us-east-1" use std::error::Error; use std::str::FromStr; use std::fmt::{Display, Error as FmtError, Formatter}; /// An AWS region. /// `CnNorth1` is currently untested ...
//! Platform-agnostic Rust driver for the DHT11 temperature and humidity sensor, //! using [`embedded-hal`](https://github.com/rust-embedded/embedded-hal) traits. //! //! # Examples //! //! An example for the STM32F407 microcontroller can be found in the source repository. //! //! ``` //! // Open drain pin compatibible...
//! Types and traits related to serializing values for the database use std::error::Error; use std::fmt; use std::io::{self, Write}; use std::ops::{Deref, DerefMut}; use std::result; use backend::Backend; use sql_types::TypeMetadata; #[cfg(feature = "postgres")] pub use pg::serialize::*; /// A specialized result ty...
// Copyright 2022 <NAME>. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writ...
use serde_json::{Value, Map, Number}; use std::collections::HashMap; use super::{RbAny, RbClass, RbHash, RbObject, RbRef, RbUserData, rc_get_ptr}; pub struct RbToJson { seen: HashMap<*const RbRef, usize>, next_id: usize, } impl RbToJson { pub fn new() -> Self { Self { seen: HashMap::ne...
use crate::boards::cursor::Cursor; use crate::boards::idx_coord::BoardCoord; use crate::boards::set_board_size; use crate::chess::game_types::get_chess_game_type; use crate::chess::renderer::render; use crate::chess::{Move, State}; use crate::constants::AI_MOVE_DELAY; use crate::system::find_nearest::find_nearest; use ...
// 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. //! Target-side test runner for a power failure test on blobfs, verifying the filesystem with fsck //! after a soft reboot. //! //! This rust handles the b...
use super::super::model::*; use flo_ui::*; use flo_binding::*; use flo_animation::*; use std::sync::*; use std::time::Duration; /// /// The display style for the frame indicator text /// #[derive(Clone, Copy, PartialEq)] enum FrameDisplayStyle { TimeOffset, FrameNumber } /// /// The frame controls allows fo...
#[macro_use] extern crate lazy_static; extern crate pest; #[macro_use] extern crate pest_derive; use yew::prelude::*; use yew::ComponentLink; use yew::ShouldRender; mod convert_chart; mod parser; mod test; enum Msg { AddText(String), } struct Model { // `ComponentLink` is like a reference to a component. ...
// pathfinder/path-utils/src/normals.rs // // Copyright © 2018 The Pathfinder Project Developers. // // 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...
#![feature(result_option_inspect)] #![feature(async_closure)] mod app; mod cmd; mod config; mod consts; mod dns; mod handlers; mod local_config; mod log; mod manager; mod saml_server; mod state_manager; mod storage; mod task; use crate::app::{State, VpnApp}; use crate::cmd::kill_openvpn; use crate::consts::*; use cra...
use std::{fs::File, io::Read}; use bevy::{prelude::*, utils::HashSet}; use bevy_ecs_tilemap::{MapQuery, Tile, TileParent, TilePos}; use crate::{ combat::{CombatState, ExitPlacementState}, loading::TextureAssets, map::{ HighlightTile, TileInBoundsEvent, UnitTile, HIGHLIGHT_OVERLAY_LAYER_ID, MAP_ID,...
//! I2C driver for PIC32 use crate::pac::{I2C1, I2C2}; use crate::time::Hertz; use crate::dma; use crate::int::InterruptSource; use embedded_hal::blocking; use mips_mcu::PhysicalAddress; use mips_mcu::fmt::virt_to_phys; /// I2C clock frequency specifier /// The values of this enum correspond to the divisor values men...
//! Window expectation-maximisation ("EM") algorithm. use std::{collections::VecDeque, io}; use crate::{ saf::{BlockIterator, ParSiteIterator}, sfs::log_sfs, stream::{Header, Reader}, Em, Sfs, UnnormalisedSfs, }; mod builder; pub use builder::WindowBuilder; mod stop; pub use stop::StoppingRule; pub...
use crate::css::{CssString, Value}; use crate::value::{ListSeparator, Numeric, Quotes}; use num_traits::Zero; use std::fmt; /// An operator that can be used in a sass value. #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub enum Operator { /// The boolean (value propagating) `and` operator. And, ...
use cssparser::ParseError; use scraper::{Html, Selector}; use selectors::parser::SelectorParseErrorKind; use serde::{Deserialize, Serialize}; use std::collections::btree_map::{BTreeMap, Entry}; use std::io::{stdin, stdout, Write}; const BASE_URL: &str = "https://dle.rae.es"; #[derive(Debug, Clone, Deserialize, Seria...
use std::cell::RefCell; use std::rc::Rc; use std::sync::Arc; use cita_trie::MemoryDB; use rand::rngs::OsRng; use async_trait::async_trait; use common_crypto::{ Crypto, PrivateKey, PublicKey, Secp256k1, Secp256k1PrivateKey, Signature, ToPublicKey, }; use framework::binding::sdk::{DefalutServiceSDK, DefaultChainQue...
// Copyright (c) 2017-present PyO3 Project and Contributors //! Python type object information use crate::once_cell::GILOnceCell; use crate::pyclass::{initialize_type_object, PyClass}; use crate::pyclass_init::PyObjectInit; use crate::types::{PyAny, PyType}; use crate::{ffi, AsPyPointer, PyNativeType, Python}; use par...
use { bincode::{Options, Result}, bitflags::bitflags, serde::Serialize, std::{ fmt, io, net::{IpAddr, Ipv4Addr, SocketAddr}, }, }; /// Maximum over-the-wire size of a Transaction /// 1280 is IPv6 minimum MTU /// 40 bytes is the size of the IPv6 header /// 8 bytes is the size o...
mod r#impl; mod poll_filter; mod poll_manager; mod web3_types; use std::sync::Arc; use jsonrpsee::http_server::{HttpServerBuilder, HttpServerHandle}; use jsonrpsee::ws_server::{WsServerBuilder, WsServerHandle}; use jsonrpsee::{core::Error, proc_macros::rpc}; use common_config_parser::types::ConfigApi; use protocol::...
// Authentication utilities for Last.fm Scrobble API 2.0 use std::collections::HashMap; #[derive(PartialEq, Debug)] pub struct Credentials { // Application specific key & secret api_key: String, api_secret: String, // Individual user's username & pass, or auth token credentials: Option<Credentials...
//! Install Nomad. use crate::checkpoint::check; use crate::common::opt_string_to_opt_str; use crate::releases::*; use super::Command; use std::fs::OpenOptions; use std::io::Write; use std::os::unix::fs::OpenOptionsExt; use std::path::Path; use std::path::PathBuf; use clap::App; use clap::Arg; use clap::ArgMatches;...
//! An Entry is a unit of data in a Holochain Source Chain. //! //! This module contains all the necessary definitions for Entry, which broadly speaking //! refers to any data which will be written into the ContentAddressableStorage, or the EntityAttributeValueStorage. //! It defines serialization behaviour for entries...
/* * Pulsar Admin REST API * * This provides the REST API for admin operations * * The version of the OpenAPI document: v2 * * Generated by: https://openapi-generator.tech */ #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct LoadReport { #[serde(rename = "name", skip_serializing_if = "Optio...
// Copyright 2021. The Tari Project // // 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 copyright notice, this list of conditions and the following // disclai...
use anyhow::{/* anyhow, */Result}; use crossterm::{ style::{ Color} }; use crossterm::event::{KeyCode, Event}; use crate::primitive::Screen; use crate::ui::{Widget,Context,Transition,Dialog,Msg,NOTHING,Command}; use crate::strs; pub struct ListItem { text: String, submenu: Option<Dialog>, command: Comman...
#![allow(non_snake_case)] extern crate clap; extern crate bulletproofs; extern crate curve25519_dalek; extern crate rand; extern crate merlin; use clap::{Arg,App,SubCommand}; use bulletproofs::r1cs::*; use bulletproofs::{BulletproofGens, PedersenGens}; use curve25519_dalek::ristretto::CompressedRistretto; use curve25...
//! A scrapper module intended to work together with the `ThreadPool`'s workers. //! //! Scrapes the page for needed data and returns it back to the main thread. use crate::{ScrapeData, ScrapeParam}; use reqwest::Url; use select::document::Document; use select::predicate::{Element, Name, Predicate}; use snailquote::une...
use crate::{ nvector_to_lat_long, xyz2r, zyx2r, Angle, GeocentricPos, GeodeticPos, Length, LongitudeRange, Mat33, Model, Vec3, }; #[derive(Clone, Copy, Debug, PartialEq)] pub struct Delta(Length, Length, Length); impl Delta { pub fn new(x: Length, y: Length, z: Length) -> Delta { Delta(x, y, z) ...
use std::collections::{HashMap, HashSet}; struct WordlSolver { word_len: usize, target_words: Vec<String>, guess_words: Vec<String>, // These hashmaps can be replaced with an array to be faster letters: Vec<HashSet<char>>, known_good: HashSet<char>, } impl WordlSolver { pub fn new(word_len...
use std::collections::HashMap; use std::io; use std::io::Write; use reqwest::blocking::Client; use reqwest::header; use std::env; use std::process; use notion_clipper_cli::NotionPage; use notion_clipper_cli::NotionParent; use notion_clipper_cli::NotionConfig; use notion_clipper_cli::NotionDatabase; use notion_clipper_...
extern crate uri; use std; use std::net::TcpStream; use std::io::{BufReader, BufRead, Read}; use uri::*; use http::model::*; use std::time::Duration; const MAX_START_LEN: usize = 8192; pub struct HttpRequestParser { buffer: Vec<u8> } //TODO: create context which owns the stream and provides response capabilities /...
use self::inbound::InboundSegments; use self::outbound::OutboundSegments; use crate::drivers::ble::mesh::driver::DeviceError; use crate::drivers::ble::mesh::generic_provisioning::GenericProvisioningPDU; use crate::drivers::ble::mesh::provisioning::ProvisioningPDU; mod inbound; pub(crate) mod outbound; pub struct Segm...
// Copyright 2020 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 afm; use glob::glob; use pom; use proc_macro2::{Ident, Span}; use quote::quote; use std::error::Error; use std::io::Write; use std::path::Path; use std::{char, u32}; use std::{env, fs}; use inflector::cases::pascalcase::to_pascal_case; use inflector::cases::snakecase::to_snake_case; const GLYPH_LIST: &'static st...
//! Libra configuration builder. //! //! Parts adapted from upstream Libra's `SwarmConfigBuilder`: //! <https://github.com/libra/libra/blob/master/config/config-builder/src/swarm_config.rs> use super::{ key_seed::KeySeed, keys::{ConsensusKeyPair, NetworkKeyPairs}, peer_info::{self, PeerInfo}, trusted_p...
use bytes::Bytes; use futures::{ future::{ok, poll_fn, Future}, prelude::*, stream, }; use http::{self, header}; use lazy_static::lazy_static; use mime_guess::guess_mime_type as guess_mime; use std::{ collections::HashMap, fmt, io, path::{Path, PathBuf}, sync::Arc, }; use tower_web::{ de...
use std::sync::Arc; use anyhow::{Context, Result}; use async_trait::async_trait; use chrono::Utc; use serde_derive::Serialize; use serde_json::Value as JsonValue; use sqlx::Acquire; use svc_agent::mqtt::{ IntoPublishableMessage, OutgoingEvent, OutgoingEventProperties, ShortTermTimingProperties, }; use uuid::Uuid; ...
use anyhow::{Context, Result}; use clap::{crate_description, crate_name, crate_version, App, AppSettings, Arg}; use colored::Colorize; use dirs::config_dir; use git2::Repository; use github_stats::Search; use itertools::Itertools; use lazy_static::lazy_static; use regex::Regex; use std::fmt::Display; use configuration...
use std::sync::mpsc::{channel, Receiver, Sender}; use core_data_structures::hashmap::HashMap; use core_img::Rgba8Image; use core_renderer::{Color, RenderBuilder, RenderCommand, SpriteTransform, TextureId}; use core_text::rasterizer::{CharacterRecord, TextRasterizer}; pub fn build<'a>( render_width: u32, rende...
use std::{collections::BTreeMap, iter::FromIterator, str::FromStr, error::Error}; use enquote::unquote; use crate::bnf_parser::SyntaxParser; type ParserError = lalrpop_util::ParseError<usize, String, &'static str>; fn first_unquoted_semi<S: AsRef<str>>(line: S) -> Option<usize> { let mut is_quoted = false; le...
use crate::models::reaction_role::ReactionRole; use crate::reaction_roles::State as RRState; use crate::util::get_client; use crate::ReactionRolesState; use serenity::model::channel::ReactionType; use serenity::prelude::*; use serenity::{ framework::standard::{macros::command, Args, CommandResult}, model::chann...
// Copyright (c) 2019 - 2020 ESRLabs // // 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 ...
use bincode::Options; use futures::{stream::StreamExt, SinkExt}; use reqwest::Url; use std::{ collections::{HashMap, LinkedList}, sync::{Arc, Mutex}, usize, }; use tokio::time::sleep; pub struct Douyu { color_tab: HashMap<String, String>, heartbeat: Vec<u8>, } impl Douyu { pub fn new() -> Self...
pub trait CmpWithoutModifiers { fn cmp_without_modifiers(self: &Self, other: &Self) -> bool; fn cmp_str_without_modifiers(self: &Self, other: &str) -> bool where Self: Parse + Sized { self.cmp_without_modifiers(&Self::parse_lossy(other.as_bytes())) } } /// General trait that each object m...
use std::{ self, ffi::{OsStr, OsString}, io::Write, path::{Path, PathBuf}, process::{Command, Stdio}, }; use std::borrow::Cow; use std::fs::{read_to_string, File}; use std::io::Read; use std::sync::Arc; use toml_edit::{Array, Document, Item, Table}; #[derive(Clone)] pub enum Channel { Stable, ...
//! Rust enums for Go (Golang) values of GOOS and GOARCH use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; #[derive(Debug, Fail)] pub enum GoError { #[fail(display = "Invalid GOOS string: {}", _0)] InvalidGoOs(String), #[fail(display = "Invalid GOARCH string: {}", _0)] InvalidGoArch(...
use crate::*; const MAX_POS: u32 = 10000; const MAX_RATIO: u32 = 10000; /// Represents an asset config. /// Example: /// 25% reserve, 80% target utilization, 12% target APR, 250% max APR, 60% vol /// no extra decimals, can be deposited, withdrawn, used as a collateral, borrowed /// JSON: /// ```json /// { /// "rese...
use crate::ast::Expr; use crate::config; use crate::input; use crate::output; use portaudio::PortAudio; use std::sync::atomic::AtomicBool; use std::sync::atomic::Ordering::SeqCst; use std::sync::Arc; use thread_priority::ThreadPriority; fn print_device_list(pa: &PortAudio) -> Result<(), portaudio::Error> { let ds ...
extern crate app_dirs; extern crate chashmap; extern crate concurr; extern crate libc; extern crate native_tls; extern crate num_cpus; #[allow(unused_extern_crates)] extern crate serde; #[macro_use] extern crate serde_derive; extern crate toml; mod args; mod certificate; mod configure; mod connection; mod inputs; mod ...
//! Physical memory allocation. use bitmap_allocator::BitAlloc; use spin::Mutex; use super::addr::{align_down, align_up, is_aligned, phys_to_virt, virt_to_phys, PhysAddr}; use crate::consts::PAGE_SIZE; use crate::error::HvResult; // Support max 1M * 4096 = 1GB memory. type FrameAlloc = bitmap_allocator::BitAlloc1M;...
#![allow(unused_imports)] use crate::error::AlternateScreenPagingError; use crate::Pager; use crossterm::{ cursor::{self, MoveTo}, event::{self, Event, KeyCode, KeyEvent, KeyModifiers}, style::Attribute, terminal::{Clear, ClearType}, }; use std::{convert::TryFrom, time::Duration}; #[derive(PartialEq, C...
/* * Copyright 2021 Aon Cyber Solutions * * 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 ag...
//! Async low power Serial. //! //! The peripheral is autmatically enabled and disabled as required to save power. //! Lowest power consumption can only be guaranteed if the send receive futures //! are dropped correctly (e.g. not using `mem::forget()`). use core::future::Future; use core::marker::PhantomData; use cor...
//! A cross-platform laser DAC detection and streaming API. pub extern crate ether_dream; pub mod ffi; pub mod lerp; pub mod point; pub mod stream; pub mod util; pub use lerp::Lerp; pub use point::{Point, RawPoint}; pub use stream::raw::Buffer; pub use stream::raw::Stream as RawStream; pub use stream::frame::Frame; ...
//! Traits to definite units that define distances use crate::position::Position; pub use leafwing_2d_macros::TrivialCoordinate; use std::{fmt::Debug, ops::*}; /// A type that can be used as a coordinate type for [`Position`] /// /// Typically, you will want to use one of a few strategies for your [`Coordinate`] type...
use std::{ fs::File, io::{self, BufReader, Write}, }; use semver::Version; use serde::{Deserialize, Serialize}; use casper_execution_engine::core::engine_state::ExecutableDeployItem; use casper_node::{ crypto::asymmetric_key::SecretKey, rpcs::{account::PutDeploy, chain::GetBlockResult, info::GetDeploy...
extern crate more_asserts; use crate::{gradient::{BlendType, ColorKey, ColorKeyGradient}, noisegen::{MountainousTerrainNoise, Noise2D}, unity::{Position2D32, Color32}}; use std::{panic}; use std::ptr; use log::info; use rayon::{prelude::*}; pub trait TextureGen2D { fn get(&self, pos: Position2D32) -> f64; fn ...
#![allow(clippy::or_fun_call)] mod error; #[cfg(test)] mod tests; mod tx; use std::collections::HashSet; use std::iter::FromIterator; use std::result; use std::sync::Arc; use datastore::{ key::{self, Key}, query, Batching, Datastore, Read, SyncQuery, TxnDatastore, Write, }; use error::*; // re-export pub use...
//! # Batcher's Odd-even merge sort //! //! A nonadaptive sorting algorithm that can easily run in parallel. use perfect_shuffle::{shuffle, unshuffle}; // The correctness of Batcher's odd-even merge can be proved by 0-1 principle. Here is another // explanation which is easier to understand: // // To sort `a` (ascend...
//! The REPL use super::{do_the_thing, parse_expressions}; use ast; use env::Environment; use error::{print_error, REPLError, ParseError}; use parser; use lalrpop_util::ParseError as PopParseError; use rustyline; use rustyline::error::ReadlineError; use rustyline::Editor; use rustyline::completion::{extract_word, C...
use std::sync::Arc; use twilight_model::guild::Permissions; use twilight_model::id::{ChannelId, GuildId, UserId}; use super::BotContext; use crate::cache::{CachedGuild, CachedMember}; use crate::commands::meta::nodes::{CommandNode, GearBotPermissions}; use crate::commands::ROOT_NODE; use crate::core::guild_config::{G...
use core::time; use std::{ collections::HashMap, path::Path, sync::{RwLockReadGuard, RwLockWriteGuard}, thread, time::SystemTime, }; use anyhow::{anyhow, Result}; use db::{DB, DB_NAME}; use reddit::{query_page, Post}; use rid::RidStore; use crate::reddit::{query_score, Score, RESOLUTION_MILLIS}; ...
//! # Find availability from two calendars //! //! Question from this [YouTube video](https://www.youtube.com/watch?v=3Q_oYDQ2whs) - <NAME> //! //! ## Parameters: //! - **Two calendars** - where a calendar is `[(String, String), ...]` where the tuple is `(start_time, end_time)` //! - The time is in military time an...
//! Collection of some abstractions and the error definition used by this PoC. /// Errors that can occur in this PoC. #[derive(Debug)] pub enum Error { /// Failed to open and read the `/proc/self/maps` file. FailedToReadMaps, /// Failed to a parse line from the `/proc/self/maps` file. /// Captures line...
/* Copyright (c) 2016-2017, <NAME> <<EMAIL>> 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 copyright notice, this list of conditions and the ...
// Environments store variables (as name-value pairs). use cell_gc::{GcHeapSession, GcLeaf}; use cell_gc::collections::VecRef; use errors::Result; use value::{InternedString, Lambda, Value}; use vm; #[derive(IntoHeap)] pub struct StaticEnvironment<'h> { pub parent: Option<StaticEnvironmentRef<'h>>, pub names:...
//! General purpose combinators use nom::bytes::streaming::take; use nom::error::ParseError; use nom::{IResult, InputLength, ToUsize}; use nom::{InputIter, InputTake}; /// Create a combinator that returns the provided value, and input unchanged pub fn pure<I, O, E: ParseError<I>>(val: O) -> impl Fn(I) -> IResult<I, O...
//! A collection of reinforcement learning benchmark domains. #[macro_use] extern crate ndarray; extern crate spaces; extern crate rand; use crate::spaces::Space; use std::iter; macro_rules! impl_into { (Transition < S, $type:ty > => Transition < S,() >) => { impl<S> Into<Transition<S, ()>> for Transition...
// ignore-windows: Concurrency on Windows is not supported yet. use std::cell::RefCell; use std::thread; struct TestCell { value: RefCell<u8>, } impl Drop for TestCell { fn drop(&mut self) { for _ in 0..10 { thread::yield_now(); } println!("Dropping: {} (should be before 'Continue main 1').",...
use crate::{lapack, Scalar}; use ndarray::{s, Array1, ArrayBase, DataMut, Ix2}; use std::cmp; use std::ops::{Div, MulAssign}; /// Computes the QR factorization of a matrix. pub fn geqrf<A, S>(a: &mut ArrayBase<S, Ix2>) -> Array1<A> where A: Scalar + Div<<A as Scalar>::Real, Output = A> + MulAssign<<A as Scalar>::R...
use std::error::Error; use std::time::SystemTime; use mal_plan::manga; use mal_plan::{ read_handled_items, write_handled_items, Cache, Config, HandledHow, HandledItem, InputOptions, Item, ListType, Options, }; use console::Term; use directories::ProjectDirs; use indicatif::{ProgressBar, ProgressStyle}; const...
extern crate env_logger; extern crate log; use b7::brute::InstCounter; use b7::errors::*; use b7::generators::Input; use b7::generators::MemInput; use b7::*; use clap::{App, Arg}; use log::debug; use std::collections::HashMap; use std::os::unix::ffi::OsStrExt; use std::process::exit; use std::time::Duration; use is_...