text stringlengths 3.09k 13.9k |
|---|
//! The Rust rewrite of the [RCOS](https://rcos.io) website.
//! This version is intended to be more maintainable in the long term
//! and uses a simpler and more conservative set of tools without being
//! entirely ["boring software"](https://tqdev.com/2018-the-boring-software-manifesto).
//!
//! ## Project Structure
... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
//! Mutator that adds new, empty functions.
use super::Mutator;
use crate::module::{PrimitiveTypeInfo, TypeInfo};
use crate::{Error, Result, WasmMutate};
use rand::Rng;
use std::convert::TryFrom;
use wasm_encoder::{Instruction, Module, ValType};
/// Mutator that adds new, empty functions to a Wasm module.
#[derive(Cl... |
use crate::*;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
/// https://swagger.io/docs/specification/using-ref/
/// https://github.com/OAI/OpenAPI-Specification/blob/master/versions/2.0.md#referenceObject
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
#[serde(untagged)]
pub enum Reference... |
use std::str::FromStr;
use crate::x::{
XEvent, XWindowID,
XConn, XError,
event::{
ConfigureRequestData,
ClientMessageEvent,
ClientMessageData,
PropertyEvent,
PointerEvent,
},
Atom,
Property, WmHintsFlags,
};
use crate::core::types::Point;
use crate::keyb... |
use std::collections::HashMap;
/// This struct will be used to store symbols as well as the state of the
/// program as it executes
pub struct ProgramState {
lists: HashMap<String, Vec<String>>,
execs: HashMap<String, String>,
command_history: Vec<String>,
repeat_level: usize,
}
/// Given a list of co... |
#![deny(warnings, rust_2018_idioms)]
#![forbid(unsafe_code)]
#![allow(clippy::inconsistent_struct_constructor)]
use linkerd_stack::{layer, NewService, Proxy};
use pin_project::pin_project;
use std::task::{Context, Poll};
use tracing::instrument::{Instrument as _, Instrumented};
use tracing::{trace, Span};
/// A strat... |
use std::convert::From;
use anyhow::Result;
use async_trait::async_trait;
use itertools::Itertools;
use tui::{
backend::Backend,
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
text::{Span, Spans},
widgets::{Block, BorderType, Borders, Clear, Paragraph},
... |
// Copyright (c) 2019 Intel Corporation. All rights reserved.
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
//
// Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE-BSD-3-Clause file.... |
extern crate regex;
#[macro_use]
extern crate lazy_static;
use regex::Regex;
use std::str::FromStr;
use std::string::ToString;
use std::io;
use std::io::prelude::*;
use std::collections::BTreeMap;
lazy_static! {
static ref SPIN_RE: Regex = Regex::new(r"^s(?P<spin_by>[0-9]+)$").unwrap();
static ref EXCHAN... |
//! This is an example of a simple application
//! which calculates the Collatz conjecture.
//!
//! The function itself is trivial on purpose,
//! so that we can focus on understanding how
//! the application can be made localizable
//! via Fluent.
//!
//! To try the app launch `cargo run --example simple-app NUM (LOCA... |
// used for dev/tests
#![deny(clippy::complexity, clippy::correctness, clippy::perf, clippy::style)]
// to serialize large json (like the index)
#![recursion_limit = "128"]
mod error;
/// Contains the functions used to query the database.
pub mod queries;
mod stats_cache;
use stats_cache::{get_stats_cache_addr, Stat... |
//! Mocks for the bonded finance pallet.
#![cfg(test)]
use super::*;
use frame_support::{
construct_runtime,
pallet_prelude::*,
parameter_types,
traits::{EnsureOrigin, Everything},
PalletId,
};
use frame_system::{EnsureRoot, RawOrigin};
use orml_tokens::CurrencyAdapter;
use orml_traits::parameter_type_with_key;
... |
#![allow(dead_code)]
use super::console::Console;
use super::tty::Tty;
impl Console {
pub const TERM_KEY_ENTER: u32 = 13;
pub const TERM_KEY_BACKSPACE: u32 = 8;
pub const TERM_KEY_INSERT: u32 = 45;
pub const TERM_KEY_DEL: u32 = 46;
pub const TERM_KEY_TAB: u32 = 9;
pub const TERM_KEY_HOME: u32 =... |
//! # MultiOracleTrieWithDiff
//! Data structure and functions used to store adaptor signature information
//! for numerical outcome DLC with t of n oracles where some difference
//! between the outcomes of each oracle can be supported.
use crate::digit_decomposition::group_by_ignoring_digits;
use crate::multi_trie::{... |
//
// Copyright 2020 bplist Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except according ... |
/// MQTT Control Packet type
///
/// Position: byte 1, bits 7-4.
///
/// Represented as a 4-bit unsigned value.
#[derive(Debug, PartialEq, Clone)]
pub enum CPType {
/// Direction of flow: Client to Server.
///
/// Description: Client request to connect to Server.
Connect,
/// Direction of flow: Ser... |
#[macro_use]
mod macros;
mod carrier;
mod dispatcher;
mod payload;
mod position;
mod slot;
mod tools;
use std::hash::Hash;
pub use carrier::*;
use dispatcher::*;
pub use payload::*;
pub use slot::*;
#[macro_use]
extern crate approx;
fn _debug_dump_slots(slots: &[Slot<char>]) {
for (i, v) in slots.iter().enumer... |
//! ISO 4217 currency codes
//!
//! This crate provides an enum that represents all ISO 4217 currencies and
//! has simple methods to convert between numeric and character code, list of
//! territories where each currency is used, the symbol,
//! and the English name of the currency.
//!
//! The data for this is taken ... |
#![cfg_attr(feature = "deny-warnings", deny(warnings))]
use rustc_tools_util::VersionInfo;
use std::env;
use std::ffi::OsString;
use std::path::PathBuf;
use std::process::{self, Command};
const CARGO_CLIPPY_HELP: &str = r#"Checks a package to catch common mistakes and improve your Rust code.
Usage:
cargo clippy ... |
//! Basic manipulation of rectangles.
use std::cmp;
/// A rectangular region of non-zero width and height.
/// # Examples
/// ```
/// use imageproc::rect::Rect;
/// use imageproc::rect::Region;
///
/// // Construct a rectangle with top-left corner at (4, 5), width 6 and height 7.
/// let rect = Rect::at(4, 5).of_size... |
use crate::context::{RenderContext, UpdateContext};
use crate::display_object::{DisplayObjectBase, TDisplayObject};
use crate::prelude::*;
use crate::tag_utils::SwfMovie;
use crate::transform::Transform;
use crate::types::{Degrees, Percent};
use gc_arena::{Collect, GcCell};
use std::sync::Arc;
#[derive(Clone, Debug, C... |
// Copyright 2019 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 ... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Port Data Output Register"]
pub pdor: PDOR,
#[doc = "0x04 - Port Set Output Register"]
pub psor: PSOR,
#[doc = "0x08 - Port Clear Output Register"]
pub pcor: PCOR,
#[doc = "0x0c - Port Toggle Output Register"]
... |
//! Composition generator, used to populate chunks with blocks
//! based on the density and biome values.
use crate::worldgen::{block_index, util, ChunkBiomes, CompositionGenerator, SEA_LEVEL};
use bitvec::slice::BitSlice;
use feather_blocks::{GrassBlockData, MyceliumData, WaterData};
use feather_core::{Biome, Block, ... |
use crate::parser::code_map::{CodeMap, Span, SpanLoc};
use codespan_reporting::diagnostic::{Diagnostic, Severity};
use codespan_reporting::files::{Error, Files};
use itertools::Itertools;
use pathdiff::diff_paths;
use std::fmt::{Display, Formatter};
use std::ops::Range;
pub type CoreResult<T> = Result<T, Diagnostics>;... |
#[macro_use]
extern crate log;
#[macro_use]
extern crate rsrpc;
#[macro_use]
pub extern crate lazy_static;
extern crate hex;
extern crate rand;
extern crate bincode;
extern crate env_logger;
extern crate futures;
extern crate ring;
extern crate serde;
extern crate serde_bytes;
extern crate sha2;
extern crate shrust;
... |
// SPDX-License-Identifier: Apache-2.0
#![doc = include_str!("../README.md")]
#![deny(missing_docs)]
#![deny(clippy::all)]
#![warn(rust_2018_idioms)]
#![feature(core_ffi_c)]
mod config;
mod loader;
use config::Config;
use loader::Loader;
use std::fs::File;
use std::io::Read;
use std::mem::forget;
use std::os::unix:... |
//! Module lexer is generated by GoGLL. Do not edit.
use crate::token;
use std::{fs, io};
use std::rc::Rc;
type State = usize;
const NULL_STATE: State = usize::MAX ;
/**
Lexer contains both the input Vec<char> and the Vec<token::Token>
parsed from the input
*/
pub struct Lexer {
/// i is the input vector of char... |
use amethyst::{
core::{
math::{Matrix4, UnitQuaternion, Vector3},
Transform,
},
ecs::prelude::*,
input::{InputEvent, StringBindings},
renderer::Camera,
shrev::EventChannel,
};
use amethyst_physics::prelude::*;
use crate::components::*;
const MOUSE_SENSITIVITY: f32 = 0.2;
const ... |
use crate::{
audio::EffectSelection,
camera::CameraController,
interaction::navmesh::{
data_model::{Navmesh, NavmeshTriangle, NavmeshVertex},
selection::NavmeshSelection,
},
scene::clipboard::Clipboard,
world::graph::selection::GraphSelection,
GameEngine,
};
use fyrox::scene:... |
//! Functions and types relating to textures.
use std::cell::RefCell;
use std::path::Path;
use std::rc::Rc;
use image;
use crate::error::{Result, TetraError};
use crate::fs;
use crate::graphics::{self, DrawParams, Drawable, Rectangle};
use crate::platform::{GraphicsDevice, RawTexture};
use crate::Context;
/// A tex... |
// Copyright 2018-2021 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... |
//!
//! # Update KV Store with SPU status (online/offline)
//!
use std::fmt::Debug;
use std::fmt::Display;
use std::convert::Into;
use std::io::Error as IoError;
use std::io::ErrorKind;
use log::trace;
use log::warn;
use log::debug;
use serde::de::DeserializeOwned;
use serde::Serialize;
use async_trait::async_trait;
... |
//! Adds support for the failure crate.
//!
//! **Feature:** `with_failure` (enabled by default)
//!
//! Failure errors and `Fail` objects can be logged with the failure integration.
//! This works really well if you use the `failure::Error` type or if you have
//! `failure::Fail` objects that use the failure context i... |
use super::Result;
#[derive(Debug, PartialEq)]
pub struct DiskUsage {
pub filesystem: Option<String>,
pub one_k_blocks: u64,
pub one_k_blocks_used: u64,
pub one_k_blocks_free: u64,
pub used_percentage: u32,
pub mountpoint: String,
}
#[derive(Debug, PartialEq)]
pub struct DiskInodeUsage {
p... |
use std::io::Write;
use clap;
use rbitcoin::blockdata::script::Script;
use rbitcoin::blockdata::transaction::Transaction;
use rbitcoin::consensus::encode::deserialize as bitcoin_deserialize;
use rbitcoin::network::constants::Network as BitcoinNetwork;
use rbitcoin::util::psbt;
use rpassword;
use trezor::{self, SignTxP... |
use clap::{Arg, App};
use std::{process, io, fs};
use std::io::{BufReader, BufRead, BufWriter, stdout};
use chainpack::{CponReader, ChainPackReader, ChainPackWriter, CponWriter};
use chainpack::Reader;
use chainpack::Writer;
use fern::colors::ColoredLevelConfig;
use colored::Color;
use colored::Colorize;
fn setup_log... |
use std::io;
use std::io::prelude::*;
enum Op {
Addr, //(add register) stores into register C the result of adding register A and register B.
Addi, //(add immediate) stores into register C the result of adding register A and value B.
Mulr, // (multiply register) stores into register C the result of multiplyi... |
use crate::onion;
use crate::secp::{self, Commitment, ComSignature, SecretKey};
use crate::ser;
use crate::types::Onion;
use jsonrpc_derive::rpc;
use jsonrpc_http_server::*;
use jsonrpc_http_server::jsonrpc_core::*;
use jsonrpc_core::{Result, Value};
use serde::{Deserialize, Serialize};
use std::net::SocketA... |
use {Backend};
use std::collections::HashMap;
use std::sync::{Arc, Mutex};
use std::os::raw::{c_void, c_long, c_int};
use std::ptr;
use hal::{self, image, pass, pso};
use cocoa::foundation::{NSRange, NSUInteger};
use metal::{self, MTLPrimitiveType};
use objc;
use spirv_cross::msl;
/// Shader module can be compiled... |
//! Remote Procedure Calls
// TODO: docs for everything
#![allow(missing_docs)]
use std::io::Read;
use bytes_v0_5::Bytes;
use prost::Message as _;
use prost_amino::{encoding::decode_varint, Message as _};
use tendermint_p2p::secret_connection::DATA_MAX_SIZE;
use tendermint_proto as proto;
use crate::{
amino_typ... |
//! Definitions of types and constants for values defined by
//! [ISO/IEC 14496 part 3 (Audio)](https://en.wikipedia.org/wiki/MPEG-4_Part_3).
//!
//! Currently supported,
//!
//! - [`AudioObjectType`](struct.AudioObjectType.html)
use std::convert::TryFrom;
use std::fmt;
/// Represents an error converting a `u8` into... |
use super::router::AppRoute;
use crate::agents::{
notifier,
repo::{Repo, Request as RepoRequest, Response as RepoResponse},
};
use crate::components::icon::{Icon, IconStyle};
use crate::objects::{Channel, JsError};
use uuid::Uuid;
use yew::prelude::*;
use yew_agent::{Bridge, Bridged, Dispatched, Dispatcher};
us... |
// This file is part of sokoban-rs
// Copyright 2015 <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 a... |
use std::fmt::Debug;
#[cfg(test)]
use num::traits::FloatConst;
#[cfg(test)]
use rand::Rng;
pub trait IEEEFloat: Sized + Copy + PartialEq + Debug {
const EXP_BITS: usize;
const MANTISSA_BITS: usize;
const SIGN_MASK: u64 = (1u64 << (Self::EXP_BITS + Self::MANTISSA_BITS));
const MANTISSA_MASK: u64 = (1... |
use std::time::Instant;
use cgmath::{Deg, Euler, Vector3, Rad};
use obj::{load_obj, Obj};
use obj::Vertex as OBJVertex;
use vxe_renderer::context::{Context};
use vxe_renderer::context::utils::{FrameUtils};
use vxe_renderer::data::{Sampler, Vertex};
use vxe_renderer::data::{VertexNormal, VertexPosition, VertexRGB};
us... |
// SPDX-FileCopyrightText: 2021 Open Energy Solutions Inc
//
// SPDX-License-Identifier: Apache-2.0
use crate::ControlProfileExt;
use std::time::SystemTime;
use crate::{error::*, OpenFMBExt};
use openfmb_messages::{
commonmodule::{
ConductingEquipment, ControlFscc, ControlScheduleFsch, ControlTimestamp, ... |
#![feature(proc_macro)]
extern crate sysmon;
extern crate toml;
extern crate getopts;
extern crate futures;
extern crate futures_cpupool;
extern crate tokio_core;
extern crate tokio_signal;
#[macro_use]
extern crate log;
#[cfg(features = "watch")]
extern crate notify;
extern crate serde;
extern crate env_logger;
use ... |
#![feature(specialization, const_fn)]
// extern crate rand;
// extern crate rayon;
#[macro_use]
extern crate pyo3cls;
use pyo3::types::PyModule;
use pyo3::{PyRawObject, PyResult, Python};
use rand::distributions::{Distribution, Uniform};
use rayon::prelude::*;
use std::collections::HashSet;
struct OneTimePad {
... |
//! Common utilities, for internal use only.
use crate::ptr;
/// Helper methods to process immutable bytes.
pub(crate) trait ByteSlice: AsRef<[u8]> {
unsafe fn first_unchecked(&self) -> u8 {
debug_assert!(!self.is_empty());
// SAFETY: safe as long as self is not empty
unsafe { *self.as_ref... |
use super::super::utils::http_get;
use crate::{
error::{Error, Result},
market::{Fees, Precision, QuantityLimit},
Market,
};
use crypto_market_type::MarketType;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use std::collections::HashMap;
fn check_error_in_body(body: String) -> Result<String>... |
use std::cell::RefCell;
use std::fmt;
use std::marker::PhantomData;
use std::pin::Pin;
use std::rc::Rc;
use std::task::{Context, Poll};
use bytes::{Bytes, BytesMut};
use futures::{ready, Sink, Stream};
use ntex_codec::{Decoder, Encoder};
use super::{Codec, Frame, Message, ProtocolError};
/// Stream error
#[derive(De... |
// Copyright 2018-2020, Wayfair GmbH
//
// 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... |
use anyhow::Result;
use home::home_dir;
use serde::{Deserialize, Serialize};
use serde_json::json;
use serde_json::Value;
use std::collections::HashMap;
use std::fs;
use std::io::BufReader;
use std::io::Read;
use std::path::PathBuf;
use std::process::Child;
use std::process::Command;
use std::process::Stdio;
use std::s... |
use std::{convert::TryInto, marker::PhantomData};
use kvdb::KeyValueDB;
use kvdb_memorydb::InMemory as MemoryDatabase;
#[cfg(feature = "web")]
use kvdb_web::Database as WebDatabase;
use libzeropool::{
constants,
fawkes_crypto::{ff_uint::Num, ff_uint::PrimeField, BorshDeserialize, BorshSerialize},
native::{... |
use logos::{Logos, SpannedIter};
use std::{
convert::TryFrom,
fmt::{Display, Formatter, Result as FmtResult},
};
use pijama_common::location::{Located, Location};
mod raw;
use raw::RawToken;
#[derive(Debug, Clone)]
pub enum LexError {
Internal,
Custom(&'static str),
}
pub struct Lexer<'a> {
i... |
use crate::cli::CLIResults;
use std::fs;
use std::io::Write;
use std::path::Path;
use subprocess::{Exec, Redirection};
use sha2::{Digest, Sha256};
fn run_command_in_dir(command: &str, args: &[&str], dir: &str) {
let data = Exec::cmd(command)
.args(args)
.stdout(Redirection::Pipe)
.stderr(R... |
#[derive(Default)]
struct Operands {
pub x: i32,
pub y: i32,
pub x_mode: i32,
pub y_mode: i32,
pub x_addr: usize,
pub y_addr: usize,
}
fn fetch_operands(modes: i32, ip: usize, data: &[i32]) -> Operands {
let mut ops: Operands = Default::default();
ops.x_mode = modes % 10;
ops.y_mode... |
use std::thread::{self, JoinHandle};
use std::path::Path;
use std::path::PathBuf;
use std::io;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use chrono::prelude::*;
use regex::Regex;
use glob::glob;
use glob::PatternError;
use glob::GlobError;
use std::sync::mpsc::SyncSender;
use writer::file_writer::FileWrit... |
use hb;
use libc::c_void;
use std;
use std::marker::PhantomData;
use std::path::Path;
use std::fs::File;
use std::io::Read;
use std::fmt;
use common::{HarfbuzzObject, Owned, Shared};
/// A `Blob` manages raw data like e.g. file contents. It refers to a slice of bytes that can be
/// either owned by the `Blob` or no... |
use rocket::{
http::{ContentType, Status},
response::content::Content,
};
use rocket_contrib::templates::Template;
use serde::{Deserialize, Serialize};
use database::schema::accounts::{AccountError, User};
use crate::webserver::{
auth::SessionId, localization::UserLanguage, Failure, FullPathAndQuery, Requ... |
use std::{
cmp, env,
ffi::OsStr,
fs::{self, ReadDir},
path::Component,
path::{Path, PathBuf},
};
use crate::{dialogs::Confirmation, info, oof};
/// Checks if the given path represents an empty directory.
pub fn dir_is_empty(dir_path: &Path) -> bool {
let is_empty = |mut rd: ReadDir| rd.next().... |
pub mod entity {
use rustc_hash::FxHashMap;
use std::sync::RwLock;
pub trait EntityMappingPersistor {
fn get_entity(&self, hash: u64) -> Option<String>;
fn put_data(&self, hash: u64, entity: String);
fn contains(&self, hash: u64) -> bool;
}
#[derive(Debug, Default)]
pub... |
use crate::{database::DatabaseGuard, pdu::PduBuilder, utils, ConduitResult, Error, Ruma};
use ruma::{
api::client::{
error::ErrorKind,
r0::message::{get_message_events, send_message_event},
},
events::EventType,
EventId,
};
use std::{
collections::BTreeMap,
convert::{TryFrom, Try... |
use crate::card::{Card, Face, Suit};
use crate::err::SolError;
#[derive(Clone, Copy, PartialEq)]
pub enum FaceOrder {
Asc,
Desc,
Any,
}
pub fn str_to_face_order(s: &str) -> Result<FaceOrder, SolError> {
match s {
"asc" | "ascending" | "inc" | "increasing" => Ok(FaceOrder::Asc),
"desc" ... |
use crate::command;
use crate::connection;
use crate::model::cfd::Dlc;
use crate::model::cfd::OrderId;
use crate::model::cfd::Role;
use crate::model::cfd::SetupCompleted;
use crate::model::Usd;
use crate::oracle::Announcement;
use crate::process_manager;
use crate::setup_contract;
use crate::wallet;
use crate::wire;
us... |
use std::{
fs::File,
thread::sleep,
time::Duration,
};
use async_trait::async_trait;
use ctor::ctor;
use env_logger;
use lazy_static::lazy_static;
use log::{debug, warn};
use openssl::{
ec::EcKey,
rsa::Rsa,
};
use rand::random;
use rusoto_core::{
Region,
request::HttpClient,
};
use rusoto_cr... |
use crate::bub::functions::BubFnsRules;
use crate::bub::functions::{BubFnsVariable, BubFnsVariable::*};
use mpl::rules::{RightRule, Rules};
use mpl::symbols::U8SliceTerminal;
type Rule<'a> = RightRule<U8SliceTerminal<'a>, BubFnsVariable>;
impl<'a> Rules<U8SliceTerminal<'a>, BubFnsVariable> for BubFnsRules {
fn g... |
#[allow(dead_code)]
#[allow(unused_imports)]
#[allow(unused_variables)]
#[allow(unused_must_use)]
// Import libraries
// A simple printing function
fn printer(num:i32) { println!("{}", num); }
// A simple doubling function
fn double(int: &mut i32) { *int *= 2; println!("{}", int); }
// A simple product function
fn ... |
use std::fmt::Display;
use nom::error::{self, ParseError};
use nom::Parser;
use crate::{IResult, Span};
pub trait NomErrorExt<E> {
fn is_failure(&self) -> bool;
fn map_err<O: FnOnce(E) -> E>(self, op: O) -> nom::Err<E>;
fn map_fail<O: FnOnce(E) -> E>(self, op: O) -> nom::Err<E>;
}
impl<E> NomErrorExt<E>... |
//! A TCP stream for communicating with shadowsocks' proxy client
use std::{
io,
pin::Pin,
task::{self, Poll},
};
#[cfg(feature = "aead-cipher-2022")]
use bytes::BytesMut;
use futures::ready;
use pin_project::pin_project;
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf};
use crate::{
context::SharedCo... |
use byteorder::{BigEndian, ReadBytesExt};
use communication::StreamHandler;
use hdfs_comm::block::{BlockInputStream, BlockOutputStream};
use hdfs_protos::hadoop::hdfs::{BlockOpResponseProto, ChecksumProto, OpReadBlockProto, OpWriteBlockProto, ReadOpChecksumInfoProto, Status};
use prost::Message;
use shared::NahFSError;... |
use crate::graph::dfs;
use crate::HashMap;
use std::cmp::Ordering;
use std::collections::hash_map::Entry;
module!(pt1: parse, pt2: parse);
fn calculate_ore_cost<'s>(
transformations: &Transformations<'s>,
fuel_goal: u64,
spare: &mut HashMap<&'s str, u64>,
) -> u64 {
spare.clear();
let... |
#![allow(clippy::unnecessary_mut_passed)]
#![deny(clippy::unimplemented)]
use chrono::Local;
use futures::lock::Mutex;
use polyfuse::{
io::{Reader, Writer},
reply::{ReplyAttr, ReplyEntry},
Context, DirEntry, FileAttr, Filesystem, Operation,
};
use polyfuse_tokio::Server;
use std::{io, mem, os::unix::prelud... |
use std::collections::HashMap;
use std::sync::mpsc::{channel, Receiver, Sender};
use std::sync::{Arc, Barrier};
use std::{thread::JoinHandle, time::Duration};
use log::{debug, error, info, trace};
use waithandle::{WaitHandleListener, WaitHandleSignaler};
use crate::builds::{Build, BuildStatus};
use crate::config::{Co... |
use std::collections::HashMap;
use xmltree::Element;
use utils;
use std::path::Path;
#[derive(Debug)]
pub struct Device {
pub name: String,
pub description: String,
pub modules: HashMap<String, Module>,
}
fn get_conflict<'a>(map: &HashMap<u32, &'a Register>, reg: &Register) -> Option<&'a Register> {
f... |
use crate::contexts::{ExecutionContextImpl, QueryContextImpl};
use crate::error;
use crate::layers::add_from_directory::{
add_layer_collections_from_directory, add_layers_from_directory,
};
use crate::layers::storage::HashMapLayerDb;
use crate::pro::contexts::{Context, ProContext};
use crate::pro::datasets::{add_da... |
/// Control and Status Registers
///
/// Documentation Comments are derivative works of
/// "The RISC-V Instruction Set Manual Volume II: Privileged Architecture
/// Document Version 20190608-Priv-MSU-Ratified"
///
/// Creative Commons Attribution 4.0 International License.
use core::convert::TryInto;
/// The Wait for... |
use crate::epi::channel::{MessageReceiver, MessageSender};
use crate::epi::solver::SolverMessage;
use crate::problem::ProblemSpec;
use crate::registry::FactoryRegistry;
use crate::rng::{ArcRng, Rng as _};
use crate::solver::{Solver, SolverFactory, SolverRecipe, SolverSpec};
use crate::trial::{EvaluatedTrial, IdGen, Nex... |
use actix_web::{middleware, web, App, HttpResponse, HttpServer, Responder};
use askama::Template;
use reqwest::{header, Certificate, Client};
use serde_derive::Deserialize;
use serde_json::json;
use tokio::{fs::File, io::AsyncReadExt};
use std::env;
use std::fmt::Debug;
use std::path::Path;
use std::sync::Arc;
#[deri... |
use crate::util::location::Location;
use crate::util::point_2d::Point2d;
use std::cmp::Ordering;
use std::collections::{BinaryHeap, HashMap, HashSet};
const RELATIVE_NEIGHBOR_POINTS: [Point2d<i32>; 4] = [
Point2d { x: 0, y: 1 },
Point2d { x: 1, y: 0 },
Point2d { x: 0, y: -1 },
Point2d { x: -1,... |
use nalgebra::{DMatrix, Dynamic, MatrixXx1, U1};
use rand::prelude::*;
use serde::{Deserialize, Serialize};
use std::fs::File;
use std::io::{BufReader, BufWriter};
use std::path::Path;
struct MnistDataset {
records: Vec<MnistRecord>,
}
struct MnistRecord {
target: usize,
targets: Vec<f32>,
inputs: Vec... |
extern crate futures;
extern crate hyper;
extern crate quikdecision;
extern crate qdweb;
use futures::future;
use hyper::rt::Future;
use hyper::service::service_fn;
use hyper::{Body, Method, Request, Response, Server, StatusCode};
use std::path::{Path,PathBuf};
use std::fs::File;
use std::io::prelude::*;
use std::ffi:... |
//! The error module contains all the data structures that represent
//! an error.
use crate::{ast::InterfaceType, interpreter::Instruction};
use std::{
error::Error,
fmt::{self, Display, Formatter},
num::TryFromIntError,
result::Result,
string::{self, ToString},
};
/// A type alias for instructio... |
extern crate alloc;
use alloc::sync::Arc;
#[derive(Debug)]
enum ListImpl<T> {
Nil,
Cons(T, Arc<ListImpl<T>>)
}
#[derive(Debug)]
pub struct List<T>(Arc<ListImpl<T>>);
impl<T: Copy> List<T> {
pub fn add(&self, t: T) -> List<T> {
List(Arc::new(ListImpl::Cons(t, self.0.clone())))
}
pub fn e... |
//! Row with the JSON web token input.
use base64ct::{Base64UrlUnpadded, Encoding};
use jwt_compact::{Header, ParseError, UntrustedToken};
use wasm_bindgen::{JsCast, UnwrapThrowExt};
use web_sys::{HtmlTextAreaElement, InputEvent};
use yew::{classes, html, Callback, Component, Context, Html, Properties};
use super::co... |
// If the numbers 1 to 5 are written out in words: one, two, three, four, five, then there are
// 3 + 3 + 5 + 4 + 4 = 19 letters used in total.
// If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used?
use std::collections::HashMap;
fn build_d1_hash_map(... |
//! Timing the host loop (usually fixed to the screen's refresh rate) with the
//! Gameboy emulation speed.
use std::time::{Duration, Instant};
use crate::{
Outcome,
args::Args,
};
/// How often the FPS are reported. Longer times lead to more delay and more
/// smoothing.
const REPORT_INTERVAL: Duration = D... |
use std::sync::mpsc;
use std::thread;
use std::collections::HashMap;
use crate::wm;
use crate::wm::events::{Event, EventValue};
#[derive(Clone, Debug)]
pub struct XWindowData {
pub x: i16,
pub y: i16,
pub width: u16,
pub height: u16,
pub name: String,
pub visible: bool,
}
const GEOMETRY_NOTIF... |
//! This crate implements a type for computing
//! [Kahan sums](https://en.wikipedia.org/wiki/Kahan_summation_algorithm)
//! over floating point numbers.
//! It also implements a new trait for computing Kahan sums over iterators of floats.
extern crate num_traits;
use num_traits::float::Float;
use std::borrow::Borrow;... |
use crate::prelude::*;
use crate::{error::Error, utils, Hasher};
type PartialTreeLayer<H> = Vec<(usize, H)>;
/// Partial tree represents a part of the original tree that is enough to calculate the root.
/// Used in to extract the root in a merkle proof, to apply diff to a tree or to merge
/// multiple trees into one.... |
#![warn(missing_docs)]
#![warn(missing_crate_level_docs)]
#![warn(missing_doc_code_examples)]
#![warn(clippy::pedantic)]
#![warn(clippy::nursery)]
//! A persister targetting `LocalStorage` in the browser.
//!
//! ```rust,no_run
//! # use automerge_persistent_localstorage::{LocalStoragePersister, LocalStoragePersisterE... |
extern crate clap;
extern crate term;
extern crate rand;
extern crate libc;
use clap::{App, Arg};
use std::io::{Read, Write};
use rand::Rng;
struct Stack {
stack: Vec<u64>,
}
impl Stack {
fn new() -> Stack {
Stack {
stack: vec![],
}
}
fn f2<F>(&mut self, func: F) where F:... |
//! High-level pieces.
use builtins;
use cell_gc::{self, GcHeapSession, GcLeaf};
use compile;
use env::{Environment, EnvironmentRef};
use errors::*;
use parse;
use std::path::Path;
use value::{BuiltinFnPtr, InternedString, Value};
use vm;
/// Create an environment that supports only core Scheme syntax.
///
/// It sup... |
//!
//! All the actual API handlers.
//!
use std::sync::{Arc, Mutex};
use http::{Response, StatusCode};
use human_size::{Byte, ParsingError, Size, SpecificSize};
use hyper::body::Body;
use tokio_stream::StreamExt;
use tokio::time::{Duration, Instant};
use warp::reply::Response as HyperResponse;
use warp::{filters::Box... |
use super::super::Context;
use crate::libraries::helpers::lua::terminate_session;
use crate::libraries::resources::{ResourceManager, ResourceManagerProvider};
use crate::with_shared_redis_resource;
use anyhow::Result;
use async_trait::async_trait;
use chrono::offset::Utc;
use jatsl::{Job, TaskManager};
use log::{error,... |
// Copyright (c) 2019-2020 Dropbox, Inc.
//! Helpers for requesting OAuth2 tokens.
use crate::Error;
use crate::client_trait::*;
use url::form_urlencoded::Serializer as UrlEncoder;
use url::Url;
/// Given an authorization code, request an OAuth2 token from Dropbox API.
/// Requires the App ID and secret, as well as ... |
use core::marker::Copy;
// use alloc::collections::BTreeMap;
use alloc::borrow::ToOwned;
use alloc::format;
use alloc::str::from_utf8;
use alloc::string::String;
use alloc::vec::Vec;
use memchr::{memchr, memchr3_iter};
use crate::buffer::ReadBuffer;
use crate::parsers::FromBuffer;
use crate::record::StateMetadata;
us... |
/* ********************************************************************** **
** This file is part of rsp2. **
** **
** rsp2 is free software: you can redistribute it and/or modify it under **
** the term... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.