text stringlengths 7.05k 33.9k |
|---|
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - PWM Control read address"]
pub con: CON,
#[doc = "0x04 - PWM Control set address"]
pub con_set: CON_SET,
#[doc = "0x08 - PWM Control clear address"]
pub con_clr: CON_CLR,
#[doc = "0x0c - Capture Control read add... |
// Copyright 2020 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 {
super::StashNode,
anyhow::{bail, format_err, Context, Error},
fidl::endpoints::create_proxy,
fidl_fuchsia_stash as fidl_stash,
fu... |
use super::*;
use byteorder::{LittleEndian, ReadBytesExt};
use std::error::Error;
use std::fs::File;
use std::io::{BufReader, Read};
use std::path::PathBuf;
const MAX_POLYS: i32 = 5000;
//const MIN_SECTOR: i32 = -25;
const MAX_SECTOR: i32 = 25;
//const MIN_SECTORZ: i32 = -35;
//const MAX_SECTORZ: i32 = 35;
//const TIL... |
use crate::sys;
/// Covers errors that can be returned by the steamworks API
///
/// Documentation is based on official documentation which doesn't
/// always explain when an error could be returned or its meaning.
#[derive(Debug, Fail)]
pub enum SteamError {
/// Returned if the steamworks API fails to initialize.... |
// This file is part of Substrate.
// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// 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
//
// ht... |
use std::cell::RefCell;
use std::collections::HashSet;
use std::convert::{TryFrom, TryInto};
use std::fmt::Debug;
use std::fs::File;
use std::io::{self, Read};
use std::ops::{Deref, DerefMut};
use std::path::Path;
use std::rc::Rc;
use std::sync::Arc;
use derive_more::{From, TryInto};
use rlua::prelude::{LuaContext, Lu... |
// Copyright 2021 Databricks, Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
// http://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to in writi... |
/*
This tool is part of the WhiteboxTools geospatial analysis library.
Authors: Dr. <NAME>
Created: 31/08/2017
Last Modified: 13/10/2018
License: MIT
*/
use crate::raster::*;
use crate::tools::*;
use num_cpus;
use std::env;
use std::f64;
use std::io::{Error, ErrorKind};
use std::path;
use std::sync::mpsc;
use std::syn... |
use std::fmt;
use std::{any::Any, sync::Arc};
use crate::{Analysis, DisplayAsDebug, EGraph, Id, Language, Pattern, SearchMatches, Subst, Var};
/// A rewrite that searches for the lefthand side and applies the righthand side.
///
/// The [`rewrite!`] is the easiest way to create rewrites.
///
/// A [`Rewrite`] consist... |
#[macro_use(slog_o)]
extern crate slog;
#[macro_use]
extern crate slog_scope;
// #[macro_use]
// extern crate tokio;
use byte_unit::Byte;
use chrono::Utc;
use clap::{arg_enum, value_t, App, Arg};
use slog::Drain;
use std::{
fs, io,
path::{Path, PathBuf},
process::Command,
str::FromStr,
time::Durati... |
//!
//! Implementation of the `Session` trait through the logind dbus interface.
//!
//! This requires systemd and dbus to be available and started on the system.
//!
//! ## How to use it
//!
//! ### Initialization
//!
//! To initialize a session just call `LogindSession::new`. A new session will be opened, if the
//! ... |
use super::{private::SealedItem, ParseError, Typecode};
use crate::kind;
use std::convert::{TryFrom, TryInto};
/// The set of known Receivers for Unified Addresses.
#[derive(Clone, Debug, PartialEq, Eq, Hash)]
pub enum Receiver {
Orchard([u8; 43]),
Sapling(kind::sapling::Data),
P2pkh(kind::p2pkh::Data),
... |
// Copyright 2021 <NAME>
// SPDX-License-Identifier: Apache-2.0
use crate::{
types::{ConsumedOutput, CreatedOutput, OutputDiff, Receipt},
workers::{
consensus::worker::EXTRA_PRUNING_DEPTH,
pruning::{
error::Error,
metrics::{ConfirmedDataPruningMetrics, MilestoneDataPruni... |
use std::collections::HashMap;
use super::{
address::{Address, Constant},
blockmap::BlockMap,
func::Func,
names::NameTable,
tac::*,
FunctionHead,
};
use crate::{
parse::{ast::*, token::Token},
resolve::{modmap::ModMap, symbol::SymbolTable, ResolveResult},
types::*,
};
#[derive(Debu... |
//! Module for ChaCha20-Poly1305 authenticated encryption with associated data (AEAD).
use crate::chacha20::ChaCha20;
use crate::gcm::AeadCipher;
use crate::util;
use byteorder::{ByteOrder as _, LittleEndian};
/// A ChaCha20-Poly1305 AEAD cipher.
pub struct ChaCha20Poly1305 {
key: [u8; 32],
}
impl AeadCipher for ... |
use log::{debug,error};
use std::cell::RefCell;
use std::convert::Infallible;
use std::error::Error;
use std::io;
use std::rc::Rc;
use std::task;
use smithay_client_toolkit::environment::SimpleGlobal;
use smithay_client_toolkit::environment::Environment;
use smithay_client_toolkit::environment;
use smithay_client_toolk... |
use line_reader::read_file_to_lines;
use std::cmp::Ordering;
use std::collections::BinaryHeap;
use std::fmt::{Debug, Display, Formatter};
pub(crate) fn day20_part1() -> usize {
shortest_path(read_file_to_lines("input/day20.txt"), Part::One)
}
pub(crate) fn day20_part2() -> usize {
shortest_path(read_file_to_l... |
// Copyright Materialize, Inc. 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 the Apache License... |
use crate::{data::*, *};
use cpal::{
traits::{DeviceTrait, HostTrait, StreamTrait},
BufferSize, SampleRate, Stream, StreamConfig, SupportedBufferSize, SupportedStreamConfigRange,
};
use std::{
cmp::{max, min, Ordering},
collections::VecDeque,
ptr,
sync::mpsc as smpsc,
};
use tokio::sync::mpsc as... |
//! Tree module that only preserves nodes to predetermined depth.
//! This tree always chooses the branch with the longest available "lineage".
//! When a new node is inserted and the current root is "too old", the root
//! is replaced with its child that leads to the longest branch, while
//! all other children are ab... |
use std::mem;
use std::ptr;
use std::ops::{Deref, DerefMut};
use std::cell::{Ref, RefMut};
use std::marker::PhantomData;
use wrap::*;
use handle::*;
use common::math::{Vec2, Transform};
use collision::shapes::{MassData, Shape};
use dynamics::world::{BodyHandle, JointHandle};
use dynamics::joints::JointEdge;
use dynamic... |
use std::ffi::OsStr;
use std::io::Cursor;
use std::path::{Path, PathBuf};
use hyper::body::Bytes;
pub enum FileContents {
Mmap(memmap2::Mmap),
Bytes(Bytes),
}
impl std::ops::Deref for FileContents {
type Target = [u8];
#[inline]
fn deref(&self) -> &[u8] {
match self {
FileCon... |
mod config;
#[macro_use]
extern crate clap;
#[macro_use]
extern crate pest;
extern crate serde_json;
use clap::{App};
use glob;
use std::path::{Path, PathBuf};
use crate::config::parse_config;
use std::collections::{HashMap, HashSet};
use std::process::{exit, Command};
use crc::{Crc, CRC_32_CKSUM};
use std::iter::Fro... |
//src/module_handling.rs: Module message handling
//Author: <NAME>
//Copyright (c) 2020 LAPS Group
//Distributed under the zlib licence, see LICENCE.
use crate::{
types::{BackendError, JobOutcome, JobResult},
util::{
create_redis_backend_key, create_redis_key, get_job_key, get_module_log_key,
g... |
use super::*;
use crate::{
build_env,
config::{Config, ExplicitRelease},
defaults,
github::{GithubReleases, Version},
};
use reqwest::Url;
use serde::Deserialize;
use solana_sdk::{
hash::{Hash, Hasher},
pubkey::Pubkey,
};
use std::{
fs::{self, File},
io::{self, BufReader, Read},
path... |
//!
//! Demonstrates use of the Flexible Static Memory Controller to interface with an ST7789 LCD
//! controller
//!
//! Hardware required: an STM32F412G-DISCO board
//!
//! Procedure: Compile this example, load it onto the microcontroller, and run it.
//!
//! Example run command: `cargo run --release --features stm32f... |
extern crate brain;
extern crate constants;
use brain::*;
use nannou::prelude::*;
#[derive(Clone, Debug)]
pub struct Mover {
pub position: Point2,
pub angle_index: usize,
pub old_angle_index: usize,
pub velocity_x: f32,
pub velocity_y: f32,
pub multiplier: i32,
pub sensor_data: [[f32; 2]; con... |
use super::common::*;
use crate::circuit::bridge::BridgeCircuit;
use arkworks_gadgets::{
arbitrary::bridge_data::Input as BridgeDataInput,
leaf::bridge::{
constraints::BridgeLeafGadget, BridgeLeaf, Private as LeafPrivate, Public as LeafPublic,
},
set::membership::{
constraints::SetMembershipGadget, Private as ... |
use rand::prelude::*;
use crate::keyboard::{KeyState, Keys};
use crate::state::{State, DISPLAY_HEIGHT, DISPLAY_WIDTH};
#[derive(Clone)]
pub struct Chip8 {
pub state: State, // initial program state
}
impl Chip8 {
pub fn new(program: &[u8]) -> Self {
Chip8 {
state: State::new(program),
... |
//! A module for configuration information
use std::collections::{BTreeMap, BTreeSet};
use std::convert::AsRef;
use std::iter::Sum;
use std::ops::Add;
use std::path::Path;
use std::{fmt, fs};
use anyhow::Result;
use cargo_lock::package::source::GitReference;
use cargo_metadata::Package;
use semver::VersionReq;
use se... |
use cgmath::InnerSpace;
use log::warn;
use std::fmt;
use ndcell_core::prelude::*;
use super::algorithms::raycast;
use super::generic::GridViewDimension;
use super::viewpoint::{CellTransform3D, Viewpoint3D};
use crate::commands::{DragCmd, DrawMode};
use crate::ext::FVecConvertExt;
use crate::mouse::MouseDisplayMode;
u... |
/*
#define SHAKE128_RATE 168
#define SHAKE256_RATE 136
void shake128(unsigned char *out,
unsigned long long outlen,
const unsigned char *in,
unsigned long long inlen);
void shake256(unsigned char *out,
unsigned long long outlen,
const unsigned char... |
use std::prelude::v1::*;
use crate::value::{LittleEndian, Value};
use std::cmp::Ordering;
use std::convert::{TryFrom, TryInto};
use std::fmt;
use std::mem;
use std::mem::size_of;
use wain_ast::{AsValType, ValType};
// Vec<Value> consumes too much space since its element size is always 16bytes.
// To use sp... |
use crate::error::Result;
use crate::io_utils::{Fill, MemMap};
use byteorder::{BigEndian, ByteOrder};
use std::borrow::Borrow;
use std::collections::BTreeMap;
use std::fmt;
use std::io::prelude::*;
use std::mem;
use std::ops::RangeInclusive;
use std::sync::Arc;
use std::u64;
const INDEX_META_SIZE: usize = mem::size_... |
use chrono::Utc;
use lorawan_encoding::{
default_crypto::DefaultFactory,
keys,
maccommands::{MacCommand, MacCommandIterator},
parser::{
parse as lorawan_parser, AsPhyPayloadBytes, DataHeader, DataPayload, EncryptedDataPayload,
EncryptedJoinAcceptPayload, FRMPayload, JoinRequestPayload, P... |
use std::sync::Arc;
use warp::{Filter, Rejection, Reply};
use crate::codegen::http_message_generated::{
get_root_as_http_message, HttpColumnValue, HttpColumnValueArgs, HttpError, HttpErrorArgs,
HttpMessageArgs, HttpQuery, HttpQueryArgs, HttpResultSet, HttpResultSetArgs, HttpRow,
HttpRowArgs,
};
use crate:... |
// Copyright 2014 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 ... |
pub mod adc {
pub const ABSOLUTE: u8 = 0x6D;
pub const ABSOLUTE_X_INDEXED: u8 = 0x7D;
pub const ABSOLUTE_Y_INDEXED: u8 = 0x79;
pub const IMMEDIATE: u8 = 0x69;
pub const INDIRECT_Y_INDEXED: u8 = 0x71;
pub const X_INDEXED_INDIRECT: u8 = 0x61;
pub const ZERO_PAGE: u8 = 0x65;
pub const ZERO_... |
use glfw;
use glfw::Context;
use gl;
use gl::types::{GLubyte, GLuint, GLchar, GLint, GLenum};
use chrono::prelude::Utc;
use std::string::String;
use std::ffi::CStr;
use std::ptr;
use std::fs::{File, OpenOptions};
use std::io::{Read, Write, BufReader};
use std::fmt::Write as FWrite;
use std::cell::Cell;
use std::sync::... |
mod sql_schema_calculator_flavour;
pub(super) use sql_schema_calculator_flavour::SqlSchemaCalculatorFlavour;
use crate::{flavour::SqlFlavour, SqlDatabaseSchema};
use datamodel::{
datamodel_connector::{walker_ext_traits::*, ReferentialAction, ScalarType},
dml::{prisma_value, PrismaValue},
parser_database::... |
use crate::contexts::ComplexFunctions;
use crate::{power_series::PowerSeries, traits::MyReal};
use log::{debug, info};
use num::Complex;
/**
Computing $\hat\Phi(s)$
Here we'd like to integrate $\hat\phi(s) = \frac{x^s}{s} \exp(\lambda^2 s^2 / 2)$. We basically follow the method in [Section 6, Platt] but with a small... |
//! A sequence Uid is an unique identifier that maintains
//! a total order of sequential elements in a distributed
//! environment.
//!
//! ## Implementation Notes
//!
//! New Uids are generated with a variant of the LSEQ
//! algorithm. It diverges from the original paper by
//! choosing allocation strategy determinis... |
use std::collections::HashMap;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use std::thread;
use std::time::{Duration, Instant};
use futures::channel::mpsc::unbounded;
use futures::future;
use futures::stream::StreamExt;
use rand::Rng;
use crate::proto::raftpb::*;
use crate::raft;
use ... |
//! A fast, chunk-friendly implementation of Naive Surface Nets on regular grids.
//!
//! 
//!
//! Surface Nets is an algorithm for extracting an isosurface mesh from a [signed distance
//! field](ht... |
use std::convert::TryInto;
use secrecy::Secret;
use crate::ciphersuite::{CipherSuite, DefaultCipherSuite, Kex, PublicKey, SecretValue};
use crate::crypto::decrypt_with_context;
use crate::key::{gen_keypair, HPKEPrivateKey, HPKEPublicKey};
use crate::message::HPKECiphertext;
use elliptic_curve::{point::Generator, weie... |
/// Metadata common to all Datastore Admin operations.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CommonMetadata {
/// The time that work began on the operation.
#[prost(message, optional, tag="1")]
pub start_time: ::core::option::Option<::prost_types::Timestamp>,
/// The time the operatio... |
use std::rc::Rc;
use crate::router::{IntoPattern, ResourceDef};
use crate::service::{boxed, IntoServiceFactory, ServiceFactory};
use crate::util::Extensions;
use super::config::AppConfig;
use super::dev::insert_slesh;
use super::error::ErrorRenderer;
use super::guard::Guard;
use super::request::WebRequest;
use super:... |
use std::cmp;
use std::fmt;
use std::io::BufRead;
use std::mem;
use std::sync::RwLock;
use std::time::Instant;
use std::u64;
use protobuf;
use protobuf::Message as PbMsg;
use raft::eraftpb::Entry;
use crate::util::{duration_to_sec, HashMap, HashSet};
use super::config::Config;
use super::log_batch::{Command, LogBatc... |
// Copyright 2020 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 {
anyhow::{Context, Result},
fuchsia_syslog::fx_log_err,
intl_model as model, libc, rust_icu_common as ucommon, rust_icu_sys as usys,
r... |
use ines::Ines;
use mos6502_assembler::{Addr, Block, LabelRelativeOffset, LabelRelativeOffsetOwned};
use mos6502_model::{interrupt_vector, Address};
pub const PRG_START: Address = 0xC000;
pub const INTERRUPT_VECTOR_START_PC_OFFSET: Address = interrupt_vector::START_LO - PRG_START;
pub const INTERRUPT_VECTOR_NMI_OFFSET... |
// 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 in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
#![recursion_limit = "128"]
#![cfg_attr(nightly, feature(pr... |
// use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use plist::Value;
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
use std::error::Error;
use std::fmt;
use std::io::{Error as IoError, Read, Seek, Write};
use std::mem::size_of;
//... |
#![warn(missing_docs)]
use std::{cell::UnsafeCell, collections::HashMap};
use crossbeam::channel::unbounded;
use futures::{
channel::{mpsc, oneshot},
StreamExt,
};
use once_cell::sync::OnceCell;
use snafu::ResultExt;
use spdk_sys::{spdk_get_thread, SPDK_BDEV_LARGE_BUF_MAX_SIZE};
use crate::{
bdev::Verbo... |
// 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 super::{callbacks::Callbacks, Bucket, OperationProvider};
use qiniu_apis::{
http::{ResponseErrorKind as HttpResponseErrorKind, ResponseParts, StatusCode},
http_client::{
ApiResult, CallbackResult, RegionsProvider, RegionsProviderEndpoints, RequestBuilderParts, Response,
ResponseError, Respon... |
//! Recovers high-level control-flow constructs from a control-flow graph.
//! Implements the algorithm described in
//! [*No More Gotos*](https://doi.org/10.14722/ndss.2015.23185)
#![allow(dead_code)]
pub mod ast_context;
pub mod condition;
pub mod export;
mod ast;
mod dedup_conds;
mod graph_utils;
mod refinement;
... |
//!
//! A simple reverse proxy, to be used with [Hyper].
//!
//! The implementation ensures that [Hop-by-hop headers] are stripped correctly in both directions,
//! and adds the client's IP address to a comma-space-separated list of forwarding addresses in the
//! `X-Forwarded-For` header.
//!
//! The implementation is... |
use super::{Event, EventMapped, EventStream};
use crate::decode::Message;
use crate::events;
use crate::Parse;
use std::any::{Any, TypeId};
use std::collections::HashMap;
use std::sync::Arc;
use tokio::sync::mpsc;
type EventRegistration = Vec<(bool, Box<dyn Any + Send>)>;
/**
An event dispatcher
This allows multip... |
//! Hypercore's main abstraction. Exposes an append-only, secure log structure.
use crate::feed_builder::FeedBuilder;
use crate::replicate::{Message, Peer};
pub use crate::storage::{Node, NodeTrait, Storage, Store};
use crate::audit::Audit;
use crate::bitfield::Bitfield;
use crate::crypto::{
generate_keypair, sig... |
use serde::Serialize;
#[serde(untagged)]
#[derive(Serialize, Clone, Debug)]
pub enum ColorWrapper {
S(String),
F(f64),
}
impl PartialEq for ColorWrapper {
fn eq(&self, other: &Self) -> bool {
let lhs = match self {
ColorWrapper::S(v) => v.to_owned(),
ColorWrapper::F(v) => f... |
use std::f32::consts::PI;
use std::os::raw::c_void;
use std::path::Path;
use std::process;
use std::time::Instant;
use cgmath::{ Deg, Point3 };
use collision::Aabb;
use gl;
use gltf;
use glutin;
use glutin::{
Api,
MouseScrollDelta,
MouseButton,
GlContext,
GlRequest,
GlProfile,
VirtualKeyCod... |
//! Implements management and use of language servers.
pub(crate) mod utils;
pub(crate) use utils::SendNotificationError;
use {
crate::io::{LanguageId, Purl},
core::{
cell::{Cell, RefCell},
convert::{TryFrom, TryInto},
fmt::{self, Display},
},
enum_map::{enum_map, EnumMap},
... |
use crate::image;
use crate::session::Rgb8;
use crate::view::layer::LayerId;
use crate::view::ViewExtent;
use super::pixels::{PixelFormat, Pixels};
use nonempty::NonEmpty;
use rgx::color::{Bgra8, Rgba8};
use rgx::rect::Rect;
use gif::{self, SetParameter};
use miniserde::json;
use std::collections::BTreeMap;
use st... |
use crate::igor::BuildData;
use serde::{Deserialize, Serialize};
use std::path::PathBuf;
macro_rules! path {
($($arg:tt)*) => {{
let res = std::path::PathBuf::from(std::fmt::format(format_args!($($arg)*)));
res
}}
}
#[derive(Debug, Serialize, Deserialize)]
pub struct GmMacros {
#[serde(ren... |
use crate::scenes::webgl::common::*;
use crate::start_webgl;
use awsm_web::webgl::{BeginMode, BufferMask, Id, WebGlCommon, WebGlRenderer,
PixelFormat, SimpleTextureOptions, TextureTarget,
WebGlTextureSource,
RenderBufferFormat,
FrameBufferTarget,
FrameBufferAttachment,
FrameBufferTextureTarget,
... |
//! Operations on a HugeTLB subsystem.
//!
//! [`Subsystem`] implements [`Cgroup`] trait and subsystem-specific operations.
//!
//! For more information about this subsystem, see the kernel's documentation
//! [Documentation/cgroup-v1/hugetlb.txt].
//!
//! # Examples
//!
//! ```no_run
//! # fn main() -> controlgroup::R... |
use crate::change::OSMObjectChange;
use crate::change_iterator::OSMObjectChangeIterator;
use crate::object::{OSMObject, OSMObjectFromNetwork, OSMObjectSpecifics, OSMObjectType};
use crate::overpass_api_server::OverpassApiServer;
use crate::utils;
use crate::{Error, Result};
use chrono::{DateTime, Utc};
use geo_types::{... |
use crate::{
buffers::Indicator,
handles::{Statement, StatementImpl},
parameter::VarCharSliceMut,
ColumnDescription, DataType, Error, Output,
};
use std::{
borrow::BorrowMut,
char::{decode_utf16, REPLACEMENT_CHARACTER},
cmp::max,
convert::TryInto,
marker::PhantomData,
thread::pa... |
use noise::{NoiseFn, Perlin};
use noise::Seedable;
use nalgebra::Vector3;
use nalgebra::Vector2;
use nalgebra::Rotation2;
use bevy::render::mesh::Mesh;
use bevy::render::render_resource::Extent3d;
use bevy::render::render_resource::TextureDimension;
use bevy::render::render_resource::PrimitiveTopology;
use bevy::render... |
// High-level Internal Representation of GObject artifacts
//
// Here we provide a view of the world in terms of what GObject knows:
// classes, interfaces, signals, etc.
//
// We construct this view of the world from the raw Abstract Syntax
// Tree (AST) from the previous stage.
use std::collections::HashMap;
use pr... |
//! Tombstone cache
use backoff::{Backoff, BackoffConfig};
use cache_system::{
backend::{
lru::{LruBackend, ResourcePool},
resource_consumption::FunctionEstimator,
shared::SharedBackend,
},
driver::Cache,
loader::{metrics::MetricsLoader, FunctionLoader},
};
use data_types::{Sequ... |
//!
//! # Partition & Partitions Metadata
//!
//! Partition metadata information on cached in the local Controller.
//!
use log::trace;
use log::debug;
use log::error;
use log::warn;
use types::log_on_err;
use flv_metadata::partition::PartitionSpec;
use flv_metadata::partition::PartitionResolution;
use flv_metadata::p... |
// std
// crates
use lazy_static::lazy_static;
use pest::{
error::Error,
prec_climber::{Assoc, Operator, PrecClimber},
Parser,
};
use pest_derive::*;
// local
mod eval;
use eval::{evaluate_constant, evaluate_function, evaluate_simple_expression};
mod conversions;
use conversions::LannerUnit as Unit;
mod... |
use serde_derive::{Deserialize, Serialize};
use std::io::{BufRead, Write};
use std::path::PathBuf;
use super::viewer::{SourceType, Viewer};
use crate::ui::cursor;
use terminal_size::terminal_size;
use termion;
const PROMPT: &'static str = "> ";
#[derive(Clone, PartialEq)]
pub enum PromptMode {
Prompt,
Histor... |
#![feature(try_find)]
#![feature(box_syntax)]
#![feature(box_patterns)]
// Often required due to clones; also false positives from type aliases
#![allow(clippy::ptr_arg)]
use crate::intrinsics::Intrinsics;
use common::{bench, mutrc_new, ModulePath, MutRc};
use gir_nodes::{
declaration::Visibility,
expression::... |
pub fn run(config: Config) -> Result<String, std::io::Error> {
match config.cmd {
CMD::Init{ path } => init(&path),
CMD::Doc{ path } => doc(&path),
CMD::Did{ path } => did(&path),
CMD::Messages{ path } => messages(&path),
CMD::Connect{ path, name, did } => connect(&path, &nam... |
// Copyright 2015-2021 Swim Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to ... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Control Register"]
pub twihs_cr: TWIHS_CR,
#[doc = "0x04 - Master Mode Register"]
pub twihs_mmr: TWIHS_MMR,
#[doc = "0x08 - Slave Mode Register"]
pub twihs_smr: TWIHS_SMR,
#[doc = "0x0c - Internal Address Regist... |
use crate::renderer::context::{FileContext, MetadataContext};
use crate::renderer::template::{helper, FILE_TEMPLATE_NAME, METADATA_TEMPLATE_NAME, TEMPLATE_EXT};
use crate::renderer::{Renderer, RendererConfig};
use crate::{DisplayNormalized, CONFIG_FILE_NAME};
use anyhow::{Context, Result};
use handlebars::Handlebars;
u... |
// Copyright 2019 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 {
crate::{
block::PropertyFormat,
block_type::BlockType,
reader::snapshot::{ScannedBlock, Snapshot},
utils, Inspect... |
use common::{Event, KeyState};
use scancode::Scancode;
use std::cell::RefCell;
use std::char::{from_u32_unchecked, REPLACEMENT_CHARACTER};
use std::collections::vec_deque::VecDeque;
use std::io::Error;
use std::{mem, ptr};
use winapi::shared::minwindef::{BYTE, UINT};
use winapi::shared::windef::{HHOOK, HWND};
use wi... |
use std::cmp::Ordering;
#[derive(PartialEq, Debug)]
enum StringElement<'a> {
Digits(&'a str),
Characters(&'a str),
}
struct StringElementIter<'a> {
str: &'a str,
}
impl<'a> Iterator for StringElementIter<'a> {
type Item = StringElement<'a>;
fn next(&mut self) -> Option<Self::Item> {
matc... |
use std::collections::BTreeMap;
use std::ffi::OsStr;
use std::fs::OpenOptions;
use std::io::{BufReader, BufWriter, Read, Write};
use tracing::{event, span, Level};
#[cfg(test)]
use crate::parser::HoldBit;
use crate::parser::{
source_file, ErrorLocation, ManuscriptBlock, ManuscriptItem, ManuscriptMetaCommand, Orig... |
use super::imports::*;
use cfg_if::cfg_if;
use std::{
borrow::Cow,
iter::{FromIterator, FusedIterator},
mem::size_of,
};
/// Ancillary data to be sent through a Unix domain socket or read from an input buffer.
///
/// Ancillary data gives unique possibilities to Unix domain sockets which no other POSIX API... |
// Copyright 2012-2015 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-MI... |
use {
clap::{value_t, value_t_or_exit, App, Arg},
fd_lock::FdLock,
safecoin_clap_utils::{
input_parsers::{pubkey_of, pubkeys_of, value_of},
input_validators::{
is_pubkey, is_pubkey_or_keypair, is_slot, is_url_or_moniker,
normalize_to_url_if_moniker,
},
},
... |
use std::fmt::Display;
use std::time::Duration;
use async_std::net::{SocketAddr, ToSocketAddrs};
use async_std::pin::Pin;
use async_trait::async_trait;
use log::{debug, info};
use pin_project::pin_project;
use crate::smtp::authentication::{
Credentials, Mechanism, DEFAULT_ENCRYPTED_MECHANISMS, DEFAULT_UNENCRYPTED... |
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.
use crate::colors;
use crate::create_main_worker;
use crate::file_fetcher::File;
use crate::flags::Flags;
use crate::fs_util;
use crate::media_type::MediaType;
use crate::module_graph;
use crate::program_state::ProgramState;
use crate::tokio_ut... |
//! all the network related actions and processes
//!
//! This module only provides and handle the different connections
//! and act as message passing between the other modules (blockchain,
//! transactions...);
//!
pub mod bootstrap;
mod client;
mod convert;
mod grpc;
pub mod p2p;
mod service;
mod subscription;
use... |
// Copyright (c) Facebook, Inc. and its affiliates.
// Copyright (c) 2021-2022 Toposware, Inc.
//
// This source code is licensed under the MIT license found in the
// LICENSE file in the root directory of this source tree.
//! An implementation of a 64-bit STARK-friendly prime field with modulus $2^{64} - 2^{32} + 1$... |
extern crate env_logger;
extern crate faerie;
extern crate failure;
extern crate goblin;
extern crate structopt;
extern crate target_lexicon;
use failure::Error;
use structopt::StructOpt;
use target_lexicon::{Architecture, BinaryFormat, Environment, OperatingSystem, Triple, Vendor};
use faerie::{ArtifactBuilder, Decl... |
use async_channel::{Receiver, Sender};
use futures_lite::io::{AsyncRead, AsyncWrite};
use futures_lite::stream::Stream;
use futures_timer::Delay;
use log::*;
use std::collections::VecDeque;
use std::convert::TryInto;
use std::fmt;
use std::future::Future;
use std::io::{self, Error, ErrorKind, Result};
use std::pin::Pin... |
//! MMC name resolution pass.
use std::sync::Arc;
use std::collections::{HashMap, hash_map::Entry};
use std::{rc::Rc, result::Result as StdResult};
use crate::elab::{
Result, ElabError,
local_context::try_get_span_from,
environment::{AtomID, Environment}};
use crate::util::FileSpan;
use super::{Compiler, types::{... |
use std::fmt::Display;
use std::{io::Error, str::FromStr};
use proc_macro2::{Ident, Span, TokenStream as TokenStream2};
use proc_macro_error::abort;
use quote::{format_ident, quote, ToTokens};
use syn::{parenthesized, parse::Parse, Token};
use crate::{component_type::ComponentType, security_requirement::SecurityRequi... |
use std::cmp::Ordering;
use std::hint::unreachable_unchecked;
use rle::Searchable;
use super::*;
use std::ops::AddAssign;
// TODO: All these methods should be unsafe and have safe wrappers in safe_cursor.
impl<E: ContentTraits, I: TreeMetrics<E>, const IE: usize, const LE: usize> UnsafeCursor<E, I, IE, LE> {
pub... |
//! Communications Class Device for USB
//!
//! This capsule allows Tock to support a serial port over USB.
use core::cell::Cell;
use core::cmp;
use super::descriptors;
use super::descriptors::Buffer64;
use super::descriptors::CdcInterfaceDescriptor;
use super::descriptors::EndpointAddress;
use super::descriptors::En... |
use std::cmp::Reverse;
use std::collections::{BTreeMap, BinaryHeap};
use std::fs::{File, OpenOptions};
use std::io::{BufReader, BufWriter, Read, Seek, Write};
use std::path::{Path, PathBuf};
use std::sync::{Arc, Mutex};
use crate::memtable::Memtable;
use crate::protos::messages::{Command, CommandType};
use crate::type... |
//! Non-finalized chain state management as defined by [RFC0005]
//!
//! [RFC0005]: https://zebra.zfnd.org/dev/rfcs/0005-state-updates.html
use std::{collections::BTreeSet, mem, sync::Arc};
use zebra_chain::{
block::{self, Block},
history_tree::HistoryTree,
orchard,
parameters::Network,
sapling, s... |
// http://cr.yp.to/mac/poly1305-20050329.pdf
use std::convert::TryInto;
use byteorder::{ByteOrder, LittleEndian};
#[derive(Clone, Default)]
struct Poly1305 {
r: [u32; 5],
h: [u32; 5],
pad: [u32; 4],
}
impl Poly1305 {
pub fn new(r: &[u8; 16], s: &[u8; 16]) -> Self {
let mut poly = Self::defau... |
#![allow(mixed_script_confusables)]
use nannou::prelude::*;
mod circ_harmonics;
mod spherical_harmonics;
use circ_harmonics::*;
use spherical_harmonics::SphericalHarmonics;
use std::f32::consts::PI;
const TWOPI: f32 = PI * 2.0;
// -------------------------------------------------------
struct Model {
_window: w... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.