text stringlengths 3.09k 13.9k |
|---|
use md5::Digest;
use rayon::prelude::*;
use std::thread;
const PUZZLE_INPUT: &str = "abbhdwsy";
pub(crate) fn day05_part1() -> String {
generate_part1_password_from(PUZZLE_INPUT)
}
pub(crate) fn day05_part2() -> String {
generate_part2_password_from(PUZZLE_INPUT)
}
// The following code is adapted from 2015... |
use std::marker::PhantomData;
use crate::baseclient::ClientCoding;
use crate::control::ControlPlaneAuth;
use crate::event::LogEvent;
use crate::prelude::*;
use crate::{
master_key::mock::MockMasterKey,
master_key::MasterKeyProvider,
server_suite::coding::CodingItem,
store::{CustomerKey, OwnedStore},
};... |
use bevy::prelude::*;
use bevy_rapier2d::prelude::*;
use rand::Rng;
use crate::*;
pub struct WinPlugin;
impl Plugin for WinPlugin {
fn build(&self, app: &mut App) {
app .add_system(check_for_contacts.label("check_for_contacts"))
.add_system(
check_for_win
... |
extern crate rust_embed;
use rust_embed::*;
use std::path::PathBuf;
use std::fs::{create_dir_all, create_dir, copy, File};
use std::os::unix::fs::PermissionsExt;
use std::io::{ErrorKind, Error, Write};
use crate::ExitCode::*;
use std::ffi::OsStr;
const DIR_CONTENT: &str = "Contents";
const DIR_RESOURCES: &str = "Reso... |
//! LLVM Module Wrapper
//!
//! Contains types and wrappers for dealing with LLVM Modules.
use super::function::Function;
use super::llvm_sys::prelude::*;
use super::llvm_sys::target_machine;
use super::llvm_sys::{analysis, bit_writer, core};
use super::pass_manager::{OptLevel, OptSize, PassManagerBuilder};
use super:... |
/*!
# Dactyl: Nice u64.
*/
use std::num::{
NonZeroU64,
NonZeroUsize,
};
/// # Total Buffer Size.
const SIZE: usize = 26;
#[derive(Debug, Clone, Copy)]
/// `NiceU64` provides a quick way to convert a `u64` into a formatted byte
/// string for e.g. printing. Commas are added for every thousand.
///
/// That's it... |
/*!
Sibyl is an [OCI][1]-based interface between Rust applications and Oracle databases. Sibyl supports both sync (blocking) and async (nonblocking) API.
# Blocking Mode Example
```
# #[cfg(feature="blocking")]
fn main() -> sibyl::Result<()> {
let oracle = sibyl::env()?;
let dbname = std::env::var("DBNAME").... |
use crate::device::{
DeviceRegion, EmulatedDevice, Port, PortReadRequest, PortWriteRequest,
};
use crate::error::Result;
use crate::memory::GuestAddressSpaceViewMut;
use alloc::boxed::Box;
use alloc::vec::Vec;
use core::convert::{TryFrom, TryInto};
use num_enum::TryFromPrimitive;
#[derive(Copy, Clone, Debug, TryFr... |
/// Compute `(x * y) mod modulo` assuming that intermediate
/// result can overflow i64
#[inline(always)]
pub fn mult128(x: i64, y: i64, modulo: i64) -> i64 {
((x as i128 * y as i128).rem_euclid(modulo as i128)) as i64
}
pub fn bin_pow(mut x: i64, mut pow_to: usize, modulo: i64) -> i64 {
let mut res = 1;
w... |
use bevy::{
asset::HandleId,
prelude::*,
render::{
render_asset::RenderAssets,
render_resource::{std140::AsStd140, BindGroup, BufferId, DynamicUniformVec},
renderer::{RenderDevice, RenderQueue},
texture::Image,
},
utils::HashMap,
window::WindowId,
};
use wgpu::{Bi... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
use std::borrow::Cow;
use std::collections::HashMap;
use crate::profile::parser::parse::{RawProfileSet, WHITESPACE};
use crate::profile::parser::source::FileKind;
use crate::profile::{Profile, ProfileSe... |
use std::collections::HashMap;
use std::collections::HashSet;
use std::io;
use std::io::BufRead;
use std::str::FromStr;
#[derive(Debug, PartialEq, Clone)]
enum Side {
Immune,
Infection,
}
impl FromStr for Side {
type Err = ();
fn from_str(s: &str) -> Result<Self, Self::Err> {
match s {
... |
// Copyright (c) Microsoft. All rights reserved.
/// Time is represented as seconds since the UNIX epoch.
#[derive(Clone, Copy, Debug, Eq, Ord, PartialEq, PartialOrd)]
pub(crate) struct Time(i64);
/// Logs a message and aborts the process. This function is called if the process encounters
/// a fatal clock error.
fn ... |
use crate::{
components::{Components, DoorState, EntityData, Tile},
realtime::RealtimeComponents,
spatial::{Location, SpatialTable},
visibility::Light,
};
use entity_table::{Entity, EntityAllocator};
use grid_2d::{Coord, Size};
use rand::Rng;
use serde::{Deserialize, Serialize};
#[derive(Serialize, Des... |
// This file is part of Substrate.
// Copyright (C) 2019-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// ht... |
// Copyright 2021 <NAME> <<EMAIL>> <<EMAIL>>
mod recollect {
use std::collections::HashMap;
use std::fs;
use std::io::{self, Seek};
use std::path;
use fs2::FileExt;
use serde_json;
type RDB = HashMap<String, String>;
pub struct Recollections {
pub file_path: Option<path::Path... |
use std::marker::PhantomData;
use amethyst_core::ecs::prelude::{
Component, DenseVecStorage, Entities, Entity, FlaggedStorage, Join, ReadStorage,
};
use serde::{Deserialize, Serialize};
use shred_derive::SystemData;
use super::{Anchor, ScaleMode, Stretch};
/// Utility `SystemData` for finding UI entities based ... |
use std::slice::Iter;
use std::iter::Filter;
use rect::*;
fn make_vec() -> Vec<Rect> {
vec![
Rect::new(1, 2, "first"),
Rect::new(10, 20, "second"),
Rect::new(3, 5, "third"),
Rect::new(12, 222, "fourth")
]
}
pub fn run() {
println!("********* Iterator<Rect> examples ********... |
use chrono::{DateTime, Local};
use regex::Regex;
use std::cmp::Ordering;
use std::collections::hash_map::DefaultHasher;
use std::fmt;
use std::hash::{Hash, Hasher};
use crate::{AsyncMigrate, Error, Migrate};
// regex used to match file names
pub fn file_match_re() -> Regex {
Regex::new(r"^(V)(\d+(?:\.\d+)?)__(\w... |
//
//! 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 appl... |
// this isn't a tunneling algorithm so much
// as it is just plopping dozens of random rooms
// around and then connecting them with
// overlapping tunnels later.
use lib::rect::*;
use lib::features::*;
use lib::dun_s1::*;
use std::vec::Vec;
use std::cmp::{min, max};
use rand::prelude::*;
use serde::Deserialize;
#[de... |
use std::path::PathBuf;
use combine::{many, many1, Parser};
use combine::{choice, optional};
use combine::error::StreamError;
use combine::easy::Error;
use ast::{self, Item};
use grammar::{value, bool, block, Code};
use helpers::{semi, ident, string, prefix};
use tokenizer::{TokenStream, Token};
use value::Value;
f... |
use crate::mapcss::styler::{is_non_trivial_cap, LineCap};
pub struct OpacityCalculator {
half_line_width: f64,
dashes: Vec<DashSegment>,
total_dash_len: f64,
traveled_distance: f64,
}
pub struct OpacityData {
pub opacity: f64,
pub is_in_line: bool,
}
impl OpacityCalculator {
pub fn new(ha... |
use crate::bits::*;
use crate::errors::RuntimeError;
use crate::version::*;
use crate::zstring::ZString;
use std::fmt;
use std::fmt::{Display, Formatter};
use std::ops::*;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Bytes(Vec<u8>);
impl Bytes {
pub fn with_size(size: usize) -> Bytes {
Bytes(vec![0; ... |
// modified from my own c-code at: https://github.com/luctius/heresyrl/blob/master/src/fov/rpsc_fov.c
use rl_utils::{Area, Coord};
use std::vec::Vec;
use crate::{utils::Octant, Fov, FovCallbackEnum, FovConfig, Los, VisionShape};
type Angle = usize;
static ANGLE_PERIOD_SHIFT: usize = 0;
#[derive(Copy, Clone, Partial... |
#![cfg_attr(not(feature = "std"), no_std)]
#![allow(clippy::too_many_arguments)]
#![allow(clippy::unnecessary_mut_passed)]
use frame_support::codec::{Decode, Encode};
pub use pallet::*;
use sp_std::cmp::{Ord, PartialOrd};
use sp_std::collections::btree_set::BTreeSet;
#[cfg(test)]
mod mock;
#[cfg(test)]
mod tests;
#... |
#![warn(rust_2018_idioms, missing_docs)]
//! ipfs-unixfs: UnixFs tree support in Rust.
//!
//! The crate aims to provide a blockstore implementation independent of the UnixFs implementation by
//! working on slices and not doing any IO operations.
//!
//! The main entry point for extracting information and/or data out ... |
// Copyright © 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use acpi_tables::{
aml::Aml,
rsdp::RSDP,
sdt::{GenericAddress, SDT},
};
use vm_memory::{GuestAddress, GuestMemoryMmap};
use vm_memory::{Address, ByteValued, Bytes};
use std::sync::{Arc, Mutex};
use crate::cpu::CpuManager;
... |
mod contents;
mod operation;
mod server;
mod manager;
mod display;
use std::time::Duration;
use async_std::task;
use async_std::io as aio;
use linux_embedded_hal::I2cdev;
use ssd1306::builder::I2CDIBuilder;
use ssd1306::displaysize;
use ssd1306::Builder;
use embedded_graphics::fonts;
use embedded_graphics::pixelcolor:... |
use std::collections::HashMap;
use crate::ir::{self, Node, Op};
use crate::number::Number;
use crate::or::{self, *};
use anyhow::{anyhow, bail, ensure, Result};
// lifetimes questionable
#[derive(Debug, Clone, PartialEq, PartialOrd)]
enum Var {
Val(Val),
Branch(Vec<Var>),
}
struct State {
inner: HashMap<... |
use ursa::{
keys::{PrivateKey, PublicKey},
signatures::{ed25519, SignatureScheme},
};
use crate::{
derivation::{basic::Basic, self_addressing::SelfAddressing, self_signing::SelfSigning},
error::Error,
event::sections::nxt_commitment,
prefix::{AttachedSignaturePrefix, BasicPrefix, IdentifierPref... |
use crate::file_util;
static INPUT_FILE: &str = "inputs/day9.txt";
fn get_tubes(lava_tubes: &[u32], width: usize) -> Vec<(usize, u32)> {
let mut result: Vec<(usize, u32)> = Vec::new();
for (index, current_lava_tube) in lava_tubes.iter().enumerate() {
let top = index.checked_sub(width);
let mu... |
//! # sys (UNIX)
//!
//! UNIX-specific structs and functions. Will be imported as `sys` on UNIX systems.
use std::env::var;
use std::sync::atomic::{AtomicBool, Ordering};
// On UNIX systems, termios represents the terminal mode.
pub use libc::termios as TermMode;
use libc::{c_int, c_void, sigaction, sighandler_t, sig... |
use crate::ServerId;
use linkerd_identity as id;
use tracing::trace;
#[derive(Debug, Eq, PartialEq)]
pub struct Incomplete;
/// Determines whether the given `input` looks like the start of a TLS connection.
///
/// The determination is made based on whether the input looks like (the start of) a valid
/// ClientHello ... |
pub use self::evdev::*;
pub use self::evdev::enums::*;
use std::fs::File;
use std::hash::{Hash, Hasher};
use std::io;
use std::os::unix::prelude::*;
extern crate evdev_rs as evdev;
pub struct Gamepad {
devpath: String,
device: Device,
raw_fd: i32,
last_event: Option<MyInputEvent>
}
#[derive(Clone)]
... |
use proc_macro2::{Ident, Span, TokenStream};
use quote::{format_ident, quote};
use syn::{
punctuated::Punctuated, token::Comma, Attribute, Data, DataEnum, DataStruct, DeriveInput,
Fields, Lit, Meta, NestedMeta, Variant,
};
use crate::utils;
pub fn to_automerge(input: &DeriveInput) -> TokenStream {
match &... |
/*! This example demonstrates building an IPv4 packet header using `BitField`.
The example program will run through the construction of the header at the speed
of your terminal's buffer. The program can be made interactive, pausing after
each modification so that the user can manually step to the next, by running it
w... |
use std::mem::size_of;
use std::rc::Rc;
use egui_glow::glow::{Context as GlContext, *};
use crate::support;
use crate::support::image::Image;
/// A RawSurface creates a full-viewport surface with given shaders.
struct RawSurface {
program: NativeProgram,
vertex_array: NativeVertexArray,
vertex_buffer: NativeBuffe... |
use nix;
use nix::sys::epoll;
use nix::sys::signal;
use nix::sys::signalfd;
use nix::sys::timerfd;
use nix::unistd;
use std::cmp::Reverse;
use std::collections::BinaryHeap;
use std::io;
use std::os::unix::io::{AsRawFd, RawFd};
use std::rc::Rc;
use std::time::{Duration, Instant};
use x11rb::connection::Connection;
use x... |
use proc_macro::TokenStream;
#[proc_macro]
pub fn backinsert(item: TokenStream) -> TokenStream {
let mut code = String::new();
let mut items: Vec<String> = Vec::new();
for a in item {
//println!("{:?}", a);
//println!("{:?}", a);
//for token in a.as_.stream {
//}
mat... |
#![allow(dead_code)]
use openapi_type::OpenapiType;
include!("util/test_type.rs");
/// Very cool struct!
#[derive(OpenapiType)]
struct StructDoc {
/// Very important!
foo: String
}
test_type!(StructDoc = {
"type": "object",
"title": "StructDoc",
"description": "Very cool struct!",
"properties": {
"foo": {
... |
use petgraph::visit::{ IntoEdgeReferences, NodeIndexable, IntoNodeIdentifiers, EdgeRef, NodeCount, IntoEdges };
pub use petgraph::algo::FloatMeasure;
/// [Prim's algorithm](https://en.wikipedia.org/wiki/Prim%27s_algorithm)
/// for computing a minimum spanning tree of a graph.
///
/// The input graph is treated as if... |
#[macro_use]
mod dsl;
mod engine;
mod rules;
mod tree_utils;
mod pattern;
use std::{borrow::Cow, fmt, fmt::Formatter};
use rnix::{SmolStr, SyntaxNode, TextRange, TextUnit};
use crate::dsl::RuleName;
/// The result of formatting.
///
/// From this Diff, you can get either the resulting `String`, or the
/// reformatt... |
use std::fs;
use std::io;
use chan;
use csv;
use stats::{Frequencies, merge_all};
use threadpool::ThreadPool;
use CliResult;
use config::{Config, Delimiter};
use index::Indexed;
use select::{SelectColumns, Selection};
use util;
static USAGE: &'static str = "
Compute a frequency table on CSV data.
The frequency tabl... |
//! A linear IR for optimizations.
//!
//! This IR is designed such that it should be easy to combine multiple linear
//! optimizations into a single automata.
//!
//! See also `src/linearize.rs` for the AST to linear IR translation pass.
use crate::cc::ConditionCode;
use crate::integer_interner::{IntegerId, IntegerIn... |
mod card_entry;
mod entries;
mod entry_type;
mod identifier;
mod play_entry;
pub use card_entry::{CardEntry, CardProfile};
pub use entries::Entries;
pub use entry_type::EntryType;
pub use identifier::EntryIdentifier;
pub use play_entry::PlayEntry;
use pulse::volume::ChannelVolumes;
use crate::{
ui::{widgets::VolumeW... |
use std::cell::RefCell;
use std::rc::Rc;
use crate::ast;
use crate::context::CloneSafe;
use crate::error::{GraphError, Result};
use crate::seed::Seed;
use crate::variable::*;
pub use n3_program::graph::*;
pub type RefGraph = Rc<RefCell<Graph>>;
#[derive(Debug)]
pub struct Graph {
pub id: u64,
shortcuts: Var... |
//! Oracles.
//!
//! Oracles take a test case and determine whether we have a bug. For example,
//! one of the simplest oracles is to take a Wasm binary as our input test case,
//! validate and instantiate it, and (implicitly) check that no assertions
//! failed or segfaults happened. A more complicated oracle might co... |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
#![forbid(unsafe_code)]
use crate::{
logging::{LogEntry, LogSchema},
metrics::{increment_counter, start_timer},
network::PeerMonitoringServiceNetworkEvents,
};
use ::network::{application::storage::PeerMetadataStorage, ProtocolId};
use aptos_co... |
use std::{collections::HashMap, env, path::PathBuf};
use bollard::{
container::{Config, CreateContainerOptions},
errors::Error as DockerError,
image::{CreateImageOptions, ListImagesOptions},
models::HostConfig,
Docker, API_DEFAULT_VERSION,
};
use futures::StreamExt;
use http::uri::Uri;
use serde::{... |
use cv::{
bitarray::{BitArray, Hamming},
feature::akaze::Akaze,
image::{
image::{self, DynamicImage, GenericImageView, Rgba, RgbaImage},
imageproc::drawing,
},
knn::{Knn, LinearKnn},
};
use imageproc::pixelops;
use itertools::Itertools;
use palette::{FromColor, Hsv, RgbHue, Srgb};
f... |
use std::{str::FromStr, collections::HashMap};
use thiserror::Error;
use crate::util;
use super::Word;
pub fn parse(s: &str) -> (Vec<Word>, Vec<ParseError>) {
let mut words = Vec::with_capacity(s.lines().count());
let mut explanations = HashMap::new();
let mut errors = Vec::new();
for (line, text) i... |
use crate::coord::ranged1d::{
AsRangedCoord, DiscreteRanged, KeyPointHint, NoDefaultFormatting, Ranged, ValueFormatter,
};
use std::ops::Range;
/// Describe a value for a nested coordinate
#[derive(PartialEq, Eq, Clone, Debug)]
pub enum NestedValue<C, V> {
/// Category value
Category(C),
/// One exact ... |
// Copyright 2021 <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 crate::config::raw::{RawWafEntryMatch, RawWafProfile, RawWafProperties, WafSignature};
use crate::logs::Logs;
use hyperscan::prelude::{pattern, Builder, CompileFlags, Pattern, Patterns, VectoredDatabase};
use hyperscan::Vectored;
use regex::Regex;
use serde::Serialize;
use std::collections::{HashMap, HashSet};
use... |
use std::cell::RefCell;
use std::fs::{create_dir_all, write};
use std::path::PathBuf;
use std::rc::Rc;
use indicatif::ProgressBar;
use indicatif::{ProgressDrawTarget, ProgressStyle};
use crate::e621::sender::entries::UserEntry;
use blacklist::Blacklist;
use dialoguer::Confirm;
use failure::ResultExt;
use grabber::Gra... |
//! `candid::Result<T> = Result<T, candid::Error>>`
use serde::{de, ser};
use crate::parser::token;
use codespan_reporting::diagnostic::{Diagnostic, Label};
use codespan_reporting::files::{Error as ReportError, SimpleFile};
use codespan_reporting::term::{self, termcolor::StandardStream};
use std::io;
use thiserror::E... |
/*
* StegaCean
*
* STEGAnography crustaCEAN, steganography program in rust.
*
* By: <NAME> | MIT Licence | Epoche: Oct 21, 2021
*/
use clap::{App, AppSettings, Arg, ArgMatches};
use lodepng;
use rgb::*;
use std::fs;
use std::fs::File;
use std::io::Write;
use std::path::Path;
fn get_args() -> ArgMatches {
re... |
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
#[cfg(feature = "use_serde")]
use serde::Serialize;
use std::io::{Read, Seek, Write};
use crate::mp4box::avcn::{Avc1Variant, Avc2Variant, Avc3Variant};
use crate::mp4box::*;
use crate::mp4box::{avcn::AvcNBox, hev1::Hev1Box, mp4a::Mp4aBox, tx3g::Tx3gBox};
#[deri... |
use super::ParticleState;
use crate::shape::MonomialSurface;
/// A trait that represents a system formulating some physical laws
pub trait ParticleSystem {
/// Compute time-derivative of a state
fn time_derivative(&self, state: &ParticleState) -> ParticleState;
/// Integrate the system with RK4 for a give... |
use std::io::{self, Write};
use std::str::from_utf8;
use r_htslib::{HtsFile, VcfHeader};
use crate::config::*;
use crate::read_vcf::unpack::{RecordBlock, RecordBlockElem, Strand};
use super::{OutputOpts, calc_phred, Record, MethRec, GT_IUPAC, GT_MASK, get_prob_dist};
// Prob. that sample has the required genotype de... |
#![no_std]
#![no_main]
extern crate embedded_hal;
extern crate panic_semihosting; // logs messages to the host stderr; requires a debugger
//use cortex_m_semihosting::hprintln;
use cortex_m::interrupt::{free, Mutex};
use cortex_m_rt::entry;
use embedded_hal::blocking::delay::DelayMs;
use embedded_hal::digital::Outpu... |
use std::cell::UnsafeCell;
use std::fmt;
use std::ops::{Deref, DerefMut};
use std::sync::atomic::{AtomicBool, Ordering};
use log::error;
use crate::errors::WebError;
use crate::lock::request_tick::{request_tick_after_timeout, ClosureHandle};
/// Like a Mutex but not as smart
#[derive(Debug)]
pub struct Stupex<T: ?Si... |
use crate::options::{FtpsClientAuth, TlsFlags};
use rustls::server::StoresServerSessions;
use rustls::{
server::{AllowAnyAnonymousOrAuthenticatedClient, AllowAnyAuthenticatedClient, NoClientAuth, NoServerSessionStorage},
version::{TLS12, TLS13},
Certificate, NoKeyLog, PrivateKey, RootCertStore, ServerConfig... |
// Copyright 2018 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 ... |
use std::sync::Arc;
use crate::{
aabb::AABB,
hittable::{HitRecord, Hittable},
rtweekend::random_int,
Ray, Vec3,
};
pub struct BVHNODE {
pub left: Arc<dyn Hittable>,
pub right: Arc<dyn Hittable>,
pub box1: AABB,
}
impl Hittable for BVHNODE {
fn hit(&self, ray: &Ray, t_min: f64, t_max: ... |
use super::cassette::*;
use super::interface::*;
pub const PATTERN_TABLE_BASE_ADDR: u16 = 0x0000;
pub const NAME_TABLE_BASE_ADDR: u16 = 0x2000;
pub const NAME_TABLE_MIRROR_BASE_ADDR: u16 = 0x3000;
pub const PALETTE_TABLE_BASE_ADDR: u16 = 0x3f00;
pub const VIDEO_ADDRESS_SIZE: u16 = 0x4000;
pub const NAME_TABLE_SIZE: u... |
use crate::command::{Command, CommandResult, CommandResultBuilder};
use crate::executor::ExecutorResult;
use crate::id::{ProcessId, Rifl, ShardId};
use crate::trace;
use crate::HashMap;
/// Structure that tracks the progress of pending commands.
#[derive(Clone)]
pub struct AggregatePending {
process_id: ProcessId,... |
// Copyright 2020 Pants project contributors (see CONTRIBUTORS.md).
// Licensed under the Apache License, Version 2.0 (see LICENSE).
use std::collections::HashMap;
use std::convert::From;
use std::iter::Iterator;
use async_trait::async_trait;
use bytes::BytesMut;
use fs::{
directory, DigestTrie, DirectoryDigest, Gl... |
#![feature(associated_consts)]
#![feature(asm)]
#![feature(const_fn)]
#![feature(shared)]
#![feature(nonzero)]
#![feature(step_by)]
#![feature(allocator)]
#![allocator]
#![no_std]
#![cfg_attr(os_test, allow(unused))]
#[macro_use] extern crate basics;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate... |
use crate::source_analysis::prelude::*;
use quote::ToTokens;
use std::path::PathBuf;
use syn::{spanned::Spanned, *};
pub(crate) fn process_items(
items: &[Item],
ctx: &Context,
analysis: &mut LineAnalysis,
) -> SubResult {
let mut res = SubResult::Ok;
for item in items.iter() {
match *item ... |
// 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 crate::core::manifold::Manifold;
use nalgebra::allocator::Allocator;
use nalgebra::{DefaultAllocator, DimName, OMatrix, OVector, Scalar};
use std::fmt::Debug;
use std::ops::Mul;
#[allow(non_snake_case)]
pub trait LieGroup<N>: Debug + Sized + Copy
where
Self: Mul<Self, Output = Self>,
Self: for<'a> Mul<&'a... |
use bevy::{math::*, prelude::shape::Quad, prelude::*};
use bevy_rapier2d::prelude::*;
use std::default::Default;
use crate::physics_object::PhysicsObjectBundle;
use crate::planet::Gravity;
use crate::ship::Ship;
pub struct CharacterPlugin;
impl Plugin for CharacterPlugin {
fn build(&self, app: &mut App) {
... |
//! Interprocedural part of the analysis.
use std::collections::hash_map::{Entry, HashMap};
use std::collections::HashSet;
use std::collections::VecDeque;
use log::Level;
use rustc::hir::def_id::DefId;
use super::constraint::{ConstraintSet, Perm};
use super::context::Ctxt;
use super::Var;
struct WorkList {
queu... |
//! Test tools for php fpm program.
//!
use crate::{context::Context, utils, utils::spawn_command};
use fastcgi_client::{Client, Params, Request};
use libc::{atexit, kill, pid_t, SIGTERM};
use once_cell::sync::OnceCell;
use std::{
fs,
mem::{forget, ManuallyDrop},
path::{Path, PathBuf},
process::Child,
... |
use assert2::{assert, let_assert};
use tokio_seqpacket::UnixSeqpacket;
/// Test a simple send and recv call.
#[tokio::test]
async fn send_recv() {
let_assert!(Ok((a, b)) = UnixSeqpacket::pair());
assert!(let Ok(12) = a.send(b"Hello world!").await);
let mut buffer = [0u8; 128];
assert!(let Ok(12) = b.recv(&mut buf... |
/// Functions for parsing & serialization of Orchard transaction components.
use std::convert::TryFrom;
use std::io::{self, Read, Write};
use orchard::{
bundle::{Action, Authorization, Authorized, Flags},
note::{ExtractedNoteCommitment, Nullifier, TransmittedNoteCiphertext},
primitives::redpallas::{self, S... |
// Copyright (C) 2022 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
... |
use curve25519_dalek::ristretto::CompressedRistretto;
use curve25519_dalek::ristretto::RistrettoPoint;
use curve25519_dalek::scalar::Scalar;
use crate::member::*;
#[derive(Debug)]
pub struct Signature {
pub challenge: Scalar,
pub responses: Vec<Scalar>,
pub key_images: Vec<CompressedRistretto>,
}
pub enu... |
//! HTTP client interceptor API.
//!
//! This module provides the core types and functions for defining and working
//! with interceptors. Interceptors are handlers that augment HTTP client
//! functionality by decorating HTTP calls with custom logic.
//!
//! Known issues:
//!
//! - [`from_fn`] doesn't work as desired.... |
use crate::{commands::dataframe::utils::parse_polars_error, prelude::*};
use nu_engine::WholeStreamCommand;
use nu_errors::ShellError;
use nu_protocol::{
dataframe::{Column, NuDataFrame},
Primitive, Signature, SyntaxShape, UntaggedValue, Value,
};
use polars::prelude::{ChunkSet, DataType, IntoSeries};
pub stru... |
use std::io::{Read, Write, stdout, Stdout, stdin, Stdin};
use log::{info, error};
use simplelog::{CombinedLogger, WriteLogger, LevelFilter, Config};
use std::fs::File;
use termion::raw::{IntoRawMode, RawTerminal};
use std::thread;
use crate::decker::{MasterControl, TaskId, ProcessOrchestrator, ProcOutput};
use crate::d... |
use crate::evolution::{EvolutionResult, EvolutionStrategy};
use crate::prelude::*;
use crate::utils::Timer;
use std::marker::PhantomData;
use std::ops::Deref;
/// An entity which simulates evolution process.
pub struct EvolutionSimulator<C, O, S>
where
C: HeuristicContext<Objective = O, Solution = S>,
O: Heuri... |
use std::sync::Arc;
use hyper::{Body, Request, Response, StatusCode};
use log::{error, info, warn};
use ring::{digest, pbkdf2};
use rustc_serialize::hex::{FromHex, ToHex};
use serde_derive::Deserialize;
use serde_json::json;
use crate::config::Config;
use crate::ldap_auth;
use crate::server::http::{parse_json, Filter... |
use std::fmt::Display;
use rand::{thread_rng, Rng};
use thingvellir::{
service_builder, Commit, CommitToUpstream, DataCommitRequest, DataLoadRequest,
DefaultCommitPolicy, LoadFromUpstream, ServiceData, ShardStats,
};
use tokio::time::{delay_for, Duration};
/// This really dumb upstream just simply creates str... |
// Copyright (c) 2017 <NAME>
//
// 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. All files in the project carrying such notice may not be copied,
// modified, ... |
use serde::Serialize;
use crate::{AlertType, OutParams};
use concourse_resource::BuildMetadata;
#[derive(Serialize)]
pub struct Message {
pub color: String,
pub text: Option<String>,
pub icon_url: String,
}
struct FormattedBuildInfo {
job_name: String,
build_name: String,
build_number: String... |
#[derive(Copy, Clone, Debug, PartialEq)]
pub enum Piece {
Empty,
X,
O,
}
#[derive(Debug, Clone, Copy)]
pub enum Player {
X,
O
}
#[derive(Debug, Eq, PartialEq, Ord, PartialOrd, Clone, Copy)]
pub enum Outcome {
O = 1,
Draw,
X,
}
#[derive(Copy)]
pub struct BoardState {
board: [[Piece... |
use handlebars::Handlebars;
use lettre::message::{MultiPart, SinglePart};
use lettre::transport::smtp::authentication::Credentials;
use lettre::{Message, SmtpTransport, Transport};
use serde::{Deserialize, Serialize};
use crate::Config;
#[derive(Serialize, Deserialize, Debug)]
pub struct Weather {
pub city: String... |
//! Methods related to handling [inline queries][tg doc].
//!
//! [tg doc]: https://core.telegram.org/bots/api#inline-mode
use std::sync::Arc;
use tbot::{
contexts::Inline,
types::{inline_query, input_message_content, keyboard::inline, parameters},
};
use crate::{
state::{spoiler::Content, State},
str... |
mod base_types;
mod base_utils;
mod client;
mod enums;
mod form;
mod header;
mod json;
mod mods;
mod multipart;
mod path;
mod query;
mod traits;
use anyhow::Result;
use client::ApiDetailedDescription;
use mods::{FileProperty, Mods};
use proc_macro2::TokenStream;
use serde_yaml::from_reader as yaml_from_reader;
use std... |
use std::error;
use std::io;
use std::fmt;
use std::error::Error;
use hyper;
use serde_json;
#[derive(Debug)]
pub enum OkoError {
Io(io::Error),
Http(hyper::Error),
Parser(serde_json::Error),
API(APIError),
}
impl From<APIError> for OkoError {
fn from(err: APIError) -> OkoError {
OkoError... |
use std::path::PathBuf;
use std::sync::{atomic::AtomicBool, Arc};
use anyhow::Result;
use filter::FilteredItem;
use icon::{Icon, IconKind};
use matcher::MatchType;
use parking_lot::Mutex;
use serde::Deserialize;
use crate::stdio_server::{types::ProviderId, Message};
const DEFAULT_DISPLAY_WINWIDTH: u64 = 100;
const ... |
//! This crate is a Rust wrapper and interface to the [SPOA](https://github.com/rvaser/spoa) (simd-accelerated partial order alignment) library.
//! This library allows the efficient generation of a consensus sequence from a set of DNA or protein sequences.
//!
//! If you use this crate, please cite the original autho... |
use crate::binemit::Stackmap;
use crate::ir::types::Type;
use crate::ir::Function;
use crate::ir::{ArgumentExtension, ArgumentPurpose, StackSlot};
use crate::isa::spirv::inst::EmitState;
use crate::isa::spirv::inst::Inst;
use crate::machinst::abi::ABIBody;
use crate::settings;
use alloc::vec::Vec;
use regalloc::*;
us... |
use clap::{App, Arg};
use rand::{
distributions::{Alphanumeric, Distribution},
thread_rng,
};
use std::convert::TryFrom;
use std::convert::TryInto;
use std::fs;
use std::path::Path;
use std::path::PathBuf;
use std::process::{exit, Command};
static REGISTRY: &str = "typeable";
static IMAGE: &str = "octopod-web-... |
use circuit::encoder;
use config;
use eth_client::ETHClient;
use ff::{PrimeField, PrimeFieldRepr};
use models::abi::TEST_PLASMA_ALWAYS_VERIFY;
use models::plasma::block::BlockData;
use models::plasma::{params, AccountMap};
use models::*;
use std::sync::mpsc::{channel, Receiver, Sender};
use storage::ConnectionPool;
use... |
// 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.
#![deny(warnings)]
#![allow(missing_docs)]
use failure::{format_err, Error};
use rand::{self, Rng};
use std;
use std::ffi::{CString, OsStr, OsString};
use... |
use crate::shape::{Shape, RandomShape};
use crate::point::PrimitivePoint;
use crate::primitive_image::PrimitiveImage;
use image::Rgba;
use std::cmp::max;
use rand;
use rand::Rng;
use image::ImageBuffer;
use imageproc::drawing::draw_filled_ellipse;
use imageproc::affine::rotate;
use imageproc::affine::Interpolation::Nea... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.