text stringlengths 3.09k 13.9k |
|---|
use std::io::Write;
use pin_project::__private::Pin;
use std::{io, array};
use std::collections::{VecDeque};
use pin_project::pin_project;
use util::slice::SlicePair;
use tokio::io::{AsyncRead, ReadBuf};
use std::task::{Poll, Context};
use std::future::poll_fn;
use tokio::task::yield_now;
use tokio::io::AsyncReadExt;
u... |
#![recursion_limit = "1024"]
extern crate byteorder;
extern crate js_sys;
extern crate rand;
extern crate wasm_bindgen;
extern crate yew;
use byteorder::{ByteOrder, LittleEndian};
use js_sys::Date;
use rand::prng::XorShiftRng;
use rand::{Rng, SeedableRng};
use std::cmp::min;
use wasm_bindgen::prelude::*;
use yew::pre... |
use yew::prelude::*;
use yew_bootstrap::component::*;
use yew_bootstrap::util::*;
enum Msg {
#[allow(dead_code)]
AddOne,
}
struct Model {
value: i64,
}
impl Component for Model {
type Message = Msg;
type Properties = ();
fn create(_ctx: &Context<Self>) -> Self {
Self { value: 0 }
... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::base::SettingInfo;
use crate::config::default_settings::DefaultSetting;
use crate::handler::base::{SettingHandlerResult, State};
use crate::hand... |
use postgres::types::ToSql;
use postgres::GenericClient;
use crate::identity;
use crate::message_store::core::{MessageData, MessageStore};
use crate::Error;
pub type Params<'a> = &'a [&'a (dyn ToSql + Sync)];
pub trait Put<T, R> {
fn put(
&mut self,
data: T,
stream_name: &str,
exp... |
use crate::nf::handler::*;
pub const NF_MAX_ADDRESS_LENGTH: usize = 28;
pub const NF_MAX_IP_ADDRESS_LENGTH: usize = 16;
#[repr(C)]
#[derive(Debug)]
#[allow(dead_code)]
pub enum NFStatus {
NfStatusSuccess = 0,
NfStatusFail = -1,
NfStatusInvalidEndpointId = -2,
NfStatusNotInitialized = -3,
NfStatusI... |
use serde::de::DeserializeOwned;
use serde::Serialize;
use crate::{self as leptos, is_server};
use crate::{view, View};
use thiserror::Error;
/// Takes locale (as `&str`), hydration state (`T`), and render state (`R`) to render a [View](leptos::View)
type BodyFn<T, R> = fn(&str, &T, &R) -> View;
type HeadFn<T, R> = ... |
use crate::{
dist::l2_norm, multi_probe::QueryDirectedProbe, utils::create_rng, DataPointSlice, FloatSize,
};
use ndarray::prelude::*;
use ndarray_rand::rand_distr::{StandardNormal, Uniform};
use ndarray_rand::RandomExt;
use serde::{Deserialize, Serialize};
pub type HashPrimitive = i8;
pub type Hash = Vec<HashPrim... |
use crate::ast::{Name, TypeId};
use im::hashmap::HashMap;
pub type ScopeId = usize;
#[derive(Debug, PartialEq, Clone)]
pub struct Scope {
pub symbols: HashMap<Name, SymbolEntry>,
pub scope_type: ScopeType,
pub parent: Option<ScopeId>,
pub parent_func_scope: Option<ScopeId>,
}
#[derive(Debug, PartialE... |
// Copyright 2020 Netwarps Ltd.
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the "Software"),
// to deal in the Software without restriction, including without limitation
// the rights to use, copy, modify, merge, publish, dis... |
use core::ops::{Deref, DerefMut};
use core::{fmt, mem, slice};
use redox_simple_endian::*;
use aes::{Aes128, BlockDecrypt, BlockEncrypt};
use uuid::Uuid;
use crate::{AllocList, BlockPtr, KeySlot, Tree, BLOCK_SIZE, SIGNATURE, VERSION};
pub const HEADER_RING: u64 = 256;
/// The header of the filesystem
#[derive(Clone... |
use wasm_bindgen::prelude::*;
fn rand_range(min: u8, max: u8) -> u8 {
min + (js_sys::Math::random() * (max - min) as f64).round() as u8
}
// --
#[wasm_bindgen]
#[derive(Default, Clone, Copy, Debug, PartialEq, Eq)]
pub struct Cell {
pub alive: bool,
r: u8,
g: u8,
b: u8,
age: u32,
life_expectancy: u32,
}... |
#![no_std]
use embedded_hal;
pub use efm32;
#[cfg(feature = "rt")]
pub use crate::efm32::interrupt;
pub mod toboot;
pub mod capacitive;
pub mod clocks;
pub mod delay;
pub mod gpio;
pub mod led;
pub mod time;
pub mod uart;
pub mod usb;
pub mod watchdog;
#[cfg(feature = "toboot-custom-config")]
pub use tomu_macros:... |
use crate::constants::ceil_div;
/// Vector of boolean values optimized for prime sieving
///
/// Each bool in Rust is represented by a full 8-bit byte. For memory-constrained applications like
/// prime sieving, it is eight times as memory-efficient to compress these values into a single byte
/// and provide wrapper m... |
use datapack_common::vfs;
use debris_lang::{
backends::{Backend, DatapackBackend},
common::{BuildMode, Code},
CompileConfig,
};
use serde_json::json;
use std::{cmp::Ordering, fmt::Write};
use wasm_bindgen::prelude::*;
// use wee_alloc::WeeAlloc;
// #[global_allocator]
// static ALLOC: WeeAlloc = WeeAlloc::... |
use http::Uri;
use hyper::client::HttpConnector;
use hyper_openssl::HttpsConnector;
use hyper_proxy::ProxyConnector;
use serde::{Deserialize, Serialize};
use tonic::body::BoxBody;
use tower::ServiceBuilder;
use crate::{
config::{
AcknowledgementsConfig, GenerateConfig, ProxyConfig, SinkContext, SinkHealthc... |
//! Dead code elimination
//!
//! This pass removes any instruction that doesn't affect the module. It does so by considering all
//! `OpEntryPoint` instructions to be "rooted", and then everything a rooted instruction touches is
//! also rooted (done transitively). Then, any instruction not rooted is removed. It gets ... |
use super::{
ApplicationDispatcherExt, ApplicationExt, Callback, Event, Message, WebviewBuilderExt,
WindowBuilderExt,
};
use wry::{ApplicationDispatcher, ApplicationExt as _, WebviewMessage, WindowExt, WindowMessage};
use once_cell::sync::Lazy;
use crate::plugin::PluginStore;
use std::sync::{Arc, Mutex};
impl ... |
//! A minimal example that implements the GlobalAlloc trait.
use core::alloc::{GlobalAlloc, Layout};
use core::mem::transmute;
use core::ptr::{self, NonNull};
use slabmalloc::*;
use spin::Mutex;
use std::alloc::System;
/// SLAB_ALLOC is set as the system's default allocator, it's implementation follows below.
///
///... |
/*!
Inspired and compatible with [Moleculer JS](https://github.com/moleculerjs/moleculer)
You can currently do all the basics of `emit`, `broadcast` and `call`.
However it only works with the `NATS` transporter and `JSON` serializer/deserializer.
## Getting Started
Simple example showing how to receive an event, an... |
use crate::PayloadGenerator;
const FUA_HEADER_SIZE: usize = 2;
const NAL_UNIT_TYPE_MASK: u8 = 0x1f;
const NAL_UNIT_REF_IDC_MASK: u8 = 0x60;
/// This payload generator is responsible to generate RTP packet's payloads
/// from H.264 data in order to send them into a RTP stream.
#[derive(Clone, Copy, Debug, Default)]
pu... |
use crate::format::{CoordIndex, JobIndex};
use crate::parse_time;
use std::iter::once;
use std::sync::Arc;
use vrp_core::models::common::*;
use vrp_core::models::problem::{Job, Single};
use vrp_core::models::solution::{Activity, Place};
use crate::format::solution::Activity as FormatActivity;
use crate::format::soluti... |
use crate::{point, DPPoint};
use crate::data::Coord;
use crate::scenes::{Scene, SceneParams};
use ggez::{Context, GameError, GameResult};
use ggez::event::KeyCode;
use crate::data::maps::{Map, Variant};
use crate::graphics::renderer::*;
use crate::data::diagonal::Diagonal;
use crate::algos::Algo;
use crate::graphics::m... |
//! Canvas rendering.
use crate::{canvas::*, gpu::*, paint::*, uniforms::*, Options, Result, World};
use glium::{
glutin::EventsLoop,
texture::texture2d_multisample::Texture2dMultisample,
texture::{Dimensions, MipmapsOption},
Frame, GlObject, Program,
};
use image::{ImageBuffer, Rgba};
use palette::{
... |
use serde::{Deserialize, Serialize};
const RATE_TABLE: [u16; 16] = [
428, 380, 340, 320, 286, 254, 226, 214, 190, 160, 142, 128, 106, 84, 72, 54,
];
/// Delta modulation channel
#[derive(Serialize, Deserialize)]
pub struct Dmc {
enabled: bool,
irq: bool,
pending_irq: Option<bool>,
loop_flag: bool... |
use std::path::Path;
use std::str::FromStr;
use std::string::ParseError;
use titlecase::titlecase;
#[derive(Debug, PartialEq)]
pub enum Format {
Md(char),
Git(char),
}
impl FromStr for Format {
type Err = ParseError;
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
"md"... |
// idbr_mod.rs
// Objects and method to work with indexeddb.
// Fully rust code and types. All the JsValue are wrapped.
// It uses the idb javascript library, idb_exports.ts and idbr_imports_mod.rs
use crate::idbr_imports_mod as idbjs;
use unwrap::unwrap;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsValue;
pub ... |
extern crate mazth;
use std::cmp;
use interface::i_interpolate::*;
use self::mazth::mat::*;
#[allow(unused_variables)]
#[derive(Debug)]
#[derive(Clone)]
pub struct SplineBezier {
pub _ctl: [ Mat4x1< f64 >; 4 ],
pub _point: Mat4x1< f64 >,
pub _point_d: Mat4x1< f64 >,
pub _point_dd: Mat4x1< f64 >,
... |
#![allow(non_snake_case)]
use crate::sys::{
statics::*,
util::{self, getClientState, getMenuState},
};
use std::ffi::CString;
use rglua::{cstr, globals::Lua::GLOBALSINDEX, lua_shared::*, rstr, types::LuaState};
const NO_LUA_STATE: &str = "Didn't run lua code, lua state is not valid/loaded!";
const INVALID_LOG_LEVEL... |
use std::io::prelude::*;
use std::io::BufReader;
use std::path::{Path, PathBuf};
use chrono::Utc;
use rand::distributions::Alphanumeric;
use rand::{thread_rng, Rng};
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::fs::File;
use tempfile::NamedTempFile;
#[derive(Serialize, Deserialize, Debug, Default)]... |
extern crate futures;
extern crate hyper;
extern crate pretty_env_logger;
#[macro_use] extern crate log;
mod storage;
mod hashstorage;
use std::rc::Rc;
use std::cell::RefCell;
use futures::{Future, Stream};
use hyper::{Get, Post, StatusCode};
use hyper::header::ContentLength;
use hyper::server::{Http, Service, Request... |
use crate::{
config::Config,
deps::{
kiss3d::{
camera::{
Camera,
FirstPerson,
},
context::Context,
nalgebra::{
Isometry,
Point3,
Translation3,
Vector3,
... |
use crate::error::{Error, Result};
use crate::ossfs_impl::backend::Backend;
use crate::ossfs_impl::node::Node;
use crate::ossfs_impl::stat::Stat;
use fuse::{FileAttr, FileType};
use rusoto_core::credential::StaticProvider;
use rusoto_core::request::HttpClient;
use rusoto_core::Region;
use rusoto_s3::{
CommonPrefix,... |
use casper_dao_modules::{AccessControl, TokenWithStaking};
use casper_dao_utils::{
casper_dao_macros::{casper_contract_interface, Instance},
casper_env::caller,
Address, Variable,
};
use casper_types::U256;
use delegate::delegate;
// Interface of the Reputation Contract.
//
// It should be implemented by [... |
#![cfg(test)]
extern crate ress;
#[macro_use]
extern crate criterion;
use criterion::black_box;
use criterion::Criterion;
use ress::Scanner;
use std::fs::read_to_string;
use std::path::PathBuf;
fn angular(c: &mut Criterion) {
run_bench(c, Lib::Angular, "angular", false);
}
fn angular_min(c: &mut Criterion) {
... |
use counter::Counter;
use gnuplot::*;
use rand::{Rng, RngCore};
use crate::impl_weight;
use crate::random::{Weight, WeightVec};
impl_weight!(isize);
/// Type of random strategy that is used to choose a goblin.
#[derive(Clone, Copy)]
pub enum RandomStrategy {
/// A goblin is chosen uniformly from all alive ones.
... |
use std::io::BufReader;
use std::sync::{Arc, Mutex};
use libheif_rs::{
ColorSpace, FileTypeResult, HeifContext, ItemId, Reader, RgbChroma, StreamReader,
};
use pyo3::exceptions;
use pyo3::prelude::*;
use pyo3::types::{PyBytes, PyTuple};
use pyo3::wrap_pyfunction;
use crate::stream::StreamFromPy;
mod stream;
fn ... |
//! Implementation of the `BuiltinOptions` derive macro.
use proc_macro::TokenStream;
use proc_macro2::Span;
use quote::{quote, ToTokens};
use std::collections::HashSet;
use std::os::raw::c_int;
use syn::spanned::Spanned;
struct VariantOption {
option: char,
name: syn::Ident,
argument_type: Option<syn::Ty... |
use crate::value::Value;
#[cfg(feature = "debug")]
use opcode;
type Line = u32;
#[derive(Debug, Clone, Default, PartialEq)]
/// A wrapper around an array of bytes
pub struct Chunk {
pub code: Vec<u8>,
pub constants: Vec<Value>,
pub lines: Vec<Line>,
}
impl Chunk {
pub fn new() -> Self {
Self:... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::{anyhow, bail, Result};
use diem_types::{
access_path::{AccessPath, Path},
account_config::diem_root_address,
account_state::AccountState,
transaction::{ChangeSet, TransactionStatus, Version, WriteSetPayload}... |
#![no_main]
#![no_std]
use cortex_m::*;
use cortex_m_rt as rt;
use embedded_hal::*;
use panic_semihosting;
use rt::{entry, exception, ExceptionFrame};
use smart_leds::{Color, SmartLedsWrite};
use stm32f1xx_hal as hal;
use stm32f1xx_hal::prelude::*;
use stm32f1xx_hal::{
gpio,
spi::Spi,
spi::{Mode, Phase, Po... |
use std::fmt;
use std::fmt::Write;
use std::iter::FromIterator;
use crate::errors::{ ErrorKind, Error };
#[derive(Default, PartialEq, Eq, PartialOrd, Clone, Hash)]
pub struct Id {
bytes: [u8; 20]
}
impl fmt::Debug for Id {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", self.to... |
use std::str::FromStr;
use anyhow::{Context, Result};
use clap::{Arg, ArgGroup, ArgMatches, Command};
use itertools::Itertools;
use prettytable::color::Color;
use prettytable::format;
use prettytable::{color, Attr, Cell, Row, Table};
use daml::lf::{DamlLfPackage, DarFile};
use crate::DarnCommand;
/// Darn command f... |
use crate::testing::{
jormungandr::starter::{Starter, StartupError},
jormungandr::JormungandrProcess,
node::LogLevel,
};
use crate::{
testing::{
network::{NodeSetting, PersistenceMode, Settings, SpawnParams},
JormungandrParams,
},
wallet::Wallet,
};
use chain_impl_mockchain::head... |
use crate::core::{Board, Piece, Color, Color::*, Square, Figure};
use std::collections::hash_set::HashSet;
use std::fmt::Display;
use itertools::Itertools;
pub struct GameBuilder {
// ?
}
#[derive(Clone)]
pub struct Game{
pub meta: Option<GameMeta>,
pub board: Board,
pub state: State,
pub moves: ... |
use super::error::{ErrorKind, Result};
use super::header;
use super::util::tcpconnection;
use super::{ServicePair, ServiceResult};
use byteorder::WriteBytesExt;
use serde_rosmsg::{from_reader, to_writer};
use std;
use std::collections::HashMap;
use std::net::TcpListener;
use std::sync::Arc;
use std::thread;
pub struct... |
pub use crate::def_mod;
pub use crate::zo::ZeroOne;
use std::marker::PhantomData;
use std::str::FromStr;
use std::{fmt, iter, ops};
pub mod conv;
pub mod io;
pub trait Mod: Default + Clone + Copy + PartialEq + Eq {
const M: u32;
const PHI: u32;
}
#[macro_export]
macro_rules! def_mod {
($name:ident, $modu... |
use egui::{containers::*, widgets::*, *};
use std::f32::consts::TAU;
#[derive(PartialEq)]
#[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))]
#[cfg_attr(feature = "serde", serde(default))]
pub struct FractalClock {
paused: bool,
time: f64,
zoom: f32,
start_line_width: f32,
... |
use std::collections::{HashSet, HashMap};
use ltl::Register;
use ltl::Label;
use ertl::liveness;
use ertl;
use common::ops;
use ltl::tree::Operand;
#[derive(Clone, Debug, Default)]
pub struct Arcs {
pub prefs: HashSet<Register>,
pub intfs: HashSet<Register>,
}
impl Arcs {
pub fn new() -> Self {
... |
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//! Triggers a forced fdr by comparing the configured
//! index against the stored index
use {
anyhow::{format_err, Context as _, Error},
fidl_fuc... |
use std::cell::Cell;
use std::ffi::c_void;
use std::ptr;
use std::rc::Rc;
use std::sync::atomic::{AtomicBool, Ordering};
use crate::{bindgen_prelude::*, check_status, sys, Result};
thread_local! {
#[doc(hidden)]
/// Determined is `constructor` called from Class `factory`
pub static ___CALL_FROM_FACTORY: AtomicB... |
// Licensed under the MIT license <LICENSE or
// http://opensource.org/licenses/MIT>. This file may not be copied,
// modified, or distributed except according to those terms.
use corpus_manager;
use std::fs;
use std::path::PathBuf;
use std::time::Duration;
use structopt::StructOpt;
#[derive(StructOpt)]
#[structopt(
... |
// Copyright (c) 2018-2020 MobileCoin Inc.
//! NetworkState implementation that polls nodes for their current state and is not part of
//! consensus. This is currently implemented by faking SCP messages and utilizing SCPNetworkState.
use crate::{NetworkState, SCPNetworkState};
use mc_common::{
logger::{log, Logge... |
// Copyright 2020 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or di... |
use super::range::Range;
use regex::Regex;
use thiserror::Error;
use std::fmt;
static RESERVED: &'static [&str] = &[
"abstract",
"as",
"asm",
"assert",
"async",
"attribute",
"auto",
"await",
"become",
"begin",
"box",
"break",
"case",
"catch",
"class",
"co... |
//! Schema definitions for d3log. Most of this data is to be stored in
//! serialized form on some entity accessible from all nodes in the
//! system.
//!
//! As a general note: we use BTree based maps & sets here over hashing
//! based ones for two reasons:
//! - they guarantee a stable order of elements which makes o... |
// Unless explicitly stated otherwise all files in this repository are licensed
// under the MIT/Apache-2.0 License, at your convenience
//
// This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2020 Datadog, Inc.
//
//! An executor for running async tasks.
#
#![allow(clippy::cast_ptr_alignment)]
use std::ptr::copy_nonoverlapping;
use std::slice;
// Holds a slice guaranteed to be shorter than 8 bytes
struct ShortSlice<'a>(&'a mut [u8]);
impl<'a> ShortSlice<'a> {
/// # Safety
//... |
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
//! Crypto primitives used by various [Helium][HELIUM] blockchain and wallet services.
//!
//! The library exposes both [Elliptic Curve (ECC)][ECC] NIST P-256 (secp256r1),
//! and ED25519 keypairs based on the excellent work done by the
//! [RustCrypto][RUSTCRYPTO] and [Dalek cryptography][DALEK] projects.
//!
//! ECC ... |
use std::fmt;
use std::str::{self, FromStr};
use std::prelude::v1::*;
use unicase::UniCase;
use header::{Header, HeaderFormat, parsing};
/// `StrictTransportSecurity` header, defined in [RFC6797](https://tools.ietf.org/html/rfc6797)
///
/// This specification defines a mechanism enabling web sites to declare
/// them... |
use ethane::rpc::{self, Rpc};
use ethane::types::{Bytes, PrivateKey, TransactionRequest, H160, H256, U256};
use rand::Rng;
use serde::de::DeserializeOwned;
use serde_json::Value;
use std::fmt::Debug;
use std::path::Path;
use std::process::Command;
use std::str::FromStr;
use tiny_keccak::{Hasher, Keccak};
mod spin_up;... |
//! # Single Sign-On (Command Line Interface)
//!
//! ## Environment Variables
//!
//! ### SSO_SENTRY_DSN
//!
//! Sentry DSN for logging, error handling integration, optional.
//!
//! ### SSO_LOG_PRETTY
//!
//! Format logs as multi-line JSON, optional, defaults to false.
//!
//! ### SSO_POSTGRES_URL
//!
//! Postgres co... |
use std::{
collections::HashMap,
fs::File,
io::{self, prelude::*, BufReader},
ops::{Deref, DerefMut},
path::Path,
};
use crate::light::LightProps;
use super::{
ast::{self, Command, Symbol, VaryInfo},
result::{EngineError, EngineResult, RuntimeError},
types::Kind,
utils::warn_unimpl... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
use std::collections::HashMap;
use std::fmt::{self, Debug};
use std::marker::PhantomData;
use std::ops::Index;
use crate::{Allocator, O... |
use ritual::cli;
use ritual::config::{Config, CrateProperties, GlobalConfig};
use ritual::cpp_data::CppPath;
use ritual::cpp_type::{CppBuiltInNumericType, CppType};
use ritual::rust_info::{NameType, RustPathScope};
use ritual::rust_type::RustPath;
use ritual_common::cpp_build_config::{CppBuildConfigData, CppLibraryType... |
use super::{
cache_cell::CacheCell,
dep_node::{DepNode, Dependent},
Storage,
};
use hashbrown::{
hash_map::{DefaultHashBuilder, RawEntryMut},
HashMap,
};
use std::{
any::type_name,
borrow::Borrow,
fmt::{Debug, Formatter, Result as FmtResult},
hash::{BuildHasher, Hash, Hasher},
m... |
use crate::component::stream::StreamCache;
use crate::component::Stream;
use crate::pipelines::Pipelines;
use crate::select::SelectPass;
use crate::style::Style;
use std::sync::Arc;
use std::sync::Mutex;
use vk::builder::Buildable;
use vk::cmd::stream::*;
use vk::mem::Handle;
use vk::pass::DrawPass;
use vk::winit;
str... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
use std::{
net::{TcpListener, SocketAddr, TcpStream},
time::Duration,
io,
};
use tezedge_recorder::{
common::MessageCategory,
database::{DatabaseNew, DatabaseFetch, rocks::Db, MessagesFilter},
... |
#![deny(clippy::pedantic)]
use dirs;
use serde::{Deserialize, Serialize};
use serde_json::{self};
use std::env;
use std::error::Error;
use std::ffi::OsString;
use std::fs::{self, File as FS_File};
use std::io::prelude::*;
fn main() -> std::io::Result<()> {
let args: Vec<String> = env::args().collect();
if arg... |
// Copyright 2022 pyke.io
// 2019-2021 Tauri Programme within The Commons Conservancy
// [https://tauri.studio/]
//
// 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... |
use crate::sim2::types::{CharacterAction, DamageType, FieldEnergy};
use crate::sim2::record::CharacterData;
#[derive(Debug, Clone, Copy)]
pub struct ActionColumn<T> {
pub burst: T,
pub press: T,
pub hold: T,
pub na: T,
pub ca: T,
}
impl Default for ActionColumn<f32> {
fn default() -> Self {
... |
// font-kit/src/sources/mem.rs
//
// Copyright © 2018 The Pathfinder Project Developers.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not ... |
use crate::path::Component;
use crate::path::Path;
use std::str::FromStr;
/// Separates the shard width and depth.
pub const SHARDSPLIT: &str = ":";
/// Terminates the end of a shard shorthand.
pub const SHARDEND: &str = "#";
/// The width of a shard is how many bytes/characters to use for each path component in shar... |
use hex;
use immense::*;
use itertools::iproduct;
use lazy_static::lazy_static;
use noise::{Fbm, NoiseFn};
use palette::encoding::pixel::Pixel;
use palette::encoding::srgb::Srgb;
use palette::rgb::Rgb;
use rand::seq::SliceRandom;
use rand::thread_rng;
use rand::Rng;
use std::fs::File;
use std::io::BufWriter... |
//! Button control widget.
use {
crate::{
base::{self, Repaintable},
draw::{self, state, HasTheme},
geom::*,
ui,
},
reclutch::{
display::{Color, DisplayCommand, DisplayText, GraphicsDisplay, Rect},
prelude::*,
verbgraph as vg,
widget::Widget,
... |
//! Declare MockSleepRuntime.
use crate::time::MockSleepProvider;
use tor_rtcompat::{BlockOn, Runtime, SleepProvider, TcpProvider, TlsProvider, UdpProvider};
use async_trait::async_trait;
use futures::task::{FutureObj, Spawn, SpawnError};
use futures::Future;
use pin_project::pin_project;
use std::io::Result as IoRes... |
use crate::conversion;
use crate::{Application, Color, Debug, Mode, Point, Size, Viewport};
use std::marker::PhantomData;
use winit::event::WindowEvent;
use winit::window::Window;
/// The state of a windowed [`Application`].
///
/// [`Application`]: ../trait.Application.html
#[derive(Debug, Clone)]
pub struct State<A... |
use crate::config::Contract;
use crate::generator::{CreateContract, TEMPLATES};
use crate::project_context::{BuildConfig, BuildEnv, Context, CONTRACTS_DIR};
use crate::recipe::Recipe;
use crate::signal::Signal;
use crate::util::cli;
use crate::util::git;
use anyhow::{anyhow, Result};
use std::fs;
use std::io::Write;
us... |
use crate::accounts_index::IndexValue;
use crate::bucket_map_holder::BucketMapHolder;
use solana_sdk::timing::{timestamp, AtomicInterval};
use std::fmt::Debug;
use std::sync::atomic::{AtomicU64, AtomicU8, Ordering};
use std::sync::Arc;
#[derive(Debug, Default)]
pub struct BucketMapHolderStats {
pub get_mem_us: Ato... |
// 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 {
crate::{
blob_location::BlobLocation, dynamic_index::DynamicIndex, pkgfs_inspect::PkgfsInspectState,
},
anyhow::{anyhow, Context ... |
// 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... |
//! * Driver for the LSM9DS1 accelerometer
//! See `http://www.st.com/en/mems-and-sensors/lsm9ds1.html`
//!
//! Driver needs to follow `https://github.com/RPi-Distro/python-sense-hat/blob/master/sense_hat/sense_hat.py`
//! in how it manages the settings file.
//!
//! It turns out handling IMUs is really complicated and... |
use codec::{Decode, Encode};
pub use aleph_bft::default_config as default_aleph_config;
use aleph_bft::{NodeCount, NodeIndex, TaskHandle};
use futures::{channel::oneshot, Future, TryFutureExt};
use sc_client_api::{backend::Backend, BlockchainEvents, Finalizer, LockImportRun, TransactionFor};
use sc_consensus::BlockImp... |
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.
// Polkadot is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any late... |
use crate::{Player, Location};
use crate::BOARD_SIZE_MAX;
use crate::board::go_board::{GoBoard, ChessType};
#[derive(Copy, Clone, Eq, PartialEq)]
enum Live {
Dead,
Alive,
None,
}
#[derive(Copy, Clone, Eq, PartialEq)]
enum Belong {
Black,
White,
None,
}
type LiveBoard = crate::board::Board<Liv... |
// 8 registers, 8 bit each (A, B, C, D, E, H, L)
pub struct Registers {
pub a: u8,
pub f: FlagsRegister,
pub b: u8,
pub c: u8,
pub d: u8,
pub e: u8,
pub h: u8,
pub l: u8,
}
const ZERO_FLAG_BYTE_POSITION: u8 = 7;
const SUBTRACT_FLAG_BYTE_POSITION: u8 = 6;
const HALF_CARRY_FLAG_BYTE_POSIT... |
use rand::distributions::Uniform;
use rand::prelude::*;
/// A trait that represents a perfect hash function [`Wikipedia`](https://en.wikipedia.org/wiki/Perfect_hash_function)
///
pub trait PerfectHash {
/// Hashes a key to find its positional index
#[inline]
fn hash<K: AsRef<[u8]>>(&self, key: K) -> usize ... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// 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 ... |
#![cfg(test)]
use crate as pallet_control;
use frame_support::{PalletId, {traits::GenesisBuild}};
use frame_system;
use sp_core::H256;
use sp_runtime::{testing::Header, traits::IdentityLookup};
// Types:
pub type AccountId = u32;
pub type BlockNumber = u64;
pub type Hash = H256;
pub type Timestamp = u64;
pub type Mom... |
use std::alloc;
use std::fmt;
use std::mem;
use uuid;
use crate::file::file::FileID;
use crate::file::piece::VersionID;
use crate::id::v1 as id;
pub const VERSION: VersionID = [0u8; 3];
pub const HEADER_LEN: usize = mem::size_of::<VersionID>()
+ mem::size_of::<[u8; 4]>()
+ mem::size_of::<[u8; 4]>()
+ mem::size_... |
use std::cell::RefCell;
use std::io::{Error, ErrorKind, Result};
use std::sync::atomic::{AtomicBool, AtomicU8, AtomicUsize, Ordering};
use std::task::{Context, Poll, Waker};
use crate::ResponseData;
use ds::RingSlice;
use protocol::{Request, RequestId};
#[repr(u8)]
#[derive(Clone, Copy)]
pub enum ItemStatus {
Ini... |
// Copyright 2018 The Exonum Team
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
//!
//! ### 6.Error handling
//!
//! URL: [Error handling](http://libcg.sourceforge.net/html/group__group__errors.html)
//!
//! Functions:
//! - cgroup_get_last_errno
//! - cgroup_strerror
//!
//! Usage:
//! ```
//! use libcgroup_rs::error::{cg_get_last_errno, cg_get_last_error_str};
//!
//! fn main()->Result<(),... |
use super::row::PgRow;
use super::schema_inspector::PgSchemaInspector;
use super::table::PgTable;
use super::writer::DumpWriter;
use crate::{Dumper, SchemaInspector, Table};
use anyhow::Result;
use datanymizer_engine::{Engine, Filter, Settings, TableList};
use indicatif::{HumanDuration, ProgressBar, ProgressStyle};
use... |
use std::collections::HashMap;
use std::{alloc, env, ffi, io, ptr};
use llvm_sys::core::*;
use llvm_sys::execution_engine::*;
use llvm_sys::orc::*;
use llvm_sys::target_machine::*;
use arret_runtime::boxed;
use arret_runtime::class_map::ClassMap;
use arret_runtime::intern::Interner;
use crate::codegen::analysis::Ana... |
//! actix-web support for Armour policies
/*
* Copyright (c) 2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* 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, i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.