text stringlengths 3.09k 13.9k |
|---|
#![allow(clippy::cast_sign_loss)]
#![allow(clippy::cast_possible_truncation)]
#![allow(clippy::cast_possible_wrap)]
#![allow(clippy::type_complexity)]
use glutin::dpi;
use glutin::event::Event;
use glutin::event::WindowEvent;
use glutin::event_loop::ControlFlow;
use glutin::event_loop::EventLoop;
use glutin::window;
u... |
use piston_window::PistonWindow as Window;
use graphics::{DrawState, Transformed};
use graphics::text::Text;
use opengl_graphics::GlGraphics;
use opengl_graphics::glyph_cache::GlyphCache;
use piston::input::{Button, Event, Input, Key, RenderArgs, UpdateArgs};
use rand::Rng;
use std::cell::RefCell;
use std::borrow::Borr... |
#![feature(get_mut_unchecked)]
#![feature(map_first_last)]
#![feature(llvm_asm)]
#![feature(raw_ref_op)]
#![feature(termination_trait_lib)]
#![feature(associated_type_defaults)]
#![feature(slice_ptr_get)]
#![feature(array_methods)]
#![feature(arc_new_cyclic)]
#![feature(format_args_capture)]
// Can disallow some of the... |
use crate::rand::SeedableRng;
use crate::{ContinuousSamplesDistribution, Distribution, DistributionError, RandomVariable};
use rand::rngs::StdRng;
// Sampling Importance Resampling
pub struct ParticleFilter<Y, X, DY, DX, PD>
where
Y: RandomVariable,
X: RandomVariable + PartialEq,
DY: Distribution<Value = Y... |
use std::error::Error;
use erupt::vk;
/// Errors that asche can throw.
#[derive(Debug)]
pub enum AscheError {
/// A `std::io::Error`.
IoError(std::io::Error),
/// A `std::ffi::NulError`.
NulError(std::ffi::NulError),
/// A `std::str::Utf8Error`.
Utf8Error(std::str::Utf8Error),
/// A `TryFr... |
use crate::*;
#[near_bindgen]
impl Marketplace {
// TODO: Storage management, assert_one_yocto, etc.
#[payable]
pub fn create_store(&mut self, store: Store) -> String {
assert_one_yocto();
// check unique storeid
assert!(
env::predecessor_account_id() == store.id,
... |
use crate::literals::{LitSet, Watches};
use crate::*;
/// An implication in the form of a 2-SAT network.
///
/// It allows answering in polynomial time whether a given literal implies another one (directly or indirectly)
///
/// The network accounts for implication between literals on the same variable:
/// `(X < 0) =... |
use regex::Regex;
pub const RAW_FLAG: &str = "--raw=";
pub const CAFILE_FLAG: &str = "--cafile=";
pub trait ArgDetection {
fn is_raw_flag(&self) -> bool;
fn is_cafile_flag(&self) -> bool;
fn is_flag(&self) -> bool;
fn is_header(&self) -> bool;
fn is_item(&self) -> bool;
fn is_likely_url(&self... |
use crate::error::{self, AutoTeXErr};
use clap::{App, Arg};
use std::ffi::OsString;
use std::fs;
use std::path::PathBuf;
use yaml_rust::YamlLoader;
// Default TeX Engine and its options
pub const TEX_ENGINES: [&str; 5] = ["pdftex", "xetex", "luatex", "tex", "plaintex"];
pub const LATEX_ENGINES: [&str; 5] = ["pdflatex"... |
//! This modules contains all the routes for querying facilities.
use geoutils::Location;
use rocket::get;
use rocket_contrib::{
databases::mongodb::{bson, doc},
json,
json::JsonValue,
};
use slippy_map_tilenames::tile2lonlat;
use super::OperationResult;
use crate::database::FacilityCollection;
/// Retur... |
//! Contains a structure for keeping track of how many of each
//! of the 27 tiles are in a container.
use crate::game::tile::Tile;
use std::iter::repeat;
/// Reusable structure used to store a quantity of each tile.
#[derive(Default, Debug, Clone, Copy)]
pub struct TileCounts {
counts: [usize; 27],
len: usiz... |
extern crate gleam;
extern crate glutin;
extern crate fasternet_common;
extern crate app_units;
extern crate webrender;
extern crate image;
extern crate rayon;
mod app;
mod style;
use gleam::gl;
use glutin::GlContext;
use webrender::api::*;
use std::sync::Arc;
// use webrender::{PROFILER_DBG, RENDER_TARGET_DBG, TEXTU... |
//! Module for [`DynamicVariable`].
#![allow(clippy::fn_address_comparisons)]
use super::VariableError;
use crate::ffi::variables as ffi;
use std::collections::HashMap;
use std::ffi::{CStr, CString};
use std::mem::MaybeUninit;
use std::os::raw::c_char;
use std::sync::atomic::AtomicBool;
use std::sync::{atomic::Orderi... |
use crate::array::{ArrayN, FastArrayCompression};
use building_blocks_core::prelude::*;
use compressible_map::{
BincodeCompression, BytesCompression, Compressed, Compression, MaybeCompressed,
};
use serde::{Deserialize, Serialize};
/// One piece of the `ChunkMap`. Contains both some generic metadata and the data... |
use arrsac::Arrsac;
use levenberg_marquardt::{LeastSquaresProblem, LevenbergMarquardt};
use nalgebra::{
dimension::{U1, U2},
storage::Owned,
Dim, Dynamic, Matrix, Matrix2, OMatrix, VecStorage, Vector2,
};
use pcg_rand::Pcg64;
use rand::distributions::Uniform;
use rand::{distributions::Distribution, Rng};
us... |
/*
* Isilon SDK
*
* Isilon SDK - Language bindings for the OneFS API
*
* OpenAPI spec version: 5
* Contact: <EMAIL>
* Generated with help by: https://github.com/swagger-api/swagger-codegen.git
*/
use base64::encode;
use cookie::{Cookie, CookieJar};
use futures;
use futures::{Future, IntoFuture};
use hyper;
use... |
use std::borrow::Cow;
#[macro_use]
extern crate speedy_derive;
extern crate speedy;
#[derive(PartialEq, Debug, Readable, Writable)]
struct DerivedStruct {
/// A doc comment.
a: u8,
b: u16,
c: u32
}
#[derive(PartialEq, Debug, Readable, Writable)]
struct DerivedTupleStruct( u8, u16, u32 );
#[derive(Pa... |
use crate::shared::intcode::IntcodeProcess;
use crate::shared::intcode::IntcodeProcessState;
use permutohedron::heap_recursive;
use std::cmp::max;
use std::collections::VecDeque;
pub fn part1(initial_memory: &str) -> i64 {
let mut phase_settings = vec![0, 1, 2, 3, 4];
let mut max_value = 0;
heap_recursive(... |
use super::{make_error, Error, Result};
use lr_tree::{mbr, MBR};
use nalgebra::{Point3, Vector3};
use phf::phf_map;
use std::fmt;
pub type LogTarget = String;
pub type Coord = f32;
pub type ColorChannel = f32;
pub type Vector = Vector3<Coord>;
pub type Color = Point3<ColorChannel>;
pub type PackedColor = i32;
pub typ... |
use std::error::Error;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::path::Path;
// Register constant table
#[derive(Copy,Clone,Debug)]
enum Registers {
RegA = 0,
RegB = 1,
}
#[derive(Copy,Clone,Debug)]
enum Command {
HLF, /* hlf r sets register r to half its current value,... |
// Copyright 2020 The Evcxr 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
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
use juliaup::global_paths::get_paths;
use juliaup::{command_link::run_command_link};
use juliaup::command_gc::run_command_gc;
use juliaup::command_update::run_command_update;
use juliaup::command_remove::run_command_remove;
use clap::Parser;
use anyhow::{Result,Context};
use juliaup::command_add::run_command_add;
use j... |
use std::env;
#[cfg(feature = "analytics")]
use std::thread;
use actix_cors::Cors;
use actix_web::{middleware, HttpServer};
use main_error::MainError;
use meilisearch_http::helpers::NormalizePath;
use meilisearch_http::{create_app, index_update_callback, Data, Opt};
use structopt::StructOpt;
use meilisearch_http::{sn... |
#![cfg(feature = "test-bpf")]
mod helpers;
use helpers::*;
use solana_program_test::*;
use solana_sdk::{pubkey::Pubkey, signature::Keypair};
use spl_token_lending::{
math::Decimal, processor::process_instruction, state::INITIAL_COLLATERAL_RATIO,
};
const LAMPORTS_TO_SOL: u64 = 1_000_000_000;
const FRACTIONAL_TO_... |
use crate::util::check_builtin_macro_attribute;
use rustc_ast::expand::allocator::{
AllocatorKind, AllocatorMethod, AllocatorTy, ALLOCATOR_METHODS,
};
use rustc_ast::ptr::P;
use rustc_ast::{self as ast, Attribute, Expr, FnHeader, FnSig, Generics, Param};
use rustc_ast::{ItemKind, Mutability, Stmt, Ty, TyKind, Unsa... |
#[macro_use]
extern crate clap;
extern crate cargo_metadata;
#[macro_use]
extern crate failure;
extern crate semver;
use cargo_metadata::DependencyKind;
use clap::{App, Arg, ArgMatches};
use failure::{Error, ResultExt, SyncFailure};
use std::collections::{HashMap, HashSet};
use std::path::Path;
use std::process::exit;... |
//! Regex patterns and utilities used for manipulating the line.
use lazy_static::lazy_static;
use regex::Regex;
use std::path::PathBuf;
lazy_static! {
static ref GREP_POS: Regex = Regex::new(r"^(.*):(\d+):(\d+):").unwrap();
// match the file path and line number of grep line.
static ref GREP_STRIP_FPATH: Rege... |
//! Unix handling of child processes
//!
//! Right now the only "fancy" thing about this is how we implement the
//! `Future` implementation on `Child` to get the exit status. Unix offers
//! no way to register a child with epoll, and the only real way to get a
//! notification when a process exits is the SIGCHLD signa... |
use std::io::prelude::*;
use std::fs::File;
struct Vector3D {
x: f32,
y: f32,
z: f32,
}
struct Light {
direction: Vector3D,
intensity: f32,
}
struct Sphere {
position: Vector3D,
color: Vector3D,
radius: f32,
}
struct Ray {
origin: Vector3D,
direction: Vector3D,
}
impl Vector3D {
fn clone(&sel... |
//! Code for building the standard library.
use crate::core::compiler::UnitInterner;
use crate::core::compiler::{CompileKind, CompileMode, RustcTargetData, Unit};
use crate::core::profiles::{Profiles, UnitFor};
use crate::core::resolver::features::{FeaturesFor, ResolvedFeatures};
use crate::core::resolver::{HasDevUnit... |
//! Simple graphviz dot file format output.
//! Based on petgraph::dot.
use std::fmt::{self, Display, Write};
use petgraph::visit::GraphRef;
/// `Dot` implements output to graphviz .dot format for a graph.
///
/// Formatting and options are rather simple, this is mostly intended
/// for debugging. Exact output may c... |
//! # minimp3
//!
//! Provides a simple wrapper and bindinings to the [minimp3](https://github.com/lieff/minimp3) C library.
//!
//! ## Tokio
//!
//! By enabling the feature flag `async_tokio` you can decode frames using async IO and tokio.
//!
//! [See the README for example usages.](https://github.com/germangb/minimp... |
/*
Copyright 2019 Supercomputing Systems AG
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 ag... |
use std::collections::{
HashMap,
HashSet,
};
use failure::{
bail,
Error,
};
use rusoto_dynamodb::DynamoDb;
use rust_proto::graph_descriptions::{
id_strategy,
Session as SessionStrategy,
*,
};
use serde::{
Deserialize,
Serialize,
};
use sha2::{
Digest,
Sha256,
};
use tracing:... |
//! Power Control Manager (PCM)
use kernel::common::registers::{
register_bitfields, register_structs, ReadOnly, ReadWrite, WriteOnly,
};
use kernel::common::StaticRef;
const PCM_BASE: StaticRef<PcmRegisters> =
unsafe { StaticRef::new(0x4001_0000 as *const PcmRegisters) };
const PCMKEY: u32 = 0x695A; // for ... |
use crate::util::*;
use proc_macro2::{Span, TokenStream};
use std::iter;
use syn::{
AngleBracketedGenericArguments, BoundLifetimes, Data, DeriveInput, Error, Fields, GenericArgument, Lifetime,
LifetimeDef, PathArguments, PredicateType, Result, TraitBound, TraitBoundModifier, Type, TypeParamBound, TypePath,
WhereClau... |
use std::fmt::{Display, Formatter, Result, Write};
use super::{
decor::{Formatted, Repr},
document::Document,
table::{Item, Table},
value::{Array, DateTime, InlineTable, Value},
};
impl Display for Repr {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
write!(f, "{}{}{}", self.decor.prefi... |
use std::cell::RefCell;
use std::rc::Rc;
use super::row::{PrivateSqliteRow, SqliteRow};
use super::stmt::StatementUse;
use crate::result::QueryResult;
#[allow(missing_debug_implementations)]
pub struct StatementIterator<'stmt, 'query> {
inner: PrivateStatementIterator<'stmt, 'query>,
column_names: Option<Rc<[... |
// Copyright (c) 2021 <NAME>
// SPDX-License-Identifier: MIT
use std::collections::HashMap;
use std::{thread, time};
pub const MAX_POS: usize = 10;
pub const MAX_SCORE: usize = 100; // needed if we're waiting for ALL player x's to win
#[derive(Debug, Clone, PartialEq, Copy, Eq, Hash)]
pub struct GameState {
p1_p... |
use crate::cache::StoreCache;
use crate::cell::attach_block_cell;
use crate::store::ChainStore;
use crate::transaction::StoreTransaction;
use crate::write_batch::StoreWriteBatch;
use crate::StoreSnapshot;
use ckb_app_config::StoreConfig;
use ckb_chain_spec::consensus::Consensus;
use ckb_db::{
iter::{DBIter, DBItera... |
use std::io::Write;
use libzakopane::config::Config;
use libzakopane::snapshot::Snapshot;
use libzakopane::structs::ChecksumCliOptions;
use libzakopane::structs::CompareCliOptions;
use libzakopane::structs::ZakopaneError;
use clap::{value_t, App, Arg, ArgMatches};
const DEFAULT_POLICY_ARG_NAME: &'static str = "defau... |
use crate::{
interrupt::{self, InterruptContextGuard, InterruptIndex},
keyboard, memory, mouse, paging,
pci::{self, Device, MsiDeliveryMode, MsiTriggerMode},
prelude::*,
sync::{OnceCell, SpinMutex},
};
use core::{
pin::Pin,
sync::atomic::{AtomicBool, Ordering},
task::{Context, Poll},
};
... |
mod glwinhelp;
use glwinhelp::{imgwin, VirtualKeyCode};
use crate::glwinhelp::imgwin::ImgWindow;
use freenectrs::freenect;
use freenectrs::freenect::{
FreenectContext, FreenectDepthStream, FreenectError, FreenectVideoStream,
};
use std::error::Error;
#[inline]
fn depth_to_img(data: &[u16]) -> image::RgbaImage {
... |
use std::{
marker::PhantomData,
convert::TryInto,
io::Write,
path::Path,
fs::File
};
use async_trait::async_trait;
use curve25519_dalek::scalar::Scalar;
use monero::{
util::ringct::EcdhInfo,
cryptonote::hash::Hash
};
use crate::{
crypt_engines::{CryptEngine, ed25519_engine::Ed25519Sha},
dl_eq::DlE... |
use std::str::FromStr;
use argh::FromArgs;
use mpc::{
fields::{Mersenne127, Mersenne61},
spdz::{PrecomputedSpdzData, SpdzShare},
MpcField, MpcShare,
};
use rand::{prelude::StdRng, Rng, SeedableRng};
use serde::{Deserialize, Serialize};
/// Field type for preprocessing.
enum FieldType {
Mersenne61,
... |
use crate::{pac::PRCI, time::Hertz};
const HFXCLK: u32 = 26_000_000;
pub trait PrciExt {
fn setup(self) -> ClockSetup;
}
impl PrciExt for PRCI {
fn setup(self) -> ClockSetup {
ClockSetup {
prci: self,
coreclk: None,
pclk: None,
}
}
}
struct PllConfig {... |
use quicksilver::{
geom::{Line, Rectangle, Circle, Shape, Transform, Vector, Scalar},
graphics::{
Background::Col,
Background,
Color,
Drawable,
Mesh,
},
};
use instant::Instant;
use crate::map::Map;
const ZOOMED_SCALE: f32 = 0.6;
pub struct LunarModule {
pub ve... |
#![warn(rust_2018_idioms)]
#[macro_use]
extern crate log;
#[macro_use]
extern crate failure;
#[cfg(test)]
#[macro_use]
extern crate proptest;
use serde_json;
use std::collections::HashSet;
use std::ops::Range;
use failure::Error;
pub mod diagnostics;
use crate::diagnostics::{Diagnostic, DiagnosticSpan};
mod replace... |
// 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 ... |
//! Software PID controller
//!
//! This crate implements a PID controller. It has seen some amount of
//! real-world usage driving 100+ kW electrical motors, but has not been tested
//! to death. Use with caution (but do use it and file bug reports!).
//!
//! Any change in behaviour that may make calculations be... |
use std::io::{self, BufReader};
use std::io::prelude::*;
use std::fs::File;
use std::collections::{HashMap, HashSet};
// This approach borrows from a single 'main' String type.
// String slices can be generated by using a start and
// end index and this main string. This only works because
// new data is always added ... |
#![deny(rust_2018_idioms)]
//! This example illustrates a few basic Dropbox API operations: getting an OAuth2 token, listing
//! the contents of a folder recursively, and fetching a file given its path.
use dropbox_sdk::{files, UserAuthClient};
use dropbox_sdk::oauth2::{oauth2_token_from_authorization_code, Oauth2Aut... |
//
//
// This file is a part of Aleph
//
// https://github.com/nathanvoglsam/aleph
//
// MIT License
//
// Copyright (c) 2020 Aleph Engine
//
// 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 Softwar... |
//!
//! The module contains the conversion to a the PAR format.
//!
use crate::{GrammarConfig, ScannerConfig, StrVec};
use std::fmt::Debug;
#[derive(BartDisplay, Debug, Default)]
#[template = "templates/par_template.par"]
struct YaccElements {
start_symbol: String,
title: String,
comment: String,
line_... |
use crate::make::get_lane_types;
pub use crate::make::{Hint, Hints, InitialMap};
use crate::{AreaType, IntersectionType, OffstreetParking, RoadSpec};
use geom::{Distance, GPSBounds, LonLat, Polygon, Pt2D};
use gtfs::Route;
use serde_derive::{Deserialize, Serialize};
use std::collections::BTreeMap;
use std::fmt;
// Sta... |
// Copyright 2020 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writi... |
use std::collections::HashMap;
use winit::{
event::{Event, WindowEvent},
event_loop::{ControlFlow, EventLoop},
window::{Window, WindowId},
};
struct ViewportDesc {
window: Window,
background: wgpu::Color,
surface: wgpu::Surface,
}
struct Viewport {
desc: ViewportDesc,
sc_desc: wgpu::Sw... |
use libc::{
getpwnam,
c_void,
c_int,
uid_t,
c_char,
c_uchar
};
use std::{
ptr,
ffi::CStr
};
use std::collections::HashSet;
use objc::runtime::{
Class,
Object
};
use objc_foundation::{
INSArray,
NSArray,
NSObject,
INSObject
};
use objc_id::Id;
use crate::tables::U... |
// Copyright 2021. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
//! Get a release of economic data
//!
//! [https://research.stlouisfed.org/docs/api/fred/release.html](https://research.stlouisfed.org/docs/api/fred/release.html)
//!
//! ```
//! use fred_rs::client::FredClient;
//! use fred_rs::release::{Builder, Response};
//!
//! let mut c = match FredClient::new() {
//! Ok(c) =... |
use std::f32;
use std::fs::File;
use std::io::Write;
use std::vec::Vec;
// use std::f32::{INFINITY, NEG_INFINITY};
use image::{GrayImage, RgbaImage};
static INF: f32 = 9999.0;
pub struct SDF {
output_image_path: String,
outline: f32,
img: GrayImage,
img_size: (u32, u32),
pixel_count: usize,
... |
//! ## Programs
//!
//! Programs are composed of Lanes and Cards. A Card consumes inputs and produces outputs.
//! Cards will always consume from the top of the stack downwards and push their outputs to
//! the stack. This means that subprogram composition is not a commutative operation. (Consider
//! Cards A, B and C.... |
//! Decodable trait & Decoder
use crate::error::{DecodeError, DecodeResult};
use std::{
array::TryFromSliceError,
convert::TryInto,
ffi::{CStr, CString},
mem,
net::{Ipv4Addr, Ipv6Addr},
str,
};
/// A trait for types which are serializable to and from DHCP binary formats
pub trait Decodable: Si... |
// BEGIN - Embark standard lints v0.4
// do not change or add/remove here, but one can add exceptions after this section
// for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/59>
//#![deny(unsafe_code)] // quite a bit of unsafe with wgpu still, would be nice to remove
#![warn(
clippy::all,
... |
use std::sync::{Arc, RwLock};
use log::{info};
fn setup_logger() -> Result<(), fern::InitError> {
if !std::path::Path::new("logs").is_dir() {
std::fs::create_dir("logs")?;
}
fern::Dispatch::new()
.format(|out, message, record| {
out.finish(format_args!(
"{} {} [{... |
// TODO: Could we leverage SIMD here??
#[cfg(test)]
mod spec_tests;
use ppu::control_register::ControlRegister;
use ppu::palette::{Color, PALETTE};
use ppu::vram::Vram;
#[derive(Default)]
pub struct BackgroundRenderer {
palettes: [Color; 16],
pattern_low_shift_register: u16,
pattern_high_shift_register: ... |
use crate::{remote::refs::JsonRef, OutputFormat, Protocol};
use git_features::progress::Progress;
use git_object::{
bstr::{BString, ByteSlice},
owned,
};
use git_odb::pack;
use git_protocol::{
fetch::{Action, Arguments, Ref, Response},
git_transport::{self, client::Capabilities},
};
use std::{
io::{... |
/*
* Copyright (c) 2021 gematik GmbH
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agr... |
// Copyright (c) 2018-2021 The MobileCoin Foundation
use crate::{
config::LedgerServerConfig, counters, db_fetcher::DbFetcher, BlockService, KeyImageService,
MerkleProofService, UntrustedTxOutService,
};
use displaydoc::Display;
use fog_api::ledger_grpc;
use fog_ledger_enclave::{Error as EnclaveError, LedgerEn... |
use crate::markdown::MarkdownStream;
use bytes::{Buf, BufMut, Bytes, BytesMut};
use futures::Async::*;
use futures::{future::Either, Future, Poll};
use http;
use http::header::{HeaderValue, CONTENT_TYPE};
use std::io;
use std::path::PathBuf;
use tower_service::Service;
use tower_web::error;
use tower_web::middleware::M... |
use super::Expander;
use crate::{
shell::{Job, RefinedJob, Shell},
types,
};
use itertools::Itertools;
use std::fmt;
/// What to redirect to the next command
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum RedirectFrom {
/// Stdout (`|`)
Stdout,
/// Stderr (`^|`)
Stderr,
/// Both (`&|`)
... |
use super::*;
use kitsune_p2p_types::dht_arc::*;
type HasMap = HashMap<Arc<KitsuneAgent>, KeySet>;
impl SimpleBloomMod {
pub(crate) async fn step_2_local_sync_inner(
&self,
local_agents: HashSet<Arc<KitsuneAgent>>,
) -> KitsuneResult<(DataMap, KeySet, BloomFilter)> {
let space = self.s... |
// constant string with the valid characters of Poop v1.0
const CHARACTERS: &str = "0123456789abcdefghijklmnopqrstuvwxyz.,-!?+*<>#@$€§%&/()[]";
// All valid instructions of Poop v1.0
enum Instructions {
MoveRight, // eat
MoveLeft, // puke
Output, // poop
OutputCaps, // POOP
PrintStr, // sn... |
//! Walk filesystem trees and indicate if files have changed.
use std::collections::BTreeSet;
use std::fs;
use std::io;
use std::path::{Path, PathBuf};
use std::sync::Arc;
use anyhow::{ensure, Context, Result};
use log::*;
use crate::chunk;
use crate::hashing::ObjectId;
use crate::tree;
/// Compares the FS entry wi... |
/*
* Copyright 2021 Fluence Labs 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 applicable law or a... |
// TODO: use slash commands
use std::str::FromStr;
use async_trait::async_trait;
use log::{error, info};
use serde::{Deserialize, Serialize};
use serenity::client::bridge::gateway::GatewayIntents;
use serenity::model::prelude::*;
use serenity::prelude::*;
pub use persistent::*;
mod persistent;
mod reaction_roles;
mo... |
use anyhow::Result;
use lazy_static::lazy_static;
use std::{
collections::HashSet,
fs::File,
io::{prelude::*, BufReader},
path::{Path, PathBuf},
env,
};
lazy_static! {
static ref CARGO_MANIFEST_DIR: PathBuf =
PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
}
fn main() -> R... |
// Copyright 2020 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,... |
// AES-CCM (Counter with CBC-MAC)
// Alternative to GCM mode.
// Available in OpenSSL as of TLS 1.3 (2018), but disabled by default.
// Two AES computations per block, thus expected to be somewhat slower than AES-GCM.
// RFC 6655 year 2012 https://tools.ietf.org/html/rfc6655
// Much lower adoption, probably because it ... |
use std::cell::RefCell;
use std::convert::From;
use std::fs::File;
use std::io::prelude::*;
use std::io::Error as IoError;
use clap::ArgMatches;
use regex::Regex;
use serde_json;
use serde_json::Error as JsonError;
use url::Url;
use super::model::*;
use super::output::*;
use crate::commands::CliError;
fn to_regex(in... |
use std::collections::{BTreeMap, HashMap, HashSet};
use std::error::Error;
use std::io::{BufRead, BufReader, Read};
use itertools::Itertools;
use regex::Regex;
#[derive(Debug, Hash, Clone, Copy, Eq, PartialEq, Ord, PartialOrd)]
pub struct Point {
x: usize,
y: usize,
}
type Centroid = usize;
type Grid = HashM... |
use std::sync::Arc;
use std::time::Instant;
use std::io::Cursor;
use std::convert::TryFrom;
use anyhow::{Result, Error};
use tracing::debug;
use wasmtime::{Caller, Extern, Func, Instance, Trap, TypedFunc, Store};
use dataplane::core::{Decoder, Encoder};
use dataplane::batch::Batch;
use dataplane::batch::MemoryRecord... |
// Copyright (c) 2016-2020 <NAME>
//! A collection if instantiation details.
#[warn(missing_docs)]
use crate::{
crate_prelude::*,
hir::{self, HirNode},
port_list::AsPortedNode,
resolver::InstTarget,
Context, ParamEnv, ParamEnvData, ParamEnvSource, PortMapping,
};
use std::sync::Arc;
/// Instantia... |
// Copyright 2018 Parity Technologies (UK) 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, mer... |
//! # Credentials for accessing the Firebase REST API
//! This module contains the [`crate::credentials::Credentials`] type, used by [`crate::sessions`] to create and maintain
//! authentication tokens for accessing the Firebase REST API.
use chrono::Duration;
use serde::{Deserialize, Serialize};
use serde_json;
use s... |
extern crate ffmpeg_sys;
extern crate failure;
#[macro_use] extern crate failure_derive;
extern crate libc;
extern crate sample;
extern crate chrono;
pub mod errors;
pub mod frame;
#[macro_use]
mod ffi;
pub use errors::{MediaResult, MediaError};
pub use frame::Frame;
pub use chrono::Duration;
use ffmpeg_sys::*;
use f... |
/*! The derby clock state machine. This handles the timing aspects of the
game clock as well as jams, lineup times, team timeouts, official timeouts,
and intermissions. This level does not care about which team is taking
a timeout or whether it's an OR or OTO.
*/
use std::time::{Instant, Duration};
#[der... |
//! Random number generator.
//! Based on the [xoroshiro128+](http://prng.di.unimi.it/xoroshiro128plus.c) RNG.
use wasm_bindgen::prelude::*;
use std::num::Wrapping as w;
/// Keeps track of the state.
#[wasm_bindgen]
#[derive(PartialEq, Eq, Debug)]
pub struct Rng(u64, u64);
/// Second half of the initial state is alw... |
#[cfg(test)]
extern crate rstest;
extern crate cfg_if;
extern crate wasm_bindgen;
extern crate rs8080;
#[cfg(target_arch = "wasm32")]
extern crate js_sys;
#[cfg(not(target_arch = "wasm32"))]
extern crate rand;
#[macro_use]
extern crate log;
mod utils;
mod si;
use std::rc::Rc;
use std::io::Write;
use cfg_if::cfg_if;
... |
use std::convert::Infallible;
use async_trait::async_trait;
use cucumber::gherkin::Step;
use cucumber::{given, then, when, World, WorldInit};
use ray_tracer::graphics::{canvas, canvas_to_ppm, color, pixel_at, write_pixel, Canvas, Color};
#[derive(Debug, WorldInit)]
struct CanvasWorld {
canvas: Option<Canvas>,
... |
//! Internal FS representation. Does not cross backends.
use crate::error::*;
use crate::plugin_store::*;
use crate::types::NodeMetadata;
use crate::types::*;
use abi_stable::StableAbi;
use cglue::prelude::v1::*;
use cglue::result::from_int_result_empty;
pub use cglue::slice::CSliceMut;
use cglue::trait_group::c_void... |
use crate::static_handlers;
use bcrypt::BcryptError;
use image::ImageError;
use rocket::http::{uncased::Uncased, Header, Status};
use rocket::request::Request;
use rocket::response::{self, Responder};
use rocket_contrib::json::Json;
use s3::S3Error;
use serde::Serialize;
use std::borrow::Cow;
use std::convert::From;
u... |
use serde::{Deserialize as De, Serialize as Ser};
use crate::git::Branch;
/// A branch diff that, when merged, triggers a deploy
#[derive(PartialEq, Clone, Debug, Ser, De)]
pub struct Mergeable {
/// Pretty name of the environment. Commands will be matched against this.
/// Must not contain spaces.
pub name: St... |
use std::env;
use clap::{App, Arg, SubCommand};
use clap::crate_version;
use lazy_static::lazy_static;
use log::Level;
use simple_logger;
use std::alloc::System;
use crate::commands::capabilities::show_capabilities;
use crate::commands::check::check;
use crate::commands::info::server_info;
use crate::commands::signin... |
use crc::{crc32, Hasher32};
use crate::{read_le_bytes, GPTError, Result, GUID};
const EFI_SIGNATURE: u64 = 0x5452415020494645;
const GPT_REV: u32 = 0x00010000;
#[derive(Debug)]
pub struct GPTHeader {
/// Size in bytes of the GPT Header. The [`Self::size`] must be greater than or equal to
/// 92 and must be l... |
// Copyright 2019 <NAME>.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE.txt or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT.txt or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according... |
use std::mem;
use crate::{cpu::Registers, memory::Memory};
pub const OP_COUNT: usize = 0xff;
pub const OP_CB_COUNT: usize = 0xff;
pub struct CPU {
pub mem: Memory,
pub reg: Registers,
opcode: u8,
}
impl CPU {
pub fn new() -> CPU {
let reg = Registers::new();
let mem = Memory::new();
CPU {
... |
//! Parse a file in `*.idx` format.
use cast;
use common_failures::prelude::*;
use image::Rgb;
use regex::Regex;
use std::fs;
use std::io;
use std::io::prelude::*;
use std::path::Path;
use errors::{IResultExt, VobsubError};
use sub;
/// Parse a single hexadecimal digit.
named!(hex_digit<u8>,
map!(one_of!(b"01234... |
use borsh::{BorshDeserialize, BorshSerialize};
use core::fmt;
use serde::{Deserialize, Serialize};
pub type PoseidonResult<T> = Result<T, PoseidonError>;
#[derive(Debug)]
pub enum PoseidonError {
Io(std::io::ErrorKind),
/// Errors from the minreq crate
Http(Minreq),
/// Errors from the bincode crate
... |
#![warn(unsafe_code)]
#[macro_use]
extern crate diesel;
#[macro_use]
extern crate diesel_migrations;
use clap::{crate_authors, crate_description, crate_name, crate_version};
use diesel::{Connection, QueryDsl, RunQueryDsl};
mod dto;
mod models;
mod schema;
#[derive(Debug)]
struct ParsedProfit {
net_profit: Vec<d... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.