text stringlengths 3.09k 13.9k |
|---|
// Copyright 2017 <NAME>
//
// 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... |
extern crate inotify;
extern crate getopts;
extern crate tail;
use std::path::Path;
use std::iter::Iterator;
use std::io::{Read, BufRead, Write, BufWriter};
use std::fs::File;
use std::collections::HashMap;
use inotify::{Inotify, WatchMask, EventMask};
use getopts::Options;
use tail::{StatefulFile, ModificationType, B... |
use core::mem;
use core::default::Default;
use core::intrinsics::volatile_store;
use reg;
use ptr::Ptr;
use collections::StaticArr;
pub mod sprites;
pub use self::sprites::*;
#[derive(Clone, Copy)]
#[repr(u8)]
pub enum VideoMode {
Mode0 = 0,
Mode1 = 1,
Mode2 = 2,
Mode3 = 3,
Mode4 = 4,
Mode5 =... |
use anyhow::{anyhow, bail, Context};
use jsonwebtoken as jwt;
use jwt::{Algorithm, DecodingKey, TokenData, Validation};
use reqwest::{header, Response};
use serde::Deserialize;
use std::{
cmp,
sync::Arc,
time::{Duration, Instant},
};
use tokio::{sync::RwLock, task::JoinHandle};
use core::config::{JWK_ISSUE... |
// Copyright 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
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writ... |
pub mod frame_errors;
pub mod request;
pub mod response;
pub mod server_event_type;
pub mod types;
pub mod value;
#[cfg(test)]
mod value_tests;
#[cfg(test)]
mod cql_collections_test;
#[cfg(test)]
mod cql_types_test;
use crate::frame::frame_errors::FrameError;
use crate::transport::Compression;
use bytes::{Buf, BufM... |
use std::collections::HashMap;
use std::fs::{File, OpenOptions};
use std::io::{BufRead, Error, Read, Seek, SeekFrom, Write};
use std::path::PathBuf;
use structopt::StructOpt;
/// PILE: The Rust Geodesy grid management program. Appends grid files into the
/// RG grid stockpile file `assets.pile` and writes metadata fil... |
// Copyright (c) 2017 mimir developers
//
// 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. All files in the project carrying such notice may not be copied,
// ... |
//
// Copyright (c) 2015-2019 Plausible Labs Cooperative, Inc.
// All rights reserved.
//
use std::fmt::Debug;
use pl_hlist::*;
use rcodec::byte_vector::ByteVector;
use rcodec::codec::*;
use rcodec::error::Error;
use rcodec::{byte_vector, hcodec, record_struct, struct_codec};
fn assert_round_trip<T, C>(codec: C, va... |
use cfg_if::cfg_if;
use futures_signals::{
map_ref,
signal::{Mutable, SignalExt, Signal},
signal_vec::{MutableVec, SignalVecExt},
CancelableFutureHandle,
};
use wasm_bindgen::prelude::*;
use wasm_bindgen::JsCast;
use std::cell::RefCell;
use std::rc::Rc;
use once_cell::sync::OnceCell;
use utils::{prelud... |
use crate::peripherals::*;
use embedded_hal::blocking::delay::DelayMs;
use core::ops::DerefMut;
use core::sync::atomic::{AtomicPtr, Ordering};
use cortex_m::interrupt::{self, Mutex};
use cortex_m::singleton;
use hmc5983::HMC5983;
use icm20689::{Builder, ICM20689};
/// Onboard sensors
use mpu9250::Mpu9250;
use ms5611_... |
use super::{single_cluster::Config, ClustersConfigParseError, Timeouts};
use once_cell::sync::Lazy;
use serde::Deserialize;
use std::{
collections::{HashMap, HashSet},
convert::TryFrom,
fmt, fs,
io::Error as IOError,
mem::swap,
path::{Path, PathBuf},
sync::Arc,
};
use tap::TapFallible;
use t... |
use byteorder::{LittleEndian, WriteBytesExt};
extern crate clap;
use clap::{Arg, App};
use crc::{crc32, Hasher32};
use std::fs;
use std::fs::File;
use std::io::{BufRead, BufReader, Read, Write};
use std::process;
use std::string::String;
#[derive(Debug)]
struct Entry {
basepath:String,
filename:String,
crc:u32,... |
use crate::scene_data::SceneData;
use crate::sampler::PathSampler;
use crate::vec::f32x3;
use crate::ray::Ray;
use crate::shapes::IsectPoint;
use crate::math;
use crate::sampling;
pub fn radiance_isect (ray: &Ray, scene_data: &SceneData, _path_sampler: &PathSampler) -> f32x3 {
let isect_p = match scene_data.inte... |
use web_sys::WebGlRenderingContext as GL;
use web_sys::*;
pub fn link_program(
gl: &WebGlRenderingContext,
vert_source: &str,
frag_source: &str,
) -> Result<WebGlProgram, String> {
let program = gl
.create_program()
.ok_or_else(|| String::from("Error creating program"))?;
let vert_... |
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License in the LICENSE-APACHE file or at:
// https://www.apache.org/licenses/LICENSE-2.0
//! Theme traits
use kas::draw::{color, DrawIface, DrawSha... |
//
// Copyright (C) 2019 Swift Navigation Inc.
// Contact: https://support.swiftnav.com
//
// This source is subject to the license found in the file 'LICENSE' which must
// be be distributed together with this source. All other rights reserved.
//
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF AN... |
//! Output formatting.
//!
//! Usually chosen via a command line parameter, the available output formats aim for human or machine readability.
//! Every possible output value does have its own enum kind, usually returned by an *Action*s *call* method.
//!
//! # Examples
//!
//! ```
//! # use dsa::output::*;
//! let for... |
// Copyright (c) Microsoft. All rights reserved.
#![deny(rust_2018_idioms)]
#![warn(clippy::all, clippy::pedantic)]
#![allow(
clippy::default_trait_access,
clippy::missing_errors_doc,
clippy::module_name_repetitions
)]
pub mod error;
use crate::error::{Error, ErrorKind};
pub fn read_config<TConfig>(
... |
use super::{FunctionDeclaration, FunctionParameter};
use crate::{
build_config::BuildConfig,
error::*,
parse_tree::{ident, TypeParameter, Visibility},
parser::Rule,
style::{is_snake_case, is_upper_camel_case},
type_engine::TypeInfo,
};
use sway_types::{ident::Ident, span::Span};
use pest::ite... |
use crate::cartridge::Cartridge;
use crate::interrupts::Interrupts;
use crate::serial::Serial;
use crate::timer::Timer;
use crate::video::Video;
use bit_field::BitField;
pub struct AddressBus<'a> {
cartridge: &'a mut Cartridge,
wram: &'a mut [u8; 8192],
serial: &'a mut Serial,
timer: &'a mut Timer,
... |
use std::io::Write;
use gst::prelude::*;
use structopt::StructOpt;
#[derive(Debug, StructOpt)]
struct Args {
#[structopt(long)]
live_rtmp_uri: String,
#[structopt(long, help = "Make RTMP pipeline EOS after N buffers")]
eos_after: Option<i32>,
#[structopt(long, help = "Make RTMP pipeline error afte... |
//! Application page components.
use wasm_bindgen::{JsValue, UnwrapThrowExt};
use yew::{classes, function_component, html, Callback, Html, Properties};
use yew_router::prelude::*;
mod about;
mod app;
mod home;
mod implementation;
mod new_poll;
mod participants;
mod tallying;
mod voting;
pub use self::{
app::{App... |
use crate::hash::{hash_group, hash_prime};
use crate::math::modpow_uint_int;
use blake2::{Blake2b, Digest};
use num_bigint::{BigInt, BigUint};
use num_integer::Integer;
// Let G be a group of unknown order.
// Here both the prover and verifier are given (u, w, x) and
// the prover wants to convince the verifier that w... |
// Copyright 2019 The Druid 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... |
use super::{Pattern, Row, Tag};
use std::collections::BTreeSet;
#[derive(PartialEq, Eq, PartialOrd, Ord, Debug, Clone, Hash)]
pub struct Matrix {
rows: Vec<Row>,
}
impl Matrix {
pub fn new(rows: Vec<Row>) -> Self {
debug_assert!(match rows.as_slice() {
[] => true,
[x, xs @ ..] ... |
use explicate::*;
use raise::TransformAst;
use raise::VisitAst;
use std::collections::HashSet;
pub fn heapify(var_data: &mut var::Slab<var::Data>, module: Module) -> Module {
let all_free_vars = all_free_vars(&module);
let main = Closure {
args: vec![],
code: module.stmts,
};
let mut bu... |
extern crate wasmi;
use self::wasmi::memory_units::Pages;
use self::wasmi::{
Error as InterpreterError, Externals, FuncInstance, FuncRef, HostError, ImportsBuilder,
MemoryInstance, MemoryRef, ModuleImportResolver, ModuleInstance, ModuleRef, RuntimeArgs,
RuntimeValue, Signature, Trap, ValueType,
};
use supe... |
use crate::prelude::*;
use crate::window::Window;
use fltk_sys::fl;
use std::{mem, os::raw, panic, ptr};
/// Alias Widget ptr
pub type WidgetPtr = *mut fltk_sys::widget::Fl_Widget;
/// Get the grabbed window
pub fn grab() -> Option<impl WindowExt> {
unsafe {
let ptr = fl::Fl_grab();
if ptr.is_null... |
use crate::network::Network;
use crate::network::DEFAULT_PORT;
use crate::node::{MemoryState, Packet, Peer};
use anyhow::Context;
use chrono::{DateTime, Utc};
use etherparse::{InternetSlice, SlicedPacket};
use etherparse::{Ipv4HeaderSlice, TcpHeaderSlice, TransportSlice};
use pcarp::Capture;
use std::collections::{Hash... |
use crate::game_analysis::*;
use crate::primitives::*;
use crate::rules::*;
use crate::util::*;
use itertools::Itertools;
pub fn parse_rule_description(
str_rules_with_player: &str,
(n_tarif_extra, n_tarif_ruf, n_tarif_solo): (isize, isize, isize),
fn_player_to_epi: impl Fn(&str)->Result<EPlayerIndex, Erro... |
use crate::functions;
use crate::table::Table;
use rand::seq::SliceRandom as _;
use rand::Rng;
const MIN_SAMPLES_SPLIT: usize = 2;
const MAX_DEPTH: usize = 64;
#[derive(Debug, Clone, Default)]
pub struct DecisionTreeOptions {
pub max_features: Option<usize>,
}
#[derive(Debug)]
pub struct DecisionTreeRegressor {
... |
use crate::common::manager::common::format_duration;
use crate::common::timeutils::parse_hms_time;
use crate::Map;
use std::process::Command;
use std::time::Duration;
/// Format a duration as a SLURM time string, e.g. 01:05:02
pub fn format_slurm_duration(duration: &Duration) -> String {
format_duration(duration)
... |
use crate::ffi;
use crate::utilities::rcp_safe;
use crate::{Error, Result};
use std::mem;
/// Encodes index data into an array of bytes that is generally much smaller (<1.5 bytes/triangle)
/// and compresses better (<1 bytes/triangle) compared to original.
///
/// For maximum efficiency the index buffer being encoded ... |
use bj_bin::prompt;
use bj_core::deck::{Card, Deck};
use bj_core::hand::{Hand, HandError};
use bj_core::resp::Resp;
use std::io::{self, BufRead, BufReader, Write};
fn hand_with_value(hand: &Hand) -> String {
format!(
"{} ({}{})",
hand,
hand.value(),
if hand.is_soft() { "s" } else { ... |
use crate::{Block, Constant, Error, Value};
use hashbrown::HashMap;
use std::cell::{Cell, Ref, RefCell, RefMut};
use std::collections::BTreeMap;
use std::fmt;
use std::rc::Rc;
/// The identifier of a constant.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct ConstId(usize);
impl fmt::Dis... |
//! ```
//! extern crate logger;
//!
//! // 1. Create directory of logging in the directory.
//! // 2. Create the log with name "main.log"
//! let target_dir = String::from("c:\\temp"); // path to the directory where need create directory with logging files
//! let log_level = String::from("debug"); // Level logging:... |
use std::fs;
use std::io::{self, Read};
use std::time::SystemTime;
use std::path::{Path, PathBuf};
use glium::backend::glutin::headless::Headless;
pub struct Shader {
filename: &'static str,
default: &'static str,
}
pub struct Program {
program: glium::program::Program,
vertex: &'static Shader,
v... |
use sp_core::crypto::AccountId32;
use sp_core::ecdsa::Public;
pub use sp_core::ecdsa::Signature;
use crate::pallets::storage::storage_key_account_balance;
use crate::rpc::{
chain_get_block, chain_get_block_hash, chain_get_genesis_hash, payment_query_fee_details,
state_get_runtime_version, state_get_storage, Js... |
use std::{
fmt,
path::{Path, PathBuf},
};
mod error;
pub use self::error::IntoBoxPathError;
#[cfg(not(windows))]
/// The platform-specific separator as a string, used for splitting
/// platform-supplied paths and printing `BoxPath`s in the platform-preferred
/// manner.
pub const PATH_PLATFORM_SEP: &str = "/... |
use super::Renderer;
use crate::{prelude::*, renderer::TextureRenderer};
use anyhow::Context;
use sdl2::{
rect::Rect as SdlRect,
render::{Canvas, Texture as SdlTexture},
};
use std::{
cell::RefCell,
ops::{Deref, DerefMut},
};
pub(crate) struct RendererTexture {
inner: Option<SdlTexture>,
}
impl Re... |
//! Detects whether a terminal supports color, and gives details about that
//! support. It takes into account the `NO_COLOR` environment variable.
//!
//! This crate is a Rust port of [@sindresorhus](https://github.com/sindresorhus)'
//! [NPM package by the same name](https://npm.im/supports-color).
//!
//! ## Example... |
//! Debug helper functions
use std::fmt;
use std::slice;
use std::mem;
use std::ops;
use std::iter;
use std::marker::PhantomData;
use rocks_sys as ll;
use crate::to_raw::{FromRaw, ToRaw};
use crate::types::SequenceNumber;
// Value types encoded as the last component of internal keys.
#[repr(C)]
#[derive(Debug, Cop... |
use super::error::ParseError;
use super::*;
use super::space::*;
use super::string::*;
use tag::*;
use tree::*;
use data::position::*;
#[derive(Debug, Clone)]
pub struct ArrayContext {
data: ArrayData,
kind: ArrayContextKind,
}
#[derive(Debug, Clone)]
pub enum ArrayParentKind {
Top,
A... |
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
#[repr(u8)]
pub enum OpCode {
STOP = 0x00,
ADD = 0x01,
MUL = 0x02,
SUB = 0x03,
DIV = 0x04,
SDIV = 0x05,
MOD = 0x06,
SMOD = 0x07,
ADDMOD = 0x08,
MULMOD = 0x09,
EXP = 0x0a,
SIGNEXTEND = 0x0b,
LT = 0x10,
GT = 0x11,
S... |
use nom::branch::alt;
use nom::combinator::opt;
use nom::sequence::preceded;
use nom::Err::Incomplete;
use nom::IResult;
use crate::result::IonResult;
use crate::text::parsers::blob::parse_blob;
use crate::text::parsers::boolean::parse_boolean;
use crate::text::parsers::clob::parse_clob;
use crate::text::parsers::deci... |
use devise::{Diagnostic, Result, Spanned, syn};
use devise::ext::{SpanDiagnosticExt, TypeExt};
use proc_macro2::{Span, TokenStream as TokenStream2};
use quote::quote_spanned;
use crate::PARAM_PREFIX;
use crate::proc_macro_ext::Diagnostics;
use crate::syn_ext::IdentExt;
pub mod hook;
pub mod step;
/// Hook or step fu... |
use crate::engine::*;
use crate::helpers::*;
use crate::scripts::*;
use gilrs::Button;
use miniquad::*;
/// state of the Application, includes drawing, input, generators
pub struct App {
/// input of the app, contains mouse, key & gamepad with frame times
input: Input,
/// sprite rendering state / pipelin... |
use backtrace::Backtrace;
use std::error::Error as StdError;
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
/// The [Result](https://doc.rust-lang.org/std/result/enum.Result.html) alias of this crate
pub type OsshResult<T> = Result<T, Error>;
/// The error type of this crate
pub struct Error {
ki... |
extern crate regex;
use std::io::{self, BufRead};
pub fn part_one() {
let actions = read_input(io::stdin().lock());
let answer = get_manhatten_dist_after_applying_actions(&Turtle::new_default(), &actions);
println!("{}", answer)
}
pub fn part_two() {
let actions = read_input(io::stdin().lock());
... |
/*******************************************************************************
* (c) 2021 Zondax GmbH
*
* 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/lic... |
use ordered_multimap::list_ordered_multimap::{
Entry as MultimapEntry, EntryValues as MultimapEntryValues,
EntryValuesDrain as MultimapEntryValuesDrain, EntryValuesMut as MultimapEntryValuesMut,
Iter as MultimapIter, IterMut as MultimapIterMut, KeyValuesDrain as MultimapKeyValuesDrain,
KeyValuesEntryDra... |
use crate::bakedexpression::BakedExpression;
use crate::element::{Element, ElementConfig};
use crate::context::Context;
use crate::render_context::RenderContext;
use crate::render_buffer::RenderBuffer;
use async_trait::async_trait;
use image::DynamicImage;
use image::GenericImageView;
use crate::pixel::Pixel;
use gl... |
mod startup;
use crate::{stages::GameState, GameAssets};
use bevy::{prelude::*, utils::HashMap};
use bevy_simple_tilemap::{prelude::TileMapBundle, Tile, TileFlags, TileMap};
use self::startup::WorldLevels;
#[derive(Debug, SystemLabel, Clone, Copy, Hash, PartialEq, Eq)]
enum WorldSystems {
WorldSetup,
Initial... |
/*
* Copyright (c) 2022 R3BL LLC
* All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by... |
// Copyright 2020 MaidSafe.net limited.
//
// This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT
// http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD
// https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied,
// modified, or di... |
use crate::hal::window::Extent2D;
use crate::hal::{self, format as f, image, memory, CompositeAlpha};
use crate::{native, Backend as B, Device, GlContainer, PhysicalDevice, QueueFamily};
use glow::Context;
fn get_window_extent(window: &Window) -> image::Extent {
image::Extent {
width: 640 as image::Size,
... |
mod action;
mod context;
use crate::constants::requeue;
use crate::error::{ReconciliationError, ReconciliationResult, Result};
use crate::resource_controller::action::{
action, Action, CreationAction, DestructionAction, ErrorState,
};
use crate::resource_controller::context::{new_context, Context, ResourceInterfac... |
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
//
// 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... |
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
extern crate lib_dachshund;
use lib_dachshund::dachshund::algorithms::coreness::{Coreness, FractionalCoreness};
use lib_dachshund::... |
use config;
use log::{debug, error, info, log, trace, warn};
use serde_derive::Deserialize;
use std::fmt;
use std::time::{Duration, SystemTime, UNIX_EPOCH};
static TARGET_SOURCE_BUILDER: &'static str = "tempest::source::SourceBuilder";
/// `SourceBuilder` trait for defining how to configure
/// structs that implement... |
/// Advent of Code 2019, day 14
/// https://adventofcode.com/2019/day/14
use std::collections::{HashMap, VecDeque};
use std::iter::FromIterator;
use std::str::FromStr;
fn div_round_up(n: u64, d: u64) -> u64 {
if n % d != 0 {
n / d + 1
} else {
n / d
}
}
#[derive(Debug, Clone)]
struct Mater... |
//! J-Type thermocouple data
use crate::{Celsius, Millivolts, FP};
const J_TYPE_E_BELOW_760: [FP; 9] = [
0.000000000000E+00,
0.503811878150E-01,
0.304758369300E-04,
-0.856810657200E-07,
0.132281952950E-09,
-0.170529583370E-12,
0.209480906970E-15,
-0.125383953360E-18,
0.156317256970E... |
use std::collections::{BTreeMap, HashMap};
use super::utils::http_get;
use crypto_market_type::MarketType;
use once_cell::sync::Lazy;
use serde::{Deserialize, Serialize};
use serde_json::Value;
// key = market_type + pair
static CONTRACT_VALUES: Lazy<HashMap<String, i64>> = Lazy::new(|| {
// offline data, in case... |
// Copyright 2021. The Tari Project
//
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
// following conditions are met:
//
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
// disclai... |
// Copyright 2021 <NAME>
//
// 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 to those terms... |
use crate::{ident_or_index::IdentOrIndex, parse_utils::ParseBufferExt, tokenizers::tstr_tokens};
use as_derive_utils::return_spanned_err;
#[allow(unused_imports)]
use core_extensions::SelfOps;
use proc_macro2::{Span, TokenStream as TokenStream2};
use quote::{quote, quote_spanned, TokenStreamExt};
use syn::{
pa... |
pub const MAX_NUM_OF_ACTIVE_WITNESSES: usize = 27;
pub const MAX_NUM_OF_STANDBY_WITNESSES: usize = 127;
// 27 * 70% = 18.9, so a solid block is one verified by 19 witnesses.
pub const SOLID_THRESHOLD_PERCENT: usize = 70;
/// Will postpone txns if block size exceeds 2MiB.
/// So in theory, max txns/block is around 770... |
//! Assemble a debug build
//!
//! TODO: Add file layout information
use super::*;
use log::info;
use resolve::Resolved;
const BYTES_P_SPAN: usize = 12;
const BYTES_P_INSTR: usize = 2;
/// Represents the amount of bytes the label reference header takes up
/// (2 for address, 2 for name len)
const REF_HEAD_LEN: usize ... |
use crate::resources::common::object::Object;
use crate::resources::common::path::{UrlPath};
use crate::resources::core::charges::BillingDetails;
use crate::resources::paymentmethods::bank::AccountHolderType;
use crate::resources::paymentmethods::cards::{CardCheck, CardType};
use crate::resources::paymentmethods::sourc... |
/*
MST Graph
MIT License
Author: <NAME>, 2018
*/
extern crate colored;
extern crate rand;
use self::colored::*;
use self::rand::Rng;
use std::collections::HashSet;
use std::fs::File;
use std::io::ErrorKind;
use std::io::Write;
use std::sync::{Arc, Condvar, Mutex, RwLock};
use std::thread;
pub mod mst;
#[derive(Clone, ... |
//! # The structures of dot language
//! The set of components of the graphviz dot notation
//! endeavouring to follow comparatively close to the language [`notation`]
//!
//! [`notation`]: https://graphviz.org/doc/info/lang.html
//!
//! # Description:
//! ```txt
//! strict digraph t { <= graph
//! ... |
//! Registration of dns-sd services
// use super::txt::TXTRecord;
use crate::ffi::apple::{
kDNSServiceErr_NoError, DNSServiceErrorType, DNSServiceFlags, DNSServiceProcessResult,
DNSServiceRef, DNSServiceRefDeallocate, DNSServiceRefSockFD, DNSServiceRegister,
};
use crate::os::apple::txt::TXTRecord;
use crate::... |
use num::{One, Zero};
use pw;
use na::{Point3, Vector3, Matrix4, PerspectiveMatrix3};
use field::{FieldData, VectorField, FieldView};
mod charge;
pub use self::charge::*;
use arrow::Arrow;
use util;
use consts::*;
pub struct PointChargesFieldView {
// The PointCharges whose field we are visualizing
pub c... |
use std::collections::HashMap;
use scroll::Pread;
use crate::utils::{sub_slice, CSTR_CTX};
use self::image_definition::ImageDefinition;
use self::method_definition::MethodDefinition;
use self::type_definition::TypeDefinition;
mod header;
mod image_definition;
mod method_definition;
mod type_definition;
/// Parser ... |
use snafu::{OptionExt, ResultExt};
#[derive(Debug, snafu::Snafu)]
pub enum Error {
#[snafu(display("couldn't get default budget: {}", source))]
GetBudget { source: super::client::Error },
#[snafu(display("couldn't update transactions: {}", source))]
UpdateTransactions { source: super::client::Error },... |
// Copyright (c) 2019 - 2020 ESRLabs
//
// 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 ... |
use crate::{
gc::Gc,
primitives::ListOperations,
rerrs::{ErrorKind, SteelErr},
rvals::{Result, SteelVal},
throw,
};
use im_rc::HashMap;
use serde_json::{Map, Number, Value};
use std::convert::{TryFrom, TryInto};
// use list
pub fn string_to_jsexpr() -> SteelVal {
SteelVal::FuncV(|args: &[Steel... |
use crate::core::domain::property::{Property, PropertyRecordRepository};
use crate::loader::domain::CsvProperty;
use crate::loader::errors::LoaderError;
use crate::loader::settings::Settings;
use console::style;
use indicatif::{ProgressBar, ProgressIterator, ProgressStyle};
use sqlx::PgPool;
use std::convert::TryInto;
... |
/**
* [480] Sliding Window Median
*
* Median is the middle value in an ordered integer list. If the size of the list is even, there is no middle value. So the median is the mean of the two middle value.
* Examples:
* [2,3,4] , the median is 3
* [2,3], the median is (2 + 3) / 2 = 2.5
* Given an array nums, there ... |
use std::io::Cursor;
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::{Arc, Mutex, Weak};
use std::time::Duration;
use rodio::source::{Buffered, Empty};
use rodio::{Decoder, Device as RodioDevice, Sample, Source};
use crate::error::{Result, TetraError};
pub use rodio::decoder::DecoderError;
pub struct ... |
//! Rainstash Manifest Objects for structs and functions within this library.
//!
//! The structs offer ways to destruct the Option value into its value with
//! error handling, this helps to reduce boilerplate code when making
//! applications using this library.
use std::fmt;
use std::hash::{Hash, Hasher};
use serde... |
// TODO Move to map_model
use std::collections::{BTreeMap, BTreeSet};
use anyhow::Result;
use serde::{Deserialize, Deserializer};
use geom::{Duration, LonLat, Pt2D};
use map_model::{
osm, ControlTrafficSignal, DirectedRoadID, IntersectionID, Map, Movement, MovementID, Stage,
StageType,
};
/// This imports t... |
// ุจูุณูู
ู ุงูููููู ุงูุฑููุญูู
ููู ุงูุฑููุญููู
// This file is part of Setheum.
// Copyright (C) 2019-2021 Setheum Labs.
// 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 a... |
use crate::crud_repo;
use crate::db::pagination::*;
use crate::db::transaction_manager::ITransaction;
use crate::errors::ServiceError;
use crate::models::team::{NewTeam, Team};
use crate::models::user::User;
use crate::models::utils::PaginationOptions;
use crate::schema::{teams, users};
use diesel::dsl::count_star;
use... |
use pest::Parser;
use pest_derive::Parser;
use std::collections::{HashMap, HashSet};
use std::fmt;
use std::io::{stdin, Read};
#[derive(Parser)]
#[grammar = "recipe.pest"]
struct ReactionParser;
#[derive(Debug)]
struct Relation {
product: String,
ingredient: String,
}
impl Relation {
fn new(product: Stri... |
/*!
Use the gpu to run computations
*/
use std::convert::TryInto;
use wgpu::util::DeviceExt;
///***execute_gpu_sync***
///
///Sync version of `execute_gpu`
pub fn execute_gpu_sync(items: Vec<Vec<u32>>, spirv: &[u32]) -> Vec<u32> {
futures::executor::block_on(execute_gpu(items, spirv))
}
///***execute_gpu***
///
... |
#![allow(clippy::future_not_send)]
//! RPC facilities.
use std::time::Duration;
use eyre::Report;
use serde::{Deserialize, Serialize};
use crate::errors::SerializedError;
const PROTOCOL_VERSION: u8 = 1;
/// Represents an RPC request.
#[derive(Debug, Serialize, Deserialize)]
pub enum Request {
/// Pause daemon.... |
use super::parser::{do_parse, Event};
use super::*;
const EMPTY_SYN_IDS: &[SynId] = &[];
impl<'a> SynTree<'a> {
fn new(text: &'a str) -> Self {
SynTree {
text,
nodes: vec![],
errors: vec![],
}
}
fn add_error(&mut self, msg: String, range: (usize, usize)... |
use combine::parser::choice::{choice, optional};
use combine::parser::item::{eof, position};
use combine::parser::repeat::many1;
use combine::{parser, ParseResult, Parser};
use crate::common::{arguments, default_value, directives, parse_type};
use crate::helpers::{ident, name, punct};
use crate::query::ast::*;
use cra... |
use hamming::blocks::Blocks;
use web_sys::HtmlElement;
use yew::prelude::*;
use crate::components::BitRenderer;
use crate::types::{Bit, RenderingMode};
pub struct App {
link: ComponentLink<Self>,
input_string: String,
output_string: String,
bits: Vec<Bit>,
input_ref: NodeRef,
rendering_mode: R... |
mod parser;
pub mod percent_path;
pub mod trash_entry;
pub mod trash_info;
mod utils;
use std::io;
use directories::UserDirs;
use fs_extra::dir;
use fs_extra::file;
use log::debug;
use log::error;
use once_cell::sync::Lazy;
use snafu::{ResultExt, Snafu};
#[cfg(feature = "rayon")]
use {
rayon::prelude::*,
std... |
use core::cell::UnsafeCell;
use core::default::Default;
use core::fmt::Debug;
use core::fmt::Formatter;
use core::sync::atomic::AtomicBool;
use core::sync::atomic::Ordering;
use psp2_sys::kernel::threadmgr::sceKernelCreateMutex;
use psp2_sys::kernel::threadmgr::sceKernelDelayThread;
use psp2_sys::kernel::threadmgr::sc... |
use crate::{
color::Color,
error::PdfResult,
filter::decode_stream,
geometry::{CubicBezierCurve, Line, Outline, Path, Point, Subpath},
resolve::Resolve,
xobject::ImageXObject,
};
use minifb::{Key, Window, WindowOptions};
pub fn fuzzy_eq(a: f32, b: f32) -> bool {
let a = a.abs();
let b ... |
use nom::IResult;
use nom::bytes::complete::take;
use nom::combinator::verify;
use nom::number::complete::{be_i16, be_u16};
/// Horizontal Header Table
///
/// The 'hhea' table contains information needed to layout fonts whose characters are written
/// horizontally, that is, either left to right or right to left.
///... |
use std::f32::consts::FRAC_PI_2;
use std::f32::consts::PI;
use std::f32::EPSILON;
use serde::{Deserialize, Deserializer, Serialize, Serializer};
#[derive(Clone)]
pub struct Color(pub u8, pub u8, pub u8);
#[derive(Clone, Copy, Serialize, Deserialize)]
pub enum ColorProperties {
Hue,
Value,
Saturation,
... |
use once_cell::sync::Lazy;
use parking_lot::Mutex;
use pin_project::pin_project;
use std::{
collections::HashMap,
future::Future,
pin::Pin,
task::{Context, Poll},
time::{Duration, Instant},
};
// TODO(azw): support more executors
#[cfg(feature = "async-std-experimental")]
use async_std::task::{spawn... |
// -*- mode:rust; coding:utf-8-unix; -*-
//! submesh.rs
// Copyright 2016 hanepjiv
// @author hanepjiv <<EMAIL>>
// @copyright The MIT License (MIT) / Apache License Version 2.0
// @since 2016/05/28
// @date 2020/03/19
// ////////////////////////////////////////////////////////////////////////////
// use =====... |
//! Module handling all connections to clients, including REST and Web Sockets.
//! The module will handle requests and interface between the clients and game/lobby as needed.
//#region Modules and Use Statements
mod account_handlers;
mod errors;
mod game_handlers;
mod validation;
use game_handlers::GameCollection;
us... |
// Module that will generate trampoline functions, and type signatures.
// As well as modify the binary to point at the generated trampolines.
use crate::parser::*;
use std::*;
/// Constants for the different opcodes of the WASM Binary we will insert
const WASM_OPCODE_I32: u8 = 0x7F;
const WASM_OPCODE_I64: u8 = 0x7E;... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.