text stringlengths 3.09k 13.9k |
|---|
use std::{
sync::{Arc, RwLock},
time::Duration,
};
use serde::{de::Unexpected, Deserialize, Deserializer};
use crate::{event::cmap::*, options::StreamAddress, RUNTIME};
use tokio::sync::broadcast::{RecvError, SendError};
#[derive(Clone, Debug)]
pub struct EventHandler {
pub events: Arc<RwLock<Vec<Event>>... |
use nalgebra::{DMatrix};
pub type Element = f64;
pub type Matrix = DMatrix<Element>;
#[derive(Copy, Clone)]
enum OperationType {
Convolutional,
MaxPooling
}
struct Layer {
operation: OperationType,
kernel_size: (usize, usize),
stride: (usize, usize),
padding: (usize, usize),
kernels: Opti... |
use std::collections::HashMap;
use std::io::Error;
use std::sync::RwLock;
use anymap::{
any::Any,
Map,
};
use lru_cache::LruCache;
use n5::prelude::*;
use n5::{
ReadableDataBlock,
ReinitDataBlock,
};
type DatasetBlockCache<BT> = LruCache<GridCoord, Option<VecDataBlock<BT>>>;
struct BlockCache<BT: Ref... |
// Copyright (c) Facebook, Inc. and its affiliates.
// SPDX-License-Identifier: Apache-2.0
use crate::{base_types::*, configuration::EpochConfiguration};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use std::{fmt::Debug, hash::Hash};
// -- BEGIN FILE smr_apis --
pub trait SmrTypes {
/// An execution... |
use std::fs::File;
use std::io::Write;
use http::Uri;
use serde::{
de::{Deserializer, Error as DeserializeError, Unexpected},
Deserialize,
};
fn deserialize_parse<'de, D: Deserializer<'de>, T: std::str::FromStr>(
deserializer: D,
) -> Result<T, D::Error> {
let s: String = Deserialize::deserialize(dese... |
// Copyright 2020 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
#[derive(Default, Clone, Debug)]
/// A `BitWriter` allows for efficiently writing bits to a byte buffer, up to a byte at a time.
pub struct BitWriter {
/// The buffer that is written to.
bytes: Vec<u8>,
/// The most recently wr... |
//!
//! ACPI Machine Language Opcode
//!
/* Data Objects */
pub const ZERO_OP: u8 = 0x00;
pub const ONE_OP: u8 = 0x01;
pub const ONES_OP: u8 = 0xFF;
pub const REVISION_OP: u8 = 0x30;
pub const EXT_OP_PREFIX: u8 = 0x5B;
/* Expression Opcodes */
pub const VAR_PACKAGE_OP: u8 = 0x13;
pub const ACQUIRE_OP: u8 = 0x23;
pub... |
use super::Error;
use crate::core::Flags;
use regex::Regex;
impl Default for Flags {
fn default() -> Self {
Self {
show_version: false,
show_help: false,
show_short_help: false,
debug: false,
https: false,
http: false,
use... |
#[macro_use(u32_bytes, bytes_u32)]
extern crate dhcp4r;
use std::collections::HashMap;
use std::net::Ipv4Addr;
use std::ops::Add;
use std::time::{Duration, Instant};
use tokio::net::UdpSocket;
use dhcp4r::{options, packet, server};
// Server configuration
const SERVER_IP: Ipv4Addr = Ipv4Addr::new(192, 168, 0, 76);
c... |
use std::fs;
use std::path::Path;
use std::sync::Arc;
use fuzzy_matcher::skim::SkimMatcherV2;
use fuzzy_matcher::FuzzyMatcher;
use ini::Ini;
use serde::{Deserialize, Serialize};
use walkdir::WalkDir;
use druid::{
AppDelegate, Command, DelegateCtx, Env, Event, HotKey, KeyCode, SysMods, Target, WindowId,
};
use cr... |
use amethyst::{
core::{
math::{Point3, Vector3},
HiddenPropagate,
shrev::{EventChannel, ReaderId},
Time,
},
renderer::{
debug_drawing::{DebugLinesComponent},
palette::Srgba,
},
utils::{
fps_counter::{FpsCounter},
tag::{Tag}
},
d... |
// Copyright 2019 <NAME>, The Alacritty Project 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 ... |
// Copyright 2020 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under The General Public License (GPL), version 3.
// Unless required by applicable law or agreed to in writing, the SAFE Network Software distributed
// under the GPL Licence is distributed on an "AS IS" BASIS, WITHOUT WARRANTI... |
use crate::errors::*;
use crate::{proto, Warnable, base, Float, Integer};
use crate::components::{Component, Sensitivity};
use crate::base::{IndexKey, Value, NodeProperties, AggregatorProperties, SensitivitySpace, ValueProperties, DataType, NatureContinuous, Nature, Vector1DNull};
use ndarray::{arr1};
use itertools:... |
extern crate indicatif;
extern crate reqwest;
use crate::errors::{
DecoderNotFoundError, FileTypeNotSupportedError, InstallTypeNotSupportedError,
PathNotFoundError,
};
use crate::install_utils::{CommandRunner, Decoder, FileTypes, InstallTypes};
use std::error::Error;
use std::fs::File;
use std::path::Path;
/... |
use std::error::Error;
use std::fs::File;
use std::io;
use std::path::Path;
use bzip2_rs::DecoderReader;
use midly::num::u7;
use strong_xml::XmlRead;
#[derive(Debug, XmlRead)]
#[xml(tag = "sv")]
pub struct SvDocument {
#[xml(child = "data")]
pub data: SvData,
#[xml(child = "display")]
pub display: Sv... |
use std::collections::HashMap;
use std::fmt;
use std::str::FromStr;
use failure::{format_err, Error};
use itertools::iproduct;
type Result<T> = ::std::result::Result<T, Error>;
macro_rules! err {
($($tt:tt)*) => { Err(format_err!($($tt)*)) }
}
pub(crate) fn main() -> Result<()> {
let grid = Grid::new(1133)... |
// Copyright (c) 2021, Facebook, Inc. and its affiliates
// Copyright (c) 2022, Mysten Labs, Inc.
// SPDX-License-Identifier: Apache-2.0
use crate::transport::*;
use bytes::{Bytes, BytesMut};
use std::{
net::TcpListener,
sync::atomic::{AtomicUsize, Ordering},
};
use sui_types::{error::*, serialize::*};
use tra... |
use super::packet::*;
pub const SYNC_REQ: u8 = 0xff;
pub const SYNC_ACK: u8 = 0xfe;
pub type SyncState = u8;
pub const SYNC_STATE_READY: SyncState = 0x01;
pub const SYNC_STATE_RECV: SyncState = 0x02;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TimerAction {
NoChange, // no change to current timer.
... |
/*
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0.
*/
use std::sync::Arc;
use aws_auth::provider::{AsyncProvideCredentials, CredentialsError, CredentialsResult};
use aws_auth::Credentials;
use aws_hyper::{DynConnector, StandardClient};
use aws_sdk_sts::op... |
use algebra_core::{Field, PrimeField};
use ff_fft::EvaluationDomain;
use r1cs_core::SynthesisError;
use core::marker::PhantomData;
use crate::Vec;
pub(crate) mod constraint_systems;
/// Describes data structures and the algorithms used by the AHP indexer.
pub mod indexer;
/// Describes data structures and the algorith... |
//! Capture functions for the cortex-m platform
use stackdump_core::register_data::RegisterData;
use stackdump_core::{
memory_region::{ArrayMemoryRegion, MemoryRegion},
register_data::ArrayRegisterData,
};
/// Capture the core registers and the stack
#[cfg(not(has_fpu))]
pub fn capture<const SIZE: usize>(
... |
// Copyright (c) Aptos
// SPDX-License-Identifier: Apache-2.0
use crate::{
common::{
types::{CliError, CliTypedResult, PromptOptions},
utils::{check_if_file_exists, read_from_file, write_to_file},
},
genesis::{
config::{HostAndPort, ValidatorConfiguration},
git::{from_yaml, ... |
use ckb_app_config::StoreConfig;
use ckb_db::RocksDB;
use ckb_db_migration::{Migration, ProgressBar, ProgressStyle};
use ckb_db_schema::COLUMN_CELL;
use ckb_error::Error;
use ckb_store::{ChainDB, ChainStore, StoreWriteBatch};
use ckb_types::{
core::{BlockView, TransactionView},
packed,
prelude::*,
};
use st... |
mod common;
use once_cell::sync::Lazy;
use parking_lot::Mutex;
use rand::{rngs::SmallRng, seq::IteratorRandom, Rng, SeedableRng};
use serde::{Deserialize, Serialize};
use tokio::{
io::{AsyncReadExt, AsyncWriteExt},
time::sleep,
};
use tracing::*;
use tracing_subscriber::filter::LevelFilter;
use pea2pea::{
... |
use crate::{
ControlStopSign, ControlTrafficSignal, IntersectionID, IntersectionType, LaneID, LaneType, Map,
RoadID, TurnID,
};
use abstutil::{retain_btreemap, retain_btreeset, Timer};
use serde_derive::{Deserialize, Serialize};
use std::collections::{BTreeMap, BTreeSet};
#[derive(Serialize, Deserialize, Debug... |
//! Representation of multiple documents.
//!
//! So to speak documentation of project as whole.
//!
//! A `literal` is a token provided by `proc_macro2`, which is then
//! converted by means of `TrimmedLiteral` using `Cluster`ing
//! into a `CheckableChunk` (mostly named just `chunk`).
//!
//! `CheckableChunk`s can co... |
// Copyright 2018 (c) rust-themis developers
//
// 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 o... |
use std::fs;
use std::io::{self, Read, Write};
use std::path::{Path, PathBuf};
use std::str;
use failure;
use bio::io::fastq;
mod linkers;
mod sample;
mod sample_sheet;
use fastx_split::linkers::*;
use fastx_split::sample::*;
use fastx_split::sample_sheet::*;
pub struct CLI {
pub fastx_inputs: Vec<String>,
... |
use crate::voltcraft::data::PowerEvent;
use chrono::{Date, DateTime, Duration, Local};
use itertools::Itertools;
use std::collections::HashSet;
pub struct VoltcraftStatistics<'a> {
power_data: &'a Vec<PowerEvent>,
}
#[derive(Debug, Copy, Clone)]
pub struct PowerStats {
pub total_active_power: f64, // tot... |
use crate::factorio::task_graph::{MineTarget, PositionRadius, TaskGraph};
use crate::factorio::util::calculate_distance;
use crate::factorio::world::FactorioWorld;
use crate::types::{
FactorioEntity, FactorioPlayer, PlayerChangedMainInventoryEvent, PlayerChangedPositionEvent,
Position,
};
use dashmap::lock::RwL... |
use size_format::SizeFormatterBinary;
use std::{ops::Range, path::PathBuf};
use unicode_width::UnicodeWidthStr;
use zi::{Canvas, Component, ComponentLink, Layout, Rect, ShouldRender, Size, Style};
use super::{ModifiedStatus, RepositoryRc};
use crate::{mode::Mode, utils::StaticRefEq};
#[derive(Clone, Debug, PartialEq)... |
const PATTERN: [i32; 4] = [0, 1, 0, -1];
const INPUT: &str = "597673328937124993035079273924927998422809490326474479437081281347598296234329796656386277488287699014599203318093242772577835599806827730050908120151947056780444944276566944506834708942044583225126854631086772979314752246441200880442415149845018010557766214... |
use anyhow::Result;
use std::collections::HashSet;
use std::io::BufRead;
const DATA_FILE: &str = "12.txt";
fn solve_recursive(
maze: &Maze,
solutions: &mut HashSet<Vec<usize>>,
path: &[usize],
has_revisited: bool,
) {
let last = path.last().unwrap();
if *last == 1 {
if !solutions.conta... |
//! The module where the pattern matching is implemented
use ast::*;
use env::{Environment, ValueInfo};
use processing::Evaluate;
use type_sys;
/// That trait that must be implemented by part of the AST for pattern matching
pub trait PatternMatch {
fn pattern_match(&self, rhs: &type_sys::Value, env: &mut Environm... |
use crate::errors::base64::Base64Error;
const B64_CHARS: [char; 64] = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S',
'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l',
'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', ... |
use super::waker_page::{
WakerPage,
WakerPageRef,
WAKER_PAGE_SIZE,
};
use futures::task::AtomicWaker;
use slab::Slab;
use std::{
future::Future,
pin::Pin,
sync::Arc,
task::{
Context,
Poll,
Waker,
},
};
use gen_iter::gen_iter;
// Adapted from https://lemire.me/blo... |
// Day 2: 2021 Advent of Code
// Calculate the horizontal position and depth you would have after following the planned course.
// What do you get if you multiply your final horizontal position by your final depth?
// To solve this problem, we must read the data input, parse it and create a list of
// x,y vectors whe... |
use crate::page::Renderer;
use crate::utils::{px, AttributeSet, StyleSet};
use itertools::Itertools;
use onenote_parser::contents::{Ink, InkBoundingBox, InkPoint, InkStroke};
impl<'a> Renderer<'a> {
const SVG_SCALING_FACTOR: f32 = 2540.0 / 96.0;
pub(crate) fn render_ink(
&mut self,
ink: &Ink,
... |
use std::fmt;
use crate::syntax::{Span, Spanned, Token};
#[derive(Debug, PartialEq)]
pub struct Module {
pub(crate) nodes: Vec<Node>,
}
#[derive(Debug, PartialEq)]
pub enum Node {
Directive,
Statement(Statement),
}
// TODO: directives like #![deny(unused_variable)]
#[derive(Debug, PartialEq)]
pub struct... |
use petgraph::visit::{
IntoNodeIdentifiers, IntoNeighbors, NodeIndexable
};
/// Find all articulation points in a simple undirected graph.
///
/// In a graph, a vertex is called an articulation point if removing it and all the edges
/// associated with it results in the increase of the number of connected compo... |
// Copyright 2019-2020 Parity Technologies (UK) Ltd.
//
// 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... |
// Copyright 2022 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.
//! Debuglog messaging types.
//!
//! The debuglog protocol is used to multicast log messages.
use crate::ValidStr;
use const_unwrap::const_unwrap_option;... |
use std::ops::{Add, Sub};
use std::rc::Rc;
/// A byte position or offset into a source file's text buffer. This is used to
/// map ASTs to soure code by indicating the position from which an AST node
/// was parsed.
#[derive(Clone, Copy, PartialEq, Debug)]
pub struct BytePos(pub usize);
/// A range (span) into a sour... |
use cell::{CellIdGenerator, CellPosition, InteractionType};
use cell_pond::CellPond;
use instruction::Instruction;
use genome::{Genome, GenomePointer};
use random_generator::RandomGenerator;
use statistics::Statistics;
use super::{FAILED_KILL_PENALTY, MUTATION_RATE, POND_DEPTH};
pub(crate) enum Facing {
Up,
Do... |
//! IRI and URI types.
use opaque_typedef::{OpaqueTypedef, OpaqueTypedefUnsized};
use serde;
use serde::{Deserialize, Deserializer};
pub use url::ParseError as UrlParseError;
pub use url::Url;
/// IRI and resolved URI.
// NOTE: For now, don't derive `{,Partial}{Eq,Ord}` and `Hash` because I'm not
// sure how they sh... |
use std::collections::HashMap;
use eyre::{eyre, Result};
use harfbuzz_rs::ClusterLevel::MonotoneCharacters;
use harfbuzz_rs::GlyphInfo;
use rgb::RGBA8;
use {freetype as ft, harfbuzz_rs as hb};
use crate::any::Any;
use crate::visual::gui::layer::GblLayer;
use crate::visual::render::atlas::AtlasHandle;
use crate::visua... |
use byteorder::{BigEndian, WriteBytesExt};
use schemars::JsonSchema;
use serde::{Deserialize, Serialize};
use crate::{abs_diff};
use crate::hmac::HmacSha256;
#[derive(Serialize, Deserialize, Debug, JsonSchema)]
pub struct Authentication {
pub(crate) details: RequestDetails,
pub(crate) signature: Signature,
}
... |
use std::{collections::HashMap};
#[derive(Debug, PartialEq, Clone, Copy, Eq, Hash)]
pub enum TokenType {
ILLEGAL,
EOF,
IDENT,
INT,
STRING,
ASSIGN,
PLUS,
MINUS,
ASTERISK,
SLASH,
EQ,
NOTEQ,
BANG,
LT,
GT,
LTE,
GTE,
COMA,
SEMICOLON,
COLON,
... |
#[doc = "Reader of register RD_RS_ERR0"]
pub type R = crate::R<u32, super::RD_RS_ERR0>;
#[doc = "Reader of field `KEY4_FAIL`"]
pub type KEY4_FAIL_R = crate::R<bool, bool>;
#[doc = "Reader of field `KEY4_ERR_NUM`"]
pub type KEY4_ERR_NUM_R = crate::R<u8, u8>;
#[doc = "Reader of field `KEY3_FAIL`"]
pub type KEY3_FAIL_R = ... |
use rand::Rng;
use std::{fs, io, net, path};
use crate::error::Error;
const GEN_CHARSET: &[u8] = b"abcdefghijklmnopqrstuvwxyz0123456789";
const GEN_LENGTH: usize = 25;
const LT: &str = "bwt::auth";
pub enum AuthMethod {
UserProvided(String),
Cookie(path::PathBuf),
Ephemeral,
None,
}
impl AuthMethod ... |
use super::error::{Error, Result};
use simple_asn1::{ASN1Block, BigInt, BigUint, OID};
// ASN1 DER import/ export functions.
// https://tools.ietf.org/html/rfc8410
// https://tools.ietf.org/html/rfc5958
pub fn import_pub(bs: &[u8]) -> Result<[u8; 32]> {
if let [ASN1Block::Sequence(_, subject_public_key_info)] = ... |
use druid::{
lens,
widget::{Button, Controller, Flex, Label, TextBox},
AppLauncher, Data, Env, Event, EventCtx, Lens, PlatformError, Selector, Widget, WidgetExt,
WindowDesc,
};
use druid_enums::Matcher;
use std::marker::PhantomData;
const LOGIN: Selector<MainState> = Selector::new("druid-enums.basic.lo... |
//! Types used by [`crate::Transport`].
use super::history;
use crate::data::channel;
use crate::data::object::Object;
use crate::data::pam;
use crate::data::presence;
use crate::data::pubsub;
use crate::data::timetoken::Timetoken;
use crate::data::uuid::UUID;
use std::{collections::HashMap, marker::PhantomData};
///... |
/*!
A simple model for constructing SKOS thesauri. This is not a complete API in
that it's extensibility with OWL is limited.
Details TBD
# Example
TBD
*/
use crate::model::properties::final_preferred_label;
use crate::model::ToStatement;
use crate::model::{
Collection, Concept, Label, Labeled, LiteralProperty... |
use crate::block::SparseIndex;
use crate::error::*;
use crate::params::{BLOCK_SIZE, STRING_POOL_SIZE};
use crate::storage::memory::PagedMemoryStorage;
use std::mem::size_of;
block_impl!(PagedMemoryStorage);
impl<'block> Block<'block> {
#[inline]
pub(crate) fn prepare_dense_storage(size: usize) -> Result<Paged... |
// Zinc, the bare metal stack for rust.
// Copyright 2014 Dzmitry "kvark" Malyshau <<EMAIL>>
//
// 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/LICEN... |
//! An API for transferring ownership of a resource.
//!
//! The `Slot<T>` and `Lease<T>` types implement an API for sharing access to a resource `T`.
//! Conceptually, the `Slot<T>` is the "primary" owner of the value, and access can be leased to one
//! other owner through an associated `Lease<T>`.
//!
//! It's imple... |
fn main() {
// Defining and Instantiating Structs
let user1 = User {
email: String::from("<EMAIL>"),
username: String::from("someusername123"),
active: true,
sign_in: 1,
};
println!("{:#?}", user1);
let mut user2 = User {
email: String::from("<EMAIL>"),
... |
// Copyright (c) 2018 King's College London
// created by the Software Development Team <http://soft-dev.org/>
//
// The Universal Permissive License (UPL), Version 1.0
//
// Subject to the condition set forth below, permission is hereby granted to any
// person obtaining a copy of this software, associated documentati... |
use std::sync::mpsc::sync_channel;
use std::sync::Arc;
use actix_web::middleware;
use actix_web::App;
use actix_web::HttpServer;
use failure::ResultExt;
use humthreads::Builder;
use openssl::ssl::SslAcceptor;
use openssl::ssl::SslFiletype;
use openssl::ssl::SslMethod;
use openssl::ssl::SslVerifyMode;
use slog::info;
... |
#![allow(dead_code)]
#![allow(unused_variables)]
#[macro_use]
extern crate log;
use std::time::Duration;
use crate::datastore::DataStore;
use crate::mqtt::MqttConfig;
use crate::sensor::mh_z19::{
MHZ19Command, MHZ19Response, MHZ19Sensor, MockMHZ19Sensor, RealMHZ19Sensor,
};
use crossbeam::channel::Sender;
use en... |
use rand::prelude::SliceRandom;
use rand::thread_rng;
use rand::Rng;
use std::sync::{Arc, Mutex};
use bevy::prelude::*;
use bevy_mod_raycast::{RayCastMesh, RayCastSource};
use bevy_rl::{state::AIGymState, AIGymCamera};
use heron::*;
use names::Generator;
use crate::{actions::*, animations::*, assets::*, game::*, lev... |
#[macro_use]
extern crate criterion;
use algebra::{fields::tweedle::Fr as FieldElement, UniformRand};
use criterion::{BatchSize, BenchmarkId, Criterion};
use primitives::{
crh::{TweedleFrBatchPoseidonHash as BatchFieldHash, TweedleFrPoseidonHash as FieldHash},
merkle_tree::{
BatchFieldBasedMerkleTreePa... |
use crate::errors::AppError;
use crate::trie_nodes::Node;
use ethereum_types::{Address, Bloom, H160, H256, U256};
use rlp::{Encodable, RlpStream};
use serde::Deserialize;
use std::collections::HashMap;
use std::result;
pub type Byte = u8;
pub type Bytes = Vec<Byte>;
pub type HexProof = String;
pub type NodeStack = Vec... |
//! Configuration options which apply only to a search.
use std::convert::TryFrom;
use serde::Deserialize;
use crate::misc::error::{AppCustomErrorKind, AppError};
/// A list of options which are specific to a search. They might or might not be used. If an option is not present, it's deemed false.
/// By default, all... |
#![allow(non_snake_case)]
use rand::seq::SliceRandom;
use rand::thread_rng;
use std::fmt;
use std::hash::{Hash, Hasher};
use std::sync::{Arc, Mutex};
use std::time::Duration;
use zookeeper::{WatchedEvent, Watcher, ZkResult, ZooKeeper};
use super::cloud_methods::SolrCloudMethods;
use crate::config::SolrClientConfig;
u... |
use serde_json::json;
use parking_lot::Mutex;
use chrono::{DateTime, Utc};
use lazy_static::lazy_static;
use super::context::ServiceContext;
use crate::{db::mongo, kafka::{self, prelude::*, Heartbeat}};
use std::{sync::Arc, thread::JoinHandle as StdJoinHandle, time::Duration};
use tonic_health::{server::HealthReporter,... |
use crate::basicstrategy::{rules, BasicStrategy};
use crate::resp::Resp;
use std::io::{self, Write};
pub struct HTMLTableRendererOpts {
pub incl_bs_rules: bool,
pub cell_onclick_cb: Option<String>,
}
pub struct HTMLTableRenderer;
impl HTMLTableRenderer {
fn header(
mut fd: impl Write,
bs_... |
/*!
# Base64 Stream
To encode/decode large data with the standard Base64 encoding.
## Examples
### Encode
#### ToBase64Reader
```rust
extern crate base64_stream;
use std::io::{Cursor, Read};
use base64_stream::ToBase64Reader;
let test_data = b"Hi there, this is a simple sentence used for testing this crate. I h... |
use crate::{db::Pool, docbuilder::Limits, impl_webpage, web::error::Nope, web::page::WebPage};
use chrono::{DateTime, Utc};
use iron::{
headers::ContentType,
mime::{Mime, SubLevel, TopLevel},
IronResult, Request, Response,
};
use router::Router;
use serde::Serialize;
use serde_json::Value;
/// sitemap inde... |
use super::header::*;
use super::question::*;
use super::resource::*;
use super::*;
use crate::error::*;
use anyhow::Result;
use std::collections::HashMap;
// A Builder allows incrementally packing a DNS message.
//
// Example usage:
// b := NewBuilder(Header{...})
// b.enable_compression()
// // Optionally start a s... |
use crate::{
config::AppConfig,
database::{DatabaseAccess, Subscription},
oracle::CommunityOracle,
requests::{
DeclareCommunityRequest, GrantedTokensRequest, MintingSignatureRequest,
RelatedCommunitiesRequest, SubscribeRequest, SubscriptionCheckRequest,
},
responses::{ErrorRespon... |
#![no_main]
#![no_std]
use core::panic::PanicInfo;
use core::sync::atomic;
use core::sync::atomic::Ordering;
use cortex_m_rt::{exception, ExceptionFrame};
use rtic::app;
use rtt_target::rprintln;
use stm32l4xx_hal;
pub const CLOCKS_FREQ_HZ: u32 = 80_000_000; //80 MHz
pub type UsrLed =
stm32l4xx_hal::gpio::gpioa::... |
//Module to handle all group related operations
use hdk::{
error::ZomeApiResult,
error::ZomeApiError,
holochain_core_types::{
entry::Entry,
cas::content::Address,
json::JsonString,
link::LinkMatch
}
};
use std::convert::TryFrom;
use super::utils;
use super::definitions... |
//! Implementations for the binary encoding of various types in RBXM files.
//! Exposed to the user for low-level modification of RBXM data
mod chomp;
mod print;
pub use chomp::{Chomp, ChompInterleaved, ChompInterleavedTransform, ChompTransform};
pub use print::{Print, PrintInterleaved, PrintInterleavedTransform, Pri... |
use crate::ast::{lam_lifted_ast as lifted, typed_ast as typed};
use crate::util::id_vec::IdVec;
// TODO: we can get away with lambda lifting if we don't implement closures
pub fn lift(prog: typed::Program) -> lifted::Program {
lifted::Program {
funcs: IdVec::from_items(
prog.funcs
... |
//! The `ExportedGlobals` WebAssembly class.
use crate::error::unwrap_or_raise;
use lazy_static::lazy_static;
use rutie::{
class, methods,
rubysys::class,
types::{Argc, Value},
util::str_to_cstring,
wrappable_struct, AnyException, AnyObject, Array, Boolean, Exception, Fixnum, Float, Module,
Nil... |
//! Types related to Slack messages
/// A message to send
#[derive(Clone, Debug, Default, Serialize)]
pub struct Message {
/// Channel, private group, or IM channel to send message to. Can be an encoded ID, or a name
pub channel: Option<String>,
/// Text of the message to send
pub text: String,
///... |
use crate::{kvraft::{msg::*, server_fut::*, state::*}, raft};
use madsim::{net, task, time};
use serde::{Deserialize, Serialize};
use futures::{StreamExt, channel::mpsc::UnboundedReceiver};
use std::{
fmt::{self, Debug},
net::SocketAddr,
sync::{Arc, Mutex},
time::Duration,
collections::HashMap,
};
... |
use bech32::{self, ToBase32};
use clap::{App, Arg};
use std::error::Error;
use std::str::FromStr;
use blake2::digest::{Update, VariableOutput};
use blake2::VarBlake2b;
use iota_ledger::LedgerBIP32Index;
use bip39::Mnemonic;
use std::io::{stdin, stdout, Write};
const HARDENED: u32 = 0x80000000;
const BIP32_ACCOUN... |
use crate::lexer::{LexError, Lexer};
use codespan::ByteIndex;
use serde_derive::{Deserialize, Serialize};
use std::fmt::{self, Display, Formatter};
pub type Spanned<'input> =
Result<(ByteIndex, Token<'input>, ByteIndex), LexError>;
pub fn construct_lexer(src: &str) -> impl Iterator<Item = Spanned> {
let mut l... |
macro_rules! cstr {
($lit:expr) => {
{
use std::ffi::CStr;
use libc::c_char;
CStr::from_bytes_with_nul_unchecked(concat!($lit, "\0").as_bytes()).as_ptr() as *const c_char
}
}
}
mod context;
mod function;
mod instructions;
mod symboltable;
mod target;
mod typ... |
// Copyright (c) 2019, The rav1e contributors. All rights reserved
//
// This source code is subject to the terms of the BSD 2 Clause License and
// the Alliance for Open Media Patent License 1.0. If the BSD 2 Clause License
// was not distributed with this source code in the LICENSE file, you can
// obtain it at www.a... |
use crate::core::worker::Worker;
use crate::host::memory_manager::page_size;
use crate::host::syscall_types::TypedPluginPtr;
use crate::utility::pod;
use crate::utility::pod::Pod;
use log::*;
use nix::{errno::Errno, unistd::Pid};
use std::fmt::Debug;
/// A utility for copying data to and from a process's memory.
#[der... |
use gilrs::{Axis, Button, Event, Gamepad, Gilrs};
use std::{collections::HashMap, convert::TryInto, fs};
use std::{net::UdpSocket, time::SystemTime};
const DEFAULT_CONFIG: &str = "target=10.0.0.1:1003";
fn alert_about_malformed_config(message: &str) {
println!("\n\n-----------------");
println!("{}", message)... |
use crate::data::{HETERONYM_TABLE, PINYIN_DATA};
use crate::{get_block_and_index, Pinyin, PinyinData};
use std::convert::TryFrom;
use std::str::Chars;
/// 单个字符的多音字信息
///
/// *仅在启用 `heteronym` 特性时可用*
#[derive(Copy, Clone)]
pub struct PinyinMulti {
first: &'static PinyinData,
other_indexes: &'static [u16],
}
im... |
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
//! Gallery of all widgets
//!
//! This is a test-bed to de... |
extern crate canadensis;
extern crate canadensis_can;
extern crate canadensis_core;
extern crate canadensis_linux;
extern crate canadensis_node;
extern crate rand;
extern crate socketcan;
use std::convert::TryFrom;
use std::env;
use std::io;
use std::time::Duration;
use socketcan::CANSocket;
use canadensis::{CoreNod... |
extern crate aoc;
use std::fmt;
use std::convert;
use std::io;
use aoc::input;
#[derive(Clone,Copy,Debug,PartialEq,Eq)]
enum NodeState {
Clean,
Weakened,
Infected,
Flagged,
}
impl fmt::Display for NodeState {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
let c = match *self {
... |
mod display;
use crate::parser::Rule;
use itertools::Itertools;
use pest::iterators::Pair;
use std::collections::BTreeSet;
// structured representation of a single RON file
pub struct FileText {
extensions: BTreeSet<String>, // btree for printing in alphabetical order
ron_text: TextFragment,
}
// wrapper ove... |
use ark_ec::PairingEngine;
use ark_serialize::{CanonicalDeserialize, CanonicalSerialize, SerializationError};
use ark_std::{
collections::BTreeMap,
fmt::Debug,
io::{Read, Write},
vec::Vec,
};
use bbs_plus::signature::SignatureG1 as BBSSignatureG1;
use dock_crypto_utils::serde_utils::*;
use serde::{Deser... |
//! Iron Middleware System borrowed from https://github.com/iron/iron/blob/master/iron/src/middleware/mod.rs
//! The code is adapted from the original but just keeping only `Handler` and `AfterMiddleware` functionality.
//! This is intended to work with latest Hyper 0.14.x
use hyper::{Body, Request, Response};
use std... |
//! Module that holds everything that is necessary for the `VpnNetwork`
use async_graphql::*;
use super::vpn_ip_address::VpnIpAddress;
use super::*;
use crate::schema::{vpn_ip_addresses, vpn_networks};
/// A [`VpnNetwork`] that is insertable into the database
#[derive(Insertable)]
#[table_name = "vpn_networks"]
pub s... |
use crate::display;
use crate::filesystem;
use crate::structures::cheat::VariableMap;
use crate::structures::fnv::HashLine;
use crate::structures::fzf::{Opts as FzfOpts, SuggestionType};
use crate::structures::option::Config;
use crate::welcome;
use regex::Regex;
use std::collections::HashSet;
use std::fs;
use std::io:... |
use hex::FromHex;
use hmac::{
digest::{consts::U32, generic_array::GenericArray},
Hmac, Mac, NewMac,
};
use serde::{Deserialize, Serialize};
use sha2::Sha256;
use std::convert::Infallible;
use warp::{http::StatusCode, Filter};
use crate::config::{self, GLOBAL_GITHUB_CONFIG, SHA256_SIZE};
use crate::manager;
t... |
//! The Azure Data Lake Storage Gen2 storage backend.
//!
//! This module is gated behind the "azure" feature. Its usage also requires
//! the `AZURE_STORAGE_ACCOUNT` and `AZURE_STORAGE_KEY` environment variables
//! to be set to the name and key of the Azure Storage Account, respectively.
use std::error::Error;
use st... |
use tinystr::{TinyStr4, TinyStr8};
use unic_langid_impl::parser::errors::ParserError;
use unic_langid_impl::parser::parse_language_identifier;
use unic_langid_impl::CharacterDirection;
use unic_langid_impl::{LanguageIdentifier, LanguageIdentifierError};
fn assert_language_identifier(
loc: &LanguageIdentifier,
... |
extern crate chashmap;
extern crate clap;
extern crate itertools;
#[cfg_attr(test, macro_use)]
extern crate polytype;
extern crate programinduction;
extern crate rayon;
extern crate serde;
extern crate serde_json;
#[macro_use]
extern crate serde_derive;
mod vs;
use self::vs::induce_version_spaces;
use polytype::Type;... |
use std::collections::HashMap;
use std::slice;
use ggez::{Context, GameResult};
mod animation_systems;
mod input_systems;
mod render_systems;
mod rule_systems;
use resources::Resources;
use types::*;
use self::render_systems::*;
type Component<T> = Vec<Option<T>>;
#[derive(Default)]
pub struct GameState {
ent... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.