text
stringlengths
3.09k
13.9k
use crate::client::builder::ClientConfigBuilder; use crate::error::Error; use crate::kx::{SupportedKxGroup, ALL_KX_GROUPS}; use crate::msgs::enums::ProtocolVersion; use crate::server::builder::ServerConfigBuilder; use crate::suites::{SupportedCipherSuite, DEFAULT_CIPHERSUITES}; use crate::versions; /// Building a [`Se...
use super::gtk_widget_event_type::*; use flo_ui::*; use flo_canvas::*; use gtk::*; /// ID used to identify a Gtk window #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] pub enum WindowId { Unassigned, Assigned(i64) } /// ID used to identify a Gtk widget #[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)] p...
use procspawn::JoinHandle; use deadqueue::unlimited; use serde::Serialize; use serde::de::DeserializeOwned; use std::sync::Arc; use tokio::sync::oneshot::Sender; use tokio::sync::{oneshot}; use std::marker::PhantomData; use crate::CubeError; use ipc_channel::ipc; use ipc_channel::ipc::{IpcSender, IpcReceiver}; use log:...
// Copyright 2019 Parity Technologies (UK) Ltd. // // Permission is hereby granted, free of charge, to any // person obtaining a copy of this software and associated // documentation files (the "Software"), to deal in the // Software without restriction, including without // limitation the rights to use, copy, modify, ...
use core::fmt; use napi::threadsafe_function::{ThreadsafeFunction, ThreadsafeFunctionCallMode}; use napi::Result; use opentelemetry::global; use opentelemetry::sdk::propagation::TraceContextPropagator; use opentelemetry::{ sdk::{trace::Config, Resource}, KeyValue, }; use opentelemetry_otlp::WithExportConfig; us...
//! //! The sort tool sorts JSON arrays, optionally using a supplied tool name //! use std::cmp::*; use std::result::Result; use serde_json::*; use gossyp_base::*; use super::compare::*; /// /// Parameters that can be passed to the sort tool /// #[derive(Serialize, Deserialize)] pub struct SortParameters { /// V...
// Vorbis decoder written in Rust // // Copyright (c) 2016 est31 <<EMAIL>> // and contributors. All rights reserved. // Licensed under MIT license, or Apache 2 license, // at your option. Please see the LICENSE file // attached to this source distribution for details. extern crate test_assets; extern crate lewton; #[m...
// Copyright (c) Microsoft. All rights reserved. use std::sync::{Arc, Mutex}; use failure::{Fail, ResultExt}; use futures::{Future, IntoFuture, Stream}; use hyper::header::{CONTENT_LENGTH, CONTENT_TYPE}; use hyper::{Body, Request, Response, StatusCode}; use serde::Serialize; use serde_json; use edgelet_core::{Identi...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT mod app_launch_context; pub use self::app_launch_context::AppLaunchContext; mod cursor; pub use self::cursor::Cursor; mod device; pub use self::device::Device; mod device_manager;...
use std::fmt::{Formatter, Display}; use thiserror::Error as Error; use crate::convert::Argument; #[derive(Copy, Clone, Debug)] /// Non-R18 by default. pub enum R18 { NonR18, R18, Mixin, } #[derive(Debug, Clone)] /// Not very convenient. you should consider use tags instead. pub(crate) struct Keyword(pub(c...
mod statedb; mod staterocksdb; mod version; use crate::rwset::key::CompositeKey; use error::*; use silk_proto::VersionedValueProto; pub use statedb::*; pub use staterocksdb::*; pub use version::{are_same, Height}; // VersionedDBProvider provides an instance of an versioned DB pub trait VersionedDBProvider { type ...
pub mod raster_floating; pub mod raster_fixed; pub mod vector; pub enum Op { Over, Src, } // Raster is a 2-D vector graphics rasterizer. // // The zero value is usable, in that it is a Rasterizer whose rendered mask // image has zero width and zero height. Call Reset to change its bounds. pub struct Rasterize...
use std::time::Duration; use bevy::prelude::*; /// Resource to control how many physics steps are performed per second. /// /// Note that the physics update will be performed at most once per frame. It means that if the rate of /// frames per second is lower than the physics step per second, the physics simulation wi...
// Testing strategy was inspired by https://github.com/anotherlin/z80emu const ZEXALL_IMAGE_BASE_ADDRESS: u16 = 0x0100; const ZEXALL_IMAGE: &[u8] = include_bytes!("assets/zexall.com"); const ZEXALL_TEST_POINTERS_TABLE_ADDRESS: u16 = 0x013A; const ZEXALL_BEGIN_MESSAGE_ADDRESS: u16 = 0x01DDA; const ZEXALL_END_MESSAGE_ADD...
//! Provides the parser for splits files used by the Llanfair Rewrite. use crate::{ xml_util::{end_tag, parse_base, parse_children, single_child, text, text_err, text_parsed}, RealTime, Run, Segment, Time, TimeSpan, }; use byteorder::{ByteOrder, BE}; use core::cmp::min; use image::{codecs::png, ColorType, Imag...
use std::collections::HashMap; use bevy::prelude::*; use bevy_rapier3d::physics::InteractionPairFilters; use bevy_rapier3d::rapier::dynamics::RigidBodyBuilder; use bevy_rapier3d::rapier::geometry::ColliderBuilder; use crate::in_game::TiedToGame; use crate::physics::OneWayPlatformHook; pub struct GameAreaPlugin<T>(pu...
mod mj; mod mjsys; use git_version::git_version; use actix_web::{get, post, web, App, HttpResponse, HttpServer, Responder}; use serde::{Serialize, Deserialize}; use std::collections::BTreeMap; use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::RwLock; // from build system const GIT_VERSION: &str = git_vers...
use std::{ default::Default, net::{IpAddr, Ipv4Addr, SocketAddr}, path::{Path, PathBuf}, time::Duration, }; use protocol::ProtocolResult; use tentacle::{ multiaddr::{Multiaddr, Protocol}, secio::{PublicKey, SecioKeyPair}, }; use crate::{ common::socket_to_multi_addr, connection::Connec...
use crate::consensus_decode; use crate::bitcoin::{BlockHash, Transaction}; use std::sync::Arc; use tokio::sync::RwLock; use tokio::sync::watch::{Sender, Receiver, channel}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum ZeroMQMessage { HashBlock(BlockHash), RawTx(Transaction), Init, } use ZeroMQMessage::...
// Copyright 2021, The Tremor 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 t...
//! Sinks //! //! This module contains a number of functions for working with `Sink`s, //! including the `SinkExt` trait which adds methods to `Sink` types. use futures_core::{Stream, IntoFuture}; use futures_sink::Sink; mod close; mod fanout; mod flush; mod err_into; mod map_err; mod send; mod send_all; mod with; mo...
use gpio_cdev::EventType::{FallingEdge, RisingEdge}; use gpio_cdev::{Chip, EventRequestFlags, EventType, LineEventHandle, LineRequestFlags}; use nix::poll::{poll, PollFd, PollFlags}; use parking_lot::Mutex; use serde::export::Formatter; use std::fmt::Display; use std::os::unix::io::AsRawFd; use std::sync::mpsc::Sender;...
#[macro_use] extern crate lazy_static; #[macro_use] extern crate q_debug; use chrono; use regex::Regex; use std::env; use std::fs; use std::io::Read; use std::sync::Mutex; use std::thread::sleep; use std::time; lazy_static! { static ref QFILE: Mutex<fs::File> = { Mutex::new( fs::OpenOptions::...
//! Base curve implementation use solana_program::{ program_error::ProgramError, program_pack::{Pack, Sealed}, }; use crate::curve::{ calculator::CurveCalculator, constant_product::ConstantProductCurve, flat::FlatCurve, stable::StableCurve, }; use arrayref::{array_mut_ref, array_ref, array_refs, mut_a...
use crate::bit_functions::{reset, set, test}; use crate::cpu::{Z80}; use crate::graphics::{ColorPixel, SCREEN_HEIGHT, SCREEN_WIDTH}; use crate::memory::{DIV, MMU, TIMA, TMA, FRAMES_PER_SECOND, CLOCK_SPEED}; use crate::graphics::{CGBPalette, PALETTE_BGB}; pub struct Gameboy { pub memory: MMU, pub cpu: Z80, ...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ access_path::{AccessPath, Accesses}, account_config, contract_event::ContractEvent, discovery_info::DiscoveryInfo, event::{EventHandle, EventKey}, language_storage::{StructTag, TypeTag}, move_re...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::error::WalletError; use crate::mock::MemWalletStore; use crate::{Wallet, WalletAccount, WalletResult, WalletStore}; use anyhow::{format_err, Result}; use starcoin_crypto::ed25519::{Ed25519PrivateKey, Ed25519PublicKey}; us...
use crate::{ collections::CollectionBuilder, endpoints::Endpoint, errors::AtomicResult, urls, Commit, Resource, Storelike, }; pub fn version_endpoint() -> Endpoint { Endpoint { path: "/version".to_string(), params: [urls::SUBJECT.to_string()].into(), description: "Constructs a versi...
use common::*; impl GameState { fn isSelectrix(&self, id: usize) -> bool { self.entities[id].contains(Component::Player | Component::IntraCellPosition) && self.player_types[id] == PlayerType::Selectrix } fn isAvatar(&self, id: usize) -> bool { self.entities[id].contains(Compone...
// advent21.rs // RPG #[macro_use] extern crate scan_fmt; use std::io; use std::cmp::max; fn main() { let mut input = String::new(); let mut boss = Stats {hit_points: 0, damage: 0, armor: 0}; io::stdin().read_line(&mut input).ok().expect("Failed to read line"); let hit_points = scan_fmt!(&input, "Hi...
use super::CrateTrait; use crate::Workspace; use failure::{Error, ResultExt}; use flate2::read::GzDecoder; use log::info; use std::fs::File; use std::io::{BufReader, BufWriter, Read}; use std::path::{Path, PathBuf}; use tar::Archive; static CRATES_ROOT: &str = "https://static.crates.io/crates"; pub(crate) struct Alte...
use mica_hl::TypeBuilder; use super::{ref_self1, ref_self2}; pub(super) fn define(builder: TypeBuilder<f64>) -> TypeBuilder<f64> { builder // Constants .add_static("nan", || f64::NAN) .add_static("infinity", || f64::INFINITY) .add_static("epsilon", || f64::EPSILON) .add_static("e", ||...
pub mod visitor; use syntax::{Name, Span}; use syntax::token::{Lit, name}; use std::cell::{Cell, RefCell}; use std::collections::HashMap; use std::fmt; pub struct AstContext { pub functions: Vec<Box<Function>> } impl AstContext { pub fn new() -> AstContext { AstContext { fu...
extern crate glob; extern crate json_value_merge; extern crate json_value_resolve; extern crate serde; extern crate serde_json; #[macro_use] extern crate tracing; pub mod connector; pub mod document; pub mod helper; pub mod step; pub mod updater; use self::step::StepType; use async_std::task; use futures::stream::Str...
use std::iter; use std::marker::PhantomData; use tll::ternary::{Nat, Pred, NatPred, Triple, NatTriple, Add, NatAdd, Term, Zero, One, Two}; use iterator::{Iterator, NonEmpty}; pub struct Chain<A: Nat, B: Nat, I: Iterator<A>, J: Iterator<B, Item = I::Item>> { phantom: PhantomData<(A, B)>, first: I, second:...
// Copyright 2020 Google LLC // Copyright 2020 Team Spacecat // // 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...
/* Misc support code and specialization for eetf */ /* A simple Erlang port in Rust. */ use std::vec::Vec; use std::option::Option; use std::io::{Read, Write, Cursor, Result}; use eetf::{Term,Tuple,Atom,FixInteger,Binary,List}; /* Read */ fn read_u32be<Stream: Read>(s: &mut Stream) -> Result<u32> { let mut b : [u...
use std::collections::BTreeMap; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::PathBuf; fn parse(lines: Vec<String>) -> Result<Vec<Vec<u8>>, Box<dyn std::error::Error>> { let digits: Vec<Vec<u8>> = lines .iter() .map(|line| { line.chars() .map(|c| c...
use crate::{ ca::CertificateAuthority, handler::{HttpHandler, MitmFilter}, http_client::HttpClient, rule::Rule, }; use http::{header, uri::PathAndQuery, HeaderValue, Uri}; use hyper::{ body::HttpBody, server::conn::Http, service::service_fn, upgrade::Upgraded, Body, Method, Request, Response, };...
use std::marker::PhantomData; use std::ffi::CString; use std::ptr; use gl::types::*; use gl; use gfx::{ Context }; use gfx::vertex; use gfx::shader::{ UniformList, UniformListBuilder }; pub struct Program<'a, L: vertex::Layout, UL: UniformList> { pub (crate) ctx: &'a Context, pub (crate) id: GLuint, pub ...
use octocrab::{markdown, models, Octocrab}; use std::collections::HashSet; use std::env; use std::fs::File; use std::io::prelude::*; use std::sync::Arc; const FILE_TEMPLATE: &str = r#" --- title: 'This week in Open Source at simplabs #2' author: 'simplabs' github: simplabs twitter: simplabs topic: open-source bio: 'Th...
// Copyright 2021 Chiral Ltd. // Licensed under the Apache-2.0 license (https://opensource.org/licenses/Apache-2.0) // This file may not be copied, modified, or distributed // except according to those terms. //! //! Generation of canonicalized SMILES for molecules //! Use GIVP orbits directly, assume that GIVP or...
use std::fs::File; use std::io::{self, Read}; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use std::ops; use std::path::Path; use std::str::FromStr; use std::time::Duration; use domain::base::name::Dname; #[derive(Clone, Debug)] pub struct ResolvOptions { pub search: SearchList, pub ndots: usize, pub tim...
#![allow(dead_code)] use super::keyboard::KeyboardDispatcher; use super::pointer::*; use super::window::*; use crate::connection::ConnectionOps; use crate::spawn::*; use crate::timerlist::{TimerEntry, TimerList}; use crate::Connection; use anyhow::{anyhow, bail, Context}; use smithay_client_toolkit as toolkit; use std:...
use crate::errors::*; use crate::*; use byteorder::{BigEndian, ByteOrder}; use ipext::IpExt; use siphasher::sip128::Hasher128; use std::hash::Hasher; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; use std::sync::Arc; use tokio::net::UdpSocket; pub const ANONYMIZED_DNSCRYPT_QUERY_M...
#![feature(bronze_gc)] use std::cell::Cell; use std::rc::Rc; use backtrace::Backtrace; // Tests must be run sequentially because the shadow stack implementation does not support concurrency. // Unfortunately Rust doesn't support configuring tests to run with only one thread, so we have to use #[serial] on every test!...
use std::{ collections::{HashMap, HashSet}, hash::Hash, }; use log::debug; use crate::module_loader::{ModuleLoader, SOURCE_MAP}; use self::analyse::{ get_module_info_from_ast, parse_file, DynImportDesc, ExportDesc, ImportDesc, ReExportDesc, }; use crate::types::{shared, ModOrExt, ResolvedId, Shared}; pub mod a...
use html_escape::decode_html_entities; use nom::{error::ErrorKind, Err}; use parser::Tag; mod parser; const MAX_BUFFER_SIZE: usize = 4096; /// Contains meta information about a /// parsed HTML page. #[derive(Debug, Clone)] pub struct Meta { pub title: Option<String>, pub description: Option<String>, pub ...
// Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::{ capability::{CapabilityProvider, CapabilitySource, FrameworkCapability}, model::{ error::ModelError, ...
// src/contentful_client.rs use std::collections::HashMap; use crate::{http_client, json_util::merge, query_builder::QueryBuilder}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use serde_json::Value; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Entries<T> { pub entries: Vec<T>, p...
//! uvth is a library that provides a efficient threadpool as an alternative to the threadpool crate. //! //! uvth is more efficient and has less overhead than the threadpool crate. Benchmarks can be found in the README. #[macro_use] extern crate log; use crossbeam_channel::{unbounded, Receiver, Sender}; use std::syn...
use super::types::{URLRecord, URLRegistry}; use crate::import::v0_0_x; use crate::types::URLs; use crate::{Repository, RepositoryOld}; use std::collections::HashMap; use std::convert::TryInto; use std::error::Error; use std::fs; use std::fs::{File, OpenOptions}; use std::io::{Read, Seek, SeekFrom, Write}; use std::path...
extern crate serde; #[macro_use] extern crate serde_derive; extern crate solana_sdk; mod dashboard; mod error; mod game; mod program_command; mod program_state; mod simple_serde; use crate::error::TicTacToeError; use program_command::Command; use program_state::State; use simple_serde::SimpleSerde; use solana_sdk::{ ...
use crate::assets::SHEET_W; #[derive(Clone, Copy, PartialEq, Eq)] pub enum LR { Left, Right, } impl From<LR> for u16 { fn from(lr: LR) -> u16 { match lr { LR::Left => 0, LR::Right => 1, } } } #[derive(Clone, Copy, PartialEq, Eq)] pub enum LMR { Left, Mi...
// Copyright 2018 Cargill Incorporated // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agre...
extern crate rand; use self::rand::{XorShiftRng, Rng, SeedableRng}; use std; use super::*; use search_tree::*; pub trait TreePolicy<Spec: MCTS<TreePolicy=Self>>: Sync + Sized { type MoveEvaluation: Sync + Send; type ThreadLocalData: Default; fn choose_child<'a, MoveIter>(&self, moves: MoveIter, handle: S...
use super::p2p::P2pService; use crate::{error::Error, subscription::BlockEvent}; use chain_core::property::{Block, HasHeader}; use futures::prelude::*; use std::{error, fmt}; /// Interface for the blockchain node service responsible for /// providing access to blocks. pub trait BlockService: P2pService { /// Th...
use crate::protos::temporal::api::command::v1::CancelTimerCommandAttributes; use crate::{ machines::{ActivationListener, DrivenWorkflow, WFCommand}, protos::{ coresdk::{wf_activation_job::Attributes, TimerFiredTaskAttributes}, temporal::api::{ command::v1::StartTimerCommandAttributes...
use crate::build::{ ANIMATION_CONFIG_INPUT_FILE_NAME, ASSETS_FOLDER_NAME, ELEMENT_CONFIG_INPUT_FILE_NAME, }; use crate::data::animation::config::AnimationConfig; use crate::data::element::ElementsConfig; use crate::data::TemplateConfig; use crate::error::{simple_error, ZagreusError}; use crate::TEMPLATE_CONFIG_FILE...
use super::super::board::SudokuBoard; use super::super::solver::{Solver, Verification}; use super::{Difficulty, Generator, Puzzle}; use rand::prelude::*; use rand::seq::SliceRandom; use rand_pcg::Pcg64Mcg; /// Number of attempts of creating board with valid /// set of clues static CREATE_CLUE_ATTEMPTS: u32 = 5; /// G...
use std::ffi::{CString, CStr}; use std::process::exit; use std::path::{Path, PathBuf}; use clap::{App, Arg, crate_version}; use nix::mount::{mount, MsFlags}; use nix::sched::unshare; use nix::sched::CloneFlags; use nix::sys::wait::{wait, WaitStatus}; use nix::sys::stat::{mknod, makedev, Mode, SFlag}; use nix::unistd:...
use std::borrow::Borrow; use std::collections::HashMap; use std::hash::Hash; /// An ID being either a Matrix ID or an external ID for one object. #[derive(Debug, PartialEq, Eq, Hash)] pub enum MappingId<'a, E: ?Sized, M: ?Sized> { /// A reference to the ID of an external object. External(&'a E), /// A refe...
// // Copyright 2020 <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 agre...
use crate::api::*; use crate::methods; use crate::special_methods; use crate::GeneratorResult; use heck::CamelCase; use proc_macro2::TokenStream; use quote::{format_ident, quote}; use std::collections::HashSet; use std::io::Write; pub fn generate_class_struct(output: &mut impl Write, class: &GodotClass) -> Generator...
#![allow(dead_code)] pub use p_tokens::{PToken, PTokenAt, PTokenRange, PTokenRangeTo}; use std::{ collections::{BTreeMap, HashSet}, hash::Hash, }; use type_map::TypeMap; // impl NLPTokenSpan { // fn matches_text(&self, text: &str) -> bool { // self.tokens // .iter() // // T...
use crate::conf::MEM_OFF; #[derive(Debug)] pub struct Dram { memory: Vec<u8>, } impl Dram { pub fn new(mem_size: usize) -> Dram { Dram { memory: vec![0; mem_size], } } #[inline(always)] fn set_mem(&mut self, idx: usize, data: u8) { if self.memory.len() < idx { ...
pub mod parser; use std::path::PathBuf; use std::{fs::read_to_string, rc::Rc}; use crate::ast::parse_ast::*; use ahash::AHashMap; use lalrpop_util::lexer::Token; use self::parser::ProgramParser; use codespan_reporting::files::SimpleFiles; #[derive(Debug)] pub enum ParseErrorType { Syntax(SyntaxError), Unexpec...
//! A simple bitmap allocator used to allocate memory for the buddy allocator #[cfg(test)] use std::boxed::Box; use core::{mem, ptr::{self, Unique}}; use core::marker::PhantomData; use core::ops::{Deref, DerefMut}; use spin::{Once, Mutex}; use bit_field::BitField; use super::{physical_allocator::BLOCKS_IN_TREE, buddy_...
use std::cmp::min; use rust_decimal::{prelude::Zero, Decimal}; use super::{queue::ResultQueue, Order, OrderQueue, OrderSide}; pub struct OrderBook { pub symbol: String, pub buy_queue: OrderQueue, pub sell_queue: OrderQueue, pub result_queue: Option<Box<dyn ResultQueue + Send + Sync>>, } impl OrderBoo...
type Point = (f64, f64); use std::cmp::Ordering; fn point_cmp((a1, a2): &Point, (b1, b2): &Point) -> Ordering { let acmp = f64_cmp(a1, b1); match acmp { Ordering::Equal => f64_cmp(a2, b2), _ => acmp, } } fn f64_cmp(a: &f64, b: &f64) -> Ordering { a.partial_cmp(b).unwrap() } /// return...
use std::borrow::Borrow; #[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Clone)] pub struct MIDIMessageNote { pub channel: u8, pub note: u8, pub velocity: u8, } #[derive(Eq, Ord, PartialEq, PartialOrd, Debug, Clone)] pub enum MIDIMessage<Buffer: Borrow<[u8]>> { // 0x9 NoteOn(MIDIMessageNote), ...
use crate::crawler::Crawler; use kuchiki::traits::*; use lazy_static::lazy_static; use regex::Regex; use serde_json::Value; use std::fs::{self, File}; use std::io::Write; use std::path::PathBuf; pub fn crawl_users(crawler: &Crawler, output: PathBuf, users: Vec<String>) { for user in users { // Process the ...
mod config; mod device; use std::cell::RefCell; use std::convert::TryFrom; use std::fs::{self, File}; use crate::config::{Config, InfluxDbConfig}; use crate::device::Device; use chrono::Local; use clap::{app_from_crate, crate_authors, crate_description, crate_name, crate_version, Arg}; use ctrlc; use derive_more::{Di...
use notify::{watcher, DebouncedEvent, ReadDirectoryChangesWatcher, RecursiveMode, Watcher}; use std::sync::mpsc::channel; use std::sync::mpsc::Receiver; use std::{collections::HashMap, fs, path::Path, str::FromStr, time::Duration}; use log::{info, warn}; use regex::Regex; use serde::{Deserialize, Serialize}; use tokio...
pub mod jsont; pub mod stats; pub mod util; use std::ops::Range; use std::{borrow::Cow, convert::TryFrom}; use anyhow::Result; pub use self::jsont::{Match, Message, SubMatch}; /// Word represents the input query around by word boundries. #[derive(Clone, Debug)] pub struct Word { pub raw: String, pub len: us...
use log::warn; use ::prometheus::{Registry, Gauge, Encoder, TextEncoder}; use super::*; pub struct PrometheusRenderer { pub buffer: Vec<u8>, registry: prometheus::Registry, pub encoder: prometheus::TextEncoder, count: prometheus::Gauge, max: prometheus::Gauge, min: prometheus::Gauge, avg: ...
use std::ops::Deref; use std::rc::Rc; use webgl::WebGlShader as GLShader; use webgl::*; use errors::*; const NAME_SIZE: usize = 64; /// Shader Source #[derive(Debug)] pub struct GLShaderSource { kind: ShaderKind, source: String, } impl GLShaderSource { pub fn from_bytes<T: Into<Vec<u8>>>(kind: ShaderKi...
// Copyright 2020 Google LLC // // 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 ...
use crate::collections::HashMap; use crate::{IrError, IrErrorKind, Spanned}; use runestick::{Bytes, ConstValue, Shared, TypeInfo}; use std::convert::TryFrom; /// A constant value. #[derive(Debug, Clone)] pub enum IrValue { /// A constant unit. Unit, /// A byte. Byte(u8), /// A character. Char(c...
use crate::config::raw::{RawAction, RawChatConfig}; use carapax::types::{Integer, MentionError, ParseMode, User}; use liquid::{value::liquid_value, Error as TemplateError, ParserBuilder as TemplateParserBuilder, Template}; use std::{collections::HashMap, error::Error, fmt, sync::Arc, time::Duration}; pub const DEFAULT...
/* ================= MAIN =================*/ // personal imports mod config; mod ui; mod util; // control imports use std::io::{ stdin, stdout, Error}; use std::env; use termion::event::Key; use termion::input::TermRead; use termion::raw::IntoRawMode; use tui::style::{Color, Style}; #[tokio::main] async fn main() -...
// Copyright 2017-2019 <NAME> (nuew) // // 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...
use cfg_if::cfg_if; use wasm_bindgen; use web_sys; use wasm_bindgen::prelude::*; use ra_syntax::{ast, AstNode, TreeArc}; use ra_mbe::{MacroRules, ast_to_token_tree, token_tree_to_macro_stmts, token_tree_to_macro_items}; use ra_tt::Subtree; use serde_derive::Serialize; use std::collections::HashMap; cfg_if! { // Wh...
//! ActionScript Broadcaster (AsBroadcaster) use crate::avm1::error::Error; use crate::avm1::function::ExecutionReason; use crate::avm1::object::TObject; use crate::avm1::property::Attribute; use crate::avm1::property_decl::Declaration; use crate::avm1::{Activation, ArrayObject, AvmString, Object, ScriptObject, Value}...
//! Provides a method for presenting a prompt for user input that can be customized with [`actions`] //! and [`completions`]. //! //! The core functionality of this module is [`read_line`]. Its invocation can be cumbersome due //! to required type annotations, therefore this module also provider a [`Builder`] which hel...
mod opts; mod tchpad; mod win; use cairo::ffi::cairo_surface_t; use glib_sys::GList; use rofi_sys::{ helper::helper_token_match, mode::{ MENU_CANCEL, MENU_CUSTOM_ACTION, MENU_OK, MODE_EXIT, ModeMode, mode_get_private_data, mode_set_private_data, }, mode_private::{ABI_VERSION, Mode},...
// Copyright 2019 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 std::collections::HashMap; const DEFAULT_QUOTA: usize = 10000; pub struct KeyManager { key_quotas: HashMap<String, usize>, last_used: usize, } impl KeyManager { pub fn new(keys: Vec<String>) -> KeyManager { let mut map = HashMap::with_capacity(keys.len()); for key in keys { ...
use std::io; use std::io::Read; /// Track whether a stream has hit the end of file. /// /// This allows slightly nicer code when reading lots of items using an uncooperative api, /// or when you want an `UnexpectedEof` only after the first byte. /// It also simplifies determining the last chunk when processing /// inp...
// #[path = "gen/target_spec.rs"] // mod gen; use std::collections::BTreeMap; use duct::cmd; use once_cell::sync::Lazy; use serde::{Deserialize, Serialize}; use strum::{Display, IntoStaticStr}; // use self::gen::*; use super::*; pub fn gen() -> Result<()> { gen_target_spec()?; Ok(()) } pub static TARGET_SP...
use crate::fs::stdio; use crate::fs::File; use alloc::vec; use core::cell::RefMut; use alloc::{ sync::{Arc, Weak}, vec::Vec, }; use crate::{ config::TRAP_CONTEXT, mm::{ address::{PhysPageNum, VirtAddr}, memory_set::{MemorySet, KERNEL_SPACE}, }, sync::UniProcSafeCell, trap::...
// Copyright 2017-2020 Parity Technologies (UK) Ltd. // This file is part of Polkadot. // Polkadot 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) any...
// BSD 3-Clause License // Copyright (c) 2022, nxtlo // 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 o...
use { super::{ convert::{oom_error_from_erupt, ToErupt as _}, device::Device, device_lost, swapchain::SwapchainImage, unexpected_result, }, crate::{ encode::{CommandBuffer, Encoder}, fence::Fence, out_of_host_memory, queue::*, s...
use ark_std::{vec, vec::Vec}; macro_rules! adc { ($a:expr, $b:expr, &mut $carry:expr$(,)?) => {{ let tmp = ($a as u128) + ($b as u128) + ($carry as u128); $carry = (tmp >> 64) as u64; tmp as u64 }}; } /// Calculate a + b + carry, returning the sum and modifying the /// carry value. #[i...
use bronze::*; // Implements a doubly-linked list. // Lists live in the GC heap but are intended to be referenced from outside. pub struct List<T> where T: 'static + GcTrace { head: Option<GcNullableRef<Node<T>>>, } impl<T: GcTrace> Finalize for List<T> {} unsafe impl<T: GcTrace> GcTrace for List<T> { custom...
use super::package::PackageMap; use anyhow::{anyhow, Context, Result}; use clap::ArgMatches; use directories::BaseDirs; use serde::{Deserialize, Serialize}; use std::fs::{self, File}; use std::path::{Path, PathBuf}; #[derive(Debug, Deserialize, Serialize)] struct ConfigFile { gitrel: Gitrel, github_pagination:...
use std::collections::HashMap; use std::fs; use std::io; use std::ops::DerefMut; use std::path::{Path, PathBuf}; use std::sync::{mpsc, Arc, RwLock}; use std::thread; use funck::{Request, Response}; use snafu::{ensure, ResultExt, Snafu}; use super::compiler; pub use super::loader::Error as LoaderError; use super::{Fu...
//! A collection of node-specific RPC methods. use std::{sync::Arc}; use sp_api::ProvideRuntimeApi; use sp_transaction_pool::TransactionPool; use sp_blockchain::{Error as BlockChainError, HeaderMetadata, HeaderBackend}; use sp_runtime::traits::BlakeTwo256; use sp_block_builder::BlockBuilder; use sc_rpc_api::DenyUnsa...
use crate::config::{MailConfig, SSL}; use rocket::State; use rocket::response::content::Xml; use serde::Serialize; use uuid::Uuid; #[derive(Serialize)] #[serde(rename_all = "PascalCase")] struct PayloadContent { email_account_type: String, email_address: String, incoming_mail_server_authentication: String...