text stringlengths 3.09k 13.9k |
|---|
use std::cmp::Reverse;
use std::collections::HashMap;
use std::hash::Hash;
use std::io;
use std::io::BufRead;
use std::ops::Mul;
use nom;
mod errors;
mod parse;
const ORE: &'static str = "ORE";
const FUEL: &'static str = "FUEL";
const ORE_AMOUNT: usize = 1_000_000_000_000;
type Magnitude = usize;
type Chemical =... |
use crate::{
requests::*,
runtime_router::{LAMBDA_RUNTIME_AWS_REQUEST_ID, LAMBDA_RUNTIME_XRAY_TRACE_HEADER},
};
use aws_lambda_events::{
apigw::{
ApiGatewayV2httpRequest, ApiGatewayV2httpRequestContext,
ApiGatewayV2httpRequestContextHttpDescription, ApiGatewayV2httpResponse,
},
encod... |
use crate::errors::{self, DecodeError};
use snafu::ensure;
use self::inner::DecodeCompositeInner;
pub struct DecodeTupleLike<'t> {
inner:DecodeCompositeInner<'t>
}
impl<'t> DecodeTupleLike<'t> {
fn new(buf:&'t [u8]) -> Result<Self, DecodeError> {
let inner = DecodeCompositeInner::read_tuple_like_head... |
//! ArtPacker creates packets to send DMX over Art-Net.
//!
//! It complies with the [Art-Net v4 specification](https://art-net.org.uk/resources/art-net-specification/), Revision 1.4dd 22/1/2017.
//! However, only the ArtDmx packet from page 45 is implemented.
//!
//! ArtPacker packs unchanged data only every 800 ms. A... |
use byteorder::{LittleEndian, ReadBytesExt};
use std::fs::File;
use std::io::{Read, Result, Seek, SeekFrom};
use std::path::Path;
use std::str::from_utf8;
pub enum Flags {
BackgroundFlag = 0x00000001,
WeaponFlag = 0x00000002,
TransparentFlag = 0x00000004,
TranslucentFlag = 0x00000008,
WallFlag = 0x... |
use super::{stream::Stream, CUresult, GlobalState, HasLivenessCookie, LiveCheck};
use crate::cuda::CUfunction_attribute;
use ::std::os::raw::{c_uint, c_void};
use std::{hint, ptr};
const CU_LAUNCH_PARAM_END: *mut c_void = 0 as *mut _;
const CU_LAUNCH_PARAM_BUFFER_POINTER: *mut c_void = 1 as *mut _;
const CU_LAUNCH_PAR... |
use std::{
path::Path,
sync::{Arc, RwLock},
};
use formatter::{DisplayStyle, FormatSession};
use grep::{
matcher::{Captures, Matcher},
regex::RegexMatcher,
searcher::{Searcher, Sink, SinkFinish, SinkMatch},
};
use ignore::{WalkBuilder, WalkState};
use structopt::StructOpt;
// SessionData holds te... |
// Copyright 2018 <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 ... |
//! Cancel an existing order and remove it from the orderbook.
use std::rc::Rc;
use crate::{
error::DexError,
state::{DexState, UserAccount},
utils::{check_account_key, check_account_owner, check_signer},
};
use solindex_orderbook::{
error::AoError,
state::{get_side_from_order_id, EventQueue, Event... |
// Copyright 2018 The Exonum Team
//
// 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 i... |
use markdown::{generate_markdown, tokenize, Block, ListItem, Span};
#[derive(Debug)]
pub(crate) struct Changelog {
header: Vec<Block>,
rest: Vec<Block>,
}
impl Changelog {
pub(crate) fn into_markdown(self) -> String {
let Self { header, rest } = self;
let blocks = header.into_iter().chain(... |
// General
pub mod bucket;
pub mod carbon;
pub mod config;
pub mod errors;
pub mod funcs;
pub mod util;
pub mod worker;
use std::collections::HashMap;
use std::fs::File;
use std::io::Read;
use std::net::SocketAddr;
use std::str::FromStr;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::{Arc, ... |
// Copyright 2018 The Exonum Team
//
// 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 i... |
///! Comments API.
///! All comments of an article are stored in `comments.json`.
use std::collections::BTreeMap;
use std::sync::Arc;
use writium::prelude::*;
use writium_auth::{Authority, DumbAuthority};
use writium_cache::{Cache, DumbCacheSource};
use model::comment::{Comment, Comments};
#[cfg(test)]
mod tests;
con... |
#[cfg(test)]
#[macro_use]
extern crate quickcheck_macros;
use num::integer::binomial;
use num::{Float, FromPrimitive};
/// Estimates the first $k$ moments of a distribution in an online fashion (either each datum being
/// incrementally added, or sets of data being added in batches). There is no need to use this
/// m... |
use crate::parser::ast::{Expr, Ident, Stmt};
use anyhow::Result;
use itertools::interleave;
use rand::distributions::Alphanumeric;
use rand::Rng;
use regex::Regex;
use specifications::{
common::{CallPattern, Function, Parameter},
package::{PackageIndex, PackageInfo},
};
use std::iter;
type Map<T> = std::collec... |
//! # Rust Tuyapi
//! This library can be used to interact with Tuya/Smart Home devices. It utilizes the Tuya
//! protocol version 3.1 and 3.3 to send and receive messages from the devices.
//!
//! ## Example
//! This shows how to turn on a wall socket.
//! ```no_run
//! # extern crate rust_async_tuyapi;
//! # use rust... |
use crossbeam::{atomic::AtomicCell, channel::Sender};
#[allow(unused_imports)]
use handlegraph::{
handle::{Direction, Handle, NodeId},
handlegraph::*,
mutablehandlegraph::*,
packed::*,
pathhandlegraph::*,
};
use rustc_hash::FxHashMap;
use crate::{app::AppMsg, overlays::OverlayKind};
use crate::{app... |
use wasm_bindgen::prelude::*;
use wee_alloc::WeeAlloc;
use js_sys::Uint32Array;
// Use `wee_alloc` as the global allocator.
#[global_allocator]
static ALLOC: WeeAlloc = WeeAlloc::INIT;
#[wasm_bindgen(module = "/www/utils/rnd.js")]
extern {
fn rnd(max: usize) -> usize;
}
#[wasm_bindgen]
#[derive(PartialEq)]
pub e... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Comparator Control Register 0"]
pub cectl0: CECTL0,
#[doc = "0x02 - Comparator Control Register 1"]
pub cectl1: CECTL1,
#[doc = "0x04 - Comparator Control Register 2"]
pub cectl2: CECTL2,
#[doc = "0x06 ... |
// Copyright 2020 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 in writ... |
use crate::paging::{as_phys_addr, as_virt_addr};
use crate::phys_memory::{frame_manager, Frame};
use crate::sync::mutex::Mutex;
use crate::x64;
use alloc::alloc::{GlobalAlloc, Layout};
use core::ptr;
use log::trace;
#[derive(Debug)]
enum AllocationMode {
Block(usize),
Frame(usize),
}
impl From<Layout> for All... |
use super::message::Message;
use super::peer;
use crate::network::server::Handle as ServerHandle;
use crate::blockchain::Blockchain;
use crate::block::*;
use crate::transaction::SignTransaction;
use crate::txs_check;
use crate::memory_pool::TransactionMempool;
use crate::crypto::hash::{H256, Hashable};
use crossbeam::... |
//! A tool to be ran in a drone CI system to create a release in gitea and upload assets to it.
//!
//! Error handling is mostly done via calls to panic!, as this is such a small purpose built tool
//! Contributions are welcome though, as long as they aren't removing the core functionality this tool was built for
#![d... |
use std::borrow::Cow;
use std::sync::Arc;
use wgpu::util::DeviceExt;
use crate::ScreenTargets;
#[repr(C)]
#[derive(Copy, Clone, Debug, bytemuck::Pod, bytemuck::Zeroable)]
pub struct Vertex {
position: [f32; 3],
tex_coords: [f32; 2],
}
impl Vertex {
pub fn desc<'a>() -> wgpu::VertexBufferLayout<'a> {
... |
/*! Compression operation, using gzip in default implementatino !*/
use std::{
fs::File,
io::{BufRead, BufReader, Read, Write},
path::{Path, PathBuf},
};
use flate2::{write::GzEncoder, Compression};
use rayon::iter::{IntoParallelIterator, ParallelIterator};
use crate::error::Error;
pub trait Compress {
... |
use crate::{
cfg::Config,
db::{self, RootData},
monitor::Monitor,
rpc,
scan::ImageScanner,
util::Preempter,
watch_file::FileWatcher,
};
use futures_util::stream::{self, Stream, StreamExt};
use snafu::ResultExt;
use std::{collections::BTreeMap, sync::Arc};
use tokio::{
signal::unix::{sign... |
use std::str;
use petgraph::graph::{UnGraph,NodeIndex};
use petgraph::visit::EdgeRef;
use std::ops::Add;
#[derive(Copy, Clone)]
struct Node<'a>{
is_big: bool
,is_start: bool
,is_end: bool
,name: &'a str
,visit_max: Option<i64>
,visits: i64
}
impl<'a> Node<'a>{
fn from_name(n:&'a str) -> No... |
///Decompose a signal into a combination of dictionary supports that maybe not be orthogonal.
///This uses greedy approach using dot product metric that tries to reduce error vector per iteration
extern crate ndarray;
use std::vec::Vec;
use self::ndarray::prelude::*;
///stopping criteria
pub struct Criteria {
pu... |
#![allow(dead_code)]
//! An implementation of Ricci calculus use for
//! tensor manipulations and computing derivatives
//!
//! use uppercase for tensor entity
//! use lowercase for indices in superscript/subscript
//! no indices indicates a scalar
//! contraction happens for a matching superscript-subscript index
//!
... |
use bzip2::read::BzDecoder;
use regex::Regex;
use seahash::SeaHasher;
use std::fs::File;
use std::hash::Hasher;
use std::io::BufRead;
use std::io::BufReader;
use std::path::Path;
use super::extractor::Extractor;
use super::Pgn;
#[derive(PartialEq, Debug)]
enum ReaderState {
Start,
Tags,
Moves,
Ended,
... |
use std::error::Error;
use systems::shared::to_bool;
use systems_wasm::aspects::{
EventToVariableMapping, ExecuteOn, MsfsAspectBuilder, VariableToEventMapping,
VariableToEventWriteOn,
};
use systems_wasm::Variable;
pub(super) fn nose_wheel_steering(builder: &mut MsfsAspectBuilder) -> Result<(), Box<dyn Error>>... |
//! The module for the hashed permutation implementation and the struct that stores its state.
//!
//! This method was first conceived by <NAME> of Pixar Research, and discussed in his 2013
//! [paper](https://graphics.pixar.com/library/MultiJitteredSampling/paper.pdf)
//! on correlated multi-jittered sampling.
use cr... |
//! A ST7789 interface, designed for Pimoroni's Pico display.
use crate::rp2040::gpio::{gpio_set_function, GPIOFunc};
use crate::rp2040::pac;
use crate::rp2040::pac::SIO;
use crate::rp2040::spi::{SPIInstance, SPI};
use cortex_m::delay::Delay;
use cortex_m::prelude::*;
pub struct ST7789<T: SPIInstance> {
spi: SPI... |
use libvmm::msr::Msr;
use x86::{segmentation, task};
use x86_64::registers::control::{Cr0, Cr0Flags, Cr3, Cr3Flags, Cr4, Cr4Flags};
use x86_64::{addr::PhysAddr, structures::paging::PhysFrame, structures::DescriptorTablePointer};
use super::segmentation::Segment;
use super::tables::{GdtStruct, IdtStruct};
const SAVED_... |
///
/// Blitz Money
///
/// Backend of module for manange contacts
///
/// Copyright 2018 <NAME> <<EMAIL>>
///
use backend::storage::*;
use json::JsonValue;
#[derive(Default, Clone, Debug)]
pub struct Contact {
pub uuid: String,
pub name: String,
pub city_location: String,
}
impl Model for Contact {
fn... |
use std::any::Any;
use std::cell::RefCell;
use std::ops::{Deref, DerefMut};
use super::MethodName;
pub mod result;
pub use super::constraint::Constraint;
pub use self::result::{ExpectationError, ExpectationResult};
/// An expectation that a method must be called. Also includes an optional
/// closure to produce ret... |
//! I2C oled display example
#![no_main]
#![no_std]
#![feature(panic_info_message)]
use core::panic::PanicInfo;
use embedded_graphics::{
fonts::{Font12x16, Font6x12, Font6x8, Font8x16},
image::Image1BPP,
prelude::*,
Drawing,
};
use embedded_hal::{
blocking::delay::DelayMs,
digital::v2::{Outpu... |
use std::collections::BTreeMap;
use std::fmt::Display;
use std::hash::Hasher;
use colored::Colorize;
use rayon::prelude::*;
use rustc_hash::FxHasher;
use crate::gadget;
// Public Types and Traits ---------------------------------------------------------------------------------------------
/// Implementors track cou... |
extern crate bit_vec;
use bit_vec::BitVec;
use super::gamma;
use super::fble;
use super::run_length;
pub fn encode(v: &Vec<u32>, blocksize: u32, bv: &mut BitVec) -> () {
let mut bbs: Vec<u32> = Vec::new();
let mut delta: Vec<u32> = Vec::new();
let mut pms: BitVec = BitVec::new();
for i in 0..v.len()... |
//! This example showcases how to use nrf-softdevice inside RTIC.
//!
//! It mixes RTIC's real-time interrupt-based multitasking with
//! static-executor's cooperative async/await multitasking.
//!
//! static-executor is run in RTIC's idle task, at lowest priority, so all RTIC
//! tasks will preempt async tasks if need... |
use std::sync::Arc;
use arrow2::types::months_days_ns;
use avro_rs::types::{Record, Value};
use avro_rs::Writer;
use avro_rs::{Days, Duration, Millis, Months, Schema as AvroSchema};
use arrow2::array::*;
use arrow2::datatypes::*;
use arrow2::error::Result;
use arrow2::io::avro::read;
use arrow2::record_batch::RecordB... |
//! This module handles the relationships between "free regions", i.e., lifetime parameters.
//! Ordinarily, free regions are unrelated to one another, but they can be related via implied
//! or explicit bounds. In that case, we track the bounds using the `TransitiveRelation` type,
//! and use that to decide when one f... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use aws_config::meta::region::RegionProviderChain;
use aws_sdk_config::model::{
ConfigSnapshotDeliveryProperties, ConfigurationRecorder, DeliveryChannel,
MaximumExecutionFrequency, RecordingGrou... |
use crate::region::Region;
use inari::{interval, Interval};
/// A one-dimensional geometric region that represents a line segment.
///
/// Conceptually, it is a pair of two [`Interval`]s `inner` and `outer`
/// that satisfy `inner ⊆ outer`. `inner` can be empty, while `outer` cannot.
#[derive(Clone, Debug)]
pub struct... |
use crate::{
types::Address,
utils::{secret_key_to_address, unused_port},
};
use k256::{ecdsa::SigningKey, SecretKey as K256SecretKey};
use std::{
io::{BufRead, BufReader},
process::{Child, Command},
time::{Duration, Instant},
};
/// How long we will wait for ganache to indicate that it is ready.
c... |
use super::{FindMatches, Regex};
use std::str::pattern::{Pattern, SearchStep, Searcher};
/// Regex Searcher Type
///
/// Represents the state of an ongoing search over a given string
/// slice.
pub struct RegexSearcher<'r, 'a> {
iter: FindMatches<'r, 'a>,
pos: usize,
hay: &'a str,
cached_match: Option<... |
// Copyright (c) Facebook, Inc. and its affiliates.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the "hack" directory of this source tree.
//
// @generated SignedSource<<0595d68bfa1ca6de81810972484b9dd8>>
//
// To regenerate this file, run:
// hphp/hack/src/oxidized_by_ref/... |
use alloc::vec;
use digest::DynDigest;
use num_bigint::traits::ModInverse;
use num_bigint::{BigUint, RandPrime};
#[allow(unused_imports)]
use num_traits::Float;
use num_traits::{FromPrimitive, One, Zero};
use rand_core::{CryptoRng, RngCore};
use crate::errors::{Error, Result};
use crate::key::RsaPrivateKey;
/// Defau... |
use luminance::{Semantics, Vertex};
use luminance_front::{
context::GraphicsContext,
pixel::NormRGB8UI,
texture::{Dim2, GenMipmaps, Sampler, Texture},
Backend,
};
use crate::PlatformServices;
#[derive(Clone, Copy, Debug, Eq, PartialEq, Semantics)]
pub enum Semantics {
// reference vertex positions with the ... |
#![cfg(feature = "diesel")]
#[macro_use]
extern crate diesel;
extern crate semver;
use diesel::connection::SimpleConnection;
use diesel::sql_types::Text;
use diesel::*;
use semver::{Version, VersionReq};
table! {
versions (name) {
name -> Text,
vers -> Text,
}
}
table! {
... |
// Copyright 2018-2021 Cargill Incorporated
//
// 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... |
//! Provides the trainers for the Layers.
//!
//! The optimal state of a neural network would be the one where
//! for any given input to the network, it would produce an output perfectly
//! matching the target function. In that state the loss function would have its
//! [global minimum][minimum].
//! This statement c... |
extern crate rocksdb;
extern crate serde;
extern crate serde_json;
extern crate structopt;
extern crate hjq;
use std::fs::File;
use std::io::{BufReader, Write};
use std::path::PathBuf;
use structopt::StructOpt;
fn main() {
let opts = Options::from_args();
match opts.cmd {
Command::Trace { input, sile... |
use crate::account::Account;
use crate::acme_proto::request_certificate;
use crate::certificate::Certificate;
use crate::config;
use crate::endpoint::Endpoint;
use crate::hooks::HookType;
use crate::logs::HasLogger;
use crate::storage::FileManager;
use acme_common::error::Error;
use std::collections::HashMap;
use std::... |
use proc_macro2::{Group, Ident, Span, TokenStream, TokenTree};
use syn::parse::{Parse, ParseStream};
use syn::punctuated::Punctuated;
use syn::{Attribute, Error, ExprPath, LitBool, LitStr, Result, Token};
pub enum EntityAttr {
Table(String),
Id(Ident),
Insertable(Option<Ident>),
Patchable(Option<Ident>... |
//! Generates an image (currently a diagonal reddish stripe) then runs it
//! through the kernel, increasing the blue channel for the entire image.
//!
//! Enable saving to disk by setting `SAVE_IMAGES_TO_DISK` to `true` and
//! change the file paths/names if desired.
//!
extern crate image;
extern crate fil_ocl as oc... |
//! A little tool to generate the README.md from the docs/.
use std::borrow::Borrow;
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use anyhow::{bail, Context, Result};
use maplit::hashmap;
use pulldown_cmark::{CowStr, Event, LinkType, Options, Parser, Tag};
use pulldown_cmark_to_cmark::cmark_with_options... |
extern crate proc_macro;
use proc_macro::TokenStream;
use proc_macro2::{Ident, Span};
use quote::quote;
use syn::{Item as SynItem, ItemFn};
#[proc_macro_attribute]
pub fn plugin_module(
_args: proc_macro::TokenStream,
input: proc_macro::TokenStream,
) -> proc_macro::TokenStream {
let token = proc_macro2::... |
// TODO: Current brute-force method is very slow (2.7s in release).
// Rewrite, use signature to speedup finding the origin points pair
// and correct rotation.
fn parse_input(input: &str) -> Vec<Vec<(i32, i32, i32)>> {
let mut scanners = Vec::with_capacity(1 << 6);
let input_sections = input.split("\n\n")... |
use crate::component::entry::TxEntry;
use ckb_types::{
core::{
cell::{CellChecker, CellMetaBuilder, CellProvider, CellStatus},
error::OutPointError,
tx_pool::Reject,
TransactionView,
},
packed::{OutPoint, ProposalShortId},
prelude::*,
};
use ckb_util::{LinkedHashMap, Link... |
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>,... |
//src/web/multipart.rs: Wrapper around the `multipart` crate to make it easier to use.
//Author: <NAME>
//Copyright (c) 2020 LAPS Group
//Distributed under the zlib licence, see LICENCE.
use crate::types::{BackendError, UserError};
use mime::Mime;
use multipart::server::Multipart;
use rocket::{
data::{Data, FromDa... |
use crate::shared::VSOCK_HOST_CID;
use anomaly::{fail, format_err};
use std::os::unix::io::AsRawFd;
use std::sync::mpsc::{Receiver, TryRecvError};
use std::thread;
use std::{
fs,
io::{self, prelude::*},
path::{Path, PathBuf},
};
use tempfile::NamedTempFile;
use tmkms_light::chain::state::{consensus, StateEr... |
#![cfg(test)]
use crate::behaviour::{Behaviour, BehaviourEvent};
use crate::multiaddr::Protocol;
use eth2_libp2p::*;
use futures::prelude::*;
use libp2p::core::identity::Keypair;
use libp2p::{
core,
core::{muxing::StreamMuxerBox, nodes::Substream, transport::boxed::Boxed},
secio, PeerId, Swarm, Transport,
}... |
//https://github.com/lovesh/bulletproofs-r1cs-gadgets/blob/master/src/gadget_mimc.rs
extern crate rand;
//extern crate rand_chacha;
extern crate curve25519_dalek;
extern crate merlin;
extern crate bulletproofs;
//extern crate r1cs_utils;
use curve25519_dalek::scalar::Scalar;
use bulletproofs::r1cs::{ConstraintSystem, ... |
//! Constant datatype IRIs and base URIs used literally during translation.
// --- Macros to allow const concatenation in submodules ---------------------
macro_rules! uris {
($($name:ident => $uri:literal,)*) => (
$(macro_rules! $name {() => ($uri)})*
);
}
uris! {
dc => "http://purl.org/dc/eleme... |
//! A library to translate the ThinEdgeJson into C8yJson
//! Takes thin_edge_json bytes and returns c8y json bytes
//!
//! # Examples
//!
//! ```
//! use c8y_translator_lib::json::from_thin_edge_json;
//! let single_value_thin_edge_json = r#"{
//! "time": "2020-06-22T17:03:14.000+02:00",
//! "temperature"... |
// Copyright Rivtower Technologies 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed ... |
// Generated by gir (https://github.com/gtk-rs/gir @ 5bbf6cb)
// from ../../gir-files (@ 8e47c67)
// DO NOT EDIT
use std::{ffi::CStr, net::SocketAddr};
use glib::translate::*;
use libc::c_char;
use nice_sys as ffi;
use nix::sys::socket::{AddressFamily, InetAddr};
#[cfg(any(feature = "v0_1_18", feature = "dox"))]
#[c... |
// Copyright 2018 The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclaim... |
// 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.
#![allow(improper_ctypes)]
#![allow(unused)]
#![allow(non_snake_case)]
#![allow(non_camel_case_types)]
#![allow(non_upper_case_globals)]
use libc::{self, ... |
// Copyright 2022 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.
#![cfg(test)]
use fidl_fuchsia_net as fnet;
use fidl_fuchsia_netemul_network as fnetemul_network;
use fuchsia_async as fasync;
use futures_util::{AsyncRea... |
use std::collections::HashSet;
use std::sync::Arc;
use dashmap::mapref::one::Ref;
use hmac::digest::KeyInit;
use hmac::Hmac;
use jwt::{AlgorithmType, Claims, Header, PKeyWithDigest, Token, VerifyingAlgorithm};
use openssl::hash::MessageDigest;
use openssl::pkey::PKey;
use sha2::{Sha256, Sha384, Sha512};
use sled::Db;
... |
use std::marker::PhantomData;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::Arc;
use chess::{Board, Color, MoveGen};
use super::eval::Eval;
use super::evaluate::Evaluate;
use super::pv::Pv;
use super::search_window::{AlphaBetaSearchParams, SearchParams};
//use super::tt_entry::TtEntry;
pub trait Sea... |
use config::{Config, ConfigError, Environment, File};
use serde::Deserialize;
use std::env;
use std::path::PathBuf;
#[derive(Debug, Deserialize)]
struct RedisConfig {
server_url: String,
script: PathBuf,
}
#[derive(Debug, Deserialize)]
struct Settings {
debug: bool,
redis: RedisConfig,
}
impl Settings... |
use std::fs::{self, File};
use std::io::prelude::*;
use std::iter;
use std::path::Path;
use nix::sched::{unshare, CloneFlags};
use nix::sys::wait::{waitpid, WaitStatus};
use nix::unistd::{chdir, chroot, daemon, fork, getpid, ForkResult, Gid, Uid};
use nix::unistd::{execve, sethostname};
use dirs::home_dir;
// for ge... |
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or ... |
// Copyright lowRISC contributors.
// Licensed under the Apache License, Version 2.0, see LICENSE for details.
// SPDX-License-Identifier: Apache-2.0
//! Implementations of [`crypto::sha256`] based on `ring`.
//!
//! Requires the `std` feature flag to be enabled,
//!
//! [`crypto::sha256`]: ../../sha256/index.html
us... |
use glsl_to_spirv::ShaderType;
use legion::prelude::*;
use crate::components::default::{Color, ID};
use crate::graphics::buffer;
use crate::graphics::resources::RenderResources;
use crate::tools::uniforms::Uniforms;
use crate::{
components::{default::Transform, geometry::Mesh},
graphics::{
pipeline, sh... |
// Copyright 2020 - 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 i... |
use std::fs::{self, File};
use std::io::{Lines, BufReader};
use std::path::{Path, PathBuf};
use crate::{util_os, util_io, util_msg, new_box_ioerror, XResult};
pub struct JoinFilesReader {
files: Vec<String>,
file_ptr: usize,
file_lines: Option<Box<Lines<BufReader<File>>>>,
}
fn open_file_as_lines(f: &str)... |
use crate::exceptions::{IOError, RunnerError};
use chrono::prelude::*;
use serde::{Deserialize, Serialize};
use serde_with::{DeserializeFromStr, SerializeDisplay};
use std::fmt::Display;
use std::path::PathBuf;
use std::str::FromStr;
use std::{cmp, fmt};
// `HyperfineCmd` defines a command that we want to measure with... |
use std::collections::{HashMap, HashSet};
use geo_types::Point;
use geojson::GeoJson;
use rand::rngs::StdRng;
use rand::SeedableRng;
use serde_json::{Map, Value};
use crate::{disaggregate, jitter, load_zones, scrape_points, Options, Subsample};
#[test]
fn test_sums_match() {
let zones = load_zones("data/zones.ge... |
use std::convert::TryInto;
use homotopy_common::{
graph::{Graph, Node},
idx::IdxVec,
};
use crate::{
common::{Boundary, DimensionError, Height, SliceIndex},
diagram::{Diagram, DiagramN},
rewrite::{Rewrite, RewriteN},
};
pub type Coord = Vec<SliceIndex>;
pub fn mk_coord<I>(coord: &[SliceIndex], i... |
//! Transaction store
//! This is now by experiment split in two files
//! to see if this improves output-reading performance
//!
//!
//! This is a bit messy for now as we're not using typed access to these store
//! as they are still WIP
use buffer::*;
use config;
use store::flatfileset::FlatFileSet;
use store::TxPt... |
use anyhow::Result;
use url::form_urlencoded::parse;
include!(concat!(env!("OUT_DIR"), "/constants.rs"));
pub async fn start_auth_flow() -> Result<String> {
let auth_flow = OAuthFlow::new(
OAUTH_HOST,
OAUTH_CLIENT_ID,
OAUTH_CLIENT_SECRET,
vec!["repo", "read:org", "workflow", "gist"... |
use crate::def_package;
use crate::parser::INT;
use crate::result::EvalAltResult;
use crate::token::Position;
#[cfg(not(feature = "no_float"))]
use crate::parser::FLOAT;
use crate::stdlib::{boxed::Box, format, i32, i64};
#[cfg(feature = "only_i32")]
pub const MAX_INT: INT = i32::MAX;
#[cfg(not(feature = "only_i32"))... |
use axum::body::Bytes;
use std::net::{IpAddr, SocketAddr};
use std::path::PathBuf;
use std::str::FromStr;
use std::sync::Arc;
use axum::extract::{ContentLengthLimit, Extension};
use axum::response::Json;
use axum::routing::post;
use axum::AddExtensionLayer;
use axum::Router;
use clap::{AppSettings, Parser};
use serde_... |
use std::{error, env, fs::File, io::Write, path::Path};
use std::process::Command;
use std::str;
/// Waiting on cargo fix!
// #[derive(serde::Deserialize)]
struct Config {
parameters: Parameters,
}
// #[derive(serde::Deserialize)]
struct Parameters {
filesystem_boundary: u32,
}
macro_rules! add_build_variab... |
use lsp_server::{Notification, Request, RequestId};
use lsp_types::notification::{DidOpenTextDocument, PublishDiagnostics};
use lsp_types::request::Initialize;
use lsp_types::{ClientCapabilities, Diagnostic, DidOpenTextDocumentParams, TextDocumentItem, Url};
use serde::{Deserialize, Serialize};
use std::io::{Read, Writ... |
// Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0.
use std::fs::File;
use std::io::Read;
use std::path::Path;
use kvproto::encryptionpb::{EncryptedContent, EncryptionMethod};
use super::{Backend, MemBackend};
use crate::{crypter, Error, Iv, Result};
pub struct FileBackend {
mem_backend: MemBacke... |
use futures::channel::mpsc;
use futures::stream::StreamExt;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::collections::HashSet;
use crate::actor::*;
use crate::message::*;
pub type Sender<M> = mpsc::UnboundedSender<Envelope<M>>;
pub type Receiver<M> = mpsc::UnboundedReceiver<Envelope<... |
use crate::interceptor::{PacketInterceptor, PeerInfo};
use crate::plugin_manager::{PacketsParser, Recorder, PLUGIN_MANAGER};
use slog_scope::{debug, error};
use std::net::SocketAddr;
use std::path::PathBuf;
use std::sync::{Arc, Condvar, Mutex};
use std::thread;
use std::time::Duration;
#[derive(Debug)]
enum RecordingS... |
use crate::css::cssom::{
CSSComponentValue, CSSDeclaration, CSSDeclarationListItem, CSSDisplay, CSSQualifiedRule,
CSSQualifiedRuleSelectors, CSSSelector, CSSSelectorItem, CSSSpecificity, CSSStylesheet,
CSSStylesheetItem,
};
use crate::html::dom::{ElementData, Node, NodeType};
use std::collections::HashMap;
use st... |
use crate::schema::building_owners;
use crate::schema::building_owners::dsl;
use chrono::Utc;
use chrono::naive::NaiveDateTime;
use diesel::prelude::*;
use diesel::pg::PgConnection;
use serde_derive::{Deserialize, Serialize};
pub struct NewBuildingOwner {
full_name: String,
is_manager: bool,
org_id: Opt... |
use std::error::Error as StdError;
use std::fmt;
use std::io;
use std::path::PathBuf;
#[derive(Debug, Clone, Copy)]
pub(crate) enum ErrorKind {
OpenFile,
CreateFile,
CreateDir,
SyncFile,
SetLen,
Metadata,
Clone,
SetPermissions,
Read,
Seek,
Write,
Flush,... |
use super::shape::Polygon;
use crate::shape::{Path, Shape};
use super::error::Error;
use crate::operation::{Operation};
use crate::intersection_algorithm::{Scope};
use crate::{Queue, Coordinate, Bounds};
use std::collections::btree_map::BTreeMap;
use crate::units::Float;
use crate::intersection_algorithm::position::Pos... |
//
// Copyright 2016 <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 writin... |
// Copyright 2017-2018 Maskerad Developers
//
// Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or
// http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or
// http://opensource.org/licenses/MIT>, at your option. This file may not be
// copied, modified, or distributed except accord... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.