text stringlengths 3.09k 13.9k |
|---|
// Copyright 2018-2021 Parity Technologies (UK) Ltd.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicab... |
use crate::{
bsdf::{Bsdf, BsdfFlags, BsdfSample},
ltc::fit::GGX_LTC_FIT,
texture::Texture,
*,
};
use lazy_static::lazy_static;
mod fit;
#[allow(dead_code)]
pub struct GgxLtcfit {
pub mat: [[Float; 9]; 64 * 64],
pub amp: [Float; 64 * 64],
}
pub struct GgxLtcBsdf {
pub color: Arc<dyn Texture>... |
use rsa::key::*;
use rsa::internals;
use num_traits::{FromPrimitive, ToPrimitive};
use rand::{rngs::ThreadRng, thread_rng};
use num_bigint::BigUint;
use rsa::algorithms::generate_multi_prime_key;
//#[test]
pub fn test_from_into() {
let private_key = RSAPrivateKey {
n: BigUint::from_u64(100).unwrap(),
... |
//! Quad batcher under the hood
use rokol::gfx as rg;
use crate::{
gfx::{draw::*, mesh::DynamicMesh, shaders::DefaultVertex},
utils::bytemuck::{Pod, Zeroable},
};
/// Number of quads in batcher, which is long enough to not be saturated
///
/// NOTE: We can't use ring buffer of vertices with Sokol for some re... |
use lazy_static::lazy_static;
use structopt::StructOpt;
use ukebox::{
Chord, ChordChart, ChordSequence, FretID, FretPattern, Semitones, Tuning, Voicing,
VoicingConfig, VoicingGraph,
};
/// Maximal possible fret ID.
/// According to Wikipedia, the biggest ukulele type (baritone) has 21 frets.
const MAX_FRET_ID:... |
use std::fs::{File, read_dir};
use std::io::{prelude::*, BufReader};
use chrono::{DateTime, Utc, NaiveDateTime};
use chrono::format::ParseError;
use std::fs::create_dir_all;
use super::dateformatter;
use super::splitter;
extern crate serde;
extern crate serde_json;
const ARCHIVE_DIR: &str = "./archive";
const OUTPUT_... |
//! Utility / conveniece functions for commonly use graphical shapes
use scale::Pt;
use Point;
// PDF doesn't understand what a "circle" is, so we have to
// approximate it.
const C: f64 = 0.551915024494;
/// Calculates and returns the points for an approximated circle, given a radius and an
/// offset into the cent... |
use super::ag100_clients::Ag100Clients;
use crate::{
apis::{enums::DialogTypeEnum, services},
base::functions,
config::{self},
forms::bin,
res,
services::client_service,
};
use gtk::prelude::*;
use res::messages::M;
use rsbp_rep::models::MaMandant;
#[derive(Debug, Clone)]
pub struct Ag110Client... |
use eframe::{
egui::{
self, Align2, Button, Color32, CtxRef, Direction, FontDefinitions, FontFamily, Key, Label,
Layout, TopBottomPanel, Vec2, Window,
},
epi,
};
use serde::{Deserialize, Serialize};
use std::{
borrow::Cow,
sync::mpsc::{Receiver, SyncSender},
};
pub const PADDING: f3... |
use crate::check::{FnCtxt, LocalTy, UserType};
use rustc_hir as hir;
use rustc_hir::intravisit::{self, Visitor};
use rustc_hir::PatKind;
use rustc_infer::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
use rustc_middle::ty::Ty;
use rustc_span::Span;
use rustc_trait_selection::traits;
/// A declarat... |
//! Sandbox demo, using a wide range of riddle features to allow quick manual
//! testing of changes.
use riddle::{
common::Color,
input::{InputEvent, KeyboardModifiers, MouseButton, VirtualKey},
math::*,
platform::{PlatformEvent, WindowBuilder},
renderer::*,
*,
};
use std::sync::{Arc, Mutex};... |
use crate::manifest::State;
use snafu::{ResultExt, Snafu};
use std::path::PathBuf;
#[derive(Debug, Snafu)]
#[snafu(visibility = "pub(crate)")]
pub enum CommonErrors {
#[snafu(display("Not-yet-great file {} is not yet tracked!", file.display()))]
FileNotTracked {
file: PathBuf,
source: std::io::... |
use super::*;
use anyhow::*;
use log::*;
use std::fs;
use std::path::PathBuf;
use std::vec::Vec;
use toml::Value;
pub const ZAPFILE: &str = "Build.toml";
#[derive(Debug)]
pub struct Buildfile {
path: PathBuf,
targets: Vec<Target>,
}
impl Default for Buildfile {
fn default() -> Self {
Buildfile {
... |
use crate::dns::header::Header;
use crate::dns::packet::BytePacketBuffer;
use crate::dns::question::Question;
use crate::dns::record::{QueryType, Record};
use std::net::Ipv4Addr;
#[derive(Debug)]
pub struct Packet {
pub header: Header,
pub questions: Vec<Question>,
pub answers: Vec<Record>,
pub authori... |
mod charger;
mod tracer;
mod turret;
use deathframe::geo::Vector;
use super::system_prelude::*;
use crate::settings::prelude::*;
struct PlayerData<'a> {
pub player: &'a mut Player,
pub pos: Vector,
}
pub struct EnemyAiSystem;
impl<'a> System<'a> for EnemyAiSystem {
type SystemData = (
Entiti... |
// Copyright 2020 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
mod shm_streams;
mod shm_vios;
#[cfg(any(target_os = "linux", target_os = "android"))]
pub use self::shm_streams::*;
pub use self::shm_vios::*;
pub ... |
#![no_std]
use bb::*;
use core::convert::TryFrom;
// maze access things
// the static array provides an alternative to
// heap allocation
static mut MAZE: [u8; 0x6400] = [0; 0x6400];
fn getmaze() -> Result<(&'static mut [u8], usize, usize)> {
// get width and height from system
let width = import::maze_getwi... |
// Copyright 2020-2021 <NAME> under the terms of the MIT License as detailed
// in the accompanying file README.md or <https://opensource.org/licenses/MIT>.
//! Traits for texture atlas/array allocator for block textures.
// TODO: Look at this module together with the concrete implementation
// module [`crate::lum::b... |
use super::*;
/// Generate out good tick interval defaults for `i128`.
pub fn compute_ticks(ideal_num_steps: u32, good_ticks: &[u32], range: [i128; 2]) -> TickInfo<i128> {
let (step, good_normalized_step) = find_good_step(good_ticks, ideal_num_steps, range);
let (start_step, step_num) = get_range_info(step, ra... |
use heapless::Vec;
pub trait SliceExt {
fn trim(&mut self, whitespaces: &[u8]);
fn trim_start(&mut self, whitespaces: &[u8]);
}
impl<const L: usize> SliceExt for Vec<u8, L> {
fn trim(&mut self, whitespaces: &[u8]) {
if let Some(first) = self.iter().position(|c| !whitespaces.contains(c)) {
... |
use super::error::SafError;
use crate::prelude::*;
use ai_hash::*;
use aingle_zome_types::ZomeName;
use std::collections::BTreeMap;
/// Wasms need to be an ordered map from WasmHash to a wasm::SafWasm
#[derive(
Clone,
Debug,
PartialEq,
Eq,
serde::Serialize,
serde::Deserialize,
derive_more::... |
//! This module provides a procedural macro to derive JSONValue for custom structs.
//!
//! # Examples
//! ```
//! extern crate json_in_type;
//! #[macro_use] extern crate json_in_type_derive;
//! use json_in_type::JSONValue;
//!
//! #[derive(JSONValue)]
//! struct MyObject {
//! void: (),
//! list: Vec<u8>,
//... |
use std::{collections::HashMap, num::ParseFloatError, path::PathBuf, str::FromStr};
use structopt::StructOpt;
use thiserror::Error;
use wonnx::{
onnx::ModelProto,
utils::{OutputTensor, Shape, TensorConversionError},
SessionError, WonnxError,
};
use wonnx_preprocessing::{
text::{EncodedText, Preprocessin... |
use crate::{
result::Result,
scalar::Uint,
tensor::{float::FloatTensorD, TensorD},
};
use ndarray::Axis;
use serde::{Deserialize, Serialize};
use std::{
fmt::{self, Debug},
iter::empty,
time::{Duration, Instant},
};
/// Criterions
pub mod criterion;
/// KMeans classifier.
#[cfg(feature = "kme... |
use actix_http::{encoding::Decoder, Payload};
use actix_web::client::{Client, ClientResponse};
use actix_web::http::header;
use anyhow::{bail, Result};
use chrono::{Datelike, Local, NaiveDate, NaiveDateTime};
use serde::Deserialize;
use serde::Serialize;
use std::{
collections::{HashMap, HashSet},
time::Duratio... |
use regex::Regex;
use serde::{Serialize, Deserialize};
use crate::types::{PlotParameters, DiagramError, Format};
use std::error::Error;
use crate::types::WSDEnum;
// Represent response from websequence diagram website
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
struct WebSequenceDiagramResponse {
... |
extern crate exoquant;
extern crate image;
extern crate imageproc;
extern crate rayon;
extern crate structopt;
use exoquant::{convert_to_indexed, ditherer, optimizer, Color as ExoColor};
use image::Rgba;
use imageproc::drawing::draw_text_mut;
use rayon::prelude::*;
use rusttype::{FontCollection, Scale};
use std::{erro... |
// 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.
//! This file contains "golden" tests, which compare the output of known sample
//! `Cargo.toml` files with known fixed reference output files.
use {
... |
use std::path::{Path, PathBuf};
use std::iter::Iterator;
use std::fmt::Write;
use walkdir::{WalkDir, DirEntry};
use chrono::{
NaiveDateTime,
Duration,
};
use std::fs::{copy, create_dir};
use crate::ffmpeg_wrapper::{Ffmpeg, FfmpegFileData};
use crate::devices::{DeviceDatetimeGetter, device_metadata_parsers};
... |
use crate::chip8::{Address, Register};
use Instructions::*;
/// All the Chip-8 instructions, with the exception of 0nnn, which is ignored by modern interpreters including this one
#[derive(Debug)]
pub enum Instructions {
/// Clear display
ClearDisplay,
/// Return from subroutine
Return,
/// Jump t... |
use once_cell::sync::OnceCell;
use std::{
convert::TryFrom,
env,
ffi::{OsStr, OsString},
fmt::Display,
io::{self, Write},
path::{Path, PathBuf},
process::{Command, Stdio},
};
pub(crate) enum Selection<T> {
Selected(T),
NoMatch,
Cancelled,
}
#[derive(Debug)]
pub(crate) struct Se... |
//! JIT compilation.
use crate::instantiate::SetupError;
use crate::object::{build_object, ObjectUnwindInfo};
use object::write::Object;
use std::hash::{Hash, Hasher};
use std::mem;
use wasmparser::WasmFeatures;
use wasmtime_debug::{emit_dwarf, DwarfSection};
use wasmtime_environ::entity::EntityRef;
use wasmtime_envir... |
use crate::errors::Result;
use crate::{AsPackage, RpVersionedPackage};
use std::borrow::Cow;
use std::collections::HashMap;
use std::fmt;
use std::result;
use std::slice;
/// Iterator over parts in a package.
#[derive(Debug, Clone)]
pub struct Parts<'a> {
iter: slice::Iter<'a, String>,
}
impl<'a> Iterator for Par... |
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
//
// Portions Copyright 2017 The Chromium OS Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the THIRD-PARTY file.
#![cfg(target_arch = "... |
use std::collections::BTreeSet;
use decorum::R64;
use parry2d_f64::{
bounding_volume::AABB,
query::{Ray as Ray2, RayCast as _},
shape::Segment as Segment2,
};
use parry3d_f64::{
math::Isometry,
query::Ray as Ray3,
shape::{Segment as Segment3, Triangle},
};
use crate::{
debug::{DebugInfo, T... |
#![forbid(missing_docs)]
//! Caw is a library which can armor data using a simple time-sensitive substitution
//! cipher, intended to prevent automated identification of non-English data.
use chrono::{Date, Datelike, Utc};
use rand::prelude::SliceRandom;
use rand_pcg::Pcg64;
use rayon::prelude::*;
// rust-analyzer d... |
use std::{collections::BTreeMap, convert::TryFrom};
use cargo_smart_release::{
changelog,
changelog::{section, section::segment::conventional, Section},
ChangeLog,
};
use git_testtools::hex_to_id;
use nom::AsBytes;
use crate::Result;
#[test]
fn conventional_write_empty_messages() -> Result {
let firs... |
use crate::tentacle::LogLine;
use futures::Async::*;
use futures::{Poll, Stream};
use log::*;
use std::fmt;
use std::fmt::Display;
use std::vec::Vec;
#[derive(Debug)]
pub enum LogStreamError {
DefaultError(String),
}
impl Display for LogStreamError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
... |
// Copyright 2016-2017 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// https://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-... |
use std::collections::HashMap;
use std::fmt::Display;
use std::fmt::Formatter;
pub use self::error::PluginError;
mod error;
#[derive(PartialEq)]
pub enum PluginKind {
Input,
Output,
Transform,
}
pub type PluginResult<T> = Result<T, PluginError>;
#[cfg(feature = "input")]
pub mod input {
use crate::*... |
use std::path::{Path, PathBuf};
use bytes::Bytes;
use futures::{Stream, TryStream, TryStreamExt};
use tokio::{
fs,
io::{AsyncWriteExt, BufWriter},
};
use tokio_util::codec::{BytesCodec, FramedRead};
use crate::sync::RSyncError;
use super::{Entry, RSyncResult, RelativePath};
struct FsPrefix {
base_path: ... |
/*
* Copyright 2018 The Starlark in Rust Authors.
* Copyright (c) Facebook, Inc. and its affiliates.
*
* 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
*
* https://www.apache.org/lic... |
use crate::{Context, Error};
use poise::serenity_prelude as serenity;
fn create_embed<'a>(
f: &'a mut serenity::CreateEmbed,
author: &serenity::User,
name: &str,
description: &str,
links: &str,
) -> &'a mut serenity::CreateEmbed {
f.title(&name)
.description(&description)
.field... |
use serde::de::Error as DeError;
use serde::{Deserialize, Deserializer};
#[cfg(feature = "http")]
use crate::builder::CreateAutocompleteResponse;
#[cfg(feature = "http")]
use crate::http::Http;
use crate::internal::prelude::*;
#[cfg(feature = "http")]
use crate::json;
use crate::json::prelude::*;
use crate::model::app... |
// This example demonstrates how to use the gstreamer editing services.
// This is gstreamer's framework to implement non-linear editing.
// It provides a timeline API that internally manages a dynamically changing
// pipeline. (e.g.: alternating video streams in second 1, 2, and 3)
// Timeline:
// ____________... |
// This file is part of Substrate.
// Copyright (C) 2020-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: Apache-2.0
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// ht... |
use super::resolve_simple;
use crate::{Ctx, Loaded, Loader, Lock, Module, Mut, Ref, Resolver, Result, Script};
use std::{
collections::{hash_map::Iter as HashMapIter, HashMap},
iter::{ExactSizeIterator, FusedIterator},
ops::{Deref, DerefMut},
};
/// Modules compiling data
#[cfg_attr(feature = "doc-cfg", do... |
use crate::models::bank::Bank;
use crate::util::get_client;
use crate::DatabasePool;
use rand::prelude::*;
use serenity::prelude::*;
use serenity::{
framework::standard::{macros::command, Args, CommandResult},
model::channel::Message,
};
#[command]
#[description = "Slot gamble game for worthless internet credi... |
//! Manages the saving and loading of settings, as well as providing menu data and a thread-safe API.
use std::sync::{
atomic::{AtomicBool, Ordering},
Arc,
};
use once_cell::sync::OnceCell;
use crate::{
menu::{self, RowData, RowDetail},
resources,
};
static SETTINGS: OnceCell<Settings> = OnceCell::n... |
use crate::{scheme::on_tx_input, states::States, store::UtxoStore};
use cardano_legacy_address::{AddressMatchXPub, ExtendedAddr};
use chain_impl_mockchain::{
fragment::{Fragment, FragmentId},
legacy::OldAddress,
transaction::{InputEnum, UtxoPointer},
value::Value,
};
use chain_path_derivation::{
rin... |
use aoc_core;
fn hex_to_bin(hex: &str) -> String {
let mut out = String::new();
for c in hex.chars() {
match c {
'0' => out.push_str("0000"),
'1' => out.push_str("0001"),
'2' => out.push_str("0010"),
'3' => out.push_str("0011"),
'4' => out.pus... |
use crate::png::PngImage;
/// An iterator over the scan lines of a PNG image
#[derive(Debug, Clone)]
pub struct ScanLines<'a> {
iter: ScanLineRanges,
/// A reference to the PNG image being iterated upon
raw_data: &'a [u8],
}
impl<'a> ScanLines<'a> {
pub fn new(png: &'a PngImage) -> Self {
Self... |
//! Duel.
use super::*;
use super::super::proto;
/// Поединок.
#[derive(Clone, Debug, ProtobufConvert)]
#[exonum(pb = "proto::Duel", serde_pb_convert)]
pub struct Duel {
/// Ключ поединка.
pub key: PublicKey,
/// Ключ арбитра.
pub arbiter_key: PublicKey,
/// Ключ играка 1.
pub player1_key: ... |
// Copyright 2014 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-MIT or ... |
// Copyright (c) 2018-2021 The MobileCoin Foundation
//! Object representing trusted storage for tx out records.
//! Mediates between the bytes used in ORAM and the protobuf format,
//! the various ORAM vs. fog api error codes, etc.
use alloc::vec;
use aligned_cmov::{
subtle::{Choice, ConstantTimeEq},
typenu... |
extern crate rlp;
extern crate secp256k1;
#[macro_use]
extern crate lazy_static;
#[macro_use]
extern crate clap;
extern crate rand;
extern crate crypto;
use std::io::{ self, Read, Write };
use std::net::{ Ipv4Addr, AddrParseError };
use std::ops::Deref;
use std::time;
use std::net::UdpSocket;
use std::fs::File;
use st... |
use crate::tagvalue::{DecodeError, DecoderBuffered, Message};
use futures::future::Fuse;
use futures::future::Ready;
use futures::select;
use futures::{AsyncRead, AsyncReadExt, FutureExt};
use futures_timer::Delay;
use std::io;
use std::time::Duration;
use std::time::Instant;
/// Asynchronous, executor-agnostic low-le... |
extern crate rand;
extern crate time;
use std::io;
use std::f64;
use std::io::prelude::*;
fn trapezoids_v1<F>(data: (f64, f64, i64), f: F) -> f64
where F: Fn(f64) -> f64
{
let (a, b, n) = data;
let mut sum: f64 = 0.0;
let h = (b - a) / n as f64;
let xk = |k: i64| a + k as f64 * h;
for i in 0..n... |
use std::collections::BTreeMap;
use imgref;
use rgb;
use crate::{
image::ImageStore,
paint::MultiStopGradient,
Color,
ErrorKind,
ImageFlags,
ImageId,
ImageInfo,
ImageSource,
Renderer,
};
/// GradientStore holds image ids for multi-stop gradients. The actual image/textures
/// are ... |
use std::cell::RefCell;
use std::collections::HashMap;
use std::rc::Rc;
type NodeRef = Rc<RefCell<Node>>;
type Link = Option<NodeRef>;
struct Node {
key: i32,
value: i32,
freq: usize,
prev: Link,
next: Link,
}
impl Node {
fn new(key: i32, value: i32) -> Self {
let freq = 1;
le... |
use enigmap::{HexMap, Hex, RATIO};
mod basic;
mod ogl;
mod sprite;
mod vector;
pub mod colors;
pub mod image;
pub use self::basic::Basic;
pub use self::ogl::OGL;
pub use self::sprite::*;
pub use self::vector::Vector;
pub use self::image::{Image, ColorMode};
const HALF_RATIO: f32 = RATIO / 2.0;
const QUARTER_RATIO: f... |
use core::ops::Deref;
use super::*;
use crate::{
fs::{FileSystem, Ufs},
kernel::{kernel_ref, KernelRef},
vm::UserMemory,
};
/// Type that stores the context of the current thread. Consists of
/// * `KernelRef<'id, 'p>`, which points to the current kernel, and
/// * `CurrentProc<'id, 'p>`, which points to ... |
use std::error::Error;
use std::fmt;
/// Basic type for errors returned from the server.
#[derive(Debug, EnumConvertFromInt, EnumError, PartialEq)]
#[EnumConvertFromIntFallback = "Unimplemented"]
pub enum ZkError {
/// This code is never returned from the server. It should not be used other than to indicate a
... |
// Copyright 2019-2022 ChainSafe Systems
// SPDX-License-Identifier: Apache-2.0, MIT
/// Filecoin RPC client interface methods
pub mod auth_ops;
pub mod chain_ops;
pub mod mpool_ops;
pub mod net_ops;
pub mod state_ops;
pub mod sync_ops;
pub mod wallet_ops;
use async_std::sync::RwLock;
use forest_libp2p::{Multiaddr, P... |
use holo_hash::*;
use holochain_p2p::event::GetActivityOptions;
use holochain_sqlite::rusqlite::*;
use holochain_state::{prelude::*, query::QueryData};
use holochain_zome_types::Judged;
use holochain_zome_types::*;
use std::fmt::Debug;
use crate::authority::*;
#[derive(Debug, Clone)]
pub struct GetAgentActivityQuery ... |
use crate::mesh::{FaceKey, MapFaceToCells, Mesh};
use russell_lab::sort4;
use std::collections::HashMap;
/// Extracts all faces (internal and boundary)
///
/// # Output
///
/// * Returns a map relating face keys to `Vec<(cell_id, f)>` where:
/// - `cell_id` -- is the id of the cell sharing the face
/// - `f` -... |
//! Configuring and running NSD.
use std::{fmt, io};
use std::fs::File;
use std::net::{IpAddr, SocketAddr};
use std::path::{Path, PathBuf};
use std::string::String;
use std::vec::Vec;
use bytes::Bytes;
use crate::utils::base64;
//------------ Config --------------------------------------------------------
/// NSD c... |
use crate::client::MpesaResult;
use crate::constants::{CommandId, IdentifierTypes};
use crate::{Mpesa, MpesaError, MpesaSecurity};
use serde::{Deserialize, Serialize};
use serde_json::Value;
#[derive(Debug, Serialize)]
/// Account Balance payload
struct AccountBalancePayload<'a> {
#[serde(rename(serialize = "Initi... |
//!
//! The semantic analyzer scope type item.
//!
pub mod index;
pub mod state;
pub mod statement;
use std::cell::RefCell;
use std::fmt;
use std::rc::Rc;
use zinc_lexical::Keyword;
use zinc_lexical::Location;
use crate::generator::statement::Statement as GeneratorStatement;
use crate::semantic::analyzer::statement... |
//! vest state
use crate::vest_schedule::create_vesting_schedule;
use bincode::{self, deserialize, serialize_into};
use chrono::prelude::*;
use chrono::{
prelude::{DateTime, TimeZone, Utc},
serde::ts_seconds,
};
use serde_derive::{Deserialize, Serialize};
use solana_sdk::{account::AccountSharedData, instruction... |
//! Support for BigML data sets.
use bigml::resource::{Dataset, Id, Source};
use std::{fmt, str::FromStr};
use crate::common::*;
mod data_type;
mod local_data;
mod schema;
mod source;
mod write_local_data;
use local_data::local_data_helper;
use schema::schema_helper;
use write_local_data::write_local_data_helper;
... |
use std::collections::HashMap;
use async_trait::async_trait;
use rusoto_core::RusotoError;
use rusoto_dynamodb::{
AttributeValue,
BatchGetItemError,
BatchGetItemInput,
BatchGetItemOutput,
DynamoDb,
KeysAndAttributes,
};
const DYNAMODB_MAX_BATCH_GET_ITEM_SIZE: usize = 100;
#[async_trait]
pub t... |
// Copyright (c) 2017 <NAME>, RWTH Aachen University
// <NAME>, RWTH Aachen University
//
// MIT License
//
// 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 restr... |
//! Coord implementation and manipulation.
use std::slice;
use crate::common::size::Size;
/// A Coord representation.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, PartialOrd, Ord)]
pub struct Coord {
pub x: usize,
pub y: usize,
}
impl Coord {
/// Creates a new Coord.
pub fn new(x: usize, y: u... |
// Copyright (c) 2021 The vulkano developers
// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or
// https://www.apache.org/licenses/LICENSE-2.0> or the MIT
// license <LICENSE-MIT or https://opensource.org/licenses/MIT>,
// at your option. All files in the project carrying such
// notice may not be ... |
extern crate wasm_bindgen;
use wasm_bindgen::prelude::*;
extern crate rust_nes_emulator;
use rust_nes_emulator::prelude::*;
#[wasm_bindgen]
extern "C" {
// Use `js_namespace` here to bind `console.log(..)` instead of just
// `log(..)`
#[wasm_bindgen(js_namespace = console)]
fn log(s: &str);
// Th... |
// Copyright 2019-2021 Parity Technologies (UK) Ltd.
// This file is part of Cumulus.
// Cumulus is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any l... |
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
enum Direction {
UP,
DOWN,
LEFT,
RIGHT,
}
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub struct Vector {
head: Point,
tail: Point,
}
#[derive(Debug, Eq, PartialEq, Copy, Clone)]
pub struct Move {
direction: Direction,
value: i64,
}
#[deri... |
use core::cell::Cell;
use core::mem;
use gpio;
use kernel;
use kernel::common::VolatileCell;
use kernel::common::take_cell::TakeCell;
use kernel::hil;
use kernel::hil::Controller;
use nvic;
use rcc;
#[repr(C, packed)]
struct USARTRegisters {
sr: VolatileCell<u32>,
dr: VolatileCell<u32>,
brr: VolatileCell<u... |
//!
//! Common traits and structs for layers
//!
use crate::relish::RelishTag;
use crate::repository::{BlockNumber, ZenithWalRecord};
use crate::{ZTenantId, ZTimelineId};
use anyhow::Result;
use bytes::Bytes;
use serde::{Deserialize, Serialize};
use std::fmt;
use std::path::PathBuf;
use zenith_utils::lsn::Lsn;
// Si... |
use std::cmp::max;
use image::{self, Rgb};
use image::{ImageBuffer, RgbImage};
use imageproc;
use imageproc::drawing;
use imageproc::point::Point;
fn main() {
let white = Rgb([255, 255, 255]);
let black = Rgb([0, 0, 0]);
// The dimension of the output image
let dims = (3840, 2160);
// The minim... |
// Copyright 2013 The gl-rs developers. For a full listing of the authors,
// refer to the AUTHORS file at the top-level directory of this distribution.
//
// 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 t... |
use std::borrow::Borrow;
use std::cmp::{max, Ord};
use std::collections::{BTreeMap, btree_map};
use std::default::Default;
use std::fmt;
use std::iter::FromIterator;
use std::mem;
use std::time::SystemTime;
use timestamp;
use serde_json::Value as Json;
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(untagge... |
use crate::{
basic_block::BasicBlockId,
ir::{
builder::IRBuilder,
function::Function,
module::Module,
opcode::{Instruction, Opcode},
remove_unreachable_block::RemoveUnreachableBlockOnFunction,
value::Value,
},
};
use std::collections::VecDeque;
// use rustc_ha... |
use weasel::ability::ActivateAbility;
use weasel::actor::{Action, Actor, ActorRules, AlterAbilities};
use weasel::battle::{BattleController, BattleRules, BattleState};
use weasel::character::{AlterStatistics, Character, CharacterRules};
use weasel::entity::{EntityId, Transmutation};
use weasel::entropy::Entropy;
use we... |
use super::control_logic::*;
use logicsim::*;
pub struct ComputerIO {
pub ig: InitializedGateGraph,
pub clock: LeverHandle,
pub reset: LeverHandle,
pub ack: LeverHandle,
pub input: WordInput,
pub write_input: LeverHandle,
pub input_busy: OutputHandle,
pub output: OutputHandle,
pub o... |
extern crate ransid;
use std::collections::{BTreeSet, VecDeque};
use std::ptr;
use orbclient::{Event, EventOption};
use syscall::error::*;
use crate::display::Display;
use crate::screen::Screen;
pub struct TextScreen {
pub console: ransid::Console,
pub display: Display,
pub changed: BTreeSet<usize>,
... |
// This file is part of Substrate.
// Copyright (C) 2017-2021 Parity Technologies (UK) Ltd.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the F... |
use crate::fs;
use de::deserialize_color_hex_string;
use serde::Deserialize;
use std::cmp::Ordering;
pub async fn load_user_themes() -> Vec<Theme> {
log::debug!("loading user themes");
fs::load_user_themes().await
}
#[derive(Debug, Clone, Deserialize)]
pub struct Theme {
pub name: String,
pub palette... |
//! Hadron client.
pub mod pipeline;
pub mod publisher;
pub mod subscriber;
use std::collections::BTreeMap;
use std::str::FromStr;
use std::sync::Arc;
use anyhow::{Context, Result};
use arc_swap::ArcSwap;
use futures::prelude::*;
use tokio::sync::{broadcast, watch};
use tokio_stream::wrappers::BroadcastStream;
use t... |
use std::f32;
use sdl2::pixels::PixelFormatEnum;
use sdl2::surface::Surface;
use crate::game::Game;
use crate::game::GameComponent;
use crate::game::GameOpts;
use crate::vector::Vec2f;
use crate::rays::RayGenerator;
use crate::textures::TextureLoader;
use crate::map;
pub struct Camera {
fov_ang: f32,
view_d... |
use std::fs;
use minifb::{Key, KeyRepeat, Window, WindowOptions};
use rand::random;
fn hue_to_rgb(p: f64, q: f64, t:f64) -> f64 {
let mut t = t;
if t < 0.0 { t += 1.0 }
if t > 1.0 { t -= 1.0 }
if t < 1.0/6.0 {
p + (q - p) * 6.0 * t
} else if t < 1.0/2.0 {
q
} else if t < 2.0/3.... |
// LNP/BP client-side-validation library implementing respective LNPBP
// specifications & standards (LNPBP-7, 8, 9, 42)
//
// Written in 2019-2021 by
// Dr. <NAME> <<EMAIL>>
//
// To the extent possible under law, the author(s) have dedicated all
// copyright and related and neighboring rights to this software to
... |
//! A modified version of https://github.com/dalek-cryptography/ed25519-dalek which uses
//! custom base point instead of a default base point.
use crate::{
cryptography_core::codec_wrapper::{
CompressedRistrettoDecoder, CompressedRistrettoEncoder, ScalarDecoder, ScalarEncoder,
},
errors::{ErrorKin... |
use crate::type_ident::{TypeIdent, TypeOrNested};
use std::collections::BTreeMap;
use std::convert::TryFrom;
use std::error::Error;
use std::fmt;
use std::fmt::{Display, Formatter};
use syn::{Data, DataEnum, Fields, FieldsNamed, Meta, NestedMeta};
// SanitizerError is a custom error type that includes
// info on why p... |
use std::fmt::{self, Debug, Display, Formatter, Write};
use std::str::FromStr;
use crate::advent_adapters::AdventState;
type ParserResult<'a, O> = nom::IResult<&'a str, O, nom::error::VerboseError<&'a str>>;
#[derive(Debug, Copy, Clone)]
enum Operation {
Add,
Mul,
}
#[derive(Debug, Clone)]
enum Token {
... |
use std::fs;
use std::io::Read;
use std::error::Error;
use std::fmt;
use minidom::Element;
use walkdir::WalkDir;
#[derive(Debug)]
pub struct WrongDirError;
impl fmt::Display for WrongDirError {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", &self.description())
}
}
... |
//! Lib3h custom error definition.
use crate::transport::error::TransportError;
use lib3h_crypto_api::CryptoError;
use lib3h_ghost_actor::{Backtwrap, GhostError};
use lib3h_p2p_protocol::error::P2pError;
use lib3h_protocol::error::{ErrorKind as Lib3hProtocolErrorKind, Lib3hProtocolError};
use rmp_serde::decode::Error ... |
use std::{collections::HashSet, env, fs};
#[allow(unused_imports)]
use itertools::Itertools;
fn main() {
let args: Vec<String> = env::args().collect();
let mut reversed_args: Vec<_> = args.iter().map(|x| x.as_str()).rev().collect();
reversed_args
.pop()
.expect("Expected the executable na... |
use crate::error::AutoReqError;
use elf::types::{Class, Machine, ELFCLASS64, EM_FAKE_ALPHA, SHT_GNU_HASH, SHT_HASH};
use elf::ParseError;
use std::collections::BTreeSet;
use std::ffi::OsString;
use std::io::{BufRead, BufReader, Read};
use std::path::Path;
use std::process::{Command, Stdio};
#[derive(Debug)]
struct Elf... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.