text stringlengths 3.09k 13.9k |
|---|
use crate::{HalfPlane, Line2d, LineSegment2d, SimplePolygon2d, Triangle, Triangle2d};
use itertools::Itertools;
use nalgebra::{Point2, RealField, Scalar, Unit, Vector2};
/// Type used to indicate conversion failure in the presence of concavity.
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
pub struct ConcavePolygonErro... |
#![deny(missing_docs, warnings)]
#![cfg_attr(test, feature(test))]
//! A mutex which can only be locked once, but which provides
//! very fast concurrent reads after the first lock is over.
//!
//! ## Example
//!
//! ```
//! # use oncemutex::OnceMutex;
//!
//! let mutex = OnceMutex::new(8);
//!
//! // One-time lock
//... |
use teki_common::game::RGBA;
use teki_common::traits::{App, Audio, Renderer, Timer};
use teki_common::utils::{
consts::*,
pad::{Key, Pad},
FpsCalc,
};
use crate::app::character_select::CharacterSelect;
use crate::app::game::Game;
use crate::app::menu_title::Title;
enum AppState {
Title(Title),
Cha... |
use log::{info, warn};
use serde::Deserialize;
use std::collections::{HashMap, HashSet};
use std::io::Write;
use std::path::{Path, PathBuf};
const TOOLCHAIN_PREFIX: &str = "Microsoft.VC.";
const CATALOG_NAME: &str = "VisualStudio.vsman";
const MANIFEST_ID: &str = "Microsoft.VisualStudio.Manifests.VisualStudio";
const ... |
use glutin::dpi::{LogicalPosition, LogicalSize};
use serde::{Deserialize, Serialize};
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash, Serialize)]
pub struct KWindowId(pub i64);
#[derive(Clone, Debug, Copy, PartialEq, Eq, Hash, Serialize)]
pub struct KWDeviceId(pub i64);
#[derive(Debug, PartialEq, Serialize)]
#[ser... |
use crate::compiler::InterpreterCompiler;
use cranelift::prelude::*;
pub struct AddStub;
impl AddStub {
pub fn generate(
ic: &mut InterpreterCompiler<'_>,
frame: Value,
left: Value,
right: Value,
) -> Value {
let left_not_int = ic.create_block();
let right_not_... |
use super::*;
use octocrab::models::{issues, ProjectCard, User};
use reqwest::Url;
use serde::*;
type DateTime = chrono::DateTime<chrono::Utc>;
// milestoned event should include only title
// See: https://docs.github.com/en/developers/webhooks-and-events/events/issue-event-types#milestoned
#[derive(Debug, Clone, Has... |
/// Software-only NIST K256
pub mod k256;
/// Software-only NIST P256
pub mod p256;
/// Software-only Curve25519
pub mod x25519;
use core::{
fmt::{Display, Error as FmtError, Formatter},
str::FromStr,
};
use disco_rs::{
error::{Error, ParamError},
key::{TaggedData, KeyType, KeyGenerator, KeyAgreement},... |
use std::{
error::Error,
fmt::{Display, Error as FormatError, Formatter},
};
/// Error respresenting the reasons why a certificate request failed.
#[derive(Debug)]
pub(crate) enum CertificateRequestError {
/// Authorization unexpectedly failed for the specified domain.
AuthorizationFailed(String),
... |
mod error;
#[cfg(feature = "sql-ext")]
pub mod sql_ext;
use chrono::prelude::*;
use rust_decimal::{prelude::ToPrimitive, Decimal};
use serde::{ser::Serializer, Deserialize, Serialize};
use std::{convert::TryFrom, fmt, str::FromStr};
use uuid::Uuid;
pub use error::ConversionFailure;
pub type PrismaValueResult<T> = std... |
//! The tick module is based on the reference implementation at:
//! https://github.com/rustwasm/wasm-bindgen/blob/master/examples/request-animation-frame/src/lib.rs
//! It's deprecated due to the simpler version in raf.rs
use crate::errors::Error;
use crate::global::{get_global_self, GlobalSelf, GlobalSelfPreference}... |
use self::block_producer_service::{BeaconBlockGrpcClient, BlockProducerService};
use self::duties::{DutiesManager, DutiesManagerService, EpochDutiesMap};
use crate::config::ClientConfig;
use block_proposer::{test_utils::LocalSigner, BlockProducer};
use bls::Keypair;
use clap::{App, Arg};
use grpcio::{ChannelBuilder, En... |
use core::mem::{self, MaybeUninit};
use cfg_if::cfg_if;
use static_assertions::{const_assert, const_assert_eq};
use typenum::{UInt, UTerm, Unsigned, B0, B1, U0, U1, U16, U2, U32, U4, U64, U8};
// Static assertions
const_assert_eq!(DefaultSize::USIZE, mem::size_of::<usize>());
const_assert!(mem::align_of::<RawStorage... |
#![recursion_limit = "256"]
extern crate failure;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate quote;
#[macro_use]
extern crate serde_derive;
extern crate digest;
extern crate fs2;
extern crate generic_array;
extern crate proc_macro2;
extern crate regex;
extern crate serde;
extern crate serde_json;... |
use std::path::{PathBuf};
use std::sync::Arc;
use std::env::current_exe;
use futures::{Future, Async};
use futures::future::{ok, FutureResult, Either, loop_fn, Loop};
use futures_cpupool::{CpuPool, CpuFuture};
use tokio_io::AsyncWrite;
use tk_http::server;
use tk_http::Status;
use http_file_headers::{Input, Output, Co... |
use actix_web::{get, web, HttpResponse, Responder};
use indexa::{
camino::Utf8PathBuf,
database::{Database, StatusKind},
enum_map::EnumMap,
mode::Mode,
query::{CaseSensitivity, MatchPathMode, QueryBuilder, SortOrder},
};
use serde::{de::IntoDeserializer, Deserialize, Serialize};
use std::time::Syste... |
// Copyright 2019-2021 Tauri Programme within The Commons Conservancy
// SPDX-License-Identifier: Apache-2.0
// SPDX-License-Identifier: MIT
use super::{
app_paths::tauri_dir,
config::{ConfigHandle, PatternKind},
};
use anyhow::Context;
use toml_edit::{Array, Document, InlineTable, Item, Table, Value};
use std::... |
use std::ptr::NonNull;
use crate::aliases::{ErrResult, WinResult};
use crate::co;
use crate::enums::{AtomStr, IdMenu};
use crate::gui::base::Base;
use crate::gui::events::{ProcessResult, WindowEvents};
use crate::gui::privs::post_quit_error;
use crate::gui::traits::Window;
use crate::gui::very_unsafe_cell::Ve... |
use super::column;
use crate::{flavour::SqlFlavour, pair::Pair};
use sql_schema_describer::{walkers::ColumnWalker, ColumnId, SqlSchema, TableId};
use std::{
borrow::Cow,
collections::{BTreeMap, HashMap},
ops::Bound,
};
pub(crate) struct DifferDatabase<'a> {
pub(super) flavour: &'a dyn SqlFlavour,
/... |
use std::{net::SocketAddr, path::PathBuf, sync::Arc};
use bytes::{Bytes, BytesMut};
use futures::StreamExt;
use http::{Request, StatusCode};
use rustls::{Certificate, PrivateKey};
use structopt::StructOpt;
use tokio::{fs::File, io::AsyncReadExt};
use tracing::{debug, error, info, trace_span, warn};
use h3::{quic::Bid... |
use crate::riichi::fast_hand_calculator::resources::RESOURCES;
pub struct SuitClassifier {
meld_count: u8,
entry: u32,
}
impl SuitClassifier {
pub fn new() -> SuitClassifier {
SuitClassifier {
..Default::default()
}
}
pub fn set_melds(&mut self, mut melds: u32) {
... |
#[doc = r"Register block"]
#[repr(C)]
pub struct RegisterBlock {
_reserved0: [u8; 0x10],
#[doc = "0x10 - Code memory page size in bytes."]
pub codepagesize: crate::Reg<codepagesize::CODEPAGESIZE_SPEC>,
#[doc = "0x14 - Code memory size in pages."]
pub codesize: crate::Reg<codesize::CODESIZE_SPEC>,
... |
use std::error::Error;
use std::io::{self, Read};
use std::num::ParseIntError;
use std::cmp::Ordering;
use std::collections::{VecDeque};
type Word = i64;
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
enum VMState {
Ready,
Halted,
Waiting
}
#[derive(Debug)]
struct VM {
pc: usize,
rb: Word,
... |
use super::cargo_cmds::{cargo_fmt, cargo_fmt_file, cargo_run, MAIN_FILE};
use super::highlight::highlight;
use crate::irust::format::format_eval_output;
use crate::irust::printer::{Printer, PrinterItem, PrinterItemType};
use crate::irust::{IRust, IRustError};
use crate::utils::{remove_main, stdout_and_stderr};
const S... |
#![feature(proc_macro_hygiene)]
use std::cmp::{max,min};
use wasm_bindgen::prelude::*;
use web_sys::console;
use jsmx::{JSMX_EXCHANGE};
use serde_json::{Value,Number,json};
use rustwebact::rwa_time::{set_interval_forget};
use rustwebact::rwa_html::*;
use rdxl::xhtml;
#[wasm_bindgen(start)]
pub fn main_js() -> Result<(... |
use dbus::{blocking::Connection};
use std::time::Duration;
use regex::{Regex};
use clap::{Arg, App, AppSettings};
use confy;
use serde_derive::{Serialize, Deserialize};
use dbus::blocking::stdintf::org_freedesktop_dbus::Properties;
#[derive(Serialize, Deserialize, Clone)]
struct PlayerPriority {
player_name: Strin... |
use crate::physics::{
ColliderHandleComponent, EventQueue, JointBuilderComponent, JointHandleComponent,
PhysicsInterpolationComponent, RapierConfiguration, RigidBodyHandleComponent,
SimulationToRenderTime,
};
use crate::rapier::pipeline::QueryPipeline;
use bevy::ecs::Mut;
use bevy::prelude::*;
use rapier::... |
use apu::ApuState;
use cartridge;
use cycle_cpu;
use cycle_cpu::CpuState;
use cycle_cpu::Registers;
use memory;
use memory::CpuMemory;
use ppu::PpuState;
use mmc::mapper::Mapper;
use tracked_events::EventTracker;
pub struct NesState {
pub apu: ApuState,
pub cpu: CpuState,
pub memory: CpuMemory,
pub ppu... |
// Copyright (c) 2022 Espresso Systems (espressosys.com)
// This file is part of the Jellyfish library.
// You should have received a copy of the MIT License
// along with the Jellyfish library. If not, see <https://mit-license.org/>.
//! This module is a defines rescue transcript.
use super::PlonkTranscript;
use cra... |
use {
daumdic, daummap,
failure::{Error, Fail},
futures::prelude::*,
howto,
lazy_static::lazy_static,
regex::Regex,
serde_derive::{Deserialize, Serialize},
std::{fmt, str::FromStr},
};
#[derive(Debug, Clone, Deserialize, Serialize)]
pub struct Config {
pub daummap_app_key: String,
}... |
use mio::event::Event;
use mio::net::{TcpListener, TcpStream};
use mio::{Events, Interest, Poll, Token};
use std::collections::HashMap;
use std::io::{self, Read, Write};
// Setup some tokens to allow us to identify which event is for which socket.
// In the events returned by polling the OS, each event contains a toke... |
use crate::component::render_component::Texture;
use fabled_render::texture::{
KTXDescriptor, KtxTextureLoader, KtxTranscodeFlag, KtxTranscodeFormat,
};
// todo clean solution.
pub fn load<P: AsRef<std::path::Path>>(
device: &wgpu::Device,
queue: &wgpu::Queue,
path: P,
) -> anyhow::Result<Texture> {
... |
use sqlparser::dialect::Dialect;
use sqlparser::parser::Parser;
use sqlparser::tokenizer::{Token, Tokenizer, TokenizerError};
#[derive(Debug, Default)]
pub struct StreamingDialect;
impl Dialect for StreamingDialect {
fn is_delimited_identifier_start(&self, ch: char) -> bool {
let b = ch == '"';
pr... |
use std::{
net::Ipv4Addr,
time::Duration,
};
use phf::phf_map;
use crate::{
DeviceInfo,
Device,
constants,
network::{
DiscoveryResponse,
RemoteDataCommand,
RemoteDataMessage,
util::{
reverse_mac,
}
},
};
/// A mapping of remote device ... |
//! A module that handles window update and key press/release events
use std::collections::VecDeque;
use piston::input::{Button, UpdateArgs};
use crate::{chart::Chart, config::Config, judgement::Judgement};
/// Holds game states needed by the logic and renderer. Also does timing judgements.
pub struct Model {
p... |
use crate::utils;
#[derive(Debug, Clone, PartialEq)]
pub struct Idblock {
file_id: [u8; 8],
format_id: [u8; 8],
program_id: [u8; 8],
default_byte_order: u16,
default_float_format: u16,
version_number: u16,
code_page_number: u16,
reserved1: [u8; 2],
reserved2: [u8; 30],
}
impl Idblo... |
use std::{thread, time};
pub use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt};
use std::io::{Cursor, Seek, SeekFrom};
use std::collections::HashMap;
pub use spacepacket::SpacePacket;
extern crate sys_info;
use serde_json;
use Config;
pub enum HkCmds {
ShutdownCommand,
SleepCommand{interval: u16},
... |
/* Debug allocators for the Expat test suite
__ __ _
___\ \/ /_ __ __ _| |_
/ _ \\ /| '_ \ / _` | __|
| __// \| |_) | (_| | |_
\___/_/\_\ .__/ \__,_|\__|
... |
/* tag::catalog[]
Title:: Basic system health test
Goal:: Start an IC with 2 subnets, 4 nodes per subnet. Install canisters and
make update and query calls that require cross-subnet communication to
succeed. While this is happening, ensure the IC finalizes rounds correctly
across all nodes in each subnet. No real load... |
use std::fs;
struct Packet {
version: u32,
typ: u8,
data: PacketData,
}
enum PacketData {
Literal(u64),
SubPackets(Vec<Packet>),
}
impl Packet {
fn from_hexdecimal(hd: &str) -> Self {
let mut binary = String::new();
for i in 0..hd.trim().len() {
binary.push_str(&format!("{:04b}", u8::from_s... |
use crate::none_of;
use rand::prelude::*;
use std::cell::Cell;
// helper function to double a value
fn twice(val: usize) -> usize {
2 * val
}
#[test]
fn none_of_comparisons_give_correct_result_for_operator_equal() {
// test simple expressions
assert_eq!(none_of!({ 4 } == 2), true);
assert_eq!(none_of!... |
use std::io as std_io;
use std::net::{IpAddr, Ipv4Addr, Ipv6Addr};
use std::fmt::Debug;
use std::collections::HashMap;
use native_tls::{
self,
TlsConnectorBuilder,
TlsConnector as NativeTlsConnector
};
use hostname::get_hostname;
use ::ascii::IgnoreAsciiCaseStr;
use ::data_types::{Domain, AddressLiteral,... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
#![forbid(unsafe_code)]
//use crate::errors::*;
use crate::{account_address::AccountAddress, byte_array::ByteArray};
use failure::prelude::*;
use serde::{Deserialize, Serialize};
use std::{convert::TryFrom, fmt};
#[derive(Clone, Hash... |
use std::sync::Arc;
use std::time::Duration;
use abstract_ns::HostResolve;
use async_slot as slot;
use futures::Stream;
use futures::future::{Future};
use futures_cpupool;
use ns_router::{self, SubscribeExt};
use ns_router::future::AddrStream;
use ns_std_threaded;
use self_meter_http::Meter;
use tk_http::server::Proto... |
mod cse;
mod dce;
pub mod dot;
mod folding;
mod graph;
mod inline;
mod logging;
mod loops;
pub mod node;
pub mod tests;
pub use graph::{
Edge, ProgramArranged, ProgramGraph, ProgramInputs, ProgramTrace, ProgramVariable,
};
use crate::{equisat, vsdg::logging::GraphSender};
use abomonation_derive::Abomonation;
use ... |
// Copyright 2022 The Engula Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to... |
// Copyright (c) The Libra Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::SynchronizerState;
use anyhow::{bail, Result};
use executor::ExecutedTrees;
use libra_crypto::hash::CryptoHash;
use libra_crypto::HashValue;
use libra_types::block_info::BlockInfo;
use libra_types::crypto_proxies::ValidatorS... |
use bincode;
use bincode::Options;
use serde::{Deserialize, Serialize};
use std::os::unix::net::UnixStream;
use crate::VppApiTransport;
use std::collections::HashMap;
use crate::get_encoder;
use std::collections::VecDeque;
use std::sync::{Arc, Mutex};
mod big_array;
use big_array::BigArray;
#[derive(Debug, Default)... |
//! This module literals in a GDL description such that all variables in a negative literal (i.e. a
//! `distinct` or `not` literal) have been seen in positive literals occurring before that
//! `negative` literal. The resulting GDL should be semantically equivalent. To see why this is
//! necessary, see section 13.6 [... |
//! A runtime for writing reliable, asynchronous, and slim applications.
//!
//! Tokio is an event-driven, non-blocking I/O platform for writing asynchronous
//! applications with the Rust programming language. At a high level, it
//! provides a few major components:
//!
//! * A multi threaded, work-stealing based task... |
//! Envy store provides a means to resolve a collection of [AWS Parameter Store](https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-paramstore.html)
//! values at runtime required for an application to run and deserialize them into a type safe struct.
//!
//! The idea here is that applications... |
//! The `poh_service` module implements a service that records the passing of
//! "ticks", a measure of time in the PoH stream
use crate::fullnode::TpuRotationSender;
use crate::poh_recorder::PohRecorder;
use crate::result::Result;
use crate::service::Service;
use crate::tpu::TpuReturnType;
use std::sync::atomic::{Ato... |
use std::{
fs::{self, File},
path::Path,
};
use std::{io, path::PathBuf};
use self::{
file_system_item::FileSystemItem,
functions::{create_link, map_dir_entry_to_file_system_item},
};
use super::config::icon_cfg::IconsConfig;
pub mod dir_item;
pub mod file_item;
pub mod file_system_item;
pub mod func... |
// Copyright 2018-2020 argmin developers
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://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... |
use std::{
io::Write,
process::{Command, Stdio},
task::Poll,
};
use crossterm::{
handle_command,
style::{Print, SetForegroundColor},
Result,
};
use crate::{
async_process::{AsyncChild, ChildOutput, Executor},
tui_util::{AvailableSize, LOG_COLORS},
};
pub type ActionResult = ChildOutpu... |
use crate::dhcp::*;
use crate::dhcp_options::*;
use nom::bytes::complete::take;
use nom::error::ErrorKind;
use nom::multi::many0;
use nom::number::complete::{be_u16, be_u32, be_u8};
use nom::{do_parse, take, IResult};
use std::net::Ipv4Addr;
macro_rules! nom_err_return (
($i:expr, $cond:expr, $err:expr) => (
... |
#![warn(clippy::all, clippy::pedantic, clippy::cargo, clippy::nursery)]
mod server;
pub mod prelude {
pub use anyhow::{Context as _, Result as AnyResult};
pub use async_trait::async_trait;
pub use futures::prelude::*;
pub use itertools::Itertools as _;
pub use rand::prelude::*;
pub use rayon::... |
// Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
use std::os::unix::io::AsRawFd;
use logger::{Metric, METRICS};
use polly::event_manager::{EventManager, Subscriber};
use utils::epoll::{EpollEvent, EventSet};
use crate::virtio::net::device::Net;
use cra... |
//! Conditionally dispatch requests to the inner service based on the result of
//! a predicate.
extern crate futures;
extern crate tower;
use futures::{Future, IntoFuture, Poll, Async};
use futures::task::AtomicTask;
use tower::Service;
use std::{fmt, mem};
use std::sync::Arc;
use std::sync::atomic::AtomicUsize;
us... |
use core::fmt;
use lib_gbemulation::io::joypad::Key;
use serde::de::{MapAccess, Visitor};
use serde::ser::SerializeMap;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
use std::collections::HashMap;
use winit::event::VirtualKeyCode;
#[derive(Serialize, Deserialize, Debug)]
pub enum Type {
Keyboard,
... |
// 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... |
use std::{collections::HashSet, ptr::null_mut};
use num_traits::FromPrimitive;
use winapi::{
ctypes::c_void,
shared::{minwindef::HIWORD, ntdef::HANDLE},
um::{
consoleapi::{GetNumberOfConsoleInputEvents, ReadConsoleInputW, SetConsoleMode},
fileapi::WriteFile,
processenv::GetStdHandle... |
// Copyright 2020-2021 the Deno authors. All rights reserved. MIT license.
use anyhow::bail;
use anyhow::Error as AnyError;
use clap::App;
use clap::AppSettings;
use clap::Arg;
use clap::SubCommand;
use deno_ast::MediaType;
use deno_ast::SourceTextInfo;
use deno_lint::diagnostic::LintDiagnostic;
use deno_lint::linter::... |
extern crate cc;
extern crate pkg_config;
use pkg_config::probe_library;
use std::env::var;
use std::fs::read_dir;
use std::process::Command;
fn link(name: &str, bundled: bool) {
let target = var("TARGET").unwrap();
let target: Vec<_> = target.split('-').collect();
if target.get(2) == Some(&"windows") {
... |
use anyhow::Result;
use std::collections::HashMap;
use std::io::BufRead;
const DATA_FILE: &str = "5.txt";
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
pub struct Point {
x: u32,
y: u32,
}
impl std::convert::From<(u32, u32)> for Point {
fn from(text: (u32, u32)) -> Self {
Self {
... |
use slab::{Iter, IterMut, Slab};
use na::Real;
use crate::world::ColliderWorld;
use crate::object::{Body, Ground};
/// A world-specific body handle.
///
/// This structure is automatically allocated by the physics world.
/// It cannot be constructed by the end-user.
#[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)]
... |
// 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.
//! This module contains the `FsInspect` trait which filesystems can implement in order to expose
//! Inspect metrics in a standardized hierarchy. Once `Fs... |
use std::{collections::HashSet, sync::Arc};
use ash::vk;
use super::{
command::VkCommandBuffer, physical_device::VkPhysicalDevice, queue_family::VkQueueFamily,
surface::VkSurface, utils, VkBuffer, VkCommandPool, VkFence,
};
pub struct VkDevice {
pub physical_device: Arc<VkPhysicalDevice>,
pub handle:... |
use crate::dataflow::{
operators::{IterateExt, JoinArranged},
send_recv::ChannelAddrs,
Channel, FilterMap, Multiply,
};
use ddshow_types::{
timely_logging::ChannelsEvent, ChannelId, OperatorAddr, OperatorId, PortId, WorkerId,
};
use differential_dataflow::{
difference::Abelian,
lattice::Lattice,... |
use std::{cmp::Reverse, collections::{HashMap, HashSet}};
use screeps::{HasId, HasPosition, ObjectId, Position, Room, RoomVisual, Structure, StructureExtension, StructureSpawn, find};
use serde::{Deserialize, Serialize};
use std::hash::{Hash, Hasher};
use super::room_ext::RoomExt;
#[derive(Clone, Debug, Serialize, D... |
pub use blake2_rfc::blake2b::Blake2bResult;
use blake2_rfc::blake2b::Blake2b;
use byteorder::{BigEndian, WriteBytesExt};
// use ed25519_dalek::PublicKey;
use merkle_tree_stream::Node as NodeTrait;
use std::convert::AsRef;
use std::mem;
use std::ops::{Deref, DerefMut};
use storage::Node;
// https://en.wikipedia.org/wi... |
use super::percentage::Percentage;
use super::point2d::Point2D;
use super::Progress;
use dim::si::Meter;
use dim::Dimensioned;
type Fdef = f64;
type Distance = Meter<Fdef>;
trait Lerp {
fn lerp(a: Self, b: Self, t: Fdef) -> Self;
}
impl Lerp for Fdef {
fn lerp(a: Self, b: Self, t: Fdef) -> Self {
a *... |
// FormValidator.validators
// - set validators rules
use nickel::{
Params,
};
use std;
use std::collections::HashMap;
macro_rules! parse_fn {
( $vtype:ty ) => {{
fn parse(x: &str) -> Option<i32> {
if x.parse::<$vtype>().is_ok() { Some(1) } else { None }
}
parse
}};
}
m... |
use colored::Colorize;
use crossbeam_channel;
use std::sync::mpsc;
use crate::Output;
use crate::TraceError;
use crate::{
ptrace::{SyscallPtrace, Tracer},
TraceType,
};
use crate::{HTraceIterator, Syscall};
use crate::{TraceOptions, TraceOutput, TraceThread};
/// Actual main tracer
#[derive(Debug)]
pub struct... |
use std::collections::HashSet;
const MAX_PERMUTATION_ROUNDS: u8 = 42;
#[derive(Copy, Clone, PartialEq, Eq, Debug)]
pub enum Bucket {
One,
Two,
}
impl Bucket {
fn other(&self) -> Bucket {
match self {
Bucket::One => Bucket::Two,
Bucket::Two => Bucket::One,
}
}
... |
// 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.
pub mod component_instance;
pub mod component_model;
pub mod environment;
pub mod node_path;
pub mod route;
pub mod serde_ext;
use {
crate::{
... |
use ndarray;
use rand;
use rand::Rng;
type TileArray = ndarray::Array2<Tile>;
// Index into a TileArray; arrays are indexed in (row (y), column (x)) order
type TileIndex = (usize, usize);
#[derive(Serialize, Deserialize, Copy, Clone, Debug, PartialEq)]
pub enum Direction {
Up,
Down,
Left,
Right,
}
im... |
//! Show toggle controls using togglers.
use std::hash::Hash;
use crate::alignment;
use crate::event;
use crate::layout;
use crate::mouse;
use crate::row;
use crate::text;
use crate::{
Alignment, Clipboard, Element, Event, Hasher, Layout, Length, Point,
Rectangle, Row, Text, Widget,
};
/// A toggler widget
//... |
/*!
sprs is a sparse linear algebra library for Rust.
It features a sparse matrix type, [**`CsMat`**](struct.CsMatBase.html), and a sparse vector type,
[**`CsVec`**](struct.CsVecBase.html), both based on the
[compressed storage scheme](https://en.wikipedia.org/wiki/Sparse_matrix#Compressed_sparse_row_.28CSR.2C_CRS_or... |
#[macro_use]
extern crate log;
pub mod app;
use app::*;
use nng::{Message, Protocol, Socket};
use serde_json::json;
use serde_json::Value;
use std::error::Error;
use std::fmt;
use v_onto::individual::Individual;
#[derive(Debug)]
pub struct ApiError {
result: ResultCode,
info: String,
}
impl fmt::Display for... |
use cosmwasm_std::{
HandleResponse, log, HumanAddr,
Api, Binary, Uint128, CosmosMsg, Env, Extern, HandleResult, InitResponse, MigrateResult, Querier, StdError, StdResult, Storage, WasmMsg, to_binary
};
use cw2::set_contract_version;
use cw20_base::contract::{
create_accounts, handle_send as cw20_handle_sen... |
//!
//! PCI
//!
use crate::arch::target_arch::device::pci::{
read_config_data_register, setup_arch_depend_pci_device, write_config_address_register,
write_config_data_register,
};
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct ClassCode {
pub base: u8,
pub sub: u8,
pub programming_interfa... |
use bevy::asset::Handle;
use bevy::prelude::*;
use bevy::prelude::ColorMaterial;
use bevy_asset_loader::{AssetCollection};
use bevy_kira_audio::AudioSource;
#[derive(AssetCollection)]
pub struct TextureAssets {
#[asset(color_material)]
#[asset(path = "MUSH_1.png")]
pub mush_1: Handle<ColorMaterial>,
#[... |
mod geometry;
mod model;
mod our_gl;
mod tga;
use crate::{geometry::*, our_gl::*, tga::*};
use model::*;
use time::Instant;
use clap::Parser;
const WIDTH: i32 = 800;
const HEIGHT: i32 = 800;
const light_dir: Vec3f = Vec3f {
x: 1.,
y: 1.,
z: 1.,
};
const eye: Vec3f = Vec3f {
x: 1.,
y: 1.,
z: 3... |
// Copyright (c) The Starcoin Core Contributors
// SPDX-License-Identifier: Apache-2.0
use anyhow::{ensure, Result};
use bcs_ext::Sample;
use network_api::messages::{CompactBlockMessage, TransactionsMessage};
use serde::de::DeserializeOwned;
use serde::Serialize;
use starcoin_crypto::hash::PlainCryptoHash;
use starcoi... |
use crate::ans::voronoy;
use crate::xyz::xyz_reader;
use xyzio::Atom;
/**
* Created by genshen at 2020/12/25
*/
pub struct BoxConfig {
pub input_box_start: Vec<voronoy::Float>,
pub input_box_size: Vec<u64>,
// from input, length can be 0
pub box_size_: (usize, usize, usize), // box size after determ... |
#[macro_use] extern crate log;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate clap;
extern crate env_logger;
extern crate regex;
extern crate libarchive3_sys;
extern crate libc;
extern crate ring;
extern crate encoding;
extern crate postgres;
extern crate hyper;
extern crate url;
extern crate chrono;
... |
use anyhow::{bail, Error};
use rss::Channel;
use tokio::sync::{mpsc, oneshot};
use tokio::time::{self, Duration};
const POLL_INTERVAL_SECONDS: u64 = 5;
/// A tuple of channels for the fetcher to report back both success and failure in fetching the
/// individual feeds' contents.
pub struct Results(mpsc::Sender<(Strin... |
//! Tridiagonal decomposition of a symmetric matrix
use ndarray::{
linalg::{general_mat_mul, general_mat_vec_mul},
s, Array1, Array2, ArrayBase, Axis, DataMut, Ix2, NdFloat, RawDataClone,
};
use crate::{
check_square, householder,
triangular::{IntoTriangular, UPLO},
LinalgError, Result,
};
/// Tr... |
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless ... |
use state;
use data;
use serde_json;
use std::sync::{Arc, Mutex};
use std::io::Read;
use result::Result;
use reader::Reader;
use std::fs::File;
use std::mem::transmute;
use getopts::Options;
use std::env;
use std::string::String;
use otp::{Port, OTP};
fn print_usage(program: &str, opts: Options) {
let brief = for... |
use std::fmt;
use std::str::FromStr;
// Kalah(m, n) notation: m pits per side
const KALAH_M: usize = 6;
const NUM_HOLES: usize = (KALAH_M + 1) * 2;
const PLAYER_STORE: usize = KALAH_M;
const OPPONENT_STORE: usize = NUM_HOLES - 1;
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Player {
First,
Second,
}
im... |
pub const DEFAULT_MOVE_OVERHEAD: u64 = 25;
pub const MIN_MOVE_OVERHEAD: u64 = 0;
pub const MAX_MOVE_OVERHEAD: u64 = 20000;
pub struct TimeControlInformation {
pub stable_pv: bool,
pub time_saved: u64,
}
impl TimeControlInformation {
pub fn new(time_saved: u64) -> Self {
TimeControlInformation { st... |
/*
* Tokio Reference TCP Implementation
* Copyright (c) 2019 Tokio Contributors
*
* 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... |
//! Code to construct paths through the Tor network
//!
//! TODO: I'm not sure this belongs in circmgr, but this is the best place
//! I can think of for now. I'm also not sure this should be public.
pub mod dirpath;
pub mod exitpath;
use tor_chanmgr::ChanMgr;
use tor_linkspec::{ChanTarget, OwnedChanTarget, OwnedCir... |
use nom::{
branch::alt,
bytes::complete::tag,
character::complete::{i64, space1},
combinator::{eof, map, recognize},
sequence::{delimited, separated_pair, terminated, tuple},
Finish,
};
use std::{collections::HashMap, path::PathBuf};
use crate::AdventOfCode;
const DAY: &str = "day22";
type Ed... |
#![crate_type = "bin"]
#![feature(get_mut_unchecked)]
use std::env;
use std::rc::Rc;
use getopts::Options;
use glib::clone;
use gdk::keys::constants;
use gtk::ApplicationWindow;
use gtk::Justification;
use gio::prelude::*;
use gtk::prelude::*;
pub mod style;
pub mod request;
pub use request::{Resp, Wik};
static AP... |
// Copyright 2022 <NAME>, 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 in wri... |
use crate::constants::{
LIBUSB_HOTPLUG_ENUMERATE, LIBUSB_HOTPLUG_EVENT_DEVICE_ARRIVED,
LIBUSB_HOTPLUG_EVENT_DEVICE_LEFT, LIBUSB_HOTPLUG_MATCH_ANY, LIBUSB_HOTPLUG_NO_FLAGS,
};
use crate::ffi::{
libusb_context, libusb_device, libusb_hotplug_callback_handle,
libusb_hotplug_deregister_callback, libusb_hotpl... |
use super::network_manager::NetworkManager;
use super::render::Painter;
use crate::{tile::Tile, tile_coordinates::TileCoordinates, tile_id::TileId};
use bytes::Bytes;
use eyre::Result;
use futures::future::try_join_all;
use geo::Point;
use log::{debug, info};
use std::{collections::HashMap, sync::Arc, time::Instant};
u... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.