text stringlengths 3.09k 13.9k |
|---|
#![allow(clippy::rc_buffer)]
use crate::error::Error;
use crate::ext::ustr::UStr;
use crate::sqlite::connection::ConnectionHandle;
use crate::sqlite::statement::StatementHandle;
use crate::sqlite::{SqliteColumn, SqliteError};
use crate::HashMap;
use bytes::{Buf, Bytes};
use libsqlite3_sys::{
sqlite3, sqlite3_prepa... |
use std::collections::{BTreeMap, BTreeSet};
use super::types::*;
use super::sets::*;
use super::dfa::*;
/*
* Computes the state that is obtained when coming from s
* by reading c.
*/
fn next_state(exp: &IRegexp, s: &CSet, c: &Character) -> CSet {
fn is_in(c: &Character, c1: &Character) -> bool {
match... |
use super::*;
struct Sprite<'a> {
lane: usize,
y_pos: usize,
image: &'a image::RgbaImage,
}
struct SpriteMap<'a> {
sprites: Vec<Sprite<'a>>,
sprite_resolution: usize,
vertical_spacing_multiplier: f32,
}
fn copy_from(
this: &mut image::RgbaImage,
other: &image::RgbaImage,
x: u32,
y: u32,
) -> image::ImageRe... |
extern crate rusoto_core;
extern crate rusoto_ec2;
extern crate rusoto_lambda;
use crate::instance::tag::Resource;
use anyhow::{anyhow, bail, Result};
use bytes::Bytes;
use rusoto_core::Region;
use rusoto_ec2::{
AttachVolumeRequest, CreateVolumeRequest, DescribeIamInstanceProfileAssociationsRequest,
DescribeIn... |
use std::collections::HashMap;
use std::fmt::Debug;
use std::io::{Cursor, Read, Write};
use std::iter::FromIterator;
use std::path::{Path, PathBuf};
use anyhow::{anyhow, Result};
use dynasmrt::{dynasm, DynasmApi, DynasmLabelApi};
use itertools::Itertools;
use procfs::process::FDTarget;
use tracing::{error, info, trace... |
//! A [`TokenStreamGetterCollector`](utils::TokenStreamGetterCollector) collecting
//! renamable [`Getter`](utils::Getter) calls.
use log::trace;
use proc_macro2::{Delimiter, TokenStream, TokenTree};
use std::path::Path;
use syn::buffer::{Cursor, TokenBuffer};
use rules::ReturnsBool;
use utils::{getter, prelude::*, G... |
use std::env;
use std::fmt;
use Expr::*;
struct Arena<'a>(typed_arena::Arena<Expr<'a>>);
enum Expr<'a> {
Int(i64),
Var(&'a str),
Add(&'a Expr<'a>, &'a Expr<'a>),
Mul(&'a Expr<'a>, &'a Expr<'a>),
Pow(&'a Expr<'a>, &'a Expr<'a>),
Ln(&'a Expr<'a>),
}
static MINUS_ONE: Expr = Expr::Int(-1);
static... |
// RustyXML
// Copyright 2013-2016 RustyXML developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distribute... |
#[derive(Clone, Copy, Debug)]
pub struct Layout {
/// The position of the quad on the screen.
pub position: ScreenPosition,
/// Which part of the quad to position at `position`.
pub anchor: Anchor,
/// The size at which to render the quad.
pub size: Size,
}
/// An anchor coordinate.
#[derive(... |
//! Mappings between old and new `NodeId`s. Also has some support for `AttrId`s.
use std::collections::hash_map::Entry;
use std::collections::{BTreeSet, HashMap, HashSet};
use std::mem;
use std::ops::Bound::Included;
use std::ops::Deref;
use syntax::ast::{AttrId, NodeId, DUMMY_NODE_ID};
use syntax::source_map::symbol:... |
// 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::errors::MetaContentsError;
use fuchsia_merkle::Hash;
use std::collections::BTreeMap;
use std::io;
/// A `MetaContents` represents the "meta/con... |
//! JSON-RPC client implementation.
#![deny(missing_docs)]
use failure::{format_err, Fail};
use futures::sync::{mpsc, oneshot};
use futures::{future, prelude::*};
use jsonrpc_core::{Error, Params};
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde_json::Value;
pub mod transports;
#[cfg(test)]
mod log... |
use std::io::{self, Read};
use std::str::{self, FromStr};
use bytes::Bytes;
use thiserror::Error;
use crate::object::{
Blob, Commit, ObjectData, ObjectHeader, ObjectKind, ParseBlobError, ParseCommitError,
ParseTagError, ParseTreeError, Tag, Tree,
};
use crate::parse::{self, Buffer, Parser};
#[derive(Debug, E... |
use crate::{Action, TYPE_BLOCK_START};
use std::io::{self, BufRead};
/// Context for the check. It notably contains informations about the crate and
/// the current type (e.g, for `#method.name` links).
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct ConversionContext<'opts> {
/// Options to apply when transform... |
use anyhow::Result;
use std::path::{Component, Path, PathBuf};
// Project root is the root of the entire project. The project might contain multiple crate and it should not
// be used together with whatever `file!()` macro will return.
pub fn get_project_root_path() -> PathBuf {
// If there's a buck build id we'l... |
use imgproc_rs::util;
use imgproc_rs::util::constants::K_GAUSSIAN_BLUR_2D_3;
use imgproc_rs::image::SubImage;
#[test]
fn vector_mul_test() {
let mat = vec![1, 2, 3, 4, 5, 6, 7, 8, 9];
let vec = vec![1, 2, 3];
let res1 = util::vector_mul(&mat, &vec).unwrap();
let mut res2 = Vec::new();
util::vector... |
/*
* 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 super::apply_transforms::Programs;
use crate::config::{Config, ProjectConfig};
use crate::errors::BuildProjectError;
use graphq... |
//! Pass reading pixels from a previously created framebuffer.
use crate::prelude::*;
use crate::display::render::pass;
use crate::system::gpu::*;
use crate::system::gpu::data::texture::class::TextureOps;
use crate::system::js::*;
use web_sys::WebGlBuffer;
use web_sys::WebGlFramebuffer;
use web_sys::WebGlSync;
//... |
use crate::chip_library::{elements::Elements, skills::Skills, chip_type::{ChipClass, ChipType}, ranges::Ranges};
use serde::Deserialize;
use unchecked_unwrap::UncheckedUnwrap;
use std::cell::UnsafeCell;
use std::cmp::{Ord, Ordering};
use yew::prelude::*;
#[derive(Deserialize)]
#[serde(rename_all(deserialize = "PascalC... |
use crate::{
collections::watched::WatchedValue,
fail::Fail,
protocols::tcp::SeqNumber,
sync::Bytes,
};
use std::{
cell::{Cell, RefCell},
collections::VecDeque,
num::Wrapping,
task::{
Context,
Poll,
Waker,
},
time::{
Duration,
Instant,
... |
use druid::{
kurbo::BezPath,
widget::{prelude::*, FillStrat},
Color, Data, KeyOrValue, Size,
};
use once_cell::sync::Lazy;
const DEFAULT_SIZE: Size = Size::new(24.0, 24.0);
pub struct Icon {
path: &'static BezPath,
fill: FillStrat,
color: KeyOrValue<Color>,
size: Size,
}
macro_rules! icon... |
use std::error::Error;
use std::fmt::Formatter;
use std::str::FromStr;
use std::sync::Arc;
use parking_lot::Mutex;
use reqwest::{Client, Response};
use reqwest::header::{AsHeaderName, HeaderMap};
use serde::de::DeserializeOwned;
use tokio::task::JoinHandle;
use uuid::Uuid;
use crate::api::error::HypixelApiError;
use cr... |
#![cfg(feature = "method_lib_serde")]
use std::collections::HashMap;
use itertools::Itertools;
use serde_crate::{Deserialize, Serialize};
use crate::{
method::{
class::{Class, FullClass},
generate_title,
},
Stage,
};
use super::{CompactMethod, LibraryMap, MethodLib};
/// A version of `M... |
use std::path;
use crate::cli::{self, utils};
#[allow(unused_imports)]
use color_eyre::{eyre::eyre, eyre::WrapErr, Help};
fn resolve_style_file(data: &cli::Data) -> eyre::Result<eyre::Result<path::PathBuf>> {
let style_json = match &data.json.style_file {
None => None,
Some(path) => {
... |
use hawktracer_parser::{CoreEventKlassId, Event, Value};
use std::io::BufRead;
// TODO: SUPPORT MAPPING EVENT
#[derive(Default)]
pub struct LabelMap {
mapping: std::collections::HashMap<u64, String>,
}
impl LabelMap {
pub fn new() -> LabelMap {
LabelMap {
mapping: std::collections::HashMa... |
use crate::api;
use crate::library::LibraryManager;
use crate::util;
use crate::Status;
use serde::{Deserialize, Serialize};
use std::sync::{Arc, Mutex};
pub struct User {
data: UserData,
firestore: Arc<Mutex<api::FirestoreApi>>,
}
#[derive(Serialize, Deserialize, Default, Debug)]
struct UserData {
uid: S... |
use crate::Todo;
use anyhow::Result;
use std::io::{stdin, stdout};
use std::path::Path;
use termion::color::Fg;
use termion::event::Key;
use termion::input::TermRead;
use termion::raw::IntoRawMode;
use termion::{clear, color, cursor, style};
enum UserAction {
Navigation,
Toggle,
Quit,
Reload,
Detai... |
#![allow(
dead_code,
mutable_transmutes,
non_camel_case_types,
non_snake_case,
non_upper_case_globals,
unused_assignments,
unused_mut
)]
use std::{
ffi::c_void,
os::raw::{c_double, c_float, c_int, c_ulong},
};
use super::smallft::*;
extern "C" {
#[no_mangle]
fn calloc(_: c... |
use crossbeam::atomic::AtomicCell;
use serde::{Deserialize, Serialize};
pub trait PluginParameterLike {
fn name(&self) -> String;
/// This is the suffix to be used after parameter values.
fn label(&self) -> String;
fn text(&self) -> String;
fn value(&self) -> f32;
fn set_value(&self, value: f32... |
//! 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...);
//!
use std::{net::{SocketAddr}, sync::{Arc}, time::{Duration}};
use tokio::net::{TcpListener, TcpStream}... |
use rocksdb::{BlockBasedIndexType, BlockBasedOptions, Cache, DBCompactionStyle, Options};
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct ServiceConfig {
ip: String,
port: u16,
workers: u8,
dev_mode: bool,
}
#[derive(Debug)]
pub struct DbConfig(pub RocksDbConfi... |
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::wlan::types;
use anyhow::{Context as _, Error};
use fidl_fuchsia_wlan_device_service::{
DeviceMonitorMarker, DeviceMonitorProxy, DeviceServi... |
use cookie::{time::Duration, Cookie};
use rewriter::rewrite_html;
use url::ParseError;
use utils::clean_headers;
use wasm_bindgen::JsValue;
use worker::*;
mod rewriter;
mod utils;
fn log_request(req: &Request) {
console_log!(
"{} - [{}], located at: {:?}, within: {}",
Date::now().to_string(),
... |
extern crate bincode;
extern crate bytes;
extern crate clap;
extern crate find_folder;
extern crate hex_slice;
extern crate image;
#[macro_use]
extern crate log;
extern crate nfd;
extern crate piston_window;
extern crate portaudio;
extern crate sdl2_window;
extern crate serde;
#[macro_use]
extern crate serde_derive;
ex... |
use Graph;
use std::ops::Add;
use std::cmp::{PartialOrd, Ordering};
use std::hash::Hash;
use std::collections::hash_map::{HashMap, Entry};
use std::collections::BinaryHeap;
use num;
use num::traits::Zero;
pub type Heuristic<N, W> = fn(from: &N, to: &N) -> W;
pub fn a_star<G: Graph>(graph: &G, start: G::NodeId, end... |
use packed_struct::prelude::*;
#[derive(Debug, Default)]
pub(super) struct GraphicCtrl {
pub gcir: GraphCtrlIndex,
spr: SetPlane,
espr: EnableSetPlane,
pub ccr: ColorCmp,
drr: DataRot,
pub rpsr: ReadPlaneSel,
pub gmr: GraphMode,
pub mr: Misc,
pub icr: IgnoreColor,
bmr: u... |
use std::sync::atomic::{AtomicPtr, Ordering, AtomicUsize};
use super::super::{Task, ChannelId, TaskId, PeriodLengthInUsec};
use super::prv::{Private};
use super::{wrap};
use std::ptr;
struct ExecFlags (AtomicUsize);
pub struct TaskPage {
data: Vec<(AtomicPtr<wrap::TaskWrap>, ExecFlags, PeriodLengthInUsec)>,
}
... |
use std::sync::Arc;
use once_cell::sync::OnceCell;
use tokio::time::Duration;
use mayastor::{
bdev::{nexus_create, nexus_lookup},
core::{io_driver, Bdev, MayastorCliArgs},
};
use rpc::mayastor::{BdevShareRequest, BdevUri};
pub mod common;
use common::compose::{self, Binary, ComposeTest, MayastorTest};
use ma... |
use std::{
io,
path::{Path, PathBuf},
};
use tokio::{fs, io::AsyncReadExt};
use crate::error::Result;
pub use crate::zip::calc_size;
use crate::zip::{Descriptor, Directory, FileHeader, ToBytes};
use futures::{
channel::mpsc::{channel, Receiver, Sender},
SinkExt,
};
mod date;
pub mod error;
mod zip;
pu... |
// 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
//! Drawing APIs — shared draw state
use super::color::Rgb... |
use crate::errors::*;
use crate::base::{Array, Value, ValueProperties, IndexKey};
use crate::{proto, base, Warnable};
use crate::components::{Component, Named};
use ndarray::ArrayD;
use ndarray::prelude::*;
use crate::utilities::{get_argument};
use indexmap::map::IndexMap;
use crate::utilities::properties::{select_p... |
use borsh::{BorshDeserialize, BorshSerialize};
use sha2::{Digest, Sha256};
use solana_program::{
account_info::{next_account_info, AccountInfo},
entrypoint,
entrypoint::ProgramResult,
msg,
program_error::ProgramError,
pubkey::Pubkey,
sysvar::{clock::Clock, Sysvar},
};
use std::collections::hash_map::Defau... |
//! Functionality for transforming gcodes.
mod predicate;
pub use self::predicate::{And, Or, Predicate};
use crate::types::{Argument, Gcode};
/// A helper trait which adds useful extension methods to all [`Gcode`]
/// iterators.
///
/// [`Gcode`]: ../struct.Gcode.html
pub trait GcodeTransforms: Iterator<Item = Gcod... |
use core::{
convert::{From, TryFrom, TryInto},
fmt::Debug,
result::Result,
};
use crate::{
codec::{self, Encodable},
error::{DecodeError, EncodeError},
fixed_header::PacketFlags,
qos,
status::Status,
};
use super::HeaderDecode;
use bitfield::BitRange;
#[derive(PartialEq, Eq, Debug, C... |
#![feature(vec_remove_item)]
mod agent;
use rand::{Rng};
use rand::seq::IteratorRandom;
use rand::seq::SliceRandom;
use std::collections::HashMap;
use self::agent::{Agent, AgentId};
pub struct World {
pub time: f64,
pub agents: Vec<Agent>,
pub locations: Vec<Location>,
pub metrics: HashMap<&'static ... |
use intcode::*;
use std::collections::{HashMap, HashSet};
use std::convert::TryInto;
#[macro_use]
extern crate num_derive;
use num_traits::FromPrimitive;
#[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)]
struct Point {
x: i32,
y: i32,
}
impl Point {
fn new(x: i32, y: i32) -> Self {
Self { x: x,... |
// Copyright (c) 2018-2021 The MobileCoin Foundation
use fog_api::ledger_grpc::FogKeyImageApi;
use fog_ledger_enclave::{
CheckKeyImagesResponse, KeyImageContext, KeyImageResult, KeyImageResultCode, LedgerEnclaveProxy,
};
use fog_ledger_enclave_api::Error as EnclaveError;
use grpcio::{RpcContext, RpcStatus, UnarySi... |
use std::str::from_utf8;
use nom::{
branch::alt,
bytes::streaming::{tag, tag_no_case, take_while, take_while1},
character::streaming::not_line_ending,
combinator::{map, map_res, opt, recognize, value},
sequence::{preceded, tuple},
IResult,
};
use crate::{
parse::{language, number},
typ... |
use crate::components::{Component, ComponentParams};
use gdk::{WindowExt, RGBA};
use glib::translate::ToGlib;
use glib_sys::g_source_remove;
use gtk::prelude::*;
use gtk::Orientation;
use crate::util::Timer;
use crossbeam_channel::{self as channel, select};
use glib;
use std::sync::Arc;
use std::time::Duration;
use st... |
// Copyright (C) 2019-2021 Calcu Network Technologies Ltd.
// This file is part of Calcu.
use crate::*;
pub use frame_support::{
parameter_types,
weights::{Weight, constants::RocksDbWeight},
traits::{OnInitialize, OnFinalize, Get, TestRandomness}
};
pub use sp_core::{crypto::{AccountId32, Ss58Codec}, H256... |
// Copyright (c) 2016 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
//
// Unless r... |
// Prefix and slash specific implementation details
mod prefix;
mod slash;
pub use prefix::dispatch_message;
use crate::serenity_prelude as serenity;
/// Retrieves user permissions in the given channel. If unknown, returns None. If in DMs, returns
/// `Permissions::all()`.
async fn user_permissions(
ctx: &sereni... |
use std::borrow::Borrow;
use std::collections::HashMap;
use std::env;
use std::str;
use std::iter::Map;
use std::ops::Index;
use std::slice::Iter;
use regex::{Match, Regex};
use substring::Substring;
use lazy_static::lazy_static;
use rust_embed::{RustEmbed, EmbeddedFile};
#[derive(RustEmbed)]
#[folder = "assets/"]
str... |
//! Compile time errors
use std::{error, fmt};
use diagnostic::{Diagnostic, Span};
use crate::{Function, Module};
pub type Result<T> = std::result::Result<T, Error>;
#[derive(Debug)]
pub enum Error {
ParseChar(Span),
ParseInt(Span, std::num::ParseIntError),
ParseFloat(Span),
MutationNotSupported(S... |
mod server;
use std::collections::{HashMap, HashSet};
use std::fs::File;
use std::io::{ErrorKind, Read, Write};
use std::path::Path;
use clap::Parser;
use color_eyre::eyre::{eyre, Context};
use color_eyre::{Help, Result};
use harness::reflection::{self, ResourceKind};
use harness::ConfigId;
use termcolor::{Color, Col... |
#![allow(unused_variables)]
use std::error::Error;
use std::collections::HashMap;
use std::collections::HashSet;
fn main() {
let data = read_array(String::from("data.txt"))
.expect("Failed to get data");
let ans1 = solve_puzzle(data.clone(), 100).expect("Failed to get answer 1");
println!("Part o... |
use vizia::*;
use crate::app_state::{AppEvent, AppState, Layer, TileFloat};
use crate::entity_config::PencilBehavior;
use crate::map_struct::CelesteMapEntity;
use crate::palette_widget::EntitySelectable;
use crate::tools::{Tool, generic_nav};
use crate::units::*;
use crate::editor_widget;
#[derive(Default)]
pub struc... |
use crate::*;
use bitcoin::secp256k1::Secp256k1;
use bitcoin::util::bip32::{DerivationPath, ExtendedPubKey};
use bitcoin::Network;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::str::FromStr;
type BitcoinDescriptor = miniscript::Descriptor<bitcoin::PublicKey>;
#[derive(Debug, Serialize, Deserialize)]... |
use log::{LevelFilter, error, warn, info, debug, trace};
use libsystemd::{activation, daemon};
use libsystemd::activation::IsType;
use mio::net::{UnixDatagram, UnixListener};
use mio::{Events, Interest, Poll, Token};
use failure::Error;
use libc::{sockaddr, sockaddr_un, getsockname};
use std::time::Duration;
use st... |
use dada_ir::diagnostic::{Diagnostic, Diagnostics};
use dada_ir::format_string::{FormatStringData, FormatStringSection, FormatStringSectionData};
use dada_ir::span::{Offset, Span};
use dada_ir::token::Token;
use dada_ir::token_tree::TokenTree;
use dada_ir::word::Word;
use std::iter::Peekable;
pub fn lex_file(db: &dyn ... |
use bytes::Buf;
use utils::contexts::{NetworkThreadContext, ConnectionContext};
use utils::Packet;
use utils::indexed_vec::IndexedVec;
use utils::buffers::VarIntsMut;
use crate::TransformationResult;
use crate::TransformationResult::{Unchanged, Canceled, Modified};
const PACKET_IDS: usize = 0x5B+1;
const STATES: usize... |
use locspan::Loc;
use static_iref::iri;
use std::collections::HashMap;
use std::path::Path;
use treeldr::vocab::{BlankLabel, GraphLabel, Id, StrippedObject, Term, Vocabulary};
type BuildContext = treeldr_build::Context<(), treeldr_syntax::build::Descriptions>;
fn infallible<T>(t: T) -> Result<T, std::convert::Infalli... |
// Copyright 2015 Michael 'ExpHP' Lamparski
//
// Licensed under the terms of the MIT License, available at:
// http://opensource.org/licenses/MIT
// and also included in the file COPYING at the root of this distribution.
// This file may not be copied, modified, or distributed except according
// to those terms.
use... |
use category::{Category, Signature};
use config::{Config, ConfigValue};
use driver::libloading::{Library, Symbol};
use error;
use resolve::resolve;
use util;
use failure::Error;
use linked_hash_map::LinkedHashMap;
use serde_json;
use serde_yaml;
use valico::json_schema::Scope;
use std::collections::HashMap;
use std::... |
use std::fmt::{self, Write};
use std::mem;
use std::ops::Index;
use std::ops::IndexMut;
#[derive(Default, Clone)]
struct Field {
lhs: Vec<bool>,
rhs: Vec<bool>,
}
impl Field {
fn with_positive(rhs: Vec<bool>) -> Self {
Self {
lhs: Vec::new(),
rhs: rhs,
}
}
... |
use crate::app::App;
use crate::info::{header_btns, make_table, make_tabs, throughput, DataOptions, Details, Tab};
use abstutil::prettyprint_usize;
use ezgui::{Btn, EventCtx, Line, LinePlot, PlotOptions, Series, Text, TextExt, Widget};
use map_model::{LaneID, OriginalLane};
use std::collections::HashSet;
pub fn info(c... |
#![recursion_limit="256"]
use crate::Msg::SetMarkdownFetchState;
use std::fmt::{Error, Formatter};
use yew::events::KeyboardEvent;
use std::future::Future;
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use wasm_bindgen_futures::spawn_local;
use wasm_bindgen_futures::JsFuture;
use web_sys::{Request, RequestIn... |
use crate::errors::*;
use crate::kafka::ctopic::CTP;
use crate::prelude::{Collection, Context, Service, ServiceState};
use crate::stores::store::Store;
use crate::types::table::CTable;
use async_trait::async_trait;
use futures::future::BoxFuture;
use futures::FutureExt;
use lever::prelude::TTas;
use lever::sync::atomic... |
// Copyright (C) 2021 Alibaba Cloud. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
use std::io::Result;
use crate::cache::state::persist_map::PersistMap;
use crate::cache::state::RangeMap;
/// The name suffix of blob chunk_map file, named $blob_id.chunk_map.
const FILE_SUFFIX: &str = "range_map";
/... |
use crate::components::Component;
use crate::utils::encoding_to_wiring;
use crate::utils::ClockInt;
use crate::utils::WireSize;
use crate::utils::WiringSize;
use crate::InvalidArgsError;
use std::convert::TryFrom;
use std::vec;
#[derive(Debug, Clone, Copy)]
enum RotorName {
One,
Two,
Three,
Four,
F... |
use clippy_utils::diagnostics::span_lint_and_then;
use clippy_utils::source::snippet;
use clippy_utils::{contains_return, is_lang_ctor, return_ty, visitors::find_all_ret_expressions};
use if_chain::if_chain;
use rustc_errors::Applicability;
use rustc_hir::intravisit::FnKind;
use rustc_hir::LangItem::{OptionSome, Result... |
use bytes::Buf;
use std::borrow::Cow;
use crate::decode::Decode;
use crate::encode::{Encode, IsNull};
use crate::error::BoxDynError;
use crate::postgres::type_info::PgType;
use crate::postgres::types::Oid;
use crate::postgres::{PgArgumentBuffer, PgTypeInfo, PgValueFormat, PgValueRef, Postgres};
use crate::types::Type;... |
use DisplayPoint;
const W_NUMBER: usize = 4; //number width in pixels
const H_NUMBER: usize = 5; //number height in pixels
const SPACE_BETWEEN_NUMBERS: usize = 1; //space between numbers in pixels
const BORDER: usize = 1; //space around graph width
const H_ARROW_HALF: usize = 3; //half arrow heigh... |
use crate::{
message_types::MessageType, mqtt_client::ProtocolError as Error,
properties::PropertyIdentifier, ser::ReversedPacketWriter, Property,
};
pub fn integer_size(value: usize) -> usize {
if value < 0x80 {
1
} else if value < 0x7FFF {
2
} else if value < 0x7F_FFFF {
3... |
// Copyright (c) SimpleStaking and Tezedge Contributors
// SPDX-License-Identifier: MIT
#![forbid(unsafe_code)]
//! Separate Tezos protocol runner, as we used OCaml protocol more and more, we noticed increasing
//! problems, from panics to high memory usage, for better stability, we separated protocol into
//! self-co... |
// Copyright (c) Microsoft. All rights reserved.
#[macro_use]
extern crate clap;
extern crate edgelet_http;
extern crate edgelet_utils;
extern crate env_logger;
extern crate failure;
extern crate failure_derive;
#[macro_use]
extern crate log;
extern crate hyper;
extern crate serde_json;
extern crate tokio;
extern crat... |
//! This allows multiple apps to write their own flash region.
//!
//! All write requests from userland are checked to ensure that they are only
//! trying to write their own flash space, and not the TBF header either.
//!
//! This driver can handle non page aligned writes.
//!
//! Userland apps should allocate buffers... |
use crate::{CKBAppConfig, MemoryTrackerConfig, MinerConfig};
use ckb_chain_spec::consensus::Consensus;
use ckb_jsonrpc_types::ScriptHashType;
use ckb_pow::PowEngine;
use ckb_types::packed::Byte32;
use faketime::unix_time_as_millis;
use std::path::PathBuf;
use std::sync::Arc;
/// Parsed command line arguments for `ckb ... |
use crate::error::Result;
use crate::demon::MinimalDemon;
use chrono::{NaiveDateTime, NaiveTime};
use futures::StreamExt;
use pointercrate_core::audit::{AuditLogEntry, AuditLogEntryType, NamedId};
use serde::Serialize;
use sqlx::PgConnection;
use std::collections::HashMap;
#[derive(Serialize)]
pub struct DemonModific... |
use std::collections::HashSet;
use std::fmt;
use std::rc::Rc;
use crate::common::WrappedRcRefCell;
use crate::core::Core;
use crate::messages::aframe::{AdditionalFrame, AfHeader, MessageBuilder};
use crate::messages::clientmsg::TaskSpec;
use crate::messages::workermsg::ComputeTaskMsg;
use crate::messages::workermsg::T... |
use std::ptr;
use log::error;
use log::trace;
use log::debug;
use async_trait::async_trait;
use futures_lite::Future;
use fluvio_future::task::spawn;
use crate::sys::napi_deferred;
use crate::sys::napi_value;
use crate::val::JsEnv;
use crate::NjError;
use crate::sys::napi_env;
use crate::sys::napi_callback_info;
use... |
//! Real events SDL backend
use super::{EventDevice, Event};
use backends::SDL_CONTEXT;
use sdl2::event::Event as SdlEvent;
use sdl2::EventPump;
use sdl2::keyboard::Scancode;
use settings::RustzxSettings;
use utils::EmulationSpeed;
use zx::keys::*;
use zx::joy::kempston::KempstonKey;
/// Represents SDL Envets bakend
p... |
use bincode::Options;
use std::convert::TryInto;
use std::process::Command;
use vpp_api_gen::interface::*;
use vpp_api_gen::interface_types::*;
use vpp_api_gen::ip_types::*;
use vpp_api_gen::vhost_user::*;
use vpp_api_gen::virtio_types::*;
use vpp_api_gen::vlib::CliInband;
use vpp_api_gen::vlib::CliInbandReply;
use vpp... |
//
// Sysinfo
//
// Copyright (c) 2015 <NAME>
//
use core_foundation_sys::array::__CFArray;
use core_foundation_sys::base::CFAllocatorRef;
use core_foundation_sys::dictionary::CFMutableDictionaryRef;
use core_foundation_sys::string::{CFStringEncoding, CFStringRef};
use core_foundation_sys::url::CFURLRef;
#[cfg(not(fe... |
use failure::Error;
use image::{imageops::resize, FilterType, RgbaImage};
use std::cmp::{min, max};
use tui::buffer::Buffer;
use tui::layout::{Alignment, Rect};
use tui::style::{Color, Style};
use tui::widgets::{Block, Widget};
pub enum ColorMode {
Luma,
Rgb,
}
const BLOCK_LIGHT: char = '\u{2591}';
const BLOC... |
use std::collections::HashMap;
use crate::expression::{
types::{Node, Token},
ExpressionError,
};
const HIGHEST_PRIORITY: u8 = 6u8;
impl Token {
pub fn into_node(self, left: Option<Node>, right: Option<Node>) -> Node {
let mut node = Node {
token: self,
left: None,
... |
//! Functions and types relating to measuring and manipulating time.
use std::collections::VecDeque;
use std::time::{Duration, Instant};
use crate::Context;
/// The different timestep modes that a game can have.
#[derive(Debug, Copy, Clone)]
#[cfg_attr(
feature = "serde_support",
derive(serde::Serialize, se... |
use super::*;
use crate::reception_report::*;
use std::io::BufWriter;
use util::Error;
#[test]
fn test_packet_unmarshal() -> Result<(), Error> {
let real_packet = vec![
// Receiver Report (offset=0)
// v=2, p=0, count=1, RR, len=7
0x81, 0xc9, 0x0, 0x7, // ssrc=0x902f9e2e
0x90, 0x... |
use std::env;
use std::fs;
use regex::Regex;
use std::collections::VecDeque;
const DAY: &str = "day4";
fn main() {
let in_files = vec![
format!("/{}/src/{}_test.txt", DAY, DAY),
format!("/{}/src/{}.txt", DAY, DAY)
];
for path in in_files{
let contents = read_lines(&path);
... |
use crate::blob::prelude::PublicAccess;
use crate::container::requests::*;
use crate::core::clients::{StorageAccountClient, StorageClient, StorageCredentials};
use crate::shared_access_signature::{
service_sas::{BlobSharedAccessSignatureBuilder, BlobSignedResource, SetResources},
SasToken,
};
use azure_core::pr... |
//! Tower middleware that limits the maximum number of in-flight requests for a
//! service.
extern crate futures;
extern crate tower_service;
use tower_service::Service;
use futures::{Future, Poll, Async};
use futures::task::AtomicTask;
use std::{error, fmt};
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
... |
use crate::rule_prelude::*;
use ast::*;
use rslint_parser::{Direction, TextRange};
use SyntaxKind::*;
declare_lint! {
/**
Disallow confusing newlines in expressions.
JavaScript has automatic semicolon insertion, where newlines end statements, however,
expressions can often span across newlines, theref... |
mod log;
mod node;
mod state;
mod transport;
pub use self::log::Entry;
pub use self::state::State;
pub use self::transport::{Event, Message, Transport};
use crate::{store, Error};
use crossbeam_channel::{Receiver, Sender};
use node::Node;
use std::collections::HashMap;
use uuid::Uuid;
/// The duration of a Raft tick... |
use graphics::character::CharacterCache;
use legion::{component, Entity, IntoQuery, Read};
use piston_window::{Graphics, Key};
use std::collections::BTreeMap;
use crate::{
components::Body, components::InInventory, components::Item, game::State,
renderer::draw_window, renderer::RenderContext, renderer::Rendera... |
use std::{
fmt::{self, Display},
path::{Path, PathBuf},
};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum LinkType {
Hard,
Symbolic,
}
impl Display for LinkType {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
match self {
Self::Hard => write!(f, "hard"),
... |
//! Collection of tools for scanning AWS for secrets. Currently only supports S3.
//!
//! `S3Scanner` acts as a wrapper around a `SecretScanner` object to provide helper functions for
//! performing scanning against AWS S3 objects. Relies on the
//! [rust-s3](https://github.com/durch/rust-s3) library which provides hel... |
use std::f64::consts;
use std::iter::{Repeat, repeat};
use crate::geometry::*;
use crate::rendering::*;
use crate::collision::{CollisionObject, CollisionObjectState, ToCollisionObjects};
use crate::collision;
/// A (formally convex) polygon for collision detection
#[derive(Clone, Debug)]
pub struct ConPoly {
pub c... |
// Copyright (c) 2015-2016, <NAME>.
// License: http://opensource.org/licenses/ISC
extern crate bgfx;
extern crate winit;
use bgfx::{Bgfx, PlatformData, RenderFrame, RendererType};
#[cfg(target_os = "macos")]
use winit::os::macos::WindowExt;
#[cfg(target_os = "windows")]
use winit::os::windows::WindowExt;
use std:... |
use std::{collections::HashMap, rc::Rc};
use dominator::clone;
use futures::join;
use shared::{
api::endpoints::{category, jig, meta, ApiEndpoint},
domain::{
category::{Category, CategoryId, CategoryResponse, CategoryTreeScope, GetCategoryRequest},
jig::{JigData, JigId, JigResponse, JigUpdateDr... |
// Copyright 2018 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use std::mem;
use anyhow::Error;
use fuchsia_wayland_core as wl;
use crate::client::Client;
use crate::object::MessageReceiver;
/// Helper for construct... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.