text stringlengths 7.05k 33.9k |
|---|
use std::collections::{BTreeSet, HashMap, VecDeque};
use serde::{Deserialize, Serialize};
use abstutil::FixedMap;
use geom::{Distance, Time};
use map_model::{Map, Position, Traversable};
use crate::mechanics::car::{Car, CarState};
use crate::{CarID, VehicleType, FOLLOWING_DISTANCE};
/// A Queue of vehicles on a sin... |
use std::{
borrow::Cow,
collections::HashMap,
iter,
};
use once_cell::sync::Lazy;
use regex::{CaptureLocations, Regex};
pub trait StringExt {
fn replacen_in_place(&mut self, from: &str, limit: usize, to: &str) -> bool;
fn replace_in_place(&mut self, from: &str, to: &str) -> bool;
fn replacen_in_place_regex(&mut... |
//! Library for decoding and encoding JSON streams.
//!
//! Example:
//! ```
//! # use futures::StreamExt;
//! # use futures::executor::block_on;
//! let expected = ("one".to_string(), 2.0, vec![3, 4]);
//! let stream = destream_json::encode(&expected).unwrap();
//! let actual = block_on(destream_json::try_decode((), s... |
//! Generates random trees and tree-like plants.
use math::*;
use prop::plant::{Branch, ControlPoint, Tree};
use rand::distributions::range::SampleRange;
use rand::distributions::{self, IndependentSample};
use rand::Rng;
use std::cmp;
use std::ops::Range;
/// Parameters for the tree generator.
#[derive(Debug)]
pub st... |
#[macro_use]
mod layouts;
mod renderer;
use super::{handle_new_grid_size, keyboard::neovim_keybinding_string, settings::WindowSettings};
use crate::{
bridge::UiCommand, channel_utils::*, cmd_line::CmdLineSettings, editor::WindowCommand,
error_handling::ResultPanicExplanation, redraw_scheduler::REDRAW_SCHEDULER... |
#![allow(clippy::new_ret_no_self)]
//! kitsune tx2 quic transport backend
use futures::future::{BoxFuture, FutureExt};
use futures::stream::{BoxStream, StreamExt};
use kitsune_p2p_types::config::*;
use kitsune_p2p_types::dependencies::{ghost_actor::dependencies::tracing, serde_json};
use kitsune_p2p_types::tls::*;
use... |
use v::{Lerp, Vec3, Rgba, Simd3, Aabb};
use gl;
use global::{Global, GlobalDataUpdatePack};
use duration_ext::DurationExt;
use gx;
use grx;
use mesh::{self, Mesh};
use scene::SimStates;
// TODO: Somehow make gravity separate (i.e have multiple gravities?)
//
// NOTE: Code du LeapFrog des particules:
// self.vit += dt... |
/*
* Copyright (c) Meta Platforms, Inc. and its affiliates.
*
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree.
*/
//! `Tracer` type, plus ways to spawn it and retrieve its output.
use crate::cp;
use crate:... |
use crate::error::Error;
use super::*;
use blue_hal::{
hal::flash,
utilities::{iterator::UntilSequence, memory::Address},
};
pub use ::ecdsa::{elliptic_curve::generic_array::typenum::Unsigned, SignatureSize};
pub use ecdsa::signature::Signature as EcdsaSignature;
use nb::block;
use p256::EncodedPoint;
pub use... |
// Copyright 2018 TiKV Project Authors. Licensed under Apache-2.0.
use super::batch::{Fsm, FsmScheduler};
use crossbeam::channel::{SendError, TrySendError};
use std::borrow::Cow;
use std::cell::Cell;
use std::ptr;
use std::sync::atomic::{AtomicPtr, AtomicUsize, Ordering};
use std::sync::{Arc, Mutex};
use tikv_util::co... |
#[macro_use]
extern crate log;
#[macro_use]
extern crate speedy_derive;
mod config;
mod constants;
mod stats;
mod trace;
pub use config::*;
use constants::*;
use stats::CallStats;
use trace::*;
use byteorder::{
LittleEndian,
NetworkEndian,
ReadBytesExt,
WriteBytesExt,
};
use crossbeam::channel::{
self,
Receive... |
//! # 获取Linux的系统信息
//!
//!
extern crate psutil;
use std::ptr;
use std::cmp;
use std::thread;
use std::sync::Arc;
use std::ffi::OsString;
use std::cell::RefCell;
use std::time::Duration;
use std::collections::HashMap;
use std::path::{Path, PathBuf};
use libc;
use psutil::{cpu, host, memory, process, di... |
use crate::ffi::OsString;
use crate::fmt;
use crate::io::{self, SeekFrom, IoSlice, IoSliceMut};
use crate::sys::time::{UNIX_EPOCH, SystemTime};
use crate::sys::unsupported;
use crate::time::Duration;
use crate::path::{Component, Path, PathBuf};
use crate::sync::Arc;
use crate::collections::HashMap;
use lazy_static::la... |
// play blackjack for money
// All throughout: `msg` variable is the message the user sent, and `message` is the one the bot sent.
use crate::database::database::{lost_increment, money_increment_without_lost};
use crate::{
database::database::{gen_connection, get_money, money_increment_with_lost},
tools::stats:... |
//! ECDSA signature methods
use super::types;
use ic_types::crypto::{AlgorithmId, CryptoError, CryptoResult};
use openssl::bn::{BigNum, BigNumContext};
use openssl::ec::{EcGroup, EcKey, EcPoint};
use openssl::ecdsa::EcdsaSig;
use openssl::nid::Nid;
use openssl::pkey::PKey;
#[cfg(test)]
mod tests;
// NOTE: prime256v1 ... |
// Copyright (c) The cargo-guppy Contributors
// SPDX-License-Identifier: MIT OR Apache-2.0
//! Facilities for writing out TOML data from a Hakari map.
#[cfg(feature = "cli-support")]
use crate::summaries::HakariBuilderSummary;
use crate::{
hakari::{HakariBuilder, OutputMap},
helpers::VersionDisplay,
};
use c... |
use crate::apiclient::{boot_update, get_chosen_update, get_os_info, prepare, update};
use apiserver::{
client::APIServerClient,
CordonAndDrainBottlerocketShadowRequest, UncordonBottlerocketShadowRequest,
{CreateBottlerocketShadowRequest, UpdateBottlerocketShadowRequest},
};
use models::{
constants::NAME... |
use std::collections::HashMap;
use std::fmt;
use std::num::ParseFloatError;
use std::rc::Rc;
#[derive(Clone)]
pub enum Oexp {
Boolean(bool),
Symbol(String),
Number(f64),
List(Vec<Oexp>),
Function(fn(&[Oexp]) -> Result<Oexp, RomeError>),
FunctionDef(Lambda)
}
#[derive(Clone)]
pub struct Lambda ... |
//! Random sampling of data from a stream.
//!
//! A stream sampler is a mechanism for maintaining a fixed-size random sample
//! from a stream of data. Specifically, we maintain "weighted samples": data
//! samples that have assigned to them a "weight" which is proportional to the
//! probability that the point will b... |
use std::borrow::Cow;
use std::collections::hash_map::Entry;
use std::collections::HashMap;
use std::collections::HashSet;
use std::fmt;
use std::fs;
use std::fs::File;
use std::io;
use std::io::Cursor;
use std::io::Read;
use std::path::Path;
use std::path::PathBuf;
use std::result;
use std::str::FromStr;
use std::sync... |
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate serde_json;
extern crate serde_yaml;
extern crate rand;
use std::sync::mpsc::channel;
use std::sync::mpsc::{Sender, Receiver};
use std::error::Error;
use std::path::Path;
use rand::Rng;
use std::fs::File;
use std::io::prelude::*;
use std::fmt;
... |
#![allow(dead_code)]
/*!
GLB file loader
*/
use serde_json::{Value, Map};
use std::{fs, ptr, str, path::Path};
#[derive(Copy, Clone, Debug, PartialEq, Eq)]
pub enum ComponentType {
Byte,
UByte,
Short,
UShort,
Int,
UInt,
Float,
}
impl ComponentType {
pub fn size(&self) -> u32 {
... |
//! A PeerFeed is a Queue and a bunch of Connections.
//!
//! There is one PeerFeed instance per NewsPeer. The PeerFeed instantiates
//! a on-disk queue, and a number of Connections to the remote peer.
//!
//! Articles are received from the MasterFeed, and sent to the Connections.
//! If there are no connections, or al... |
use crate::command::Command;
use crate::pipe::*;
use crate::process::Process;
use crate::psuedocon::PsuedoCon;
use crate::win32_error_with_context;
use crate::Token;
use std::ffi::{OsStr, OsString};
use std::io::{Error as IoError, Read, Result as IoResult, Write};
use std::os::windows::prelude::*;
use std::path::{Path,... |
//! Integration tests for checking high-level functionality of the most
//! important moving parts. Namely, these tests exercise the following modules:
//! * [`db`](db/index.html)
//! * [`coll`](coll/index.html)
//! * [`cursor`](cursor/index.html)
//! * [`doc`](doc/index.html)
//! * [`ops`](ops/index.html)
#[macro_use... |
use std::collections::{BTreeMap, HashSet, VecDeque};
use std::fmt::{self, Debug, Formatter};
use std::future::Future;
use std::pin::Pin;
use std::sync::{
atomic::{AtomicU8, Ordering},
Arc,
};
use std::task::{Context, Poll};
use std::time::{Duration, Instant};
use concurrent_queue::ConcurrentQueue;
use futures_... |
use std::{
fmt,
fs::Metadata,
io,
path::{Path, PathBuf},
time::{SystemTime, UNIX_EPOCH},
};
use actix_service::{Service, ServiceFactory};
use actix_web::{
body::{self, BoxBody, SizedStream},
dev::{
AppService, BodyEncoding, HttpServiceFactory, ResourceDef, ServiceRequest,
Se... |
//! KEM API
//!
//! See [`Kem`] for the main functionality
use alloc::borrow;
use alloc::vec::Vec;
use core::ptr::NonNull;
#[cfg(feature = "no_std")]
use cstr_core::CStr;
#[cfg(not(feature = "no_std"))]
use std::ffi::CStr;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use crate::ffi::kem as ffi;
us... |
use regex::Regex;
use std::collections::HashMap;
use std::env;
use std::fs::File;
use std::io::{self, BufRead, Error};
use std::path::{Path, PathBuf};
// This is the config data we'll pass into any functions that need it
pub struct Config {
pub record_path: PathBuf,
pub template_path: PathBuf,
pub template... |
// There's a decent amount of code that's just for example and isn't called
#![allow(dead_code)]
use legion::*;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use structopt::StructOpt;
use rafx::api::{RafxExtents2D, RafxResult, RafxSwapchainHelper};
use rafx::assets::AssetManager;
use crate::daemon_args::Asset... |
//! Support for generating a standard wasm interface types
//!
//! This module has all the necessary support for generating a full-fledged
//! standard wasm interface types section as defined by the `wit_walrus`
//! crate. This module also critically assumes that the WebAssembly module
//! being generated **must be sta... |
//! Timer implementation.
//!
//! This module contains the types needed to run a timer.
//!
//! The [`Timer`] type runs the timer logic. It holds all the necessary state
//! to track all associated [`Delay`] instances and delivering notifications
//! once the deadlines are reached.
//!
//! The [`Handle`] type is a refe... |
/* This is dvipdfmx, an eXtended version of dvipdfm by <NAME>.
Copyright (C) 2002-2018 by <NAME> and <NAME>,
the dvipdfmx project team.
Copyright (C) 1998, 1999 by <NAME> <<EMAIL>>
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public Li... |
//!
//! A demonstration of all non-primitive widgets available in Conrod.
//!
//!
//! Don't be put off by the number of method calls, they are only for demonstration and almost all
//! of them are optional. Conrod supports `Theme`s, so if you don't give it an argument, it will
//! check the current `Theme` within the `... |
//! The utility functions and data structures of this project.
/// The author meta data.
///
/// A valid author serialisation consists of
///
/// * the specified name, and
/// * the specified email address, wrapped in sharp brackets (`<>`).
///
/// In case that some of the assumptions should fail, an according error f... |
// This file is part of Substrate.
// Copyright (C) 2019-2020 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... |
// Copyright 2015-2019 Parity Technologies (UK) Ltd.
// This file is part of Parity Ethereum.
// Parity Ethereum is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at yo... |
/*
* Copyright 2018 Intel Corporation
*
* 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... |
use std::collections::hash_map::{Entry, HashMap};
use std::ffi::CString;
#[cfg(windows)]
use std::ffi::OsStr;
use std::fs::File;
#[cfg(unix)]
use std::os::unix::ffi::OsStrExt;
use std::path::{Path, PathBuf};
use std::sync::{Arc, RwLock};
use std::time::Duration;
use std::{io, ptr, sync};
use once_cell::sync::Lazy;
use... |
use crate::config;
use crate::database::Backend;
use crate::infer_schema_internals::*;
use serde::de::{self, MapAccess, Visitor};
use serde::{Deserialize, Deserializer, Serialize};
use serde_regex::Serde as RegexWrapper;
use std::collections::HashSet;
use std::error::Error;
use std::fmt::{self, Display, Formatter, Wri... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless... |
// 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.
//! Hashes video frames.
use async_trait::async_trait;
use fidl_fuchsia_media::*;
use fidl_fuchsia_sysmem as sysmem;
use hex::encode;
use mundane::hash::{... |
use crate::hash_path::shard::ShardStrategy;
use crate::hash_path::shard::SHARDEND;
use crate::prelude::*;
use holochain_wasmer_guest::*;
use holochain_zome_types::link::LinkTag;
use std::str::FromStr;
use validate::RequiredValidationType;
/// Allows for "foo.bar.baz" to automatically move to/from ["foo", "bar", "baz"]... |
use crate::core::x224;
use crate::core::tpkt;
use crate::model::error::{RdpResult, Error, RdpError, RdpErrorKind};
use crate::core::gcc::{KeyboardLayout, client_core_data, ClientData, ServerData, client_security_data, client_network_data, block_header, write_conference_create_request, MessageType, read_conference_creat... |
mod compression;
mod database;
mod s3;
pub use self::compression::{compress, decompress, CompressionAlgorithm, CompressionAlgorithms};
use self::database::DatabaseBackend;
use self::s3::S3Backend;
use crate::{db::Pool, Config, Metrics};
use chrono::{DateTime, Utc};
use failure::{err_msg, Error};
use path_slash::PathEx... |
// Copyright (c) 2022 Espresso Systems (espressos<EMAIL>)
// This file is part of the Jellyfish library.
// You should have received a copy of the MIT License
// along with the Jellyfish library. If not, see <https://mit-license.org/>.
//! An argument system that proves/verifies multiple instances in a batch.
use cra... |
// Copyright 2020 The Evcxr Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agree... |
use std::{
collections::HashMap,
path::{Path, PathBuf},
sync::Arc,
time::Duration,
};
#[cfg(feature = "encryption")]
use bonsaidb_core::document::KeyId;
use bonsaidb_core::{
permissions::Permissions,
schema::{Schema, SchemaName},
};
use sysinfo::{RefreshKind, System, SystemExt};
#[cfg(feature ... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
file_format::{
Bytecode, CodeOffset, CodeUnit, ConstantPoolIndex, FieldHandle, FieldHandleIndex,
FieldInstantiation, FunctionDefinition, FunctionHandle, FunctionHandleIndex,
FunctionInstantiatio... |
use crate::error::*;
use crate::rsync::SyncStats;
use crate::socket_node::*;
use chrono::{NaiveDateTime, Utc};
use lazy_static::*;
use log::*;
use postgres::*;
use postgres_derive::*;
use r2d2::{Pool, PooledConnection};
use r2d2_postgres::{PostgresConnectionManager, TlsMode};
use std::net::{IpAddr, Ipv4Addr, SocketAd... |
#![warn(rust_2018_idioms)]
use ::log::{debug, error, info};
use env_logger;
use std::env;
use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6};
use std::str;
use tokio;
use tokio::io::{self, AsyncReadExt, AsyncWriteExt};
use tokio::net::{
lookup_host,
tcp::{ReadHalf, WriteHalf},
TcpLi... |
use std::sync::Arc;
use std::{fmt::Display, str::FromStr};
use arrow::compute::SortOptions;
use indexmap::{map::Iter, IndexMap};
use itertools::Itertools;
use snafu::Snafu;
use super::TIME_COLUMN_NAME;
#[derive(Debug, Snafu)]
pub enum Error {
#[snafu(display("invalid column sort: {}", value))]
InvalidColumnS... |
// Copyright (c) 2020 Google LLC All rights reserved.
// Use of this source code is governed by a BSD-style
// license that can be found in the LICENSE file.
#![deny(missing_docs)]
use {
crate::{content::*, error::*, options::*},
std::cell::RefCell,
std::collections::HashMap,
std::collections::HashSet,... |
#![windows_subsystem = "windows"] // Do not display a console when running a windowed application
use docopt::Docopt;
use mazes::{
cells::{Cartesian2DCoordinate, Cell, SquareCell},
generators,
grid::Grid,
grid_coordinates::RectGridCoordinates,
grid_dimensions::RectGridDimensions,
grid_displays:... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt::{self, Debug, Display, Formatter};
use std::hash::Hash;
use std::rc::Rc;
#[cfg(test)]
use proptest_derive::Arbitrary;
use super::lex::{ComparisonToken, Keyword, Locatable};
use super::types::Type;
use super::*;
use crate::... |
#[macro_use]
extern crate lazy_static;
mod args;
mod errors;
mod wrapped_copy;
use std::sync::Arc;
use std::sync::Mutex;
use anyhow::Result;
use args::CannedACL;
use core::str::FromStr;
use errors::{ArgumentError, GranteeParseError};
use errors::{ExpressionError, S3Error};
use futures::stream::StreamExt;
use log::{de... |
use crate::error::Error;
use addr2line::fallible_iterator::FallibleIterator;
use addr2line::Location;
use object::read::File;
use object::Object;
use object::ObjectSection;
use object::ObjectSymbol;
use object::ObjectSymbolTable;
use std::borrow::Cow;
use std::collections::{hash_map, HashMap};
use std::fmt;
use std::io... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Data Register, UARTDR"]
pub uartdr: UARTDR,
#[doc = "0x04 - Receive Status Register/Error Clear Register, UARTRSR/UARTECR"]
pub uartrsr: UARTRSR,
_reserved2: [u8; 16usize],
#[doc = "0x18 - Flag Register, UARTFR"]
... |
// Symphonia
// Copyright (c) 2019 The Project Symphonia Developers.
//
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at https://mozilla.org/MPL/2.0/.
//! The `meta` module defines basic metadata... |
use iced_graphics::{
Backend, Defaults, Font, HorizontalAlignment, Primitive, Renderer, VerticalAlignment,
};
use iced_native::{
event::{Event, Status},
layout,
widget::svg::Handle,
Background, Clipboard, Color, Element, Hasher, Layout, Length, Point, Rectangle, Size, Vector,
Widget,
{
... |
use std::f64;
use wasm_bindgen::prelude::*;
use ncollide2d::world::*;
use ncollide2d::shape::*;
use ncollide2d::math::*;
use ncollide2d::query;
use std::convert::From;
// use ncollide2d::events::*;
// use ncollide2d::bounding_volume;
// use web_sys::console;
// use na::{Vector2};
// When the `wee_alloc` feature is en... |
#![feature(duration_float)]
mod geometry;
mod math_extensions;
mod ray;
mod camera;
use math_extensions::*;
use ray::Ray;
use geometry::*;
use camera::Camera;
use cgmath::prelude::*;
use cgmath::{Rad, Euler};
use sdl2::pixels::Color;
use sdl2::event::Event;
use sdl2::keyboard::Keycode;
use std::time::Instant;
use ... |
//! Ring protocol logic and supporting types.
//!
//! # Routing
//! The routing mechanism consist in a greedy routing algorithm which just targets
//! the closest location to the target destination iteratively in each hop, until it reaches
//! the destination.
//!
//! Path is limited to local knowledge, at any given po... |
// Copyright © Spelldawn 2021-present
// 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
// https://www.apache.org/licenses/LICENSE-2.0
// Unless required by applicable law or agreed to i... |
use std::iter::{FromIterator, IntoIterator};
use std::time::Duration;
use ::log::{error, log};
use chrono::{self, Utc};
use futures::stream::Stream;
use futures::{future, prelude::*};
use http;
use hyper;
use hyper::header;
use itertools::Itertools;
use serde_json as json;
use tokio_timer;
use url::form_urlencoded;
u... |
use crate::certificate;
use support::{
decl_module, decl_storage, decl_event, dispatch::Result, ensure, print,
traits::{
LockableCurrency, WithdrawReason, WithdrawReasons, LockIdentifier, Currency,
}
};
use system::ensure_signed;
use codec::{Encode, Decode};
use rstd::prelude::Vec;
use sr_primitive... |
// Copyright Amazon.com, Inc. or its affiliates.
//! Provides owned implementations of [`SymbolToken`], [`Element`] and its dependents.
//!
//! This API is simpler to manage with respect to borrowing lifetimes, but requires full
//! ownership of data to do so.
use super::{AnyInt, Element, ImportSource, Sequence, Stru... |
#![warn(
trivial_casts,
trivial_numeric_casts,
unused_extern_crates,
unused_import_braces,
unused_qualifications
)]
#![deny(missing_debug_implementations, missing_docs, unused)]
//! Low-level graphics abstraction for Rust. Mostly operates on data, not types.
//! Designed for use by libraries and hi... |
use crate::distribution::Continuous;
use crate::distribution::Normal;
use crate::statistics::{Max, MeanN, Min, Mode, VarianceN};
use crate::{Result, StatsError};
use nalgebra::{
base::allocator::Allocator, base::dimension::DimName, Cholesky, DefaultAllocator, Dim, DimMin,
LU, U1,
};
use nalgebra::{DMatrix, DVec... |
use super::*;
#[tokio::test(flavor = "multi_thread")]
async fn unbounded_loop() {
// Set handler timeout to 3 seconds.
let module = test_valid_module_and_store_with_timeout(
"unboundedLoop",
mock_data_source("wasm_test/non_terminating.wasm"),
Some(Duration::from_secs(3)),
)
.0;
... |
use std::time::Duration;
use bevy::{
math::Vec2,
prelude::*,
sprite::{Sprite, SpriteBundle},
};
use bevy_extensions::Vec2Conversion;
use crate::{
animation::TweenDoneAction,
extra::TransformBundle,
level::{CourtRegion, CourtSettings, InitialRegion, NetOffset, ServingRegion},
palette::{Pale... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
//! This module implements an in-memory Sparse Merkle Tree that is similar to what we use in
//! storage to represent world state. This tree will store only a small portion of the state -- the
//! part of accounts that have been modifi... |
use diesel::{connection::SimpleConnection, pg::PgConnection};
use diesel::{
r2d2::{self, event as e, ConnectionManager, HandleEvent, Pool, PooledConnection},
Connection,
};
use graph::{
prelude::{
anyhow::{self, anyhow, bail},
crit, debug, error, info, o,
tokio::sync::Semaphore,
... |
//! Universal Shaping Engine.
//! https://docs.microsoft.com/en-us/typography/script-development/use
use std::convert::TryFrom;
use std::os::raw::c_void;
use crate::{ffi, CodePoint, Tag, Buffer, GlyphInfo};
use crate::buffer::BufferFlags;
use crate::map::{Map, MapBuilder, FeatureFlags};
use crate::unicode::{CharExt, ... |
// Copyright 2020 <NAME>. All rights reserved.
// Copyright (C) 2021 Alibaba Cloud. All rights reserved.
//
// SPDX-License-Identifier: Apache-2.0
//! A blob cache layer over storage backend to improve performance.
//!
//! One of Rafs filesystem's goal is to support "on demand data loading". On demand loading may
//! ... |
/*a Copyright
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the... |
/*
* Copyright 2017 <NAME>
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without
* limitation the rights to use, copy, modify, merge, publish, distrib... |
extern crate time;
extern crate postgres;
use std::ops::Sub;
use std::time::{Duration, Instant};
use std::collections::{HashSet, VecDeque};
use pnet::packet::ethernet::EtherTypes::Ptp;
use pnet::packet::ethernet::{EthernetPacket, EtherTypes};
use pnet::packet::ipv6::Ipv6Packet;
use pnet::packet::udp::UdpPacket;
use pn... |
//! Implements a registry of modules for a store.
use crate::{Engine, Module};
use std::{
collections::BTreeMap,
sync::{Arc, RwLock},
};
use wasmtime_environ::{EntityRef, FilePos, TrapCode};
use wasmtime_jit::CompiledModule;
use wasmtime_runtime::{ModuleInfo, VMCallerCheckedAnyfunc, VMTrampoline};
lazy_static... |
use std::sync::atomic::{AtomicUsize, Ordering};
use std::borrow::Borrow;
use std::mem;
use futures::task::{self, Task};
use futures::{StartSend, AsyncSink, Async, Sink, Stream, Poll};
use handle::{Handle, IdHandle, ResizingHandle, BoundedHandle, HandleInner};
use primitives::index_allocator::IndexAllocator;
use contai... |
//! ZFS operations
use chrono::{Datelike, Local, Timelike};
use failure::{err_msg, format_err};
use regex::{self, Regex};
use serde_derive::Serialize;
use std::{
collections::{BTreeSet, HashMap},
fs::File,
io::{self, BufRead, BufReader},
os::unix::io::{AsRawFd, FromRawFd},
process::{Command, Stdio}... |
pub mod config;
pub mod ord;
use crate::manager::{Log, Logs, Process, ProcessManager};
use crate::zinit::ord::ProcessDAG;
use crate::zinit::ord::{service_dependency_order, DUMMY_ROOT};
use anyhow::Result;
use config::DEFAULT_SHUTDOWN_TIMEOUT;
use nix::sys::signal;
use nix::sys::wait::WaitStatus;
use nix::unistd::Pid;
u... |
mod node;
pub mod primitives;
mod storage;
use std::collections::HashMap;
#[doc(inline)]
pub use primitives::Primitive;
#[doc(inline)]
pub use node::Node;
pub use storage::Storage;
use crate::{
dom_factory::{add_event, window, now, set_timeout, request_animation_frame},
log, node, rc_rcell, TextureType,
... |
use super::PosNormMesh;
use building_blocks_core::prelude::*;
use building_blocks_storage::{prelude::*, ArrayForEach};
/// Pads the given chunk extent with exactly the amount of space required for running the `surface_nets` algorithm.
pub fn padded_surface_nets_chunk_extent(chunk_extent: &Extent3i) -> Extent3i {
... |
use aoc::{CustomError, Result};
use lazy_static::lazy_static;
use regex::Regex;
use std::collections::BTreeMap;
use std::convert::From;
use std::fmt;
use std::ops::{Add, AddAssign, Index, IndexMut, Mul, Sub, SubAssign};
use std::str::FromStr;
#[derive(Clone, Copy, PartialEq, Eq, Hash, Ord, PartialOrd, Default)]
struct... |
use std::{collections::HashMap, default::Default, time::Duration};
use ggez::{
graphics::{Color, Font, Image, Text},
Context,
};
use rand::{thread_rng, Rng};
use scene::{action, Action, Boxed, Layer, Scene, Sprite};
use crate::{
core::{
battle::{
self, ability::Ability, command, compon... |
use indexmap::IndexMap;
use crate::{
ast::{Directive, FromInputValue, InputValue, Selection},
executor::{ExecutionResult, Executor, Registry, Variables},
parser::Spanning,
schema::meta::{Argument, MetaType},
value::{DefaultScalarValue, Object, ScalarValue, Value},
GraphQLEnum,
};
/// GraphQL t... |
// use crate::util::xor_si128_inplace;
#[inline]
fn add_si512_inplace(a: &mut [u32; Chacha20::STATE_LEN], b: &[u32; Chacha20::STATE_LEN]) {
for i in 0..Chacha20::STATE_LEN {
a[i] = a[i].wrapping_add(b[i]);
}
}
#[inline]
fn xor_si512_inplace(a: &mut [u8], b: &[u32; Chacha20::STATE_LEN]) {
// NOTE:... |
//! A minimal command line program for connecting to the tor network
//!
//! (If you want a more general Tor client library interface, use [`arti_client`].)
//!
//! This crate is the primary command-line interface for
//! [Arti](https://gitlab.torproject.org/tpo/core/arti/), a project to
//! implement [Tor](https://www... |
//! Miscellaneous utility functions, usually geometric operations.
use std::{cmp::Ordering, f32::consts::PI};
use crate::V2;
use angle::{Angle, Deg, Rad};
use num_complex::Complex32;
/// Compute the average of a set of vectors
pub fn centroid(vs: impl IntoIterator<Item = V2>) -> Option<V2> {
let mut sum = V2::Z... |
use std::{
io::Read,
path::Path,
sync::atomic::{AtomicBool, Ordering},
time::{Duration, SystemTime, UNIX_EPOCH},
};
use log::info;
use reqwest::blocking::{Body, Client, Request, Response};
use reqwest::header::{HeaderValue, CONNECTION, CONTENT_TYPE, REFERER, USER_AGENT};
use reqwest::Url;
use crate::d... |
use std::{collections::BTreeMap, hash::Hash, ops::RangeInclusive};
use eframe::epi;
use egui::{
self,
plot::PlotImage,
plot::{Plot, Value},
Color32, ColorImage, DragValue, ProgressBar, TextureHandle,
};
use serde::{Deserialize, Serialize};
use uom::si::{angle::radian, f32::*, length::foot, time::secon... |
use crate::cpu::interrupt::{Flag, InterruptFlags};
use crate::memory::Memory;
use rand::Rng;
use std::cell::RefCell;
use std::rc::Rc;
pub const FB_W: usize = 160;
pub const FB_H: usize = 144;
pub const VRAM_SIZE: usize = 0x2000;
pub const OAM_SIZE: usize = 0xa0;
pub const TILE_MAP_SIZE: usize = 384;
#[derive(Debug, P... |
#![allow(dead_code)]
use backtrace::Backtrace;
use byteorder::{ByteOrder, BE};
use libflate::zlib;
use std::clone::Clone;
use std::io::{Cursor, Error, Read};
//
// Types
//
#[derive(Eq, PartialEq, Ord, PartialOrd, Debug, Clone)]
pub struct Hdata {
pub h_path: Vec<String>,
pub keys: Vec<(String, String)>,
... |
extern crate timely;
extern crate graph_map;
extern crate alg3_dynamic;
use std::sync::{Arc, Mutex};
use std::io::BufReader;
use std::error::Error;
use std::fs::File;
use std::io::prelude::*;
use std::path::Path;
use timely::dataflow::*;
use timely::dataflow::operators::*;
use alg3_dynamic::*;
fn main () {
let... |
//! Vertex transform cache analysis and optimization
use crate::INVALID_INDEX;
#[derive(Default)]
pub struct VertexCacheStatistics {
pub vertices_transformed: u32,
pub warps_executed: u32,
/// Transformed vertices / triangle count
///
/// Best case 0.5, worst case 3.0, optimum depends on topology
pub a... |
use std::io::{self, Read, Write};
use std::ops::{Add, AddAssign};
use std::str;
use std::thread;
use std::time::Duration;
use mio;
use mio::tcp::{TcpListener, TcpStream};
use cpu::BreakReason;
use dbgcore::{self, ActiveCpu::Arm9};
use hwcore::Message;
use msgs;
use utils;
#[derive(Debug, Error)]
pub enum ErrorKind {... |
use anyhow::{Context, Result};
use smithay::backend::{
drm::DrmSurface,
egl::{
EGLError, SwapBuffersError,
display::EGLDisplayHandle,
native::{EGLNativeDisplay, EGLNativeSurface, EGLPlatform}
}
};
use smithay::reexports::{
drm::control::{
Device as ControlDevice,
... |
/*
* Copyright 2018-2020 TON DEV SOLUTIONS LTD.
*
* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
* this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASI... |
macro_rules! fn_name {
() => {{
fn f() {}
fn type_name_of<T>(_: T) -> &'static str {
std::any::type_name::<T>()
}
let name = type_name_of(f);
let mut result = &name[..name.len() - 3];
// trim "::{{closure}}" from the end, if present (such is present for a... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.