text stringlengths 3.09k 13.9k |
|---|
use std::collections::{HashSet, HashMap};
use std::option::Option;
use super::claim::*;
use super::reference::*;
use super::secret::*;
/// Models an OpenID Connect or OAuth2 client
#[derive(Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct Client {
/// Specifies if client is enabled (defaults to <c>true<... |
#![warn(rust_2018_idioms)]
pub mod data;
pub mod param;
pub mod services;
mod errors;
pub use errors::*;
#[derive(Debug, serde::Deserialize)]
pub struct Pager<T> {
pub total: usize,
pub data: Vec<T>,
}
#[derive(Clone)]
struct Config {
base_url: String,
}
struct Request<S: serde::Serialize> {
path:... |
// Copyright 2013 <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, ... |
use chapter2::dungeon::{Dungeon};
use chapter2::celloption::{Occupant};
use chapter2::genotype::{Genotype};
use chapter2::phenotype::{Seed};
use util::config::{Config};
use util::util::{odds};
use rand::{Rng};
#[derive(Clone, Debug)]
pub struct ListOfWalls {
seed: Seed,
walls: Vec<Wall>,
coverage: f64,
... |
use std::{collections::HashMap, time::Duration};
use futures::{
channel::mpsc::{self, Receiver, Sender},
StreamExt,
};
use http::{header::AUTHORIZATION, Method, Request, StatusCode, Uri};
use hyper::{client::HttpConnector, Body, Client};
use metrics::counter;
use serde::Deserialize;
use crate::splunk_hec_gen:... |
use anyhow::{anyhow, Result};
use structopt::{clap::arg_enum, StructOpt};
use url::Url;
arg_enum! {
#[derive(Debug, Clone)]
pub enum TransactionConfig {
NoTransaction,
ReadUncommitted,
ReadCommitted,
RepeatableRead,
Serializable,
}
}
impl Default for TransactionConf... |
// Copyright 2020 <NAME>.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
use std::{fmt::{Formatter, Display}};
use once_cell::sync::Lazy;
#[derive(PartialEq)]
pub enum SetResult {
Set,
NotSet
}
type SudokuMatrix = Box<[u8; 81]>;
type ConstraintTable = Box<[[bool; 10]; 9]>;
type RowColSqArray = [(usize, usize, usize); 81];
// [ARoney] NOTE: The inner arrays for the constraint tabl... |
// Tunnul
// Copyright (c) 2015, <NAME>
// All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions
// are met:
// 1. Redistributions of source code must retain the above copyright
// notice, this list of conditio... |
// 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... |
use crate::commands::WholeStreamCommand;
use crate::data::{Primitive, Value};
use crate::prelude::*;
use csv::WriterBuilder;
pub struct ToTSV;
#[derive(Deserialize)]
pub struct ToTSVArgs {
headerless: bool,
}
impl WholeStreamCommand for ToTSV {
fn name(&self) -> &str {
"to-tsv"
}
fn signatur... |
#![deny(clippy::all, clippy::cargo)]
#![warn(missing_docs, nonstandard_style, rust_2018_idioms)]
#![warn(clippy::multiple_crate_versions)]
//! This crate includes a base HTTP client to interact with
//! the AWS Lambda Runtime API.
use http::{uri::PathAndQuery, uri::Scheme, Request, Response, Uri};
use hyper::{
cli... |
use crate::layout::common::{coverage_or_nah, FromLowlevel, ToLowlevel};
use otspec::layout::coverage::Coverage;
use otspec::layout::gsub1::{SingleSubstFormat1, SingleSubstFormat2};
use otspec::tables::GSUB::GSUBSubtable;
use otspec::types::*;
use std::collections::BTreeMap;
/* This struct is the user-facing representa... |
/*
* MinIO Rust Library for Amazon S3 Compatible Cloud Storage
* Copyright 2019 MinIO, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICE... |
// Take a look at the license at the top of the repository in the LICENSE file.
#[cfg(feature = "use_glib")]
use glib::translate::*;
use std::cmp::PartialEq;
use std::hash;
#[cfg(any(feature = "v1_16", feature = "dox"))]
use crate::font::font_face::to_optional_string;
#[cfg(any(feature = "v1_16", feature = "dox"))]
u... |
#[macro_use]
mod macros;
pub mod audio;
pub mod camera;
pub mod collision;
pub mod color;
pub mod data;
pub mod drawing;
pub mod file;
pub mod input;
pub mod logging;
pub mod math;
pub mod misc;
pub mod models;
pub mod shaders;
pub mod text;
pub mod texture;
pub mod vr;
pub mod window;
use crate::ffi;
use std::ffi::C... |
//! Generic implementation of Hash-based Message Authentication Code (HMAC).
//!
//! To use it you'll need a cryptographic hash function implementation from
//! RustCrypto project. You can either import specific crate (e.g. `sha2`), or
//! meta-crate `crypto-hashes` which reexport all related crates.
//!
//! # Usage
//... |
// Copyright 2018 PingCAP, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
//! Merkle tree used in Tendermint networks
pub mod proof;
use sha2::{Digest, Sha256};
/// Size of Merkle root hash
pub const HASH_SIZE: usize = 32;
/// Hash is the output of the cryptographic digest function
pub type Hash = [u8; HASH_SIZE];
/// Compute a simple Merkle root from vectors of arbitrary byte vectors.
/... |
use itertools::{
EitherOrBoth::{Both, Left, Right},
Itertools,
};
use json::Location;
use serde::Serialize;
use serde_json::Value;
/// Diff is a detected difference within a document.
#[derive(Serialize, Debug)]
pub struct Diff {
/// JSON-Pointer location of the difference.
pub location: String,
//... |
use byteorder::{ByteOrder, LittleEndian};
use ckb_vm::instructions::{extract_opcode, i, m, rvc, Instruction, Itype, Stype, Utype};
use ckb_vm_definitions::instructions as insts;
use clap::{App, Arg};
use goblin::elf::{section_header::SHF_EXECINSTR, Elf};
use std::fs::{read, write};
fn main() {
let matches = App::n... |
use ethers::types::{Address, Bytes, NameOrAddress, U256};
use forge::{
executor::{CallResult, DatabaseRef, DeployResult, EvmError, Executor, RawCallResult},
trace::{CallTraceArena, TraceKind},
CALLER,
};
use super::*;
pub struct Runner<DB: DatabaseRef> {
pub executor: Executor<DB>,
pub initial_bala... |
use std::fmt;
use std::collections::HashMap;
const DEFAULT_DELTA: f64 = 1.0;
#[derive(Debug)]
pub struct Node {
pub weight: f64,
pub outbound: f64,
}
impl fmt::Display for Node {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f,"({}, {})", self.weight, self.outbound)
}
}
pub s... |
use chalk_ir::interner::{HasInterner, Interner};
use chalk_ir::*;
use chalk_ir::{cast::Cast, fold::Fold};
use tracing::{debug, instrument};
pub(crate) mod canonicalize;
pub(crate) mod instantiate;
mod invert;
mod normalize_deep;
mod test;
pub(crate) mod ucanonicalize;
pub(crate) mod unify;
pub(crate) mod var;
use sel... |
#![no_std]
#![no_main]
#![feature(asm)]
use core::panic::PanicInfo;
use pudding_pac::arm::cpu;
mod bootstrap;
//mod rtos;
use jelly_rtos::rtos;
#[macro_use]
pub mod uart;
use uart::*;
//mod timer;
#[panic_handler]
fn panic(_panic: &PanicInfo<'_>) -> ! {
println!("\r\n!!!panic!!!");
loop {}
}
static mut ST... |
//! Module for standard generic contract factory manager.
//! TODO: move to near-sdk standards library.
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize};
use near_sdk::json_types::Base58CryptoHash;
use near_sdk::serde_json;
use near_sdk::{env, sys, AccountId, Balance, CryptoHash, Gas};
/// Gas spent on t... |
use std::{
collections::HashMap,
sync::{
atomic::{AtomicUsize, Ordering},
mpsc::{channel, Receiver, Sender},
Arc, Mutex, RwLock,
},
};
use inox_uid::Uid;
pub type JobId = Uid;
pub const INDEPENDENT_JOB_ID: JobId = inox_uid::generate_static_uid_from_string("IndependentJob");
pub st... |
use crossterm::{
self, cursor,
event::{self, poll, Event, KeyCode, KeyModifiers},
execute, terminal,
};
use serde_json::{json, Value};
use std::{
io::{self, ErrorKind, Read, Write},
net::TcpStream,
process,
sync::mpsc::{self, TryRecvError},
time::Duration,
};
use tui::{
backend::Cros... |
//! Multi-platform support interfaces.
use std::cell::RefCell;
use std::collections::HashSet;
use std::env;
use std::path::{Path, PathBuf};
use std::process::{Command, Output};
use crate::sw::instrument::Spec;
use super::error::SoftwareError;
use super::Platform;
use super::PlatformSupport;
use super::Result;
/// T... |
use super::stat::WorkerLocalStat;
use super::work_bucket::*;
use super::*;
use crate::mmtk::MMTK;
use crate::util::copy::GCWorkerCopyContext;
use crate::util::opaque_pointer::*;
use crate::vm::VMBinding;
use atomic_refcell::{AtomicRef, AtomicRefCell, AtomicRefMut};
use std::sync::atomic::{AtomicBool, Ordering};
use std... |
use crate::camera::*;
use crate::core::*;
use crate::definition::*;
use crate::math::*;
use std::f32::consts::PI;
const NO_VIEW_ANGLES: u32 = 8;
///
/// A level-of-detail technique to replace rendering high-poly meshes at a distance.
/// A mesh is rendered from different angles into a set of textures and the textures... |
// Copyright 2019, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use crate::interpreter::environment::EnvironmentId;
use crate::interpreter::error::{Error, ErrorKind};
use crate::interpreter::interpreter::Interpreter;
use crate::interpreter::value::Value;
use crate::interpreter::library;
use crate::interpreter::value::SymbolId;
fn make_dotimes_environment(
interpreter: &mut In... |
//! The `FluentValue` enum represents values which can be formatted to a String.
//!
//! The [`ResolveValue`][] trait from the [`resolve`][] module evaluates AST nodes into
//! `FluentValues` which can then be formatted to Strings using the i18n formatters stored by the
//! `FluentBundle` instance if required.
//!
//! ... |
use std::fs;
use pyo3::prelude::*;
use pyo3::types::PyDict;
use crate::config::{Config, Delimiter};
use crate::util;
use crate::CliError;
use crate::CliResult;
use indicatif::{ProgressBar, ProgressDrawTarget};
use serde::Deserialize;
const HELPERS: &str = r#"
def cast_as_string(value):
if isinstance(value, str):... |
use std::io::{self, Error};
use std::fs::File;
use std::io::BufReader;
use std::io::prelude::*;
use std::mem;
use libc::{socket, recvfrom, sendto, close, AF_PACKET, SOCK_RAW, AF_AX25,
sockaddr, socklen_t, sockaddr_ll, c_void, c_int, c_char, c_ulong};
const ETH_P_AX25: u16 = 0x0002; // from if_ether.h for SOCK_RA... |
use crate::{
event::{self, Event, LogEvent, Value},
internal_events::KubernetesLogsDockerFormatParseFailed,
transforms::Transform,
};
use chrono::{DateTime, Utc};
use lazy_static::lazy_static;
use serde_json::Value as JsonValue;
use snafu::{OptionExt, ResultExt, Snafu};
use string_cache::DefaultAtom as Atom... |
//! HTTP/1.1 Upgrades
use super::{h1, Body};
use futures::{
future::{self, Either},
TryFutureExt,
};
use hyper::upgrade::OnUpgrade;
use linkerd2_drain as drain;
use linkerd2_duplex::Duplex;
use std::fmt;
use std::mem;
use std::sync::Arc;
use std::task::{Context, Poll};
use tracing::{debug, info, trace};
use tr... |
use ash::{
extensions::khr::Surface,
version::{DeviceV1_0, EntryV1_0, InstanceV1_0},
vk, Device, Entry, Instance,
};
use super::platform::{create_surface, extension_names};
use super::{
debug::{Debugger, ValidationInfo},
device,
queue::QueueFamilyIndices,
};
use crate::constants::*;
use std::f... |
#[macro_use]
extern crate failure;
extern crate nix;
extern crate serde_yaml;
extern crate signal_notify as sig;
#[macro_use]
extern crate taskmaster;
use failure::Error;
use sig::Signal;
use std::io::{self, stdin, stdout, BufRead, Read, Write};
use std::net::TcpStream;
use std::sync::mpsc;
use std::thread;
use std::t... |
extern crate chrono;
extern crate i3status_ext;
extern crate notify_rust;
extern crate openweathermap;
use clap::{crate_version, load_yaml, App};
use std::collections::HashMap;
use std::thread;
use std::time::Duration;
mod level;
mod notify;
mod spot;
mod weather;
use level::Level;
use notify::Notify;
use spot::*;
u... |
#![feature(try_from)]
#[macro_use]
extern crate hdk;
extern crate serde;
#[macro_use]
extern crate serde_derive;
extern crate serde_json;
#[macro_use]
extern crate holochain_core_types_derive;
use hdk::{
entry_definition::ValidatingEntryType,
error::ZomeApiResult, error::ZomeApiError
};
use hdk::holochain_core... |
use crate::Cmp;
/// Struct containing a version number with some meta data.
/// Such a set can be used for testing.
///
/// # Arguments
///
/// - `0`: The version string.
/// - `1`: Number of version parts.
pub struct Version(pub &'static str, pub usize);
/// List of version numbers with metadata for dynamic tests
pu... |
use crate::graph::*;
use super::common::*;
use serde::{Deserialize, Serialize};
use std::mem::size_of;
#[derive(Default, Clone, Debug, Serialize, Deserialize)]
struct Node {
// Offset in the `edge_references` array to iterate over outgoing edges.
pub out_edges_offset: Idx,
// Offset in the `edge_references` arra... |
use goblin::{elf, mach};
use elf::{find_elf_section, has_elf_section};
use mach::{find_mach_section, has_mach_segment};
use object::{Object, ObjectTarget};
/// Provides access to DWARF debugging information in object files.
pub trait DwarfData {
/// Checks whether this object contains DWARF infos.
fn has_dwar... |
#![no_std]
#![feature(type_alias_impl_trait)]
#![feature(alloc_error_handler)]
#![allow(incomplete_features)]
#![feature(cell_update)]
pub mod app;
pub mod board;
pub mod drivers;
pub mod tasks;
use core::alloc::Layout;
#[allow(unused)]
use core::panic::PanicInfo;
use core::sync::atomic::{AtomicUsize, Ordering};
use... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::cli_state::CliState;
use crate::StarcoinOpt;
use anyhow::{bail, ensure, format_err, Result};
use scmd::{CommandAction, ExecContext};
use starcoin_config::temp_path;
use starcoin_move_compiler::move_command_line_common::fi... |
use actix::prelude::*;
use actix_broker::BrokerSubscribe;
use std::collections::HashMap;
use std::time::Duration;
use crate::engine::config::Configs;
use crate::engine::entities::Entities;
use crate::engine::world::{WorldConfig, WorldMeta};
use super::super::engine::{chunks::Chunks, clock::Clock, players::Players, w... |
//! This module is an implemention of a namespacing scheme described
//! in https://github.com/webmaster128/key-namespacing#length-prefixed-keys
//!
//! Everything in this file is only responsible for building such keys
//! and is in no way specific to any kind of storage.
use serde::de::DeserializeOwned;
use std::any... |
use crate::crypto::{
pubkey_to_address, CreateKey, Ed25519PrivKey, Ed25519PubKey, Error, Message, PubKey,
};
use hex::encode;
use sodiumoxide::crypto::sign::{
gen_keypair, sign_detached, verify_detached, PublicKey as EdPublicKey, SecretKey,
Signature as EdSignature,
};
use std::fmt;
use std::ops::{Deref, De... |
// Copyright 2020-2021 The Datafuse Authors.
//
// SPDX-License-Identifier: Apache-2.0.
use std::any::Any;
use std::collections::HashMap;
use std::sync::Arc;
use std::time::Instant;
use common_arrow::arrow::array::BinaryBuilder;
use common_arrow::arrow::array::StringBuilder;
use common_datablocks::DataBlock;
use comm... |
extern crate indyrs as indy;
use std::path::Path;
use std::path::PathBuf;
use std::fs;
use utils::environment::EnvironmentUtils;
use std::io::Write;
use sovtoken::utils::random::rand_string;
use indy::future::Future;
pub fn create_pool_config() -> String {
let path = create_genesis_txn_file_for_test_pool("p1", N... |
//! Timer driver.
use crate::chip_config::CONFIG;
use kernel::common::cells::OptionalCell;
use kernel::common::registers::{register_bitfields, register_structs, ReadWrite, WriteOnly};
use kernel::common::StaticRef;
use kernel::hil::time;
use kernel::hil::time::{Ticks, Ticks64, Time};
use kernel::ReturnCode;
const PRE... |
use bevy::prelude::{Local, Query, Res, ResMut, State};
use bevy_egui::{egui, EguiContext};
use rand::Rng;
use rose_game_common::{
components::{Npc, Team},
messages::client::ClientMessage,
};
use crate::{
resources::{AppState, GameConnection, GameData},
ui::UiStateDebugWindows,
};
#[derive(Debug, Parti... |
use crate::IndexSet;
use rustpython_bytecode::{CodeFlags, CodeObject, ConstantData, Instruction, Label, Location};
pub type BlockIdx = Label;
#[derive(Debug)]
pub struct InstructionInfo {
/// If the instruction has a Label argument, it's actually a BlockIdx, not a code offset
pub instr: Instruction,
pub l... |
// cargo run --release --example meander_blobs -- --blobs 400 --noise 0.8 --x-start -500 --x-end 700 --y-start -200 --y-end 200 --detail 10 --meander 3 --rotation 0 --seed 15
// cargo run --release --example meander_blobs -- --blobs 750 --noise 01 --x-start -700 --x-end 700 --y-start -200 --y-end 400 --detail 11 --mean... |
use crate::config::CacheConfig;
use anyhow::anyhow;
use dashmap::DashMap;
use flate2::read::GzEncoder;
use flate2::Compression;
use hyper::body::Bytes;
use lazy_static::lazy_static;
use mime::Mime;
use std::collections::HashMap;
use std::collections::HashSet;
use std::fs::{File, Metadata};
use std::io::{BufReader, Read... |
// Copyright 2020, The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
use minreq::Response;
use serde::de::DeserializeOwned;
use std::fmt::{self, Display};
use std::borrow::Cow::{self, Borrowed, Owned};
use crate::error::{ApiError, ApiErrorKind};
// Base url to the GW2 API.
pub const BASE_URL: &str = "https://api.guildwars2.com";
// Wait max 10 seconds for a response from the server.
... |
use actix_files as fs;
use actix_web::{
error, get, middleware, post, web, App, Error, HttpRequest, HttpResponse, HttpServer, Result,
};
use entity::post;
use entity::post::Entity as Post;
use entity::sea_orm;
use listenfd::ListenFd;
use migration::{Migrator, MigratorTrait};
use sea_orm::DatabaseConnection;
use se... |
#![no_std]
#![allow(non_camel_case_types, non_snake_case, non_upper_case_globals)]
#![cfg_attr(Py_LIMITED_API, allow(unused_imports))]
// old: marked with TODO
// Based on the headers of Python 3.4.3
// Supports the stable ABI (PEP 384) only.
// new:
// Based on the headers of Python 3.3.0, 3.4.0 and 3.5.0.
extern c... |
use smallvec::SmallVec;
use std::cell::RefCell;
use crate::attribute::typing::EdgeFunctionBwd;
use super::attribute::Attribute;
use super::typing::EdgeFunctionFwd;
use super::attribute_name::AttributeName;
const MAX_EDGE_COUNT: usize = 30;
#[derive(Copy, Clone, Debug)]
struct SimpleEntry {
pub value_from_edge: ... |
use futures;
use futures::future;
use futures::future::FutureResult;
use futures::{Future, Stream};
use futures::stream;
use std::io::{Error as IOError};
use hyper;
use hyper::{Body, Chunk, Method, StatusCode};
use hyper::error::Error;
use hyper::header::ContentLength;
use hyper::server::{Http, Request, Response, Ser... |
/*! # Addressable Bits
`bitvec` is a foundation library for memory compaction techniques that rely on
viewing memory as bit-addressed rather than byte-addressed.
The `bitvec` project is designed to provide a comprehensive set of tools for
users who need memory compaction, with as low a cost as possible.
# Usage
`bi... |
mod athing;
use crate::athing::*;
use select::{
document::Document,
predicate::{Class, Name, Predicate},
};
use std::error::Error;
/// Maximum post fetch count
const MAX_POSTS: usize = 100;
fn main() {
// handle cli args
let args = clap::App::new("Hacker News Scraper")
.version("0.1")
... |
use alloc::prelude::v1::Box;
use alloc::vec::Vec;
use diem_types::account_address::AccountAddress;
use move_binary_format::access::ModuleAccess;
use move_binary_format::file_format::{
Ability, AbilitySet, SignatureToken, StructFieldInformation, StructHandleIndex, Visibility,
};
use move_binary_format::CompiledModul... |
//! Tool remove PCR duplicates from UMI-tagged reads.
//!
//! This tool takes two FASTQ files (forward and reverse)
//! and returns two FASTQ files in which all PCR duplicates
//! have been merged into a consensus read.
//! Duplicates are identified by a Unique Molecular Identifier (UMI).
//!
//! ## Requirements:
//!
/... |
// Copyright 2013 The Servo Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution.
//
// 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 ... |
use shared::utils;
use std::fmt;
lazy_static! {
static ref INPUT: Vec<String> = utils::read_input_lines("day19");
}
#[allow(clippy::enum_variant_names)]
#[derive(Clone)]
enum Rule {
Or(Vec<Rule>),
RuleNum(usize),
Terminal(u8),
ManyTill(usize, usize),
And(Vec<Rule>),
}
impl Rule {
pub fn u... |
//! A solver that uses a [Cbc](https://www.coin-or.org/Cbc/) [native library binding](https://docs.rs/coin_cbc).
//! This solver is activated using the default `coin_cbc` feature.
//! You can disable it an enable another solver instead using cargo features.
use std::convert::TryInto;
use coin_cbc::{raw::Status, Col, M... |
use crate::config::Config;
use crate::consts::*;
use crate::error::HermodError;
use crate::hacl::HaclResolver;
use crate::message::{Message, MessageType};
use crate::peer::Peer;
use snow::{
self,
resolvers::{DefaultResolver, FallbackResolver},
Builder, HandshakeState, TransportState,
};
use log::info;
us... |
use std::{
collections::HashMap,
sync::{Arc, Mutex},
};
use crate::{
actions::util::action_error,
error::TaskError,
tasks::{TaskDefinition, TaskGraphState, TaskRef, TaskResult},
Result, WRITER,
};
use rlua::{Function, Lua, Table, Value, Variadic};
pub struct LuaState {
lua: Lua,
tasks:... |
extern crate proc_macro;
extern crate syn;
#[macro_use]
extern crate quote;
extern crate proc_macro2;
extern crate structopt;
extern crate structopt_derive;
use proc_macro::TokenStream;
use syn::*;
use syn::punctuated::Punctuated;
use syn::token::{Comma};
use structopt::*;
use structopt_derive::*;
#[proc_macro_derive... |
use crate::helpers::{ColorScheme, ID};
use crate::render::{AgentColorScheme, DrawCtx, DrawOptions, Renderable, OUTLINE_THICKNESS};
use ezgui::{Color, Drawable, GeomBatch, GfxCtx, Prerender, Text};
use geom::{Angle, Circle, Distance, PolyLine, Polygon, Pt2D};
use map_model::{Map, TurnType};
use sim::{CarID, DrawCarInput... |
use atty::Stream;
use dirstat_rs::{DiskItem, FileInfo};
use pretty_bytes::converter::convert as pretty_bytes;
use std::env;
use std::error::Error;
use std::io;
use std::io::Write;
use std::path::PathBuf;
use structopt::StructOpt;
use termcolor::{Buffer, BufferWriter, Color, ColorChoice, ColorSpec, WriteColor};
const I... |
//! copyright
//!
//! 微信消息处理
//!
use super::utils;
use actix_web::http::StatusCode;
use actix_web::{web, HttpRequest, HttpResponse, Result};
use std::collections::HashMap;
use url::Url;
use wechat_sdk::{
current_timestamp,
message::{KFService, Message, ReplyRender, TextReply},
tripartite::{get_tripartite_c... |
use super::AcceptedType;
#[derive(Clone)]
pub enum Parts{
// rr:logicalSource
LogicalSource{
source: std::path::PathBuf,
reference_formulation: AcceptedType,
iterator: String,
},
// rr:subjectMap
SubjectMap{
components: Vec<Self>
},
// rr:predicateObjectMap
... |
use std::path::PathBuf;
use std::{fs, path::Path};
use anyhow::{anyhow, bail, ensure, Result};
use fs_extra::dir::CopyOptions;
use lazy_static::lazy_static;
use regex::Regex;
use super::{Location, LocationResolver};
use crate::{
index::{Area, Category},
Index, Item, ID,
};
pub struct DiskResolver {
ro... |
use std::result;
use chrono::{DateTime, Duration, FixedOffset, Local, NaiveTime, TimeZone};
use super::{
enums::Event,
errors::{ConfigErrorKind, HeliocronError},
};
type Result<T> = result::Result<T, HeliocronError>;
pub fn parse_date(
date: &str,
date_fmt: &str,
time_zone: Option<&str>,
) -> Re... |
/*
* Copyright 2019 The Starlark in Rust Authors.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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/lic... |
use std::sync::{Arc, Barrier};
use reqwest::{Client, ClientBuilder, header::HeaderMap};
use singlyton::SingletonOption;
use gmod::lua::{LuaReference, LuaInt};
use crate::{http::HTTPRequest, tls};
pub enum CallbackResult {
Success(LuaReference, LuaInt, HeaderMap, Vec<u8>, Option<LuaReference>),
Failed(LuaReference,... |
use crate::{
actions::ACTION_MANAGER_SERVICE,
core::CORE,
decoders::AUDIO_DECODERS,
file::{
FILE_FORMATS, FILE_INFO_FORMATTER, FILE_INFO_FORMATTER_UTILS, FILE_INFO_SERVICE,
FILE_STREAMING, FILE_SYSTEMS, FILE_URI_SERVICE,
},
internet::{CONNECTION_SETTINGS, HTTP_CLIENT},
msg_bo... |
//! The circuit module contains the structs and methods to create and run the circuits
use std::thread;
#[derive(Copy, Clone)]
pub enum FilterType {UpDown, LeftRight}
/// A particle can be observed by a Filter or counted by a Detector.
pub trait Particle {
// if up returns true, false otherwise
fn observe_up... |
// Copyright 2020-2021, The Tremor Team
//
// 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 agr... |
use macroquad::prelude::{Vec2, vec2, rand, screen_width, screen_height};
use rstar::{AABB, PointDistance, RTree, RTreeObject};
/// Elements of the biots' genomes:
/// a for attack
/// d for defence
/// p for photosynthesis
/// m for motion
/// i for intelligence
/// n does nothing
const LETTERS : &[char] = &['a','d','... |
use {
crate::{audio::AudioRenderer, video::VideoRenderer},
ceres_core::{Cartridge, Gb, Model, PX_HEIGHT, PX_WIDTH},
sdl2::{
controller::GameController,
event::{Event, WindowEvent},
keyboard::Scancode,
Sdl,
},
std::{
cell::RefCell,
fs::{self, File},
... |
use std::io::{Read, Write};
use util::Error;
use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use super::errors::*;
// A ReceptionReport block conveys statistics on the reception of RTP packets
// from a single synchronization source.
#[derive(Debug, PartialEq, Default, Clone)]
pub struct ReceptionReport {
... |
//! Divide function.
use std::fmt;
use std::rc::Rc;
use std::collections::HashMap;
use crate::model::node::Node;
use crate::model::node_base::NodeBase;
use crate::model::node_std::{NodeStd, NodeStdProp};
use crate::model::constant::ConstantScalar;
/// Divide function.
pub struct FunctionDiv {
args: (Node, Node),... |
extern crate bit_vec;
extern crate strlib;
use bit_vec::BitVec;
use std::cmp::{min, max};
use strlib::{fble, packed_gamma};
use super::super::{cfg::*};
pub fn encode(g: &Grammar, bv: &mut BitVec, blocksize: u32) -> () {
let mut deltas: Vec<u32> = Vec::new();
let mut starting_values: Vec<u32> = Vec::new();
... |
use crate::lang_config::LangConfig;
use crate::Config;
use anyhow::{anyhow, Context, Result};
use prost::Message;
use prost_types::FileDescriptorSet;
use std::borrow::Borrow;
use std::fs;
use std::path::{Path, PathBuf};
pub fn unquote_arg(arg: &str) -> String {
arg[1..arg.len() - 1].to_owned()
}
pub(crate) fn che... |
use crate::QuantityError;
use pyo3::prelude::*;
use pyo3::{exceptions::PyRuntimeError, PyErr};
#[macro_use]
mod macros;
mod sinumber;
pub use sinumber::{PyCelsius, PyDebye, PySINumber};
mod siarray;
pub use siarray::{PySIArray1, PySIArray2, PySIArray3, PySIArray4};
mod angle;
pub use angle::PyAngle;
impl From<Quanti... |
use crate::brainfuck_exec;
#[test]
// https://en.wikipedia.org/wiki/Brainfuck#Adding_two_values
fn add_two_values() {
let program = r#"
++ Cell c0 = 2
> +++++ Cell c1 = 5
[ Start your loops with your cell pointer on the loop counter (c1 in our case)
< + Add 1 to c0
> - ... |
#![feature(
alloc_error_handler,
llvm_asm,
global_asm,
naked_functions,
untagged_unions,
core_intrinsics,
const_in_array_repeat_expressions,
const_loop,
const_if_match,
const_generics,
c_variadic,
start,
)]
// For unwinding support
#![feature(std_internals, panic_info_me... |
use ic_sys::{PageBytes, PageIndex};
use std::{
fmt::Debug,
sync::atomic::{AtomicUsize, Ordering},
sync::Arc,
};
// Exported publicly for benchmarking.
pub use heap::{HeapBasedPage, HeapBasedPageAllocator};
mod heap;
// MmapBasedPageAllocator currenly uses memfd_create that is
// available only on linux.
#[... |
#![no_std]
#![no_main]
#![feature(abi_efiapi)]
#![feature(vec_into_raw_parts)]
#[macro_use]
extern crate alloc;
#[macro_use]
mod fs;
use alloc::vec::Vec;
use core::{mem, slice};
use goblin::elf;
use log::info;
use ors_common::{frame_buffer, memory_map};
use uefi::prelude::*;
use uefi::proto::console::gop::{GraphicsO... |
pub mod range;
pub mod unit;
use std::cmp::Ordering;
/// A macro to unwrap an option to its `Some` value, and panic if `None`. This
/// is the same as [Option::unwrap], except that it accepts a format string
/// and format arguments, allowing for more flexibility in error messages.
#[macro_export]
macro_rules! unwrap... |
//! Pixel-sampling engine function.
use crate::{
geom::{Cube, Trace},
img::{Colour, Gradient},
math::{Dir3, Pos3},
phys::Crossing,
sim::render::{lighting, Attribute, Input, Output, Tracer},
};
use rand::rngs::ThreadRng;
use std::time::Instant;
/// Calculate the colour of a single tracer.
#[allow(c... |
/*
Copyright (c) 2015, 2016 <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, distribute, su... |
use super::Context;
use crate::{
beam::disp_result::DispatchResult,
emulator::{code_srv::CodeServer, mfa::ModFunArity, process::Process, vm::VM},
fail::{self, RtErr, RtResult},
native_fun::NativeFn,
term::{boxed::import, value::*},
};
use core::slice;
// fn module() -> &'static str { "runtime_ctx.call_native... |
use libsyntax2::{
SyntaxKind, SyntaxNodeRef, AstNode, File, SmolStr,
ast::{self, NameOwner},
algo::{
visit::{visitor, Visitor},
walk::{walk, WalkEvent, preorder},
},
};
use TextRange;
#[derive(Debug, Clone)]
pub struct StructureNode {
pub parent: Option<usize>,
pub label: String... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.