text
stringlengths
3.09k
13.9k
//! A one-shot, futures-aware channel //! //! This channel is similar to that in `sync::oneshot` but cannot be sent across //! threads. use std::cell::RefCell; use std::future::Future; use std::pin::Pin; use std::rc::{Rc, Weak}; use std::task::{Context, Poll}; pub use futures::channel::oneshot::Canceled; use crate::...
use conllx::graph::{Node, Sentence}; use edit_tree::{Apply, EditTree}; use failure::{Error, Fail}; use serde::{Deserialize, Serialize}; use super::{EncodingProb, SentenceDecoder, SentenceEncoder}; /// Lemma encoding error. #[derive(Clone, Debug, Eq, Fail, PartialEq)] pub enum EncodeError { /// The token does not ...
//! PowerPC Vector Scalar eXtensions (VSX) intrinsics. //! //! The references are: [POWER ISA v2.07B (for POWER8 & POWER8 with NVIDIA //! NVlink)] and [POWER ISA v3.0B (for POWER9)]. //! //! [POWER ISA v2.07B (for POWER8 & POWER8 with NVIDIA NVlink)]: https://ibm.box.com/s/jd5w15gz301s5b5dt375mshpq9c3lh4u //! [POWER IS...
//! Faster version of node-resolve. //! //! See: https://github.com/goto-bus-stop/node-resolve use anyhow::{bail, Context, Error}; use lru::LruCache; use serde::Deserialize; use std::{ fs::File, io::BufReader, path::{Path, PathBuf}, sync::Mutex, }; use swc_bundler::Resolve; use swc_common::FileName; p...
use std::collections::HashMap; use std::collections::HashSet; /// Represents a unknown number represented by a sequence of symbols /// with the least significant digit as first element. /// so if it's "ABCD" in the original puzzle, it's represented "DCBA" here. type SymbolNum = Vec<char>; /// Parsed puzzle representat...
use crate::blockstore_db::Result; use crate::{blockstore::*, blockstore_meta::SlotMeta}; use log::*; use solana_sdk::clock::Slot; pub struct RootedSlotIterator<'a> { next_slots: Vec<Slot>, prev_root: Slot, blockstore: &'a Blockstore, } impl<'a> RootedSlotIterator<'a> { pub fn new(start_slot: Slot, blo...
extern crate proc_macro; use proc_macro::TokenStream; use syn::parse::Parser; use syn::{punctuated, Expr, ItemConst, Token}; use std::fs::{create_dir_all, remove_file, OpenOptions}; use std::io::prelude::*; use std::path::Path; #[derive(Debug)] struct Command { name: String, desc: String, args: Vec<Arg>,...
//! Drawing the data grid use crate::dataframe::*; use crate::kind::*; use anyhow::Context; use crossterm::*; use ndarray::prelude::*; use pad::{Alignment, PadStr}; use std::fmt::{self, Display}; use std::io::Write; use std::str::FromStr; #[derive(PartialEq, Clone, Default)] pub struct DrawParams { pub rows: usiz...
use anyhow::Context; use reqwest::{self, blocking::Client, blocking::Response}; use reqwest::header::{HeaderMap, InvalidHeaderValue, HeaderValue, USER_AGENT, AUTHORIZATION}; use serde::{Deserialize, Serialize}; use crate::{Commit, GitDate, parse_to_utc_date}; #[derive(Serialize, Deserialize, Debug)] struct GithubComm...
//! This is a crate for wrapping common JWT functionality needed for securing information in a webapp. //! It is flexible in that it can support arbitrary payload subjects. #![deny( missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, ...
/// The access permissions for the image. #[derive(Copy, Clone, PartialEq, Eq)] pub enum AccessQualifier { /// A read only image. ReadOnly = 0, /// A write only image. WriteOnly = 1, /// A readable and writable image. ReadWrite = 2, } /// Whether the image uses arrayed content. #[derive(Copy, C...
use { std::{ collections::HashSet, convert::{ Infallible as Never, TryInto as _, }, ffi::OsString, io, iter, path::Path, pin::Pin, sync::Arc, }, async_proto::Protocol, chrono::prelude::*, chrono_tz::Tz, ...
use std::{sync::Arc, time::Duration}; use async_trait::async_trait; use color_eyre::{ eyre::{bail, ensure, Context}, Result, }; use ethers::{core::types::H256, signers::Signer, types::Address}; use futures_util::future::select_all; use rocksdb::DB; use tokio::{ sync::{ mpsc::{self, Receiver, Sender...
//! This module provides canvases on which to draw graphs like box plots and histograms use druid::{ kurbo::{Line, Size}, piet::{self, Brush, Color, RenderContext}, Data, }; use std::{marker::PhantomData, ops::Range}; const DEFAULT_AXIS_COLOR: Color = Color::grey8(50); /// An object that knows how to dra...
#![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! GPIOI //! //! Used by: stm32mp153, stm32mp157 #[cfg(not(feature = "nosync"))] pub use crate::stm32mp::peripherals::gpioi::Instance; pub use crate::stm32mp::peripherals::gpioi::{RegisterBlock, ResetValues}; pub use crate::stm32mp::per...
extern crate tokio; extern crate undermoon; #[macro_use] extern crate log; extern crate arc_swap; extern crate config; extern crate env_logger; use arc_swap::ArcSwap; use futures::channel::mpsc; use std::cmp::min; use std::env; use std::error::Error; use std::num::{NonZeroU64, NonZeroUsize}; use std::sync::atomic::{At...
use std::convert::{TryFrom, TryInto}; use std::sync::Arc; use liblumen_alloc::erts::exception::{AllocResult, Exception}; use liblumen_alloc::erts::process::alloc::{default_heap_size, heap, next_heap_size}; use liblumen_alloc::erts::process::{Priority, Process}; use liblumen_alloc::erts::term::prelude::*; use liblumen_...
use futures::{ future::{self, AbortHandle}, prelude::*, }; use log::{error, info, warn}; use serde::{Deserialize, Serialize}; use std::{ collections::{hash_map, HashMap}, io, mem, net::SocketAddr, sync::{Arc, RwLock}, time::Duration, }; use tarpc::{ context, server::{self, Channel}, ...
// Copyright 2015-2016 <NAME> <<EMAIL>> // // 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...
use crate::algorithm::Algorithm; use crate::cert::{CertGenConf, CertVerConf}; use crate::csr::CSRGenConf; use crate::error::CborCertError; use crate::execution::Config; use crate::keygen::KeyGenConf; use crate::saving::{File, FileFormat}; use serde::de::DeserializeOwned; use std::io::Read; pub enum Command { KeyGe...
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] // Test naming occasionally uses camelCase with underscores to separate sections of // the test name. #[cfg_attr(test, allow(non_snake_case))] #[macro_use] extern crate neovide_derive; #[macro_use] extern crate clap; mod bridge; mod channel_utils; mo...
use core::{ fmt, iter::{FromIterator, FusedIterator}, ops::RangeBounds, }; use alloc::vec::Vec; use crate::{Segment, SegmentSet}; // TODO: all doctests // /// See [`alloc::collections::btree_set::ITER_PERFORMANCE_TIPPING_SIZE_DIFF`] // /// // /// The std library uses `ITER_PERFORMANCE_TIPPING_SIZE_DIFF` ...
use crate::context::*; use crate::position::*; use crate::types::*; use crate::util::*; use itertools::Itertools; use jsonrpc_core::Params; use lsp_types::*; use serde::Deserialize; use std::collections::HashMap; pub fn semantic_highlighting_notification(params: Params, ctx: &mut Context) { let params = params.par...
// Tifflin OS - login // - By <NAME> (thePowersGang) // // GUI root process, handling user logins on a single session use lazy_static::LazyStatic; extern crate async; extern crate lazy_static; extern crate loader; extern crate wtk; #[macro_use] extern crate syscalls; macro_rules! imgpath { ($p:expr) => {concat!("/...
use std::{ io::{self, Cursor}, sync::mpsc::{Receiver, Sender}, thread::spawn, }; use build_html::{Html, HtmlContainer, HtmlPage}; use eyre::{format_err, Result}; use image::GenericImage; use qrcodegen::{QrCode, QrCodeEcc}; use slog::{debug, error, info, o, Logger}; use tiny_http::{Header, Request, Response...
use crate::proto; use crate::proto::Raft; use crate::raft::{Entry, Event, Message, Transport}; use crate::Error; use crossbeam_channel::{Receiver, Sender}; use grpc::ClientStubExt; use std::collections::HashMap; /// A gRPC transport. pub struct GRPC { /// The node channel receiver node_rx: Receiver<Message>, ...
use super::builder::WindowBuilder; use super::camera::{Camera, CameraController}; use super::event::WindowEventState; use super::uniform::Uniforms; use crate::pipes::{PipelineBuilder, PipelineRenderer, VertexFormat}; use nalgebra::{Point3, Vector2}; use slam_cv::Number; use winit::{event::*, window}; pub struct Windo...
// 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 { fuchsia_async as fasync, fuchsia_merkle::*, fuchsia_syslog as syslog, log::*, rand::rngs::SmallRng, rand::seq::SliceRandom, ...
#[allow(dead_code)] use mio::net::{TcpListener, TcpStream}; use rustls::Session; use config::ApplicationConfig; use service::handler::HttpHandler; use std::collections::HashMap; use std::io::{self, Read, Write}; use std::net::Shutdown; use std::rc::Rc; use std::str; use std::string::String; use std::sync::Arc; use std...
//! The `GhostBorrow` trait allows simultaneously borrowing multiple `GhostCell` immutably. //! //! Technically, this is already allowed, however it can be useful to do so as a single expression, which this trait //! provides. use core::mem; use crate::ghost_cell::*; /// A trait for implementing multiple borrows for...
use anchor_lang::prelude::*; use anchor_lang::solana_program::entrypoint::ProgramResult; use anchor_lang::solana_program::sysvar::clock::Clock; declare_id!("BBZ2HBi6WbaFtGeXwewBbMe3x4foTcrQNfc4jJUPLt8a"); #[program] pub mod solanaloans { use super::*; pub fn initialize(ctx: Context<Initialize>) -> ProgramResult {...
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unl...
/* Read README.md */ use std::{error, sync::Arc}; use futures_util::future; use log::info; use oauth2_signin::{ oauth2_client::{ oauth2_core::utils::gen_code_challenge, utils::{gen_code_verifier, gen_nonce, gen_state}, }, web_app::{ SigninFlowBuildAuthorizationUrlConfiguration, Sig...
extern crate trio_binning; extern crate clap; extern crate ansi_term; use trio_binning::kmer::*; use trio_binning::classify::*; use std::fs::File; use clap::{Arg, App, ArgMatches}; use std::{process, error, thread, fmt}; use ansi_term::Colour; type BoxResult<T> = Result<T, Box<error::Error>>; #[derive(Debug)] struct...
use env_var::env_var; use futures::{StreamExt, TryStreamExt}; use kube::{api::{Api, ListParams, ResourceExt, WatchEvent}, Client}; use kube::CustomResource; use hyper::Result; use schemars::JsonSchema; use serde::{Serialize, Deserialize}; use std::collections::HashMap; use tibco_ems::admin::BridgeInfo; use tibco_ems::{...
//! This module contains XDG and DBus specific code. //! //! it should not be available under any platform other than `(unix, not(target_os = "macos"))` use std::borrow::Cow; use std::ops::{Deref, DerefMut}; use super::Notification; use dbus::{BusType, Connection, ConnectionItem, Message, MessageItem}; use error::*; ...
use rayt::{ camera::Camera, hittable::{HitRecord, Hittable, Shape}, hittable_list::HittableList, material::{Material, Scatter}, ray::Ray, utils::{INFINITY, clamp}, vec3::{unit_vector, Color, Point3, Vec3}, }; use rayon::prelude::*; //use std::sync::Arc; #[macro_use] extern crate rayt; #[ma...
use std::path::{Path, PathBuf}; use std::fs; use std::str::FromStr; use chrono::prelude::*; use clap::ArgMatches; use slug::slugify; use lib::settings::Settings; use diesel::prelude::*; use diesel::insert_into; use ffmpeg::{identify, de_aax, extract_coverart, convert, MediaInfo}; use database::get_db_conn; use lib::...
extern crate rayon; extern crate image; extern crate rand; extern crate raytracing_study; use std::sync::{ Arc, Mutex }; use rayon::prelude::*; use image::{ Rgb, RgbImage }; use raytracing_study::{ vec3, Vector3, Transform, math, util }; use raytracing_study::{ Camera, Ray, Scene, PPrimitive, Geometry, Tr...
use sanskrit_common::errors::*; use sanskrit_common::encoding::*; use model::{Capability, Permission}; pub trait BitEntry { fn to_mask(&self) -> u8; } pub trait BitSet<T:BitEntry> where Self:Sized { fn to_bits(&self) -> u8; fn from_bits(idx:u8) -> Self; //generate a empty set fn empt...
use ssh2::{Error, File, OpenFlags, OpenType, Sftp}; use std::io::{Read, Seek, Write}; use std::ops::{Deref, DerefMut, Drop}; use std::path::{Path, PathBuf}; use std::rc::Rc; type Result<T> = std::result::Result<T, Error>; /// Wraps a remote file with its paired remote lock file /// /// The lock file is deleted upon ...
use std::ops::Range; use codespan_reporting::diagnostic::{Diagnostic, Label}; use codespan_reporting::files::{Error, SimpleFiles}; use codespan_reporting::term::termcolor::{ColorChoice, StandardStream}; use peg::error::ParseError; use peg::str::LineCol; use crate::frontend::{Expr, Type}; impl Expr { pub fn expre...
use std::collections::LinkedList; use crate::core::Error; use crate::interpreter::expr::ast::Node; use crate::interpreter::expr::parser::parse; use crate::interpreter::expr::token::TokenMap; ///lexer pub fn lexer(express: &str, token_map: &TokenMap) -> Result<Vec<String>, Error> { let express = express.replace("n...
use crate::context::{AudioContextRegistration, AudioParamId, BaseAudioContext}; use crate::control::Scheduler; use crate::param::{AudioParam, AudioParamDescriptor, AutomationRate}; use crate::render::{AudioParamValues, AudioProcessor, AudioRenderQuantum, RenderScope}; use crate::RENDER_QUANTUM_SIZE; use super::{AudioN...
//! Hashing to BLS12-381 primitives use ff::Field; use group::{CurveAffine, EncodedPoint}; use ic_crypto_sha256::Sha256; use miracl_core::bls12381::ecp::ECP; use pairing::bls12_381::{Fr, G1Affine, G1}; use rand_chacha::ChaChaRng; use rand_core::SeedableRng; #[cfg(test)] mod tests; /// Hash onto BLS12-381 G1 (random ...
use std::collections::HashMap; use crate::map::DMap; #[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] pub struct DiffReport { diffs: Vec<Diff> } #[derive(Debug, PartialEq, PartialOrd, Eq, Ord)] pub enum Diff { Add(String), Remove(String), Changed(String) } impl DiffReport { pub fn create(diffs: ...
use crate::object::{RobjPtr, Robj}; use crate::util::bytes_to_usize; pub struct DecodeIter<'a> { raw: &'a [u8], idx: usize, curr: usize, total: usize, fail: bool, } impl<'a> Iterator for DecodeIter<'a> { type Item = Result<RobjPtr, ()>; fn next(&mut self) -> Option<Self::Item> { i...
//! A proxy for encoding arbitrary Rust structs in protocol buffer binary format //! by means of a "proxy message" (a generated `prost::Message`) plus `Into` / //! `TryInto` implementations to convert between the Rust struct and the proxy //! message. //! //! The only major downside when compared to `serde` (which does...
use lazy_static::lazy_static; use odbc_api::{ buffers, buffers::TextColumn, handles::{CDataMut, Statement}, Connection, Cursor, Environment, Error, RowSetBuffer, U16Str, }; // Rust by default executes tests in parallel. Yet only one environment is allowed at a time. lazy_static! { pub static ref EN...
extern crate glfw; extern crate gl; use std::sync::mpsc; use self::glfw::Context as glfwContext; use system::config; use math::vec4::Vec4; use math::mat4::*; pub struct Context { pub glfw: glfw::Glfw, pub events: mpsc::Receiver<(f64, glfw::WindowEvent)>, pub window: glfw::Window, pub window_wid...
use clap::ArgMatches; use common::addressing; use common::proto::payload::CreateOrganizationAction; use common::proto::payload::{CertificateRegistryPayload, CertificateRegistryPayload_Action}; use error::CliError; use transaction::{create_batch, create_batch_list_from_one, create_transaction}; use key; use sawtooth_...
// 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 writ...
use super::Tag; use crate::base::{Bytes, HasReplacementsError, Range}; use encoding_rs::Encoding; // NOTE: All standard tag names contain only ASCII alpha characters // and digits from 1 to 6 (in numbered header tags, i.e. <h1> - <h6>). // Considering that tag names are case insensitive we have only // 26 + 6 = 32 cha...
use std::collections::HashMap; use super::*; use crate::Hash; use crate::{ document::Document, error::{Error, Result}, }; /// An item in a Checklist. To complete it, find a document whose hash matches the one that was /// provided alongside this item, then feed that document to the [`check`][ListItem::check] ...
use std::collections::{HashMap, HashSet}; use crate::coordinates::{Point, Slope}; struct Map { objects: Vec<Vec<bool>>, } impl Map { fn from(map_string: &str) -> Map { Map { objects: map_string .trim() .lines() .map(|l| { l.trim() .chars() .map(...
mod router; use std::future::{ready, Future, Ready}; use xitca_http::{http::Request, RequestBody, ResponseError}; use xitca_service::{Service, ServiceFactory, ServiceFactoryExt, Transform, TransformFactory}; use crate::request::WebRequest; // App keeps a similar API to xitca-web::App. But in real it can be much sim...
use std; use std::borrow::Cow; use super::operator; use super::{ error::ParsingError, FromXmlAttribute, MathmlElement, MathmlInfo, ParseContext, }; use crate::types::{Field, Length, MathExpression, MathItem, MathSpace}; use crate::unicode_math::{convert_character_to_family, Family}; #[derive(Debug, Copy, Cl...
use log::debug; use std::error::Error; use crate::enum_primitive::FromPrimitive; use crate::libs::source_codec::bitvec_source_encoding_extractor::BitvecSourceEncodingExtractor; use crate::libs::source_codec::keying_encoder::decode_from_binary_with_known_sign; use crate::libs::source_codec::keying_timing::{DefaultKeying...
//! Random and probabilistic things helpful for games. use itertools::{Either, Itertools}; use rand::Rng; /// It's often helpful to have weighted probabilities. /// This struct serves as a sort of weighted bag; you can give it entries /// with various weights, and then randomly sample them. /// /// This is t...
// Copyright 2021 Lido // // 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 writing...
// argument option #[derive(Debug, Clone)] pub(crate) struct Arg<ID: Copy> { id: ID, short_name: char, value_name: Option<String>, help: String, } impl<ID: Copy> Arg<ID> { pub(crate) fn new(id: ID, short_name: char, value_name: Option<String>, help: String) -> Self { Arg { id, ...
use crate::{AppState, STAGE}; use bevy::{prelude::*, sprite::collide_aabb::collide}; use rand::prelude::*; pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut AppBuilder) { app.on_state_enter(STAGE, AppState::InGame, setup_game.system()) .on_state_update(STAGE, AppSta...
//! This module contains the functions for forking the //! different endpoints. use std::error::Error; use std::marker; use std::panic::set_hook; use std::thread::{Builder, JoinHandle}; use crate::binary::struct_trait::session::Session; use crate::meshedchannels::MeshedChannels; use crate::role::Role; #[doc(hidden)]...
//! Describes the instructions. use device::Device; use ir::{self, DimMapScope, LoweringMap, Operand, Operator, Statement, StmtId, Type}; use std; use std::hash::{Hash, Hasher}; use utils::*; /// Uniquely identifies an instruction. #[derive( Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Serialize, Dese...
use crate::{commands::*, theme::*}; use audio_ops::pure::linlin; use druid::{ kurbo::BezPath, piet::{FontFamily, PietText, Text, TextLayout, TextLayoutBuilder}, Event, Point, RenderContext, Size, }; use std::collections::VecDeque; pub struct Widget { font: Option<FontFamily>, grid_unit: Option<Size...
pub(super) fn run() -> Result<(), super::Error> { { let result = part1(super::read_input_lines::<String>("day18")?)?; println!("18a: {}", result); assert_eq!(result, 8929569623593); } { let result = part2(super::read_input_lines::<String>("day18")?)?; println!("18b: {}", result); assert_eq!(result, ...
use byteorder::{LittleEndian, ReadBytesExt}; use std::io::Cursor; use std::io::Read; use crate::*; #[derive(Debug, Copy, Clone)] pub enum FormatVersion { V3, V5, } impl FormatVersion { fn line_header_5th_attribute(&self) -> bool { match self { FormatVersion::V3 => false, Fo...
use crate::{cpp_field, cpp_method}; use crate::rstl::{WString, Vector}; use core::ptr; pub enum CGuiFrame { } pub enum CGuiWidget { } pub enum CGuiTextPane { } pub enum CGuiTextSupport { } impl CGuiFrame { // FindWidget__9CGuiFrameCFPCc #[cpp_method(CGuiFrame::FindWidget(const char *) const)] pub unsafe ...
#![allow(clippy::unreadable_literal)] use core::fmt::Debug; use core::fmt::Write; use core::ops::Deref; use serde::de::DeserializeOwned; use serde::{Deserialize, Serialize}; use pinecone::{from_bytes, to_vec}; use hashbrown::HashMap; #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] struct BasicU8S { st: ...
//! Common testing helper functions use crate::class::load_class; use crate::function::structure::ControlFlowGraph; use crate::output::BuiltinFunction; use crate::scheduler::SerialScheduler; use crate::{ collect_functions, compile_functions, construct_virtual_table, render_module, Class, Module, }; use data_encodi...
extern crate walkdir; use std::path::{Path, PathBuf, Component}; use std::fs; use std::convert; // Deploy Options // - Whether to overwrite {Files, Dirs} w/ {Files, Dirs} // - Whether to create INTERmediary directories #[derive(Clone, Copy, Debug)] pub struct DepOpt { pub OW_FF: bool, pub OW_DD: bool, pub...
use ic_test_utilities::execution_environment::{ExecutionTest, ExecutionTestBuilder}; use ic_types::{ingress::WasmResult, CanisterId}; use proptest::{ prelude::*, test_runner::{TestRng, TestRunner}, }; fn make_module_wat(heap_size: usize) -> String { format!( r#" (module (import "ic0" "msg...
use crate::{ parser::{take, take_n, Parser, Propagate}, AmlContext, AmlError, }; use bit_field::BitField; #[derive(Clone, Copy, PartialEq, Eq, Debug)] pub struct PkgLength { pub raw_length: u32, /// The offset in the structure's stream to stop parsing at - the "end" of the PkgLength. We need to tra...
use crate::v3::core::node_id::NodeId; /// `ReorderBuffer` (ROB) keeps track of outstanding dependencies of "in flight" tasks. /// /// Each task that exits `TaskStack` has a slot in the ROB that will be used to store the /// output of said task. That is, once a task X is finished, it's result is written into the ROB. /...
#![feature(test)] use std::error::Error; use std::fs::File; use std::io::{BufRead, BufReader}; use gif::{Frame, Encoder, Repeat, SetParameter}; use std::borrow::Cow; #[macro_use] extern crate scan_fmt; extern crate gif; extern crate test; #[derive(Debug)] struct Point { pos_x: i32, pos_y: i32, vel_x: i...
use std::{ collections::{BTreeMap, HashMap}, path::PathBuf, }; use librojo::project::{Project, ProjectNode}; use rbx_dom_weak::{AmbiguousRbxValue, RbxValue, UnresolvedRbxValue}; use rlua::{Context, FromLua, Value}; pub struct RemodelProject(pub Project); impl<'lua> FromLua<'lua> for RemodelProject { fn f...
use std::convert::Infallible; use std::fmt; use serde::Deserialize; /// A `Result` alias where the `Err` variant contains an `ErrorInfo`. pub type Result<T> = std::result::Result<T, ErrorInfo>; /// Creates an [`ErrorInfo`] with the given code and message. /// /// [`ErrorInfo`]: ably::ErrorInfo #[macro_export] macro_...
mod movers; mod widgets; mod screen; pub use screen::Screen; use serde::Serializer; pub use widgets::message; pub use widgets::Widget; pub(crate) type PartPixel = image::Rgba<u8>; pub(crate) type PartImage = ImageBuffer<PartPixel, Vec<u8>>; pub(crate) use screen::{Part, PartCache, PartChannel, PartSender}; use image:...
use async_trait::async_trait; use std::collections::HashMap; use tokio_tungstenite::tungstenite::Message; use crate::{ clients::common_traits::{ Candlestick, Level3OrderBook, OrderBook, OrderBookTopK, Ticker, Trade, BBO, }, common::{ command_translator::CommandTranslator, message_ha...
use std::collections::{HashMap, HashSet}; use std::fs; use std::sync::Arc; use async_trait::async_trait; use hubcaps_ex::issues::Issue; use log::{debug, info, trace}; use serde::{Deserialize, Serialize}; use tera::{from_value, to_value, Context, Tera, Value}; use crate::component::repo::issue::IssueComponentTrait; us...
// Copyright (c) 2019 <NAME>, RWTH Aachen University // // 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 exc...
use crate::access_control; use serum_common::pack::Pack; use serum_lockup::accounts::{Safe, TokenVault, Vesting}; use serum_lockup::error::{LockupError, LockupErrorCode}; use solana_sdk::account_info::{next_account_info, AccountInfo}; use solana_sdk::info; use solana_sdk::instruction::{AccountMeta, Instruction}; use so...
//! Hashmaps for tracking pending JSON-RPC requests. use std::fmt::{self, Debug, Formatter}; use std::future::Future; use std::sync::Arc; use dashmap::{mapref::entry::Entry, DashMap}; use futures::channel::oneshot; use futures::future::{self, Either}; use log::{info, warn}; use serde::Serialize; use super::{Error, I...
use crate::api_error::api_error; use crate::db::users::*; use crate::model::users::*; use crate::state::State; use chrono::Utc; use diesel::mysql::MysqlConnection; use futures::Future; use rand::Rng; use reqwest::r#async::Client; use sha2::{Digest, Sha256}; use std::sync::{Arc, Mutex}; use warp::http::StatusCode; #[de...
// Copyright 2020 Parity Technologies // // 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 accor...
use super::TestContext; use crate::formatting::ContextualDisplay as _; use crate::module::{Formatter, ModuleSet}; use crate::prelude::*; use crate::sexp::{self, matcher as m}; use itertools::Itertools; use std::borrow::Cow; use std::convert::TryFrom; use std::fmt; #[derive(Debug)] pub(super) enum ModuleValidation { ...
// Copyright (c) 2021 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 or agre...
//! Reading packets as events from a pcap file. use crate::Error; use std::fs::File; use std::io::{self, Read}; use std::path::Path; use pcap_parser::{ create_reader, data::get_packetdata_ethernet, data::PacketData, traits::PcapReaderIterator, Block, PcapBlockOwned, PcapError, }; #[derive(Debug)] pub struct ...
use tide::prelude::*; use crate::csp::filter::{ BLOCKED_URI_FILTERS, ORIGINAL_POLICY_FILTERS, REFERRER_FILTERS, SCRIPT_SAMPLE_FILTERS, SOURCE_FILE_FILTERS, }; #[derive(Debug, Serialize, Deserialize)] pub struct CspReportContent { /// The URI of the resource that was blocked from loading by the /// Con...
use flate2::read::GzDecoder; use std::fmt::Display; use std::fs::File; use std::path::{Path, PathBuf}; use tar::Archive; use zip::ZipArchive; use rlua::{Lua, Table, UserData}; use crate::actions::util; use crate::error::TaskError; use crate::{Result, WRITER}; use super::file::HpgDir; #[derive(Debug, Clone, Copy, Pa...
//! Commonly used utilities use anyhow::{format_err, Result}; use std::process::Command; pub mod globals { pub const VERSION: &str = env!("CARGO_PKG_VERSION"); pub const DESCRIPTION: &str = env!("CARGO_PKG_DESCRIPTION"); pub const COLORS: [(&str, &str); 12] = [ ("{reset}", "\x1B[00m"), ("{b...
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to those terms. #![allow(clippy::mo...
use super::Aura; use codec::{Codec, Decode, Encode}; use primitives::{ sr25519::{Public as SRPublic, Signature as SRSignature}, H256, H512, }; use rstd::collections::btree_set::BTreeSet; use rstd::convert::From; use runtime_io::sr25519_verify; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; use sr_...
// bmp.rs // Bitmap scene writer // <NAME> // 9 Dec 2020 use std::vec::Vec; use std::fs::File; use std::io::{BufWriter, Error, Write}; use crate::vector::Color; use std::mem::size_of; pub struct Row { cols: Vec<Color> } impl Default for Row { fn default() -> Self { Self { cols: Vec::new()...
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")] extern crate reqwest; extern crate tokio; extern crate serde_json; extern crate whoami; extern crate base64; extern crate litcrypt; use std::{thread, time}; use std::env::args; use std::process::exit; use std::process::Command; use rand::prelude::*; u...
use std::collections::HashMap; use std::hash::Hash; use std::thread; use std::time::Duration; fn generate_workout(intensity: u32, random_number: u32) { // this is a closure, not the Ruby-like syntax (or inspired by Smalltalk [:num | num+1] ) // unlike functions, the compile will infer the types so they may be ...
use failure::{Backtrace, Context, Fail}; use std::fmt; use std::path::{Path, PathBuf}; use std::result; /// A type alias for handling errors throughout the service pub type Result<T> = result::Result<T, Error>; /// An error that can occur #[derive(Debug)] pub struct Error { ctx: Context<ErrorKind>, } ...
//! Routing for paths delimited by a forward slash, with the ability to capture //! specified path segments. //! //! # Example //! //! ```rust //! use path_router::Tree; //! let mut routes = Tree::new(); //! routes.add("GET/user/:username/profile", "profile.html"); //! assert_eq!( //! routes.find("GET/user/my_name/...
//! Arena allocator implementation for use within the Hash compiler sources. //! //! All rights reserved 2021 (c) The Hash Language authors pub mod brick; pub mod collections; use std::mem::{ManuallyDrop, MaybeUninit}; /// The root primitive of arena allocation. /// /// A `Castle` can create [`Wall`]s, which in turn...
use ckb_jsonrpc_types::{ Alert, BannedAddr, Block, BlockNumber, BlockReward, BlockTemplate, BlockView, Capacity, CellOutputWithOutPoint, CellTransaction, CellWithStatus, ChainInfo, Cycle, DryRunResult, EpochNumber, EpochView, EstimateResult, HeaderView, LiveCell, LocalNode, LockHashIndexState, OutPoint,...