text stringlengths 9.08k 47.9k |
|---|
// This file is part of the SORA network and Polkaswap app.
// Copyright (c) 2020, 2021, Polka Biome Ltd. All rights reserved.
// SPDX-License-Identifier: BSD-4-Clause
// Redistribution and use in source and binary forms, with or without modification,
// are permitted provided that the following conditions are met:
... |
pub mod protocols;
pub use protocols::create::{BuildFundingPsbt, SignFundingPsbt};
use protocols::{close, create, punish::punish, splice, update};
use crate::{
keys::{
OwnershipKeyPair, OwnershipPublicKey, PublishingKeyPair, PublishingPublicKey,
RevocationKeyPair, RevocationPublicKey, RevocationSe... |
// Copyright 2020 The Grin 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 or agree... |
use fantoch::id::ProcessId;
use fantoch::{HashMap, HashSet};
use std::mem;
type Ballot = u64;
/// Implementation of Flexible single-decree Paxos in which:
/// - phase-1 waits for n - f promises
/// - phase-2 waits for f + 1 accepts
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SynodMessage<V> {
// to be handled... |
//! This module is responsible for matching a search pattern against a node in the AST. In the
//! process of matching, placeholder values are recorded.
use crate::{
parsing::{Constraint, NodeKind, Placeholder, Var},
resolving::{ResolvedPattern, ResolvedRule, UfcsCallInfo},
SsrMatches,
};
use hir::Semantic... |
use rustc::ty::{self, ParamEnv, TyKind};
use syntax::ast::*;
use syntax::parse::token;
use syntax::ptr::P;
use crate::command::{CommandState, Registry};
use crate::driver::Phase;
use crate::matcher::{mut_visit_match_with, replace_expr, MatchCtxt};
use crate::transform::Transform;
use crate::RefactorCtxt;
use c2rust_as... |
use protocol::FIXValue;
/// ISO 4271 currency code
#[derive(Clone, Debug, Eq, PartialEq)]
pub enum Currency {
/// UAE Dirham
AED,
/// Afghani
AFN,
/// Lek
ALL,
/// Armenian Dram
AMD,
/// Netherlands Antillean Guilder
ANG,
/// Kwanza
AOA,
/// Argentine Peso
ARS,
... |
//! Main verification functions that can be used to implement a light client.
//!
//!
//! # Examples
//!
//! ```
//! // TODO: add a proper example maybe showing how a `can_trust_bisection`
//! // looks using the types and methods in this crate/module.
//! ```
use std::cmp::Ordering;
use std::time::{Duration, SystemTim... |
use super::input_getter::{get_bool, get_string, get_uint};
use colour::{cyan_ln, dark_cyan_ln, green_ln, prnt_ln, red_ln, yellow, yellow_ln};
use reqwest::{
self,
blocking::Client,
header::{HeaderValue, AUTHORIZATION, LINK, USER_AGENT},
};
use serde_json::{self, Value};
use std::{
collections::HashMap,
... |
use super::file_chooser::*;
use super::file_chooser_model::*;
use super::file_controller::*;
use super::super::file_model::*;
use super::super::file_manager::*;
use super::super::open_file_store::*;
use flo_ui::*;
use flo_canvas::*;
use flo_binding::*;
use std::sync::*;
use std::path::Path;
use std::collections::Hash... |
/*
* Copyright 2021 <NAME>
* https://github.com/mikechambers/dcli
*
* 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... |
// QuiZX - Rust library for quantum circuit rewriting and optimisation
// using the ZX-calculus
// Copyright (C) 2021 - <NAME>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
/... |
//! Structures and functions for the Warren Virtual Machine, what I'm calling an
//! implementation of Warren's Abstract Machine.
#![allow(unused_parens)]
use std::fmt::{Display, Formatter};
use prettytable::{format as TableFormat, Table};
use string_cache::DefaultAtom;
use crate::address::*;
use crate::cell::*;
use... |
#![cfg(not(doctest))]
// unfortunately the proto code includes comments from the google proto files
// that are interpreted as "doc tests" and will fail to build.
// When this PR is merged we should be able to remove this attribute:
// https://github.com/danburkert/prost/pull/291
#![allow(
rustdoc::bare_urls,
r... |
use std::borrow::Cow;
use anyhow::Context;
use async_trait::async_trait;
use futures::{stream::FuturesOrdered, StreamExt};
use redis::AsyncCommands;
use serde::{Deserialize, Serialize};
use sha2::{Digest, Sha256};
use tgbotapi::{requests::*, *};
use super::{
Handler,
Status::{self, *},
};
use crate::{MessageH... |
//! Everything related to writing a PLY file.
//!
//! # Random notes on the format
//!
//! Unfortunately, the PLY format is terribly underspecified (as are most mesh
//! formats). Therefore, here are a few notes on missing information or this
//! particular implementation. You will find more comments on this below.
//!... |
use {
crate::{raw_str_to_os_string, to_u16_vec, Error, ReadSeek, Result},
lazy_static::lazy_static,
log::{error, trace},
std::{
collections::HashMap,
error,
ffi::{OsStr, OsString},
fmt, fs, io, mem,
path::{Path, PathBuf},
ptr, slice,
sync::{Mutex, ... |
use std::io;
use std::ptr::{null_mut, NonNull};
use std::ffi::{CString, c_void};
use std::marker::PhantomData;
use std::ops::{Deref, DerefMut};
use libc::{c_char, c_int, c_short, c_uint, c_uchar, size_t, ssize_t, off_t};
use c2rust_bitfields::BitfieldStruct;
use super::{hts_err, get_cstr, SamReadResult, sam_hdr_t, bam... |
use super::ParsedTextType;
use crate::cli::{similar_help_suggestions, PrintableMessage};
use crate::graphql::schema;
use crate::graphql::schema::field as schema_field;
use crate::graphql::variable;
use graphql_parser::query as parsed_query;
use graphql_parser::Pos;
use std::collections::hash_map::Entry;
use std::collec... |
use crate::{
check_precomputed_parameters, BatchFieldBasedHash, BatchFieldBasedMerkleTreeParameters, Error,
FieldBasedHash, FieldBasedHashParameters, FieldBasedMHTPath, FieldBasedMerkleTree,
FieldBasedMerkleTreePath, MerkleTreeError,
};
use algebra::{serialize::*, Field};
use std::marker::PhantomData;
/// ... |
// TODO: What a dirty code
use crate::exec::decode::BytesToInstructions;
use crate::metadata::{
assembly::*, class::*, header::*, image::*, metadata::*, method::*, signature::*,
};
use rustc_hash::FxHashMap;
use std::{cell::RefCell, rc::Rc};
use std::{
fs::File,
io::{BufReader, Read, Seek, SeekFrom},
i... |
use std::collections::{HashMap, HashSet};
use std::convert::TryFrom;
use std::fs;
use std::io::Write;
use std::path::PathBuf;
use std::str::FromStr;
use ckb_jsonrpc_types as json_types;
use ckb_jsonrpc_types::JsonBytes;
use ckb_sdk::{
constants::{MULTISIG_TYPE_HASH, SECP_SIGNATURE_SIZE},
wallet::KeyStore,
... |
//! A _synchronous_ algorithm for dealerless distributed key generation.
//!
//! This protocol is meant to run in a _completely synchronous_ setting where each node handles all
//! messages in the same order. It can e.g. exchange messages as transactions on top of
//! `HoneyBadger`, or it can run "on-chain", i.e. commi... |
use {
crate::{
code_editor::{self, CodeEditor, SessionId, ViewId},
dock::{self, Dock, PanelId},
file_tree::{self, FileNodeId, FileTree},
id::{IdAllocator, IdMap},
protocol::{self, Notification, Request, Response, ResponseOrNotification},
server::{Connection, Server},
... |
use core::alloc::{GlobalAlloc, Layout};
use core::ptr::null_mut;
use alloc::alloc::handle_alloc_error;
use crate::driver;
use crate::aarch64::bits::clz;
use crate::pager;
use crate::aarch64::lock;
extern "C" {
static mut __el0_heap_start: u64;
static mut __el0_heap_end: u64;
}
struct Allocator;
struct SlabA... |
// Workaround rustfmt bug:
// https://github.com/rust-lang/rustfmt/issues/3794
#[path = "common.rs"]
mod common;
#[path = "shape.rs"]
mod shape;
use std::convert::TryFrom;
use std::path::Path;
use std::rc::Rc;
use allsorts::binary::read::ReadScope;
use allsorts::error::ShapingError;
use allsorts::gsub::{self, Feature... |
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://www.rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-M... |
// TODO: temp
#![allow(dead_code)]
use super::Error;
use crate::FastHashMap;
use crate::{
back::{binary_operation_str, vector_size_str, wgsl::keywords::RESERVED},
proc::{EntryPointIndex, TypeResolution},
valid::{FunctionInfo, ModuleInfo},
Arena, ArraySize, Binding, Constant, Expression, Function, Global... |
use crate::{
control_flow::{
cfg::{CallSite, Edge, EdgeKind, ForwardCFG, Method, Node, NodeKind},
utils,
},
known_names::KnownNames,
};
use either::*;
use log::*;
use rustc_hir::Constness;
use rustc_infer::{
infer::InferCtxt,
traits::{FulfillmentErrorCode, Obligation, ObligationCause... |
use anyhow::{anyhow, Context, Result};
use std::collections::{BTreeMap, BTreeSet};
use crate::asset::{Category, CategoryName, CategoryValue, Money, Tx};
use crate::flow::{Flow, FlowName};
use crate::tax::{AnnualTaxPolicy, TaxAdjustment, TaxSummary};
use crate::time::{Month, TimeRange, Year};
#[derive(Debug)]
pub stru... |
use std::{collections::BTreeMap, str::FromStr};
use crate::ids::{consts, Fid, Lid, Pid, Qid, Sid, WikiId};
use crate::text::{Lang, Text};
use chrono::{DateTime, TimeZone, Utc};
use serde::{Deserialize, Serialize};
use serde_json::Value;
/// A Wikibase entity: this could be an entity, property, or lexeme.
#[derive(Deb... |
use core::fmt::Debug;
use core::ops::{Index, IndexMut};
use zeroize::Zeroize;
use constants;
#[derive(Copy, Clone)]
pub struct Scalar29(pub [u32; 9]);
impl Debug for Scalar29 {
fn fmt(&self, f: &mut ::core::fmt::Formatter) -> ::core::fmt::Result {
write!(f, "Scalar29: {:?}", &self.0[..])
}
}
impl Z... |
// Copyright (c) 2018-2022 The MobileCoin Foundation
#![doc = include_str!("../README.md")]
use cargo_emit::{rerun_if_changed, rustc_env, warning};
use cargo_metadata::{CargoOpt, Error as MetadataError, Metadata, MetadataCommand};
use displaydoc::Display;
use mbedtls::{pk::Pk, rng::RngCallback};
use mbedtls_sys::type... |
//! System call
use alloc::{string::String, sync::Arc, vec::Vec};
use core::{fmt, slice, str};
use bitflags::bitflags;
use rcore_fs::vfs::{FileType, FsError, INode, Metadata};
use rcore_memory::VMError;
use crate::arch::cpu;
use crate::arch::interrupt::TrapFrame;
use crate::arch::syscall::*;
use crate::fs::epoll::Ep... |
// TODO ONCE FINISHED: REPLACE STACK AND STACK POINTER USING VECTORS
// crates
use rand::random;
// screen size will need to be accessed by frontend
pub const SCREEN_WIDTH: usize = 64;
pub const SCREEN_HEIGHT: usize = 32;
// start address - ROM loaded in from 512th byte in RAM
const START_ADDRESS: u16 = 0x200;
// 4 ... |
//! Tracks rumors for distribution.
//!
//! Each rumor is represented by a `RumorKey`, which has a unique key and a "kind", which
//! represents what "kind" of rumor it is (for example, a "member").
//!
//! New rumors need to implement the `From` trait for `RumorKey`, and then can track the arrival of
//! new rumors, a... |
//! Capstone-based translator for 32-bit x86.
use crate::error::*;
use crate::il::*;
use crate::translator::x86::mode::Mode;
use crate::translator::{unhandled_intrinsic, BlockTranslationResult, Options};
use falcon_capstone::{capstone, capstone_sys};
use crate::translator::x86::semantics::Semantics;
fn ensure_block_... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
core_mempool::{CoreMempool, TimelineState, TxnPointer},
counters,
};
use admission_control_proto::{
proto::admission_control::{
submit_transaction_response::Status, AdmissionControlStatusCode, SubmitTra... |
use crate::blocks::{
ActionResult, Block, BlockDirection, BlockFace, BlockPos, BlockProperty, BlockTransform,
FlipDirection,
};
use crate::world::World;
use std::collections::HashMap;
use std::str::FromStr;
impl Block {
fn unwrap_wire(self) -> RedstoneWire {
match self {
Block::Redstone... |
//! Code for definition discovery in the blocks, finding definition by name and related utilities.
use crate::prelude::*;
use crate::double_representation::LineKind;
use ast::crumbs::ChildAst;
use ast::crumbs::Crumbable;
use ast::crumbs::InfixCrumb;
use ast::crumbs::Located;
use ast::known;
use ast::opr;
use parser:... |
// Copyright 2021 Red Hat, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to i... |
//! A platform agnostic Rust driver for the Akafugu TWIDisplay 4-digit 7-segment display controller,
//! based on the [`embedded-hal`](https://github.com/japaric/embedded-hal) traits.
//!
//! This driver allows you to:
//! - Display single digits or characters, also at a selected position
//! - Display text, although ... |
//! This module contains timeline id -> safekeeper state map with file-backed
//! persistence and support for interaction between sending and receiving wal.
use anyhow::{bail, Context, Result};
use etcd_broker::SkTimelineInfo;
use lazy_static::lazy_static;
use postgres_ffi::xlog_utils::XLogSegNo;
use std::cmp::{max,... |
// 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::{account_manager::AccountId, pinweaver::PinweaverParams, scrypt::ScryptParams},
async_trait::async_trait,
fidl_fuchsia_identity_ac... |
//! Track and report errors, exceptions and messages from your Rust application to Rollbar.
pub extern crate backtrace;
extern crate futures;
extern crate hyper;
extern crate hyper_tls;
extern crate serde;
#[macro_use]
extern crate serde_derive;
#[macro_use]
extern crate serde_json;
extern crate tokio;
//use std::io:... |
/*
Module implements Bech32 encoding.
Made to work best with the WitnessProgram struct
*/
use crate::{
util::decode_binary_string,
script::WitnessProgram as WitProg
};
#[derive(Debug)]
pub enum Bech32Err {
BadNetwork,
CannotEncode,
InvalidInt(u8),
InvalidLength(usize),
InvalidData(... |
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)]
pub struct AllocationReportAck {
/// MsgType = AT
#[serde(flatten)]
pub standard_message_header: super::super::standard_message_header::StandardMessageHeader<'A', 'T'>,
/// AllocReportID
#[serde(rename = "755... |
#![allow(dead_code)]
use crate::bytecode::{AppendArrayType, CompOp, NewObjectType, Opcode};
use crate::{bytecode, object, types, Object};
use crate::{Error, Result};
use core::ops::Range;
use num_traits::FromPrimitive;
use std::cell::{Ref, RefCell, RefMut};
use std::collections::HashMap;
use std::fmt::Display;
use std:... |
//! Implementation of pseudocode from chapter 11 of <NAME>'s
//! [Computer Graphics from Scratch](https://gabrielgambetta.com/computer-graphics-from-scratch/)
//! book. I am not affiliated with Gabriel or his book in any way.
//!
//! This code implements clipping.
use std::iter::Iterator;
use std::vec::Vec;
use rust_c... |
//! The virtio_blk module implements a virtio block device.
//!
//! The spec for Virtual I/O Device (VIRTIO) Version 1.1:
//! https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html
//! 5.2 Block Device:
//! https://docs.oasis-open.org/virtio/virtio/v1.1/cs01/virtio-v1.1-cs01.html#x1-2390002
use crate::bus::VI... |
//! Replicated sqlite DBs are represented as protobuf "manifest"
//! metadata that refer to content-addressed chunks by fingerprint.
use std::fs::File;
use std::sync::Arc;
use tracing::instrument;
use umash::Fingerprint;
use uuid::Uuid;
use crate::chain_error;
use crate::drop_result;
use crate::fresh_error;
use crate... |
#![no_std]
pub mod buffer;
pub mod error;
pub mod filter;
pub mod frame;
pub(crate) mod macros;
pub mod regs;
pub mod stat;
use core::fmt::Debug;
use buffer::{RxBuf, RxBufIdent, TxBuf};
use embedded_hal::{
blocking::{can::Can, delay::DelayMs, spi::Transfer},
can::{ExtendedId, Frame, Id, StandardId},
digi... |
/// Block manager manipulates blocks.
/// Block manager loads blocks into buffer from main data store, version store, or checkpoint
/// store.
use crate::common::errors::Error;
use crate::common::defs::BlockId;
use crate::storage::datastore::DataStore;
use crate::storage::datastore::FileDesc;
use crate::storage::data... |
//! Estimation procedures specific to linear method.
/*
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... |
//! Project Euler solutions for problems 91 through 100.
//!
//! This crate is designed to be used via crate `euler`.
use std::collections::HashSet;
use std::collections::HashMap;
use std::fmt;
use std::cmp;
use std::f64::EPSILON;
extern crate itertools;
use itertools::Itertools;
extern crate num;
use num::integer::... |
use rand::{self, Rng};
use rand::distributions::{Weighted, WeightedChoice, Distribution};
use std::path::Path;
use std::io;
use std::io::prelude::*;
use std::io::stdout;
use std::fs;
use std::fs::File;
use std::mem;
use std::error::Error;
use std::sync::Arc;
use std::sync::Mutex;
use std::sync::mpsc::*;
use std::sync... |
/*
* Copyright (c) 2017-2020 Boucher, Antoni <<EMAIL>>
*
* 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, mod... |
//! Ported to Rust from <https://www.shadertoy.com/view/llVXRd>
use shared::*;
use spirv_std::glam::{
const_mat2, const_vec2, const_vec3, vec2, vec3, Mat2, Mat3, Vec2, Vec3, Vec3Swizzles, Vec4,
Vec4Swizzles,
};
// Note: This cfg is incorrect on its surface, it really should be "are we compiling with std", but... |
// Copyright 2018 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.
//! Type-safe bindings for Zircon handles.
//!
use crate::{
object_get_info, object_get_property, object_set_property, ok, ObjectQuery, Port, Property,... |
//! Implementation of DMA-based SPI master and slave communication for the
//! SAM4L.
//!
//! Driver for the SPI hardware (separate from the USARTS), described in chapter
//! 26 of the datasheet.
//!
//! - Authors: <NAME> <<EMAIL>>, <NAME> <<EMAIL>>
use core::cell::Cell;
use core::cmp;
use core::mem;
use dma::DMAChan... |
use std::collections::{BTreeSet, HashMap, HashSet};
use maplit::hashset;
use abstutil::{prettyprint_usize, Counter, MultiMap, Timer};
use geom::{Distance, PolyLine, Polygon, Time};
use map_gui::tools::ColorLegend;
use map_model::{osm, BuildingID, BuildingType, IntersectionID, LaneID, Map, RoadID, TurnType};
use sim::... |
use dioxus_core::*;
use std::fmt::Arguments;
macro_rules! no_namespace_trait_methods {
(
$(
$(#[$attr:meta])*
$name:ident;
)*
) => {
$(
$(#[$attr])*
fn $name<'a>(&self, cx: NodeFactory<'a>, val: Arguments) -> Attribute<'a> {
... |
use std::collections::HashMap;
use std::cell::RefCell;
use std::rc::Rc;
use crate::context::{Context, ContextInternal, InputModifiers};
use crate::{
AnimState, AnimStateKey, Rect, Point, WidgetBuilder, PersistentState, Align,
};
use crate::image::ImageHandle;
use crate::widget::Widget;
const MOUSE_NOT_... |
extern crate sdl2;
use crate::consts::*;
use crate::ram;
use anyhow::Result;
use sdl2::audio::{AudioQueue, AudioSpecDesired};
use std::convert::TryFrom;
extern crate packed_struct;
use packed_struct::prelude::*;
const WAVE_LEN: u8 = 32;
const HZ: u16 = 48000;
const DUTY: [[u8; 8]; 4] = [
[0, 0, 0, 0, 0, 0, 0, 1],... |
use std::collections::BTreeMap;
use anyhow::Result;
use abstutil::wraparound_get;
use geom::{Circle, Distance, InfiniteLine, Line, PolyLine, Polygon, Pt2D, Ring, EPSILON_DIST};
use super::Results;
use crate::{osm, InputRoad, OriginalRoad};
const DEGENERATE_INTERSECTION_HALF_LENGTH: Distance = Distance::const_meters... |
#![allow(clippy::type_complexity)]
#![allow(clippy::cognitive_complexity)]
use super::methods::{ErrorMessage, RPCCodedResponse, RequestId, ResponseTermination};
use super::protocol::{Protocol, RPCError, RPCProtocol, RPCRequest};
use super::RPCEvent;
use crate::rpc::protocol::{InboundFramed, OutboundFramed};
use core::... |
/*
* Copyright 2018-2020 TON DEV SOLUTIONS LTD.
*
* Licensed under the SOFTWARE EVALUATION License (the "License"); you may not use
* this file except in compliance with the License.
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASI... |
use crate::{cmd::*, result};
use std::process;
use ferrous_serialport as serialport;
use serialport::{SerialPort, SerialPortType};
use std::time::{Duration, Instant};
use std::{thread, time};
use std::convert::TryInto;
use std::io::prelude::*;
use std::{fs, io, path::PathBuf};
use serde_json::Value;
use snailquote::... |
//! Convenience macros for the [actix-web](https://github.com/wafflespeanut/paperclip/tree/master/plugins/actix-web)
//! OpenAPI plugin (exposed by paperclip with `actix` feature).
use heck::*;
use http::StatusCode;
use lazy_static::lazy_static;
use proc_macro::TokenStream;
use quote::quote;
use std::collections::Hash... |
////////////////////////////////////////////////////////////////////////////////////////////////
// Based on C++ demo & tutorial by <NAME> and released under equivalent terms. //
// https://bitbucket.org/jose_henriques/vulkan_tutorial/src //
// http://av.dfk... |
use std::collections::HashMap;
use std::io;
use std::io::Write;
use std::path::Path;
use std::sync::Arc;
use chrono::offset::Utc;
use hyper;
use hyper::method::Method;
use hyper::net::HttpsConnector;
use hyper::net::Openssl;
use hyper::status::StatusCode;
use hyper::Url;
use openssl::crypto::hash::Type as HashType;
us... |
use std::fmt;
use std::str::FromStr;
use thiserror::Error;
/// Errors when parsing a callsign-SSID into an `Address`
#[derive(Debug, Error)]
pub enum AddressParseError {
#[error("Address must be a callsign, '-', and a numeric SSID. Example: VK7NTK-0")]
InvalidFormat,
#[error("Could not parse SSID: {}", sou... |
use std::collections::HashMap;
use std::io::BufRead;
use std::str;
use std::str::FromStr;
use std::path::{Path, PathBuf};
use crate::common::utils::get_inode;
use crate::common::defs::Section;
use utils::compress;
struct InFile {
name: String,
inode: u64,
line: usize, // Line in file (zero offset)
pos: usize, //... |
use std::io::Write;
use std::str;
use super::font::{get_font, Font};
use super::models::{Cell, Image, Paragraph, Path, Row, Spacer, Stationary, Table};
use super::objects::{LinkAnnotation, PDFDocument, PDFImage, PDFPage};
use super::styles::{Color, HorizontalAlign, VerticalAlign};
use super::template::PageTemplate;
us... |
// 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 net_declare::{fidl_ip, fidl_mac, fidl_subnet};
struct IpLayerConfig {
alice_subnet: fidl_fuchsia_net::Subnet,
bob_ip: fidl_fuchsia_net::IpAddr... |
macro_rules! args {
($($key:expr => $value:expr),*) => {{
[$(($key, $value),)*].into_iter().map(|(k, v): &(&str, &str)| (*k, *v))
}};
}
#[cfg(feature = "nameattr")]
mod attrs;
pub mod color;
pub mod merge;
mod rand;
mod svg;
use std::fs::File;
use std::io::prelude::*;
use std::io::{self, BufReader};
... |
//! # An ɴsɪ Context.
// Needed for the example dode to build.
extern crate self as nsi;
use crate::{argument::*, *};
// std::slice is imported so the (doc) examples compile w/o hiccups.
#[allow(unused_imports)]
use std::{
ffi::{CStr, CString},
marker::PhantomData,
ops::Drop,
os::raw::{c_int, c_void},
... |
//! Insert Poly types and Box/Unbox expressions to represent polymorphism (generics).
/*
The SMT solver does not support polymorphic types directly,
so polymorphism must be encoded by coercing expressions to and from a universal
Poly type via Box and Unbox coercions.
The predicate has_type describes which underlying t... |
extern crate bincode;
extern crate blake2_rfc;
extern crate bn;
extern crate byteorder;
extern crate crossbeam;
extern crate ethabi;
extern crate ethereum_types;
extern crate hex;
extern crate ipfs_api;
extern crate json;
extern crate rand;
extern crate rustc_serialize;
extern crate serde_json;
extern crate sha3;
exter... |
use crate::horust::error::{ValidationError, ValidationErrors};
use anyhow::{Context, Error, Result};
use nix::sys::signal::{
Signal, SIGABRT, SIGALRM, SIGBUS, SIGCHLD, SIGCONT, SIGFPE, SIGHUP, SIGILL, SIGINT, SIGIO,
SIGPIPE, SIGPROF, SIGPWR, SIGQUIT, SIGSEGV, SIGSTKFLT, SIGSTOP, SIGSYS, SIGTERM, SIGTRAP,
SI... |
// Copyright Materialize, Inc. All rights reserved.
//
// Use of this software is governed by the Business Source License
// included in the LICENSE file.
//
// As of the Change Date specified in that file, in accordance with
// the Business Source License, use of this software will be governed
// by the Apache License... |
//! Contains all structures and methods to create and manage 3D transforms.
//!
//! `Transform` allows you to combine spatial properties into a single matrix in
//! an easy manner. It contains many methods that can be used to modify a single
//! property of a transform which then will be "baked" into the single matrix.... |
/*
This tool is part of the WhiteboxTools geospatial analysis library.
Authors: Dr. <NAME>
Created: 28/06/2017
Last Modified: 05/12/2019
License: MIT
NOTE: This tool was originally named FillDepressions. However, I have updated the algorithm used by the
FillDepressions tool to something that is often more efficient th... |
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::{
chunk_request::GetChunkRequest,
counters,
error::Error,
logging::{LogEntry, LogEvent, LogSchema},
network::{StateSyncMessage, StateSyncSender},
};
use diem_config::{
config::{PeerNetworkId, UpstreamC... |
use chrono::DateTime;
use snafu::{ResultExt, Snafu};
use sqlparser::{
ast::{BinaryOperator, Expr as SqlParserExpr, Ident, Statement, Value},
dialect::GenericDialect,
parser::Parser,
};
use data_types::{
delete_predicate::{DeleteExpr, DeletePredicate},
timestamp::TimestampRange,
};
use datafusion::l... |
//!
//! Manages header synchronization with peers.
//!
use nakamoto_common::bitcoin::consensus::params::Params;
use nakamoto_common::bitcoin::network::constants::ServiceFlags;
use nakamoto_common::bitcoin::network::message_blockdata::Inventory;
use nakamoto_common::block::store;
use nakamoto_common::block::time::{Cloc... |
extern crate lru_time_cache;
extern crate pnet;
extern crate pnet_macros_support;
use crate::passthrough;
use self::passthrough::backend::{Backend, Node};
use self::passthrough::utils::find_interface;
use self::passthrough::utils::{EPHEMERAL_PORT_LOWER, EPHEMERAL_PORT_UPPER, IPV4_HEADER_LEN};
use crate::config::Config... |
// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements. See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership. The ASF licenses this file
// to you under the Apache License, Version 2.0 (the
// "License"); you may... |
// Copyright 2012-2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MI... |
// wengwengweng
use std::rc::Rc;
use std::collections::HashMap;
use std::collections::HashSet;
use glutin::dpi::*;
use glutin::event_loop::EventLoop;
use crate::*;
use math::*;
use input::*;
use window::*;
/// The Window Context
pub struct Window {
gl: Rc<glow::Context>,
event_loop: Option<EventLoop<()>>,
window... |
use bitvec::prelude::*;
use log::{debug, error, trace, warn};
use serde::{Deserialize, Serialize};
use crate::{
consts::{
DOTS_PER_LINE, INT_LCD_STAT, INT_VBLANK, LINES_PER_FRAME, SCREEN_WIDTH, VISIBLE_RANGE,
},
context,
interface::{Color, FrameBuffer},
util::{pack, trait_alias},
};
trait_... |
/* Copyright 2018-2019 Mozilla Foundation
*
* Licensed under the Apache License (Version 2.0), or the MIT license,
* (the "Licenses") at your option. You may not use this file except in
* compliance with one of the Licenses. You may obtain copies of the
* Licenses at:
*
* http://www.apache.org/licenses/LICENS... |
// 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::log_if_err;
use crate::message::Message;
use crate::node::Node;
use crate::shutdown_request::{RebootReason, ShutdownRequest};
use crate::tempera... |
//! The `banking_stage` processes Transaction messages. It is intended to be used
//! to contruct a software pipeline. The stage uses all available CPU cores and
//! can do its processing in parallel with signature verification on the GPU.
use crate::blocktree::Blocktree;
use crate::cluster_info::ClusterInfo;
use crate... |
//! A peer set whose size is dynamically determined by resource constraints.
// Portions of this submodule were adapted from tower-balance,
// which is (c) 2019 Tower Contributors (MIT licensed).
use std::{collections::HashSet, net::SocketAddr, sync::Arc};
use futures::{
future::{self, FutureExt},
sink::Sink... |
use ipg_core::game::{map::Map, Galaxy, Game, Move, Planet};
use std::rc::Rc;
use std::{f64::consts::PI, marker::PhantomData};
use wasm_bindgen::{JsCast, JsValue};
// use wasm_bindgen::prelude::*;
use web_sys::{
CanvasRenderingContext2d, HtmlCanvasElement, WebGl2RenderingContext, WebGlProgram, WebGlShader,
WebGl... |
/* rusty-ircd - an IRC daemon written in Rust
* Copyright (C) 2020 <NAME> <<EMAIL>>
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your op... |
//! Types related to qualifiers.
//!
//! A qualifier is essentially a signature and a term. The idea is that, given
//! some sample (input values) for a predicate, we want to to find all the
//! combinations of values that make sense for this qualifier.
//!
//! We also want to avoid storing the same qualifier more than... |
use std::convert::TryFrom;
use crate::emulator::*;
use crate::emulator::access::register::*;
use crate::emulator::instruction::opcode::*;
pub struct Opcode16 (pub super::OpcodeArr);
impl Opcode16 {
pub fn new(op: super::OpcodeArr) -> Self {
Self (op)
}
}
impl super::OpcodeTrait for Opcode16 {
fn i... |
use std::convert::TryInto;
use std::sync::Arc;
use std::{any::TypeId, arch::x86_64::*};
use num_complex::Complex;
use num_integer::{div_ceil, Integer};
use num_traits::Zero;
use primal_check::miller_rabin;
use strength_reduce::StrengthReducedUsize;
use crate::common::{fft_error_inplace, fft_error_outofplace};
use cra... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.