text stringlengths 3.09k 13.9k |
|---|
use log::{debug, error, info};
use openssl::pkey;
use openssl::rsa::Rsa;
use std::io;
use std::net::TcpListener;
use std::ops::DerefMut;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::Duration;
use uuid::Uuid;
use crate::clientbound;
use crate::clientbound::... |
//! Translucent Material
use bumpalo::Bump;
use core::bssrdf::*;
use core::interaction::*;
use core::material::*;
use core::microfacet::TrowbridgeReitzDistribution;
use core::paramset::*;
use core::pbrt::*;
use core::reflection::*;
use core::spectrum::*;
use core::texture::*;
use std::sync::Arc;
use textures::*;
/// ... |
use wgpu::util::DeviceExt;
use super::Options;
use futures::future::join;
use std::{convert::TryInto, future::Future, num::NonZeroU64, time::Duration};
fn block_on<T>(future: impl Future<Output = T>) -> T {
cfg_if::cfg_if! {
if #[cfg(target_arch = "wasm32")] {
wasm_bindgen_futures::spawn_local... |
mod fat32;
use clap::{App, Arg};
use fat32::{StateFatMap, StatePosInfo, UFat};
use rand::{thread_rng, seq::SliceRandom};
use regex_automata::{dense, DFA};
use std::collections::{HashMap, HashSet};
use std::error::Error;
use std::fs::File;
use std::io::Write;
use std::process::exit;
const FORBIDDEN_PRINT_ASCII: [u8; 17... |
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
//! Secure Client Actor State
use crate::{internals, line_error};
use crate::{state::key_store::KeyStore, utils::LoadFromPath, Location};
use engine::{
store::Cache,
vault::{ClientId, DbView, RecordId, VaultId},
};
use std::time::Duration;... |
use super::CapSecret;
use crate::zome::FunctionName;
use crate::zome::ZomeName;
use ai_hash::*;
use aingle_middleware_bytes::SerializedBytes;
use serde::Deserialize;
use serde::Serialize;
use std::collections::BTreeMap;
use std::collections::BTreeSet;
/// Represents a _potentially_ valid access grant to a zome call.
/... |
use crate::color::LinSrgba;
use crate::draw::primitive::path;
use crate::draw::primitive::{PathStroke, Primitive};
use crate::draw::properties::spatial::{orientation, position};
use crate::draw::properties::{ColorScalar, SetColor, SetOrientation, SetPosition, SetStroke};
use crate::draw::{self, Drawing};
use crate::geo... |
#[cfg(test)]
#[path = "../../tests/unit/checker/capacity_test.rs"]
mod capacity_test;
use super::*;
use crate::utils::combine_error_results;
use std::iter::once;
use vrp_core::models::common::{Load, MultiDimLoad};
/// Checks that vehicle load is assigned correctly. The following rules are checked:
/// * max vehicle's... |
//
// Copyright (c) Dell Inc., or its subsidiaries. All Rights Reserved.
//
// 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 crate::pr... |
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::num::ParseIntError;
use std::path::PathBuf;
#[cfg(test)]
fn vec_to_str(pixels: &Vec<bool>) -> String {
pixels
.iter()
.map(|p| if *p { '#' } else { '.' })
.collect::<String>()
}
fn str_to_vec(pixels: &String) -> Vec<bool> {
... |
// Take a look at the license at the top of the repository in the LICENSE file.
use glib::translate::*;
use glib::Type;
use std::fmt;
use std::ptr;
use crate::io_extension::IOExtension;
// rustdoc-stripper-ignore-next
/// Builder for extension points.
#[derive(Debug)]
#[must_use = "The builder must be built to be us... |
use super::Snapshot;
use std::io::{Result, Write};
use std::time::{Duration, Instant};
use tokio::net::UdpSocket;
use tokio::sync::mpsc::Receiver;
use tokio::time::{interval, Interval};
use futures::ready;
pub(crate) struct Sender {
rx: Receiver<Snapshot>,
addr: String,
socket: Option<UdpSocket>,
buf... |
// 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... |
use std::collections::HashMap;
use std::io::{BufRead, BufReader};
use ggez::graphics::{Image, Rect, WHITE};
use ggez::{error::GameError, Context, GameResult};
use super::level::Level;
use super::tile::Tile;
use crate::sprites::Sprite;
pub struct LevelBuilder {
default: Sprite,
tile_image: HashMap<usize, Spri... |
mod utils;
use jrsonnet_parser::{LocExpr, ParseError};
use log::{error, trace, warn};
use lsp_server::{Connection, ErrorCode, Message, Notification, Request, RequestId, Response};
use lsp_types::{
notification::{Notification as _, *},
request::{Formatting, Request as RequestTrait},
OneOf, *,
};
use std::... |
use std::cell::RefCell;
use std::rc::Rc;
use std::collections::BTreeMap;
use walkdir::WalkDir;
use deno_core::{JsRuntime, json_op_sync, serde_json::Value};
use regex::Regex;
use unicode_segmentation::UnicodeSegmentation;
fn main() {
let mut cards_js = get_cards();
assert!(!cards_js.is_empty());
let card_t... |
use std::{
fs::File,
io::{self, BufReader, Read, Write},
path::{Path, PathBuf},
};
use eyre::Result;
use ignore::WalkBuilder;
use itertools::Itertools;
use log::debug;
use serde_yaml::Value;
use crate::CliArgs;
#[derive(Debug)]
enum WriteMode {
Write,
StdOut,
DryRun,
}
#[derive(Debug)]
pub e... |
//! Module `program` describes a single slide program, and is the heart of the server's query and
//! analysis work.
use libslide::evaluator_rules::Rule;
use libslide::{build_rules, ProgramContext};
use parking_lot::{MappedRwLockReadGuard, RwLock, RwLockReadGuard};
use tower_lsp::lsp_types::Url;
use crate::ast::Ast;
... |
#[cfg_attr(test, macro_use)]
extern crate may;
use std::fmt;
use std::sync::Arc;
use std::ops::{Deref, DerefMut};
use std::collections::LinkedList;
use std::cell::{Cell, UnsafeCell};
use std::panic::{RefUnwindSafe, UnwindSafe};
use std::sync::atomic::{AtomicUsize, Ordering};
use may::sync::{AtomicOption, Blocker, Mut... |
//! An `OpenCL` platform identifier.
//!
//! Documentation copied from [https://www.khronos.org/registry/cl/sdk/1.2/doc
//! s/man/xhtml/clGetPlatformInfo.html](https://www.khronos.org/registry/cl/sd
//! k/1.2/docs/man/xhtml/clGetPlatformInfo.html)
use std;
use std::ops::{Deref, DerefMut};
use std::str::SplitWhitespace... |
//! Run the example with command `cargo run --example render2d_millions` --release`.
//!
//! My device(CPU: AMD R5 2600X, Meomory: 16GB DDR4, GPU: NVIDIA GTX1070Ti) can be
//! able to render 1_000_000 sprites in 60 fps.
use yam::legion::{systems::CommandBuffer, *};
use yam::nalgebra::Vector2;
use yam::*;
fn main() ->... |
//! CCH query based on elimination tree
use super::*;
pub mod stepped_elimination_tree;
use crate::datastr::timestamped_vector::TimestampedVector;
use stepped_elimination_tree::EliminationTreeWalk;
#[derive(Debug)]
pub struct Server<CCH, CCHB> {
customized: Customized<CCH, CCHB>,
fw_distances: TimestampedVect... |
//! Linking for JIT-compiled code.
use crate::object::utils::try_parse_func_name;
use object::read::{Object, ObjectSection, Relocation, RelocationTarget};
use object::{elf, File, RelocationEncoding, RelocationKind};
use std::ptr::{read_unaligned, write_unaligned};
use wasmtime_environ::entity::PrimaryMap;
use wasmtime... |
use super::*;
use crate::simulation::Graph;
use bzip2::read::BzDecoder;
use bzip2::write;
use bzip2::Compression;
use std::cmp::max;
use std::fs;
use std::fs::File;
use std::io::prelude::*;
impl Graph {
pub fn from_as_rel_file(path: &Path) -> Self {
let contents = read_bz2_file_to_string(path);
... |
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::HashMap;
lazy_static! {
static ref LOWERCASED: Regex = Regex::new(r"([a-z]+)").unwrap();
}
use crate::{
ast::{self, Type},
error_message::ErrorMessage,
span::{Span, Spanned},
};
#[derive(Debug, Clone)]
pub struct InferedType {
p... |
//! Hamming-encoded headers for the preppers. Reading a corrupted header can
//! have devastating consequences. It is better to panic. And yes, this _has_
//! happened in a real world scenario (SIGKILL).
//!
//! Here is how to generate the parity masks, in Python:
//! ```python
//! pow2 = {1, 2, 4, 8, 16, 32}
//!
//! f... |
//extern crate std::string;
// extern crate std;
// use std::time::Duration;
// extern crate core;
use std::collections::HashMap;
use std::cell::RefCell;
use std::sync::RwLock;
use std::sync::Arc;
use std::sync::RwLockReadGuard;
// use core::ops::Deref;
use super::super::utils::big::parse;
use super::super::utils::bi... |
use super::{Editor, SegmentRow, TimingMethod};
use crate::comparison::personal_best;
use crate::platform::prelude::*;
use crate::run::RunMetadata;
use crate::settings::{CachedImageId, ImageData};
use crate::timing::formatter::none_wrapper::EmptyWrapper;
use crate::timing::formatter::{Accuracy, Short, TimeFormatter};
us... |
use std::collections::HashMap;
extern crate simple_json;
use simple_json::{ Json, Number };
macro_rules! test {
($T: ty, $jsn:expr, $val:expr) => {{
let json = Json::parse($jsn).unwrap();
let source: String = json.to_source();
let val: $T = json.into();
assert_eq!($jsn, source);
... |
use crate::util::{Compact, TimeUntil};
use fnv::FnvHashMap;
use futures::future::{AbortHandle, AbortRegistration};
use std::{
collections::hash_map,
task::{Context, Poll},
time::SystemTime,
};
use tokio_util::time::delay_queue::{self, DelayQueue};
use tracing::Span;
/// A data structure that tracks in-flig... |
use ggez::{
conf,
event,
graphics,
input,
timer,
Context,
ContextBuilder,
GameResult,
};
use ggez::mint::{Point2};
use ggez::event::{EventHandler, KeyCode};
use ggez::graphics::{Color, Text};
mod stars2;
mod vector;
use vector::{
Vec3D,
Vec2D
};
const WIDTH: usize = 1280;
const ... |
/*-----------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See LICENSE in the project root for license information.
*-----------------------------------------------------------------------... |
use crate::stream::{OutputStreamHandle, PlayError};
use std::sync::atomic::Ordering;
use std::sync::atomic::{AtomicBool, AtomicUsize};
use std::sync::mpsc::Receiver;
use std::sync::Arc;
use std::sync::Mutex;
use std::time::Duration;
use crate::queue;
use crate::source::Done;
use crate::Sample;
use crate::Source;
use s... |
use crate::cache::{Cache, CacheItem, LFUCacheItem, LRUCacheItem, ICache, IPolicy, ICacheItemWrapper, Policy};
use self::constants::{DISCOUNT_RATE, LEARNING_RATE};
use rand::random;
use std::collections::{HashMap, BinaryHeap};
use std::f64::consts::E;
mod constants;
/// Controlling struct for the cache
/// Keeps a mai... |
// Tako -- Take container image.
// Copyright 2018 <NAME>, <NAME>, <NAME>.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// A copy of the License has been included in the root of the repository.
//! Interface to libcurl. Not as b... |
// This file is part of olympus-xmp. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/raphaelcohn/olympus-xmp/master/COPYRIGHT. No part of olympus-xmp, including this file, may be copied, modified, propagated, or dist... |
extern crate advantage as adv;
use adv::prelude::*;
use adv::Float;
/// Sigmoid function
fn sigmoid<T: Float>(x: T) -> T {
let x_exp = x.exp();
x_exp / (x_exp + T::one())
}
/// A simple multilayer perceptron with 2 input neuron, 2 hidden neurons and 1 output neuron
fn multilayer_perceptron<T: Float>(
inp... |
use crate::word_count::WordCount;
use super::WordCountable;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std::fs::{File, OpenOptions};
use std::io::{self, ErrorKind, Read};
#[cfg(unix)]
use libc::S_IFREG;
#[cfg(unix)]
use nix::sys::stat;
#[cfg(any(target_os = "linux", target_os = "android"))]
use std:... |
use anyhow::{Error, anyhow};
use serde_json::Value;
#[derive(Debug)]
pub struct Procedure {
pub name: String,
pub commands: Vec<String>,
pub environment: String,
pub condition: String,
pub deploy_path: String,
pub auto_restart: AutoRestartPolicy,
pub branches: Vec<String>,
pub log: Opti... |
use colored::Colorize;
use failure::{err_msg, Backtrace, Context, Error, Fail};
use fern::colors::ColoredLevelConfig;
use log::Level;
use std::collections::HashSet;
use std::fmt::{self, Display};
use std::io;
use std::str::FromStr;
use std::sync::Arc;
use crate::c_ast::{ClangAstParseErrorKind, DisplaySrcSpan};
use c2r... |
use crate::{device::Device, sys::*, FilterError};
/// A generic ray tracing denoising filter for denoising
/// images produces with Monte Carlo ray tracing methods
/// such as path tracing.
pub struct RayTracing<'a, 'b> {
handle: OIDNFilter,
device: &'a Device,
albedo: Option<&'b [f32]>,
normal: Option... |
// Copyright 2020-2021 The Datafuse Authors.
//
// SPDX-License-Identifier: Apache-2.0.
use std::cmp::Ordering;
use std::fmt;
use std::marker::PhantomData;
use common_datavalues::prelude::*;
use common_datavalues::DFTryFrom;
use common_exception::ErrorCode;
use common_exception::Result;
use common_io::prelude::*;
us... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::fs;
use std::path::Path;
use std::process;
use std::rc::Rc;
use rusty_v8 as v8;
use crate::binding;
use crate::bootstrap;
use crate::js_loading;
struct IsolateState {
hash_to_absolute_path: HashMap<i32, String>,
absolute_path_to_module: HashMap<... |
use std::{
collections::VecDeque,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
time::Duration,
};
use tokio::sync::{Mutex, Notify};
use zksync_types::{AccountUpdates, BlockNumber};
/// Description of a single block root hash job.
///
/// Contains data required to calculate the roo... |
use crypto_market_type::MarketType;
use crate::{MessageType, Order, OrderBookMsg, TradeMsg, TradeSide};
use super::EXCHANGE_NAME;
use crate::exchanges::utils::calc_quantity_and_volume;
use serde::{Deserialize, Serialize};
use serde_json::Value;
use simple_error::SimpleError;
use std::collections::HashMap;
pub(super)... |
extern crate rbtree;
use std::sync::Arc;
use common::{error::Errno, numbers::NumberOp};
use io_engine::backend_storage::BackendStore;
use rbtree::RBTree;
use crossbeam_channel::{Receiver, select};
use crate::segment_store::SegmentStore;
use crate::segment_backend_store_types::{ReqCloseSegmentBackendStore, ReqOpenSegm... |
use super::*;
use bbs::{Issuer as BbsIssuer, MessageGenerators, PublicKey, SecretKey};
use bls::ProofOfPossession;
use core::convert::TryFrom;
use ockam_core::lib::{HashMap, String, Vec};
use rand::{CryptoRng, RngCore};
use signature_core::lib::*;
/// Represents an issuer of a credential
#[derive(Debug)]
pub struct Cr... |
use hir_def::data::LocalFieldId;
use la_arena::ArenaMap;
use crate::{
ty::{ArraySize, ArrayType, ScalarType, Ty, TyKind, VecSize},
HirDatabase,
};
type Bytes = u32;
fn round_up(multiple: Bytes, num: Bytes) -> Bytes {
(num + multiple - 1) / multiple * multiple
}
#[test]
fn test_round_up() {
assert_eq... |
use log::{debug, warn};
use prost::{Message, Oneof};
use std::{
collections::{HashMap, HashSet},
str,
sync::Arc,
time::{Duration, Instant},
};
use tentacle::{
async_trait,
bytes::{Bytes, BytesMut},
context::{ProtocolContext, ProtocolContextMutRef},
service::TargetSession,
traits::Ser... |
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::io::{
prelude::{Read, Seek},
SeekFrom,
};
use crate::data::{pubs::MasterRecord, EOByte, EOShort, Serializeable, StreamReader};
/// represents emf (skill master) files
///
/// The master file contains a list of vendor NPCs and skills they... |
use crate::common::access_control;
use serum_common::pack::Pack;
use serum_common::program::invoke_token_transfer;
use serum_lockup::accounts::{vault, Vesting};
use serum_lockup::error::{LockupError, LockupErrorCode};
use solana_program::msg;
use solana_sdk::account_info::{next_account_info, AccountInfo};
use solana_sd... |
use core::str::FromStr;
use std::fs;
use std::time::Instant;
const INPUT_FILEPATH: &str = "../resources/year2018_day4_input.txt";
type Int = u32;
#[derive(Debug, Eq, Ord, PartialEq, PartialOrd)]
enum Action {
ShiftBegins(Int),
FallsAsleep,
WakesUp,
}
impl FromStr for Action {
type Err = ();
fn f... |
use crate::{lock::Lock, process::Process, vm::VmSpace};
use alloc::boxed::Box;
use alloc::str;
use core::ops::{Deref, DerefMut};
use cstr_core::{CStr, CString};
use libc::{c_char, c_void};
#[derive(Debug)]
#[repr(transparent)]
pub struct Task(pub(crate) *mut TaskInner);
impl Task {
/// Get the current running [`Task... |
#[macro_use]
extern crate failure;
extern crate json;
extern crate wait_timeout;
mod runner;
use std::process::{self, Command, Stdio};
use std::fs::{File, remove_file};
use std::io::Read;
use std::path::{Path, PathBuf};
use std::str::from_utf8;
use runner::{CoverageRunner, FullSuiteRunner, Runner, Status};
static TA... |
use crate::downloader::{
messages::{EthMessageId, Message},
sentry_client::*,
};
use anyhow::bail;
use futures_core::Stream;
use futures_util::TryStreamExt;
use parking_lot::RwLock;
use std::{collections::HashMap, pin::Pin, sync::Arc};
use strum::IntoEnumIterator;
use tokio::{
sync::{broadcast, mpsc},
t... |
use tui::{
backend::Backend,
layout::{Alignment, Constraint, Direction, Layout, Rect},
style::{Color, Modifier, Style},
widgets::{Block, BorderType, Borders, Clear, Paragraph},
Frame,
};
use super::{
game::{COLS, ROWS},
App,
};
const CELL_WIDTH: u16 = 5;
const CELL_HEIGHT: u16 = 3;
const PADDING: u16 = ... |
//! Module providing advanced iterators over SpanTree nodes.
use crate::prelude::*;
use crate::node;
use crate::node::Payload;
use crate::Node;
// ===============================
// === Chain Children Iterator ===
// ===============================
/// A stack frame of DFS searching.
#[derive(Debug)]
struct StackF... |
use sauron::{
html::{
attributes::class,
div,
text,
},
prelude::*,
Node,
};
use web_sys::HtmlAudioElement;
#[derive(Clone, Debug)]
pub enum Msg {
AnimateIn,
StopAnimation,
NextAnimation(bool, f64, f64),
}
pub struct AnimateList<MSG> {
animated_layer: Option<Node... |
use crate::attribute::Attribute;
use crate::encoding::Encoding;
use crate::handler::Handler;
use crate::handler::HandlerResult;
use crate::tag;
use crate::tag::Tag;
use crate::value_parser::data::DataParser;
use crate::value_parser::data_undefined_length::DataUndefinedLengthParser;
use crate::value_parser::encapsulated... |
use anyhow::{anyhow, Error, Result};
use std::collections::{HashMap, HashSet, VecDeque};
use std::fs;
use std::path::Path;
use std::str::FromStr;
fn subtract(a: usize, b: usize) -> Option<usize> {
if b > a {
return None;
}
{
Some(a - b)
}
}
#[derive(Eq, Debug, Clone, Copy, PartialEq)]
... |
// Copyright 2020 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... |
use std::time::Duration;
use base64;
use cast_client::{MediaConnection, ReceiverConnection, Status};
use floating_duration::TimeAsFloat;
use punchtop_audio::chromecast::Device as CastDevice;
use punchtop_audio::Track;
use punchtop_playlist::fs::{self, Playlist};
use serde_derive::Serialize;
use stream_util::{self, Tri... |
use serde::{de, Deserialize, Deserializer, Serialize};
/// It's kind of dumb that we can't just derive `Deserialize` for [`ConcreteNumber`].
/// See docs for [`ConcretNumber`] as to why this isn't possible and why we need this
/// Visitor at all.
pub(super) struct ConcreteNumberVisitor;
impl<'de> de::Visitor<'de> for... |
use std::sync::Arc;
use parking_lot::RwLock;
use beserial::Deserialize;
use nimiq_block::{
Block, MacroBlock, MacroBody, MultiSignature, SignedViewChange, TendermintIdentifier,
TendermintProof, TendermintProposal, TendermintStep, TendermintVote, ViewChange,
ViewChangeProof,
};
use nimiq_blockchain::{Abstr... |
//! [`ProofOfPossession`] and related logic.
use merlin::Transcript;
use rand_core::{CryptoRng, RngCore};
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use subtle::ConstantTimeEq;
#[cfg(feature = "serde")]
use crate::serde::{ScalarHelper, VecHelper};
use crate::{
alloc::Vec,
group::Group,
... |
// editor-server - A HTTP server to interface file edition.
//
// The MIT License (MIT)
//
// Copyright (c) <NAME> (https://github.com/JonathanxD) <<EMAIL>>
// Copyright (c) contributors
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this softwar... |
mod attach_to_game;
mod close_socket;
mod create_object;
mod delete_object;
mod direct_sending;
mod games_list_query;
mod get_game_data;
mod leave_world;
mod register_name;
mod server_time_query;
mod set_game_data;
mod set_player_data;
mod set_world;
mod total_players_data_query;
mod update_object;
use attach_to_game:... |
use async_std::prelude::*;
use async_std::stream::Stream;
use std::collections::HashSet;
enum Field {
Empty,
Asteroid,
}
struct Map {
map: Vec<Field>,
width: usize,
}
impl Map {
fn coords(&self, idx: usize) -> (isize, isize) {
let x = (idx % self.width) as isize;
let y = (idx / se... |
use crate::errors::FormatError;
#[derive(Debug, PartialEq)]
enum Segment {
PlaceHolder {
padding: Option<usize>,
index: usize,
},
String(String),
}
#[derive(Debug, PartialEq)]
pub struct Formatter(Vec<Segment>);
impl Formatter {
pub fn new(format: &str) -> Result<Self, FormatError> {
... |
// This file is part of the open-source port of SeetaFace engine, which originally includes three modules:
// SeetaFace Detection, SeetaFace Alignment, and SeetaFace Identification.
//
// This file is part of the SeetaFace Detection module, containing codes implementing the face detection method described in the f... |
// Copyright 2018-2020 ETH Zurich
// <NAME> <<EMAIL>>
//
// SPDX-License-Identifier: (Apache-2.0 OR MIT)
use std::fs::File;
use std::io::{BufRead, BufReader, Result};
use std::io::prelude::*;
use std::vec::Vec;
use std::collections::HashMap;
#[macro_use]
extern crate clap;
use clap::{Arg, App};
extern crate regex;
u... |
use std::io;
use std::{error, result};
use std::fmt;
use nson::Message;
use crate::dict::*;
#[derive(Debug)]
pub enum Error {
NotFound(String),
PermissionDenied(String),
ConnectionRefused(String),
ConnectionAborted(String),
Full(String),
Disconnected(String),
BrokenPipe(String),
Alrea... |
//! # [Day 2: Dive!](https://adventofcode.com/2021/day/2)
//!
//! Now, you need to figure out how to pilot this thing.
//!
//! It seems like the submarine can take a series of commands like `forward 1`, `down 2`, or `up 3`:
//!
//! - `forward X` increases the horizontal position by `X` units.
//! - `down X` increas... |
use crate::error::*;
use nom::
{
character::complete::*,
combinator::*,
sequence::*,
multi::*,
IResult,
Parser,
};
/// # Examples
///
/// ```
/// # use adventofcode::solution::{ y2021::d20::Solution, Solution as S };
/// # env_logger::init();
/// let input = "..#.#..#####.#.#.#.###.##.....###.##.#..###.####..##... |
use base64;
use clap::{App, Arg, ArgMatches};
use md5;
use std::ops::Deref;
use std::path::Path;
pub fn arg_matches() -> ArgMatches<'static> {
App::new("Query light curves and extrac features")
.arg(
Arg::with_name("database")
.required(true)
.possible_values(&["... |
/*
* Camunda BPM REST API
*
* OpenApi Spec for Camunda BPM REST API.
*
* The version of the OpenAPI document: 7.14.0
*
* Generated by: https://openapi-generator.tech
*/
/// ExternalTaskQueryDto : A JSON object with the following properties:
#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
pub str... |
#[macro_use]
extern crate clap;
use std::convert::TryFrom;
use std::fs;
use std::path::Path;
use std::process::exit;
use clap::{Arg, ArgGroup, ArgMatches};
use walkdir::WalkDir;
use convert_path::{self, Convention};
use convert_path::error::PathConvertError;
fn get_matches<'a>() -> ArgMatches<'a> {
app_from_cra... |
use async_trait::async_trait;
use etcd_client::Error;
use serde::{de::DeserializeOwned, Serialize};
use serde_json::{Error as SerdeError, Value};
use snafu::Snafu;
use strum_macros::Display;
use tokio::sync::mpsc::Receiver;
/// Definition of errors that can be returned from the key-value store.
#[derive(Debug, Snafu)]... |
use crate::buffer::{Buffer, BufferViewMut};
use crate::pipeline::graphics::util::BufferDescriptor;
use crate::pipeline::graphics::{TransformFeedback, TypedTransformFeedbackLayout};
use staticvec::StaticVec;
/// Encodes a description of a (set of) buffer(s) or buffer region(s) that can record the output
/// feedback fr... |
use futures_util::FutureExt;
use std::collections::HashMap;
use std::time::Duration;
use event::encoding::{EncodingConfig, StandardEncodings};
use rdkafka::ClientConfig;
use serde::{Deserialize, Serialize};
use crate::batch::{BatchConfig, NoDefaultBatchSettings};
use crate::common::kafka::{KafkaAuthConfig, KafkaCompr... |
use std::{io, net::SocketAddr, process::exit, sync::Arc, sync::atomic::{AtomicBool, Ordering}, sync::mpsc::{channel, Sender}, thread::{JoinHandle, sleep}, thread, time::Duration};
use std::fmt::{Display, Formatter};
use std::sync::atomic::Ordering::SeqCst;
use structopt::StructOpt;
use crate::{
blockchain::Blockc... |
extern crate serde;
extern crate reqwest;
extern crate uuid;
extern crate chrono;
extern crate serde_json;
pub mod command;
pub mod cache;
mod resource;
mod types;
pub use types::*;
pub use resource::*;
pub use cache::*;
use std::collections::HashMap;
use std::fmt;
use std::error::Error;
#[macro_use] extern crate... |
use std::collections::{BTreeSet, HashMap};
use std::io::{self, Read};
use once_cell::sync::OnceCell;
type UniquePatterns = [String; 10];
type OutputPatterns = [String; 4];
fn parse(puzzle_input: &str) -> Vec<(UniquePatterns, OutputPatterns)> {
puzzle_input.lines().map(|line| {
let mut pipe_iter = line.spl... |
////////////////////////////////////////////////////////////////////////////////
//
// Copyright (c) 2018, the Perspective Authors.
//
// This file is part of the Perspective library, distributed under the terms
// of the Apache License 2.0. The full license can be found in the LICENSE
// file.
// Required by yew's `... |
#![warn(clippy::all)]
//! Filesystem walk.
//!
//! - Performed in parallel using rayon
//! - Entries streamed in sorted order
//! - Custom sort/filter/skip
//!
//! # Example
//!
//! Recursively iterate over the "foo" directory sorting by name:
//!
//! ```no_run
//! # use std::io::Error;
//! use jwalk::{WalkDir};
//!
/... |
use super::util;
use super::vm;
use crate::util::{bit_at, bit_slice, imm5, offset11, offset6, offset9};
#[derive(Debug)]
pub enum Instruction {
Add(vm::dr, vm::sr, vm::sr),
AddImm(vm::dr, vm::sr, vm::imm),
And(vm::dr, vm::sr, vm::sr),
AndImm(vm::dr, vm::sr, vm::imm),
Br(vm::CondReg, vm::sr),
Jm... |
use super::{Job, PROTOCOL_VERSION};
use serde::Serialize;
use sha2::{Sha256, Digest};
/// Trait for all commands, mostly used to prevent small errors
/// from occuring when having to type the command names, and to
/// keep them all in one place.
pub(crate) trait Command {
const NAME: &'static str;
}
/// Response ... |
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::mem;
use rabble::{Pid, Envelope, CorrelationId};
use msg::Msg;
use time::SteadyTime;
use namespace_msg::{NamespaceMsg, NamespaceId};
use vr::replica::VersionedReplicas;
use vr::vr_fsm::{State, VrState};
use vr::v... |
use amethyst::prelude::*;
use amethyst::{
core::*,
core::{
math::{Point3, Vector2, Vector3},
Named, Parent, Transform,
},
ecs::{Entity, Join},
input::{is_close_requested, is_key_down, InputHandler, StringBindings},
input::{InputEvent, VirtualKeyCode},
renderer::camera::Camera... |
use std::env;
use std::str::FromStr;
// Basically stolen from the rust book and sample CLI repo, see here: https://github.com/rust-cli/cli-template/
// Ideally, we would use this struct to hold all arguments passed from the user,
// The crate StructOpt will handle creating the struct from the cmd line args, handles er... |
use std::collections::HashMap;
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::net::Ipv4Addr;
use std::sync::Arc;
use std::sync::RwLock;
use hyper::header::{*};
use nickel::{*, HttpRouter, Middleware, MiddlewareResult, Nickel, Options, Request, Response, StaticFilesHandler};
use nickel::hy... |
use std::{
cmp::Ordering,
collections::{hash_map::DefaultHasher, HashMap, HashSet},
hash::{Hash, Hasher},
path::PathBuf,
};
use async_graphql::{Enum, SimpleObject};
use serde::{Deserialize, Serialize};
use super::sorted_map::SortedMap;
#[derive(Serialize, Deserialize)]
pub struct Index {
pub from... |
use super::SelectionState;
use crate::{geometry::offset_transform, ImmediateModeTag, VoxelCursorRayImpact};
use crate::edit_tools::VOXEL_WIDTH;
use crate::edit_tools::CurrentTool;
use bevy::{
asset::prelude::*,
ecs::prelude::*,
pbr::prelude::*,
render::{
mesh,
mesh::{VertexAttributeVal... |
use std::fmt;
use std::path::{PathBuf};
use colored::*;
use serde::{Serialize,Deserialize};
use super::scan::change::{Change,same};
use super::scan::{DirEntryWithMeta as Entry};
#[derive(Debug, Clone, Serialize, Deserialize)]
pub enum Action {
Local(Change),
Remote(Change),
Conflict(Change,Change),
Res... |
use rayon::{ThreadPool, ThreadPoolBuilder};
use std::sync::mpsc::channel;
use super::super::algo::k_way_merge::k_way_merge;
use super::super::algo::regions_graph::{swap_countries, RegionsGraph};
use super::super::algo::verge_sort_heuristic::verge_sort_preprocessing;
use super::super::{RadixKey, RadixSort, Radixable};... |
use std::vec::Vec;
use rand::*;
use rustc_serialize::{Encodable, Decodable, Encoder, Decoder};
use evolution::*;
pub mod cpu;
struct RngWrapper(OsRng);
impl Encodable for RngWrapper {
fn encode<S: Encoder>(&self, _: &mut S) -> Result<(), S::Error> {
Ok(())
}
}
impl Decodable for RngWrapper {
fn... |
//! This module contains definitions for the extension and related types.
//! Extensions are optional data frames sitting before the voxel data.
//! When present, an extender frame of 4 bytes is also present at the
//! end of the NIFTI-1 header, with the first byte set to something
//! other than 0.
use crate::error::... |
// MakAir
//
// Copyright: 2020, <NAME>
// License: Public Domain License
use super::fonts::Fonts;
use conrod_core::widget::Id as WidgetId;
use conrod_core::{
color::{self, Color},
widget, Colorable, Positionable, Sizeable, Widget,
};
use telemetry::structures::MachineStateSnapshot;
pub type WidgetIds = (Widg... |
//! Command line modules: has one function which takes input parameters from commandline
//! and parses them.
use adbfbinlib::common::config;
static APP_TITLE: &str = concat!("The audiobook finder (", env!("CARGO_PKG_NAME"), ")");
static ARG_NET: &str = "net";
static ARG_TUI: &str = "tui";
static ARG_WEBUI: &str = "w... |
use std::fs;
use std::path::Path;
use tantivy::collector::TopDocs;
use tantivy::query::QueryParser;
use tantivy::schema::*;
use tantivy::Index;
use tantivy::ReloadPolicy;
use git_collector::{GitCollector};
use trello_collector::{TrelloCollector};
use serde::Serialize;
use crate::config::Config;
use collector;
use colle... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.