text stringlengths 3.09k 13.9k |
|---|
use dependencies::hkdf;
use dependencies::hex;
use dependencies::bitcoin_hashes;
use bitcoin_hashes::Hash;
use super::cipher_state::CipherState;
use std::{fmt, io};
use common_types::{Sha256, Sha256HashEngine};
// TODO: needed MAC type encapsulating the array [u8; MAC_SIZE]
pub const MAC_SIZE: usize = 16;
/// `Symm... |
// Generated by `scripts/generate.js`
use std::os::raw::c_char;
use std::ops::Deref;
use std::ptr;
use std::cmp;
use std::mem;
use utils::c_bindings::*;
use utils::vk_convert::*;
use utils::vk_null::*;
use utils::vk_ptr::*;
use utils::vk_traits::*;
use vulkan::vk::*;
use vulkan::vk::{VkStructureType,RawVkStructureType... |
/*
* Copyright (c) 2021 Arm Limited.
*
* SPDX-License-Identifier: MIT
*
* 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 ... |
use std::str::FromStr;
use crate::{
betting::*,
change::{BinScript, Change},
};
use anyhow::anyhow;
use bdk::bitcoin::{self, Amount};
use olivia_core::EventId;
#[derive(Clone, Debug, PartialEq, serde::Deserialize, serde::Serialize)]
pub enum VersionedProposal {
One(Proposal),
}
impl From<VersionedProposa... |
extern crate handoff_counter;
extern crate devesim;
extern crate rand;
extern crate roaring;
extern crate counter_simulator;
//use rand::{Rng};
//use std::cmp::{min, max};
use roaring::RoaringBitmap;
use devesim::{Simulator};
type Bitmap = RoaringBitmap<u32>;
use counter_simulator::network;
use counter_simulator::... |
use registry::{Enum, Registry, Cmd, Ns};
use registry::{Gl, Gles1, Gles2, Wgl, Glx, Egl};
use syntax::ast;
use syntax::ext::base::ExtCtxt;
use syntax::ptr::P;
mod ty;
pub mod global_gen;
pub mod static_gen;
pub mod struct_gen;
/// Trait for a bindings generator.
pub trait Generator {
/// Builds the GL bindings.
... |
extern crate proc_macro;
const I8_BLOCK_WIDTH: usize = 8;
const I8_BLOCK_HEIGHT: usize = 4;
use proc_macro::TokenStream;
use image::imageops::overlay;
use image::GrayImage;
use proc_macro_hack::proc_macro_hack;
use rusttype::gpu_cache::CacheBuilder;
use rusttype::Point;
use rusttype::{Font, Rect, Scale};
use syn::{
... |
use std::fs::File;
use std::path::PathBuf;
use crossbeam::thread;
use failure::Fallible;
use glutin::ContextTrait;
use structopt::StructOpt;
use webrender::api::units::*;
use rpdf_document::Document;
mod render;
#[derive(Debug, StructOpt)]
#[structopt(name = "rpdf")]
struct Opt {
#[structopt(parse(from_os_str))... |
// Copyright (C) The OpenTimestamps developers
//
// This file is part of rust-opentimestamps.
//
// It is subject to the license terms in the LICENSE file found in the
// top-level directory of this distribution.
//
// No part of rust-opentimestamps including this file, may be copied, modified,
// propagated, or distr... |
//! Example code showing how to use the MT25QL128ABA on the STM32F746G Discovery Board.
//! The intended behavior of the example is to write a known pattern to flash memory and
//! read it back using both polling and DMA indirect modes of the QSPI HAL driver.
//! The example will panic on failure and print messages ove... |
//! How to write either a single or a list of layers.
use crate::meta::header::{ImageAttributes, Header};
use crate::meta::{Headers, compute_chunk_count};
use crate::block::BlockIndex;
use crate::image::{Layers, Layer};
use crate::meta::attribute::{TileDescription};
use crate::prelude::{SmallVec};
use crate::image::wr... |
use crate::{
aggregator::{Aggregator, Context},
async_sender::AsyncSender,
output_filter::OutputFilter,
};
use futures::stream::{FuturesUnordered, StreamExt};
use core::{mem, time::Duration};
use std::sync::{Arc, Mutex, RwLock};
use crossbeam_channel::Receiver;
use tokio::{signal, task::JoinHandle, time}... |
use crate::illuminate::D65;
use crate::spaces::{CieXyz, Jab, Srgb};
use crate::{Color, Float, Into};
const N: Float = 0.1593017578125; // = 2610 / Math.pow(2, 14);
const P: Float = 134.034375; // = 1.7 * 2523 / Math.pow(2, 5);
const C1: Float = 0.8359375; // = 3424 / Math.pow(2, 12);
const C2: Float = 18.8515625; // =... |
//! Operational semantics of the data description language.
use codespan::Span;
use crate::core::{Term, Value};
/// Evaluate a term into a semantic value.
pub fn eval(term: &Term) -> Value {
match term {
Term::Item(_, label) => Value::Item(label.clone()), // TODO: Evaluate to value in environment
... |
use alloc::string::String;
use byteorder::{ByteOrder, NetworkEndian};
use smoltcp::wire::Ipv4Address;
use super::Stringable;
// pub enum Cidr {
// Ipv4Cidr,
// Ipv6Cidr,
// }
// pub enum IpAddr {
// Ipv4Addr,
// Ipv6Addr,
// }
type Ipv4Addr = u32;
// type Ipv6Addr = u128;
impl Stringable for Ipv4Ad... |
use amethyst::{
animation::{
AnimationPrefab, AnimationSetPrefab, InterpolationFunction, Sampler, SpriteRenderChannel,
SpriteRenderPrimitive,
},
assets::Prefab,
core::{transform::Transform, Named},
renderer::{
formats::texture::ImageFormat,
sprite::{
prefa... |
// 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.
use std::convert::TryFrom;
use std::fmt;
use crate::types::*;
/// An unchecked signal represents a signal that has not been through verification, and may... |
use super::{Dir, GridCoord, Point3, PosInOwningRoot};
use crate::movement::{move_forward, turn_left_by_one_hex_edge};
use std::iter::Chain;
use std::slice;
pub struct Neighbors {
// Hide the iterators used to implement this.
iter: NeighborsImpl,
}
/// Iterator over the cells sharing an interface with a given ... |
#![feature(nll)]
#[derive(Debug)]
pub struct BTree {
minimum_degree: usize,
root: Option<BTreeNode>,
}
impl BTree {
pub fn new(minimum_degree: usize) -> BTree {
BTree{
root: None,
minimum_degree: minimum_degree,
}
}
pub fn search(&self, key: usize) -> Optio... |
use session::game::{Session, GameState};
use session::game::chunk::{self, Ref};
use protocol::*;
use protocol::messages::game::chat::channel::*;
use protocol::messages::game::chat::*;
use protocol::messages::game::chat::smiley::*;
use protocol::types::game::data::items::ObjectItem;
use protocol::messages::game::basic::... |
mod utils;
use midi_file::MidiFile;
use std::fmt::{Debug, Display, Formatter};
use std::path::{Path, PathBuf};
use tempfile::TempDir;
use utils::{
enable_logging, test_file, ADESTE_FIDELES, ALS_DIE_ROEMER, AVE_MARIS_STELLA, BARITONE_SAX,
B_GUAJEO, LATER_FOLIA, LOGIC_PRO, PHOBOS_DORICO, TOBEFREE,
};
type RtRes... |
use std::sync::atomic::{AtomicUsize, Ordering};
use std::time::{Duration, Instant};
use concurrent_queue::ConcurrentQueue;
use suspend::Notifier;
use super::resource::{ResourceGuard, ResourceInfo, ResourceLock};
pub type ReleaseFn<T> = Box<dyn Fn(&mut T, ResourceInfo) -> bool + Send + Sync>;
pub type DisposeFn<T> = ... |
//! TODO_DOCS_DESCRIPTION
//!
//! [](https://iteration-square.schichler.dev/#narrow/stream/project.2Flignin-azul)
#!... |
use std::fs;
use human_sort::compare;
use std::collections::BTreeMap;
extern crate lopdf;
use lopdf::{Document, Bookmark, Object, ObjectId};
pub fn get_documents(directory: &std::path::Path) -> Vec<Document> {
let mut file_paths: Vec<_> = fs::read_dir(directory).unwrap().map(|r| r.unwrap().path()).collect()... |
// Copyright 2017 The Australian National University
//
// 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 applicab... |
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors
//
// 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
//
// Unl... |
//! This module contains fragments implementation.
use super::{VDiff, VNode, VText};
use crate::html::{AnyScope, NodeRef};
use cfg_if::cfg_if;
use std::collections::HashSet;
use std::ops::{Deref, DerefMut};
cfg_if! {
if #[cfg(feature = "std_web")] {
use stdweb::web::Element;
} else if #[cfg(feature = "w... |
use std::path::Path;
use tch::{Tensor, nn, Device, no_grad};
use tch::nn::VarStore;
use rust_bert::Config;
use rust_bert::bert::{BertModel, BertEmbeddings, BertConfig};
use rust_tokenizers::{BertTokenizer, BertVocab};
use rust_tokenizers::preprocessing::tokenizer::base_tokenizer::{Tokenizer, MultiThreadedTokenizer};
... |
//! Contains structs used for encryption and decryption.
//!
//! ## Example
//! ```
//! use fire_crypto::cipher::{Keypair, Nonce};
//!
//! // Alice creates a key only she knows.
//! let alice_privkey = Keypair::new();
//! // Bob creates a key only he knows.
//! let bob_privkey = Keypair::new();
//!
//! // Alice sends i... |
use crate::Update;
use std::{
collections::BTreeSet,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
},
};
use tracing_core::span::Id;
/// Constructs a channel of [`Trace`] updates bounded at `capacity`.
pub(crate) fn bounded(id: Id, capacity: usize) -> (Sender, Updates) {
let (sender, rec... |
use eyre::eyre;
use eyre::ErrReport;
use futures::prelude::*;
use rand::{
distributions::{Bernoulli, Distribution},
thread_rng,
};
use std::collections::BTreeSet;
use std::convert::TryInto;
use std::io::Cursor;
use std::time::Duration;
use tcn::{ReportAuthorizationKey, SignedReport, TemporaryContactKey, Tempora... |
#![warn(clippy::all, clippy::pedantic)]
use clap::{crate_name, crate_version, App, AppSettings, Arg, ArgMatches};
use hline::file;
use hline::file::ReadRecorder;
use std::env;
use std::fmt::Display;
use std::fs::File;
use std::io;
use std::io::{Read, Seek, Stdin};
use std::process;
use termion::color::{Fg, LightRed, Re... |
use std::fs::File;
use std::io::BufWriter;
use std::io::Read;
use std::io::Write;
use std::io::SeekFrom;
pub(crate) fn get_u16<T: Read>(f: &mut T) -> u16 {
let mut buffer = [0; 2];
f.read_exact(&mut buffer).unwrap();
u16::from_le_bytes(buffer)
}
pub(crate) fn get_u32<T: Read>(f: &mut T) -> u32 {
let m... |
use std::fmt::Debug;
use std::rc::Rc;
use std::cell::RefCell;
use std::collections::HashMap;
use value::Value;
use value::LoxInstance;
use environment::Environment;
use parser::ast::FunctionDecl;
use parser::ast::FunctionStmt;
use eval::RuntimeError;
use eval::Interpreter;
#[derive(PartialEq, Clone)]
pub enum Callab... |
extern crate scurry;
extern crate postgres;
extern crate rusqlite;
#[macro_use]
extern crate log;
#[macro_use]
extern crate clap;
mod termlog;
use clap::{Arg, App, SubCommand};
use postgres::{Connection as PgConnection, SslMode};
use rusqlite::Connection as SqliteConnection;
use scurry::connection::ScurryConnection;... |
use std::sync::Arc;
use arukas::{
geometry::load_model,
glm,
render::{
fovx_to_fovy,
passes::{self, DeferredShadingInput},
FrameContext, GPUScene, Mesh, OribitalCamera, Perspective, PointLight, RenderContext,
RenderPass,
},
};
use arukas::render::GPUMesh;
use winit::{
... |
use lorawan_encoding::creator::{DataPayloadCreator, JoinRequestCreator};
use lorawan_encoding::default_crypto::DefaultFactory;
use lorawan_encoding::maccommands::MacCommand;
use lorawan_encoding::parser;
use lorawan_encoding::parser::{
DataHeader, DataPayload, EncryptedJoinAcceptPayload, FCtrl, FRMPayload, MHDRAble... |
use std::cmp::PartialEq;
use std::ops::BitXor;
use std::ops::Shl;
#[derive(Debug, PartialEq, Eq)]
pub struct CpuFlag {
pub carry: bool,
pub half_carry: bool,
pub negative: bool,
pub zero: bool,
}
impl CpuFlag {
pub fn to_u8(self: &Self) -> u8 {
let bits = [
self.zero as u8,
... |
use std::convert::TryFrom;
use serbuffer::{types, FieldMetadata};
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub enum DataType {
/// A boolean datatype representing the values `true` and `false`.
Boolean,
/// A signed 8-bit integer.
Int8,
/// An unsigned ... |
pub(super) mod imp;
pub(crate) mod scope;
use ra_syntax::{
ast::{self, AstNode, NameOwner},
SmolStr, SyntaxNode,
};
use relative_path::RelativePathBuf;
use crate::{db::SyntaxDatabase, syntax_ptr::SyntaxPtr, FileId};
pub(crate) use self::scope::ModuleScope;
/// Phisically, rust source is organized as a set o... |
//! Profile services.
use crate::api::rcos::users::edit_profile::{EditProfileContext, SaveProfileEdits};
use crate::api::rcos::users::profile::{
profile::{ProfileTarget, ResponseData},
Profile,
};
use crate::api::rcos::users::UserRole;
use crate::error::TelescopeError;
use crate::templates::forms::FormTemplate... |
#![feature(try_trait)]
use std::fs::File;
use std::io::Read;
use std::io::Write;
use chrono::naive::NaiveDate;
use chrono::Datelike;
use clap::{crate_authors, crate_name, crate_version, load_yaml, App};
use lazy_static::lazy_static;
use regex::Regex;
use select::document::Document;
use select::node::Node;
use select:... |
use std::collections::HashMap;
use std::fmt::{self, Display};
use itertools::Itertools;
use proctor::elements::telemetry::combine::{self, TelemetryCombinator};
use proctor::elements::TelemetryType;
use serde::de::{self, Deserializer, MapAccess, SeqAccess, Visitor};
use serde::ser::SerializeTupleStruct;
use serde::{Des... |
// Path tracking simulation with pure pursuit steering and PID speed control.
// author: <NAME> (@Atsushi_twi)
// <NAME> (@Gjacquenot)
// <NAME> (@rsasaki0109)
use plotlib::page::Page;
use plotlib::repr::Plot;
use plotlib::view::ContinuousView;
use plotlib::style::LineStyle;
#[derive(Debug, Copy, Clone... |
use directory::DEFAULT_ROOT_DIR;
use network::NetworkConfig;
use serde_derive::{Deserialize, Serialize};
use std::fs;
use std::path::PathBuf;
use types::{Graffiti, PublicKeyBytes};
/// Default directory name for the freezer database under the top-level data dir.
const DEFAULT_FREEZER_DB_DIR: &str = "freezer_db";
/// ... |
use tract_hir::internal::*;
use crate::model::{ParsingContext, TfOpRegister};
use crate::tfpb::tensorflow::NodeDef;
pub fn register_all_ops(reg: &mut TfOpRegister) {
reg.insert("Assign", |_, _| Ok(Box::new(Assign::default())));
reg.insert("VariableV2", variable_v2);
}
fn variable_v2(_ctx: &ParsingContext, no... |
//! Module for template system based on [tera crate v1.15.0](https://docs.rs/tera/1.15.0/tera/).
use crate::settings;
use log::{debug, error, info, warn};
use serde::Serialize;
use std::{collections::HashMap, str::FromStr};
pub use tera::{Context as TeraContext, Result, Tera, Value};
/// A type alias for `tera::Conte... |
//! Message stickers.
//!
//! See the [Discord documentation] for more information.
//!
//! [Discord documentation]: https://discord.com/developers/docs/resources/sticker#sticker-object-sticker-structure
mod format_type;
mod kind;
mod message;
mod pack;
pub use self::{
format_type::{StickerFormatType, StickerForm... |
//! The encoder and decoder of the GZIP format.
//!
//! The GZIP format is defined in [RFC-1952](https://tools.ietf.org/html/rfc1952).
//!
//! # Examples
//! ```
//! use std::io::{self, Read};
//! use libflate::gzip::Encoder;
//! use libflate::non_blocking::gzip::Decoder;
//!
//! // Encoding
//! let mut encoder = Encod... |
use crate::controller;
use crate::editor_transport;
use crate::project_root::find_project_root;
use crate::thread_worker::Worker;
use crate::types::*;
use crate::util::*;
use crossbeam_channel::{after, never, select, Sender};
use lsp_types::notification::Notification;
use lsp_types::*;
use std::collections::HashMap;
us... |
use std::fmt::Debug;
use carbide_core::DeserializeOwned;
use carbide_core::draw::Dimension;
use carbide_core::Serialize;
use carbide_core::widget::*;
use crate::PlainPopUpButton;
#[derive(Clone, Widget)]
pub struct PopUpButton<T, GS>
where
GS: GlobalStateContract,
T: Serialize + Clone + Debug + D... |
use pyo3::{prelude::*, types::*};
use std::collections::HashMap;
use std::fs;
use std::io::{self, Write};
use std::path::{Path, PathBuf};
use std::time::{Duration, Instant, SystemTime};
use super::StepId;
use crate::config_file::ExecConfig;
use crate::envdict::EnvDict;
#[derive(Debug)]
pub struct CommandResult {
... |
// Copyright 2018-2021 Parity Technologies (UK) Ltd.
//
// 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 ... |
use super::*;
use crate::core::Target;
use crate::search;
use clap::Arg;
pub struct ListCommand {}
impl Command for ListCommand {
fn name(&self) -> String {
String::from("list")
}
fn app<'a>(&self) -> clap::App<'a> {
App::new(&self.name())
.version("1.0")
.visible_a... |
use polyhorn::prelude::*;
use polyhorn::Reference;
use polyhorn_core::{use_channel, Receiver};
use polyhorn_ui::events::EventListener;
use polyhorn_ui::geometry::{Dimension, Size};
use polyhorn_ui::styles::{Position, Transform, ViewStyle};
use std::sync::{Arc, RwLock};
use super::{PropertyState, State, TransitionConte... |
#![cfg_attr(not(feature = "mock"), no_std)]
#![feature(proc_macro_hygiene)]
#![allow(clippy::too_many_arguments)]
extern crate ontio_std as ostd;
use ostd::abi::Dispatcher;
use ostd::abi::{Sink, Source};
use ostd::contract::ont;
use ostd::prelude::*;
use ostd::types::u128_to_neo_bytes;
use ostd::{console, runtime};
#... |
//! X-Ray [tracing header](https://docs.aws.amazon.com/xray/latest/devguide/xray-concepts.html?shortFooter=true#xray-concepts-tracingheader)
//! parser
use crate::{SegmentId, TraceId};
use std::{
collections::HashMap,
fmt::{self, Display},
str::FromStr,
};
#[derive(PartialEq, Debug)]
pub enum SamplingDeci... |
// SPDX-License-Identifier: Apache-2.0 OR MIT
// Copyright 2021 Microsoft
use std::fs::File;
use std::os::unix::io::{AsRawFd, FromRawFd, RawFd};
use crate::ioctls::Result;
use crate::mshv_ioctls::{MSHV_GET_DEVICE_ATTR, MSHV_HAS_DEVICE_ATTR, MSHV_SET_DEVICE_ATTR};
use mshv_bindings::mshv_device_attr;
use vmm_sys_util:... |
use crate::constants::LIBRARY_COLLECTION_NAME;
use crate::models::ctx::{update_library, update_profile, CtxError};
use crate::runtime::msg::{Action, ActionCtx, Event, Internal, Msg};
use crate::runtime::{Effect, Effects, Env, Update};
use crate::types::api::{
fetch_api, APIRequest, APIResult, AuthRequest, AuthRespo... |
use std::collections::VecDeque;
use crate::expression::{
types::{Node, Token},
ExpressionError,
};
pub struct ParseError(&'static str);
impl From<ParseError> for ExpressionError {
fn from(err: ParseError) -> ExpressionError {
ExpressionError::Parse(err.0)
}
}
// Note: we don't have triple-op... |
//
// Copyright 2021 The Project Oak 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 o... |
// Generated from definition io.k8s.api.core.v1.StorageOSVolumeSource
/// Represents a StorageOS persistent volume resource.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct StorageOSVolumeSource {
/// Filesystem type to mount. Must be a filesystem type supported by the host operating system. Ex. "ext4", "xf... |
use crate::backend::{ApiResponse, Json, JsonHandlerScopeExt, Nothing, RequestHandle};
use crate::error::{ErrorNotification, ErrorNotifier};
use crate::{
backend::Backend,
data::{SharedDataDispatcher, SharedDataOps},
error::error,
page::AppRoute,
pages::{
apps::ApplicationContext,
dev... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{test_utils::diem_swarm_utils::get_client_proxy, workspace_builder};
use cli::client_proxy::ClientProxy;
use diem_config::config::NodeConfig;
use diem_crypto::ed25519::Ed25519PrivateKey;
use diem_genesis_tool::{config_builder... |
//! High-level setup and interrupt mapping for the chip.
use core::fmt::Write;
use kernel;
use kernel::common::registers::FieldValue;
use kernel::debug;
use kernel::hil::time::Alarm;
use rv32i;
use rv32i::csr::{mcause, mie::mie, mip::mip, CSR};
use rv32i::PMPConfigMacro;
use crate::gpio;
use crate::interrupts;
use cr... |
use std::collections::BTreeSet;
use geom::Distance;
use crate::make::initial::lane_specs::get_lane_specs_ltr;
use crate::osm::NodeID;
use crate::raw::{OriginalRoad, RawMap, RawRoad};
use crate::{osm, IntersectionType, LaneType};
/// Collapse degenerate intersections between two cycleways.
pub fn collapse(raw: &mut R... |
use crate::{
block::{block_header_to_digest, BlockHeader, BlockTrait, BlockTxList},
config::PoWConfig,
};
use chrono::{DateTime, Utc};
use futures::prelude::*;
use serde::{Deserialize, Serialize};
use slimchain_common::{
basic::{Nonce, H256, U256},
digest::{blake2b_hash_to_h256, default_blake2, Digestib... |
///////////////////////////////////////////////////////////////////////////////
//
// Copyright 2018-2021 Robonomics Network <<EMAIL>>
//
// 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
... |
// Copyright (c) 2018-2022 The MobileCoin Foundation
//! Code for computing and decrypting fog hints
use crate::encrypted_fog_hint::{EncryptedFogHint, EncryptedFogHintSize};
use core::convert::TryFrom;
use mc_account_keys::PublicAddress;
use mc_crypto_box::{
generic_array::{
typenum::{Diff, Unsigned},
... |
mod flags;
pub use self::flags::*;
mod link_layer_type;
pub use self::link_layer_type::*;
use super::{LinkBuffer, LINK_HEADER_LEN};
use crate::{DecodeError, Emitable, Parseable};
/// High level representation of `RTM_GETLINK`, `RTM_SETLINK`, `RTM_NEWLINK` and `RTM_DELLING`
/// messages headers.
///
/// These headers ... |
use std::{error::Error, io, io::Stdout};
use i3ipc::reply::Node;
use termion::{input::MouseTerminal, raw::IntoRawMode, raw::RawTerminal, screen::AlternateScreen};
use tui::style::{Color, Modifier, Style};
use tui::text::{Span, Spans};
use tui::widgets::Paragraph;
use tui::{
backend::TermionBackend,
layout::{Co... |
// Copyright 2020-2021 The Datafuse Authors.
//
// SPDX-License-Identifier: Apache-2.0.
use std::sync::Arc;
use common_arrow::arrow::datatypes::Field;
use common_arrow::arrow::datatypes::Schema;
use common_arrow::arrow::ipc::convert;
use common_arrow::arrow_flight::flight_descriptor::DescriptorType;
use common_arrow:... |
//! A disassembler library.
#![allow(non_upper_case_globals, non_snake_case)]
pub enum LLVMOpaqueDisasmContext {}
pub type LLVMDisasmContextRef = *mut LLVMOpaqueDisasmContext;
pub type LLVMOpInfoCallback =
extern "C" fn(DisInfo: *mut ::libc::c_void,
PC: u64, Offset: u64,
Size:... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::INTERNAL_METADATA_DIRECTIVE;
use common::{FileKey, Location, NamedItem, Span, WithLocation};
use graphql_ir::{
Argum... |
use futures::channel::oneshot;
use futures::{Future, TryFutureExt};
use std::sync::Arc;
use std::sync::RwLock;
use std::sync::Weak;
use std::fmt::Debug;
/// Cloneable wrapper for callbacks registered when watching files of a `Directory`.
#[derive(Clone)]
pub struct WatchCallback(Arc<dyn Fn() + Sync + Send>);
impl Debu... |
#![doc(alias = "bits")]
#![doc(alias = "channel-bits-events-v2")]
//! PubSub messages for bits
use crate::{pubsub, types};
use serde::{Deserialize, Serialize};
/// Anyone cheers in a specified channel.
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
#[serde(into = "String", try_from = "String")]
pub str... |
use std::rc::Rc;
#[derive(Debug, PartialEq)]
pub struct DexFile {
pub header: super::Header,
pub file_data: DexFileData,
pub classes: Vec<ClassDefinition>
/* TODO: parse call site items
pub call_site_items: Vec<CallSiteItem>
*/
}
#[derive(Debug, PartialEq)]
pub struct DexFileData {
pub... |
// Copyright 2018-2022 Parity Technologies (UK) Ltd.
//
// 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 applicab... |
use crate::{
application_context::ApplicationContext,
db::DbConn,
helpers::{admin_only::AdminOnly, maybe_user::MaybeUser},
models::{ModelError, Snippet},
};
use chrono::{DateTime, FixedOffset};
use rocket::{delete, get, post, put, serde::json::Json, State};
use serde::{Deserialize, Serialize};
/* #regi... |
/// Redis queue implementation
///
/// This implementation uses the following data structures:
/// - A "tasks to be processed" queue - which is what the consumer listens to for tasks.
/// AKA: Main
/// - A "tasks currently processing" queue - which are for tasks that are currently being handled.
/// AKA: Proces... |
use std::fmt::Display;
use serde::ser::{self, Serialize, SerializeSeq, Serializer};
use error::NoError;
use join::Join;
use saveload::EntityData;
use saveload::marker::{Marker, MarkerAllocator};
use storage::{GenericReadStorage, ReadStorage, WriteStorage};
use world::{Component, EntitiesRes, Entity};
/// Converts a ... |
// Copyright 2020-2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
use crate::{
fullnode::config::FullNodeConfig,
plugins::dashboard::{broadcast, websocket::WsUsers, Dashboard},
storage::NodeStorageBackend,
};
use bee_protocol::{types::metrics::NodeMetrics, workers::PeerManager};
use bee_rest_api::endpo... |
// Copyright 2020-2021, The Tremor 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 agr... |
use crate::aligned_bytes::{Alignment, Misaligned, A1, A2, A4, A8};
use core::{borrow::Borrow, convert::TryFrom, fmt::Display, marker::PhantomData};
/// Represents a usize that is some multiple of [`Alignment::ALIGNMENT`].
///
/// `AlignedOffset<A2>` is essentially a usize that is multiple of 2. This is
/// useful bec... |
use notify::Watcher;
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use std::sync::mpsc::channel;
use std::sync::Arc;
use std::path::{Path, PathBuf};
macro_rules! shader_program(
($name:ident, $vert:literal, $frag:literal) => {
#[derive(Debug)]
pub struct $name;
impl ShaderP... |
extern crate indy_crypto;
use errors::common::CommonError;
use std::collections::{HashMap, HashSet};
use self::indy_crypto::cl::*;
use self::indy_crypto::utils::json::{JsonDecodable, JsonEncodable};
#[derive(Clone, Debug, Deserialize, Serialize)]
pub struct AttributeInfo {
pub name: String,
pub restrictions:... |
use crate::{light_block::LightBlock, Generator};
use tendermint::block::{self, Height};
use tendermint::chain::Info;
use std::convert::{TryFrom, TryInto};
#[derive(Clone, Debug)]
pub struct LightChain {
pub info: Info,
pub light_blocks: Vec<LightBlock>,
}
impl LightChain {
pub fn new(info: Info, light_bl... |
// 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... |
// Copyright 2019. 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
// disclai... |
//! The `queens` example searches for solutions of the
//! [N Queens Problem](https://en.wikipedia.org/wiki/Eight_queens_puzzle)
use genevo::{operator::prelude::*, prelude::*, random::Rng, types::fmt::Display};
const NUMBER_OF_QUEENS: i16 = 16;
const NUM_ROWS: i16 = NUMBER_OF_QUEENS;
const NUM_COLS: i16 = NUMBER_OF_Q... |
use crate::{request::Span, Error, Request};
/// Status of parsing an HTTP request. The request may have been only
/// partial, in which case the buffer is returned in `Partial` so we
/// can continue reading from the socket.
#[derive(Debug)]
pub enum Status {
Complete(Request),
Partial(Vec<u8>),
}
/// Total s... |
use std::{collections::HashMap, fs, ops::RangeInclusive, path::Path, str::FromStr};
use select::{document::Document, predicate::Name};
// macro_rules! t {
// ($e:expr) => {
// $e.expect(&format!("{}: {}", line!(), stringify!($e)))
// };
// }
macro_rules! t {
($e:expr) => {
$e?
};
}
#... |
use common::BinarySerializable;
use regex::Regex;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::borrow::Borrow;
use std::borrow::Cow;
use std::fmt::{self, Debug, Display, Formatter};
use std::io::{self, Read, Write};
use std::str;
const SLASH_BYTE: u8 = b'/';
const ESCAPE_BYTE: u8 = b'\\';
/... |
// Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: MIT OR Apache-2.0
use crate::build_targets;
use crate::common::UNUSED_URL;
use crate::datetime::parse_datetime;
use crate::error::{self, Result};
use crate::source::parse_key_source;
use chrono::{DateTime, Utc};
use ... |
use itertools::Itertools;
use positioned_io::WriteAt;
use serde_json::{json, Value};
use anyhow::Context as ErrContext;
use super::unmatched::UnmatchedHandler;
use std::{fs::{File, OpenOptions}, io::{BufWriter, Write}, time::Duration};
use crate::{error::{MatcherError, here}, folders::{self, ToCanoncialString}, model::... |
use super::{SendEvent, UdpConnectionConfig, UdpPacket, SequenceNumber};
use log::*;
use std::collections::HashMap;
use std::task::Waker;
use std::time::{Duration, Instant};
use tokio::sync::mpsc::UnboundedSender;
#[derive(Debug, PartialEq, Copy, Clone)]
pub(super) enum UdpConnectionState {
New,
SentHello,
... |
use crate::map::UV;
use crate::Color;
use crate::QuarchitectError;
use crate::Vector2;
use crate::Vector3;
// Game-specific extra data
#[derive(PartialEq, Debug)]
pub struct SurfaceData {
pub surface_contents: i32,
pub surface_flags: i32,
pub surface_value: f32,
}
impl SurfaceData {
fn new(surface_con... |
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 chainblocks::cstr;
use chainblock... |
use std::cmp::max;
use reqwest::{Client, Error as ReqwestError};
use crate::api::data::{Error as DataError, OwnedData};
use crate::api::nonce::{request_nonce, NonceError};
use crate::api::request::{ensure_success, ResponseError};
use crate::api::url::UrlBuilder;
use crate::file::remote_file::RemoteFile;
/// An actio... |
use std::sync::Arc;
use clap::{ArgEnum, Parser};
use log::{debug, error, info};
use tokio::sync::Mutex;
use wirepact_translator::{
run_translator, CheckRequest, EgressResult, IngressResult, Status, Translator,
TranslatorConfig, HTTP_AUTHORIZATION_HEADER,
};
use crate::provider::{ClientCredentialProvider, Prov... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.