text stringlengths 3.09k 13.9k |
|---|
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::cli_state::CliState;
use crate::view::{ExecuteResultView, ExecutionOutputView};
use crate::StarcoinOpt;
use anyhow::{bail, Result};
use scmd::{CommandAction, ExecContext};
use starcoin_dev::playground;
use starcoin_move_c... |
// Copyright (c) 2021 Quark Container 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 required by applicable law ... |
#[allow(unused_imports)]
use libc::{c_char, c_int, c_uchar, c_void};
use crate::object::*;
use crate::pyport::Py_ssize_t;
#[cfg(Py_3_8)]
pub enum _PyOpcache {}
#[repr(C)]
#[derive(Copy)]
pub struct PyCodeObject {
pub ob_base: PyObject,
pub co_argcount: c_int,
#[cfg(Py_3_8)]
pub co_posonlyargcount: c_... |
//! This module contains the Streamlet structure.
//!
//! A streamlet is a component where every [Interface] has a [LogicalType].
use crate::logical::LogicalType;
use crate::traits::Identify;
use crate::util::UniquelyNamedBuilder;
use crate::{Document, Error, Name, Result};
use std::convert::TryInto;
use std::str::Fro... |
#[derive(Default, Debug, Clone)]
pub struct CpuData {
pub cpu_prefix: String,
pub cpu_count: Option<usize>,
pub cpu_usage: f64,
}
pub type CpuHarvest = Vec<CpuData>;
pub type PastCpuWork = f64;
pub type PastCpuTotal = f64;
#[cfg(not(target_os = "linux"))]
use sysinfo::{ProcessorExt, System, SystemExt};
... |
use std::future::Future;
use std::marker::PhantomData;
use async_trait::async_trait;
use chrono::{DateTime, Duration, Utc};
use super::base::{SendSyncStatic, TaskPayload};
use super::{Config, FunctionTask, IntoTask, Task, TaskError};
use crate::from_payload::FromPayload;
use crate::message::{Message, SerializableMes... |
use bson;
use errors::*;
use intermediate::IntermediateInputKV;
use mapper::MapInputKV;
use serde::de::DeserializeOwned;
use serde::Serialize;
use serde_json;
use serialise::{FinalOutputObject, IntermediateOutputObject};
use std::io::{Read, Write};
/// `read_map_input` reads bytes from a source and returns a `MapInput... |
use std::io;
use serde::{Deserialize, Deserializer, Serialize};
pub trait StoreCompressor {
fn compress(&self, uncompressed: &[u8], compressed: &mut Vec<u8>) -> io::Result<()>;
fn decompress(&self, compressed: &[u8], decompressed: &mut Vec<u8>) -> io::Result<()>;
fn get_compressor_id() -> u8;
}
/// Compr... |
use crate::{
identifier::ident,
spec::{self, RefKey, TypeName},
CrateConfig, PropertyName, Spec,
};
use camino::Utf8Path;
use camino::Utf8PathBuf;
use heck::ToPascalCase;
use once_cell::sync::Lazy;
use proc_macro2::TokenStream;
use quote::quote;
use regex::Regex;
/// code generation context
pub struct Code... |
use std::cmp;
use std::collections::{HashMap, HashSet};
// common data structures
#[derive(Debug, PartialEq)]
pub struct Task {
pub id: String,
pub prio: u8,
pub deadline: u32,
pub inter_arrival: u32,
pub trace: Trace,
}
//#[derive(Debug, Clone)]
#[derive(Debug, PartialEq)]
pub struct Trace {
... |
use std::cell::RefCell;
use std::collections::LinkedList;
use std::future::Future;
use std::pin::Pin;
use std::rc::Rc;
use std::sync::Mutex;
use std::sync::{Arc, Weak};
use std::task::{Context, Poll, Waker};
use futures::task::AtomicWaker;
#[allow(unused_imports)]
use futures::FutureExt;
use tokio::time::{self, Durati... |
use std::borrow::Borrow;
use std::collections::HashMap;
use std::fmt::Debug;
use std::hash::Hash;
use crate::FsError;
use crate::FsResult;
#[derive(Debug)]
/// A tree contains a bunch of nodes.
pub struct Tree<K: Eq + Hash, D> {
nodes: HashMap<u64, Node<K, D>>,
node_id: u64,
}
/// id of the root node of th... |
//! Command like parsing for rust-analyzer.
//!
//! If run started args, we run the LSP server loop. With a subcommand, we do a
//! one-time batch processing.
use std::{env, path::PathBuf};
use anyhow::{bail, format_err, Result};
use pico_args::Arguments;
use rust_analyzer::cli::{AnalysisStatsCmd, BenchCmd, BenchWhat... |
use crate::JsValue;
use std::alloc::{self, Layout};
use std::cell::Cell;
use std::mem;
use std::ptr;
use std::slice;
use std::vec::Vec;
externs! {
#[link(wasm_import_module = "__wbindgen_externref_xform__")]
extern "C" {
fn __wbindgen_externref_table_grow(delta: usize) -> i32;
fn __wbindgen_ext... |
use crate::theme::{SimpleTheme, TermThemeRenderer, Theme};
use console::{Key, Term};
use fuzzy_matcher::FuzzyMatcher;
use std::{io, ops::Rem};
/// Renders a selection menu that user can fuzzy match to reduce set.
///
/// User can use fuzzy search to limit selectable items.
/// Interaction returns index of an item sele... |
// This file is part of Substrate.
// Copyright (C) 2018-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... |
#[macro_use]
mod macros;
mod asraw;
mod checkstatus;
mod directives;
mod imagetype;
pub mod name;
mod performance;
mod release;
mod result;
pub mod types;
mod vxerror;
mod vxgraphstate;
mod vxstatus;
pub use crate::asraw::AsRaw;
pub use crate::checkstatus::CheckStatus;
pub use crate::directives::{SetDirective, VxDire... |
use std::sync::Arc;
use std::time::Duration;
use futures::future::abortable;
use futures::FutureExt;
use tokio::io::{AsyncReadExt, AsyncWriteExt};
use tokio::net::{TcpListener, ToSocketAddrs, UdpSocket};
use tokio::sync::RwLock;
use tokio::time::timeout;
use leaf::proxy::*;
pub async fn run_tcp_echo_server<A: ToSock... |
use crate::core::compiler::unit::UnitInterner;
use crate::core::compiler::CompileTarget;
use crate::core::compiler::{BuildConfig, BuildOutput, CompileKind, Unit};
use crate::core::profiles::Profiles;
use crate::core::{Dependency, InternedString, Workspace};
use crate::core::{PackageId, PackageSet};
use crate::util::con... |
use data_types::job::Job;
use parking_lot::Mutex;
use std::{
collections::{BTreeMap, BTreeSet},
convert::Infallible,
ops::DerefMut,
sync::Arc,
time::Duration,
};
use time::TimeProvider;
use tracker::{TaskId, TaskRegistration, TaskRegistryWithHistory, TaskTracker, TrackedFutureExt};
const JOB_HISTOR... |
use std::io::Read;
use error::Error;
use html5ever::rcdom::NodeData::{
Document,
Doctype,
Text,
Comment,
Element,
ProcessingInstruction
};
use html5ever::rcdom::{RcDom, Handle};
use html5ever::{parse_document, Attribute};
use html5ever::tendril::TendrilSink;
#[cfg(feature = "reqwest")]
use std... |
// Copyright (C) 2018 <NAME> <<EMAIL>>
use std::ffi::{CStr, CString};
use std::os::raw::{c_char, c_int};
mod ffi {
#![allow(dead_code)]
use std::os::raw::{c_char, c_int};
extern "C" {
pub fn verilated_set_rand_reset(val: c_int);
pub fn verilated_rand_reset() -> c_int;
pub fn veri... |
use std::convert::TryFrom;
use std::ops::{Bound};
use std::os::raw::{c_char, c_void};
use num::One;
use opendp::core::{DatasetMetric, Metric};
use opendp::dist::{HammingDistance, SymmetricDistance, AbsoluteDistance, L1Distance, L2Distance};
use opendp::dom::{AllDomain, VectorDomain, IntervalDomain};
use opendp::err;
... |
use crate::MIN_DISTANCE;
use petgraph::graph::{EdgeIndex, Graph, IndexType};
use petgraph::EdgeType;
use petgraph_layout_force_simulation::{Force, ForceToNode, Point};
use std::collections::HashMap;
#[derive(Copy, Clone)]
pub struct LinkArgument {
pub distance: Option<f32>,
pub strength: Option<f32>,
}
impl L... |
/*
* Various types to support iteration.
*/
use crate::function::PyFuncArgs;
use crate::pyobject::{PyContext, PyIteratorValue, PyObjectRef, PyResult, TypeProtocol};
use crate::vm::VirtualMachine;
use super::objbool;
use super::objbytearray::PyByteArray;
use super::objbytes::PyBytes;
use super::objrange::PyRange;
us... |
use crate::objecttools::ObjectTools;
use anyhow::{anyhow, Context};
use paste::paste;
use sapp_jsutils::JsObject;
use std::{collections::HashMap, convert::Infallible};
extern "C" {
// Primitive passing
fn primitive_to_js_u8(it: u8) -> JsObject;
fn primitive_to_js_u16(it: u16) -> JsObject;
... |
use std::{
ffi::c_void,
marker::PhantomData,
mem,
};
use libc::size_t;
pub use iter::{VectorIterator, VectorRefIterator};
pub use vector_extern::{VectorElement, VectorExtern, VectorExternCopyNonBool};
use crate::{core::Boxed, Result};
mod vector_extern;
mod iter;
/// Wrapper for C++ [std::vector](https://en.cpp... |
use super::attr;
use super::Ctxt;
use super::Derive;
use syn::punctuated::Punctuated;
use syn::Token;
/// A source data structure annotated with `#[derive(NewFuzzed)]` and/or `#[derive(Mutatable)]`
pub struct Container<'a> {
/// The struct or enum name (without generics).
pub ident: syn::Ident,
/// Attribu... |
//! Delays
use core::cmp;
use cortex_m::peripheral::SYST;
use hal::blocking::delay::{DelayMs, DelayUs};
use crate::prelude::*;
use crate::rcc::Rcc;
use crate::stm32::*;
use crate::time::{Hertz, MicroSecond};
/// Delay provider
pub struct Delay<TIM> {
clk: Hertz,
tim: TIM,
}
pub trait DelayExt<TIM> {
fn d... |
use chrono::{TimeZone, Utc};
use sqlx::{query, MySqlPool};
use crate::z_lib::remote::repository::mysql::helper::mysql_error;
use crate::auth::ticket::remote::kernel::infra::{
AuthTicketRepository, DiscardAuthTicketRepository, IssueAuthTicketRepository,
};
use crate::{
auth::ticket::remote::kernel::data::{Aut... |
use std::{
collections::{HashMap, HashSet},
hash,
ops::Deref,
sync::{Arc, RwLock},
};
use serde::{Deserialize, Serialize};
use crate::{
document::{Document, MultipartDocument},
elements::PartReference,
AliasType, PartAlias,
};
#[derive(Serialize, Deserialize, Clone, Copy, Debug)]
pub enum... |
//! Prevent mutations if the HTTP method is GET.
//!
//! See [`Layer`] and [`Service`] for more details.
use crate::{
error::Error, json_ext::Object, layers::sync_checkpoint::CheckpointService, ExecutionRequest,
ExecutionResponse, Response,
};
use futures::stream::BoxStream;
use http::{header::HeaderName, Meth... |
#![doc = include_str!( "../README.md" )]
#![doc(html_logo_url = "https://git.openprivacy.ca/cwtch.im/cwtch-ui/media/branch/trunk/cwtch.png")]
#![doc(html_root_url = "https://git.openprivacy.ca/cwtch.im/libcwtch-rs")]
#![deny(missing_docs)]
mod bindings_go;
mod cwtchlib_go;
/// Basic structs using data from Cwtch and ... |
use crate::search::query::{QueryFactoryError, QueryFactoryErrorKind};
use std::ops::Range;
use tantivy::query::RangeQuery;
use tantivy::schema::Type;
use tantivy::Searcher;
pub type RangeQueryArgs = serde_json::Value;
/// Create a range query.
pub fn create_range_query(
args: &RangeQueryArgs,
searcher: &Searc... |
//! Transform and desugaring of HIR to MIR.
//!
//! AST transformations in this phase should NOT produce errors or panics
use super::hir::*;
use super::mir::Expr;
use super::*;
/// Helper function to recursively generate nested let expressions
fn desugar_bindings(mut args: Vec<String>, mut vals: Vec<Expr>, body: Expr... |
use ferrysched_shared::imports::*;
use ferrysched_shared::types::*;
static MIN_THRU_FARE_TRANSFER_DURATION: Lazy<Duration> = Lazy::new(|| Duration::minutes(30));
static MAX_THRU_FARE_TRANSFER_DURATION: Lazy<Duration> = Lazy::new(|| Duration::minutes(125));
#[derive(Eq, Ord, PartialEq, PartialOrd)]
pub struct SailingW... |
// 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... |
use crate::controller::sql::query_graph::{QueryGraph, QueryGraphEdge};
use crate::controller::sql::query_signature::Signature;
use crate::controller::sql::reuse::helpers::predicate_implication::complex_predicate_implies;
use crate::controller::sql::reuse::{ReuseConfiguration, ReuseType};
use std::collections::HashMap;... |
use core::slice;
use std::ptr;
#[derive(Debug)]
pub struct Scanner {
start: *const u8,
end: *const u8,
current: *const u8,
line: usize,
}
impl Scanner {
const fn new() -> Self {
Self {
start: ptr::null(),
end: ptr::null(),
current: ptr::null(),
... |
use crate::{
circuits::{
gate::{CircuitGate, GateType},
wires::*,
},
prover::ProverProof,
prover_index::testing::new_index_for_test,
verifier::batch_verify,
};
use ark_ec::{AffineCurve, ProjectiveCurve};
use ark_ff::{Field, One, PrimeField, UniformRand, Zero};
use array_init::array_i... |
use crate::monoid::Monoid;
use std::ops::{Bound, RangeBounds};
/// Segment tree
#[derive(Debug)]
pub struct SegmentTree<T> {
len: usize,
v: Vec<T>,
}
impl<T: Clone + Monoid> SegmentTree<T> {
/// O(n).
/// Construct segment tree for given size.
pub fn new(n: usize) -> Self {
let s: &[T] = &... |
// Copyright 2021 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::object_store::Timestamp,
anyhow::{bail, Error},
async_trait::async_trait,
storage_device::buffer::{Buffer, BufferRef, MutableB... |
//!
//!
//! @see https://vulkan-tutorial.com/Drawing_a_triangle/Setup/Instance
//!
//! 注:本教程所有的英文注释都是有google翻译而来。如有错漏,请告知我修改
//!
//! Note: All English notes in this tutorial are translated from Google. If there are errors and omissions, please let me know
//!
//! The MIT License (MIT)
//!
use ash::{
ve... |
use egg::*;
define_language! {
enum Prop {
Bool(bool),
And = "&",
Not = "~",
Or = "|",
Implies = "->",
Variable(String),
}
}
type EGraph = egg::EGraph<Prop, ConstantFold>;
macro_rules! rule {
($name:ident, $left:literal, $right:literal) => {
#[allow... |
use anyhow::Result;
use ash::vk;
use gltf::{texture::Info, Material as MaterialData};
use nalgebra::{vector, Vector4};
use crate::{resources::VulkanContext, texture::Texture};
/// A component that instructs the renderer how an entity should look when rendered
/// Mostly maps to the [glTF material spec](https://www.kh... |
use btree_dag::{AddEdge, AddVertex};
use crate::{expression::Expr, Dag, Set};
pub trait Coalesceable: Sized + Ord + Clone + std::fmt::Debug {
fn axiom_set(&self) -> Set<Self>;
fn children(&self) -> Set<Box<Self>>;
fn dim_bound(&self) -> usize;
fn spawn(&self, proof: &mut Dag<Set<Self>>) -> Set<Set<... |
//! An MP3 stream in a MPEG-1 container.
use super::Encoder;
use anyhow::{bail, Context, Result};
/// Error checker for lame_sys functions.
///
/// Returns an [`anyhow::Error`] with the stringified error if the result of the function call is negative,
/// and the result of the function as-is otherwise.
fn check_err(... |
use crate::credentials;
use git_features::{progress, progress::Progress};
use git_transport::{
client::{self, SetServiceResponse, TransportV2Ext},
Service,
};
use quick_error::quick_error;
use std::io;
mod refs;
use refs::InternalRef;
pub use refs::Ref;
mod command;
pub use command::Command;
mod arguments;
p... |
//! The `poh_service` module implements a service that records the passing of
//! "ticks", a measure of time in the PoH stream
use crate::poh_recorder::PohRecorder;
use crate::service::Service;
use solana_sdk::timing::NUM_TICKS_PER_SECOND;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::SyncSender;
... |
//! Child/executor process impls
use crate::cli_options::ExecuteReportOpt;
use crate::file_results::{AvmType, FileResults, Step};
use crate::logging::{ScanLogBackend, ThreadLocalScanLogger, LOCAL_LOGGER};
use ruffle_core::backend::audio::NullAudioBackend;
use ruffle_core::backend::locale::NullLocaleBackend;
use ruffle... |
#![feature(generic_associated_types)]
use crystalorb::{client::stage::Stage, Config, TweeningMethod};
use itertools::iproduct;
use pretty_assertions::assert_eq;
use test_log::test;
mod common;
use common::{MockClientServer, MockCommand};
#[test]
fn when_client_becomes_ready_state_should_already_be_initialised() {
... |
use std::fmt;
use std::collections::HashMap;
use regex::Regex;
#[derive(PartialEq, Eq, Hash)]
struct Input {
name: String,
quantity: i64
}
impl fmt::Debug for Input {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(f, "{} {}", self.quantity, self.name)
}
}
impl Input {
... |
//! Applies pooling to the input.
//!
//! This layers looks at adjectant values of the input and then computes a
//! simple pooling operation over them (e.g. taking their maximum or average value).
//! *See [PoolingMode][pooling_mode]*
//!
//! [pooling_mode]: ./enum.PoolingMode.html
//!
//! ## Input Data
//!
//! The la... |
use std::convert::TryFrom;
use std::path::PathBuf;
use anyhow::Result;
use synth_core::schema::Namespace;
use synth_core::{Content, DataSourceParams};
use crate::cli::csv::{CsvFileImportStrategy, CsvStdinImportStrategy};
use crate::cli::json::{JsonFileImportStrategy, JsonStdinImportStrategy};
use crate::cli::jsonl::... |
// 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 writi... |
use std::cell::RefCell;
use std::ops::DerefMut;
use std::rc::Rc;
use yew::{Component, ComponentLink, Html, Properties};
thread_local! {
static CURRENT_HOOK: RefCell<Option<HookState>> = RefCell::new(None);
}
struct HookState {
counter: usize,
process_message: Rc<dyn Fn(Box<dyn FnOnce() -> bool>)>,
hoo... |
//! # 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::api::trace::span_context::TraceState;
use crate::a... |
extern crate num_traits;
use num_traits::{Float, One, Zero};
use std::iter::Sum;
use crate::visitor::Visitor;
use crate::tree::{BoundingBox, Internal, Leaf, Tree};
/// A visitor on nodes used to compute an anomaly score.
///
/// Given a tree and a point to score, the tree returns a branch of nodes using
/// [`Tree:... |
use std::{borrow::Cow, collections::HashMap, iter};
use bevy_ecs::prelude::Entity;
use tokio::sync::mpsc;
use crate::{
engine::{
db::Db,
fsm::{negotiate_login::ClientLoginFsm, Params, StackFsm, UpdateResult},
ClientMessage, EngineResponse,
},
world::GameWorld,
ClientId,
};
use ... |
use crate::{
schema::sso_service, DriverResult, Service, ServiceCreate, ServiceList, ServiceListQuery,
ServiceRead, ServiceUpdate,
};
use chrono::{DateTime, Utc};
use diesel::prelude::*;
use uuid::Uuid;
#[derive(Debug, Identifiable, Queryable)]
#[table_name = "sso_service"]
#[primary_key(id)]
pub struct ModelS... |
//! # RedisGraph implementation of the waSCC Graph Database Capability Provider API
//!
//! Provides an implementation of the wascc:graphdb contract for RedisGraph
//! using the Cypher language
#[macro_use]
extern crate wascc_codec as codec;
extern crate wasccgraph_common as common;
#[macro_use]
extern crate log;
u... |
use crate::search::{Search, SearchCommand, SearchInfo, SearchResult, MAX_SEARCH_DEPTH};
use crossbeam_channel::{Receiver, Sender};
use eval::eval::{Eval, Score, CHECKMATE_BLACK, CHECKMATE_WHITE, EQUAL_POSITION, NEGATIVE_INF};
use movegen::move_generator::MoveGenerator;
use movegen::position_history::PositionHistory;
us... |
use gantan::{GenoType, Inspector, PhenoType, Population, Roulette, Simulator};
use ordered_float::OrderedFloat;
use rand::prelude::*;
struct Pheno<'a> {
cities: &'a [(i32, i32)],
indices: Vec<usize>,
}
impl<'a> PhenoType for Pheno<'a> {
type GenoType = Gene<'a>;
fn encode(&self) -> Self::GenoType {
... |
use crate::{
marker, BitFlags, Error, RdsBlockData, RdsBlockErrors, RdsData, RdsMode, RdsRadioText,
RdsRadioTextData, Register, Si4703,
};
use embedded_hal::blocking::i2c;
impl<I2C, E, IC> Si4703<I2C, IC>
where
I2C: i2c::Write<Error = E> + i2c::Read<Error = E>,
IC: marker::WithRds,
{
/// Enable RDS... |
use crate::pathfind::{driving_cost, walking_cost, WalkingNode};
use crate::{
IntersectionID, LaneID, Map, Path, PathConstraints, PathRequest, PathStep, RoadID, TurnID,
};
use enumset::EnumSet;
use petgraph::graphmap::DiGraphMap;
use serde::{Deserialize, Serialize};
use std::collections::BTreeSet;
#[derive(Serializ... |
// Copyright 2022 Webb Technologies Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed... |
//! Module containing logic for writing to the screen.
use std::io::{BufWriter, Seek, SeekFrom, Write};
use std::os::unix::io::AsRawFd;
use wayland_client::{self, EventQueueHandle, EnvHandler, Proxy};
use wayland_client::protocol::{wl_shm, wl_shell_surface, wl_buffer, wl_output,
wl_surf... |
use std::io::{BufReader, Result, stdout};
use std::io::prelude::*;
use std::fs::File;
use std::collections::HashMap;
use flate2::read::GzDecoder;
use bzip2::read::BzDecoder;
use glob::glob;
pub struct NxResult {
pub index: u8,
pub n_result: u64,
pub l_result: u64,
pub total_length: u128,
}
fn file_decoder(pat... |
// 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 writi... |
#![feature(test)]
extern crate test;
use std::{
collections::HashMap,
fs::File,
io::{BufRead, BufReader},
mem::swap,
};
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
struct Token(u8);
type Template = Vec<usize>; // Counts of occurrences of each token
type Rules = Vec<(char, [Token; 2])>; // First char... |
// Copyright (c) 2020 DDN. All rights reserved.
// Use of this source code is governed by a MIT-style
// license that can be found in the LICENSE file.
use futures::{future::BoxFuture, stream, FutureExt, TryStreamExt};
use iml_tracing::tracing;
use std::{io, string::FromUtf8Error, sync::Arc, time::Duration};
use thrus... |
use std::{collections::HashMap, time::Duration};
use crossbeam_channel::{unbounded, Receiver, Select, Sender};
use crate::task::{Coroutine, RunResult};
/// A type which receives notifications from a worker.
pub(crate) trait Listener {
fn on_task_started(&mut self) {}
fn on_task_completed(&mut self, _panicke... |
use std::io;
use std::path::Path;
use std::pin::Pin;
use std::sync::Arc;
use std::task::{Context, Poll};
use bytes::Bytes;
use futures::prelude::*;
use log::error;
use rusoto_core::{credential, HttpClient, Region, RusotoError};
use rusoto_s3::{S3Client, S3 as S3Trait};
use tokio::io::AsyncWrite;
use tokio::sync::mpsc:... |
//! `hotwatch` is a Rust library for comfortably watching and handling file changes.
//! It's a thin convenience wrapper over [`notify`](https://github.com/passcod/notify),
//! allowing you to easily set callbacks for each path you want to watch.
//!
//! Watching is done on a separate thread so you don't have to worry ... |
use crate::LOOPS;
use serde_json::Result;
use std::io::prelude::*;
use flate2::Compression;
use flate2::write::ZlibEncoder;
use std::time::{SystemTime};
use serde::{Serialize, Deserialize};
#[derive(Serialize, Deserialize, PartialEq, Eq, Debug, Clone)]
enum Fruit {
Apples, Pears, Bananas
}
#[derive(Serialize, D... |
// ===============================================================================================
// Copyright (c) 2018 <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 r... |
//! Utility functions related to certificate policy-related certification path validation operations.
//! Functions, structures, etc. in this file are pub(crate).
use alloc::{vec, vec::Vec};
use core::cell::RefCell;
use const_oid::db::rfc5280::ANY_POLICY;
use der::asn1::ObjectIdentifier;
use crate::util::error::*;
u... |
pub struct List<T> {
head: Link<T>,
}
// type aliases
type Link<T> = Option<Box<Node<T>>>;
struct Node<T> {
elem: T,
next: Link<T>,
}
// Tuple struct are an alternative form of struct,
// useful for trivial wrappers around other types.
pub struct IntoIter<T> (List<T>);
impl<T> Iterator for IntoIter<T> {... |
use flate2::read::GzDecoder;
use lambda_runtime::{handler_fn, Context};
use rusoto_core::region::Region;
use rusoto_sqs::{DeleteMessageRequest, ReceiveMessageRequest, SendMessageRequest, Sqs, SqsClient};
use serde::Serialize;
use serde_json::Value;
use std::env::var;
use std::io::Read;
use std::str::FromStr;
use tracin... |
use core::ops::{Add, AddAssign};
use std::collections::HashSet;
use std::fs;
extern crate regex;
use regex::Regex;
extern crate num_integer;
#[derive(Clone, Copy, Eq, Hash, PartialEq, PartialOrd)]
struct Coordinate(i32);
impl Coordinate {
fn new(value: i32) -> Coordinate {
Coordinate { 0: value }
}
... |
// Copyright 2018-2021 Google 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 applicable law or agreed t... |
use super::{
address,
crypto::{self, key},
};
pub mod accounts;
#[derive(Copy, Clone, Debug, PartialEq)]
pub struct account {
private: key::PrivKey,
address: address::v1::AddrV1,
}
impl account {
// new_account generates a new account
pub fn new_account() -> Result<account, AccountError> {
... |
use crate::core::*;
use crate::domains::Transition;
use crate::fa::{Parameterised, QFunction};
use crate::policies::{fixed::Greedy, Policy, FinitePolicy};
use std::collections::VecDeque;
struct BackupEntry<S> {
pub s: S,
pub a: usize,
pub q: f64,
pub residual: f64,
pub sigma: f64,
pub pi: f64... |
use std::fs;
use std::ops::Add;
use std::path::PathBuf;
use proc_macro2::{Span, TokenStream};
use syn::{self, Path, Attribute, Item, Visibility};
use devise::Result;
use quote::quote_spanned;
use crate::{
BEFORE_SCENARIO_HOOK_STRUCT_PREFIX,
BEFORE_STEP_HOOK_STRUCT_PREFIX,
STEP_STRUCT_PREFIX,
AFTER_STE... |
#![allow(dead_code)]
extern crate lpc1347;
// ADC clock frequency
const ADC_CLK: u32 = 4000000;
#[derive(Copy, Clone)]
pub enum PinPos {
Pin0 = 11,
Pin1 = 12,
Pin2 = 13,
Pin3 = 14,
Pin4 = 15,
Pin5 = 16,
Pin6 = 22,
Pin7 = 23,
}
#[derive(Copy, Clone)]
pub enum Capture {
Rising,
... |
use std::net::SocketAddr;
use std::str::FromStr;
use chrono::prelude::*;
use serde_json;
use uuid::Uuid;
use cerberus_proto::worker as pb;
use errors::*;
use util::state::StateHandling;
#[derive(Serialize, Deserialize)]
/// `WorkerStatus` is the serializable counterpart to `pb::WorkerStatus`.
pub enum WorkerStatus {... |
mod status;
mod forest;
//mod tests;
//mod tests2;
mod tests3;
/*
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum Status {
Success,
Failure,
Pending,
}
use self::Status::{
Success,
Failure,
Pending,
};
use std::time::{Instant, Duration};
pub enum Behavior<'a, S: 'a> {
Action(S),
... |
use std::collections::{HashMap, HashSet};
use std::path::{Path, PathBuf};
use canonical_path::CanonicalPathBuf;
use walkdir::{DirEntry, WalkDir};
use anyhow::Error;
use log;
use crate::id::ResourceId;
use crate::meta::ResourceMeta;
#[derive(Debug)]
pub struct ResourceIndex {
pub path2meta: HashMap<CanonicalPath... |
#[cfg(feature = "parallel")]
use rayon::prelude::*;
use na::{self, RealField, Unit};
use crate::geometry::ParticlesContacts;
use crate::math::Vector;
use crate::object::{Boundary, Fluid};
use crate::solver::NonPressureForce;
use crate::TimestepManager;
#[derive(Clone)]
/// Surface tension method introduced by Akinc... |
//! # Transparent Log for RocksDB
//!
//! Uses [RocksDB](http://rocksdb.org/) as the storage backend
//!
use byteorder::{BigEndian, ByteOrder, WriteBytesExt};
use maybe_owned::MaybeOwned;
use rocksdb::{ColumnFamilyDescriptor, Options, DB};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::{marker::Ph... |
//! Monitors the default output device.
//!
//!
use std::sync::{Arc, Mutex};
use anyhow::{self, Context};
use clap;
use cpal;
use spectrum_analyzer::{self, FrequencyLimit, FrequencySpectrum, samples_fft_to_spectrum, windows::hann_window};
use vcs_classic_hid::{self, Device, LedReport, process_input};
use cpal::trait... |
use crate::configuration::ConfigurationError;
use derivative::Derivative;
use indexmap::IndexMap;
use jsonschema::paths::{JSONPointer, PathChunk};
use std::collections::HashMap;
use yaml_rust::parser::{MarkedEventReceiver, Parser};
use yaml_rust::scanner::Marker;
use yaml_rust::Event;
#[derive(Derivative, Clone, Debug... |
use core::cmp::Ordering;
use super::Id;
use super::IdReg;
use super::filter::FilterId;
use super::message_ram::enums::FrameFormat as PacFrameFormat;
use super::message_ram::{RxFifoElementHeader, TxBufferElementHeader};
use super::message_ram::enums::RemoteTransmissionRequest;
use super::message_ram::enums::{DataLen... |
use anyhow::{Context, Result};
use http::uri::PathAndQuery;
use hyper::service::{make_service_fn, service_fn};
use hyper::Server;
use lazy_static::lazy_static;
use log::{debug, info};
use prometheus::{GaugeVec, IntGaugeVec};
use simplelog::{LevelFilter, TermLogger};
use std::net::SocketAddr;
use std::sync::Arc;
use str... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
use crate::{
ExtensionData, Extensions, GraphSyncResponse, MetadataItem, RequestID, ResponseStatusCode,
EXTENSION_METADATA,
};
use cid::Cid;
use fnv::FnvHashMap;
/// ResponseBuilder captures components of a response message across... |
use d10_core::pixelbuffer::PixelBuffer;
use d10_core::color::Rgb;
use crate::FilterMode;
/// Resize buffer
fn resize_with_fn<F>(buffer: &PixelBuffer<Rgb>, new_width: u32, new_height: u32, func: F) -> PixelBuffer<Rgb>
where
F: Fn(&PixelBuffer<Rgb>, u32, u32, f32, f32) -> Rgb
{
let scale_x = (new_width ... |
#[allow(dead_code)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
#[repr(u8)]
pub enum Color {
Black = 0,
Blue = 1,
Green = 2,
Cyan = 3,
Red = 4,
Magenta = 5,
Brown = 6,
LightGray = 7,
DarkGray = 8,
LightBlue = 9,
LightGreen = 10,
LightCyan = 11,
LightRed = 12,
Pin... |
use crate::models::model::{Agent, BaseModel, Model};
use crate::strategies::utils::StrategyOperation;
use rand::{thread_rng, Rng};
use crate::models::game;
use crate::models::game::Game;
pub trait GAOperation {
fn get_point_list(&self) -> Vec<u64>;
fn get_dna_list(&self) -> Vec<String>;
}
// トレイトを実装するためだけのデー... |
pub const SEPARATORS: &[char] = &['\\', '/'];
pub const WILDCARD_CHARACTERS: &[char] = &['*', '?'];
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum PathType {
Invalid,
DeviceStorage,
Local,
}
pub fn get_path_type(path: &str) -> PathType {
let colon_count = path.chars().filter(|ch| *ch == ':').co... |
use std::sync::Arc;
use std::collections::HashMap;
use std::sync::atomic::{AtomicBool, Ordering};
use log::info;
use regex::Regex;
use tokio::sync::{Mutex, Notify, RwLock};
use crate::queue::{Queue, ClientId, MessageId};
use crate::shared_memory::SmartMemoryAllocation;
pub type QueueId = u64;
/// Manages the queu... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.