text stringlengths 3.09k 13.9k |
|---|
use crate::{
remote_ptr::{RemotePtr, Void},
session::{
address_space::{kernel_mapping::KernelMapping, thread_group_in_exec},
task::Task,
},
};
use libc::{ino_t, pid_t};
use nix::{
sys::{
mman::{MapFlags, ProtFlags},
stat::makedev,
},
unistd::getpid,
};
use std::{
... |
// Copyright © 2021 HQS Quantum Simulations GmbH. All Rights Reserved.
//
// 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 requi... |
//! Path related utilities
use std::path::{Path, PathBuf};
use std::io;
use std::fs;
/// Denotes value as having path on a file system
pub trait HasPath {
/// Returns a reference to a path
fn path(&self) -> &Path;
}
/// Allows for directory resolution
pub trait ResolvePath {
/// Resolves to an actual dir... |
use crate::rpc::*;
use anyhow::Result;
use futures::channel::mpsc;
use futures::StreamExt;
use jsonrpc_pubsub::SubscriptionId;
use starcoin_logger::prelude::*;
use starcoin_miner::{
MinerService, SubmitSealRequest as MinerSubmitSealRequest, UpdateSubscriberNumRequest,
};
use starcoin_service_registry::{
ActorSe... |
use cpal;
use cpal::traits::{HostTrait, DeviceTrait, EventLoopTrait};
use vg::audio;
use parking_lot::{Mutex, RwLock};
use lewton::inside_ogg::OggStreamReader;
use std::collections::VecDeque;
use std::io::Cursor;
use std::sync::{Arc, Weak, atomic::AtomicBool, atomic::Ordering::Relaxed};
struct Inner {
vorbis: Mut... |
//! Font and window metrics (most of which will be un-hardcoded later).
use serde::{Deserialize, Serialize};
use std::convert::TryFrom;
pub(super) const TIME_CHARS: i32 = 9; // XX'XX"XXX
/// Font metrics.
#[derive(Copy, Clone, Debug, Deserialize, Serialize)]
pub struct Font {
/// Columns in the font texture.
... |
#![warn(clippy::all, clippy::pedantic, clippy::nursery)]
#![allow(clippy::future_not_send)]
mod comic;
mod config;
use crate::config::Configuration;
use anyhow::Context;
use futures_util::stream::StreamExt;
use slog::Logger;
use sloggers::Config;
use std::sync::Arc;
use std::time::Duration;
use twilight_gateway::{Eve... |
use futures::executor::ThreadPool;
use std::sync::{
Arc, Mutex,
mpsc::{
Sender,
Receiver
}
};
use notices::{
Diagnostic,
DiagnosticBuilder,
DiagnosticLevel,
DiagnosticSource,
DiagnosticSourceBuilder
};
use ir::{
Chunk,
};
use module_messages::ModuleMessage;
mod m... |
#![allow(clippy::mutable_key_type)]
use crate::debugger;
use anyhow::{anyhow, Result};
use async_jsonrpc_client::Output;
use async_jsonrpc_client::{Params as ClientParams, Transport};
use ckb_fixed_hash::H256;
use gw_config::DebugConfig;
use gw_jsonrpc_types::ckb_jsonrpc_types::TransactionWithStatus;
use gw_rpc_client... |
// 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 agreed to in writ... |
// Copyright Materialize, Inc. and contributors. All rights reserved.
//
// 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 file at the
// root of this repository, or online at
//
/... |
use anyhow::*;
use env_logger::{Builder, Env};
use globset::{Glob, GlobSet, GlobSetBuilder};
use log::*;
use std::io::Write;
use std::path::PathBuf;
use std::process::exit;
use std::time::SystemTime;
use structopt::StructOpt;
use thumbs::cli::{Command, ProgramOptions};
use thumbs::{show, Thumbnail, UnThumbnailer};
con... |
//! A custom, configurable TLS server that does not rely on the crypto
//! implementation. It is purely for testing the client.
#![allow(clippy::unwrap_used)]
use crate::tls::set_peer_verification_cert_store;
use crate::tls::x509_certificates::CertWithPrivateKey;
use ic_protobuf::registry::crypto::v1::X509PublicKeyCert... |
use crate::{core_editor::LineBuffer, Completer, CompletionActionHandler, DefaultCompleter, Span};
/// A simple handler that will do a cycle-based rotation through the options given by the Completer
pub struct ListCompletionHandler {
completer: Box<dyn Completer>,
complete: bool,
}
impl ListCompletionHandler {... |
use crate::lexer::TokenType;
const INPUT_INSTRUCTIONS: [TokenType; 2] = [TokenType::Xic, TokenType::Xio];
const OUTPUT_INSTRUCTIONS: [TokenType; 6] = [TokenType::Ote, TokenType::Otl, TokenType::Otu, TokenType::Jsr, TokenType::Ret, TokenType::Emit];
#[derive(Default)]
pub struct CodeGenerator {
current_code_block... |
use std::{fmt, sync::Arc};
use hv::prelude::*;
use parry3d::bounding_volume::AABB;
use soft_edge::{Atom, Axis, CompoundHull, EdgeFilter, Face, VertexFilter, VertexSet};
use crate::{
collision::{CompoundHullShape, CompoundHullShapeCache},
lattice::{chunk_map::ChunkMap, tracked_map::TrackedMap},
};
#[derive(De... |
#![warn(clippy::all)]
#[macro_use]
extern crate log;
use clap::{crate_version, App, Arg};
use explugin_example::ExEmptyPluginBuilder;
use libpcap_analyzer::*;
use libpcap_analyzer::plugins::PluginsFactory;
use libpcap_tools::{Config, PcapDataEngine, PcapEngine};
use simplelog::{LevelFilter, SimpleLogger};
use std::fs... |
use std::{fmt, mem, ptr};
use std::borrow::Borrow;
use crate::*;
/// DualShock4 HID Input report.
#[cfg(feature = "unstable")]
#[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)]
#[repr(C)]
pub struct DS4Report {
pub thumb_lx: u8,
pub thumb_ly: u8,
pub thumb_rx: u8,
pub thumb_ry: u8,
pub buttons: u16,
pub special... |
use crate::{
BytesCompression, CacheEntry, Chunk, ChunkMap, ChunkReadStorage, CompressedChunks,
CompressibleChunkStorage, IterChunkKeys, LocalCache, LruChunkCacheEntries, LruChunkCacheKeys,
};
use building_blocks_core::prelude::*;
use core::hash::Hash;
use fnv::FnvBuildHasher;
/// An object for reading from `... |
use core::hint::unreachable_unchecked;
use wasmlib::host;
/// Represents any valid smart contract type id.
#[derive(Clone, Copy, Debug, Hash, PartialEq, Eq, PartialOrd, Ord)]
#[repr(i32)]
pub enum ScTag {
/// Represents a smart contract address.
Address = host::TYPE_ADDRESS,
/// Represents a smart contract agent... |
//! Version 1 of the SERCOM pads module
//!
//! This module is a compatibility shim that allows existing code to use the new
//! [`sercom::v2`](crate::sercom::v2) module. This API will eventually be
//! deprecated and removed.
//!
//! To recreate the `v1` API with `v2` types, this module defines its own [Pad]
//! type.... |
use super::*;
mod parameters;
pub use parameters::*;
#[derive(Debug, Copy, Clone)]
pub enum DrawMode {
Points,
Lines { line_width: f32 },
LineStrip { line_width: f32 },
LineLoop { line_width: f32 },
Triangles,
TriangleStrip,
TriangleFan,
}
pub fn clear(framebuffer: &mut Framebuffer, colo... |
use bytes::{BufMut, BytesMut};
use std::error::Error;
use std::io::prelude::*;
use std::net::TcpStream;
use std::process::Command;
use std::thread;
use std::time::Duration;
fn transceive_packet(
stream: &mut TcpStream,
request: u16,
payload: &[u8],
response: &mut [u8],
) -> Result<(), Box<dyn Error>> {... |
use serde::export::Option::Some;
#[derive(Debug, Clone)]
pub struct Map {
tile_size: f64,
pub tiles: Vec<Tile>,
pub decorations: Vec<Tile>,
pub flag: Tile,
is_flag_reached: bool,
}
impl Map {
pub fn new(tile_size: f64) -> Map {
Map {
tile_size,
tiles: vec![
... |
use std::convert::TryInto;
use std::io;
use std::collections::HashSet;
macro_rules! parse_input {
($x:expr, $t:ident) => ($x.trim().parse::<$t>().unwrap())
}
#[derive(Clone)]
struct Cell {
ore:i8,
hole:bool,
}
struct Map {
grid:Vec<Cell>,
height:usize,
width:usize,
visible_ore:i32,
}
str... |
use anyhow::Result;
use colored::Colorize;
use itertools::Itertools;
use crate::color::VERSION_COLOR;
#[derive(Clone, Debug)]
pub struct Version {
pub version: Vec<String>,
}
impl Version {
pub fn new(version: &str) -> Self {
let (version, ..) = Self::split(version);
Self { version }
}
... |
use eyre::Context;
use vulkan::{
ClearColorValue, ClearDepthStencilValue, ClearValue, CommandBuffer, CommandBufferLevel,
CommandBufferUsageFlags, CommandPool, CommandPoolCreateFlags, CommandPoolResetFlags, Fence,
FenceCreateFlags, Offset2D, PipelineStageFlags, QueryPipelineStatisticFlags, QueryPool,
Que... |
use crate::*;
use bitcoincore_rpc::RpcApi;
use bitcoincore_rpc_json::{ImportMultiOptions, ImportMultiRequest, ImportMultiRescanSince};
use log::debug;
use log::info;
use structopt::StructOpt;
#[derive(StructOpt, Debug)]
pub struct CreateWalletOptions {
/// The name of the wallet to be created
#[structopt(long ... |
//! # typed_index_derive
//!
//! A frequent pattern in Rust is to store objects in a vector and use integer indexes
//! as handlers to them. While using `usize` works, it could become confusing if there
//! are several flavors of indexes. To make the meaning of each index clear the newtype
//! wrappers like `FooIdx(usi... |
// Copyright 2020 Hyperledger Ursa 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 required by applicable la... |
use super::{InterfaceType, Nl80211Attr, Nl80211Cmd};
use crate::{bss::Bss, interface::ScanError};
use macaddr::MacAddr6;
use neli::{
attr::Attribute,
consts::nl::{NlmF, NlmFFlags, Nlmsg},
consts::socket::NlFamily,
genl::{Genlmsghdr, Nlattr},
nl::{NlPayload, Nlmsghdr},
socket::NlSocketHandle,
... |
use makepad_render::*;
use crate::buttonlogic::*;
#[derive(Clone)]
pub struct TabClose {
pub bg: DrawTabClose,
pub animator: Animator,
}
#[derive(Clone, DrawQuad)]
#[repr(C)]
pub struct DrawTabClose {
#[default_shader(self::shader_bg)]
base: DrawColor,
hover: f32,
down: f32,
}
impl TabClose {... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::constants::CONFIG_CACHE_TIMEOUT,
crate::environment::Environment,
crate::file_backed_config::FileBacked as Config,
anyhow::{an... |
use std::cmp::Ordering;
pub fn cmp_module_specifiers(a: &str, b: &str, cmp_text: impl Fn(&str, &str) -> Ordering) -> Ordering {
let a_info = get_module_specifier_info(a);
let b_info = get_module_specifier_info(b);
return match a_info.kind {
ModuleSpecifierKind::Absolute => {
match b_in... |
extern crate regex;
use regex::Regex;
use std::collections::{BTreeSet, HashMap, HashSet, VecDeque};
use std::fs::File;
use std::io::BufRead;
use std::io::BufReader;
use std::path::Path;
use std::{thread, time};
fn main() {
let f = File::open("./src/input.txt").unwrap();
let mut file = BufReader::new(&f);
... |
use Token::*;
use regex::Regex;
#[derive(Clone, Eq, PartialEq, Debug)]
pub enum Token {
Lparen,
Rparen,
Plus,
Minus,
Number(i32),
Variable(String)
}
impl Token {
fn to_str(&self) -> String {
match self {
Lparen => "(".to_string(),
Rparen => ")".to_string(),
... |
use crate::common::*;
use datamodel::{ast::Span, common::ScalarType, configuration::*, error::DatamodelError};
use datamodel_connector::{Connector, ExampleConnector};
use pretty_assertions::assert_eq;
//##########################
// Directive implementation
//##########################
//struct CustomDirective {
// ... |
pub mod bearer;
use crate::drivers::ble::mesh::bearer::{Bearer, Handler};
use crate::drivers::ble::mesh::composition::ElementsHandler;
use crate::drivers::ble::mesh::config::configuration_manager::ConfigurationManager;
pub use crate::drivers::ble::mesh::driver::node::MeshNodeMessage;
use crate::drivers::ble::mesh::dri... |
use super::real_time_clock::{RTCRegister, RealTimeClock};
use super::MemoryBankController;
use crate::cartridge::cartridge_capability::CartridgeCapability;
use crate::util::savestate::{
read_savestate_bool, read_savestate_byte, LoadSavestateError, Savestate, SavestateStream,
};
use std::cmp;
pub struct MBC3 {
... |
// Copyright 2015 The rust-pcre authors.
//
// 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 distributed
// except ac... |
//! # Addr
//! An actor address with name, node ip and port
//!
use crate::{compute_hash, option_of_bytes, Config};
use local_ip_address::local_ip;
use serde::{Deserialize, Serialize};
use std::hash::Hash;
use std::net::{IpAddr, Ipv4Addr, SocketAddr};
///Handle the case when the system binds to all interfaces
static W... |
use super::*;
use std::collections::hash_map::{self, HashMap};
use std::io;
use std::process::exit;
/// The configuration for the argument parser.
///
/// # Parameters
///
/// `<'a>` – The lifetime of the arguments’ actions
///
/// `<T>` – The result type that each argument will be parsed into
#[derive(Debug)]
pub s... |
#![cfg_attr(target_os = "none", no_std)]
#![cfg_attr(target_os = "none", no_main)]
mod api;
use api::*;
use api::Opcode;
use num_traits::{FromPrimitive, ToPrimitive};
use xous::{msg_scalar_unpack, CID};
use xous_ipc::*;
#[derive(Copy, Clone, Debug)]
struct ScalarCallback {
server_to_cb_cid: CID,
cb_to_client... |
//! Parsing utilities for route config files.
// TODO: this parser is functional, but there's a lot more that can
// be done to improve robustness and error reporting.
use lazy_static::lazy_static;
use nom::types::CompleteStr;
use nom::{
alt_complete, apply, char, complete, count, delimited, do_parse, eof, line_e... |
use super::RttMeasurer;
use crate::{
config::SocketConfig,
errors::{LaminarError, PacketError},
net::{DeliveryMethod, ExternalAcks, LocalAckRecord},
packet::{
headers::{HeaderReader, ReliableHeader, StandardHeader},
PacketType, ProcessedPacket,
},
protocol_version,
sequence_b... |
use std::ffi::CString;
use x11_dl::xlib;
//#![allow(non_snake_case)]
#[derive(Clone, Debug)]
#[allow(non_snake_case)]
pub struct XAtom {
pub WMProtocols: xlib::Atom,
pub WMDelete: xlib::Atom,
pub WMState: xlib::Atom,
pub WMTakeFocus: xlib::Atom,
pub NetActiveWindow: xlib::Atom,
pub NetSupported... |
// Copyright 2019-2020 Alibaba Cloud. All rights reserved.
// Portions Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license ... |
//! A wide assortment of graphics meant to show off many different uses of piet
use piet::kurbo::{Affine, BezPath, Line, Point, Rect, RoundedRect, Vec2};
use piet::{
Color, Error, FontBuilder, ImageFormat, InterpolationMode, RenderContext, Text, TextLayout,
TextLayoutBuilder,
};
pub fn draw(rc: &mut impl Ren... |
// بِسْمِ اللَّهِ الرَّحْمَنِ الرَّحِيم
// This file is part of Setheum.
// Copyright (C) 2019-2021 <NAME>.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as publ... |
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT license.
use crate::{
engine::Engine,
protocols::{
arp,
ethernet2::MacAddress,
tcp,
},
runtime::{
PacketBuf,
Runtime,
},
scheduler::{
Operation,
Scheduler,
Scheduler... |
//! Chain specifications.
use local_runtime::{
wasm_binary_unwrap, AccountId, AuraConfig, AuraId, BalancesConfig, BaseFeeConfig,
BlockRewardConfig, EVMConfig, GenesisConfig, GrandpaConfig, GrandpaId, Precompiles, Signature,
SudoConfig, SystemConfig, VestingConfig,
};
use sc_service::ChainType;
use sp_core:... |
use anyhow::{anyhow, Result};
use gw_common::H256;
use gw_types::packed::LogItem;
use gw_types::prelude::*;
use std::usize;
pub const GW_LOG_SUDT_TRANSFER: u8 = 0x0;
pub const GW_LOG_SUDT_PAY_FEE: u8 = 0x1;
pub const GW_LOG_POLYJUICE_SYSTEM: u8 = 0x2;
pub const GW_LOG_POLYJUICE_USER: u8 = 0x3;
#[derive(Debug, Clone)]... |
use std::collections::HashMap;
use failure::Fail;
use log::trace;
use reqwest::blocking::{Client, Response};
use reqwest::StatusCode;
use serde::de::DeserializeOwned;
use serde::Deserialize;
use authenticate::{Scope, Token};
use get_home_status::HomeStatus;
use get_homes_data::HomesData;
use get_measure::Measure;
use... |
extern crate serde_json;
extern crate shiplift;
extern crate tokio;
use futures::StreamExt;
use serde_json::value::Value::{Object, String as Str};
use shiplift::rep::ContainerCreateInfo;
use shiplift::{tty::TtyChunk, ExecContainerOptions};
use shiplift::{BuildOptions, Container, ContainerOptions, Docker, RmContainerOp... |
use std::{fmt, str::FromStr};
use crate::expression::{expression_list, primary_expression, ExpressionList, PrimaryExpression};
use crate::literal::{numeric_literal, NumericLiteral};
use crate::terminals::{preceded_tag, sp, sp_enc, sp_enc1};
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::bytes::st... |
use super::{config, constant::*};
use crate::{
base::{check_validity_for_reuse_statistic, constant::*, ResourceType},
Error, Result,
};
use serde::{Deserialize, Serialize};
use serde_json;
use std::path::PathBuf;
use std::{fmt, net::SocketAddr};
#[derive(Serialize, Deserialize, Debug)]
pub struct AppConfig {
... |
use std::sync::Arc;
use super::{Future, SynthesisError};
use ff::{Field, PrimeField, ScalarEngine};
use pairing::Engine;
use super::{ParameterSource, Result};
use crate::{ConstraintSystem, Index, LinearCombination, Coefficient};
use crate::{domain, multiexp};
use domain::Scalar;
use multiexp::DensityTracker;
mod bu... |
//! # Store Config
//!
//! `store` is the module containing the store configuration type and functions.
use crate::error::Error;
use crate::result::Result;
use serde::{Deserialize, Serialize};
use serde_cbor;
use serde_json;
use toml;
/// `StoreConfig` is the type representing a store configuration.
#[derive(Clone, E... |
use crate::{runner, Command, CommandResult, Runner};
use chrono::{DateTime, Local};
use serde::Serialize;
use snafu::{ResultExt, Snafu};
use std::{collections::HashMap, fmt::Debug};
use uname;
/// Error type
#[derive(Debug, Snafu)]
#[allow(missing_docs)]
pub enum Error {
/// Context initialization failed
#[sn... |
use super::nodes::*;
use super::schema::*;
use super::util;
use curve25519_dalek::scalar::Scalar;
use zkvm::blockchain::{Block, BlockchainState};
use zkvm::TxEntry;
use serde_json::Value as JsonValue;
use std::collections::HashMap;
// Stored data
#[derive(Debug, Queryable, Insertable)]
pub struct BlockRecord {
p... |
use crate::error::{Result, SandboxError};
use async_trait::async_trait;
use derive_builder::Builder;
use dyn_clone::clone_trait_object;
use dyn_clone::DynClone;
use getset::{CopyGetters, Getters, Setters};
use std::fmt::Debug;
use std::fmt::Display;
use std::path::{Path, PathBuf};
use std::process::Output;
use strum::{... |
use crate::ast::{Datatype, Ident, Krate, Path, Typ, TypX, VirErr};
use crate::ast_util::{err_str, err_string, path_as_rust_name};
use crate::scc::Graph;
use air::ast::Span;
use std::collections::HashMap;
// To enable decreases clauses on datatypes while treating the datatypes as inhabited in specs,
// we need to make ... |
use anyhow::{Context, Result};
use std::fmt;
pub fn part1(input: &str) -> Result<impl fmt::Display> {
let pb = parse(input)?;
Ok(pb.iter().filter(|p| p.is_complete()).count())
}
pub fn part2(input: &str) -> Result<impl fmt::Display> {
let pb = parse(input)?;
Ok(pb
.iter()
.filter(|p| ma... |
use crate::{
console::CONS,
memlayout::UART0,
printf::PR,
proc::{Process, CPUS, PROCS},
spinlock::Mutex,
};
use core::{num::Wrapping, ptr, sync::atomic::Ordering};
use Register::*;
const IER_RX_ENABLE: u8 = 1 << 0;
const IER_TX_ENABLE: u8 = 1 << 1;
const FCR_FIFO_ENABLE: u8 = 1 << 0;
const FCR_FIFO... |
#![deny(missing_docs)]
use num_traits::cast::NumCast;
use gl33::global_loader::*;
use gl33::*;
use glutin::event_loop::EventLoop;
use glutin::window::Window;
use glutin::window::WindowBuilder;
use glutin::{
Api, ContextBuilder as GlutinContextBuilder, ContextWrapper, GlRequest, PossiblyCurrent,
};
use crate::{Colo... |
use std::convert::TryFrom;
use std::env;
use std::fs;
use std::net::Ipv4Addr;
use std::path::{Path, PathBuf};
use serde::{Deserialize, Serialize};
use structopt::StructOpt;
pub const DEFAULT_CONFIG_FILE: &str = "./config.yaml";
pub const DEFAULT_SCHEDULES_FOLDER: &str = "./schedules";
pub const DEFAULT_LOG_LEVEL: &st... |
use std::{
ffi::{OsStr, OsString},
os::unix::{ffi::OsStrExt, fs::PermissionsExt},
path::{Path, PathBuf},
process::{Command, Output},
};
use snafu::{ensure, ResultExt};
use crate::error;
const NIXPKGS: &str = "<nixpkgs>";
trait CommandExt {
fn to_command_string(&self) -> String;
fn run(&mut ... |
use crate::actors::block::{GroundBlockMid, GroundBlockTop, StartBlock, StoneBlock};
use crate::actors::coin::Coin;
use crate::actors::koopa::Koopa;
use crate::actors::player::Player;
use mold2d;
use mold2d::{
ActorIndex, ActorManager, ActorPosition, ActorToken, CollisionSide, Context, MessageHandler,
PositionCh... |
extern crate math2d;
extern crate rand;
use std::f32::consts::PI;
use math2d::matrix3x2f::IDENTITY;
use math2d::point2f::ORIGIN;
use math2d::vector2f::{ONE, ZERO};
use math2d::Matrix3x2f;
const EPSILON: f32 = 1e-5;
const SEED: [u8; 16] = [
0x68, 0x16, 0x78, 0x24, 0x6a, 0xc0, 0x74, 0x5f, 0xf0, 0x60, 0xf8, 0xe9, 0... |
// Copyright (c) 2019 Dropbox, Inc.
use std::fmt::Debug;
use std::marker::PhantomData;
use crate::{Error, ErrorKind, ResultExt};
use crate::client_trait::*;
use serde::de::{self, Deserialize, DeserializeOwned, Deserializer, MapAccess, Visitor};
use serde::ser::Serialize;
use serde_json;
// When Dropbox returns an err... |
//! Custom derive support for `abscissa_core::component::Component`.
use proc_macro2::{Ident, Span, TokenStream};
use quote::quote;
use syn::{DeriveInput, Lit, Meta, MetaList, MetaNameValue, NestedMeta};
use synstructure::Structure;
/// Custom derive for `abscissa_core::component::Component`
pub fn derive_component(s... |
use core::panic;
use std::env;
use std::fs;
use std::path::{Path, PathBuf};
use std::process::{Command, Stdio};
fn get_graphviz_dir() -> PathBuf {
let dir = env::var("CARGO_MANIFEST_DIR").unwrap();
let graphviz_dir = Path::new(&dir).join("graphviz-2.49.0");
if fs::metadata(&graphviz_dir)
.map(|m| m... |
//extern crate colored; // not needed in Rust 2018
use colored::*;
use std::path::Path;
use std::convert::TryInto;
pub fn blur(infile: String, outfile: String) {
// Here's how you open an existing image file
let img = image::open(infile).expect("Failed to open INFILE.");
// **OPTION**
// Parse the blu... |
use std::hash::Hash;
use std::collections::hash_map::{self, HashMap};
use std::sync::Mutex;
use super::{DiagnosticSink, Diagnostic};
use crate::syntax::FallFile;
use super::query;
type QMap<'f, Q> = Mutex<HashMap<Q, <Q as Query<'f>>::Result>>;
pub(crate) struct DB<'f> {
file: FallFile<'f>,
pub(super) diagno... |
use std::fmt;
use std::rc::Rc;
use super::types::TargetView;
use crate::graphics::gpu::quad::{self, Pipeline};
use crate::graphics::Transformation;
#[derive(Clone)]
pub struct Texture {
texture: Rc<wgpu::Texture>,
view: TargetView,
binding: Rc<quad::TextureBinding>,
width: u16,
height: u16,
la... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
cluster::Cluster,
cluster_swarm::{cluster_swarm_kube::ClusterSwarmKube, ClusterSwarm},
experiments::{Context, Experiment, ExperimentParam},
instance::Instance,
tx_emitter::EmitJobRequest,
};
use anyhow:... |
use crate::errors::CompileError;
use crate::yul::mappers::expressions;
use crate::yul::operations::data as data_operations;
use fe_analyzer::namespace::types::FixedSize;
use fe_analyzer::{
Context,
Location,
};
use fe_parser::ast as fe;
use fe_parser::span::Spanned;
use std::convert::TryFrom;
use yultsur::*;
/... |
use std::io::{Read, Write};
use std::mem;
use std::time::Duration;
use crate::codecs::{FromByte, ToByte};
use crate::error::{Error, KafkaCode, Result};
use crc::Crc;
/// Macro to return Result<()> from multiple statements
macro_rules! try_multi {
($($input_expr:expr),*) => ({
$($input_expr?;)*
Ok(... |
//! Utilities for mapping between offset:length bytes and col:row character positions.
use rowan::{TextRange, TextSize};
pub use lsp_types::{Position, Range};
use std::iter;
/// Offset in characters instead of bytes.
/// It is u64 because lsp_types uses u64.
pub type CharacterOffset = u64;
/// Offset range in chara... |
// Copyright 2012-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
// Generated from definition io.k8s.api.extensions.v1beta1.NetworkPolicySpec
/// DEPRECATED 1.9 - This group version of NetworkPolicySpec is deprecated by networking/v1/NetworkPolicySpec.
#[derive(Clone, Debug, Default, PartialEq)]
pub struct NetworkPolicySpec {
/// List of egress rules to be applied to the select... |
// Copyright 2019 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or d... |
use polyhorn_ios_sys::polykit::{
PLYByEdge, PLYCornerRadii, PLYDimension, PLYDimensionKind, PLYLayoutAxisX, PLYLayoutAxisY,
PLYPoint,
};
use polyhorn_ios_sys::quartzcore::CATransform3D;
use polyhorn_ios_sys::uikit::{UIColor, UIFont, UIScrollViewIndicatorStyle};
use polyhorn_ui::color::Color;
use polyhorn_ui::fo... |
use std::sync::Arc;
use zoon::{eprintln, println, *, strum::EnumIter};
pub mod view;
mod todo_id;
use todo_id::TodoId;
static STORAGE_KEY: &str = "<KEY>";
// ------ ------
// Types
// ------ ------
// ------ Filter -------
#[derive(Copy, Clone, Eq, PartialEq, EnumIter, Deserialize, Serialize)]
#[serde(crate =... |
/*
* Copyright 2019 Comcast Cable Communications Management, LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicab... |
//! # No-op OpenTelemetry Trace Implementation
//!
//! This implementation is returned as the global tracer if no `Tracer`
//! has been set. It is also useful for testing purposes as it is intended
//! to have minimal resource utilization and runtime impact.
use crate::{
sdk::export::trace::{ExportResult, SpanData,... |
// 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 fidl_fuchsia_media::FormatDetails;
pub trait ElementaryStream {
fn format_details(&self, version_ordinal: u64) -> FormatDetails;
/// Whether ... |
//! `wren_class` attribute.
use proc_macro2::TokenStream;
use quote::{format_ident, quote};
use syn::{
parse::{Parse, ParseStream},
punctuated::Punctuated,
Expr, ExprAssign, Ident, Token,
};
/// Generate an implementation of `FromWren` for the given type identifier.
///
/// The type must be `'static` since... |
use std::collections::BTreeMap;
use std::str::FromStr;
#[derive(Debug, Eq, PartialEq, Clone, strum::Display, strum::IntoStaticStr)]
pub enum Item {
Value(i64),
Variable(Variable),
}
impl Item {
pub fn resolve(&self, variables: &BTreeMap<Variable, i64>) -> i64 {
match self {
Item::Varia... |
//! Extractor for getting connection information from a client.
//!
//! See [`Router::into_make_service_with_connect_info`] for more details.
//!
//! [`Router::into_make_service_with_connect_info`]: crate::routing::Router::into_make_service_with_connect_info
use super::{Extension, FromRequest, RequestParts};
use crate... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use std::{io::Read, mem, slice, sync::Arc};
use anyhow::{ensure, Error};
use fidl_fuchsia_sysmem::{BufferCollectionSynchronousProxy, CoherencyDomain};
use... |
use std::{
io::{self, BufRead, BufReader, Read},
path::PathBuf,
process::{Command, Stdio},
};
use snafu::{OptionExt, ResultExt, Snafu};
use crate::{
get_player_dir, PlayerProcesses, CONDUCTOR_CONFIG_FILENAME, CONDUCTOR_STDERR_LOG_FILENAME,
CONDUCTOR_STDOUT_LOG_FILENAME, LAIR_STDERR_LOG_FILENAME, M... |
use crate::XkcdState;
use crate::{XKCD_INDEX, XKCD_INDEX_READER, XKCD_INDEX_SCHEMA};
use serde::Deserialize;
use serenity::prelude::*;
use serenity::{
framework::standard::{macros::command, Args, CommandResult},
model::channel::Message,
};
use tantivy::collector::TopDocs;
use tantivy::query::QueryParser;
use ta... |
// -*- mode: rust; -*-
//
// This file is part of tiny-ped-com.
// Copyright (c) 2018 <NAME>
// See LICENSE for licensing information.
//
// Authors:
// - <NAME> <<EMAIL>>
//!
//! A small Rust library for Pedersen commitments over elliptc curves.
//!
//! Example usage:
//!
//! ```
//! let mut rng = OsRng::new().unwrap(... |
use clap::*;
use log::{debug, info};
use simplelog::*;
use std::fs::File;
// Create clap subcommand arguments
pub fn make_subcommand<'a>() -> Command<'a> {
Command::new("txdb")
.about("Init the taxonomy database")
.after_help(
"\
~/.nwr/taxonomy.sqlite\n\
",
... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
sandbox::utils::{
package::{MovePackage, SourceFilter},
OnDiskStateView,
},
DEFAULT_PACKAGE_DIR,
};
use anyhow::{bail, Result};
use include_dir::{include_dir, Dir};
use move_binary_format::file_f... |
//! A post-processing effect to highlight edges.
use na::Vector2;
use crate::context::Context;
use crate::post_processing::post_processing_effect::PostProcessingEffect;
use crate::resource::{
AllocationType, BufferType, Effect, GPUVec, RenderTarget, ShaderAttribute, ShaderUniform,
};
#[path = "../error.rs"]
mod ... |
use crate::database::Gallery;
use crate::exhentai::*;
use crate::utils::*;
use crate::{BOT, CONFIG, DB};
use anyhow::Result;
use chrono::{Duration, Utc};
use telegraph_rs::{html_to_node, Page, Telegraph};
use teloxide::prelude::*;
use teloxide::types::ChatOrInlineMessage;
use teloxide::ApiErrorKind;
use v_htmlescape::e... |
//! Contains our type for GPS/WGS84 coordinates with the corresponding methods.
use distance::{fcc_approximation, ConvertError, Meter};
use exif;
use exif::Field;
use std;
use std::path::Path;
/// WGS84 Coordinates.
///
/// No validation or normalisation is done at the moment!
#[derive(Debug, PartialEq, Copy, Clone)]... |
//! DNS Client cache
#[cfg(unix)]
use std::path::Path;
use std::{
collections::{hash_map::Entry, HashMap, VecDeque},
future::Future,
io,
net::SocketAddr,
time::Duration,
};
use log::{debug, trace};
use tokio::sync::Mutex;
use trust_dns_resolver::proto::{error::ProtoError, op::Message};
use shadow... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.