text stringlengths 3.09k 13.9k |
|---|
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//! Manages the per-connection flow-control window
use crate::{
contexts::{OnTransmitError, WriteContext},
sync::{IncrementalValueSync, ValueToFrameWriter},
transmission,
};
use alloc::rc::Rc;
use ... |
use gettextrs::*;
use gtk::prelude::*;
use gtk::subclass::prelude::*;
use gtk::CompositeTemplate;
use std::rc::Rc;
use crate::app::components::utils::{wrap_flowbox_item, Debouncer};
use crate::app::components::{AlbumWidget, ArtistWidget, Component, EventListener};
use crate::app::dispatch::Worker;
use crate::app::mode... |
pub mod impls;
mod merkle_hasher;
mod merkleize_padded;
mod merkleize_standard;
pub use merkle_hasher::{Error, MerkleHasher};
pub use merkleize_padded::merkleize_padded;
pub use merkleize_standard::merkleize_standard;
use eth2_hashing::{hash_fixed, ZERO_HASHES, ZERO_HASHES_MAX_INDEX};
pub const BYTES_PER_CHUNK: usiz... |
use std::{
env,
ffi::{OsStr, OsString},
option::Option,
path::Path,
};
use clap::{App, Arg, ArgMatches, SubCommand};
use cli_table::{self, print_stdout, Cell, CellStruct, Table, TableStruct};
use dyn_clone::DynClone;
use generated_types::{
handler_service_client::HandlerServiceClient, HandlerState... |
pub mod parcel;
use crate::actors::engine::RillEngine;
use crate::actors::recorder::{Recorder, RecorderLink};
use crate::config::EngineConfig;
use crate::tracers::meta::PathTracer;
use anyhow::Error;
use async_trait::async_trait;
use meio::{
ActionHandler, Actor, Context, Eliminated, Id, IdOf, InstantActionHandler... |
use crate::headers::from_headers::*;
use crate::resources::document::{Document, DocumentAttributes};
use crate::ResourceQuota;
use azure_core::headers::{
continuation_token_from_headers_optional, item_count_from_headers, session_token_from_headers,
};
use azure_core::SessionToken;
use chrono::{DateTime, Utc};
use ... |
use super::{
directory_stack::DirectoryStack,
escape::{escape, unescape},
variables::Variables,
};
use glob::glob;
use liner::{Completer, FilenameCompleter};
use smallvec::SmallVec;
use std::{iter, str};
/// Performs escaping to an inner `FilenameCompleter` to enable a handful of special cases
/// needed b... |
use crate::ast::ParsedDateTime;
use crate::parser::{DateTimeField, ParserError};
pub(crate) fn tokenize_interval(value: &str) -> Result<Vec<IntervalToken>, ParserError> {
let mut toks = vec![];
let mut num_buf = String::with_capacity(4);
fn parse_num(n: &str, idx: usize) -> Result<IntervalToken, ParserErro... |
use termion::event::{Event};
use crate::widget::{Widget, WidgetCore};
use crate::coordinates::{Coordinates, Size, Position};
use crate::fail::{HResult, HError, ErrorLog};
#[derive(Debug, PartialEq)]
pub struct HBox<T: Widget> {
pub core: WidgetCore,
pub widgets: Vec<T>,
pub ratios: Option<Vec<usize>>,
... |
use crate::App;
use anyhow::Error;
use dashmap::{DashMap, SharedValue};
use diesel::{pg::upsert::excluded, prelude::*};
use std::collections::HashMap;
use std::sync::atomic::{AtomicI64, AtomicUsize, Ordering};
/// starships.in receives a lot of download requests, and we can't execute a write query to the
/// database ... |
use crate::model::link::Links;
use crate::model::relationship::Relationships;
use crate::model::{error, Meta};
use crate::Result;
use serde::{Deserialize, Serialize};
use std::cmp::Ordering;
use std::collections::HashMap;
use std::collections::HashSet;
use std::fmt::Debug;
use std::hash::Hash;
use std::iter::FromIterat... |
//! Memory management for executable code.
use crate::function_table::FunctionTable;
use region;
use std::{cmp, mem};
use wasmtime_environ::{Compilation, CompiledFunction};
use wasmtime_runtime::{Mmap, VMFunctionBody};
/// Memory manager for executable code.
pub struct CodeMemory {
current: (Mmap, FunctionTable),... |
use std::f32::consts::PI;
use bevy::prelude::*;
use bevy_prototype_lyon::entity::ShapeBundle;
use bevy_prototype_lyon::prelude::*;
use bevy_prototype_lyon::shapes::RectangleOrigin;
use heron_core::CollisionShape;
use heron_rapier::convert::IntoBevy;
use heron_rapier::rapier2d::geometry::{ColliderHandle, ColliderSet, ... |
use egui::{AlphaImage, ClippedMesh, ColorImage, Context, ImageData, TextureId, TexturesDelta};
use hashbrown::hash_map::{Entry, HashMap};
use sierra::{
AccessFlags, ComponentMapping, Encoder, Extent2d, Extent3d, ImageInfo, ImageView,
ImageViewInfo, Offset3d, OutOfMemory, SubresourceLayers,
};
use winit::{event:... |
//! Authentication related structure and functions
use std::env;
use crate::{conv, enums::*, functions::*, types::*};
/// Main struct to authenticate a user
///
/// You need to create an instance of it to start an authentication process. If you
/// want a simple password-based authentication, you can use `Client::wit... |
use std::fs::File;
use rand::{Rng, SeedableRng};
use rand_xorshift::XorShiftRng;
use serde::Deserialize;
use abstutil::{prettyprint_usize, MapName, Timer};
use geom::{Polygon, Ring};
use kml::ExtraShapes;
use crate::configuration::ImporterConfiguration;
use crate::utils::{download, download_kml, osmconvert};
fn inp... |
extern crate serde;
extern crate serde_json;
extern crate gethrpc;
extern crate shapeshift;
extern crate emerald_core as emerald;
#[macro_use]
extern crate nickel;
#[macro_use]
extern crate serde_derive;
extern crate bincode;
extern crate leveldb;
extern crate hyper;
extern crate time;
extern crate hex;
use bincode... |
use {
super::Sort,
crate::pattern::*,
clap::ArgMatches,
};
/// Options defining how the tree should be build and|or displayed
#[derive(Debug, Clone)]
pub struct TreeOptions {
pub show_hidden: bool, // whether files whose name starts with a dot should be shown
pub only_folders: bool, // whether to h... |
use crate::{tag_from_bytes, Tag};
use core::fmt;
use super::lang_data::*;
/// Chinese, Japanese and Korean languages.
#[derive(Copy, Clone, PartialEq, Eq, Hash, Debug)]
#[repr(u8)]
pub enum Cjk {
None = 0,
Traditional = 1,
Simplified = 2,
Japanese = 3,
Korean = 4,
}
/// Representation of a langua... |
use std::io;
use std::net::SocketAddr;
use std::sync::Arc;
use futures::future::try_join;
use tokio;
use tokio::net::TcpListener;
use tokio::net::TcpStream;
use tokio::prelude::*;
use tokio::time::{timeout, Duration};
use super::config::ClientConfig;
use super::crypto::{Crypto, KeyPair};
use super::socks5;
use super:... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! This module implements a checker for verifying that a script, public(script), or other entry
//! point function a valid signature, which entails
//! - (DEPRECATED) All signer arguments are occur before non-signer arguments
//! - (DE... |
use crate::game_of_life::{Board, Cell};
use crate::prettier_printer::{PrettierPrinter, Seed};
use crossterm::cursor;
use crossterm::cursor::{MoveTo, MoveToNextLine};
use crossterm::event::poll;
use crossterm::style::{Color, Colors, Print, SetBackgroundColor, SetColors};
use crossterm::terminal::{disable_raw_mode, enabl... |
//! Providing auxiliary information for signals.
use std::io::Error;
use std::mem;
use std::ptr;
use libc::{c_int, EINVAL};
use crate::consts::signal::*;
use crate::low_level;
#[derive(Clone, Copy, Debug)]
enum DefaultKind {
Ignore,
#[cfg(not(windows))]
Stop,
Term,
}
struct Details {
signal: c_... |
// 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 {
anyhow::{Context as _, Error},
async_trait::async_trait,
fdio,
fidl::endpoints::{DiscoverableProtocolMarker, Proxy},
fidl_fuchsia... |
#[derive(Clone, Default, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub struct Script {
pub commands: Vec<Command>,
pub dependents: Vec<Script>,
}
impl Script {
pub fn new() -> Self {
Default::default()
}
pub fn is_empty(&self) -> bool {
self.commands.is_empty() && self.dependents.is_... |
mod impls;
use borsh::{BorshDeserialize, BorshSerialize};
use once_cell::unsync::OnceCell;
use crate::env;
use crate::store::lazy::{load_and_deserialize, serialize_and_store};
use crate::utils::{CacheEntry, EntryState};
use crate::IntoStorageKey;
/// An persistent lazily loaded option, that stores a `value` in the s... |
use std::{convert::TryFrom, fmt::Display, num::ParseIntError, str::FromStr};
use itertools::Itertools;
use crate::Error;
/// A number within a ,v file: this is generally a sequence of dotted, positive
/// integers, such as `1.1` or `1.1.2.2.2.1`.
///
/// Note that these come in two closely related variants: branches... |
// 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 ... |
use encodelib::chartable::CharTable;
use encodelib::utils::Utils;
use serde::{Deserialize, Serialize};
use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt};
use encoding::all::WINDOWS_1252;
use encoding::{DecoderTrap, EncoderTrap, Encoding};
use std::env;
use std::fs::File;
use std::io::prelude::*;
use std::i... |
// The MIT License (MIT)
// Copyright © 2021 Aukbit Ltd.
//
// 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, mo... |
// EndBASIC
// Copyright 2021 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not
// use this file except in compliance with the License. You may obtain a copy
// of the License at:
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agre... |
// Copyright (c) 2018-2022 The MobileCoin Foundation
//! Implements the service logic for the Fog Overseer.
//!
//! This is encapsulated by Fog Oveseer Server, and it in turn encapsulates the
//! OverseerWorker, which contains the overseer busines logic.
//!
//! HTTP Client -> Overseer Rocket Server -> *OverseerServic... |
use crate::db::DB;
use crate::workload::Workload;
use rand::distributions::{Alphanumeric, DistString};
use rand::rngs::SmallRng;
use rand::SeedableRng;
use std::collections::HashMap;
use std::sync::Mutex;
use crate::generator::{
AcknowledgedCounterGenerator, ConstantGenerator, CounterGenerator, DiscreteGenerator,
... |
use anyhow::{Context, Error, Result};
use std::fs::File;
use std::path::PathBuf;
use std::sync::{Arc, Mutex};
use crate::storage::Store;
use crate::ui::summary;
/// A configuration bundle for the recorder
pub struct Config {
/// The format to use for recorded traces. See `OutputFormat` for a list of available opt... |
use std::hash::{BuildHasher, Hasher};
/// Hasher for MurmurHash3 64-bit implementation of the 128-bit hashing algorithm.
#[derive(Default)]
pub struct Murmur3Hasher128x64 {
buffer: Vec<u8>,
}
impl Hasher for Murmur3Hasher128x64 {
fn write(&mut self, bytes: &[u8]) {
self.buffer.extend(bytes)
}
... |
use std::ops::Add;
use multiversion::multiversion;
use crate::bitmap::utils::{BitChunkIterExact, BitChunksExact};
use crate::datatypes::{DataType, IntervalUnit};
use crate::error::{ArrowError, Result};
use crate::scalar::*;
use crate::types::simd::*;
use crate::types::NativeType;
use crate::{
array::{Array, Primi... |
/*
MIT License
Copyright (c) 2019, 2020 <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, d... |
mod element;
mod style;
mod update;
use crate::{
addon::{Addon, AddonState},
config::{load_config, Config, Flavor},
curse_api,
error::ClientError,
tukui_api, wowinterface_api, Result,
};
use iced::{
button, pick_list, scrollable, Application, Column, Command, Container, Element, Length,
Set... |
/*!
This module defines the CommonTokens type,
used to pass constants of type from `syn` to
many functions in the `abi_stable_derive_lib::stable_abi` module.
*/
use proc_macro2::Span;
use crate::{
*,
fn_pointer_extractor::FnParamRet,
};
use std::cmp::{Eq, Ord, Ordering, PartialEq, PartialOrd};
macro_rule... |
use std::io;
use nom::be_u8;
use num_traits::FromPrimitive;
use rand::{CryptoRng, Rng};
use crate::crypto::hash::HashAlgorithm;
use crate::errors::Result;
use crate::ser::Serialize;
const EXPBIAS: u32 = 6;
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct StringToKey {
typ: StringToKeyType,
hash: HashAlgori... |
use std::fmt;
#[repr(C)]
#[derive(Clone, Copy, Debug)]
pub struct Axis(f32);
impl Axis {
pub fn get(self) -> f32 {
self.0
}
pub fn set_value(&mut self, value: f32) {
if value < 0.0 || value > 1.0 {
panic!("invalid axis value: {}", value);
}
self.0 = value;
}
}
#[repr(C)]
#[derive(Clon... |
use cards::value;
use cards::value::Value;
use cards::card::Card;
use std::fmt;
use shoe::shoe::DirectShoe;
pub const INDEX_TO_SCORE: [u32;13] = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10];
pub fn score_for_value(v: &Value) -> u32 {
return INDEX_TO_SCORE[v.index()];
}
pub struct BJHand {
score: u32,
ace_... |
use kitsune_p2p_types::{agent_info::AgentInfoInner, dht_arc::DhtArc};
pub use crate::test_util::spawn_handler;
use super::*;
// TODO: integrate with `HandlerBuilder`
async fn standard_responses(
agents: Vec<(Arc<KitsuneAgent>, AgentInfoSigned)>,
with_data: bool,
) -> MockKitsuneP2pEventHandler {
let mut ... |
use crate::model::*;
use async_std::prelude::*;
use encoding::EncodingRef;
use http::header::{HeaderMap, HeaderName, ACCEPT_ENCODING, CONTENT_LENGTH, HOST};
use smallvec::{smallvec, SmallVec};
use std::collections::HashSet;
pub async fn write_request(
rw: &mut Connection,
req: &Request,
config: &ClientConf... |
use ark_ff::{PrimeField, UniformRand, Zero};
use ark_poly::Polynomial;
use ark_std::test_rng;
use fflonk::{Poly, FflonkyKzg};
use crate::{VanillaPlonkAssignments, DecoyPlonk};
use fflonk::pcs::PCS;
use ark_std::rand::Rng;
use fflonk::fflonk::Fflonk;
use ark_std::{end_timer, start_timer};
use fflonk::pcs::PcsParams;
use... |
use std::time::Instant;
use futures_lite::{
future::{block_on, try_zip},
io::{copy, split},
};
use glommio::{
net::{TcpListener, TcpStream},
prelude::*,
};
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
runtime::{Builder, Handle, Runtime},
sync::oneshot,
};
#[derive(Copy, Clone)]
struct T... |
use apu::envelope::Envelope;
use apu::length_counter::LengthCounter;
use log::{debug, info};
const EIGHTH_DUTY_CYCLE: [u8; 8] = [0, 0, 0, 0, 0, 0, 0, 1];
const QUARTER_DUTY_CYCLE: [u8; 8] = [0, 0, 0, 0, 0, 0, 1, 1];
const HALF_DUTY_CYCLE: [u8; 8] = [0, 0, 0, 0, 1, 1, 1, 1];
const NEGATIVE_QUARTER_DUTY_CYCLE: [u8; 8] =... |
use actix::{Handler, Message, MessageResult};
use chrono;
use diesel;
use diesel::prelude::*;
use serde_json;
use uuid;
use crate::db::schema::test_item;
#[derive(Debug, Insertable, Queryable, Clone, Identifiable)]
#[table_name = "test_item"]
pub struct TestItemDb {
pub id: String,
pub parent_id: String,
p... |
// Copyright 2020 Palantir Technologies, 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 a... |
use crate::{
algorithms::Bounded,
components::{
BoundingBox, Dimension, DrawingObject, Geometry, Layer, LineStyle,
PointStyle,
},
primitives::{Line, Point},
render::Viewport,
Vector,
};
use kurbo::{Circle, Size};
use piet::{Color, RenderContext};
use shred_derive::SystemData;
use... |
// Copyright (c) 2017-present PyO3 Project and Contributors
use proc_macro2::{Span, TokenStream};
use quote::ToTokens;
use syn::spanned::Spanned;
use crate::attributes::{CrateAttribute, TextSignatureAttribute};
/// Macro inspired by `anyhow::anyhow!` to create a compiler error with the given span.
macro_rules! err_sp... |
// MIT License
// Copyright (c) 2018 brycx
// 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, pu... |
use anyhow::{anyhow, Result};
use http::Uri;
use structopt::StructOpt;
use url::Url;
#[derive(Clone, Debug, PartialEq, StructOpt)]
#[structopt(name = "sqsproxyd")]
pub struct Config {
#[structopt(long, env = "AWS_ACCESS_KEY_ID")]
pub aws_access_key_id: Option<String>,
#[structopt(long, env = "AWS_SECRET_AC... |
use anyhow::{anyhow, bail, Result};
use clap::Parser;
use cli::{Opts, SubCommands};
use core::default::Default;
use dialoguer::{theme::ColorfulTheme, Select};
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{
fs,
path::PathBuf,
process::{Command, Stdio},
};
use i18n::I18N_LOADER;
use kernel... |
#[macro_use]
extern crate tracing;
use futures::{future, Future, Stream};
use std::{
cmp::{max, min},
fs::File,
net::SocketAddr,
path::{Path, PathBuf},
};
use structopt::StructOpt;
use tokio_signal::unix::{Signal, SIGHUP, SIGINT, SIGQUIT, SIGTERM};
use trace_metrics::MetricsSubscriber;
use tracing::{fi... |
use crate::SolutionType;
pub fn day4(input: &str) -> SolutionType {
let passports = input.split("\n\n").filter(|i| i != &"");
passports
.filter(|passport| {
let keys = passport
.split(|ch: char| ch.is_ascii_whitespace())
.filter(|i| i != &"")
... |
use self::ll::{AUDIO_S16LSB, AUDIO_S16MSB, AUDIO_S8, AUDIO_U16LSB, AUDIO_U16MSB, AUDIO_U8};
use self::ll::{SDL_LockAudio, SDL_MixAudio, SDL_OpenAudio};
use self::ll::{SDL_UnlockAudio};
use std::mem::{forget, transmute};
use libc::{c_int, c_void, uint16_t};
use std::ptr::null_mut;
pub mod ll {
#![allow(non_camel_c... |
use std::{
sync::Arc,
str::FromStr,
convert::Infallible,
net::SocketAddr,
path::PathBuf,
env
};
use futures::{select, FutureExt};
use tokio::pin;
use hyper::{Body, Request, Response, Server};
use hyper::service::{make_service_fn, service_fn};
use hyper::http::{Uri, Method,StatusCode};
use hyp... |
use std::{collections::HashMap, sync::Weak};
use components::*;
use flecs_rs::*;
use math::TRS;
use crate::{compiler::AsyncCompiler, scene::Scene};
use super::Resource;
#[derive(Debug)]
pub struct EntitiesWorldResource {
scene: Weak<Scene>,
}
impl EntitiesWorldResource {
pub fn new(scene: Weak<Scene>) -> Se... |
use super::super::io::{AsyncRead, AsyncWrite, Error, ErrorKind};
use std::collections::VecDeque;
use std::pin::Pin;
use std::sync::{Arc, Mutex};
use std::task::{Context, Poll};
use tokio::io::ReadBuf;
#[derive(Debug)]
enum ChannelState {
Open(VecDeque<Box<[u8]>>),
Closed,
Error(ErrorKind),
}
impl ChannelS... |
//! Contraction Hierarchy query server.
//!
//! Actually not much more than a bidirectional dijkstra with a different stopping criterion.
//! And more complicated path unpacking.
//! This works because the augmented graph was split into an upward and an downward part.
//! This implicitly makes sure, that both searches ... |
//! Generic [Cipher Feedback (CFB)][1] mode implementation.
//!
//! This crate implements CFB as a [self-synchronizing stream cipher][2].
//!
//! # Security Warning
//! This crate does not ensure ciphertexts are authentic! Thus ciphertext integrity
//! is not verified, which can lead to serious vulnerabilities!
//!
//!... |
extern crate csv;
extern crate radiate;
extern crate rayon;
use radiate::prelude::*;
use std::error::Error;
fn main() -> Result<(), Box<dyn Error>> {
// set the number of threads to be used
rayon::ThreadPoolBuilder::new()
.num_threads(8)
.build_global()
.unwrap();
// define the en... |
use sp_core::{U256, H256};
use sp_runtime::generic::BlockId;
use parity_scale_codec::{Encode, Decode};
use sc_consensus_pow::{PowAlgorithm, Error};
use sp_consensus_pow::{Seal as RawSeal, POW_ENGINE_ID};
use sha3::{Sha3_256, Digest};
use rand::{thread_rng, SeedableRng, rngs::SmallRng};
use sc_client_api::{backend::Aux... |
use std::error::Error;
use crate::errors::UnsolvableError;
use crate::solver::board::Board;
use crate::solver::solve::solve;
use crate::tools::{BitReader, BitWriter};
struct PredictorBoard {
board: [u8; 81],
}
impl PredictorBoard {
fn possibilities(&self, i: u8) -> Vec<u8> {
if self.board[i as usize] ... |
use serde::{de::DeserializeOwned, Serialize};
use std::{
collections::HashSet,
path::PathBuf,
process,
sync::{mpsc::Sender, Arc, Mutex},
thread,
time::{Duration, Instant},
};
use wasmer::{imports, Function, ImportObject, Store, WasmerEnv};
use wasmer_wasi::WasiEnv;
use zellij_tile::data::{Event,... |
#![allow(
unused_imports,
clippy::many_single_char_names,
clippy::comparison_chain,
clippy::if_same_then_else,
clippy::if_not_else,
clippy::ifs_same_cond,
clippy::type_complexity,
clippy::collapsible_if,
clippy::collapsible_else_if
)]
use std::cmp::*;
use std::collections::*;
pub s... |
use crate::{
shape::Style,
shapes::text::{FontWeight, Text, TextAlign},
Drawing, Rect, Shape,
};
use algebr::{vec2, Vec2};
use rusttype::{Font, Scale};
#[derive(Debug, Clone, PartialEq)]
pub struct TextLayout {
pub(crate) text: String,
pub(crate) pos: Rect,
pub(crate) boxes: Vec<TextBox>,
}
cra... |
mod test_utils;
/// Instead of guarding every individual thing with `#[cfg(feature = "http")]`, use a module.
#[cfg(feature = "http")]
mod http_happy {
use crate::test_utils::{read_to_end, test_data};
use mockito::mock;
use std::fs::File;
use std::str::FromStr;
use tough::{DefaultTransport, HttpTra... |
//! Support for the 8259 Programmable Interrupt Controller, which handles
//! basic I/O interrupts. In multicore mode, we would apparently need to
//! replace this with an APIC interface.
//!
//! The basic idea here is that we have two PIC chips, PIC1 and PIC2, and
//! that PIC2 is slaved to interrupt 2 on PIC 1. You... |
#![allow(non_camel_case_types)]
pub use libc::size_t;
use std::os::raw::{c_char, c_int, c_uchar, c_void};
// Error return codes
pub const SSH_OK: c_int = 0;
pub const SSH_ERROR: c_int = -1;
pub const SSH_AGAIN: c_int = -2;
pub const SSH_EOF: c_int = -127;
pub enum ssh_session_struct {}
pub type ssh_session = *mut s... |
use futures::{channel::mpsc, prelude::*};
use log::{debug, error, trace};
use multiaddr::Multiaddr;
use secio::handshake::Config;
use std::{
io,
pin::Pin,
task::{Context, Poll},
time::Duration,
};
use tokio::io::{AsyncRead, AsyncWrite};
use yamux::session::SessionType as YamuxType;
use crate::{
err... |
use image::Pixel;
/// Create a `Rgba<u8>` pixel from (r,g,b,a) components in the range [0..1]
///
/// # Examples
/// ```
/// rgba(0.0, 1.0, 1.0, 0.5) // is semi-transparent cyan
/// ```
pub fn rgba(r: f32, g: f32, b: f32, a: f32) -> ::image::Rgba<u8> {
fn to_u8(i: f32) -> u8 { (255.0 * i) as u8 }
::image::Rgb... |
//! Statistics of skipped and validated slots.
use crate::config::Whitelist;
use log::{debug, log_enabled, Level};
use prometheus_exporter::prometheus::{GaugeVec, IntCounterVec};
use solana_client::{client_error::ClientError, rpc_client::RpcClient};
use solana_sdk::epoch_info::EpochInfo;
use std::collections::BTreeMap... |
mod export;
mod voltcraft;
use colored::*;
use glob::glob;
use std::env;
use std::fs;
use std::time::Instant;
use voltcraft::data::{PowerEvent, VoltcraftData};
use voltcraft::stats::VoltcraftStatistics;
use export::{save_parameter_history_csv, save_parameter_history_txt, save_statistics};
const PARAMETER_HISTORY_FIL... |
//! The `Cutscene` component is used to describe how we can manipulate the
//! camera during our transition to the damaged background art/wide-screen mode.
//! It's expected that camera systems will use this component to get the next
//! camera scale, and states (namely `transition.rs`) can check if we're in
//! the `S... |
//
// Vidoxide - Image acquisition for amateur astronomy
// Copyright (c) 2020-2021 <NAME> <<EMAIL>>
//
// This project is licensed under the terms of the MIT license
// (see the LICENSE file for details).
//
//!
//! Image feature tracking.
//!
use ga_image::{Image, ImageView, PixelFormat, point::{Point, Rect}};
con... |
//! Types for rolling dice.
use super::*;
mod standard_die;
pub use standard_die::*;
mod exploding_die;
pub use exploding_die::*;
/// Performs an `XdY` style dice roll, such as `3d6`.
///
/// * If `sides` is 0 or less, the output will be 0.
/// * If `count` is negative the output will be negative.
/// * Runs in `O(... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use super::ast::*;
use crate::errors::*;
use std::collections::{BTreeMap, BTreeSet, VecDeque};
//**************************************************************************************************
// CFG
//*****************************... |
//! HAL library for PMAP (Port Mapping Controller) - MSP432P401R
pub use pac::PMAP;
pub use pac::pmap;
use cortex_m::interrupt;
use crate::gpio::{Alternate, Primary};
const UNLOCK_KEY: u16 = 0x2D52;
const OFFSET0: u16 = 0x0000;
const OFFSET1: u16 = 0x0008;
static mut PORT_MAP: PmapControl = PmapControl {map: None};
... |
use std::collections::HashMap;
use kuchiki::{traits::*, NodeRef};
use crate::errors::PaperoniError;
use crate::moz_readability::{MetaData, Readability};
pub type ResourceInfo = (String, Option<String>);
lazy_static! {
static ref ESC_SEQ_REGEX: regex::Regex = regex::Regex::new(r#"(&|<|>|'|")"#).unwrap();
}
pub ... |
/* Copyright (c) Fortanix, Inc.
*
* Licensed under the GNU General Public License, version 2 <LICENSE-GPL or
* https://www.gnu.org/licenses/gpl-2.0.html> or the Apache License, Version
* 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0>, at your
* option. This file may not be copied, modified, or ... |
use crate::utilities::database::get_user_location;
use crate::utilities::geo_utils::get_coordinates;
use chrono::prelude::*;
use itertools::Itertools;
use log::error;
use reqwest::blocking::Client;
use reqwest::Url;
use serde::Deserialize;
use serenity::client::Context;
use serenity::framework::standard::macros:... |
#![no_std]
use core::slice::Iter;
use core::ops::Index;
#[derive(Debug, Copy, Clone)]
pub struct Node<'a> {
pub name: &'a str,
pub body: &'a str,
after: &'a str,
opener: &'a str,
}
fn is_space(c: char) -> bool {
c == ' ' || c == '\t' || c == '\n' || c == '\r'
}
fn count_until(s: &str, c: char) -... |
use ipaddress::IPAddress;
use core::result::Result;
use num::bigint::BigUint;
use core::str::FromStr;
use num_traits::One;
use num_traits::Num;
use core::ops::Rem;
use core::ops::Shl;
use core::ops::Shr;
use num_traits::Zero;
use num_traits::FromPrimitive;
use num_traits::ToPrimitive;
use prefix128;
use ipv4;
/// =N... |
use crate::{mdl, Swapchain};
use raw_window_handle::HasRawWindowHandle;
use wgpu::TextureSampleType;
pub struct WindowInfo<'a, Handle: HasRawWindowHandle> {
pub name: &'a str,
pub handle: &'a Handle,
pub size: mdl::Size2d,
}
pub struct WindowSource {
pub texture_view: wgpu::TextureView,
pub format... |
use std::collections::BTreeMap;
use std::os::unix::io::RawFd;
use std::sync::mpsc::Receiver;
use super::{AppInstruction, SenderWithContext};
use crate::os_input_output::OsApi;
use crate::panes::PositionAndSize;
use crate::pty_bus::{PtyInstruction, VteEvent};
use crate::tab::Tab;
use crate::{errors::ErrorContext, wasm_... |
mod bindings {
#![allow(non_upper_case_globals)]
#![allow(non_camel_case_types)]
#![allow(non_snake_case)]
#![allow(dead_code)]
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
}
use bindings::*;
use std::{ffi, fmt, io, mem, os::raw, slice};
use hyperminhash::Sketch;
#[cfg(feature = "serialize"... |
#![allow(dead_code)]
use std::convert::TryFrom;
use frame_support::dispatch::DispatchResultWithPostInfo as PsResult;
use frame_system as system;
use move_core_types::account_address::AccountAddress;
use move_core_types::identifier::Identifier;
use move_core_types::language_storage::ModuleId;
use move_core_types::langu... |
// Moduel for defining errors
use crate::prelude::*;
#[derive(Debug)]
pub struct Error{
/// This `Box` allows us to keep the size of `Error` as small as possible. A
/// larger `Error` type was substantially slower due to all the functions
/// that pass around `Result<T, Error>`.
err: Box<ErrorCode>,
}... |
use std::{fs, io::Write, path::PathBuf};
use anyhow::{Context, Result};
use nix::{
sched,
unistd::{Gid, Uid},
};
use oci_spec::Spec;
use crate::{
capabilities, cgroups,
namespaces::Namespaces,
notify_socket::NotifyListener,
process::{child, fork, parent},
rootfs,
rootless::Rootless,
... |
use std::fs::{File, OpenOptions};
use std::sync::atomic::{self, AtomicI64, Ordering};
use std::time::{Duration, SystemTime, UNIX_EPOCH};
use std::{env, error::Error, process, thread};
use chrono::{DateTime, Duration as ChronoDuration, Utc};
use dirs;
use lettre::smtp::authentication::{Credentials, Mechanism};
use lett... |
use bgfx_rs::*;
use glam::{EulerRot, Mat4, Vec3};
use glfw::{Action, Context, Key};
use std::{time::Instant};
mod common;
use common::{get_render_type, get_platform_data};
const WIDTH: usize = 1280;
const HEIGHT: usize = 720;
#[repr(packed)]
struct PosColorVertex {
_x: f32,
_y: f32,
}
static TRIANGLE_VERTIC... |
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate lolbench_support;
extern crate time;
extern crate serde;
extern crate serde_json;
extern crate rustc_serialize;
#[macro_use]
pub mod enums;
pub mod adapter;
pub mod color;
pub mod empty;
pub mod prim_str;
pub mod timer;
pub mod copy;
pub use self::... |
use std::fmt;
use bytes::{Buf, Bytes, BytesMut};
use crate::pack::NameList;
use crate::pack::{Pack, Put, Unpack, UnpackError};
pub(crate) mod channel_close;
pub(crate) mod channel_data;
pub(crate) mod channel_eof;
pub(crate) mod channel_extended_data;
pub(crate) mod channel_failure;
pub(crate) mod channel_open;
pub(... |
mod control_point_iter;
mod curve;
mod difficulty_object;
mod osu_object;
mod pp;
mod skill;
mod skill_kind;
mod slider_state;
use difficulty_object::DifficultyObject;
use osu_object::OsuObject;
pub use pp::{OsuAttributeProvider, OsuPP};
use skill::Skill;
use skill_kind::SkillKind;
use slider_state::SliderState;
use ... |
// Copyright 2020 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
// the License. You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing,... |
pub enum Token
{
Symbol(String),
Ident(String),
Lifetime(String),
String(String),
ByteString(Vec<u8>),
Char(char),
Unsigned(u128, u8),
Signed(i128, u8),
Float(f64, u8),
}
pub struct Reader<R>
{
inner: R,
}
impl<R: ::std::io::Read> Reader<R> {
pub fn new(r: R) -> Reader<R> {... |
//! Helper to build a vector w/o blowing up memory.
/// Default block size (10MB).
pub const DEFAULT_BLOCK_SIZE: usize = 1024 * 1024 * 10;
/// Helper to build a vector w/ limited memory consumption.
///
/// For small vectors the elements are not copied. For larger vectors the elements are only copied once (in contras... |
// Author of the port to Rust: <NAME>
// Date: 2020.09.11
// Original code in Javascript made by <NAME>.
// See [Have a donut - obfuscated c donut](https://www.a1k0n.net/2006/09/15/obfuscated-c-donut.html)
// And this project page on github user joaocarvalhoopen.
// License: For my part of the port is MIT Open License ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.