text
stringlengths
3.09k
13.9k
#[cfg(not(feature = "library"))] use cosmwasm_std::entry_point; use cosmwasm_std::{ attr, to_binary, Binary, Coin, CosmosMsg, Decimal, Deps, DepsMut, Env, MessageInfo, Reply, Response, StdError, StdResult, SubMsg, WasmMsg, }; use crate::state::{read_config, store_config, Config}; use anchor_token::collector:...
use crate::{path::image_lib_url, prelude::*}; use awsm_web::canvas::{get_2d_context, CanvasToBlobFuture}; use web_sys::{window, Blob, CanvasRenderingContext2d, HtmlImageElement, HtmlCanvasElement, ImageData}; use wasm_bindgen::JsCast; use shared::{domain::jig::module::body::Image, media::PngImageFile}; pub struct Im...
use net2; use redis; use std::net::SocketAddr; use std::str::from_utf8; use std::sync::Arc; // for boxed() use futures::future::FutureExt; use futures::Future; use tokio; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpListener; use tokio::net::TcpStream; use tokio::sync::mpsc; use tokio::sync::one...
mod camera; mod hit; mod material; mod ray; mod sphere; mod vec; use std::sync::Arc; use rand::prelude::*; use rayon::prelude::*; use camera::Camera; use hit::{Hit, World}; use material::{Dielectric, Lambertian, Metal}; use ray::Ray; use sphere::Sphere; use vec::{Color, Point3, Vec3}; fn random_scene() -> World { ...
#[macro_use] extern crate log; use deno_core::js_check; use deno_core::BufVec; use deno_core::ErrBox; use deno_core::JsRuntime; use deno_core::OpState; use deno_core::ZeroCopyBuf; use futures::future::poll_fn; use futures::future::Future; use serde_json::Value; use std::cell::RefCell; use std::convert::TryInto; use st...
// Copyright 2017 click2stream, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed...
// page_main_mod.rs use unwrap::unwrap; use wasm_bindgen::prelude::*; //use wasm_bindgen::{JsCast, JsValue}; use serde_json::Value; use wasm_bindgen::JsCast; use wasm_bindgen_futures::spawn_local; use crate::on_click; use crate::utils_mod as ut; use crate::web_sys_mod as w; /// fetch and inject HTML fragment into in...
use std::io::{self, Read}; use regex::Regex; #[derive(Copy, Clone, Debug)] struct Item { cost: u16, damage: u16, armor: u16 } impl Item { fn new(cost: u16, damage: u16, armor: u16) -> Item { Item { cost, damage, armor } } } #[derive(Copy, Clone, Debug)] struct Player { hp: u16, d...
// This file is part of Substrate. // Copyright (C) 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 Free S...
// Copyright 2021 The AccessKit Authors. All rights reserved. // Licensed under the Apache License, Version 2.0 (found in // the LICENSE-APACHE file) or the MIT license (found in // the LICENSE-MIT file), at your option. use std::sync::Arc; use accesskit::{ActionHandler, TreeUpdate}; use accesskit_consumer::{Tree, Tr...
use simple_error::bail; use std::error::Error; use std::fmt; pub const CONNACK: [u8; 4] = [0x20, 2, 0, 0]; pub const DISCONNECT: [u8; 2] = [0xE0, 0]; pub const PINGREQ: [u8; 2] = [0xC0, 0]; pub const PINGRESP: [u8; 2] = [0xD0, 0]; #[derive(PartialEq)] pub enum Message { Pingresp, Connack, Publish { ...
// Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use crate::manifest::BlobManifest; use anyhow::{Context, Result}; use assembly_tool::Tool; use assembly_util::PathToStringExt; use fuchsia_pkg::PackageMani...
/// This file contains a simple implementation of the one-time pad. /// It is NOT intended for production usage and has not been extensively verified for it. /// This file is simply an educational tool for AN implementation that works. extern crate rand; // Used to generate random numbers use std::fs::File;...
//! Utilities and other miscellaneous functions for `RuneContext` use r2pipe::r2::R2; use r2api::api_trait::R2Api; use crate::context::rune_ctx::RuneContext; use crate::context::context::{ContextAPI}; use crate::memory::memory::Memory; use crate::memory::seg_mem::SegMem; use crate::regstore::regstore::RegStore; u...
//! Standard Class B Position Report (type 18) use super::navigation::*; use super::parsers::*; use super::radio_status::{ItdmaMessage, RadioStatus, SotdmaMessage}; use super::types::AssignedMode; use super::AisMessageType; use crate::errors::Result; use nom::bits::{bits, complete::take as take_bits}; use nom::combinat...
use crate::io; use crate::client_old::{Action,Email,parse}; use std::net::TcpStream; use native_tls::{TlsStream,TlsConnector}; mod resolve; pub fn send_mail(email:Email) -> Result<(),&'static str> { let actions:Vec<Action>; match parse::init(email.clone()){ Ok(a)=>{ actions = a; },...
use chrono::{DateTime, Utc}; use regex::Regex; use uuid::Uuid; lazy_static! { // Initialise the set of regular expressions we use to clean up broken dates // Feeds may not comply with the specification in various ways (https://tools.ietf.org/html/rfc2822#page-14) static ref RFC2822_FIXES: Vec<(Regex, &'sta...
use bdk::bitcoin::Network; use ini::Ini; use std::env; use structopt::StructOpt; /// Bitcoin tip server configuration options /// /// All options can be set via command line arguments, environment variables or an ini file. #[derive(Debug, StructOpt, Clone, PartialEq)] #[structopt(name = "BTC Tip Server", version = opt...
//! This module contains a trait representing the (real-valued) objective associated with a //! discrete optimization problem. The greedy algorithm contained in this crate is implemented for //! any struct implementing `Objective`. use std::fmt::Debug; use std::hash::Hash; use errors::*; use fnv::FnvHashSet; use setlik...
use crate::common::{prepend_prefix, ConnectionDetails, MessageParseResult, Subscriber}; use anyhow::Result; use lapin::{ message::{Delivery, DeliveryResult}, options::*, Connection, ConsumerDelegate, }; use matrix_bot_api::handlers::{HandleResult, MessageHandler}; use matrix_bot_api::{ActiveBot, MatrixBot, ...
//! Conflict driven clause learning. use partial_ref::{partial, PartialRef}; use varisat_internal_proof::ProofStep; use crate::{ analyze_conflict::analyze_conflict, assumptions::{enqueue_assumption, EnqueueAssumption}, clause::{assess_learned_clause, bump_clause, db, decay_clause_activities}, context...
use std::net::{SocketAddr, SocketAddrV4}; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::tcp::{OwnedReadHalf, OwnedWriteHalf}; use tokio::net::TcpStream; use tokio::task::JoinHandle; use tracing::Instrument; use agent_common::{ClaimIns...
use fftw::array::AlignedVec; use fftw::plan::{C2RPlan, C2RPlan32, R2CPlan, R2CPlan32}; use fftw::types::{c32, Flag}; use nih_plug::prelude::*; use std::f32; use std::pin::Pin; const WINDOW_SIZE: usize = 2048; const OVERLAP_TIMES: usize = 4; struct Stft { params: Pin<Box<StftParams>>, /// An adapter that perf...
use crate::varint; use crate::{label, tags}; use desert::{ToBytesLE, FromBytesLE}; use earcutr; use failure::Error; #[test] fn peer_area() -> Result<(),Error> { let tags = vec![ ("source", "bing"), ("boundary", "protected_area"), ("tiger:cfcc", "A41"), ]; let positions: Vec<f32> = v...
use failure::Error; use num_bigint::{BigInt, BigUint}; use rand::CryptoRng; use rand::Rng; pub trait StaticAccumulator { /// Setup generates a group of unknown order and initializes the group /// with a generator of that group. fn setup<T, R>(rng: &mut R, int_size_bits: usize) -> Self where T: ...
//! //! The Zinc virtual machine `run` subcommand. //! use std::collections::HashMap; use std::convert::TryFrom; use std::fs; use std::path::PathBuf; use num::BigInt; use num::Zero; use structopt::StructOpt; use franklin_crypto::bellman::pairing::bn256::Bn256; use zinc_vm::CircuitFacade; use zinc_vm::ContractFacade...
use super::models::Matche; use std::collections::HashMap; use probability::prelude::*; use probability::distribution::Gaussian; use super::CURRENT_YEAR; const START_SCORE: f64 = 0f64; const NEW_AVG: f64 = 150f64; const SCORE_STD: &'static [f64] = &[17.6, 50.9, 45.6, 24.6, 28.4, 46.2, 24.4, 21.0, 2.7, 28.4, 15.5, 3...
// Copyright 2018-2020 argmin developers // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except according...
extern crate pest; #[macro_use] extern crate pest_derive; use avro_rs::types::Value; use crate::virtual_table::{Cell, Column, DataType, EventqlMappedValue, PrimaryKey, Row, Table, Null}; use std::rc::Rc; use linked_hash_map::LinkedHashMap; use std::collections::HashMap; use crate::error::VirtualTableError; use failur...
use std::mem::size_of; use std::os::raw::c_void; use std::path::Path; use std::ffi::CStr; use image; use image::DynamicImage::*; use image::GenericImage; use cgmath::Zero; use gl; use drawable::Drawable; use shader_manager::ShaderManager; const SKYBOX_VERTICES: [f32; 108] = [ -1.0, 1.0, -1.0, -1.0, -1.0, -1.0, 1...
use wasm_bindgen::prelude::*; use crate::domus::*; use crate::math::random_usize; #[derive(Clone, Copy, Debug, PartialEq)] pub enum CellValue { O, X, Empty, } impl CellValue { pub fn name(&self) -> &str { match *self { CellValue::O => "O", CellValue::X => "X", ...
use std::io; use std::thread; use std::time::{Duration, Instant}; use anyhow::{bail, Result}; use crossbeam_channel::{self as channel, select, Receiver}; use notify::RecommendedWatcher; use termion::{event::Key, input::TermRead, raw::IntoRawMode, screen::AlternateScreen}; use tui::backend::TermionBackend; use tui::lay...
use bytes::Bytes; use string::String; use crate::proto::{Protocol, QoS}; #[repr(u8)] #[derive(Debug, Eq, PartialEq, Copy, Clone)] /// Connect Return Code pub enum ConnectCode { /// Connection accepted ConnectionAccepted = 0, /// Connection Refused, unacceptable protocol version UnacceptableProtocolVer...
#![recursion_limit = "128"] use std::io; use std::net::{IpAddr, SocketAddr}; use futures::{future, Sink, Stream}; use futures_util::sink::SinkExt; use futures_util::stream::StreamExt; use structopt::StructOpt; use tokio::net::{TcpListener, TcpStream}; use tokio_util::codec::{BytesCodec, Framed, FramedParts}; use trac...
use crate::http::HttpConnection; use std::{collections::HashMap, net::SocketAddr, time}; pub struct ConnectionSpeedMeasurement { speeds: [f32; 3], ind: usize, } impl ConnectionSpeedMeasurement { pub fn new() -> ConnectionSpeedMeasurement { return ConnectionSpeedMeasurement { speeds: [...
use std::{collections::HashMap, convert::TryInto, error::Error, num::TryFromIntError}; use crate::{ column::reader::ColumnReader, data_type::{Int64Type, Int96, Int96Type}, errors::ParquetError, record::{ reader::{I64Reader, I96Reader, MapReader}, schemas::TimestampSchema, triple...
// MIT License // // Copyright (c) 2020 <NAME> // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merg...
/// This implementation operates on units of 32 bits. type Unit = u32; const BITS: usize = 32; /// Result of a bit-parallel addition operation. #[derive(Copy, Clone, Debug)] struct AddResult { sum: Unit, carry: Unit, } /// Bit-parallel half-adder. fn half_add(a: Unit, b: Unit) -> AddResult { AddResult { ...
use itertools::Itertools; use nalgebra_glm as glm; use glm::{Vec2, Vec3, Vec4, Mat4}; use winit::event::MouseButton; use triangulate::mesh::Vertex; #[derive(Copy, Clone, Debug)] enum MouseState { Unknown, Free(Vec2), Rotate(Vec2), Pan(Vec2, Vec3), } pub struct Camera { /// Aspect ratio of the win...
//! Real Time For the Masses (RTFM) framework for ARM Cortex-M microcontrollers //! //! This crate is based on [the RTFM framework] created by the Embedded Systems //! group at [Luleå University of Technology][ltu], led by Prof. <NAME>, //! and uses a simplified version of the Stack Resource Policy as scheduling //! po...
// Copyright 2020 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 use super::generated_ops::psa_asymmetric_encrypt::{ Operation as OperationProto, Result as ResultProto, }; use crate::operations::psa_asymmetric_encrypt::{Operation, Result}; use crate::requests::ResponseStatus; use log::er...
extern crate proc_macro; use self::proc_macro::TokenStream; use quote::quote; use syn::{parse_macro_input, Data, DataStruct, DeriveInput, Fields}; /// 2 -> ( $1,$2 ) fn dollar_values(max: usize) -> String { let itr = 1..max + 1; itr.into_iter() .map(|s| format!("${}", s)) .collect::<Vec<Strin...
use std::io::Read; use core::error::AzureRequestError; use hyper::client::Response; use serde_json; header! { (BrokerPropertiesHeader, "BrokerProperties") => [String] } /// /// A list of the properties that the message can have. /// This is not all the possible properties exposed, but it's /// some of the common ones...
mod connection; mod connection_utils; use alvr_common::{prelude::*, ALVR_VERSION}; use alvr_sockets::HeadsetInfoPacket; pub use alxr_engine_sys::*; use lazy_static::lazy_static; use local_ipaddress; use parking_lot::Mutex; use std::ffi::CStr; use std::{ptr, slice, sync::atomic::AtomicBool}; use tokio::{runtime::Runtim...
// Copyright 2020-2021, The Tremor 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 agr...
//use ConfigParser:: // use std::{env, fs, thread}; use std::fs::File; use std::io::Read; use std::os::unix::fs::FileTypeExt; use std::path::{Path, PathBuf}; use std::str; use std::sync::Arc; use std::vec::Vec; use nix::{ unistd, sys::stat::Mode }; use ini::{ Ini, ini::Properties }; use serenity::{ ...
use crate::components::{Component, ComponentParams}; use crate::config::ConfigGroup; use crate::wm::events::{Event, EventId}; use crate::wm::{self, WMUtil}; use gtk::prelude::*; use glib::translate::{ToGlib, from_glib}; use gdk::{Rectangle, WindowExt}; use std::cell::RefCell; use std::rc::Rc; mod autosuggest; use a...
use ::{USIZE_SIZE}; use ::shm::{SharedMemMap, Access as SharedMemAccess}; use platform; use std::{io, mem, thread}; use std::borrow::Borrow; use std::sync::{LockResult, PoisonError}; use std::sync::atomic::{Ordering, AtomicBool}; use uuid::Uuid; /// An analogue of `std::sync::Mutex` which can operate within shared m...
extern crate serde_json; use crate::core::codec::Codec; use crate::jwk::data::Algorithm; use crate::jwk::data::JSONWebKey; use crate::jwk::data::KeyOperation; use crate::jwk::data::KeyType; use crate::jwk::data::KeyUse; use crate::jwk::data::PublicSpecification; use std::str::FromStr; #[derive(Serialize, Deserialize)...
use chrono::TimeZone; use chrono::{DateTime, NaiveDate, NaiveTime}; use clap::Parser; use colour::*; use dialoguer::Confirm; use egg_mode::{self, auth::verify_tokens}; use futures::StreamExt; use indicatif::{self, ProgressBar}; use serde::Deserialize; use std::path::PathBuf; use std::sync::Arc; use tokio::sync::Mutex; ...
use std::fs; use std::path::Path; use std::process::Command; use anyhow::{bail, Context, Result}; use serde::{Deserialize, Serialize}; use crate::net::{self, ConfigNet}; use crate::string_like::StringOrUint; use crate::Error; pub struct Keys { authorized_keys: Vec<String>, key: Option<String>, } impl Keys {...
use cos::poly_cos; use std::ops::{Add, Mul}; /// Calculate sine function with modified Taylor series as approximation approach /// /// /// ```raw /// x^3 x^5 x^7 x^9 x^11 x^13 /// sin(x) = x - --- + --- - --- + --- - ---- + ---- - ... /// 3! 5! 7! 9! 11! 13! /// ```...
//! Provides functionality to manage multiple stacks. use crate::arch::{self, Architecture}; use core::cmp::{max, min}; use core::fmt; use core::mem::size_of; use crate::memory::address_space::{AddressSpace, Segment, SegmentType}; use crate::memory::{MemoryArea, PageFlags, VirtualAddress}; // NOTE: For now only full ...
//! Lookup-tables used by [`Engine`]:s. //! //! All tables are global and each is initialized at most once. //! //! # Tables //! //! | Table | Size | Used in encoding | Used in decoding | By engines | //! | ------------ | ------- | ---------------- | ---------------- | ---------- | //! | [`Exp`] | 128 ki...
use std::os::raw::{c_char, c_int}; use crate::{ bindings::*, mm_allocator::MMAllocator, penalties::AffinePenalties, }; #[derive(Debug, Clone, Copy)] pub enum WavefrontError { InputLengthError, } impl std::fmt::Display for WavefrontError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result...
use std::time::Duration; use cgmath::*; use crate::{ audio, collision, entity::{Entity, GameStatePeek}, event_dispatch::*, map, sprite::rendering, state::{constants::layers, events::Event}, util::Bounds, }; use super::util::HorizontalDir; // ----------------------------------------------...
use std::collections::HashSet; use std::hash::{Hash, Hasher}; use std::iter::{once, FromIterator, Iterator}; fn calc_ones(mut num: usize) -> usize { let mut c = 0; while num > 0 { c += num & 1; num >>= 1; } c } #[derive(Debug, Eq, PartialEq, Clone)] pub struct AssociatedTerm { // 用...
use engine::buffer::{Buffer, InitialData}; use engine::camera::CameraBuffer; use engine::clips::{SceneClip, SceneTarget}; use engine::object::ObjectBuffer; use engine::resources::shader_manager::ShaderManager; use engine::{CreationContext, DepthStencilTarget, FrameContext, RenderTarget2D, Viewport}; use path_abs::PathD...
use super::adjacencylist::AdjacencyListStorage; use super::dense_adjacency::DenseAdjacencyListStorage; use super::disk_adjacency; use super::disk_adjacency::DiskAdjacencyListStorage; use super::linear::LinearGraphStorage; use super::{prepost::PrePostOrderStorage, GraphStatistic, GraphStorage}; use crate::{ errors::...
use rom::RomError; use std::convert::TryInto; use std::ops::Range; use std::path::PathBuf; pub mod rom; pub mod video; pub mod misc; #[derive(Debug)] pub enum MemError { RomError(rom::RomError), InvalidAddressRegion(MemRegion), Invalid2ByteAccess, } pub type MemResult<T> = Result<T, MemError>; impl From...
use std::collections::BTreeMap; use std::io::BufRead; use std::sync::{Arc, Mutex}; use clap::{App, AppSettings, Arg, ArgMatches}; use rayon::prelude::*; use rayon::ThreadPoolBuilder; use rust2vec::prelude::*; use rust2vec::similarity::Analogy; use rust2vec_utils::{read_embeddings_view, EmbeddingFormat}; use stdinout::...
use super::{ lexical_referent::LexicalReferent, scope_walker::{ScopeId, ScopeWalker}, }; use crate::{ front::name_resolution::{resolve_builtin_ty, NameReferents}, parse::ANameId, utils::MapStack, }; use std::collections::HashMap; /// スコープの種類 (名前を探すとき) #[derive(Copy, Clone, Eq, PartialEq, Hash)] pub...
pub mod data; pub mod error; pub mod magic; use std::collections::BTreeMap; use std::collections::btree_map::Range; use std::ops::RangeBounds; use std::path::Path; use bincode::{deserialize_from, serialize}; use serde::Serialize; use tokio::fs::{File, OpenOptions}; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use c...
use cacroix::{ common::shape, dynamic::{ joint::{distance::DistanceJoint, mortor::MortorJoint, Joint}, particle::{self, Material, Particle}, world::{DefaultWorld, World}, }, }; use glutin_window::GlutinWindow as Window; use opengl_graphics::{GlGraphics, OpenGL}; use piston::window::W...
use std::collections::HashMap; use std::ffi::OsString; use std::fs::{File, read_dir}; use std::io::{BufRead, BufReader, ErrorKind, Read, Seek, SeekFrom}; use std::os::unix::ffi::OsStringExt; use std::path::PathBuf; use std::process::Command; use byteorder::{ReadBytesExt, LE}; use failure::{Error, Fail, ResultExt}; us...
// // lib.rs // Copyright (C) 2019 <NAME> <<EMAIL>> // Distributed under terms of the MIT license. // use anyhow::{anyhow, bail, Error}; use std::cell::UnsafeCell; use std::ffi::{c_void, CString}; use std::mem::MaybeUninit; use std::path::Path; mod gsd_bindings; use gsd_bindings::*; #[derive(Clone, Debug)] pub stru...
// Copyright 2017-2019 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate 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) a...
use std::borrow::Cow; use crate::bytes::guess_align_of; use crate::de::{self, Deserialize, Map, Seq, Visitor}; use crate::error::Result; use crate::json::{Array, Number, Object}; use crate::ser::{self, Serialize}; use crate::Place; /// Any valid JSON value. /// /// This type has a non-recursive drop implementation so...
use super::*; use crate::gc::Address; use std::collections::HashSet; pub struct HeapBlock { cell_size: usize, free_list: *mut FreeListEntry, bitset: HashSet<Address>, cursor: Address, pub next: Address, pub prev: Address, storage: u8, } impl HeapBlock { pub fn sweep(&mut self) -> bool {...
use rayon::prelude::*; use serde::{Deserialize, Serialize}; use serde_json::Value as JsonValue; use std::{borrow::Cow, collections::HashMap, fmt}; use tantivy::{ schema::{DocParsingError, FieldValue, Schema, Value}, Document, IndexWriter, Result, Term, }; pub type JsonObject = serde_json::Map<String, JsonValue...
// 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, ...
// Copyright 2018 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 ...
use crate::dots::{Dot, DotOverride}; use crate::BOMBADIL_CONFIG; use anyhow::Result; use colored::Colorize; use config::{Config, ConfigError, File}; use std::collections::HashMap; use std::ops::Not; use std::path::PathBuf; /// The Global bombadil configuration #[derive(Debug, Deserialize, Serialize)] #[serde(deny_unkn...
use core::{ alloc::Layout, ptr, sync::atomic::{AtomicU64, Ordering}, }; #[allow(unused_imports)] use crate::{ object::{ObjID, Protections}, simple_idcounter::IdCounter, syscall::{MapFlags, ThreadSpawnArgs, ThreadSpawnFlags}, }; #[repr(C)] pub struct ThreadRepr { version: u32, flags: u3...
//! Make a minimum space between notes by removing higher-divisor notes. use crate::node::prelude::*; #[derive(Debug, Clone, Serialize, Deserialize)] #[serde(default)] pub struct Space { pub from: BucketId, pub into: BucketId, pub min_dist: MinDist, } impl Default for Space { fn default() -> Self { ...
#![cfg_attr(not(feature = "std"), no_std)] /// Edit this file to define custom logic or remove it if it is not needed. /// Learn more about FRAME and the core library of Substrate FRAME pallets: /// <https://substrate.dev/docs/en/knowledgebase/runtime/frame> use pallet::*; mod types; #[cfg(test)] mod mock; #[cfg(te...
use std::process::Command; use std::env; use std::path::Path; use std::str; use std::fs; use std::io::Write; use serde::{Serialize, Deserialize}; use crate::parser::{CommandType, open_file, parse, get_toml_arr}; macro_rules! needs_rendering { () => { println!("needs re-rendering") }; } #[derive(Se...
use crate::prelude::*; use abscissa_core::{Command, Options, Runnable}; use relayer::config::{ChainConfig, Config}; use relayer::query::channel::query_channel; use relayer_modules::ics24_host::identifier::{ChannelId, PortId}; use crate::commands::utils::block_on; use relayer::chain::tendermint::TendermintChain; use ...
// MakAir // // Copyright: 2020, <NAME> // License: Public Domain License use chrono::{offset::Utc, DateTime, Duration}; use std::collections::{HashMap, VecDeque}; use std::convert::TryFrom; use crate::config::environment::*; use crate::physics::types::DataPressure; use telemetry::alarm::AlarmCode; use telemetry::ser...
use crate::{rounds::LocalKey, types::RoundId}; use chacha20poly1305::{ aead::{Aead, NewAead}, XChaCha20Poly1305, }; use codec::Encode; use curv::elliptic::curves::Secp256k1; use sc_service::{ChainType, Configuration}; use serde::{Deserialize, Serialize}; use sp_core::{sr25519, Pair, Public}; use sp_keystore::{SyncCry...
use ndarray::{Array1, ArrayView1, ArrayViewMut1}; use crate::hogwild::Hogwild; use crate::idx::WordIdx; use crate::loss::log_logistic_loss; use crate::train_model::{NegativeSamples, TrainIterFrom, TrainModel, Trainer}; use crate::vec_simd::scaled_add; /// Stochastic gradient descent /// /// This data type applies sto...
#[macro_use] extern crate nom; use nom::types::CompleteStr; use std::error::Error; use std::io::BufRead; use std::time::Instant; #[derive(Debug, Clone, Copy)] struct Input { instruction: char, requiere: char, } fn bench<T, F>(name: &str, mut f: F) -> T where F: FnMut() -> T, { let start = Instant::no...
use super::*; use std::collections::VecDeque; #[derive(Clone)] pub struct RenderStale(pub bool); impl Default for RenderStale { fn default() -> Self { RenderStale(true) } } #[derive(Clone, Default)] pub struct SavedStates { pub saves: Vec<SaveGameData>, } #[derive(Debug, Copy, Clone, Eq, Partia...
//! Build program to generate a program which runs all the testsuites. //! //! By generating a separate `#[test]` test for each file, we allow cargo test //! to automatically run the files in parallel. use anyhow::Context; use std::env; use std::fmt::Write; use std::fs; use std::path::{Path, PathBuf}; use std::process...
mod utils; use std::char; use std::fmt; use std::io; use std::u64; use std::fs::File; use std::collections::HashMap; use utils::read_lines; const INPUT_FN : &str = "input/day4.txt"; struct Passport { has_required_fields: bool, fields_are_valid: bool, } fn field_validations(field_name: &str, val: &str) -> ...
use openssl::ecdsa::EcdsaSig; use openssl::sha::sha256; use serde::Serialize; use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use crate::acc::AcmeKey; use crate::jwt::*; use crate::req::{req_expect_header, req_handle_error, req_head, req_post}; use crate::util::base64url; use crate::Result; /// JWS paylo...
#![feature(linked_list_cursors)] use std::collections::{LinkedList,HashMap}; use std::sync::{Arc,Mutex}; use std::thread; use std::thread::JoinHandle; use std::time::Duration; use std::mem::drop; use std::process::Command; use rand::Rng; macro_rules! sleep_seconds { ($s:expr) => (thread::sleep(Duration::from_secs($s)))...
// pointer_events.rs // Pointer events (touch screen events) handler use std::any::Any; use std::borrow::BorrowMut; use std::fs::{OpenOptions, File}; use std::io::{Cursor, Read}; use std::path::PathBuf; use std::sync::{RwLock, Arc, Mutex}; use std::thread::{self, Thread, JoinHandle}; use std::time::Duration; use byteo...
use std::fs::File; use std::io; use std::io::prelude::*; use std::ops::{Deref, DerefMut}; use std::path::Path; use std::ptr; use std::time; #[cfg(not(target_arch = "wasm32"))] type Instant = time::Instant; #[cfg(not(target_arch = "wasm32"))] fn now() -> Instant { time::Instant::now() } #[cfg(target_arch = "wasm32...
extern crate colored; use colored::*; use std::time::Instant; use crate::{config::Config, program::Program}; pub fn command_src(program: &Program) -> Result<String, &'static str> { Ok(format!( "{}:\n____________________________\n{}\n____________________________", "Source code".bold(), program.generate_source...
#[cfg(test)] use mock_instant::Instant; use std::time::Duration; #[cfg(not(test))] use std::time::Instant; /** * Token bucket based rate limiting. This is suitable for rate limiting ipc/api calls * and network traffic, while allowing short bursts. * * Tokens are refilled at N tokens per second and there's a bucket...
use std::error::Error; use std::fmt; #[cfg(feature = "gl")] pub use gfx_device_gl::Version as GlslVersion; #[cfg(feature = "metal")] pub use gfx_device_metal::ShaderModel as MetalShaderModel; pub type DxShaderModel = u16; /// Shader backend with version numbers. #[derive(Copy, Clone, Debug, PartialEq)] pub enum Bac...
use crate::puzzle_input; use regex::Match; use regex::Regex; use std::collections::HashMap; use std::ops::RangeInclusive; pub fn run() { let input = puzzle_input::read_string("./input/2020-d16-input1.txt"); let (mut rules, my_ticket, mut tickets) = parse_input(&input); println!("** Part 1 Final: {:?}", va...
use diesel_migrations::embed_migrations; embed_migrations!("migrations/"); use diesel::pg::PgConnection; use diesel::prelude::*; use rand::distributions::Distribution; use rand::{thread_rng, Rng}; use std::time::SystemTime; use uuid::Uuid; use crate::models; #[derive(Debug)] pub struct Letters; impl Distribution<c...
//! Requester side of the protocol //! //! # Note //! //! This **does not** include **any** networking code, such as any code to //! actually request protocol initiation. Also, the request for protocol //! initiation is neither defined nor implemented by this crate. use curve25519_dalek::{ constants::RISTRETTO_BASE...
use std::cell::RefCell; use std::rc::Rc; use clap::{App, Arg, ArgMatches}; use crate::cmd::add_cmd::{add_cmd, get_key}; use crate::cmd::reader::{get_file_reader, EncItFileReader}; use crate::EncItError::InvalidCommand; use crate::{EncItConfig, EncItError, EncItPEM}; pub fn add_identity_cmd<'a>() -> App<'a, 'a> { ...
// Copyright 2020 Google LLC // // 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/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writ...
use std::collections::HashMap; #[macro_use] extern crate log; use simplelog::*; use dkregistry::v2::Client as DKClient; use k8s_openapi::api::core::v1::{Namespace, Pod, Secret}; use kube::{ api::{DeleteParams, ListParams}, Api, Client, ResourceExt, }; use serde::Deserialize; #[tokio::main] async fn main() ->...
#[macro_use] extern crate bitflags; #[macro_use] extern crate log; extern crate clap; extern crate sdl2; extern crate simplelog; use std::error::Error; use std::fs; use std::str; use std::thread::sleep; use std::time::{Duration, Instant}; use clap::{App, Arg}; use log::LevelFilter; use sdl2::audio::{AudioQueue, Audio...
use std::fs::{ File, OpenOptions }; use std::io::{BufReader,SeekFrom}; use std::io::prelude::*; pub trait FileLoaderFile { fn is_valid( &self ) -> bool; fn read_u8( &mut self ) -> u8; fn eof( &self ) -> bool; fn name( &self ) -> &str; fn pos( &self ) -> usize; fn set_pos( &mut self, pos: usize ) -> usize; fn ...