text stringlengths 3.09k 13.9k |
|---|
// Take a look at the license at the top of the repository in the LICENSE file.
use crate::PromiseResult;
use crate::Structure;
use crate::StructureRef;
use glib::translate::*;
use std::ptr;
use std::task::{Context, Poll};
use std::{ops::Deref, pin::Pin};
glib::wrapper! {
#[derive(Debug, PartialEq, Eq, PartialOr... |
//
// 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
//
pub(crate) mo... |
use tract_hir::internal::*;
use nom::IResult;
use nom::{
branch::alt,
bytes::complete::*,
character::complete::*,
combinator::*,
number::complete::{le_i32, le_i64},
sequence::*,
};
use std::collections::HashMap;
use crate::model::{Component, KaldiProtoModel};
use tract_itertools::Itertools;
... |
use crate::internal::*;
use tract_core::ndarray::*;
use tract_core::ops::array::{Pad, PadMode};
use tract_pulse_opl::ops::{Delay, PulsePad};
submit_op_pulsifier!(Pad, pulsify);
fn pulsify(
op: &Pad,
_source: &TypedModel,
node: &TypedNode,
target: &mut PulsedModel,
mapping: &HashMap<OutletId, Outle... |
// Copyright 2018 Google LLC
//
// 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 agreed to ... |
// author: <NAME> <<EMAIL>>
#[macro_use]
extern crate vst;
extern crate time;
use vst::plugin::{Category, Info, Plugin};
use vst::buffer::AudioBuffer;
use std::mem;
use std::f64::consts::PI;
use std::collections::VecDeque;
/// Calculate the length in samples for a delay. Size ranges from 0.0 to 1.0.
fn delay(index:... |
//! Block producer
//! Block producer assemble several Godwoken components into a single executor.
//! A block producer can act without the ability of produce block.
use anyhow::{anyhow, Result};
use gw_common::{
h256_ext::H256Ext,
merkle_utils::{calculate_ckb_merkle_root, ckb_merkle_leaf_hash},
smt::Blake... |
//MIT License
//Copyright (c) 2021 Ivan (GitHub: <ivanl-exe>, E-Mail: <<EMAIL>>)
use read_input::prelude::*;
use std::{
env::args,
io::BufReader,
fs::File
};
use image::{
imageops::FilterType::Triangle,
io::Reader,
DynamicImage,
ImageFormat
};
//Bourke, P., 1997. Character representation of grey scale i... |
use std::collections::btree_map;
use std::collections::hash_set;
use std::error;
use std::ffi::{OsStr, OsString};
use std::fmt;
use std::fs;
use std::io;
use std::path::{Path, PathBuf};
use std::result;
use chrono::TimeZone;
use derive_more::{Display, From};
use rayon::iter::{FromParallelIterator, IntoParallelIterator... |
use downcast::AnySync;
use once_cell::sync::OnceCell;
use variadic_generics::va_expand;
use std::collections::HashMap;
use std::sync::Arc;
pub extern crate anyhow;
mod common;
pub use common::*;
#[cfg(feature = "async")]
pub mod r#async;
/* Current TODOs:
*
* 1. write tests
* 2. figure out which parts of the lib... |
use crate::execution::Phase;
use crate::key::*;
use crate::uref::{AccessRights, URef};
use crate::value::account::{
AccountActivity, ActionThresholds, AssociatedKeys, BlockTime, PublicKey, PurseId, Weight,
MAX_KEYS,
};
use crate::value::*;
use alloc::collections::BTreeMap;
use alloc::string::String;
use proptes... |
use std::path;
use anyhow::{anyhow, Result};
use liquid;
use super::files;
use super::slug;
use super::FrontmatterBuilder;
#[derive(Debug, Eq, PartialEq, Hash, Copy, Clone, Serialize, Deserialize)]
#[serde(deny_unknown_fields)]
pub enum SortOrder {
None,
Asc,
Desc,
}
impl Default for SortOrder {
fn ... |
#[cfg(not(feature = "sqlite"))]
extern crate dotenv;
#[cfg(not(feature = "sqlite"))]
extern crate url;
use std::fs::{self, File};
use std::io::prelude::*;
use std::path::{Path, PathBuf};
use tempdir::TempDir;
use super::command::TestCommand;
pub fn project(name: &str) -> ProjectBuilder {
ProjectBuilder::new(name... |
// TODO move unit tests to relevant files (or folders)
#![allow(unused_imports)]
#[cfg(feature = "bench")]
extern crate test;
use super::*;
use fnv::{FnvHashMap, FnvHashSet};
use indoc::indoc;
use input_options::*;
use insta::assert_snapshot;
use manifest::{BrowserSubstitution, BrowserSubstitutionMap, PackageInfo};
u... |
mod utils;
mod sliding_square;
use getrandom;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use web_sys::{console, CanvasRenderingContext2d, OffscreenCanvas, Performance};
use tetris::{Tetris, TetrisBuilder, Randomizer, MoveDirection, RotationDirection, TetrisAction};
#[cfg(feature = "wee_alloc")]
... |
use std::convert::TryFrom;
use tracing::{debug, trace};
use fluvio_socket::{AllMultiplexerSocket, SharedAllMultiplexerSocket};
#[cfg(feature = "native_tls")]
use fluvio_future::native_tls::AllDomainConnector;
#[cfg(feature = "rust_tls")]
use fluvio_future::tls::AllDomainConnector;
use crate::config::ConfigFile;
us... |
// Copyright 2017 The xi-editor 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or ag... |
#![allow(unused)]
use crate::protocols::stream::responses::StreamMessage;
use ockam_core::RouteBuilder;
use rand::{distributions::Standard, prelude::Distribution, Rng};
mod cmd;
pub use cmd::{StreamCmdParser, StreamWorkerCmd};
mod consumer;
use consumer::StreamConsumer;
mod producer;
use producer::StreamProducer;
... |
// P_2_1_2_02
//
// Generative Gestaltung – Creative Coding im Web
// ISBN: 978-3-87439-902-9, First Edition, Hermann Schmidt, Mainz, 2018
// <NAME>, <NAME>, <NAME>, <NAME>
// with contributions by <NAME> and <NAME>
// Copyright 2018
//
// http://www.generative-gestaltung.de
//
// Licensed under the Apache License, Ver... |
use gfx::{
format::{Depth, Srgba8},
Device,
};
use gfx_glyph::*;
use glutin::{
event::{ElementState, Event, KeyboardInput, MouseScrollDelta, VirtualKeyCode, WindowEvent},
event_loop::ControlFlow,
};
use old_school_gfx_glutin_ext::*;
use std::{env, error::Error};
const MAX_FONT_SIZE: f32 = 4000.0;
fn m... |
mod error;
mod file_tree;
#[cfg(test)]
mod tests;
pub use error::DockerArchiveError;
pub use file_tree::FileTree;
use flate2::read::GzDecoder;
use path_clean::clean;
use serde::{Deserialize, Serialize};
use std::cell::RefCell;
use std::collections::HashMap;
use std::fs::OpenOptions;
use std::io::{BufReader, Read};
use... |
use crate::device_info::DeviceInfo;
use ash::vk;
use crate::renderer::RenderContext;
use crossbeam::queue::SegQueue;
use dust_core::svo::alloc::{AllocError, BlockAllocation, BlockAllocator};
use std::ops::Range;
use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::Arc;
pub struct IntegratedBlockAllocator {
... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! A helper to emit code. Supports indentation and maintains source to target location information.
use std::collections::{BTreeMap, Bound};
use codespan::{ByteIndex, ColumnIndex, FileName, LineIndex};
use move_ir_types::ast::Loc;
... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
use anyhow::Result;
use humantime::parse_duration;
use serde::{Deserialize, Serialize};
use std::rc::Rc;
use std::time::Duration;
use structopt::clap::arg_enum;
use stru... |
use std::io::{BufRead, Error as IoError};
use std::str::FromStr;
use std::sync::Arc;
use failure::Fail;
use futures::{future::*, Future, Stream};
use hex::FromHex;
use parking_lot::Mutex;
use reqwest::r#async::{Chunk, Client, Response};
use url::Url;
use genesis::{NetworkId, NetworkInfo};
use keys::Signature;
use pee... |
//! Safekeeper communication endpoint to WAL proposer (compute node).
//! Gets messages from the network, passes them down to consensus module and
//! sends replies back.
use anyhow::{anyhow, bail, Result};
use bytes::BytesMut;
use tokio::sync::mpsc::UnboundedSender;
use tracing::*;
use zenith_utils::sock_split::Read... |
// Copyright 2021 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.
#![allow(dead_code)]
use crate::task::{WaitQueue, Waiter};
use crate::types::*;
use parking_lot::RwLock;
use std::collections::VecDeque;
use std::sync::Ar... |
use chrono::DateTime;
use digest::{Digest, generic_array::typenum::U32};
use std::ops::{Add, Sub, Neg};
/// How many bits are used to shift 1 to get to zero centering
const BITS_IN_ZERO: usize = 254;
/// Represents an abstract encoder used for converting types to cryptographic integers
/// Cryptographic integers are ... |
use ovl_derive::FromParsedResource;
#[derive(Debug, Clone)]
pub struct ParsedResource {
name: String,
resource_type: String,
content: Vec<(String, String)>,
}
#[derive(Debug)]
pub struct Resource {
name: String,
resource: ResourceType,
}
#[derive(Debug, Default, FromParsedResource)]
pub struct Ov... |
use super::*;
use events::{Event, EventFilter, Notifier, Observer};
use fs::channel::{Channel, Consumer, Producer};
use fs::{IoEvents, IoNotifier};
use std::any::Any;
use std::sync::{Arc, Weak};
pub type Endpoint = Arc<Inner>;
/// Constructor of two connected Endpoints
pub fn end_pair(nonblocking: bool) -> Result<(En... |
use std::{
fs,
path::{Path, PathBuf},
};
use color_eyre::eyre::{Context, Result};
use displaydoc::Display;
use git2::Repository;
use log::{debug, error, info, trace};
use rayon::{iter::Either, prelude::*};
use thiserror::Error;
use walkdir::WalkDir;
use self::GenerateGitError as E;
use super::GENERATED_PRELUD... |
use alloc::vec::Vec;
use alloc::collections::BTreeMap;
use primitive_types::{H160, H256, U256};
use super::{Basic, Backend, ApplyBackend, Apply, Log};
/// Vivinity value of a memory backend.
#[derive(Clone, Debug, Eq, PartialEq)]
#[cfg_attr(feature = "with-codec", derive(codec::Encode, codec::Decode))]
#[cfg_attr(feat... |
use parking_lot_core::{park, unpark_all, DEFAULT_PARK_TOKEN, DEFAULT_UNPARK_TOKEN, ParkResult};
use std::any::Any;
use std::panic::{catch_unwind, UnwindSafe};
use std::sync::atomic::{AtomicU8, Ordering};
use std::time::{Instant, Duration};
const DEFAULT: u8 = 0b00;
const PREPPING: u8 = 0b01;
const READY: u8 = 0b10;
/... |
use std::fmt;
use std::fs;
use criterion::{criterion_group, criterion_main, BenchmarkId, Criterion};
use relay_general::pii::{DataScrubbingConfig, PiiProcessor};
use relay_general::processor::{process_value, SelectorSpec};
use relay_general::protocol::{Event, IpAddr};
use relay_general::store::{StoreConfig, StoreProc... |
use super::Definition;
use shelves::{Ref, Shelf};
use std::collections::HashMap;
pub struct StronglyConnectedLayouts<'l, F> {
layouts: &'l Shelf<Vec<Definition<F>>>,
map: HashMap<Ref<Definition<F>>, u32>,
component_count: u32,
}
impl<'l, F> StronglyConnectedLayouts<'l, F> {
#[inline(always)]
pub fn new(layouts: ... |
extern crate chrono;
#[macro_use]
extern crate failure;
#[macro_use]
extern crate log;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate ring;
extern crate serde_json;
extern crate untrusted;
use std::str;
use chrono::prelude::*;
pub use failure::Error;
use ring::signature;
#[cfg(test)]
mod te... |
use crate::types::{Command, Emoji, EmojiRow, Quantity, ReplyMsg, Username};
use indexmap::{map::Entry as IndexMapEntry, IndexMap};
use itertools::Itertools;
use rand::rngs::StdRng;
use rand::seq::IteratorRandom;
use rand::FromEntropy;
use std::collections::hash_map::Entry as HashMapEntry;
use std::collections::HashMap;... |
//! Execution engine management code, decoding protocol messages and turning them into
//! actions on the Veracruz host provisioning state.
//!
//! ## Authors
//!
//! The Veracruz Development Team.
//!
//! ## Licensing and copyright notice
//!
//! See the `LICENSE_MIT.markdown` file in the Veracruz root directory for
/... |
use bevy::prelude::*;
use bevy_ecs_tilemap::prelude::*;
mod helpers;
struct CurrentColor(u16);
struct LastUpdate(f64);
fn startup(
mut commands: Commands,
asset_server: Res<AssetServer>,
mut materials: ResMut<Assets<ColorMaterial>>,
mut map_query: MapQuery,
) {
commands.spawn_bundle(OrthographicC... |
/*
* File: src/window_manager.rs
* Date: 06.11.2019
* Author: MarkAtk
*
* MIT License
*
* Copyright (c) 2019 MarkAtk
*
* 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 restr... |
use std::ops::Add;
use itertools::Itertools;
use num::Integer;
use petgraph::{
algo::toposort,
graph::NodeIndex,
stable_graph::StableDiGraph,
visit::{depth_first_search, Control, DfsEvent, DfsPostOrder, NodeIndexable},
EdgeDirection::Incoming,
};
#[derive(Debug)]
pub enum Element {
Number(u32)... |
use crate::data::error_info::ErrorInfo;
use crate::data::literal::ContentType;
use crate::data::primitive::{closure::capture_variables, PrimitiveArray, PrimitiveObject};
use crate::data::{
ast::*, warnings::DisplayWarnings, ArgsType, Data, Literal, MemoryType, MessageData, Position,
MSG,
};
use crate::error_for... |
//! Build library to generate a program which runs all the testsuites.
//!
//! By generating a separate `#[test]` test for each file, we allow cargo test
//! to automatically run the files in parallel.
//!
//! > This program is inspired/forked from:
//! > https://github.com/bytecodealliance/wasmtime/blob/master/build.r... |
// Copyright (c) 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except accordin... |
pub(crate) mod errors;
mod mode;
mod op;
pub(crate) mod types;
use self::errors::{Error, Result};
use self::mode::Mode;
use self::op::OpCode;
use self::types::Value;
use std::cmp::Ordering;
use std::convert::TryInto;
pub trait Memory {
fn read(&self, address: usize) -> Result<Value>;
fn write(&mut self, addr... |
use std::collections::{LinkedList, HashMap};
use std::iter::Peekable;
use std::vec::IntoIter;
use std::rc::Rc;
use tokenizer::Token;
#[derive(PartialEq, Debug, Clone)]
pub enum Node {
Str(String),
Int(i64),
Real(f64),
Symbol(String),
Bool(bool),
Nil,
List(LinkedList<Rc<Node>>),
Map(HashMap<String, Rc<Node>>),... |
//! Save and load entities from various formats with serde.
//!
//! ## `WorldSerialize` / `WorldDeserialize`
//!
//! This module provides two `SystemData` implementors:
//!
//! * `SerializeComponents` and
//! * `DeserializeComponents`
//!
//! Reading those makes it very easy to serialize or deserialize
//! components.
... |
#![no_std]
#![no_main]
extern crate alloc;
use alloc::vec::Vec;
use alloc::string::String;
extern crate nx;
use nx::svc;
use nx::result::*;
use nx::util;
use nx::diag::assert;
use nx::diag::log;
use nx::service::vi;
use nx::service::nv;
use nx::gpu;
use nx::service::hid;
use nx::input;
use core::panic;
mod ui2d;
#... |
use std::collections::HashMap;
use std::io::{BufReader, Cursor as IoCursor};
use std::ops::Range;
use syntect::highlighting::{Highlighter, Style as SyntectStyle, Theme, ThemeSet};
use syntect::parsing::{ParseState, ScopeStack, ScopedMetadata, SyntaxSet};
use xi_core_lib::selection::Selection;
use xi_rope::spans::{Span... |
use actix_codec::*;
use bytes::Buf;
use bytes::{BufMut, BytesMut};
use futures_sink::Sink;
use std::collections::VecDeque;
use std::io::{self, Write};
use std::pin::Pin;
use std::task::Poll::{Pending, Ready};
use std::task::{Context, Poll};
use tokio_test::{assert_ready, task};
macro_rules! bilateral {
($($x:expr,... |
//! # randselect
//! This crate provides a simple command line utility for randomly selecting N
//! files from a directory and copying/moving them to a target directory.
//!
//! `randselect` operates (inefficiently) by generating a random permutation of
//! the files in a given directory, then moving/copying the first ... |
use std::ops::Range;
use std::collections::HashMap;
use super::leaf::IArgLeaf;
use super::serialize::{
ISerializableArg,
SerializationInfo
};
use super::super::banana::bananaq::FuzzyQ;
use std::sync::Weak;
/// structure capable of describing any argument, composed of IArgLeafs
///
/// - mostly any custom ar... |
use matches2::option_match;
use proc_macro2::TokenStream;
use quote::quote;
use syn::parse::{Parse, ParseStream};
use syn::{Error, Result};
use crate::util::{Attr, Named};
use crate::{entity_ref, util};
pub(crate) fn imp(args: TokenStream, input: TokenStream) -> Result<TokenStream> {
let args: Attr<FnOpt> = syn::... |
use ::multiaddr::{Multiaddr, Protocol};
use chain_impl_mockchain::{
block::{Block, BlockDate},
fee::LinearFee,
header::Header,
};
use quibitous_automation::quibitous::grpc::{
client::MockClientError,
server::{
start_thread, MockBuilder, MockController, MockServerData as NodeData, ProtocolVer... |
use crate::spec::MDSMatrix;
use halo2curves::FieldExt;
use std::marker::PhantomData;
/// Grain initializes round constants and MDS matrix at given sponge parameters
pub(super) struct Grain<F: FieldExt, const T: usize, const RATE: usize> {
bit_sequence: Vec<bool>,
_field: PhantomData<F>,
}
impl<F: FieldExt, co... |
use super::spotify_api::{
endpoints::{ALL_PLAYLISTS, GET_USER, SAVED_TRACKS, SAVED_TRACKS_REMOVAL},
models::{PlaylistTrack, SavedTrack, SimplifiedPlaylist, Track, User},
};
use super::CmdHandler;
use console::style;
use dialoguer::{Confirmation, Select};
use serde_json::json;
use std::collections::HashMap;
use ... |
/*
These tests serve very little purpose for now as the atomicdouble type is a
custom atomic type and loom doesnt support it. These are here jst to test out loom's
features and maybe test some permutations using loom::thread.
Put it short -> This test is useless as of now
*/
#![cfg(loom)]
use std::ptr;
use ... |
use crate::blocks::get_address;
use crate::blocks::get_timeout;
use crate::blocks::NodeData;
use crate::blocks::NODE_TYPE;
use crate::blocks::NODE_VAR;
use chainblocks::block::Block;
use chainblocks::cblog;
use chainblocks::core::activate_blocking;
use chainblocks::core::log;
use chainblocks::core::BlockingBlock;
use c... |
use super::tree::*;
use super::super::Graph;
use super::super::dominators::Dominators;
use super::super::node_vec::NodeVec;
use std::collections::HashSet;
use std::default::Default;
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
enum NodeState {
NotYetStarted,
InProgress(Option<LoopId>),
FinishedHeadWalk,
... |
use atomic_refcell::AtomicRefCell;
use std::path;
use std::path::Component;
use std::sync::Arc;
mod trie;
use crate::http::{HttpMethod, Request, Response};
use trie::Trie;
/// Defines a type alias for the Http Handlers associated to a [``Router`].
pub type HttpHandler = Box<dyn Fn(Request) -> Response + Send + Sync>;... |
// Copyright 2015-2021 <NAME>.
//
// Permission to use, copy, modify, and/or distribute this software for any
// purpose with or without fee is hereby granted, provided that the above
// copyright notice and this permission notice appear in all copies.
//
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHORS DISCLAIM ALL... |
use std::fmt::Display;
use std::time::Instant;
use aoc_2021::get_input;
use itertools::Itertools;
fn parse_input(input: &[String]) -> (Vec<i16>, Vec<Vec<i16>>) {
let draw_numbers = input[0]
.split(',')
.map(|n| n.parse::<i16>().unwrap())
.collect();
let mut boards = Vec::new();
let... |
use crate::buffer::Buffer;
use crate::tagvalue::{DecodeError, EncodeError};
use std::convert::TryInto;
// A tag-value message can't possibly be shorter than this.
//
// 8=?|9=?|35=?|10=???|
pub const MIN_FIX_MESSAGE_LEN_IN_BYTES: usize = 20;
/// The checksum field is composed of:
/// - `10=` (3 characters)
/... |
use chrono::prelude::*;
use collecting_hashmap::CollectingHashMap;
use ordered_float::OrderedFloat;
use plotters::prelude::*;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::cmp::{max, min};
use std::collections::HashMap;
use std::convert::TryInto;
use std::env;
use std::fs::{create_dir_all, read_dir, ... |
use bytes::Bytes;
use crate::fixed_codec::{FixedCodecError, ProtocolFixedCodec};
use crate::types::epoch::{Epoch, EpochHeader, EpochId, Pill, Proof, Validator};
use crate::types::primitive::Hash;
use crate::types::Bloom;
use crate::{impl_default_fixed_codec_for, ProtocolResult};
// Impl ProtocolFixedCodec trait for t... |
use thiserror::Error;
use tonic::transport::{Channel, Server};
use tonic::{Request, Response, Status};
use trace_lib::propagate_trace;
use tracing::*;
use tracing_futures::Instrument;
mod cache;
mod invert;
mod kafka;
use cache::*;
use kafka::*;
mod geom {
tonic::include_proto!("geom");
}
mod object_state {
... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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 applic... |
// Copyright 2020 <NAME> <<EMAIL>>
// All right reserved.
//
use keyberon::action::Action;
use heapless::Vec;
use heapless::consts::U4;
use keyberon::action::Action::{NoOp, Trans};
/// # キーの形状
///
/// 下が長いEnterの呼び名が分からないので含めていない
#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub enum Shape {
Rectangle,
IsoEnter... |
//! The proofs library implements proof of different properties
//! of the plain text, given the cipher text without revealing the
//! plain text. For example proving that the value that was encrypted
//! is within a range.
use crate::{
asset_proofs::errors::{ErrorKind, Fallible},
codec_wrapper::{
Comp... |
// Copyright 2021 Vector 35 Inc.
//
// 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 w... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
use crate::remote::{Connector, Computer, Command, RemoteFileCopier, FileCopier};
use std::path::{Path, PathBuf};
use std::{io, fs};
use std::time::Duration;
use std::io::ErrorKind;
use uuid::Uuid;
use rev_lines::RevLines;
pub struct ShadowCopier<'a> {
connector_impl: &'a dyn Connector,
pub copier_impl: &'a dy... |
use std::str::FromStr;
use device_query::Keycode;
use enigo::{Enigo, Key, KeyboardControllable};
use crate::db::Recording;
pub fn play(recording: &Recording) {
let key_pressed = recording
.key_pressed
.as_ref()
.expect("No key pressed data present in the recording.");
let mut enigo =... |
use clap::{App, AppSettings, Arg};
use libc::c_long;
use nix::unistd::{self, PathconfVar};
use std::borrow::Cow;
use std::env;
use std::ffi::OsStr;
use std::io::Write;
use std::os::unix::ffi::OsStrExt;
use std::path::Path;
use super::{
BuiltinError, BuiltinSetup, Environment, ExecData, ExitCode, Result, UtilSetup... |
#![crate_name = "sort"]
#![feature(collections, core, io, path, rustc_private, unicode)]
/*
* This file is part of the uutils coreutils package.
*
* (c) <NAME> <<EMAIL>>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
#![allow(de... |
use crate::config::DisplayMode;
use crate::consts::NONE;
use crate::error::Error;
use crate::status::Status;
use crate::target_gen::Targets;
use anyhow::Result;
use log::debug;
use rayon::prelude::*;
use std::collections::BTreeMap;
use std::path::{Path, PathBuf};
use std::process::Command;
#[cfg(target_os = "windows")... |
use std::io::prelude::*;
use chrono::{DateTime, FixedOffset};
use xml::reader::{EventReader, XmlEvent};
use xml::ParserConfig;
use crate::error::{Error, Result};
use crate::service::file_entry::FileEntry;
pub fn parse_propfind_response<R: Read>(read: R) -> Result<Vec<TempFileEntry>> {
#[derive(Debug, PartialEq)]... |
//! Routerstatus-specific parts of networkstatus parsing.
//!
//! This is a private module; relevant pieces are re-exported by its
//! parent.
#[cfg(feature = "build_docs")]
pub(crate) mod build;
mod md;
#[cfg(feature = "ns_consensus")]
mod ns;
use super::{NetstatusKwd, RelayFlags, RelayWeight};
use crate::parse::par... |
#![forbid(unsafe_code)]
use super::awaitable_responses::AwaitableResponses;
use super::writer_buffered::WriterBuffered;
use super::*;
use std::fmt::Debug;
use std::io;
use std::sync::atomic::{AtomicBool, AtomicU32, Ordering};
use std::sync::Arc;
use openssh_sftp_protocol::constants::SSH2_FILEXFER_VERSION;
use tokio:... |
//! Handles interrupts on the x86_64 architecture.
mod ioapic;
pub mod lapic;
pub use self::lapic::issue_self_interrupt;
use super::sync::CLOCK;
use core::time::Duration;
use crate::memory::{Address, VirtualAddress};
use crate::multitasking::scheduler::schedule_next_thread;
use crate::sync::Mutex;
use x86_64::instruc... |
// Ziggurat algorithms for exponential distribution
use crate::gen::RandomStream;
use crate::gen::Rejectable;
use crate::gen::Dimensionless;
// adapted from Marsaglia & Tsang The Ziggurat Method for Generating Random Variables https://core.ac.uk/download/pdf/6287927.pdf
const NSTRIPS: usize = 256;
// Marsaglia's Zi... |
use crate::common::*;
#[derive(StructOpt)]
pub(crate) enum Subcommand {
#[structopt(about("Update all generated docs"))]
All {
#[structopt(
long = "no-git",
help = "Skip generated outputs that require a Git repository. Currently this only includes \
the changelog."
)]
no_git: ... |
use crate::{
client::Client,
error::Error as HttpError,
request::{self, AuditLogReason, Request, TryIntoRequest},
response::ResponseFuture,
routing::Route,
};
use serde::Serialize;
use twilight_model::{
channel::{thread::AutoArchiveDuration, Channel},
id::{marker::ChannelMarker, Id},
};
use ... |
use std::borrow::Borrow;
use std::borrow::BorrowMut;
use std::fmt::Display;
use std::fmt::Formatter;
use std::fmt::Result as FmtResult;
use std::fmt::Write;
use std::ops::Deref;
use std::ops::DerefMut;
use pest::iterators::Pair;
use crate::ast::*;
use crate::error::SyntaxError;
use crate::parser::FromPair;
use crate... |
use crate::prelude::*;
use datamodel::{DefaultValue, FieldArity};
use once_cell::sync::OnceCell;
use std::{
fmt::Debug,
hash::{Hash, Hasher},
sync::{Arc, Weak},
};
static ID_FIELD: &str = "id";
static EMBEDDED_ID_FIELD: &str = "_id";
static UPDATED_AT_FIELD: &str = "updatedAt";
static CREATED_AT_FIELD: &st... |
// This entire module is Python 3.8+ and !Py_LIMITED_API only.
use crate::pyport::Py_ssize_t;
#[cfg(Py_3_9)]
use libc::c_void;
use libc::{c_char, c_int, c_ulong, wchar_t};
#[repr(C)]
#[derive(Copy, Clone)]
pub enum PyStatusType {
_PyStatus_TYPE_OK = 0,
_PyStatus_TYPE_ERROR = 1,
_PyStatus_TYPE_EXIT = 2,
}
... |
//! See documentation of [`CartridgeVariant`] for more info
use super::cram::*;
use super::desc::*;
use super::mbc::*;
use super::CartridgeImpl;
use std::{fs, path::Path};
/// For maximum speed, we want to avoid dynamic dispatch for everything that is called
/// in a hot loop. Cartridge memory access is both very hot... |
// Copyright <NAME> 2018.
// Dual-licensed under either the MIT License or the Boost Software License,
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// https://www.boost.org/LICENSE_1_0.txt)
//! Vulkan implementation for adi_gpu.
// #![no_std]
extern crate asi_vulkan;
extern crate adi_gpu_base;
... |
use regex::Regex;
const REQUIRED_VARIANTS: [&str; 7] = [
"BirthYear",
"IssueYear",
"ExpiryYear",
"Height",
"HairColor",
"EyeColor",
"PassportId",
];
lazy_static::lazy_static! {
static ref HEIGHT_REGEX: Regex = Regex::new(r#"^(\d+)(cm|in)$"#).unwrap();
static ref HAIR_COLOR_REGEX: Re... |
use std::ffi::CString;
use crate::{Dict, LMStateRef};
use super::LM;
pub type KenLMWordIndex = ctclib_kenlm_sys::lm_WordIndex;
#[derive(Debug, Clone)]
pub struct KenLMState(ctclib_kenlm_sys::lm_ngram_State);
impl KenLMState {
fn new() -> Self {
Self(unsafe { std::mem::zeroed() })
}
fn with_ptr... |
use prowatch_client::apis::Error;
use serde_json::Value;
use crate::common::{
clear_card_and_set_err, create_asc_record, get_badge_use_request_indv, get_str_from_value, pw_photo_to_veda, set_badge_to_indv, str_value2indv, Context,
CARD_NUMBER_FIELD_NAME,
};
use v_common::module::veda_backend::Backend;
use v_co... |
extern crate float_pretty_print;
mod assignments;
mod computation;
pub mod consts;
mod conversions;
mod enum_map;
pub mod objects;
mod variable_computations;
use crate::assignments::*;
use crate::computation::*;
use crate::consts::*;
use crate::conversions::*;
use crate::objects::*;
use std::cell::RefCell;
// These... |
use crate::enum_code::ENUM_CODE_LENGTH;
#[inline]
fn scan_block_naive(classes: &[u8], start: usize, end: usize) -> (u64, u64) {
let mut class_sum = 0;
let mut length_sum = 0;
for &class in &classes[start..end] {
class_sum += class as u64;
length_sum += ENUM_CODE_LENGTH[class as usize] as u6... |
use crate::renderer::case::Case;
use crate::renderer::template::METADATA_TEMPLATE_NAME;
use crate::renderer::{primitive, proto};
use serde::{Deserialize, Serialize};
use std::collections::HashMap;
#[derive(Serialize, Deserialize, Clone)]
pub struct RendererConfig {
/// The file extension to use for generated files... |
use sha1::Digest;
use std::convert::TryFrom;
use std::io::Read;
pub type Hash = [u8; 20];
#[derive(Debug)]
pub enum MetadataError {
IOError(std::io::Error),
BencodeError(serde_bencode::Error),
InvalidMetadata,
InvalidPieces,
InvalidTrackerUrl
}
impl From<std::io::Error> for MetadataError {
fn from(error: std::... |
// Copyright 2021 <NAME>
// Licensed under the MIT license (http://opensource.org/licenses/MIT)
// This file may not be copied, modified, or distributed
// except according to those terms.
/*!
Sequences of bio alphabet characters. Slicable, Boxable, Iterable.
!*/
pub use crate::alphabet::dna::Dna;
pub use crate::alph... |
use std::thread::sleep;
use std::time::Duration;
use http::header::{CONNECTION, CONTENT_LENGTH, LAST_MODIFIED, LOCATION};
use http::status::StatusCode;
use log::LevelFilter;
use crate::util::copy_database;
use crate::util::http::{body, date_header, header};
const FILTER: LevelFilter = LevelFilter::Warn;
#[test]
#[i... |
use std::collections::HashMap;
use lber::structure::{StructureTag, PL};
use lber::structures::{ASNTag, Boolean, OctetString, Sequence, Tag};
use lber::universal::Types;
use lazy_static::lazy_static;
/// Recognized control types.
///
/// The variants can't be exhaustively matched, since the list of
/// recognized and... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Supported Parallel Port Size Register"]
pub sspsr: crate::Reg<sspsr::SSPSR_SPEC>,
#[doc = "0x04 - Current Parallel Port Size Register"]
pub cspsr: crate::Reg<cspsr::CSPSR_SPEC>,
_reserved2: [u8; 0x08],
#[doc = "0x10... |
use anyhow::{anyhow, Result};
use petgraph::{
algo::toposort,
graph::{DiGraph, NodeIndex},
};
use std::collections::HashSet;
/// Returns all nodes at a fixed `distance` from `source` in `G`.
/// https://github.com/networkx/networkx/blob/cabf22e98d06d6c34ff88515f339b515695a7455/networkx/algorithms/traversal/br... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.