text stringlengths 3.09k 13.9k |
|---|
// Copyright 2020 <NAME>
// SPDX-License-Identifier: Apache-2.0
use crate::address::IotaAddress;
use rand::{thread_rng, Rng};
use std::convert::TryInto;
#[derive(Debug, Clone)]
pub struct Input {
pub address: IotaAddress,
pub balance: u64,
}
pub fn select_input(target: u64, available_utxos: &mut [Input]) -> ... |
use bwapi_sys as sys;
use unit::Unit;
use player::Player;
use from_raw::FromRaw;
use game;
use std::ffi::CStr;
use std::os::raw::c_void as void;
#[repr(C)]
pub struct AIModule {
vtable: Box<sys::AIModule_vtable>,
handler: Box<game::EventHandler>,
}
impl AIModule {
pub fn new(handler: Box<game::EventHand... |
//! This library implements parts Saga system for execution and rollback
//! consectual steps.
//!
//! The basic concept of this installation is that each Saga is made of
//! a number of Adventures.
//! Each Adventure has a forward and backwards step.
//!
//! When a forward step returns a Failure, the state of that
//!... |
use super::*;
pub struct Code {
name: RcStr,
ops: Vec<Opcode>,
/// Describes how arguments map to the variables
/// in a Frame
params: Vec<Variable>,
varspec: VarSpec,
marks: Vec<Mark>,
doc: Option<RcStr>,
docmap: Rc<HashMap<RcStr, RcStr>>,
}
impl fmt::Debug for Code {
fn f... |
use egl;
use gbm::gbm_bo_flags;
use std::fs::File;
use std::os::raw::c_void;
use std::ptr;
use crate::egl_utils::{choose_config, match_config_to_visual};
#[rustfmt::skip]
const ATTRIBUTES: [egl::EGLint; 13] = [
egl::EGL_SURFACE_TYPE, egl::EGL_WINDOW_BIT,
egl::EGL_RED_SIZE, 8,
egl::EGL_GREEN_SIZE, ... |
use conrod_core::image::{Id, Map};
use glium::texture::{RawImage2d, SrgbTexture2d};
use glium::Display;
use std::path::Path;
use std::time::{Duration, Instant};
use super::{events as e, AppEvent, EventSystem};
use crate::data::File;
use crate::support::{ErrToString, ExtensionIs};
#[derive(Debug, Copy, Clone)]
struct ... |
#[macro_use]
mod ffi;
mod basic_block;
mod block_builder;
mod block_visitor;
// mod cir_jit;
mod cir_to_bb;
mod codegen;
mod disassemble;
mod memory;
pub use codegen::JitReturnCode;
pub use ffi::State;
pub use memory::Executable;
use crate::{
args::Settings,
ir::{Block, Pretty, PrettyConfig},
jit::codegen... |
use super::bins::Bins;
use super::errors::BinsBuildError;
use super::strategies::BinsBuildingStrategy;
use itertools::izip;
use ndarray::{ArrayBase, Axis, Data, Ix1, Ix2};
use std::ops::Range;
/// A `Grid` is a partition of a rectangular region of an *n*-dimensional
/// space—e.g. [*a*<sub>0</sub>, *b*<sub>0</sub>) × ... |
use super::*;
/////////////////////////////////////
/// Functions used to test that the C abi is the same in both the library and the loader.
#[repr(C)]
#[derive(StableAbi)]
pub struct CAbiTestingFns {
pub(crate) take_pair_a: extern "C" fn(Tuple2<u16, ()>) -> u32,
pub(crate) take_pair_b: extern "C" fn(Tuple2<... |
use ash::vk;
use ash::version::EntryV1_0;
use ash::version::InstanceV1_0;
use crate::core::debug;
use crate::core::debug::{ ValidationConfig, DebugInstanceType };
use crate::core::platforms;
use crate::utils::cast;
use crate::types::vkuint;
use crate::error::{ VkResult, VkError };
use std::ptr;
use std::ffi::CStri... |
use crate::MonolithDb;
use crate::common::label::{Label, Labels};
use crate::common::time_series::TimeSeries;
use crate::proto::{QueryResult, ReadRequest, ReadResponse, WriteRequest};
use crate::storage::Storage;
use crate::{Result, Timestamp};
use protobuf::{CodedInputStream, CodedOutputStream, Message, RepeatedField... |
#![allow(non_snake_case)]
// import at crate root level
pub(crate) mod Lazy;
pub(crate) mod Mutable;
// re-export at crate root level
pub use crate::Choice::*;
pub use std::collections::{HashMap, HashSet};
pub use std::rc::Rc;
pub use Lazy::*;
pub use Mutable::*;
pub type List_1<T> = Option<Rc<crate::List_::Node_1<T... |
use clap::{App, Arg};
use dirs::home_dir;
use std::io::{stdin, stdout, Write};
use std::process::exit;
mod postio;
use postio::Encryption;
fn main() {
let app = App::new("Postio")
.version(env!("CARGO_PKG_VERSION"))
.author("Ricky (Degausser) <<EMAIL>>")
.about("Send and receive encrypte... |
#![doc(html_root_url = "https://docs.rs/abnf_to_pest/0.1.1")]
//! A tiny crate that helps convert ABNF grammars to [pest][pest].
//!
//! Example usage:
//! ```
//! let abnf_path = "src/grammar.abnf";
//! let pest_path = "src/grammar.pest";
//!
//! let mut file = File::open(abnf_path)?;
//! let mut data = Vec::new();
/... |
extern crate backtrace;
use backtrace::Frame;
use std::thread;
static LIBUNWIND: bool = cfg!(all(unix, feature = "libunwind"));
static UNIX_BACKTRACE: bool = cfg!(all(unix, feature = "unix-backtrace"));
static LIBBACKTRACE: bool = cfg!(feature = "libbacktrace") && !cfg!(target_os = "fuchsia");
static CORESYMBOLICATIO... |
use {
super::help_content,
crate::{
app::*,
command::{Command, TriggerType},
conf::Conf,
display::{Screen, W},
errors::ProgramError,
launchable::Launchable,
pattern::*,
tree::TreeOptions,
verb::*,
},
std::path::{Path, PathBuf},
... |
//! PKCS#1 RSA Private Keys.
#[cfg(feature = "alloc")]
pub(crate) mod document;
#[cfg(feature = "alloc")]
pub(crate) mod other_prime_info;
use crate::{Error, Result, RsaPublicKey, Version};
use core::fmt;
use der::{asn1::UIntBytes, Decodable, Decoder, Encodable, Sequence, Tag};
#[cfg(feature = "alloc")]
use {self::o... |
//! Utilities for helping with metric tracking.
use std::sync::{
atomic::{AtomicU64, AtomicUsize, Ordering},
Once,
};
use sysinfo::{NetworkExt, NetworksExt, ProcessExt, SystemExt};
static SYS_INFO: Once = Once::new();
static TASK_COUNT: AtomicUsize = AtomicUsize::new(0);
static USED_MEM_KB: AtomicU64 = Atomi... |
#![recursion_limit = "256"]
pub mod cards;
pub mod data;
pub mod player;
pub mod ui;
use cards::card::Card;
use cards::utils;
use data::*;
use player::computer::ComputerPlayer;
use ui::cardbufui::CardBufUI;
use ui::selectui::SelectUI;
use yew::prelude::*;
use yew::services::ConsoleService;
pub struct Model {
con... |
//! This module contains the implementation of abstract virtual node.
use super::{Key, VChild, VComp, VList, VPortal, VSuspense, VTag, VText};
use crate::html::IntoComponent;
use std::cmp::PartialEq;
use std::fmt;
use std::iter::FromIterator;
use web_sys::Node;
/// Bind virtual element to a DOM reference.
#[derive(Cl... |
//! For middleware documentation, see [`ErrorHandlers`].
use std::{
future::Future,
pin::Pin,
rc::Rc,
task::{Context, Poll},
};
use actix_service::{Service, Transform};
use ahash::AHashMap;
use futures_core::{future::LocalBoxFuture, ready};
use crate::{
dev::{ServiceRequest, ServiceResponse},
... |
use crate::bub::{BubFrameReader, BubFrameReaderKind, BubMetadata};
use crate::{BubFnsCoord, LpcmKind, OaoSpaces, Sample};
use mycrc::CRC;
use std::fs::File;
use std::io::{BufReader, Read, Result};
use std::path::Path;
pub struct BubReader<R: Read> {
pub inner: R,
pub metadata: BubMetadata,
/// Speakers abs... |
//! Matrix identifiers for places where a room ID or room alias ID are used interchangeably.
use std::{
convert::TryFrom,
fmt::{Display, Formatter, Result as FmtResult},
};
#[cfg(feature = "diesel")]
use diesel::sql_types::Text;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use crate::{
... |
// Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause
//! This module defines the data structures used for the intermmediate representation (IR),
//! as well as the logic for compiling the filter into BPF code, the final form of the filter.
m... |
/*!
Type definition for two connected chains.
*/
use ibc_relayer::chain::handle::{ChainHandle, ProdChainHandle};
use ibc_relayer::config::SharedConfig;
use ibc_relayer::foreign_client::ForeignClient;
use ibc_relayer::registry::SharedRegistry;
use std::path::PathBuf;
use tracing::info;
use crate::relayer::foreign_c... |
// Copyright 2021 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 file.
use data_model::{DataInit, Le16, Le32, Le64};
pub const SECTOR_SHIFT: u8 = 9;
pub const SECTOR_SIZE: u64 = 0x01 << SECTOR_SHIFT;
pub const MAX_DISCARD... |
use crate::api_client::RateLimitedClient;
use crate::crates_cache::{CacheState, CratesCache};
use serde::{Deserialize, Serialize};
use std::{
collections::BTreeMap,
io::{self, ErrorKind},
time::Duration,
};
use schemars::JsonSchema;
use crate::common::*;
#[derive(Deserialize)]
struct UsersResponse {
... |
//! An experimental implementation of [Rust RFC#2256 libsyntax2.0][rfc#2256].
//!
//! The intent is to be an IDE-ready parser, i.e. one that offers
//!
//! - easy and fast incremental re-parsing,
//! - graceful handling of errors, and
//! - maintains all information in the source file.
//!
//! For more information, see... |
use super::{differ_database::DifferDatabase, foreign_keys_match};
use crate::pair::Pair;
use sql_schema_describer::{
walkers::{ColumnWalker, ForeignKeyWalker, IndexWalker, TableWalker},
PrimaryKey, TableId,
};
pub(crate) struct TableDiffer<'a, 'b> {
pub(crate) tables: Pair<TableWalker<'a>>,
pub(crate) ... |
use crate::shaderast::*;
use crate::env::VarKind;
use crate::ident::{Ident,IdentPath};
use crate::lit::{Lit};
use crate::span::Span;
use crate::ty::{Ty,TyLit};
use crate::val::Val;
use std::cell::Cell;
#[derive(Clone, Debug)]
pub struct ConstGatherer<'a> {
pub shader: &'a ShaderAst,
pub gather_all: bool,
}
im... |
extern crate gl;
extern crate x11;
use std::ffi::{CStr, CString};
use std::os::raw::{c_int, c_void};
use std::ptr::null_mut;
pub use x11::{glx::*, xlib};
// Minimum reuqired version for glxCreateContextAttribs extension
const GLX_CONTEXT_MAJOR_VERSION_ARB: u32 = 0x2091;
const GLX_CONTEXT_MINOR_VERSION_ARB: u32 = 0x2... |
//! Aggregated error type for this module
use crate::eth::pool::transactions::PoolTransaction;
use anvil_rpc::{
error::{ErrorCode, RpcError},
response::ResponseResult,
};
use ethers::{
providers::ProviderError,
signers::WalletError,
types::{Bytes, SignatureError, U256},
};
use foundry_evm::revm::Re... |
use std::cmp::min;
use std::io;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::Duration;
use byteorder::{BigEndian, ByteOrder};
use bytes::BytesMut;
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite};
use tokio::time::timeout;
pub struct SniffingStream<T> {
inner: T,
buf: BytesMut,
}
imp... |
use std::cell::{Cell, RefCell};
use std::rc::Rc;
use orbclient::{self, Color, Mode, Renderer as OrbRenderer, Window as OrbWindow};
use dces::World;
use application::Tree;
use backend::{Backend, BackendRunner, EventContext, LayoutContext, RenderContext};
use event::{
EventQueue, Key, KeyDownEvent, KeyUpEvent, Mou... |
use chrono::prelude::*;
use amount::Amount;
use deserialize;
/// Transactions are the basic unit of change in the Stellar Network.
/// A transaction is a grouping of operations.
///
/// To learn more about the concept of transactions in the Stellar network, take a look at the Stellar transactions concept guide.
#[deri... |
use std::fmt::{self, Debug};
use async_trait::async_trait;
use cast_trait_object::dyn_upcast;
use crate::graph::shape::{SinkShape, SourceShape};
use crate::graph::{stage, Inlet, Outlet, Port, Stage, PORT_DATA};
use crate::{AppData, ProctorResult, SharedString};
/// Filter the incoming elements using a predicate.
///... |
use super::*;
mod background;
#[path = "strategy/mod.rs"]
pub mod processor_strategy;
pub use background::*;
pub use processor_strategy::GameProcessorStrategy;
pub struct GameProcessor<G: Game> {
seed: Option<u64>,
strategy: Box<dyn GameProcessorStrategy<G>>,
players: Vec<Option<Box<dyn Player<G>>>>,
... |
//! Basic block and tokens a [template](`super::Template`) is created from.
use std::fmt;
use super::span::{ByteSpan, Spanned};
/// A parsed instruction from a template.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub enum BlockHint {
/// Starts a `Text` block
Text,
/// Starts a `Comment` block
Comment,
... |
// Copyright 2020 The Grin Developers
//
// 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 agree... |
use std::mem;
use crate::ffi;
#[repr(C)]
#[derive(Eq,PartialEq,Clone,Copy,Debug)]
pub enum Format {
UNKNOWN = -1,
BMP = 0,
ICO = 1,
JPEG = 2,
JNG = 3,
KOALA = 4,
//LBM = 5,
IFF = 5,
MNG = 6,
PBM = 7,
PBMRAW = 8,
PCD = 9,
PCX = 10,
PGM = 11,
PGMRAW = 12,
PNG = 13,
PPM = 14,
PPMRAW = 15,
R... |
use chrono::{DateTime, Utc};
use futures::{Stream, StreamExt};
use std::{
fmt::{self, Display, Formatter},
str::FromStr,
task::Poll,
time::Duration,
};
#[derive(Clone, Copy)]
pub enum Color {
Black,
Red,
Green,
Yellow,
Blue,
Purple,
Cyan,
White,
Fixed(u8),
}
impl Di... |
use migration_engine_tests::test_api::*;
use std::fmt::Write as _;
#[test_connector(tags(CockroachDb))]
fn soft_resets_work_on_cockroachdb(mut api: TestApi) {
let initial = r#"
CREATE TABLE "Cat" ( id TEXT PRIMARY KEY, name TEXT, meowmeow BOOLEAN );
CREATE VIEW "catcat" AS SELECT name, meowmeow FRO... |
use crate::context::*;
use crate::controller::write_response_to_fifo;
use crate::position::*;
use crate::types::*;
use crate::util::*;
use itertools::Itertools;
use jsonrpc_core::Params;
use lsp_types::*;
use std::collections::HashMap;
pub fn publish_diagnostics(params: Params, ctx: &mut Context) {
let params: Pub... |
use crate::custom_config::CustomConfig;
use crate::gen_struct::template::{Field, Template};
use crate::gen_struct::{GenStruct, GenTemplateData};
use async_trait::async_trait;
use inflector::Inflector;
use lazy_static::lazy_static;
use mysql::prelude::*;
use mysql::Row;
use mysql::*;
use quicli::prelude::*;
use regex::R... |
#![cfg(target_os = "windows")]
use std::ptr;
use winapi::shared::windef::HWND;
use winit;
use Api;
use ContextError;
use CreationError;
use GlAttributes;
use GlRequest;
use PixelFormat;
use PixelFormatRequirements;
use api::egl;
use api::egl::ffi::egl::Egl;
use api::egl::Context as EglContext;
use api::wgl::Context... |
use combine::{
eof, many, many1, optional, satisfy, ParseError, Parser, Stream,
};
use csv;
use serde_json;
use std::fmt;
use std::io;
use std::path::{Path, PathBuf};
use std::str::FromStr;
use util::basename;
#[derive(Debug, PartialEq)]
pub enum CliSection {
From,
To,
}
impl FromStr for CliSection {
... |
#![warn(missing_docs)]
//! This crate provides a container that cannot be leaked (e.g. via `std::mem::forget()`) once `lock()`ed: `Lock<'lock, T>`.
//!
//! `Lock::lock()` returns an `Acceptor<'lock, T>`, which allows placing `T` inside the `Lock<'lock, T>`.
//!
//! If the only safe way to create `T` requires an `Accep... |
mod parse;
mod token;
pub use parse::Parser;
pub use token::{Lexer, Token, TokenKind};
use crate::{Expr, Function};
use std::collections::HashMap;
use std::fmt;
use std::ops;
///
/// cycle-lang spec
///
/// The reference is described mainly as a mathematical language with special operators.
/// Note that this is in... |
use std::any::{self, Any};
use std::collections::BTreeMap;
use std::marker::PhantomData;
use std::mem::{self, MaybeUninit};
use std::sync::Arc;
use bitvec::prelude::BitVec;
use parking_lot::RwLock;
use crate::{comp, entity, Archetype};
pub(crate) type SharedSimple<A> = Arc<RwLock<dyn AnySimpleStorage<A> + Send + Syn... |
use crate::check_replay_roundtrip;
use shuttle::rand::{thread_rng, Rng};
use shuttle::scheduler::RandomScheduler;
use shuttle::sync::Mutex;
use shuttle::{check_random, replay, thread};
use shuttle::{scheduler::DfsScheduler, Runner};
use std::collections::HashSet;
use std::sync::atomic::{AtomicUsize, Ordering};
use std:... |
use std::time::{Duration, UNIX_EPOCH};
use chrono::{DateTime, Utc};
use tui::{
style::{Color, Modifier, Style},
text::{Span, Spans, Text},
widgets::ListItem,
};
use crate::model::ThreadPost;
pub fn format_default(str: &str) -> String {
format!(" {}", str)
}
pub fn format_post(post: &ThreadPost, no: ... |
#![cfg(test)]
use crate as pallet_lrp;
use frame_support::{
construct_runtime, parameter_types,
traits::{GenesisBuild, Nothing},
};
use frame_system as system;
use orml_currencies::BasicCurrencyAdapter;
use orml_traits::parameter_type_with_key;
pub use pallet_balances::Call as BalancesCall;
use pallet_timestamp::{s... |
//! Traits, helpers and type definitions for embedded/no_std I/O functionality.
use core::fmt;
use core::result;
/// `blocking` turns a non-blocking transmit/receive into a blocking transmit/receive
pub fn blocking<F, O, E>(non_blocking: F) -> result::Result<O, E>
where F: Fn() -> result::Result<O, E>,
... |
use ::proptest::prelude::*;
use comfy_table::modifiers::UTF8_ROUND_CORNERS;
use comfy_table::presets::UTF8_FULL;
use comfy_table::ColumnConstraint::*;
use comfy_table::Width::*;
use comfy_table::*;
/// Pick any of the three existing ContentArrangement types for the table.
fn content_arrangement() -> impl Strategy<Valu... |
use std;
use std::mem;
use libc::*;
use std::ffi::CString;
use super::types::*;
type StartupFunc = extern fn (type_: c_int, module_number: c_int) -> c_int;
type ShutdownFunc = extern fn (type_: c_int, module_number: c_int) -> c_int;
type InfoFunc = extern fn () ;
type GlobalsCtorFunc = extern fn (global: *const c_void... |
use super::{MapBuilder, Map, Rect, apply_room_to_map,
TileType, Position, spawner, SHOW_MAPGEN_VISUALIZER, draw_corridor};
use rltk::RandomNumberGenerator;
use specs::prelude::*;
pub struct BspDungeonBuilder {
map : Map,
starting_position : Position,
depth: i32,
rooms: Vec<Rect>,
history: Vec<... |
use super::{InlineAsmArch, InlineAsmType};
use rustc_macros::HashStable_Generic;
use std::fmt;
def_reg_class! {
PowerPC PowerPCInlineAsmRegClass {
reg,
reg_nonzero,
freg,
}
}
impl PowerPCInlineAsmRegClass {
pub fn valid_modifiers(self, _arch: super::InlineAsmArch) -> &'static [char... |
use crate::serialization::prefab_loader::PrefabLoader;
use crate::utils::branch_likely_impl::unlikely;
use crate::wire_type::{deformmat_wired_id, NonPrefabWireType, WireType};
use crate::DeSerialization;
struct DefaultPrefabLoader {}
impl PrefabLoader for DefaultPrefabLoader {
fn skip_wire_type(&self) -> NonPrefa... |
use std::collections::HashMap;
pub type Link = Option<Box<Node>>;
#[derive(Debug, Clone)]
pub struct Node {
pub pow: f32,
pub key: Option<char>,
pub left: Link,
pub right: Link,
}
impl Drop for Node {
fn drop(&mut self) {
// println!("self.left = {:#?}", self.left);
}
}
impl Node {
... |
use std::io;
use std::mem::size_of;
use crate::udp::UdpWriter;
use crate::{Config, Error, Result, Wire};
use nom::bytes::complete::{tag, take};
use nom::error::context;
use nom::number::complete::be_u16;
/// Magic value "1WAY"
const RETRANSMIT_MAGIC: &[u8; 4] = b"1WAY";
/// The actual Retransmit header being set as... |
use serde::{Deserialize, Serialize};
use std::{collections::HashMap, time::Duration};
use tokio::{self, time::sleep};
use crate::errors::HomeRadioError;
#[derive(Clone)]
pub struct RemoteMediaService {
base_url: String,
host: String,
port: String,
client: awc::Client,
}
impl RemoteMediaService {
... |
/*
Copyright 2018 Intel Corporation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, ... |
use std::mem;
use futures::future::Shared;
use futures::sync::{mpsc, oneshot};
use futures::{Async, Future, Poll, Stream};
use never::Never;
/// Creates a drain channel.
///
/// The `Signal` is used to start a drain, and the `Watch` will be notified
/// when a drain is signaled.
pub fn channel() -> (Signal, Watch) {... |
use ascii::AsciiChar;
use core::ptr::Unique;
use krnl::port;
use krnl::port::Port;
use spin::Mutex;
use volatile::Volatile;
//
// ------------------> y (80)
// | > _ |
// | console |
// | |
// x-----------------x
// (25)
pub const MAX_ROW: usize = 25;
pub const MAX_COLUMN: usi... |
use std::error::Error;
use std::fs;
use std::io::{self, Write};
use std::mem::size_of;
use std::path::{Path, PathBuf};
use std::process;
use std::result;
use std::time::Instant;
use regex_automata::{DFA, Regex, RegexBuilder, DenseDFA, SparseDFA};
type Result<T> = result::Result<T, Box<dyn Error>>;
macro_rules! err {... |
use crate::model::AgentConfig;
use anyhow::Result;
use clap::App;
use clap::Arg;
use log::info;
use reqwest::Url;
use std::{path::Path, time::Duration};
use tokio::runtime::Builder;
use werkflow_core::sec::ZoneRecord;
use werkflow_core::sec::{Authentication, DnsControllerClient, DnsProvider};
use werkflow_core::sec::{C... |
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/.
use crate::vector::FocusMut;
use rand_core::{RngCore, SeedableRng};
use std::cmp::Ordering;
use std::mem;
fn gen_ran... |
use std::collections::BTreeMap;
use std::fmt::Display;
use std::io::Read;
use std::ops::Bound::Included;
use std::string::ToString;
use std::sync::Arc;
use anyhow::bail;
use crate::jwk::Jwk;
use crate::{JoseError, Map, Value};
/// Represents JWK set.
#[derive(Debug, Eq, PartialEq, Clone)]
pub struct JwkSet {
key... |
// https://processing.org/examples/flocking.html
mod utils;
extern crate js_sys;
use wasm_bindgen::prelude::*;
use vector2d::Vector2D;
use js_sys::Array;
use core::f64::consts::PI;
use std::ops::Add;
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(feature = "wee_alloc")... |
use super::{ColumnMap, Vector};
use crate::{eval, EvalContext, EvalResult, NativeGenericType, Type, Value};
use lazy_static::lazy_static;
use qry_lang::{BinaryOperator, Syntax, SyntaxNode};
use std::collections::HashMap;
#[derive(Clone, Debug)]
pub struct SqlExpression {
pub sql_type: Type,
pub text: String,
}
fn b... |
use crate::{
prelude::{AffineCurve, BigInteger, FpParameters, One, PrimeField, ProjectiveCurve, Zero},
Vec,
};
#[cfg(feature = "parallel")]
use rayon::prelude::*;
pub struct VariableBaseMSM;
impl VariableBaseMSM {
pub fn multi_scalar_mul_affine<G: AffineCurve>(
bases: &[G],
scalars: &[<G::... |
//! `zebrad` launch-specific shared code for the `zebrad` acceptance tests.
//!
//! # Warning
//!
//! Test functions in this file will not be run.
//! This file is only for test library code.
use std::{env, path::Path, time::Duration};
use color_eyre::eyre::Result;
use zebrad::config::ZebradConfig;
use zebra_test::... |
//! Look, I'm not happy about the code in here, and you shouldn't be either. This is all an awful,
//! dirty hack to work around the fact that there's no such thing as "run this after all unit tests"
//! in stable Rust. Don't do the things in here. They're bad. This is test only code, and should
//! never ever be remov... |
//! Defines common `async` tasks used by Krator's Controller
//! [Manager](crate::manager::Manager).
use std::future::Future;
use futures::FutureExt;
use kube::{api::ApiResource, api::GroupVersionKind, Resource};
use kube_runtime::watcher::Event;
use tracing::{debug, info, warn};
use crate::{
manager::controlle... |
//! Key code definitions.
#[allow(missing_docs)]
/// Define a key code according to the HID specification. Their names
/// correspond to the american QWERTY layout.
#[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)]
#[repr(u8)]
pub enum KeyCode {
/// The "no" key, a placeholder to express nothing.
... |
use super::Error;
use futures::{try_ready, Async, Future, Poll};
use std::time::{Duration, Instant};
use tokio::timer::Delay;
use tower::{retry::Policy, timeout::error::Elapsed};
pub trait RetryLogic: Clone {
type Error: std::error::Error + Send + Sync + 'static;
type Response;
fn is_retriable_error(&self... |
use guest::prelude::*;
use stacktrader_types as trader;
use trader::components::*;
const DEPLETED_COLOR: &str = "#A9A9A9";
/// Receives an entity, shard, elapsed time, etc from an EntityFrame
/// published on decs.frames.{shard}.{system}, e.g. `decs.frames.the_void.physics`
/// or `decs.frames.shard-two.navigation`. ... |
use morphorm::{GeometryChanged, PositionType};
use crate::{
Actions, Context, Data, Event, Handle, Lens, LensExt, Model, Modifiers, Orientation, Scrollbar,
Units, VStack, View, WindowEvent,
};
const SCROLL_SENSITIVITY: f32 = 35.0;
#[derive(Copy, Clone, Debug)]
pub struct RatioLens<L1, L2> {
numerator: L1... |
//
//! Copyright 2020 Alibaba Group Holding Limited.
//!
//! 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 super::Cmd;
use crate::common::JorupConfig;
use std::{
env::{self, consts::EXE_SUFFIX},
fs, io,
path::{Path, PathBuf},
};
use structopt::StructOpt;
use thiserror::Error;
/// Operations for 'jorup'
#[derive(Debug, StructOpt)]
pub enum Command {
Install(Install),
Update,
Uninstall,
}
/// Ins... |
use libc::{c_char, size_t};
use std::ffi::CStr;
use std::marker::PhantomData;
use std::ops::Deref;
use std::{fmt, mem, ptr};
use super::JsonnetVm;
use jsonnet_sys;
/// Rust wrapper for libjsonnet string values.
///
/// This string is allocated against a particular JsonnetVm, and may
/// not outlive the JsonentVm. It... |
use itertools::Itertools;
use ndarray::prelude::*;
fn c(x: f64) -> f64 {
1. - 3. * x * x + 2. * x.abs().powf(3.)
}
fn xorshift64(x: u64) -> u64 {
let x = x ^ (x << 13);
let x = x ^ (x >> 7);
let x = x ^ (x << 17);
x
}
struct Mute<T> {
x: Vec<T>,
size: usize,
state: usize,
max_stat... |
pub use self::checkstyle::*;
pub use self::diff::*;
pub use self::files::*;
pub use self::json::*;
pub use self::modified_lines::*;
pub use self::stdout::*;
use std::fs;
use std::io::{self, Write};
use std::path::Path;
use std::rc::Rc;
use thiserror::Error;
use crate::formatting::ParseSess;
use crate::{config::FileN... |
use std::fs::File;
use std::path::Path;
use serde::{Deserialize, Serialize};
use tera::{Context, Tera};
use crate::cmd::library::generate::config::Config;
use crate::cmd::library::generate::task::{CleanupScope, Task};
use crate::error::Error;
use crate::manifest::item::Item;
use crate::manifest::library::Library;
use... |
// Copyright 2018 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 ... |
//! Provides functions for determining the paths of files and directories
//! in a standard Notion layout in Unix-based operating systems.
use std::{env, io};
use std::path::PathBuf;
use std::os::unix;
use notion_fail::{ExitCode, Fallible, NotionFail};
#[derive(Debug, Fail, NotionFail)]
#[fail(display = "environment... |
use std::convert::TryFrom;
use v8::{script_compiler::Source, Context, DataError, Global, ModuleStatus, OwnedIsolate};
pub struct SsrEngine {
isolate: OwnedIsolate,
context: Global<Context>,
}
impl SsrEngine {
pub fn init() {
lazy_static! {
static ref INIT_PLATFORM: () = {
... |
// font-kit/src/properties.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 b... |
/*
* Copyright 2020 sukawasatoru
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to... |
use std::collections::HashSet;
use std::path::{Path, PathBuf};
use clap::{
crate_authors, crate_name, crate_version, value_t, App, AppSettings, Arg, Error, ErrorKind,
};
#[derive(Debug, PartialEq, Eq, Hash)]
enum Input {
File(PathBuf),
Stdin,
}
#[derive(Debug)]
pub struct Opts {
inputs: HashSet<Input... |
//! Utilities for communicating with the GPU.
use crate::math::{self as m, uv};
use zerocopy::{AsBytes, FromBytes};
/// Utility type to convert transform matrices to a form with appropriate padding
/// for sending to the GPU.
#[derive(Clone, Copy, AsBytes, FromBytes)]
#[repr(transparent)]
pub struct GpuMat3([[f32; 4]... |
use auto_struct_macros::auto_struct;
use reader_writer::generic_array::GenericArray;
use reader_writer::generic_array::typenum::{U32, U512};
use reader_writer::{IteratorArray, LazyArray, RoArray, Reader};
#[derive(Debug, Clone)]
pub struct MipmapSizeIter {
width: usize,
height: usize,
format: u32,
cou... |
#[cfg(feature = "unproven")]
use std::collections::HashMap;
use crate::elementext::ElementExt;
use xmltree::Element;
#[cfg(feature = "unproven")]
use crate::encode::Encode;
use crate::error::*;
#[cfg(feature = "unproven")]
use crate::new_element;
use crate::parse;
use crate::types::Parse;
use crate::svd::{
acces... |
#[derive(Clone, Debug, Eq, PartialOrd, Ord, PartialEq)]
pub struct Decision {
x: usize,
r: usize,
}
const ALL_VALID_DECISIONS: &'static [Decision] = &[
Decision { x: 2, r: 3 },
Decision { x: 3, r: 3 },
Decision { x: 3, r: 1 },
Decision { x: 4, r: 1 },
Decision { x: 5, r: 1 },
Decision {... |
use std::error::Error;
use std::fs;
use std::ops::RangeInclusive;
use regex::Regex;
type AocResult<T> = std::result::Result<T, Box<Error>>;
struct Intersection<'a> {
x: i32,
y: i32,
horizontal: &'a Interval,
vertical: &'a Interval
}
#[derive(PartialEq)]
enum Orientation {
Horizontal,
Vertical... |
use proc_macro::TokenStream;
use quote::quote;
use syn::{parse_macro_input, parse_quote, DeriveInput, Generics};
fn ty_inner_type<'a>(wrapper: &str, ty: &'a syn::Type) -> std::option::Option<&'a syn::Type> {
if let syn::Type::Path(ref p) = ty {
if p.path.segments.len() != 1 || p.path.segments.iter().last()... |
//! Unit tests for boxed bit-slices.
#![cfg(test)]
#[cfg(not(feature = "std"))]
use alloc::vec;
use alloc::{
borrow::Cow,
boxed::Box,
};
use core::{
any,
borrow::{
Borrow,
BorrowMut,
},
convert::TryFrom,
fmt::{
Debug,
Display,
Pointer,
},
hash::Hash,
iter::{
FromIterator,
FusedIterator,
},
o... |
//! This module provides `MessageAction` which can be used to override the
//! default message type to build custom message actions.
//! These can have a custom payload and may perform arbitrary
//! computation on message application.
use crate::cow_bytes::{CowBytes, SlicedCowBytes};
use bincode::{deserialize, seriali... |
use open_ttt_lib::{ai, game};
// Ensures the unbeatable opponent never loses.
//
// The unbeatable opponent fully evaluates every possible move and countermove
// to pick the best position. However, if there is an issue, it might lose to a
// random opponent. This test plays several games to ensure the unbeatable
// o... |
use core::fmt;
use core::num::ParseIntError;
use core::str::FromStr;
use std::collections::HashSet;
#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)]
enum Opcode {
AddRegister,
AddImmediate,
MultiplyRegister,
MultiplyImmediate,
BitwiseANDRegister,
BitwiseANDImmediate,
BitwiseORRegister,
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.