text stringlengths 3.09k 13.9k |
|---|
use std::collections::{ HashSet };
use std::str::FromStr;
use once_cell::sync::Lazy;
use regex::Regex;
use anyhow::{ Result, anyhow };
#[derive(Debug,Clone)]
pub struct Template {
pieces: Vec<Piece>,
re: Regex
}
impl Template {
/// Instantiate a new template given a string
/// like 'foo {bar} wibble'... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use crate::tracing::types::{
InitializeRequest, ResultsDestination, TerminateRequest, TerminateResponse,
};
use anyhow::Error;
use base64;
use fidl_fuc... |
use crate::model::*;
use async_std::prelude::*;
use http::{
header::{HeaderName, CONNECTION /*, CONTENT_LENGTH*/, CONTENT_ENCODING},
status::StatusCode,
HeaderMap, HeaderValue,
};
use http_parser::*;
use libflate::gzip::Decoder;
use std::io;
use std::time::Instant;
pub async fn read_response(
rw: &mut ... |
use mrc_decoder::decode_instruction;
use mrc_instruction::Instruction;
use std::{
fmt::{Display, Formatter},
io::Read,
str::FromStr,
};
use structopt::StructOpt;
struct SegmentAndOffset {
segment: u16,
offset: u16,
}
#[inline(always)]
fn segment_and_offset(segment: u16, offset: u16) -> SegmentAndO... |
use std::path::Path;
use std::{fs, str};
use std::fs::OpenOptions;
use std::io::Write;
use select::document::Document;
use select::predicate::{Class, Name};
#[derive(Clone, Debug, Eq, PartialEq)]
struct Address {
street: String,
city: String,
state: String,
zip_code: String,
}
fn name_data(name: &str... |
use hotham::{
components::RigidBody,
rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ColliderBuilder, RigidBodyBuilder},
resources::{PhysicsContext, XrContext},
util::{is_space_valid, posef_to_isometry},
};
use legion::{system, Entity, World};
use nalgebra::{vector, Isometry3, Quaternion, Transl... |
use std::fs::{self, File};
use std::convert::TryInto;
use itertools::Itertools;
use png::HasParameters;
use crate::rom::*;
use crate::mod_dir::ModDir;
use crate::data::yay0;
use crate::data::color::Palette;
use super::shape::Shape;
fn asset_table_addr(rom: &Rom) -> u32 {
match rom.region {
Region::Japan ... |
//! Sql column types and traits
use crate::{
error::{err_column_null, err_type_conv},
ibase, FbError,
};
use std::ops::Deref;
use ColumnType::*;
/// A database row
pub struct Row {
pub cols: Vec<Column>,
}
impl Row {
/// Get the column value by the index
pub fn get<T>(&self, idx: usize) -> Resul... |
use proc_macro2::{TokenStream, TokenTree};
use syn::parse::{Parse, ParseStream, Result};
use syn::spanned::Spanned;
use syn::token::Brace;
use syn::{braced, Block, Expr, Ident, Token};
#[derive(Debug)]
pub enum Tag {
/// <div id="app" class=*CSS>
/// <br />
Open {
name: Ident,
attrs: Vec<At... |
extern crate console_error_panic_hook;
extern crate gif;
extern crate wasm_bindgen;
use gif::SetParameter;
use gif::{ColorOutput, Decoder, Encoder, Frame, Reader, Repeat};
use std::vec::Vec;
use wasm_bindgen::prelude::*;
#[wasm_bindgen]
extern "C" {
// Access console.log() from the wasm module
#[wasm_bindgen(... |
use std::{
collections::{HashMap, HashSet},
fs,
path::{Path, PathBuf},
};
use crate::error::OperationsError;
/// Operations are derived by reading files subdirectories per cloud /etc/tedge/operations directory
/// Each operation is a file name in one of the subdirectories
/// The file name is the operatio... |
// Copyright 2020 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
use {
crate::io::{Directory, File},
crate::utils::{BLOCK_SIZE, FOUR_MB},
fuchsia_merkle::MerkleTree,
fuchsia_zircon::Status,
rand::{rng... |
use super::lovense_dongle_messages::{
LovenseDongleIncomingMessage, LovenseDongleMessageFunc, LovenseDongleMessageType,
LovenseDongleOutgoingMessage, OutgoingLovenseData,
};
use crate::{
core::{
errors::{ButtplugDeviceError, ButtplugError},
messages::RawReading,
ButtplugResultFuture,
},
device::{
... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Parity Error Enable Register"]
pub peen: PEEN,
#[doc = "0x04 - Memory Checking Control Register"]
pub mchkcon: MCHKCON,
#[doc = "0x08 - Parity Error Trap Enable Register"]
pub pete: PETE,
#[doc = "0x0c - Parity ... |
// wengwengweng
use std::collections::HashMap;
use std::time::Duration;
use crate::*;
use math::*;
use gfx::shapes;
#[derive(Clone)]
pub struct Sprite {
tex: gfx::Texture,
frames: Vec<Quad>,
cur_frame: usize,
offset: Vec2,
anims: HashMap<String, Anim>,
cur_anim: Option<String>,
timer: Duration,
speed: Durati... |
use app::StatusOr;
use dimensions::time;
use file;
use gl::{
self,
types::*
};
use glm;
use nalgebra;
use ncollide;
use nphysics3d;
use shader::ShaderProgram;
use std::{
self,
sync::Arc,
};
const HEXAGON_SCALE: f32 = 20.0;
pub struct HexGrid {
shader: ShaderProgram,
vao: GLuint,
positions_... |
use std::collections::VecDeque;
use cursive::{
Cursive, Printer,
direction::Direction,
event::{AnyCb, Event, EventResult},
theme::{ColorStyle, Color, ColorType, BaseColor},
view::{View, Selector, Scrollable, ScrollStrategy, Identifiable},
views::{RadioGroup, LinearLayout, Dialog, TextView, Chec... |
use bstr::ByteSlice;
use std::io::{self, Read};
use std::ops::Range;
use memchr::memchr;
use thiserror::Error;
use crate::object::ParseIdError;
use crate::reference::{Direct, ReferenceTarget, Symbolic};
const SYMBOLIC_PREFIX: &[u8] = b"ref: ";
const INVALID_REFERENCE_START: &[u8] = b"\n #";
pub struct Parser<R> {
... |
//! Provide transformations between PDF and SVG coordinate systems.
use usvg::{Align, AspectRatio, ViewBox};
/// Convert point data between two coordinate systems.
#[derive(Debug, Copy, Clone)]
pub struct CoordToPdf {
factor_x: f64,
factor_y: f64,
offset_x: f64,
offset_y: f64,
height_y: f64,
d... |
use futures_util::StreamExt;
use hyper::Body;
use ic_types::canonical_error::{out_of_range_error, unknown_error, CanonicalError};
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::Duration;
use tokio::time::timeout;
use tower::Service;
#[derive(Clone)]
pub(crate) struct BodyPar... |
use super::spinlock::SpinRwLock;
use super::IntoOptionArc;
use std::mem;
use std::ptr::null_mut;
use std::sync::atomic::{AtomicPtr, Ordering};
use std::sync::Arc;
/// An atomic reference that may be updated atomically.
pub struct AtomicOptionRef<T> {
ptr: AtomicPtr<T>,
lock: SpinRwLock,
}
impl<T> AtomicOption... |
use crate::stable_hasher::{HashStable, StableHasher};
use std::cmp::Ordering;
use std::hash::{Hash, Hasher};
use std::ops::Deref;
use std::ptr;
use crate::fingerprint::Fingerprint;
mod private {
#[derive(Clone, Copy, Debug)]
pub struct PrivateZst;
}
/// A reference to a value that is interned, and is known t... |
use kompact::prelude::*;
use futures::StreamExt;
use std::{net::SocketAddr, sync::Arc};
use tokio::{
net::{TcpListener, UdpSocket},
runtime::Runtime,
};
use tokio_util::{
codec::{BytesCodec, Decoder},
udp::UdpFramed,
};
use bytes::BytesMut;
use std::thread::{Builder, JoinHandle};
/// Events that an I... |
use std::time::SystemTime;
use http_cache_semantics::{AfterResponse, BeforeRequest, CacheOptions, CachePolicy};
use reqwest::Client;
use serde::{de::DeserializeOwned, Serialize};
use url::Url;
mod api_models;
mod cache;
mod error;
pub use api_models::*;
pub use error::Error;
use crate::pokedex::cache::Entry;
use s... |
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors
// SPDX-License-Identifier: MIT
#![forbid(unsafe_code)]
use std::{ops::Range, env};
use structopt::StructOpt;
#[derive(StructOpt)]
enum Args {
Log {
range: u8,
},
P2pInitiator {
this: u16,
peer: u16,
},
... |
#[macro_use]
extern crate derive_new;
extern crate clap;
extern crate hyper;
extern crate log;
extern crate nix;
extern crate pretty_env_logger;
extern crate serde_json;
extern crate ddns_common;
#[derive(Debug, new)]
struct Config {
interface: String,
host: String,
port: String,
socket_address: std:... |
use std::{mem, slice};
use std::sync::{Arc, Mutex};
use std::sync::atomic::{AtomicBool, AtomicUsize, Ordering};
use chunk_vec::{Chunk, ChunkVec, ChunkWriter};
use config::{Config, IPair};
use pair::VPair;
use stats::{self, IterStats};
use util::{MutexExt, PoolExt};
use ctrlc::CtrlC;
use scoped_threadpool::Pool;
pub ... |
use std::{
ops::{Add, Rem, Sub},
str::FromStr,
};
use arbitrary::{Arbitrary, Unstructured};
use rand::RngCore;
use uom::{
num::Signed,
si::{f64::*, length::foot, time::second, velocity::foot_per_minute},
};
use opentaws::prelude::*;
#[derive(Debug, Clone)]
struct AircraftStateWrapper(AircraftState);... |
use crate::{
core::{context::Context, failable_unit::FailableUnit, io, logs, outputs, remote_zips, script::Script, scripts},
log_tag,
};
use std::{collections::HashMap, path::PathBuf};
const EMSCRIPTEN_VERSION: &str = "2.0.32";
const EMSCRIPTEN_URL: &str = "https://github.com/emscripten-core/emsdk/archive/refs... |
use std::convert::TryInto;
use std::io::Write;
use std::time::Instant;
use preference_splitting::graph::dijkstra::Dijkstra;
use preference_splitting::graph::path::Path;
use preference_splitting::graph::trajectory_analysis::{SubPath, TrajectoryAnalysis};
use preference_splitting::graph::{parse_minimal_graph_file, Graph... |
use glium;
use glium::{Display, Program};
use glium::Surface;
use std::collections::hash_map::HashMap;
use camera::Camera;
use render::object::Object;
use universe::game::Game;
use openhmd::OpenHMD;
pub struct RenderBuffer{
pub shaders: HashMap<String, Program>
}
impl RenderBuffer{
pub fn add_shader(&mut self... |
use gouda::ecs::{GameStateId, Entity, ECS, Mutation, Mutations};
use gouda::{GameState, RenderLayer};
use gouda::mouse_capture::{MouseCaptureLayer, ActiveCaptureLayer, MouseCaptureArea};
use gouda::gui::{GuiComponent, GuiText};
use gouda::gui::constraints::{GuiConstraints, Constraint};
use gouda::types::{Color, Bounds}... |
use rustls::{internal::pemfile, NoClientAuth, ServerConfig};
use std::fs::File;
use std::io::{BufReader, Write};
use std::net::{SocketAddr, ToSocketAddrs};
use std::sync::Arc;
use uuid::Uuid;
#[derive(Deserialize, Serialize, Debug)]
pub struct CfgAddr {
pub ip: Option<String>,
pub domain: Option<String>,
p... |
use alloc::string::String;
use core::ops::Range;
use core::str::{CharIndices, FromStr};
use num::{One, Zero};
use crate::err::TermFromStringError;
#[derive(Debug, Clone, PartialEq)]
/// Degree is a type which represents the degree of a polynomial.
pub enum Degree {
/// The degree of a zero-polynomial.
NegInf... |
#[doc = "Reader of register ENABLED1"]
pub type R = crate::R<u32, super::ENABLED1>;
#[doc = "Reader of field `clk_sys_xosc`"]
pub type CLK_SYS_XOSC_R = crate::R<bool, bool>;
#[doc = "Reader of field `clk_sys_xip`"]
pub type CLK_SYS_XIP_R = crate::R<bool, bool>;
#[doc = "Reader of field `clk_sys_watchdog`"]
pub type CLK... |
mod utils;
use rand::Rng;
use std::{fmt, ops};
use wasm_bindgen::prelude::*;
use web_sys::console as web_console;
use fixedbitset::FixedBitSet;
#[wasm_bindgen]
pub fn set_panic_hook() {
utils::set_panic_hook();
}
// When the `wee_alloc` feature is enabled, use `wee_alloc` as the global
// allocator.
#[cfg(featu... |
use failure::{Error, ResultExt};
use std::env;
use std::path::PathBuf;
use std::process::Command;
use crate::env::{corpora_dir, state_dir};
use crate::fuzzers::{FuzzerConfig, FuzzerQuit};
use crate::targets::Targets;
/***********************************************
name: Afl with jqf for java fuzzing
github: https:/... |
use std::boxed::Box;
use crate::algos::MazeAlgo;
#[derive(Copy, Clone)]
pub enum Walls {
Left = 1 << 0,
Right = 1 << 1,
Up = 1 << 2,
Down = 1 << 3,
}
impl Walls {
fn left(v: i8) -> bool {
v & Walls::Left as i8 != 0
}
fn right(v: i8) -> bool {
v & Walls::Right as i... |
use enum_primitive::FromPrimitive;
use register::mmio::*;
#[derive(Debug, PartialEq, Copy, Clone)]
pub enum GpioPort {
A = 0,
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,
AA,
BB... |
use crate::stream_parser::model::DataMessage;
use crate::stream_parser::model::FlattenedField;
use crate::stream_parser::model::FlattenedFieldValue;
pub use crate::stream_parser::model::{FlattenedFieldType, MultiId};
use crate::stream_parser::LittleEndianParser;
use crate::stream_parser::LogParser;
use std::collections... |
use base64;
use log::error;
use std::convert::TryFrom;
use super::auth_service_port::*;
use super::auth_store_port::*;
use super::auth_types::*;
use jsonwebtoken::{decode, encode, DecodingKey, EncodingKey, Header, Validation};
use sodiumoxide::crypto::hash;
use sodiumoxide::crypto::pwhash;
#[cfg(test)]
pub mod test_c... |
use std::env::args;
use std::time::Instant;
#[derive(Debug)]
enum RuleKind {
Letter(char),
Seq(Vec<usize>),
Choice(Box<Rule>, Box<Rule>),
}
#[derive(Debug)]
struct Rule {
kind: RuleKind,
idx: usize,
}
impl Rule {
fn seq(idx: usize, seq: &mut Vec<usize>) -> Self {
let mut vec = Vec::wi... |
//! Parser functions for a string with 4 digits.
/// Parses 4 digits effectively in little endian.
///
/// # Failures
///
/// Note that this returns meaningless value for strings with non-digit characters.
/// This is safe in a sense that this never cause UB for any input, but callers
/// should ensure that the bytes ... |
use std::io::{Cursor, Write};
use libflate::zlib::Encoder;
use prost::Message as ProstMesssage;
use crate::libs::{Ndarray, Vec3};
/// Protocol buffers generated by `prost.rs`.
pub mod protocols {
include!(concat!(env!("OUT_DIR"), "/protocol.rs"));
}
pub use protocols::Message;
pub type MessageType = protocols:... |
#![deny(warnings)]
#![allow(non_camel_case_types)]
#![allow(clippy::all)]
#![no_std]
mod generic;
pub use generic::*;
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
#[doc = "0x00 - Master Priviledge Registers"]
pub mpr: MPR,
_reserved1: [u8; 60usize],
#[doc = "0x40 - Off-Platform Per... |
// Copyright 2019 EinsteinDB Project Authors. Licensed under Apache-2.0.
use einsteindb_util::keybuilder::KeyBuilder;
use crate::*;
/// A byteseq indicating where an iterator "seek" operation should stop.
pub enum SeekKey<'a> {
Start,
End,
Key(&'a [u8]),
}
pub trait Iterator: Send {
fn seek(&mut ... |
use std::{borrow::{Borrow, Cow}, ops::Deref, process::Command, sync::mpsc::Receiver};
use conrod_core::{Colorable, Positionable, Widget, widget, widget_ids};
use gilrs::{Button, EventType, Gilrs};
use glium::Surface;
use smithay::reexports::calloop::channel::Sender;
conrod_winit::v023_conversion_fns!();
mod drawing;... |
use mathml_rs::MathNode;
use sbml_rs::{self, Model};
use std::collections::HashMap;
use crate::LocalParameter;
use super::bindings::random_string;
#[derive(Debug, Clone)]
pub struct Reaction {
pub id: String,
pub reversible: bool,
pub compartment: Option<String>,
pub sbo_term: Option<String>,
pub... |
use crate::Git;
use once_cell_regex::regex;
#[cfg(feature = "serde")]
use serde::{Deserialize, Serialize};
use std::{
error::Error as StdError,
fmt::Display,
path::{Path, PathBuf},
};
#[derive(Debug)]
pub enum Source {
NameMissing,
IndexCheckFailed(std::io::Error),
InitCheckFailed(std::io::Erro... |
use crate::abstracts::{AbstractSource, ComparableAbstractSource, AbstractBoundary};
use crate::delimeter::Delimeter;
use crate::raw_token::{RawToken, RawTokenInfo};
use crate::special_characters::{COLON, NEW_LINE, SPACE, TAB};
/// Returns the info of recognized attacher and the last index that has been checked from th... |
mod vec_trie;
use inferno::flamegraph;
use std::cell::RefCell;
use std::fmt::Write;
use std::fs::File;
use std::time::{Duration, Instant};
use vec_trie::{Index, VecTrie, Visitor};
/// Declare a span to be traced. Takes a single `&'static str` argument.
///
/// The span begins when the macro is called, and ends when t... |
// Copyright 2020-2021 The Datafuse Authors.
//
// SPDX-Lise-Identifier: Apache-2.0.
use std::collections::HashMap;
use std::convert::TryFrom;
use std::sync::Arc;
use std::sync::Mutex;
use common_arrow::arrow::datatypes::Schema;
use common_arrow::arrow_flight;
use common_arrow::arrow_flight::FlightData;
use common_fl... |
use crate::MatLinAlgBound;
use super::sparse::NRsparseMat;
/// Trait for solving sparce linear equations by the preconditioned conjugate gradient method
pub trait Linbcg<T>
where
T: MatLinAlgBound,
{
fn asolve(&self, b: &Vec<T>, x: &mut Vec<T>, itrnsp: usize);
fn atimes(&self, x: &Vec<T>, r: &mut Vec<T>, ... |
/*
* Copyright 2020 Fluence Labs Limited
*
* 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 a... |
use chargrid_input::*;
macro_rules! convert_char_shift {
($lower:expr, $upper:expr, $shift:expr) => {
KeyboardInput::Char(if $shift { $upper } else { $lower })
};
}
#[allow(clippy::cognitive_complexity)]
fn keyboard_input_from_js_event_key_press(key_code: u8, shift: bool) -> Option<KeyboardInput> {
... |
// MIT License
//
// Copyright (c) 2020 <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, merg... |
use crate::runtime::execution::ExecutionState;
use crate::runtime::storage::StorageKey;
use crate::runtime::task::clock::VectorClock;
use crate::sync::Mutex;
use std::cell::RefCell;
use std::rc::Rc;
use tracing::trace;
/// A synchronization primitive which can be used to run a one-time global initialization. Useful
//... |
use crate::disk_service::DiskService;
use crate::mem_table::{MemTable, MemTableEntry};
use std::io::{Error, ErrorKind};
use std::path::PathBuf;
use std::fs;
use std::io;
use std::fs::OpenOptions;
use std::time::{SystemTime, UNIX_EPOCH};
use crate::wal::WAL;
use crate::util;
struct db {
dir_db: PathBuf,
disk_se... |
use arbitrary::{self, unstructured::Unstructured, Arbitrary};
use rand::{prelude::random, rngs::SmallRng, Rng, SeedableRng};
use super::*;
use std::{collections::BTreeMap, ops::Bound};
#[test]
fn test_rc_omap() {
let seed: u128 = random();
// let seed: u128 = 46462177783710469322936477079324309004;
print... |
pub type c_char = i8;
pub type greg_t = u64;
pub type wchar_t = i32;
pub type nlink_t = u64;
pub type blksize_t = ::c_long;
pub type __u64 = ::c_ulonglong;
s! {
pub struct stat {
pub st_dev: ::dev_t,
pub st_ino: ::ino_t,
pub st_nlink: ::nlink_t,
pub st_mode: ::mode_t,
pub st... |
//! Computes a minimum cut of an undirected connected graph using Karger's algorithm.
extern crate rand;
use std::collections::HashMap;
use std::collections::hash_map::Entry;
use std::cmp;
use std::mem;
use rand::distributions::{IndependentSample, Range};
pub type Vertex = usize;
pub type Weight = u32;
const UNIT_... |
use crate::{
ffi::callbacks,
proto,
proto::VarInt,
proto_impl::{
endpoint::EndpointEvent,
result::FFIErrorKind,
},
};
use bytes::Bytes;
use quinn_proto::StreamEvent;
use std::{
sync::{
mpsc,
mpsc::Sender,
},
time::Instant,
};
/// Events for the connection... |
use std::fmt::{Display, Formatter};
use vfpl_error::Span;
use vfpl_global::{GlobalCtx, Spur, SpurCtx};
#[derive(Debug, Clone, PartialEq)]
pub struct Token {
pub span: Span,
pub kind: TokenKind,
}
#[derive(Debug, Clone, PartialEq)]
pub enum TokenKind {
CondKw(CondKeyword),
Ident(SpurCtx),
// Keywor... |
//! Cancels an existing bid. This only works in two cases:
//!
//! 1) The auction is still going on, in which case it is possible to cancel a bid at any time.
//! 2) The auction has finished, but the bid did not win. This allows users to claim back their
//! funds from bid accounts.
use crate::{
errors::Auction... |
use std::env;
use html5ever::buffer_queue::BufferQueue;
use html5ever::tendril::format_tendril;
use html5ever::tokenizer::{TagKind, Token as Token2, TokenSinkResult, TokenizerResult};
use html5gum::{Doctype, Emitter, EndTag, Reader, StartTag, Token};
use pretty_assertions::assert_eq;
pub fn run(s: &[u8]) {
let m... |
use std::borrow::BorrowMut;
use nalgebra::{Point3, Vector3};
use num_traits::identities::Zero;
use rand::prelude::SliceRandom;
use rand::{thread_rng, Rng};
use bsdf::{BsdfSampleResult, BXDFTYPES};
use helpers::power_heuristic;
use lights::area::AreaLight;
use lights::{Light, LightTrait};
use materials::MaterialTrait;... |
use super::{Mapper, MapperParams, RomAddress};
use super::bank::*;
struct Mapper000 {
prg_rom: MappingTable,
chr_rom: Box<[u8]>,
chr_ram: Box<[u8]>,
prg_ram: Box<[u8]>,
mode: &'static [u16; 4],
}
pub fn new(params: MapperParams) -> Box<Mapper> {
let chr_ram = if params.chr_rom.is... |
/*
* MIT License
*
* Copyright (c) 2022 <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, m... |
//! This crate provides a macro that enables the familiar `try-catch` syntax of other programming languages.
//! It can be used to easlily group errors and manage them dynamically by type rather than value.
//!
//! ```rust
//! use try_catch::catch;
//! use std::*;
//! use serde_json::Value;
//!
//! catch! {
//! try... |
use super::*;
use pact_matching::models::*;
use pact_matching::models::matchingrules::*;
use pact_matching::models::generators::*;
use std::str::FromStr;
use std::error::Error;
use std::collections::hash_map::HashMap;
use hyper::client::Client;
use hyper::{Request as HyperRequest, Response as HyperResponse};
use hyper:... |
/*!
[`RangeMap`] and [`RangeInclusiveMap`] are map data structures whose keys
are stored as ranges. Contiguous and overlapping ranges that map to the same
value are coalesced into a single range.
Corresponding [`RangeSet`] and [`RangeInclusiveSet`] structures are also provided.
# Different kinds of ranges
`RangeMap... |
use types::Identifier;
use parser::peg::Pipeline;
use parser::assignments::Binding;
#[derive(Debug, PartialEq, Clone)]
pub struct ElseIf {
pub expression: Pipeline,
pub success: Vec<Statement>
}
#[derive(Debug, PartialEq, Clone, Copy)]
pub enum Type { Float, Int, Bool }
#[derive(Debug, PartialEq, Clone)]
... |
use crate::{
attr::AttrStr,
error::Convert,
object::ObjectRef,
schema::{Any, FieldSchema, Schema, WithSchema},
};
use indexmap::IndexMap;
use serde::ser::Error;
use serde::{
ser::{SerializeMap, SerializeSeq, Serializer},
Serialize,
};
lazy_static::lazy_static! {
static ref ATTR_NAME: AttrSt... |
use crate::_aeon_parser::{FnUpdateTemp, RegulationTemp};
use crate::{BooleanNetwork, Parameter, RegulatoryGraph};
use regex::Regex;
use std::collections::HashSet;
use std::convert::TryFrom;
impl TryFrom<&str> for BooleanNetwork {
type Error = String;
fn try_from(value: &str) -> Result<Self, Self::Error> {
... |
//! Information about status and state of the container
use std::collections::HashMap;
use std::fmt::Display;
use std::fs;
use std::path::PathBuf;
use std::{fs::File, path::Path};
use anyhow::{Context, Result};
use chrono::{DateTime, Utc};
use serde::{Deserialize, Serialize};
/// Indicates status of the container
#[d... |
#[allow(unused_imports)]
use std::rc::Rc;
use std::sync::{Mutex, Arc};
use std::thread;
/*
A mutex allows only one thread to access some data at any given time. To access
the data in a mutex, a thread must first signal that it wants access by asking
to acquire the mutex’s lock. The lock is a data structure that is p... |
use idroid::{math::TouchPoint, node::BufferlessFullscreenNode, utils::HUD, SurfaceView};
use super::{compute_node::SDFComputeNode, render_node::SDFRenderNode};
use uni_view::{fs::FileSystem, AppView, GPUContext};
pub struct SDFTextView {
pub app_view: AppView,
hud: HUD,
image: Option<String>,
compute_... |
use std::borrow::{Borrow, BorrowMut};
use std::char;
use std::convert::Into;
use std::fmt;
use std::iter::{IntoIterator, Iterator};
#[derive(Clone, Copy, PartialEq, Default)]
pub struct CandidateSet(usize);
// Constant with all the candidates turned on.
const ALL_CAND: usize = 1 | 1 << 1 | 1 << 2 | 1 << 3 | 1 << 4 | ... |
#![warn(missing_debug_implementations, rust_2018_idioms)]
#![warn(clippy::all)]
//!
use frontmatter::split_matter;
use pulldown_cmark::{html, Parser};
use std::path::PathBuf;
use std::sync::Arc;
use std::{collections::HashMap, fs::File, io::BufReader, pin::Pin};
#[salsa::query_group(FSDatabaseStorage)]
pub trait FSDa... |
// Copyright 2018 The Exonum 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 agreed to i... |
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
use crate::{Error, ... |
//! Futures task based helpers
#![allow(clippy::mutex_atomic)]
use std::future::Future;
use std::mem;
use std::ops;
use std::pin::Pin;
use std::sync::{Arc, Condvar, Mutex};
use std::task::{Context, Poll, RawWaker, RawWakerVTable, Waker};
use tokio::stream::Stream;
/// TOOD: dox
pub fn spawn<T>(task: T) -> Spawn<T> ... |
// Import hacspec and all needed definitions.
use hacspec_lib::*;
array!(State, 16, U32, type_for_indexes: StateIdx);
array!(Constants, 4, U32, type_for_indexes: ConstantsIdx);
bytes!(Block, 64);
bytes!(ChaChaIV, 12);
bytes!(ChaChaKey, 32);
fn chacha20_line(a: StateIdx, b: StateIdx, d: StateIdx, s: usize, m: State) -... |
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0 OR MIT
use clap::{
app_from_crate, crate_authors, crate_description, crate_name, crate_version, App, AppSettings,
Arg,
};
use std::env;
/// Option name used to set log level.
pub const LOG_LEVEL: &'sta... |
//! This module implements a do_cgi function, to run CGI scripts with hyper
use futures::stream::StreamExt;
use futures::TryStreamExt;
use hyper::{Request, Response};
use std::process::Stdio;
use std::str::FromStr;
use tokio::io::AsyncBufReadExt;
use tokio::io::AsyncReadExt;
use tokio::io::BufReader;
use tokio::process... |
use super::*;
use futures::stream;
use http_body::Body;
use linkerd2_proxy_api::tap as pb;
pub fn client(addr: SocketAddr) -> Client {
let api = pb::tap_client::TapClient::new(SyncSvc(client::http2(addr, "localhost")));
Client { api }
}
pub fn client_with_auth<T: Into<String>>(addr: SocketAddr, auth: T) -> Cl... |
use std::{
collections::HashMap,
fs,
path::{Path, PathBuf},
};
use clap::{App, Arg, SubCommand};
use failure::bail;
use tools::{
collect_tests, generate,install_format_hook, run, run_rustfmt,
Mode, Overwrite, Result, Test, Verify, project_root, run_fuzzer
};
const GRAMMAR_DIR: &str = "crates/ra_s... |
use futures::{ready, Stream, TryFuture};
use linkerd_channel as mpsc;
use linkerd_error::{Error, Never};
use pin_project::pin_project;
use std::future::Future;
use std::pin::Pin;
use std::task::{Context, Poll};
use std::time::Duration;
use tokio::sync::oneshot;
use tokio::time::{self, Sleep};
use tower::discover;
use t... |
//! Work with sparse and dense polynomials.
use core::convert::TryInto;
use crate::{Cow, EvaluationDomain, Evaluations, FftField, Field, Vec};
use DenseOrSparsePolynomial::*;
mod dense;
mod sparse;
pub use dense::DensePolynomial;
pub use sparse::SparsePolynomial;
/// Represents either a sparse polynomial or a den... |
use crate::platform::prelude::*;
use serde::{Deserialize, Serialize};
/// Describes a Font to visualize text with. Depending on the platform, a font
/// that matches the settings most closely is chosen. The settings may be
/// ignored entirely if the platform can't support different fonts, such as in a
/// terminal.
#... |
#![allow(deprecated)]
use std::collections::HashSet;
use std::{collections::HashMap, io::stdin};
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
struct Func {
name: String,
re: String,
args: Vec<String>,
}
use inflector::Inflector;
use regex::Regex;
use std::fs::*;
use std::io::*;
fn main() {
let name =... |
// This file is part of Substrate.
// Copyright (C) 2017-2020 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... |
/*
* Rust BareBones OS
* - By <NAME> (Mutabah/thePowersGang)
*
* main.rs
* - Top-level file for kernel
*
* This code has been put into the public domain, there are no restrictions on
* its use, and the author takes no liability.
*/
#![crate_name = "kernel"]
#![feature(lang_items, no_std, asm)]
// Crates
#![fe... |
// This file is part of Substrate.
// Copyright (C) 2020-2021 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... |
use cosmwasm_bignumber::{Decimal256, Uint256};
use cosmwasm_std::{
attr, from_binary, to_binary, BankMsg, Binary, Coin, CosmosMsg, Decimal, Deps, Empty,
QueryRequest, Response, StdError, StdResult, Uint128, WasmMsg, WasmQuery,
};
use cw20::Cw20ExecuteMsg;
use cw20::Cw20ReceiveMsg;
use schemars::JsonSchema;
use... |
//! aes128 driver, nRF5X-family
//!
//! Provides a simple driver for userspace applications to encrypt and decrypt
//! messages using aes128-ctr mode on top of aes128-ecb.
//!
//! Roughly, the module three buffers with the following content:
//!
//! * Key
//! * Initial counter
//! * Payload, to be encrypted or decrypte... |
// 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.
//! Typesafe wrappers around an open package directory.
use crate::{MetaContents, MetaContentsError, MetaPackage, MetaPackageError};
use fidl::endpoints::... |
use core::str;
use cstr_core::{CStr, CString};
use ndless::hw::has_colors;
use ndless::prelude::*;
// Setup linking for all targets.
#[cfg(target_os = "macos")]
mod mac {
#[cfg(mac_framework)]
#[link(name = "SDL", kind = "framework")]
extern "C" {}
#[cfg(not(mac_framework))]
#[link(name = "SDL")]
extern "C" {}
... |
use crate::common::*;
#[derive(Debug, Clone)]
pub struct Detect2DInit {
pub num_classes: usize,
pub anchors: Vec<RatioSize<R64>>,
}
impl Detect2DInit {
pub fn build<'p, P>(self, path: P) -> Detect2D
where
P: Borrow<nn::Path<'p>>,
{
let path = path.borrow();
let device = pat... |
use std::convert::TryFrom;
use nix::errno::Errno;
use snafu::{ResultExt, Snafu};
use url::{ParseError, Url};
use crate::{
bdev::{
AioBdev,
AioParseError,
IscsiBdev,
IscsiParseError,
NvmeCtlAttachReq,
NvmfParseError,
UringBdev,
UringParseError,
},... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.