text stringlengths 3.09k 13.9k |
|---|
mod pkt;
use crate::error::{Error, IoError};
use crate::exit_listener;
use mio;
use mio::net::UdpSocket;
use std::collections::VecDeque;
use std::net::SocketAddr;
use std::sync::{Arc, Mutex};
use std::thread;
pub struct NetServer {
que: Arc<Mutex<SendQueue>>,
new_data_readiness: mio::SetReadiness,
}
const UD... |
use std::thread;
use std::fmt;
use std::error::Error;
use std::sync::mpsc;
use std::cell::Cell;
use traits::{Runner, Process, Sender, Receiver, Signal};
use {MaridError};
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
enum ProcState {
Init,
SetupDone,
Finished,
}
#[derive(Debug, Eq, PartialEq, Clone)]
/// ... |
//! Mocks for the currencies module.
#![cfg(test)]
use super::*;
use frame_support::{construct_runtime, parameter_types, PalletId};
use sp_core::H256;
use sp_runtime::{
testing::Header,
traits::{AccountIdConversion, IdentityLookup},
AccountId32,
};
use crate as currencies;
parameter_types! {
pub const BlockHas... |
use std::collections::HashMap;
use os_pipe::pipe;
use mio::unix::SourceFd;
use mio::{Events, Poll, Token, Interest};
use std::io::{Read, ErrorKind};
use std::os::unix::io::{RawFd, AsRawFd};
use std::process::{Command, Stdio, ExitStatus};
use tokio::sync::broadcast::Sender;
use parking_lot::RwLock;
use std::sync::Arc;
u... |
//! Tests for various types of file (video, image, compressed, etc).
//!
//! Currently this is dependent on the file’s name and extension, because
//! those are the only metadata that we have access to without reading the
//! file’s contents.
use ansi_term::Style;
use crate::fs::File;
use crate::output::file_name::Fi... |
//! dirent implementation following http://pubs.opengroup.org/onlinepubs/009695399/basedefs/dirent.h.html
use alloc::boxed::Box;
use core::{mem, ptr};
use c_str::CStr;
use fs::File;
use header::{errno, fcntl, stdlib, string};
use io::{Seek, SeekFrom};
use platform;
use platform::types::*;
use platform::{Pal, Sys};
c... |
// Copyright 2018 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 anyhow::{format_err, Context as _, Error};
use carnelian::{
color::Color,
drawing::{FontDescription, FontFace, Paint},
measure_text, Canvas... |
//! Installs rust-analyzer language server and/or editor plugin.
use std::{env, path::PathBuf, str};
use anyhow::{bail, format_err, Context, Result};
use xshell::{cmd, pushd};
// Latest stable, feel free to send a PR if this lags behind.
const REQUIRED_RUST_VERSION: u32 = 47;
pub struct InstallCmd {
pub client:... |
use crate::data::{Data, ParseBytes, TryFromBytes};
use crate::iter_utils::IterUtils;
use crate::parser::Parser;
use itertools::Itertools;
use std::collections::BTreeMap;
type RuleId = u8;
#[derive(Debug, Clone, Eq, PartialEq)]
enum Rule {
Char(u8),
Sequence(Vec<RuleId>),
EitherSequence {
either: V... |
pub mod s3;
use crate::CubeError;
use async_trait::async_trait;
use chrono::{DateTime, Utc};
use futures::future::BoxFuture;
use futures::FutureExt;
use log::debug;
use std::path::PathBuf;
use std::sync::Arc;
use tokio::fs;
use tokio::sync::RwLock;
use std::fmt::Debug;
#[derive(Debug, Clone)]
pub struct RemoteFile {
... |
//! Submission Queue
use core::sync::atomic;
use super::sys;
use super::util::{unsync_load, Mmap};
use bitflags::bitflags;
pub struct SubmissionQueue {
pub(crate) head: *const atomic::AtomicU32,
pub(crate) tail: *const atomic::AtomicU32,
pub(crate) ring_mask: *const u32,
pub(crate) ring_entries: *co... |
use crate::prelude::*;
#[derive(Copy, Clone)]
pub enum RankMethod {
Dense,
Ordinal,
Min,
Max,
Average,
}
pub(crate) fn rank(s: &Series, method: RankMethod) -> Series {
// See: https://github.com/scipy/scipy/blob/v1.7.1/scipy/stats/stats.py#L8631-L8737
let len = s.len();
let null_count... |
//! Implementation neutral TLS API.
use std::io;
use std::fmt;
use std::error;
use std::result;
// Error
pub struct Error(Box<error::Error + Send + Sync>);
/// An error returned from the TLS implementation.
impl Error {
pub fn new<E : error::Error + 'static + Send + Sync>(e: E) -> Error {
Error(Box::n... |
use std::fs;
use serde::{Deserialize, Serialize};
use std::time::Duration;
pub mod helpers;
pub mod vendor;
pub const VERSION: &'static str = env!("CARGO_PKG_VERSION");
#[derive(Default, Serialize, Deserialize)]
pub struct Concentratord {
pub log_level: String,
#[serde(default)]
pub log_to_syslog: bool,... |
use num_traits::Zero;
use std::fmt::Debug;
use std::ops::{Add, Mul};
use super::PackB;
use std::marker::PhantomData;
pub trait VecMatMul<T: Copy + Add + Mul + Zero + Debug>:
Send + Sync + Debug + objekt::Clone
{
fn packed_a_len(&self) -> usize;
fn packed_a_alignment(&self) -> usize;
fn pack_a(&self, p... |
use advent_lib::{
cases::{GenericPuzzleCase, Puzzle, PuzzleCase, PuzzleRunner},
helpers::StringAdventExt,
};
use lazy_static::lazy_static;
use petgraph::stable_graph::StableGraph;
use regex::Regex;
use std::{
collections::{BTreeSet, HashMap},
iter::Iterator,
};
pub fn get_puzzles() -> Vec<Box<dyn Puzzl... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::blob::Blob;
use crate::node_type::{SparseMerkleInternalNode, SparseMerkleLeafNode};
use anyhow::{bail, ensure, Result};
use serde::{Deserialize, Serialize};
use starcoin_crypto::hash::*;
/// A proof that can be used to a... |
use super::{PositionWithAffinity, RectHeightStyle, RectWidthStyle, TextBox};
use crate::{interop::VecSink, prelude::*, scalar, textlayout::LineMetrics, Canvas, Point};
use skia_bindings as sb;
use std::{fmt, ops::Range};
pub type Paragraph = RefHandle<sb::skia_textlayout_Paragraph>;
unsafe_send_sync!(Paragraph);
impl... |
use crate::config::Config;
use super::{
args::{Domain, ForwardPath, ReversePath},
Command, Envelope, Response, ResponseCode,
};
pub struct Server {
config: Box<dyn Config>,
state: State,
command: String,
message: Envelope,
}
impl Server {
pub fn initiate(config: Box<dyn Config>) -> (Self, Response) {
let pr... |
// Copyright 2016 <NAME>, The Alacritty Project 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
//
// Unless required by ... |
use std::cmp::Ordering;
use std::path::PathBuf;
use std::process::Child;
use criterion_plot::prelude::*;
use stats::univariate::Sample;
use kde;
use report::{BenchmarkId, ValueType};
use itertools::Itertools;
use super::{debug_script, escape_underscores, scale_time};
use super::{DARK_BLUE, DEFAULT_FONT, KDE_POINTS,... |
use super::*;
use bytes::{Buf, BufMut, Bytes, BytesMut};
/// Return code in connack
#[derive(Debug, Clone, Copy, PartialEq)]
#[repr(u8)]
pub enum PubRelReason {
Success = 0,
PacketIdentifierNotFound = 146,
}
/// Acknowledgement to QoS1 publish
#[derive(Debug, Clone, PartialEq)]
pub struct PubRel {
pub pki... |
//! Common errors.
use std::ffi::OsString;
use std::fmt;
use std::io::Error as IoError;
use std::process::{Command, ExitStatus};
/// An error that can occur during a build.
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum BuildError {
/// A system-level IO error occurre... |
use crate::config;
use std::{borrow::Cow, str::FromStr};
use tui::{
style::{Color, Modifier, Style},
text::Span,
};
#[derive(Debug, Clone)]
pub struct Styles {
palette: Palette,
toggles: config::ColorToggles,
pub(crate) utf8: bool,
}
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
#[repr(u8)]
pub enu... |
pub mod application_command;
pub mod autocomplete;
pub mod message_component;
pub mod ping;
use application_command::ApplicationCommandInteraction;
use autocomplete::AutocompleteInteraction;
use bitflags::__impl_bitflags;
use message_component::MessageComponentInteraction;
use ping::PingInteraction;
use serde::de::{De... |
use std::collections::HashMap;
use regex::Regex;
use expresso::expression::Expression;
use expresso::machine::Machine;
#[derive(Debug)]
pub struct Context {
time_step: f64,
machine: Machine,
}
impl Context {
pub fn new() -> Self {
Self {
time_step: 1.0/60.0,
machine: Machine::new(),
}
}
pub fn get_mu... |
//! Provides functions related to the the dumped file.
use crate::upstream::Article;
use html5ever::driver::ParseOpts;
use html5ever::interface::{ElementFlags, QualName};
use html5ever::rcdom::{Node, RcDom};
use html5ever::tendril::{format_tendril, TendrilSink};
use html5ever::tree_builder::{Attribute, NodeOrText, Tre... |
use std::path::{Path, PathBuf};
use structopt::StructOpt;
use anyhow::{anyhow, Context, Result};
use app_dirs::{AppDataType, AppInfo};
const APP_INFO: AppInfo = AppInfo {
name: "kak",
author: "<NAME>",
};
// À une vache près, c'est pas une scrience exacte
const ONE_MONTH: std::time::Duration = std::time::Dur... |
use std::collections::HashMap;
use std::env;
use std::ffi::{OsStr, OsString};
use std::fmt;
use std::path::Path;
use std::process::{Command, ExitStatus, Output};
use std::str;
use notion_fail::{ExitCode, Fallible, NotionFail};
/// A builder object for an external process, similar to `std::process::Command`.
#[derive(... |
use crate::error::Error;
use clru::CLruCache;
use cosmwasm_vm::Checksum;
use wasmer::{Instance, Module, Store};
#[derive(Debug, Default, Clone, Copy, PartialEq)]
pub struct Stats {
pub hits: u32,
pub misses: u32,
}
impl Stats {
pub fn new() -> Self {
Self { hits: 0, misses: 0 }
}
}
/// An in... |
use std::fmt;
use std::net::SocketAddr;
use std::rc::Rc;
use error_chain::bail;
use common::new_rpc_system;
use futures::Future;
use rain_core::{errors::*, types::*, utils::*};
use super::super::state::StateRef;
use super::{DataObjectRef, TaskRef};
use wrapped::WrappedRcRefCell;
pub struct Governor {
/// Unique ... |
use base_x;
use diesel::debug_query;
use diesel::prelude::*;
use failure::{Fallible, ResultExt};
use std::{cmp, str};
use uuid::Uuid;
use crate::db::{self, model::*, schema::*, Paginate};
pub struct PadsDao {
pool: db::DBPool,
}
impl PadsDao {
pub fn new(pool: &db::DBPool) -> Self {
Self { pool: pool... |
//! A USB PCAP packet abstraction.
use pnet_macros::Packet;
use pnet_macros_support::types::{u1, u3, u4, u7, u16le, u32le, u64le};
use pnet_macros_support::packet::PrimitiveValues;
/// Represents a USB PCAP function for the requested operation.
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub st... |
//! Implementation of the ARP protocol
use core::convert::TryInto;
use crate::time;
use super::{Packet, Ipv4Addr, NetDevice, ETHTYPE_IPV4, Ethernet};
/// Ethernet type for ARPs
const ETHTYPE_ARP: u16 = 0x0806;
/// Hardware type for ethernet
pub const HWTYPE_ETHERNET: u16 = 1;
/// ARP opcodes
#[repr(u16)]
pub enum O... |
use anyhow::{bail, Result};
use clap::Parser;
use std::fs::File;
use std::io::Read;
use std::str::FromStr;
#[derive(Parser)]
#[clap(version = "1.0", author = "Raniz")]
struct Opts {
#[clap(short, long, default_value = "input")]
input: String,
#[clap(short, long)]
aim: bool,
}
fn main() -> Result<()> {... |
// Copyright 2021 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::{commands::types::DiagnosticsProvider, types::Error},
async_trait::async_trait,
diagnostics_data::{Data, DiagnosticsData},
dia... |
use crate::{
dimensions::GridDirection,
maps::MapConfig,
};
use gl::{
self,
types::{
GLsizei,
GLuint,
GLvoid,
}
};
use glm;
struct MeshInfo {
vertices: Vec<glm::Vec3>,
faces: Vec<GLuint>,
}
pub struct HexMesh {
vbo: GLuint,
ebo: GLuint,
num_faces: usize,... |
mod error;
use std::sync::Arc;
use wasm_bus::prelude::*;
use serde::*;
pub use std::time::Duration;
pub use std::net::SocketAddr;
pub use std::net::IpAddr;
pub use std::net::Ipv4Addr;
pub use std::net::Ipv6Addr;
pub use error::*;
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize, Deserial... |
// Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
//
use std::collections::HashMap;
use gltf::json::{buffer::View, texture::Sampler, Image, Material, Mesh, Root, Texture};
use crate::{MeldKey, Result, Tag};
use crate::gltfext::add_buffer_view_from_slice;
pub mod construct;
pub mod export;
p... |
// 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... |
use alloc::{vec::Vec, vec, string::String, format};
use anyhow::Error;
use crankstart::{
file::FileSystem,
graphics::{Graphics, LCDColor, LCDSolidColor},
system::System,
Playdate
};
use crankstart_sys::{FileOptions, PDButtons, LCDBitmapDrawMode};
use euclid::{point2, rect};
const X_PADDING: i32 = 20;
c... |
// Copyright (c) 2018-2021 <NAME> <<EMAIL>>,
// <NAME> <<EMAIL>>,
// <NAME> <<EMAIL>>
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/lice... |
pub mod cart_server_client;
pub mod mocks;
use crate::utilities::retry_loop::{self, retry_until_ok, RetryTimeoutError};
use self::cart_server_client::CartServerClient;
use self::mocks::MockStockServiceApi;
use actix_rt::task::JoinHandle;
use actix_rt::System;
use actix_web::dev::Server;
use anyhow::Error;
use cart_ser... |
//! Thread-local variables that may be accessed across dynamic library boundaries.
pub use abi_stable as macro_support;
use abi_stable::std_types::{RBox, RStr};
/// A key into thread-local storage.
pub struct LocalKey<T: 'static> {
#[doc(hidden)]
pub read: unsafe extern "C" fn() -> *const T,
}
/// Create one... |
//
// Copyright 2021 The Project Oak Authors
//
// 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 o... |
use common::AgentSettings;
pub use common::*;
use logdna_mock_ingester::{
http_ingester_with_processors, FileLineCounter, IngestError, ProcessFn,
};
use std::fs::File;
use std::future::Future;
use std::io::Write;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use ... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct SecondaryAssetGrp {
/// NoSecondaryAssetClasses
#[serde(skip_serializing_if = "Option::is_none")]
#[serde(rename = "1976")]
pub secondary_asset_classes: Option<fix_common::RepeatingValues<SecondaryA... |
extern crate maud;
extern crate toml;
extern crate comrak;
extern crate walkdir;
use maud::{html, Markup, DOCTYPE, PreEscaped};
use serde::Deserialize;
use std::{
collections::HashMap,
fs::File,
path::Path,
io::Read,
};
use walkdir::WalkDir;
use comrak::{markdown_to_html, ComrakOptions};
use syntect::{
... |
use {
rustls::{
server::{ClientHello, ResolvesServerCert},
sign::{any_supported_type, CertifiedKey, SignError},
},
std::{
ffi::OsStr,
fmt::{Display, Formatter},
path::Path,
sync::Arc,
},
};
/// A struct that holds all loaded certificates and the respectiv... |
use crate::jcli_app::utils::{open_api_verifier, DebugFlag, OpenApiVerifier};
use reqwest::{
self,
blocking::{Client, Request, RequestBuilder, Response},
header::HeaderValue,
};
use serde::{self, Serialize};
use serde_json::error::Error as SerdeJsonError;
use std::{fmt, string::FromUtf8Error};
use thiserror:... |
#![feature(try_blocks)]
// This is a basic implementation for a server that can handle an arbitrary number of chatrooms.
// All chatrooms are assigned a unique id by external services and the associated chatroom is
// allocated when the first client connects to the server.
mod chatroom;
mod model;
use crate::chatroo... |
use ed25519_dalek::{PUBLIC_KEY_LENGTH, SIGNATURE_LENGTH, Signer, Keypair, Verifier, PublicKey, KEYPAIR_LENGTH, SecretKey};
use std::os::raw::{c_ulong};
use std::{slice, ptr};
use ed25519_dalek::ed25519::signature::Signature;
/// Length of a random generator seed
pub const ED25519_SEED_LENGTH: c_ulong = 32;
/// The le... |
#[cfg(test)]
mod api_test;
pub mod interceptor_registry;
pub mod media_engine;
pub mod setting_engine;
use crate::media::dtls_transport::RTCDtlsTransport;
use crate::media::ice_transport::RTCIceTransport;
use crate::peer::certificate::RTCCertificate;
use crate::peer::ice::ice_gather::ice_gatherer::RTCIceGatherer;
use... |
pub mod category;
use htmlescape;
use pretty_bytes::converter::convert;
use serde_json;
use std::fs;
use std::io;
use std::path::{Path, PathBuf};
use config::Config;
// TODO: This function should work with paths that do not exist
/// This function is a secure version of the join method for PathBuf. The standart join... |
use std::collections::{HashMap, HashSet};
use syntax::ast::*;
use syntax::source_map::{SourceMap, Span};
use syntax::symbol::Symbol;
use syntax::visit::{self, Visitor, FnKind};
use json::{self, JsonValue};
use rewrite::{TextRewrite, TextAdjust};
fn encode_span(sm: &SourceMap, sp: Span) -> JsonValue {
let lo = sm... |
use std::char::from_u32 as char_from_u32;
use pest::Error;
use pest::iterators::{Pair, Pairs};
use ast::{Clause, Literal, Name, Program, Statement, Term, Variable};
use parser::Rule;
use parser::utils::{as_amb, as_one, as_one_any};
pub fn convert_program<'a>(
pairs: Pairs<'a, Rule>,
) -> Result<Program, Error<'a... |
use structopt::StructOpt;
use anyhow::{Error, Result};
use chrono::NaiveDate;
use prank::item::Item;
use prank::user::User;
use prank::DbConn;
use rocket::fairing::Fairing;
mod mail;
#[derive(StructOpt, Debug)]
#[structopt(about = "prankctl: CLI tool to manage prank")]
enum PrankCtl {
Users(UsersSubcommand),
... |
// Copyright (C) 2020 ADVANCA PTE. LTD.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
//! The Subsequence Graph.
use crate::prelude::*;
use std::collections::BTreeSet;
// =============
// === Graph ===
// =============
/// A graph vertex.
///
/// The vertices are identified by two indexes: a layer index and text's char index. See
/// `Graph` docs for details.
///
/// The field order is significant,... |
// File: day_22.rs
// Author: <NAME>
// Date: December 2020
/*
Copyright 2020 <NAME>
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 t... |
//! `badm` is a tool that stores your configuration files, or
//! [dotfiles](https://en.wikipedia.org/wiki/Hidden_file_and_hidden_directory), in a directory that replicates the directory hierarchy of the
//! dotfiles' original path, and creates symlinks to their original paths. This creates a
//! standardized and syste... |
use crate::enums::{IntoResult, OtcBool, OtcError, OtcResult};
use crate::video_frame::{FrameFormat, VideoFrame};
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::os::raw::c_void;
use std::sync::{Arc, Mutex};
lazy_static! {
static ref INSTANCES: Arc<Mutex<HashMap<usize, VideoCapturer>>> = Defa... |
const KEYS: [char; 69] = [
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I',
'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b',
'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', '... |
// Copyright (C) 2020 - 2022, J2 Innovations
//! Haystack Kinds
use std::fmt::Display;
use super::Value;
/// List all haystack kind types as an simple enum
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
pub enum HaystackKind {
/// No value
Null,
/// A remove tag
Remove,
... |
use std::collections::{HashMap, HashSet, BTreeMap};
type Position = (u64, u64);
#[derive(PartialEq, PartialOrd, Eq, Ord, Clone, Debug, Hash, Copy)]
enum Tool {
ClimbingGear,
Torch,
Neither,
}
static DEPTH: u64 = 10689;
static TARGET: Position = (11, 722);
fn geologic_index(p: Position, target: Position, lut: ... |
//! This module implements the "universal ping algorithm" for determining when
//! to next poll the user as to what they're doing. The scheduling algorithm
//! used here ensures that, given two target intervals between pings, a and b,
//! the ping times for a will be a superset of those for b iff a < b. more info
//! a... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Timer 0 Configuration"]
pub t0cfg: T0CFG,
#[doc = "0x04 - Timer 1 Configuration"]
pub t1cfg: T1CFG,
#[doc = "0x08 - Timer 0 Control Run control/status for timer 0"]
pub t0ctl: T0CTL,
#[doc = "0x0c - Timer 0 Targ... |
use dprint_core::{
configuration::get_unknown_property_diagnostics,
configuration::{
ConfigKeyMap, ConfigurationDiagnostic, GlobalConfiguration, ResolveConfigurationResult,
},
};
use serde::Serialize;
use std::{fmt, path::Path, str::FromStr};
use strum::AsRefStr;
#[derive(Debug, Clone, Default, Par... |
use lazy_static::lazy_static;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::sync::Mutex;
const ASCII_CHARS: &str = r##" !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^_`abcdefghijklmnopqrstuvwxyz{|}~"##;
lazy_static! {
static ref FONT_CACHE: Mutex<HashMap<String, Fon... |
use crate::ast::Val;
use crate::error_handling::pretty_print_warning;
use crate::interpreter::interpret::{InterpError, StackFrame};
use crate::parser::util::ParseError;
use crate::static_checking::exhaustiveness::{
check_program_exhaustiveness, ExhaustivenessError, ProgramExhaustivenessReport,
};
use crate::type_in... |
use std::fmt::{self, Display, Formatter};
use criterion::{measurement::WallTime, BenchmarkGroup, BenchmarkId, Throughput};
use rand::{distributions::uniform::SampleUniform, Rng, SeedableRng};
use spade::{
DelaunayTriangulation, HierarchyHintGenerator, LastUsedVertexHintGenerator, Point2, SpadeNum,
Triangulatio... |
// Copyright 2017-2019 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) a... |
//! An algorithmic, IIR reverberation filter.
use num::traits::Float;
use oxcable::types::{SAMPLE_RATE, AudioDevice, MessageReceiver, Sample, Time};
use oxcable::utils::ringbuffer::RingBuffer;
use oxcable::utils::helpers::decibel_to_ratio;
use super::rooms::Room;
/// Defines the messages that the MoorerReverb supp... |
use std::fmt::{Display, Error, Formatter};
use board;
#[derive(Copy, Clone, Eq, PartialEq)]
pub struct Coordinate {
pub row: usize,
pub col: usize,
}
impl Coordinate {
pub fn move_in(&self, dir: Direction, delta: usize) -> Option<Coordinate> {
match dir {
Direction::Up => if self.row >... |
use crate::api::AuthInfo;
use crate::api::{token::responses::LookupTokenResponse, EndpointMiddleware};
use crate::error::ClientError;
use async_trait::async_trait;
use rustify::clients::reqwest::Client as HTTPClient;
use std::{env, fs};
use url::Url;
/// Valid URL schemes that can be used for a Vault server address
co... |
use {
crate::*,
fnv::FnvHashMap,
std::{
cmp::{Ord, Ordering, Reverse},
path::Path,
},
};
#[derive(Debug)]
pub struct DirsReport<'d> {
pub dup_dirs: Vec<DupDir<'d>>,
pub brotherhoods: Vec<Brotherhood<'d>>,
pub auto_solvable_brotherhoods_count: usize,
pub dir_pairs: Vec<Di... |
use std::collections::HashMap;
use std::fs::File;
use std::io::Cursor;
use std::io::Read;
use std::io::Write;
use std::path::Path;
use super::chunk::{Chunk, Id};
use super::{ReadError, Result};
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
/// A BEAM File
///
/// ```
/// use liblumen_beam::beam::chunk::{C... |
use syntax::ast::{Crate, Expr, ExprKind, Lit, LitKind, Stmt, StmtKind};
use syntax::ptr::P;
use crate::command::{CommandState, Registry};
use crate::matcher::{MatchCtxt, Subst, replace_expr, mut_visit_match_with, find_first};
use crate::transform::Transform;
use crate::RefactorCtxt;
/// # `reconstruct_while` Command... |
#![feature(proc_macro_hygiene, decl_macro)]
#[macro_use]
extern crate rocket;
use clap::{App, Arg};
use rocket::config::{Config, Environment};
use rocket::response::NamedFile;
use rocket::response::Redirect;
use rocket::{Rocket, State};
use rocket_contrib::templates::Template;
use std::collections::HashMap;
use std::... |
use bevy::asset::LoadState;
use bevy::prelude::*;
use bevy::render::mesh::Indices;
use bevy::render::render_resource::{AddressMode, PrimitiveTopology, SamplerDescriptor};
use block_mesh::ndshape::{ConstShape, ConstShape3u32};
use block_mesh::{greedy_quads, GreedyQuadsBuffer, MergeVoxel, Voxel, VoxelVisibility, RIGHT_HA... |
// Copyright (C) 2020 <NAME> <<EMAIL>>
// Distributed under terms of the MIT license.
use crate::hand::Hand;
use crate::rules::*;
use crate::rules::Action::*;
const DAS: bool = DOUBLE_AFTER_SPLIT;
const PAIR_SPLITTING: [[bool; 10]; 10] = [
// 2 3 4 5 6 7 8 9 10 A <- ... |
use std::marker::PhantomData;
use {ResourceId, Resources};
/// Trait for fetching data and running systems. Automatically implemented for systems.
pub trait RunNow<'a> {
/// Runs the system now.
///
/// # Panics
///
/// Panics if the system tries to fetch resources
/// which are borrowed in an... |
use crate::util::Permutation;
pub struct FasterBingo {
bingo_size: u128,
bingo_range: u128,
necessary_column_cells: Vec<Vec<Vec<usize>>>,
num_called_column: Vec<usize>,
all_cards: u128,
bingo_cards_per_each_turn: Vec<u128>,
called_number: Vec<usize>,
perm_gen: Permutation,
}
impl Fas... |
use crate::bounding_volume::{BoundingVolume, AABB};
use crate::math::{Isometry, Real};
use crate::query::contact_manifolds::contact_manifolds_workspace::{
TypedWorkspaceData, WorkspaceData,
};
use crate::query::contact_manifolds::ContactManifoldsWorkspace;
use crate::query::query_dispatcher::PersistentQueryDispatch... |
use core::fmt;
use core::iter::FusedIterator;
use core::marker::PhantomData;
use core::mem;
use crate::char::Wide;
#[derive(Clone, Debug, Eq, PartialEq)]
pub struct DecodeWideError<T> {
code: T,
}
pub trait Decode: Copy + Eq + Ord + 'static {
fn next(iter: &mut Chars<'_, Self>) -> Option<Result<char, DecodeW... |
//! How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)?
#[derive(Debug, PartialEq)]
enum Month {
Janurary,
February,
March,
April,
May,
June,
July,
August,
September,
October,
November,
December,
}
impl Month {
c... |
use codec::{Decode, Encode};
use composable_tests_helpers::test::helper::assert_last_event;
pub use composable_traits::nft::NftClass;
use composable_traits::nft::{Key, ReferenceNft, Value};
use frame_support::{
assert_ok, bounded_btree_map,
traits::tokens::nonfungibles::{Inspect, Mutate},
};
use std::{
collections::... |
use clap::{crate_authors, crate_description, crate_name, crate_version, App, Arg};
use futures::{stream, StreamExt};
use once_cell::sync::{Lazy, OnceCell};
use reqwest::get;
use std::{
env, fs,
io::{BufRead, BufReader},
path::Path,
process::Stdio,
time::Duration,
};
use tokio::{process::Command, tim... |
// File: day_6.rs
// Author: <NAME>
// Date: December 2020
/*
Copyright 2020 <NAME>
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 super::Saver;
use async_std::fs;
use async_std::prelude::*;
use failure::Error;
use futures::future::BoxFuture;
use futures::FutureExt;
use futures::TryFutureExt;
use log::error;
use log::info;
use log::warn;
use std::path::PathBuf;
use std::sync::Arc;
use uuid::Uuid;
pub struct FilesystemSaver {
pub path: Arc... |
// SPDX-License-Identifier: MIT
//
// Copyright (C) 2022 Open Information Security Foundation
use crate::common::{
parse_base, parse_endian, parse_number, parse_number_or_name, parse_tag, parse_token,
};
use crate::{Base, ByteMath, ByteMathOperator, Endian, RuleParseError};
use nom::Err::Error;
use nom::IResult;
u... |
extern crate libc;
extern crate gl;
extern crate sdl2;
extern crate imgui_rs;
use std::os;
use std::ffi::CString;
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::mouse::Mouse;
use sdl2::keyboard::Keycode;
use imgui_rs::imgui::*;
use imgui_rs::renderer::Renderer;
fn cstr(input:&str) -> *const i8 {
CStri... |
use std::slice;
use prototty::{inputs, Input};
const MOD_SHIFT: u8 = (1 << 0);
macro_rules! convert_char_shift {
($lower:expr, $upper:expr, $shift:expr) => {
Some(Input::Char(if $shift {
$upper
} else {
$lower
}))
}
}
pub fn from_js_event(event_key_code: u8, ev... |
#[macro_use]
extern crate serde;
mod test_utils;
use chrono::{DateTime, NaiveDate, NaiveDateTime, Utc};
use flexi_logger::ReconfigurationHandle;
use hdbconnect::{Connection, HdbResult};
use log::{debug, info, trace};
#[test] // cargo test --test test_021_longdate
pub fn test_021_longdate() -> HdbResult<()> {
let... |
use parity_codec::{Decode, Encode};
use runtime_primitives::traits::As;
use support::{
decl_event, decl_module, decl_storage,
dispatch::Result, ensure, StorageMap,
};
use system::ensure_signed;
use rstd::prelude::*;
#[derive(Encode, Decode, Clone, PartialEq)]
#[cfg_attr(feature = "std", derive(Debug))]
pub enum Terr... |
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
// We're only providing virtio over MMIO devices for now, but we aim to add PCI support as well.
pub mod block;
use std::sync::atomic::{AtomicU8, Ordering};
use std::sync::{Arc, Mutex};
... |
// Core Local Interruptor (CLINT)
// https://static.dev.sifive.com/FU540-C000-v1.0.pdf
use crate::peripherals::timer::Timer;
pub struct Clint {
/// current clock cycle.
cycle: u64,
// Machine-mode software interrupts are generated by writing to the memory-mapped control register msip.
// Each msip reg... |
use crate::htslib::BSStrand;
// Set bit 2 for CA, CC or CT, and set bit 3 for AG, GG and TG
const RTAB: [u8; 64] = [
0, 0, 0, 0, 0, 0, 0, 0, // NX
0, 0, 0, 8, 0, 0, 0, 0, // AX
0, 4, 4, 0, 4, 0, 0, 0, // CX
0, 0, 0, 8, 0, 0, 0, 0, // GX
0, 0, 0, 8, 0, 0, 0, 0, // TX
0, 0, 0, 0, 0, 0, 0, 0, // N... |
use std::sync::{Arc, Mutex, RwLock};
use std::collections::VecDeque;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::mpsc::{Sender, Receiver};
use rand::Rng;
use crate::task::{Task, TaskState};
use crate::policy::Policy;
use std::thread;
use std::time::Duration;
use crate::{cycles, PARALLEL, LIMIT};
use... |
use ndarray::arr1;
use ndarray::prelude::*;
use ndarray_rand::RandomExt;
use rand::Rng;
use rand_distr::{Distribution, StandardNormal};
use crate::simulation::monte_carlo::PathGenerator;
pub struct MultivariateGeometricBrownianMotion {
initial_values: Array1<f64>,
/// drift term
drifts: Array1<f64>,
/... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.