text
stringlengths
3.09k
13.9k
use std::{ sync::{ atomic::{AtomicUsize, Ordering}, Arc, }, thread, }; use sabi_core::{JobHandlerRw, System}; use sabi_math::Matrix4; use sabi_messenger::MessengerRw; use sabi_resources::{DataTypeResource, Resource, SharedData, SharedDataRc}; use sabi_serialize::generate_random_uid; use cr...
use crate::{Channel, Delivery, ErrorKind, FieldTable, Result}; use crossbeam_channel::Receiver; use std::cell::Cell; /// Options passed to the server when starting a consumer. /// /// The [`default`](#impl-Default) implementation sets all boolean fields to false and has an empty /// set of arguments. #[derive(Clone, D...
pub mod converters; mod default_plugins; pub mod renderer; mod webgl2_render_pass; mod webgl2_renderer; mod webgl2_resources; use crate::renderer::WebGL2RenderResourceContext; use bevy::app::{prelude::*, Events}; use bevy::window::{WindowCreated, Windows}; pub use default_plugins::*; use std::sync::Arc; pub use webgl2_...
#![allow(non_snake_case)] #![allow(non_camel_case_types)] //! Backtracking allocator: the as-yet-unallocated VirtualReg LR prio queue. use core::cmp::Ordering; use alloc::collections::BinaryHeap; use alloc::string::String; use alloc::vec::Vec; use crate::alloc::string::ToString; use crate::data_structures::{TypedIxV...
// Copyright 2020 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, modify, mer...
use std::thread; use std::time::Duration; use serenity::framework::standard::{macros::command, Args, CommandResult}; use serenity::model::guild::Guild; use serenity::model::prelude::{ChannelId, Member, Message, RoleId, User}; use serenity::prelude::*; pub static SHADOW_REALM_CHANNEL_ID: ChannelId = ChannelId(21529407...
//! Plugin host for Fornjot models //! //! Fornjot models are loaded into the Fornjot application as plugins. This //! crate contains the code required to host plugins. #![deny(missing_docs)] mod platform; use std::{ collections::{HashMap, HashSet}, ffi::OsStr, io, path::PathBuf, process::Command...
#![deny(unused_must_use)] // A common serialization library used in the blockchain space, which we'll use to serialize our // cross chain message payloads. use borsh::{ BorshDeserialize, BorshSerialize, }; // Solana SDK imports to interact with the solana runtime. use solana_program::account_info::{ next_...
//! Commonly-used structs that multiple modules use. use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; #[cfg(test)] /// Tests for the structs. Each test is named after the function and/or struct /// it tests, prefixed with test. mod tests { use std::{env, fs, path::Path}; use super::{Confi...
#![feature(once_cell)] #![feature(cell_update)] //! Dependency-Free Iterator Extension Trait with accompanying struct to make !Clone Iterators with Clone elements into a Clone Iterator mod symbol { use std::lazy::SyncLazy; use std::sync::Mutex; use std::cell::Cell; #[derive(Default, Clone, Copy)] ...
use std::collections::HashMap; use crate::components::{Info, Parent, Root, TransformMatrix}; use itertools::Itertools; use legion::{component, system, world::SubWorld, Entity, EntityStore, IntoQuery}; use nalgebra::Matrix4; #[system] #[write_component(TransformMatrix)] #[read_component(Parent)] #[read_component(Info)...
// 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...
// Copyright 2016 <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 writing, ...
use super::commitments::{Commitments, MultiCommitGens}; use super::group::GroupElement; use super::scalar::{Scalar, ScalarFromPrimitives}; use super::transcript::{AppendToTranscript, ProofTranscript}; use merlin::Transcript; use serde::{Deserialize, Serialize}; // ax^2 + bx + c stored as vec![a,b,c] // ax^3 + bx^2 + c...
use clap::{App, Arg, ArgMatches}; use std::fs::{File, OpenOptions}; use std::io::{self, Seek, SeekFrom, Write}; use std::path::Path; use std::process; use thiserror::Error; use n64rom::convert::{self, ConvertStatus}; use n64rom::rom::{Endianness, Rom}; use n64rom::stream::Writer; use n64rom::util::{FileSize, MEBIBYTE}...
use futures::stream::StreamExt; use kube::Resource; use kube::ResourceExt; use kube::{api::{ListParams, PatchParams, Patch}, client::Client, Api}; use kube_runtime::controller::{Context, ReconcilerAction}; use kube_runtime::Controller; use tokio::time::Duration; use serde_json::{json}; use std::fmt; use kube::core::obj...
//! API for human-readable encoding of programs. //! Syntax: //! * Words (such as `input`, `output` and `cloak`) are operation names. //! * `0x...` is a hex-encoded `push` operation. //! * `[...]` is a sub-program. //! * `{...}` is a contract. use std; use std::fmt; use crate::constraints::Commitment; use crate::cont...
use std::ops::{Add, Deref}; use std::str::FromStr; use time::{Date, Duration, OffsetDateTime, Weekday}; use std::fmt::{Display, Formatter, Result as FmtResult}; #[derive(Debug, PartialEq, PartialOrd)] pub struct SmartDate { now: Date, date: Date, } impl FromStr for SmartDate { type Err = String; fn ...
//! Error types used throughout this library use std::error::Error; use std::fmt; /// Errors that can occur when creating a histogram. #[derive(Debug, Eq, PartialEq, Clone, Copy)] pub enum CreationError { /// Lowest discernible value must be >= 1. LowIsZero, /// Lowest discernible value must be <= `u64::ma...
mod hessian; extern crate nom; use std::fs::{File, read}; use std::io::prelude::*; use nom::bytes::complete::take; use nom::number::complete::{be_u32, be_u16, be_u8, be_f32}; use nom::error; use nom::Err; use nom::error::ErrorKind; use std::cmp::min; #[derive(Debug, PartialEq)] struct JavaClass { header: Header...
use crate::*; /// How many TLS sessions should we store in memory /// for session resumption on both client and server? const MEM_SESSION_STORAGE: usize = 512; /// Callback function signature for proxy accept/deny. pub type AcceptProxyCallbackFn = Arc<dyn Fn(CertDigest) -> MustBoxFuture<'static, bool> + 'static +...
extern crate rayon; use rayon::prelude::*; // const WIDTH : usize = 3; const WIDTH : usize = 4; const WM : usize = WIDTH - 1; const WP : usize = WIDTH + 1; const SIZE : usize = WIDTH * WIDTH; // const GOAL : i32 = 21; // const CHOICES : [i32; SIZE] = [3,4,5,6,7,8,9,10,11]; const GOAL : i32 = 34; const CHOICES : [i32...
/// Define Board and Pieces /// Boards and games have a 1:1 ratio /// Boards are made up of 25 Pieces use std::fmt::{self, Formatter, Display}; use rand::{thread_rng, Rng}; use rand::distributions::{Sample, Range}; pub const BOARD_DIMENSIONS: i32 = 4; // representation of the playing board #[derive(Debug)] pub struc...
//! Transparency, visibility sorting and camera centroid culling for 3D Meshes. use std::cmp::Ordering; use amethyst_core::{ ecs::{systems::ParallelRunnable, *}, math::{convert, distance_squared, Matrix4, Point3, Vector4}, transform::Transform, Hidden, HiddenPropagate, }; use indexmap::IndexSet; use se...
// Copyright 2017 Mozilla // // 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 writing, software...
//! Interaction with the Cloudflare API. //! //! This module implements the necessary GET and PUT //! requests to update a DNS record programmatically. use std::any; use std::error; use std::fmt; use std::net; use anyhow::anyhow; use anyhow::Context; use serde::Deserialize; use serde::Serialize; static CLOUDFLARE_AP...
//! Utilities to asynchronously stream JSON in actix //! use { actix_http::{Response, ResponseBuilder}, actix_web::web::Bytes, futures::{Stream, StreamExt}, serde::Serialize, std::fmt::Debug, }; /// https://en.wikipedia.org/wiki/Maximum_transmission_unit#Ethernet_maximum_frame_size const ETHERNET_...
use amethyst::{ assets::AssetStorage, ecs::{Entities, Entity, Join, Read, ReadStorage, System, World, Write, WriteStorage}, shred::{ResourceId, SystemData}, shrev::EventChannel, }; use derivative::Derivative; use derive_new::new; use sequence_model::{ loaded::{WaitSequence, WaitSequenceHandle}, ...
use syn::{self, *}; use syn::fold::Fold; use syn::spanned::Spanned; use proc_macro::Span; use quote::ToTokens; struct AssertFolder { ident: Ident, push_count: usize, startpos: usize, } impl Fold for AssertFolder { fn fold_expr(&mut self, expr: Expr) -> Expr { match expr { // Expr::...
#[path = "../src/arm7tdmi.rs"] mod arm7tdmi; #[path = "../src/decode.rs"] mod decode; #[path = "../src/exec.rs"] mod exec; mod bus { pub struct Bus { mem: [u8; 0x400] } impl Bus { pub fn new() -> Self { Bus { mem: [0; 0x400] } } pub ...
// Copyright 2021 - <NAME> <<EMAIL>> // SPDX-License-Identifier: Apache-2.0 use crate::nymd::GasPrice; use cosmrs::tx::{Fee, Gas}; use cosmrs::Coin; use serde::{Deserialize, Serialize}; use std::fmt; #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] #[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, S...
use crate::manifests::ApixRequest; use crate::requests::{make_request, AdvancedBody, RequestOptions}; use super::dialog::Dialog; use super::template::{MapTemplate, StringTemplate, ValueTemplate}; use super::{ApixKind, ApixManifest}; use anyhow::Result; use indexmap::IndexMap; use reqwest::header::{HeaderMap, HeaderNam...
//! IO functions use super::core::{Relationship, SysDiagram, Table}; use super::parser; use std::convert::TryFrom; use std::io::Error as IoError; use std::io::{Cursor, Read, Seek}; use base64::decode as base64_decode; use base64::DecodeError as Base64DecodeError; use cfb::CompoundFile; use displaydoc::Display; use ms_...
use super::{ ButtplugDeviceResultFuture, ButtplugProtocol, ButtplugProtocolCommandHandler, ButtplugProtocolCreator, }; use crate::{ core::errors::ButtplugDeviceError, device::{ configuration_manager::DeviceProtocolConfiguration, ButtplugDeviceEvent, DeviceSubscribeCmd, DeviceUnsubscribeCmd, ...
/*! Utilities to transform chunks. */ use std::{collections::HashMap, ops::RangeInclusive}; /// Transforms a list of `values` into a list /// of ranges of contiguous sequences of same values. /// # Example /// ```ignore /// use std::collections::HashMap; /// /// let values = vec![1, 1, 2, 2, 1, 3, 3]; /// let groups ...
// Copyright 2018-2019 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 std::{ collections::HashMap, fs::{self, File}, process::{self, Command}, str, sync::mpsc, thread, time::Duration, }; use futures::{ future, stream::Stream, Future, }; use hyper::{ service::service_fn, Body, Method, Response, Server, }; use rbx_dom_weak::{...
use std::path::PathBuf; use std::process::Command; /// The builder for the `git init` command created by calling `Git::init()` pub struct GitInitBuilder { quiet: bool, bare: bool, template: Option<PathBuf>, initial_branch: Option<String>, separate_git_dir: Option<PathBuf>, object_format: Option<Hash>, sh...
// Copyright (C) 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 // // http://www.apache.org/licenses/LICENSE-2.0 ...
use anyhow::Result; use chrono::{Duration, Local}; use log; use std::{ fs::OpenOptions, io::{BufReader, BufWriter}, }; use structopt::StructOpt; use tokio::sync::mpsc; use tokio::time::sleep; mod center; mod district; mod notification; mod state; use center::CentersResponse; use notification::NotificationMessa...
use derivative::Derivative; use std::cmp::Reverse; use std::collections::hash_map::Entry; use std::collections::{BinaryHeap, HashMap, HashSet}; use crate::entity::storage::{AsStorage, Enumerate, Get}; use crate::entity::traverse::Adjacency; use crate::entity::view::{Bind, Unbind}; use crate::entity::EntityError; use c...
use sha2::{Digest, Sha256}; use std::fs; use std::io; use std::path::Path; #[derive(Clone, Copy, Debug)] pub enum Base { Base2, // IEC Base10, // SI } fn round_up(value: f64, precision: usize) -> f64 { let multiplier = 10u64.pow(precision as u32) as f64; (value * multiplier).ceil() / multiplier } pu...
/* * Asana * * This is the interface for interacting with the [Asana Platform](https://developers.asana.com). Our API reference is generated from our [OpenAPI spec] (https://raw.githubusercontent.com/Asana/developer-docs/master/defs/asana_oas.yaml). * * The version of the OpenAPI document: 1.0 * * Generated by: ...
use crate::web3util; use clap::ArgMatches; use core::fmt; use std::borrow::Cow; use std::convert::TryFrom; use std::time::Duration; use std::vec::Vec; use web3::contract::{Contract, Options}; use web3::futures::Future; use web3::types::{Address, H256, U256}; use web3::Transport; #[derive(RustEmbed)] #[folder = "src/co...
use futures::StreamExt; use ntex::{ http::Method, util::BytesMut, web::{ error, get, types::Data, types::{Path, Payload}, Error, HttpRequest, HttpResponse, }, }; use num_traits::FromPrimitive; use peace_constants::{api::UpdateUserTask, GameMode}; use peace_database::Datab...
//! Implements a Twitch client for relaying. //! //! Built on the twitchchat library for Twitch API intercommunication. use std::{option::Option, sync::Arc}; use futures::task::FutureObj; use serde_derive::Deserialize; use tokio::sync::{ mpsc::{channel, Receiver, Sender, UnboundedReceiver}, Mutex, }; use traci...
//! Get git commits with help of the libgit2 library const RUST_SRC_URL: &str = "https://github.com/rust-lang/rust"; const RUST_SRC_REPO: Option<&str> = option_env!("RUST_SRC_REPO"); use std::env; use std::ops::Deref; use std::path::Path; use chrono::{TimeZone, Utc}; use anyhow::{bail, Context}; use git2::build::Rep...
//! Ellie for Discord //! //! Ellie is a bot for the Discord chat platform focused on giving users //! a powerful set of features, while remaining quick to respond. mod commands; mod listeners; mod utilities; use commands::extra::sloc::*; use commands::extra::weather::*; use commands::fun::ascii::*; use commands::fun...
/* * Copyright 2020 Draphar * * 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 writi...
/* * 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 clap; extern crate fxhash; extern crate serde_json; use crate::dachshund::algorithms::betweenness::Betweenness; use cr...
use scraper::{Html, Selector}; use std::io::{BufRead, BufReader}; use std::{ env, fs::{self, File}, io::Write, }; fn main() { let args: Vec<String> = env::args().collect(); let bdu_codes = parse_report(); let mut result = get_vuln_list(bdu_codes); let mut bdu = false; get_capecs(&mut re...
use crate::transflow::transflow::{Flow, Mapping}; use crate::transflow::Transflow; pub struct JsFlowGen {} /// generate from typescript interface /// ```javascript /// el.setAttribute('entries', JSON.stringify({ // items: ['blog', 'todo'] // })); // el.setAttribute('data', JSON.stringify(data)); /// ``` #[d...
extern crate polygon_io; use crate::util::MarketDays; use chrono::{NaiveDate, Utc, Duration}; use polygon_io::{ client::Client, equities::trades::Trade }; use std::{ collections::HashSet, io::ErrorKind, process, sync::{Arc, Mutex}, time::Instant }; use threadpool::ThreadPool; use zdb::{ schema::{Column,...
const RAM_SIZE: usize = 16 * 1024; // 32KiB pub struct Emulator<'a> { pub ram: RAM, alu: ALU, reg: Registers, rom: &'a [u16], pc: u16, } impl<'a> Emulator<'a> { pub fn new(rom: &'a [u16]) -> Self { Emulator { ram: RAM::new(), alu: ALU::default(), reg...
use na::{DVector, Point2}; use std::iter; use crate::bounding_volume::AABB; use crate::math::{Real, Vector}; use crate::shape::Segment; #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] #[derive(Clone, Debug)] /// A 2D heightfield. pub struct HeightField { heights: DVector<Real>, scale: Vector<R...
use async_trait::async_trait; use cosmicverge_shared::protocol::{self, navigation::ActivePilot}; use database::{ basws_server::{self, prelude::*}, cosmicverge_shared::protocol::{ cosmic_verge_protocol_version_requirements, OAuthProvider, Permissions, Request, Response, }, schema::{convert_db_pil...
// Copyright 2016 <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 thos...
use std::collections::{HashMap}; use wasm_bindgen::prelude::*; use std::cell::RefCell; use std::mem::transmute; use std::hash::{Hash}; thread_local!( static FLOAT_CACHE: Cacher<BitwiseFloat> = Cacher::new(); static STRING_CACHE: Cacher<&'static str> = Cacher::new(); static BOOL_CACHE: Cacher<bool> = Cacher::new(); ...
use crate::op::{Op, OpType}; pub struct Compiler { ops: Vec<Op>, out: String, } impl Compiler { pub fn new(ops: Vec<Op>) -> Compiler { Compiler { ops, out: String::new(), } } pub fn compile(&mut self) -> String { self.emit(format!( "/* G...
use crate::logic_prelude::*; #[derive(Debug, PartialEq, Clone, Copy)] pub struct Stats { health: u16, attack: u16, defense: u16, wisdom: u16, speed: u16, nature: u16, demon: u16, } impl Stats { pub fn new(health: u16, attack: u16, defense: u16, wisdom: u16, speed: u16, nature: u16, dem...
// Copyright 2021 <NAME> <<EMAIL>> // // 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 t...
use anyhow::{Result}; use boringauth::pass::is_valid; use serde::{Deserialize, Serialize}; use tokio::sync::{mpsc::Receiver, mpsc::Sender}; use shared::{login::LoginCredentials, remote_conn_packet::*}; use super::user::User; const SECRET_KEY: &[u8; 8] = b"openlink"; #[derive(Serialize, Deserialize)] struct Claims { ...
extern crate num; use self::num::traits::{Num, FromPrimitive, ToPrimitive}; #[cfg(test)] mod tests; // enums used in interpolator constructor pub enum FunctionType { Static, Linear, Quadratic, Cubic, } pub enum Repeat { Once, Bounce, Wrap, } mod control { use std::rc::Rc; use std...
/// Templates: Base strings, into which nouns can be inserted. pub const TEMPLATES: &[&str] = &[ "\x1F ahead", "\x1F required ahead", "be wary of \x1F", "try \x1F", "weakness: \x1F", "visions of \x1F...", "\x1F", "\x1F!", "\x1F?", "\x1F...", "hurrah for \x1F!", ]; /// Conjun...
#[macro_use] extern crate lazy_static; extern crate bytes; extern crate futures; extern crate actix_web; extern crate openssl; extern crate mime; extern crate mime_guess; extern crate mime_sniffer; extern crate json; use actix_web::{server, server::ServerFlags, App, HttpRequest, HttpResponse, AsyncResponder, Error, Bod...
use std::collections::HashMap; use ty; use ir; use common; use ir::IdentifierId; use errors::TranslationError; use trans::{self, typeck, TranslationResult}; use codemap::{Span, Spanned}; macro_rules! error { ($err:expr, $span:expr) => { Err(Spanned::new($err, $span)) } } #[derive(Debug, Clone)] pub s...
use crate::{ math::*, utils::*, BoundingBox, DefaultVisible, GeometryHitResult, IntersectResult, Intersectable, Material, PartialScatterResult, Primitive, Ray, ScatterResult, SkinnedHitResult, Texture, TimeDependentBounded, }; use std::sync::Arc; pub trait MediumDensity: Send + Sync + std::fmt::Debug { ...
//! Xl reader //! //! Reading Xl files use std::{ fs::File, io::{Cursor, Read, Seek}, }; use async_trait::async_trait; use super::{Cell, Workbook, XlConsumer, XlExecutor, XlSource, UNSUPPORTED_TYPE}; use crate::{value, Fabrix, FabrixError, FabrixResult, FromSource, ReadOptions, Value, D2}; // ==============...
use std::cell::RefCell; use std::marker; use thiserror::Error; pub type Dfu<C> = dfu_core::sync::DfuSync<DfuLibusb<C>, Error>; #[derive(Debug, Error)] pub enum Error { #[error("Could not find device or an error occurred.")] CouldNotOpenDevice, #[error(transparent)] Dfu(#[from] dfu_core::Error), #[...
use error::*; use rocksdb::{WriteBatch, DB}; use serde::{de::DeserializeOwned, Deserialize, Serialize}; use silk_proto::*; use crate::keys::{ construct_block_hash_key, construct_block_num_key, construct_check_point_key, CheckPoint, }; use std::ops::Range; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct...
#![allow(dead_code)] use libc::*; pub type T1Foo = i32; pub const T1S: &str = "foo"; pub const T1N: i32 = 5; macro_rules! i { ($i:item) => { $i }; } #[repr(C)] pub struct T1Bar { pub a: i32, pub b: u32, pub c: T1Foo, pub d: u8, pub e: [i64; T1N as usize], pub f: [[i64; 2]; T...
use crate::element::Tet4Element; use crate::geometry::proptest::Triangle3dParams; use crate::geometry::Orientation::Counterclockwise; use crate::mesh::procedural::create_rectangular_uniform_quad_mesh_2d; use crate::mesh::QuadMesh2d; use ::proptest::prelude::*; use fenris_geometry::Triangle3d; use nalgebra::{Point2, Poi...
use crate::arbitraries::queries::queries::{ ArbitraryMutationInfo, ArbitraryQueryInfo, InputInfo, QueriesArbitrary }; pub fn assert_correct_result( result_json: &serde_json::Value, selection_name: &str, input_infos: &Vec<InputInfo> ) -> Result<bool, Box<dyn std::error::Error>> { let dat...
pub enum Exterpolation { Linear, Saturation, } fn point_linear_interp<T: Into<f64> + Copy, S: Into<f64> + Copy>( x: T, x0: T, y0: S, x1: T, y1: S, ) -> f64 { y0.into() + (x.into() - x0.into()) * (y1.into() - y0.into()) / (x1.into() - x0.into()) } pub fn series_linear_interp<X: Into<f64...
// e::engine::Layer // by <NAME>, 2019 use canvas::{Canvas,Framebuffer}; /// graphics layer. pub struct Layer<'a> { pub canvas: &'a Canvas, pub x0: f32, pub y0: f32, pub xs: f32, pub ys: f32, pub framebuffer: Framebuffer, } impl<'a> Layer<'a> { pub fn new(canvas: &'a Canvas, width: u32,he...
/// Represents an external LibRetroCore. use backend::lib; use std::io; use std::fs::File; use std::str::Utf8Error; use std::path::Path; use std::io::Read; use retro_types::*; use backend::callbacks::*; // Core interface pub struct LibRetroCore { library: lib::Library, } // Error handling #[derive(Debug)] pub ...
use std::io; use std::io::prelude::*; use std::fs::File; use std::fs; use common::err; //const F32_ZERO: f32 = 1.0e-40_f32; pub fn min_index<T: PartialOrd>(list: &Vec<T>) -> Option<usize> { let mut min_value = None; let mut min_index: usize = 0; let mut index: usize = 0; for i in list { m...
use super::error::UError; use super::hash::Hash; use super::proof::{Proof, ProofStep}; use super::update::Update; use merlin::Transcript; #[derive(Clone, PartialEq)] pub struct Utreexo { pub roots: Vec<Option<Hash>>, } impl Utreexo { pub fn new() -> Utreexo { return Utreexo { roots: Vec::...
use std::sync::Arc; use parquet2::{ encoding::Encoding, metadata::{ColumnChunkMetaData, ColumnDescriptor}, read::{ levels::{get_bit_width, split_buffer_v1, split_buffer_v2, RLEDecoder}, Page, PageHeader, StreamingIterator, }, }; use super::super::nested_utils::*; use super::super::util...
/* * Copyright 2019 The Exonum Team * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed...
use crate::cache::LayerType; use crate::coordinates; use crate::mapfile::MapFile; use crate::terrain::raster::{GlobalRaster, Raster, RasterCache}; use anyhow::Error; use atomicwrites::{AtomicFile, OverwriteBehavior}; use crossbeam::channel::{self, Receiver, Sender}; use futures::future::{self, BoxFuture, FutureExt}; us...
//! Handlers for the C callbacks from the LibRetro core itself. //! These are generally unsafe, and have to use a global callback in order to talk to the main //! application. use retro_types::RetroPixelFormat; use retro_types::RetroEnvironment; use retro_types::RawRetroVariable; use backend::state::get_current_backe...
#[macro_use] extern crate log; #[macro_use] extern crate lazy_static; use dotenv; use std::env; use std::error::Error; use std::sync::Arc; use tonic::transport::Server; use r2d2_redis::{r2d2, RedisConnectionManager}; use diesel::{ r2d2::{Pool, ConnectionManager}, pg::PgConnection }; use rauth::metadata::{ ...
use bindings::Bindings; use fact_table::FactTable; use program::Program; use std::mem::swap; use truth_value::TruthValue; use types::{Clause, ClauseIndex}; #[derive(Copy, Clone, Debug)] enum FactSource { EDB, IDB, LastIter, } fn match_clause<T>(last_iter: Option<&FactTable<T>>, idb: Opt...
use ring::aead; use ring::rand::*; use ring::digest; use ring::pbkdf2; use base64::encode; use base64::decode; use std::str::from_utf8; static ALGORITHM_NAME: &'static aead::Algorithm = &aead::AES_128_GCM; const ALGORITHM_NONCE_SIZE: usize = 12; const ALGORITHM_TAG_SIZE: usize = 16; const ALGORITHM_KEY_SIZE: usize = 1...
use super::command::Command; use super::message::Message as KrakenWsMessage; use crate::errors::KrakenError; use base64::{decode as b64decode, encode as b64encode}; use failure::Fallible; use fehler::{throw, throws}; use futures::sink::Sink; use futures::stream::Stream; use futures::task::{Context, Poll}; use log::trac...
use anyhow::Error; use chrono::{DateTime, NaiveDate, Utc}; use futures::future::try_join_all; use log::debug; use postgres_query::{query, query_dyn, FromSqlRow, Parameter}; use serde::{Deserialize, Serialize}; use stack_string::StackString; use std::collections::HashMap; use crate::common::pgpool::PgPool; #[derive(Se...
use std::collections::BTreeMap; use std::fs::File; use std::io::prelude::*; use std::io::{BufReader, LineWriter, Lines}; use std::path::Path; pub fn parse_fasta_id(path: &str) { let ids = get_ids(path); let mut records: Vec<IDs> = Vec::with_capacity(ids.len()); ids.iter().for_each(|r| { let mut fas...
//! Create anonymous POSIX shared memory objects. //! //! This crate is only works on `unix` targets and is `no_std` compatible. #![cfg(unix)] #![no_std] // Inspired by https://github.com/lassik/shm_open_anon (ISC license, Copyright 2019 <NAME>) use libc::c_int; #[cfg(not(any(target_os = "freebsd", target_os = "andro...
//! Module for broadcasting when an entity comes within //! range of a player. Also handles sending the correct //! packet to spawn entities on the client. //! //! Sending entities to a client is handled lazily //! through `LazyUpdate`, because arbitrary components //! may need to be accessed. use crate::chunk_logic::...
use span::Span; macro_attr_many! { /// An index pointing to the n-th bit of a `#` value (or, an `u32` value). #[cfg_derive!(Clone, Debug)] pub struct BitIndex { span: Span, index: u8, } } impl BitIndex { /// Create a new `BitIndex` with the given `span` and the given `index` if ...
use crate::InnerAtom; use lyon::path::Path; use lyon::tessellation::geometry_builder::simple_builder; use lyon::tessellation::math::point; use lyon::tessellation::{FillOptions, FillTessellator}; use std::collections::HashMap; pub use lyon::tessellation::{geometry_builder::VertexBuffers, math::Point, TessellationError...
use advent_2019::Result; use std::cmp::Ordering; use std::collections::HashMap; use std::f64::consts::PI; use std::fs::File; use std::hash::{Hash, Hasher}; use std::io::prelude::*; type Point = (i32, i32); #[derive(Debug, Copy, Clone)] struct Slope { delta_x: f64, delta_y: f64, } impl Slope { fn val(&sel...
use std::error::Error; use std::fmt; /// The result of a given letter at a specific location. There is some complexity here when a /// letter appears in a word more than once. See [`GuessResult`] for more details. #[derive(Debug, Eq, PartialEq, Clone, Copy, Hash)] pub enum LetterResult { /// This letter goes exact...
// Copyright 2015-2018 Aerospike, Inc. // // Portions may be licensed to Aerospike, Inc. under one or more contributor // license agreements. // // 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 ...
use base64::encode; use hex::encode as h_encode; use rand::random; #[derive(Debug, Serialize, Deserialize)] pub struct SuperProperties<'a> { os: &'a str, browser: &'a str, device: &'a str, system_locale: &'a str, browser_user_agent: &'a str, browser_version: &'a str, os_version: &'a str, ...
use toshi::{ cluster::{self, Consul}, commit::IndexWatcher, index::IndexCatalog, router::router_with_catalog, settings::{Settings, HEADER}, }; use clap::{crate_authors, crate_description, crate_version, App, Arg, ArgMatches}; use futures::{future, sync::oneshot, Future, Stream}; use log::{error, in...
use std::collections::BTreeMap; use std::fs; use std::io::BufWriter; use std::path::PathBuf; use std::time::Duration; use std::time::SystemTime; use measureme::{MatchingEvent, ProfilingData}; use serde::{Serialize, Serializer}; use structopt::StructOpt; fn as_micros<S: Serializer>(d: &Duration, s: S) -> Result<S::Ok...
// 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...
use std::fmt; use crate::{error, Config}; use crate::types::{FormData, Header, Para, Proxy, RoUrl, ToRoUrl}; #[derive(Clone, Debug)] pub struct Request { closed: bool, count: u32, config: Config, url: Option<RoUrl>, method: String, paths: Vec<String>, paras: Vec<Para>, formdatas: Vec<FormData>, head...