text stringlengths 3.09k 13.9k |
|---|
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Substrate.
// Substrate is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any la... |
//! Players containing information about active playing state within guilds and
//! allowing you to send events to connected nodes.
//!
//! Use the [`PlayerManager`] to retrieve existing [players] for guilds and
//! use those players to do things like [send events] or [read the position] of
//! the active audio.
//!
//... |
use anyhow::Result;
use bcs_ext::BCSCodec;
use clap::Clap;
use jsonrpc_core_client::{RpcChannel, RpcError};
use serde::{Deserialize, Serialize};
use starcoin_crypto::{HashValue, ValidCryptoMaterialStringExt};
use starcoin_rpc_api::types::{TransactionInfoView, TransactionStatusView};
use starcoin_rpc_api::{chain::ChainC... |
use crate::math::{self, Mean, Vector2D, WeightedMean};
use crate::settings::Settings;
use crate::simulation::SIZE;
use rand::Rng;
use std::iter;
use yew::{html, Html};
#[derive(Clone, Debug, PartialEq)]
pub struct Boid {
position: Vector2D,
velocity: Vector2D,
radius: f64,
hue: f64,
}
impl Boid {
... |
/*
* Copyright 2018 ProximaX Limited. All rights reserved.
* Use of this source code is governed by the Apache 2.0
* license that can be found in the LICENSE file.
*/
use {::std::fmt, failure::_core::any::Any, serde_json::Value};
use crate::{
models::{
account::{Account, Address, PublicAccount},
... |
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by ... |
use crate::{
analysis::{
dom_tree::DominatorTreeConstructor,
loops::{Loop, Loops, LoopsConstructor},
},
ir::{
basic_block::{BasicBlock, BasicBlockId},
builder::{Builder, FunctionEntity},
function::Function,
module::Module,
opcode::{Instruction, Opcode,... |
use rand::prelude::*;
use rusty_engine::prelude::*;
use SpritePreset::*; // The SpritePreset enum was imported from rusty_engine::prelude
rusty_engine::init!(GameState);
#[derive(Default)]
struct GameState {
marbles_left: Vec<String>,
cars_left: Vec<i32>,
spawn_timer: Timer,
}
fn main() {
let mut gam... |
///! (Var, Hi, Lo) triples
use std::collections::BinaryHeap;
use std::collections::HashSet;
use nid::{NID, IDX};
use vid::VID;
pub type VHLHashMap<K,V> = hashbrown::hash_map::HashMap<K,V>;
/// Simple Hi/Lo pair stored internally when representing nodes.
/// All nodes with the same branching variable go in the same ... |
use anyhow::Result;
use std::process::Command;
#[derive(Debug, PartialEq, Eq)]
struct Monitor {
width: i32,
height: i32,
name: String,
}
impl Monitor {
fn resolution(&self) -> String {
format!("{}x{}", self.width, self.height)
}
fn from_line(line: &str, next: &str) -> Option<Monitor> ... |
//! APIs for creating container images from OSTree commits
use super::ociwriter::OciWriter;
use super::*;
use crate::tar as ostree_tar;
use anyhow::Context;
use fn_error_context::context;
use gio::glib;
use ostree::gio;
use std::collections::BTreeMap;
use std::path::Path;
use tracing::{instrument, Level};
/// Configu... |
// This file is part of Substrate.
// Copyright (C) 2018-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... |
//! Error types
use {
num_derive::FromPrimitive,
solana_program::{
decode_error::DecodeError,
msg,
program_error::{PrintProgramError, ProgramError},
},
thiserror::Error,
};
/// Errors that may be returned by the Vault program.
#[derive(Clone, Debug, Eq, Error, FromPrimitive, Pa... |
use crate::data::{List, Map, Set, Struct};
/// Data.
#[derive(Debug, Clone, PartialEq)]
#[cfg_attr(feature = "serde", derive(Serialize))]
#[allow(missing_docs)]
pub enum Data {
Bool(bool),
I8(i8),
I16(i16),
I32(i32),
I64(i64),
Double(f64),
Binary(Vec<u8>),
Struct(Struct),
Map(Map),
... |
use sha2::{Digest, Sha256};
use std::{
collections::HashMap,
fmt::Display,
fs,
fs::File,
io,
path::{Path, PathBuf},
process::Command,
};
/// Runs rustfmt on the generated files - this is lifted from tonic-build
fn fmt<P>(out_dir: P)
where P: AsRef<Path> + Display {
let dir = walk_files(... |
use crate::block::{Block, Header, Content, State, INIT_COINS, AccountState};
use crate::crypto::hash::{H256, Hashable};
use crate::crypto::address::H160;
use crate::crypto::key_pair;
use ring::signature::KeyPair;
use std::collections::HashMap;
use log::info;
pub struct Blockchain {
blocks: HashMap<H256,Block>,
... |
use super::*;
#[derive(Debug, Clone)]
pub struct BroadcastMessage {
event_id: Option<usize>,
event: String,
data: String,
inner: Bytes,
}
impl BroadcastMessage {
/// `data` should not contain newline...
pub fn new(event: &str, data: String) -> Self {
//let s = format!("event: {}\ndata:... |
use std::{cell::RefCell, rc::Rc};
use derive_more::{Deref, DerefMut, From};
use crate::{
dom::{Comment, Namespace, ProcessingInstruction, Text},
tokenizer::TagName,
};
#[derive(Clone, Debug, Eq, From, PartialEq)]
pub enum ChildNode {
Element(Rc<RefCell<Element>>),
Text(Rc<RefCell<Text>>),
Process... |
//! Parse components into the VNode::Component variant
//! ==========================================
//!
//! We can be reasonably sure that whatever enters this parsing path is in the right format.
//! This feature must support
//! - [x] Namespaced components
//! - [x] Fields
//! - [x] Componentbuilder synax
//! - [x]... |
pub(crate) trait Convert<To> {
fn convert(self) -> To;
}
macro_rules! convert {
($a:ty, $b:ty) => {
impl Convert<$b> for $a {
#[inline(always)]
fn convert(self) -> $b {
unsafe {
core::mem::transmute::<$a, $b>(self)
}
... |
// Copyright 2014 <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.
use std::fmt;
use std::iter;
use std::slice;
use crate::htslib;
use crate::bam;
use crate::bam::record;
/// Iterator over alig... |
/**
Efficient Exponentiation
Problem 122
https://projecteuler.net/problem=122
The most naive way of computing n^15 requires fourteen Multiplications:
n × n × ... × n = n^15
But using a "binary" method you can compute it in six Multiplications:
n × n = n^2
n^2 × n^2 = n^4
n^4 × n^4 = n^8
n^8 × n^4 = n^12
n^12 × n^... |
use crate::model::{Config,Token,ChargerGroupsResponse, ChargerResponse};
use jarvis_lib::measurement_client::MeasurementClient;
use jarvis_lib::model::{Measurement, MetricType, Sample, SampleType};
use chrono::Utc;
use std::env;
use std::error::Error;
use uuid::Uuid;
use http_auth_basic::Credentials;
pub struct Wallb... |
//! A physical joystick device, controlling based on `InputIndex` and raw inputs.
use static_assertions::assert_not_impl_all;
use std::os::raw::c_int;
use std::ptr::NonNull;
use std::{ffi::CStr, marker::PhantomData};
use crate::bind;
use self::axis::Axis;
use self::button::Button;
use self::hat::Hat;
use self::track... |
#![cfg_attr(not(feature = "std"), no_std)]
/// Edit this file to define custom logic or remove it if it is not needed.
/// Learn more about FRAME and the core library of Substrate FRAME pallets:
/// <https://substrate.dev/docs/en/knowledgebase/runtime/frame>
use frame_support::RuntimeDebug;
use sp_std::prelude::*;
u... |
use super::{menu::dom::render_draw_menu, state::*, trace::state::*};
use crate::{
traces::{
edit::{select::trace::state::*, state::*},
svg::{
self, ShapeStyle, ShapeStyleEditMode, ShapeStyleKind, ShapeStyleMode, ShapeStyleVar,
SvgCallbacks, TransformSize,
},
},
... |
use std::{collections::HashMap, convert::TryFrom, error::Error, fmt::Debug};
use automerge_protocol as amp;
use automerge_protocol::{ActorId, ObjectId, OpId, Patch};
use crate::{
error::{InvalidInitialStateError, InvalidPatch},
mutation::{LocalChange, MutableDocument},
path::Path,
state::FrontendState... |
use anyhow::Result;
use std::process::Command;
use toml::map;
fn get_command_list(config: &map::Map<String, toml::Value>) -> Option<(String, Vec<String>)> {
let mut command_name = "".to_string();
let mut option_lst = vec![];
#[cfg(target_os = "windows")]
let os_name = "windows";
#[cfg(target_os = "macos")]
... |
// Copyright 2018 <NAME> <https://portstrom.com>
// This is free software distributed under the terms specified in
// the file LICENSE at the top-level directory of this distribution.
pub fn parse_link_end<'a>(
state: &mut ::State<'a>,
configuration: &::Configuration,
start_position: usize,
nodes: Vec<... |
use crate::db::{Database, LookForDocResult};
use fog_pack::types::{Hash, Identity};
use fog_pack::document::Document;
use fog_pack::query::NewQuery;
use fog_pack::entry::Entry;
use tokio::sync::oneshot;
use crate::NetType;
use std::sync::Arc;
use crate::error::{DbError, CursorError};
// Implement a cursor for navigati... |
use std::borrow::BorrowMut;
use std::env;
use pancurses::*;
const CHAR_WIDTH: u16 = 5;
const CHAR_HEIGHT: u16 = 7;
const CELL_WIDTH: u16 = 2;
const CELL_HEIGHT: u16 = 1;
const CELL_SELECTED_ATTR: Attribute = Attribute::Reverse;
const PIXEL_ENABLED: u8 = 0x01;
const PIXEL_DISABLED: u8 = 0x00;
const BORDER_THICKNESS... |
pub mod lexer;
pub mod world;
pub mod uberstate;
pub mod pool;
pub mod player;
pub mod inventory;
pub mod requirements;
pub mod generator;
pub mod headers;
pub mod util;
use std::collections::HashSet;
use rand::seq::IteratorRandom;
use rand::rngs::StdRng;
use world::{World, WorldGraph, Node, Anchor, Position};
use p... |
use crate::colors::ColorIndexType;
use crate::io::chunks_writer::ChunksWriter;
use crossbeam::channel::*;
use crossbeam::queue::*;
use parallel_processor::mem_tracker::tracked_box::TrackedBox;
use parking_lot::{Mutex, RwLock, RwLockWriteGuard};
use std::cell::UnsafeCell;
use std::cmp::max;
use std::mem::{swap, take};
u... |
use crate::{
backend::{self, BackendXOnly, TimeSensitive},
hash::HashInto,
marker::*,
Point, Scalar,
};
use rand_core::{CryptoRng, RngCore};
/// An `XOnly` is the compressed representation of a [`Point<EvenY,S,Z>`] which
/// only stores the x-coordinate of the point.
///
/// Using a `Point<EvenY,..>` i... |
use super::{Row, SqlError};
/// Converts from a [`tokio_postgres::Row`]. Implementations are provided for rows that contain only a single value of several types that implement [`FromSql`] (currently no check is done that the row only contained one value)
///
/// [`TryFromRow`]: ./trait.TryFromRow.html
/// [`tokio_pos... |
extern crate ptime;
extern crate time;
// year, month, day of month, weekday, day of year
static PERSIAN_GREGORIAN: [[[i32; 5]; 2]; 9] = [
[
[1383, 3, 15, 2, 107],
[2004, 6, 5, 1, 186],
],
[
[1394, 11, 9, 1, 344],
[2016, 1, 28, 0, 58],
],
[
[1394, 9, 11, 6, 2... |
use std::ops::{Deref, DerefMut};
use bytes::Bytes;
use sqlx_rt::TcpStream;
use crate::error::Error;
use crate::io::{BufStream, Encode};
use crate::mssql::protocol::col_meta_data::{ColMetaData, ColumnData};
use crate::mssql::protocol::done::{Done, Status as DoneStatus};
use crate::mssql::protocol::env_change::EnvChang... |
use std::collections::HashMap;
use std::error::Error;
use std::io::{self, Read, Write};
use std::process::exit;
use std::time::{Duration, Instant};
macro_rules! err {
($($tt:tt)*) => { Err(Box::<dyn Error>::from(format!($($tt)*))) }
}
type Result<T> = ::std::result::Result<T, Box<dyn Error>>;
type Cache = HashMa... |
use indexmap::IndexMap;
use linkerd2_app_core::{
classify,
dst::{DstAddr, Route},
metric_labels::EndpointLabels,
proxy::{http, identity, tap},
router,
transport::{connect, tls},
Addr, Conditional, NameAddr,
};
use std::fmt;
use std::net::SocketAddr;
use std::sync::Arc;
use tracing::debug;
#... |
use rusty_v8 as v8;
use std::{cell::RefCell, rc::Rc, sync::Once};
/// `JavaScriptRuntimeState` defines a state of JS runtime that will be stored per v8 isolate.
pub struct JavaScriptRuntimeState {
pub context: v8::Global<v8::Context>,
}
/// `JavaScriptRuntime` defines a JS runtime with v8.
/// It has a link to a ... |
// Copyright 2018 dgc.network
//
// 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 ... |
use crate::rest::*;
use crate::router::ResponseFuture;
use futures::future::{err, ok};
use futures::{Future, Stream};
use hyper::{Body, Request, Response, StatusCode};
use serde::{Deserialize, Serialize};
use serde_json;
use std::collections::HashMap;
use std::fmt::Debug;
use url::form_urlencoded;
/// Parse request bo... |
#![allow(warnings, unused)]
use std::collections::HashMap;
use aries_backtrack::Trail;
use aries_collections::ref_store::RefVec;
use aries_collections::*;
use aries_model::bounds::Bound;
use aries_model::lang::{IVar, IntCst, VarRef};
use aries_model::WModel;
pub mod learn;
pub mod max;
pub mod range_set;
pub mod sig... |
/*
Touch utility implementation.
Copyright 2017 <NAME>.
Released under the MIT License.
*/
extern crate clioptions;
extern crate filetime;
extern crate time;
extern crate litepattern;
use clioptions::CliOptions;
use filetime::FileTime;
use litepattern::LPattern;
use std::fs;
use std::fs::File;
use std::pa... |
//! An example demonstrating sRGB color spaces.
//!
//! sRGB is one of those things that's a bit subtle, a bit obscure,
//! and easy to get wrong, but worth knowing because it crops up
//! from time to time and makes things mysteriously "look wrong" in
//! some cases. It also is sort of overloaded to do two things at
... |
use core::convert::TryInto;
use crate::{Decodable, ErrorKind, Length, Result};
/// SIMPLE-TLV decoder.
#[derive(Debug)]
pub struct Decoder<'a> {
/// Byte slice being decoded.
///
/// In the event an error was previously encountered this will be set to
/// `None` to prevent further decoding while in a b... |
//! # Error
//!
//! Custom Error types for our crate
use std::error;
use std::fmt;
use std::result;
use bitcoin::hashes::hex::Error as HashesHexError;
use bitcoin::hashes::Error as HashesError;
use bitcoin::secp256k1::Error as Secp256k1Error;
use config_rs::ConfigError;
use mongodb::Error as MongoDbError;
use ocean::... |
use crate::changelog::component_section::package_section_filter;
use crate::changelog::entry::read_entries_sorted;
use crate::changelog::fs_utils::{entry_filter, path_to_str, read_and_filter_dir};
use crate::{ComponentSection, Config, Entry, Error, Result};
use log::debug;
use std::ffi::OsStr;
use std::path::Path;
///... |
use std::any::Any;
use std::cell::UnsafeCell;
use std::os::raw::c_void;
use std::{mem, panic, ptr};
use super::*;
extern "C" {
#[link_name = "__self"]
#[thread_local]
static mut __self: *mut ffi::thread_t;
}
pub(crate) fn thread_self() -> *mut ffi::thread_t {
unsafe { __self }
}
pub fn thread_yield(... |
use nom::branch::alt;
use nom::bytes::complete::{tag, take_until, take_while1};
use nom::character::complete::{alphanumeric1, digit1, newline, none_of};
use nom::combinator::{all_consuming, map, map_opt, opt, recognize};
use nom::error::ParseError;
use nom::multi::{fold_many_m_n, many0, many1, many_till};
use nom::sequ... |
#[cfg(feature = "alloc")]
extern crate alloc;
#[cfg(feature = "alloc")]
use alloc::vec::Vec;
#[cfg(all(not(feature = "alloc"), feature = "std"))]
use std::vec::Vec;
use core::convert::TryFrom;
use core::iter::once;
use curve25519::constants;
use curve25519::edwards::EdwardsPoint;
use curve25519::scalar::Scalar;
use c... |
//! Test setting LRU actually limits the number of things in the database;
use std::{
cell::RefCell,
sync::{
atomic::{AtomicUsize, Ordering},
Arc,
},
};
use salsa::{Database as _, Durability};
trait LruPeek {
fn log(&self, event: String);
}
#[derive(Debug, PartialEq, Eq)]
struct HotPo... |
use std::collections::BTreeMap;
use super::data::*;
use super::super::utils::{preprocess_input, ParseError, Error};
use regex::{Captures, Regex};
fn state_from_capture(capture: &Captures) -> Result<State, ParseError> {
let r0 = capture[1].parse::<i32>()?;
let r1 = capture[2].parse::<i32>()?;
let r2 = capture[3].... |
// Licensed under the Apache License, Version 2.0 (the "License"); you may
// not use this file except in compliance with the License. You may obtain
// a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed ... |
//! An [Automaat] processor to print a string output.
//!
//! Using this crate in your Automaat workflow allows you to return the string
//! provided to the processor's configuration.
//!
//! On its own, this is not very useful, but combined with an application like
//! [Automaat Server], you can allow pipelines to con... |
use std::rc::Rc;
use std::vec::Vec;
use std::f32::consts::PI;
use web_sys::*;
use web_sys::WebGl2RenderingContext as GL;
use js_sys::*;
use nalgebra::{Isometry3, Matrix4, MatrixMN, Vector3, Perspective3, Matrix3, Rotation3, Transform3, Similarity3};
use crate::render::{Render, Camera, Renderable};
use crate::shader::S... |
/*
* <NAME>
* AoC 2021 Day 3
* Finding the most common bit value per bit
*/
use std::fmt::Display;
use std::fs::{File, read};
use std::io::{Error, BufReader, BufRead};
use std::{collections::BTreeSet}; // A smart man once told me "You're using the wrong tool for the job" aka vectors for everything
fn read_input... |
use std::sync::Arc;
use std::sync::atomic::AtomicBool;
use super::*;
/// A sequential store which allows users to create
/// reservations placed at known log offsets, used
/// for writing persistent data structures that need
/// to know where to find persisted bits in the future.
///
/// # Working with `Log`
///
/// ... |
// Copyright © 2016 <NAME>
// This program is licensed under the "MIT License".
// Please see the file COPYING in this distribution
// for license terms.
//! Full Assembunny assembler and interpreter for Advent of Code 2016
//! solutions.
//!
//! This is a fairly standard pcode setup. Call `asm()` to assemble
//! the ... |
use anyhow::Error;
use lam_emu::{
Coordinator, CoordinatorAction, List, Literal, Program, RunFuel, Runtime, Scheduler,
SchedulerManager, Tuple, Value, MFA,
};
use log::*;
use num_bigint::BigInt;
use std::env;
use std::str::FromStr;
#[derive(Default, Debug)]
/// The NativeRuntime implements support for schedule... |
//! A persistent lazy storage value. Stores a value for a given key.
//! Example:
//! If the underlying value is large, e.g. the contract needs to store an image, but it doesn't need
//! to have access to this image at regular calls, then the contract can wrap this image into
//! [`Lazy`] and it will not be deserialize... |
/*
MIT License
Copyright (c) 2019 <NAME>
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, merge, publish, distrib... |
use crate::{
asset::{Asset, AssetIndex},
cache::{PriceCache, ThreadSafePriceCache},
feed::{Exponent, Price, TimeStamp, TimeStampedPrice},
};
use chrono::Duration;
use futures::channel::oneshot;
use serde::Serialize;
use std::{
convert::TryFrom,
net::SocketAddr,
str::FromStr,
sync::{Arc, RwLock},
};
use tokio::ta... |
use std::collections::HashSet;
use std::fmt::Debug;
use std::fs::File;
use std::io::{BufRead, BufReader};
use std::num::ParseIntError;
use std::ops::RangeInclusive;
use std::str::FromStr;
#[derive(Hash, PartialEq, Eq, Clone)]
struct Point {
x: u16,
y: u16,
}
impl FromStr for Point {
type Err = ParseIntErro... |
use criterion::{criterion_group, criterion_main, Criterion, Throughput};
use oxhttp::model::{Method, Request, Status};
use oxigraph::io::GraphFormat;
use oxigraph::model::GraphNameRef;
use oxigraph::sparql::{Query, QueryResults, Update};
use oxigraph::store::Store;
use rand::random;
use std::env::temp_dir;
use std::fs:... |
//! Serde `Deserializer` module
use crate::{
de::escape::EscapedDeserializer,
de::{BorrowingReader, DeEvent, Deserializer, INNER_VALUE, UNFLATTEN_PREFIX},
errors::serialize::DeError,
events::attributes::Attribute,
events::BytesStart,
};
use serde::de::{self, DeserializeSeed, IntoDeserializer};
use ... |
use warp::{
//filters::BoxedFilter,
Filter,
http,
};
use warp::hyper::body::Bytes;
use serde_json;
use std::str::{from_utf8};
use crate::handler::call::interface;
use crate::util::global::{GLOBAL};
//use futures::Future;
use std::io;
use serde_json::json;
use tokio::fs;
use tokio::io::AsyncWriteExt;
//fn p... |
use std::{
io,
io::{Read, Write},
sync::mpsc::{sync_channel, Receiver, SyncSender, TrySendError},
thread,
time::Duration,
};
use curl::easy::Easy2;
use git_features::io::pipe;
use crate::client::blocking_io::http;
#[derive(Default)]
struct Handler {
send_header: Option<pipe::Writer>,
send... |
pub use receiver::*;
pub use sender::*;
use crate::light_validation::utils::storage_map_prefix_blake2_128_concat;
use crate::std::vec::Vec;
use enclave_api::crypto::EncryptedData;
use parity_scale_codec::{Decode, Encode};
#[derive(Encode, Decode, Debug)]
pub enum Payload<T> {
Plain(T),
Encrypted(EncryptedData... |
// Copyright 2006 The Android Open Source Project
// Copyright 2020 <NAME>
//
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::{Point, Shader, GradientStop, SpreadMode, Transform};
use crate::pipeline;
use crate::scalar::Scalar;
use crate::wide::u32x8;... |
use std::cell::RefCell;
use std::marker::PhantomData;
use std::rc::Rc;
use anyhow::Result;
use crate::algorithms::compose::compose_filters::ComposeFilter;
use crate::algorithms::compose::filter_states::FilterState;
use crate::algorithms::compose::lookahead_filters::lookahead_selector::{
selector, MatchTypeTrait, ... |
use aes_gcm_siv::aead::consts::{U12, U16};
use aes_gcm_siv::aead::generic_array::typenum::Unsigned;
use aes_gcm_siv::aead::generic_array::{ArrayLength, GenericArray};
use aes_gcm_siv::aead::{AeadCore, AeadMutInPlace, Buffer, NewAead};
use aes_gcm_siv::{Aes128GcmSiv, Key, Nonce};
use anyhow::Result;
use v8;
use crate::... |
use serde::{Deserialize, Serialize};
use serde_json::Value;
use crate::error::{Error, Result};
const MESSAGE_LIMIT: usize = 2000;
const EXTERNAL_ID_LIMIT: usize = 450;
/// Holds all annotations that apply to a Code Insights report.
///
/// A Code Insights report must have been created in Bitbucket Server before
/// ... |
use nrf52840_hal::{
gpio::{Output, Pin, PushPull},
spis::{Instance, Mode, Spis, TransferSplit},
};
use embedded_hal::digital::v2::{OutputPin, StatefulOutputPin};
use anachro_spi::{arbitrator::EncLogicLLArbitrator, Error, Result};
use crate::{ConstRawSlice, MutRawSlice};
unsafe impl<S> Send for Periph<S> whe... |
//! Constraint representation and manipulation.
use crate::flat_filter::FlatFilter;
use crate::ir::SetRef;
use crate::ir::{self, Adaptable};
use fxhash::FxHashMap;
use std;
use utils::*;
/// A constraints on IR choices.
#[derive(Debug)]
pub struct Constraint {
pub vars: Vec<ir::Set>,
pub inputs: Vec<ir::Choice... |
use optarg2chain::*;
#[derive(PartialEq, Debug)]
struct Integer(i32);
#[optarg_impl]
impl Integer {
#[optarg_method(AddBuilder, exec)]
fn add<'a>(&'a self, #[optarg(20)] a: i32) -> i32 {
self.0 + a
}
#[optarg_method(AssignBuilder, exec)]
fn assign<'a>(&'a mut self, #[optarg(0)] a: i32) {
... |
#![cfg_attr(docsrs, feature(doc_cfg))]
#![allow(clippy::clippy::needless_doctest_main)]
//! craftping provides a `ping` function to send Server List Ping requests to a Minecraft server.
//!
//! # Feature flags
//!
//! - `sync` (default): Enables synchronous, blocking [`ping`](crate::sync::ping) function.
//! - `async-t... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Calibration temperature and checksum"]
pub cal: crate::Reg<cal::CAL_SPEC>,
#[doc = "0x04 - ADC0 Calibration register 0"]
pub adc0cal0: crate::Reg<adc0cal0::ADC0CAL0_SPEC>,
#[doc = "0x08 - ADC0 Calibration register 1"]
... |
// Copyright © 2019 Intel Corporation
//
// SPDX-License-Identifier: Apache-2.0
//
use linux_loader::cmdline::Cmdline;
use net_util::MacAddr;
use std::convert::From;
use std::net::AddrParseError;
use std::net::Ipv4Addr;
use std::path::Path;
use std::result;
use vm_memory::GuestAddress;
pub const DEFAULT_VCPUS: &str =... |
use std::collections::BTreeMap;
use std::fs::File;
use std::io::prelude::*;
use std::io::{LineWriter, Result};
use std::iter;
use std::path::{Path, PathBuf};
use crate::common::SeqFormat;
pub struct SeqWriter<'m> {
path: PathBuf,
outname: PathBuf,
matrix: &'m BTreeMap<String, String>,
id_len: usize,
... |
use std::{fmt::Display, str::FromStr};
use anyhow::Result;
use rss::Item;
use yew::{
format::{Json, Nothing},
html,
services::{
fetch::{FetchTask, Request, Response},
FetchService, StorageService,
},
Callback, Component, ComponentLink, Html, InputData, Properties, ShouldRender,
};
... |
use anyhow::Result;
use async_trait::async_trait;
use aws_config::{
meta::{credentials::LazyCachingCredentialsProvider, region::RegionProviderChain},
profile::ProfileFileCredentialsProvider,
};
use http::Uri;
use std::{str::FromStr, sync::Arc};
use amazon_qldb_driver::{retry, QldbDriver, QldbDriverBuilder, Qld... |
extern crate gtk;
extern crate tempdir;
use self::gtk::prelude::*;
use std::collections::HashSet;
use self::tempdir::TempDir;
pub fn main_gui() {
if gtk::init().is_err() {
println!("Failed to initialize GTK.");
return;
}
// Main window.
let main = gtk::Window::new(gtk::WindowType::To... |
use std::fmt::Display;
use std::panic::{catch_unwind, UnwindSafe};
use crate::pot::FondueTestFn;
use crate::{ic_instance::InternetComputer, ic_manager::IcHandle};
use std::path::{Path, PathBuf};
use std::time::Duration;
pub trait PotConfigFn: FnOnce() -> InternetComputer + UnwindSafe + Send + Sync + 'static {}
impl<T... |
use crate::color::RGBA8;
use crate::graphics::Texture;
use crate::graphics::{
BlendFactor, Capability, ClearMode, CullFace, DepthTest, DisplayMode, OpenGL, OpenGLWindow,
OpenGLWindowContract, PixelStoreAlignment, TextureFiltering, WindowSettings,
};
use crate::image::Image;
use crate::{App, Context};
use cgmath... |
//! Transparent transfer serialization formats for finalized data.
//!
//! # Correctness
//!
//! The [`crate::constants::DATABASE_FORMAT_VERSION`] constant must
//! be incremented each time the database format (column, serialization, etc) changes.
use std::fmt::Debug;
use serde::{Deserialize, Serialize};
use zebra_c... |
//! Descrives the current process textually. Operating systems
//! can reuse pids, so we couple that with the time at which
//! the process was spawned.
use regex::Regex;
use std::fs::File;
use std::io::BufRead;
use std::io::Error;
use std::io::ErrorKind;
use std::io::Result;
use std::sync::atomic::AtomicU32;
use std:... |
use crate::adapter::{
Resource, Remote, Local, Adapter, SendStatus, AcceptedType, ReadStatus, ConnectionInfo,
ListeningInfo,
};
use crate::remote_addr::{RemoteAddr};
use crate::util::{OTHER_THREAD_ERR};
use mio::event::{Source};
use mio::net::{TcpStream, TcpListener};
use tungstenite::protocol::{WebSocket, Me... |
mod client_handler;
mod server_handler;
use crate::proto::{MessageCode, MessageStream, PartyId, PayloadKind};
use actix::clock::Duration;
use actix::{
Actor as ActixActor, Addr as ActorAddress, Context, Handler as MessageHandler, Message, Running,
};
use std::collections::BTreeMap;
use std::sync::atomic::{AtomicBo... |
use cc;
use core::arch::x86_64::__cpuid_count;
use rerun_except::rerun_except;
use std::env;
use std::fs;
use std::os::unix::fs as unix_fs;
use std::path::{Path, PathBuf};
use std::process::Command;
const FEATURE_CHECKS_PATH: &str = "feature_checks";
const C_DEPS_DIR: &str = "c_deps";
const C_DEPS_MAKEFILE: &str = "c... |
// Copyright 2019-2020 Parity Protocol.
// This file is part of Parity.
// Parity is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// You... |
extern crate rand;
use std::collections::HashMap;
use std::collections::HashSet;
use std::collections::VecDeque;
use std::fmt::Write;
pub trait PathableGraph {
fn get_neighbors(&self, String) -> Option<&HashSet<String>>;
fn contains_node(&self, String) -> bool;
}
fn find_path<T: PathableGraph>(graph: T, star... |
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) Collabora Ltd.
use anyhow::{anyhow, Error, Result};
use log::error;
use serde::{Deserialize, Serialize};
use std::io::Write;
use std::os::unix::process::CommandExt;
use std::path::Path;
use crate::job::{FormatOpts, JobCtxs};
// The hard-coded file n... |
use crate::colors::storage::serializer::{ColorsFlushProcessing, ColorsIndexEntry};
use crate::colors::storage::ColorsSerializerImpl;
use crate::colors::ColorIndexType;
use crate::config::DEFAULT_OUTPUT_BUFFER_SIZE;
use crate::io::varint::{decode_varint, encode_varint};
use crate::utils::async_slice_queue::AsyncSliceQue... |
/// This module contains the objects for handling compressed archive files
use std::fmt::Debug;
use std::fs::{create_dir_all, remove_file, File};
use std::io::BufReader;
use std::path::{Path, PathBuf};
use path_clean::PathClean;
use tar::{Archive, Builder, Entry, Header};
use zstd::{Decoder, Encoder};
use c... |
use proc_macro::TokenStream;
use quote::quote;
use syn::{self, parse, DeriveInput};
#[proc_macro_derive(CustomDebug, attributes(debug))]
pub fn derive(input: TokenStream) -> TokenStream {
let ast: DeriveInput = parse(input).unwrap();
let name = &ast.ident;
let mut debug_fields = vec![];
let mut para... |
use crate::ast::{
BinaryOperator, ExpressionStaticType, FullyInlinedProgram, IfElseBlock, LiteralValue,
SourceLanguageExpression, SourceLanguageProgram,
};
use crate::inliner::program_inline;
use std::collections::HashMap;
fn pretty_print(
expression: &SourceLanguageExpression,
string_builder: &mut String,
v... |
//! APIs to read Arrow streams asynchronously
use std::sync::Arc;
use arrow_format::ipc::planus::ReadAsRoot;
use futures::future::BoxFuture;
use futures::AsyncRead;
use futures::AsyncReadExt;
use futures::Stream;
use crate::array::*;
use crate::chunk::Chunk;
use crate::error::{ArrowError, Result};
use super::super::... |
extern crate proc_macro;
extern crate syn;
#[macro_use]
extern crate synstructure;
#[macro_use]
extern crate quote;
extern crate c2rust_xcheck_config as xcfg;
fn get_attr_args<'a>(
attrs: &'a [syn::Attribute],
attr_name: &'static str,
) -> impl Iterator<Item = xcfg::attr::ArgList<&'a str>> {
attrs
... |
use core_affinity;
use rayon;
pub fn new_thread_pool(num_threads: usize, thread_pinning: bool) -> rayon::ThreadPool {
let core_ids = if thread_pinning {
core_affinity::get_core_ids().unwrap()
} else {
Vec::new()
};
rayon::ThreadPoolBuilder::new()
.num_threads(num_threads)
... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.