text
stringlengths
3.09k
13.9k
use super::constants::{CRED_DEF, GET_CRED_DEF}; use super::did::ShortDidValue; use super::identifiers::cred_def::CredentialDefinitionId; use super::identifiers::schema::SchemaId; use super::{get_sp_key_marker, ProtocolVersion, RequestType}; use crate::common::error::prelude::*; use crate::utils::qualifier::Qualifiable;...
// 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 w...
use serde::{de, Deserialize, Deserializer, Serialize, Serializer}; #[allow(unused_imports)] use super::{EntityInstance, Level}; use bevy::prelude::*; use regex::Regex; use crate::ldtk::color; #[derive(PartialEq, Debug, Clone, Serialize)] pub struct FieldInstance { /// Field definition identifier #[serde(rena...
use std::{convert::TryInto, path::Path}; use git_actor::{Sign, Signature, Time}; use git_lock::acquire::Fail; use git_object::bstr::ByteSlice; use git_testtools::hex_to_id; use tempfile::TempDir; use super::*; use crate::{file::WriteReflog, FullNameRef}; type Result<T = ()> = std::result::Result<T, Box<dyn std::erro...
//! Asynchronously listen to the Windows clipboard and send delay-rendered data to it. //! //! # Example //! //! ``` //! use windows_clipboard_async::*; //! //! #[tokio::main(flavor = "current_thread")] //! async fn main() { //! let clipboard = WindowsClipboard::init().await.unwrap(); //! //! let mut watch = cl...
//! CRC calculation unit //! //! This unit is modeled after the [corresponding unit in the stm32l4xx-hal](https://github.com/stm32-rs/stm32l4xx-hal/blob/master/src/crc.rs). //! //! Usage example: //! ``` //! let crc = dp.RCC.constrain(); //! //! // Lets use the CRC-16-CCITT polynomial //! let mut crc = crc.polynomial(c...
#[macro_use] extern crate serde; extern crate json_patch; extern crate serde_json; extern crate simple_error; use simple_error::{bail, try_with}; use serde::Deserialize; use std::error::Error; use std::fs::File; use std::io; use std::io::{BufReader, BufWriter}; use std::path::Path; use niffler; use json_patch::{di...
#![allow(clippy::int_plus_one)] #![allow(clippy::many_single_char_names)] #![allow(clippy::assertions_on_constants)] use crate::all_of; use rand::prelude::*; #[test] fn any_of_with_map_comparisons_give_correct_result_for_operator_equal() { // test very simple expressions assert_eq!(all_of!({2,4,6}.satisfy(|x|...
// 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. use super::{ BaseElement, ElementDigest, ElementHasher, FieldElement, Hasher, Rp64_256, StarkField, ALPHA, INV_ALPHA, STATE_WIDTH,...
use linked_hash_map::LinkedHashMap; /// The type representing the inferred structure /// /// A word of caution: Everything in this crate is "internal API", but for this type in particular, /// since it is very central to how json_typegen works, /// be prepared that major breaking changes may need to be made to this in...
// Copyright (c) 2017 <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 restriction, including // without limitation the rights to...
// 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. use std::{ convert::TryInto as _, io, mem, num::TryFromIntError, os::unix::io::AsRawFd as _, time::Duration, }; // TODO(48913): Migrate clients to...
use super::{RasterQueryRectangle, VectorQueryRectangle}; use crate::concurrency::{ThreadPool, ThreadPoolContext, ThreadPoolContextCreator}; use crate::engine::{RasterResultDescriptor, ResultDescriptor, VectorResultDescriptor}; use crate::error::Error; use crate::mock::MockDatasetDataSourceLoadingInfo; use crate::source...
extern crate rand; extern crate timely; extern crate differential_dataflow; #[macro_use] extern crate abomonation_derive; extern crate abomonation; #[macro_use] extern crate serde_derive; extern crate serde; use rand::{Rng, SeedableRng, StdRng}; use timely::dataflow::*; use timely::dataflow::operators::probe::Handl...
use crate::context::DiscordContext; use futures::sink::SinkExt; use futures::stream::StreamExt; use flate2::{Decompress, FlushDecompress}; use http::Request; use minnie_errors::*; use rand::seq::SliceRandom; use serde::*; use std::net::SocketAddr; use std::time::{Instant, Duration}; use tokio::net::TcpStream; use tokio...
use std::collections::HashSet; use expr::Expression; use expr::Character; #[derive(Debug, PartialEq, Clone)] pub enum ExpectedChar { Specific(char), Wildcard, Any(Vec<Character>), None(Vec<Character>) } #[derive(Debug, PartialEq, Clone)] pub enum State { Success, // In order to transition to...
//! Functions to detect subgraph features. //! //! The rationale of this module revolves around the concept of feature declaration and detection. //! //! Features are declared in the `subgraph.yml` file, also known as the subgraph's manifest, and are //! validated by a graph-node instance during the deploy phase or by ...
// Unless explicitly stated otherwise all files in this repository are licensed // under the MIT/Apache-2.0 License, at your convenience // // This product includes software developed at Datadog (https://www.datadoghq.com/). Copyright 2021 Datadog, Inc. use anyhow::*; use lazy_static::lazy_static; use serde::{Deserial...
use std::{mem::size_of, num::NonZeroU64}; use crate::{ client::render::{pipeline::Pipeline, ui::quad::QuadPipeline, GraphicsState}, common::util::any_as_bytes, }; #[repr(C, align(256))] #[derive(Clone, Copy, Debug)] pub struct PostProcessUniforms { pub color_shift: [f32; 4], } pub struct PostProcessPipel...
use std::fs::{read, File}; use std::io::BufWriter; use std::path::Path; use anyhow::Result; use anyhow::Context; use nom::multi::count; use nom::number::complete::le_i64; use nom::IResult; use crate::fst_impls::vector_fst::VectorFstState; use crate::fst_impls::VectorFst; use crate::fst_traits::{ArcIterator, CoreFst, ...
use anyhow::anyhow; use regex::Regex; use std::ffi::OsString; use std::fmt::Formatter; use std::fs::{read_dir, OpenOptions}; use std::io::{BufRead, BufReader, ErrorKind, Write}; use std::path::PathBuf; pub struct KoanConfiguration { pub base_path: PathBuf, } impl KoanConfiguration { pub fn new<P: Into<PathBuf...
use core::fmt::{self, write, Write}; use nom::{branch::permutation, number::complete::le_u32}; use crate::parser::{ parser_common::*, tx_input::{OutPoint, TxInput}, tx_output::TxOutput, }; use crate::zxformat; pub type TxTuple<'a> = ( u32, // version number arrayvec::ArrayVec<[&'a [u8]; MAX_TX_IN...
// Copyright (c) 2013-2016 Sandstorm Development Group, Inc. and contributors // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the right...
//! Defines the data types used to create noise modules. use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; use std::str::FromStr; use noise::{Constant, MultiFractal, RangeFunction, RidgedMulti, Seedable, Worley}; use super::error; /// Copied from https://doc.rust-lang.org/std/hash/ fn ca...
// This example demonstrates how to get a raw video frame at a given position // and then rescale and store it with the image crate: // {uridecodebin} - {videoconvert} - {appsink} // The appsink enforces RGBA so that the image crate can use it. The image crate also requires // tightly packed pixels, which is the case...
// Copyright 2020-2020 <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 wr...
use rusty_machine::learning::gp::{ConstMean, GaussianProcess}; use rusty_machine::learning::{toolkit::kernel, SupModel}; use rusty_machine::linalg::{Matrix, Vector}; use tokio::runtime::{self}; use tokio::task::JoinHandle; pub fn multiple_gps( x_input_ptr: *mut f64, y_input_ptr: *mut f64, input_size: usiz...
// MMC2, a somewhat advanced bank switcher with extended CHR memory // https://wiki.nesdev.com/w/index.php/MMC2 use ines::INesCartridge; use memoryblock::MemoryBlock; use mmc::mapper::*; use mmc::mirroring; pub struct PxRom { pub prg_rom: MemoryBlock, pub prg_ram: MemoryBlock, pub chr: MemoryBlock, p...
use super::{ header::BlockHeader, header_slice_status_watch::HeaderSliceStatusWatch, header_slices::{HeaderSlice, HeaderSliceStatus, HeaderSlices}, }; use crate::{ kv, kv::{tables::HeaderKey, traits::MutableTransaction}, }; use anyhow::format_err; use parking_lot::RwLock; use std::{ ops::{Contro...
use crate::{didcore::*, AsymmetricKey, Payload}; use super::{generate_seed, Ecdh, Ecdsa}; use secp256k1::{Message, PublicKey, SecretKey, SharedSecret, Signature}; use sha2::{Digest, Sha256}; pub type Secp256k1KeyPair = AsymmetricKey<PublicKey, SecretKey>; impl Secp256k1KeyPair { pub fn from_seed(seed: &[u8]) -> ...
#[derive(Clone, PartialEq, ::prost::Message)] pub struct BigInt { #[prost(bytes="vec", tag="1")] pub bytes: ::prost::alloc::vec::Vec<u8>, } #[derive(Clone, PartialEq, ::prost::Message)] pub struct Block { /// Firehose block version (unrelated to Arweave block version) #[prost(uint32, tag="1")] pub v...
use std::fmt::{self, Display}; use std::fs; use std::path::{Path, PathBuf}; use super::{debug_already_fetched, info_fetched, Tool}; use crate::error::ErrorDetails; use crate::fs::{delete_dir_error, delete_file_error, dir_entry_match}; use crate::path; use crate::session::Session; use crate::shim; use crate::style::{su...
use std::collections::HashMap; use std::{fs, process}; use anyhow::{bail, format_err, Error}; use serde::Deserialize; use structopt::StructOpt; use crate::common::{ChartType, TimeFrame}; use crate::theme::Theme; use crate::widget::KagiOptions; pub fn resolve_opts() -> Opts { let mut opts = get_cli_opts(); i...
// Copyright (c) 2016 rust-threshold-secret-sharing developers // // Licensed under the Apache License, Version 2.0 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT // license <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your // option. All files in the project carrying such notic...
//! This implements the core logic of the compression scheme used to compactly //! encode the Unicode character classes. //! //! The primary idea is that we 'flatten' the Unicode ranges into an enormous //! bitset. To represent any arbitrary codepoint in a raw bitset, we would need //! over 17 kilobytes of data per cha...
// Copyright 2020 ADVANCA PTE. 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 applicable law or agreed to in ...
/* * The MIT License (MIT) * * Copyright (c) 2015 <NAME> (<EMAIL>) * * 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 ...
//! `start` subcommand - start the light node. use crate::application::app_config; use crate::config::{LightClientConfig, LightNodeConfig}; use crate::rpc; use crate::rpc::Server; use abscissa_core::config; use abscissa_core::path::PathBuf; use abscissa_core::status_err; use abscissa_core::status_info; use abscissa_c...
// 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 crate::crypto_primitives::SignatureScheme; use algebra::{ bytes::ToBytes, fields::{Field, PrimeField}, groups::Group, to_bytes, }; use digest::Digest; use failure::Error; use rand::{Rand, Rng}; use std::{ hash::Hash, io::{Result as IoResult, Write}, marker::PhantomData, ops::Sub, }; ...
use memflow::os::process::*; use memflow::prelude::v1::*; use libc::{iovec, pid_t, sysconf, _SC_IOV_MAX}; use std::ffi::c_void; #[derive(Clone, Copy)] #[repr(transparent)] struct IoSendVec(iovec); unsafe impl Send for IoSendVec {} #[derive(Clone)] pub struct ProcessVirtualMemory { pid: pid_t, temp_iov: Box<...
use glow::*; use glutin::event::{Event, VirtualKeyCode, WindowEvent}; use glutin::event_loop::ControlFlow; const SCR_WIDTH: u32 = 800; const SCR_HEIGHT: u32 = 600; pub fn main_1_2_2() { unsafe { let event_loop = glutin::event_loop::EventLoop::new(); let window_builder = glutin::window::Windo...
// Copyright 2019 Cargill Incorporated // // 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 agre...
use super::super::query_graph::{JoinRef, QueryGraph, QueryGraphEdge}; use super::helpers::predicate_implication::predicate_is_equivalent; use super::ReuseType; use nom_sql::ConditionTree; use std::collections::HashSet; use std::vec::Vec; #[derive(Debug, Clone)] struct JoinChain { join_order: Vec<JoinRef>, tabl...
use lazy_static::lazy_static; use regex::Regex; use std::env; use std::fs; lazy_static! { static ref HGT_RE: Regex = Regex::new( r"(?x) (?P<height>\d+) # the year (?P<unit>\D+) # the month ", ) .unwrap(); static ref HCL_RE: Regex = Regex::new(r"^#[[:xdigit:]]{6}...
// 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...
/* * Copyright 2020 Skyscanner Limited. * * 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...
extern crate core; use std::fs::File; use std::iter::Iterator; use std::io::{Read}; use self::core::str::FromStr; #[derive(Clone, Copy)] enum TaxiRotation { Left, Right, } #[derive(Clone, Copy, PartialEq, Debug)] enum TaxiOrientation { North, East, South, West, } type Position = (i64, i64); ...
use crate::clamp; use crate::core::PurrShape; use crate::graphics::raster::rasterize_quad_bezier; use crate::graphics::{Point, Scanline, Shape}; use crate::{Rgba, RgbaImage}; use rand::{Rng, RngCore, SeedableRng}; use rand_distr::StandardNormal; #[derive(Debug, Clone, Copy)] pub struct Quadratic { pub p0: Point, ...
use super::ArchMmuSpec; use crate::architecture::Endianess; use crate::types::{clamp_to_usize, umem, Address}; /// The `ArchMmuDef` structure defines how a real memory management unit should behave when /// translating virtual memory addresses to physical ones. /// /// The core logic of virtual to physical memory tran...
use std::cell::{Cell, Ref, RefCell, RefMut}; use std::rc::{Rc, Weak}; /// A type that can have and break cycles. pub trait Manage { // TODO: Replace with AVec /// Updates `traces` with all the GC-tracked references directly accessible /// to this object. fn trace<'a>(&'a self, traces: &mut Vec<&'a Gc<S...
#[cfg(test)] #[macro_use] extern crate lazy_static; use std::collections::HashMap; use std::fs::File; use std::io::{BufRead, BufReader}; use std::iter::IntoIterator; const INPUT_FILE: &'static str = "./input/input_06.txt"; type Coord = (i32, i32); fn read_file() -> Vec<String> { let f = File::open(INPUT_FILE).u...
extern crate rand; use rand::Rng; use std::collections::{HashMap, HashSet}; use crate::result_store::*; use crate::search_result::*; /// A navigable small world graph defined /// by a sparse edge set and a flat vector set, one for each vertex. pub struct NavigableSmallWorldGraph { pub edges: HashMap<usize, Vec<u...
//! Manage nix-generated Cargo workspaces. use crate::{ config, prefetch::PrefetchableSource, resolve::{CratesIoSource, GitSource}, }; use anyhow::{bail, format_err, Context, Error}; use semver::Version; use std::{ borrow::Cow, path::{Path, PathBuf}, }; use std::{fs::File, io::BufRead, process::Com...
use std::fmt::{Display, Formatter}; use std::fs::{File, remove_file}; use std::path::Path; use std::process::{ExitStatus, Stdio}; use anyhow::Error; use async_trait::async_trait; use emoji::symbols::alphanum::INFORMATION; use emoji::symbols::other_symbol::{CHECK_MARK, CROSS_MARK}; use reqwest::Client; use serde::{Dese...
use std::fmt::Display; /// In Rust generics are type parameters for you structs, enums, types, impls, and functions. This is an /// example for a generic parameter for a struct. struct OptionalVector<T>(Option<Vec<T>>); // A `impl` block defines all of its generic parameters directly after the `impl` keyword. This //...
//! run rust code on the rust-lang playground use crate::{ api, commands::{Args, Result}, }; use reqwest::header; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::str::FromStr; const MAX_OUTPUT_LINES: usize = 45; #[derive(Debug, Serialize)] struct PlaygroundCode<'a> { channel...
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use crate::isolate_state::*; use crate::msg; use crate::ops; use crate::resources; use crate::resources::Resource; use crate::resources::ResourceId; use crate::startup_data; use crate::workers; use crate::workers::WorkerBehavior; use deno_core::...
use std::fmt; use std::fmt::{Display, Formatter}; use crate::{Node, TypeName, InitializerList}; #[derive(Debug, Clone, PartialEq, Eq)] pub enum Constant { Integer(Integer) } #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Integer { U8(u8), I8(i8), U16(u16), I16(i16), U32(u32), I32(i...
use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::PathBuf; #[derive(Debug, Clone)] enum Element { Value(usize), Pair(Vec<Element>), } #[derive(Debug)] struct Explosion { x: usize, y: usize, left: Option<usize>, right: Option<usize>, } impl Element { fn get_left(&self) -...
use crate::{ encryption::ElGamal, helper::Helper, types::{Cipher, ModuloOperations, PublicKey}, }; use num_bigint::BigUint; use num_traits::One; #[cfg(feature = "std")] use serde::{Deserialize, Serialize}; #[derive(Clone, Eq, PartialEq, Debug, Hash)] #[cfg_attr(feature = "std", derive(Serialize, Deseriali...
use std::{ convert::TryFrom, io::{self, Read}, }; use crate::record::{ value::{Int16, Int32, Int8}, Value, }; use super::value::read_value; pub fn read_string_map_index<R>(reader: &mut R) -> io::Result<usize> where R: Read, { let i = match read_value(reader)? { Some(Value::Int8(Some(I...
use std::io; use crate::model::{Buffer, DosChar, BitFont, Size, Palette, BufferType}; use super::{ Position, TextAttribute, SaveOptions}; // http://fileformats.archiveteam.org/wiki/ICEDraw const HEADER_SIZE: usize = 4 + 4 * 2; const IDF_V1_3_HEADER: &[u8] = b"\x041.3"; const IDF_V1_4_HEADER: &[u8] = b"\x041.4"; co...
#![deny(overflowing_literals)] #![feature(proc_macro, proc_macro_gen, lang_items)] #![no_std] // For custom start #![feature(start)] // Value where the potentiometer value indicates state-change const ADC_LIMIT: u16 = 800; // BIAS Pins const POT_BIAS_PIN: u32 = 8; // ADC PIN 0 const FROM_POT_PIN: u8 = 0; extern cra...
use core::cell::UnsafeCell; use core::intrinsics::size_of; use file_system_lib::{BLOCK_SIZE, FileStatus}; use param_lib::{MAX_DEV_NUMBER, MAX_FILE_NUMBER, MAX_OP_BLOCKS}; use crate::file_system::device::DEVICES; use crate::file_system::file::File; use crate::file_system::file::FileType::{DEVICE, INODE, NONE, PIPE}; u...
/* * Copyright (c) 2021 Works Applications Co., 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 applica...
use crate::args_parser; use std::{ collections::HashMap, fs::File, io::{prelude::*, BufReader}, }; /// Returns the same matrix of create_score_matrix with every score transformed into an f32 /// this is done in order to works with f32 values needed in alignment with simd instruction. pub fn create_f32_scor...
mod parse_tests; // Even though we can `use` the macros directly in 2018, these macros have other // macro dependencies which are annoying to `use` and make the code a little less clear. #[macro_use] extern crate nom; #[macro_use] extern crate clap; #[macro_use] extern crate error_chain; use std::ffi::OsStr; use std...
use metrics::gauge; use std::sync::atomic::{AtomicU64, AtomicUsize, Ordering}; use std::{sync::Arc, time::Duration}; use tokio::time::interval; use tracing::{Instrument, Span}; use crate::WhenFull; #[derive(Clone, Debug)] pub struct BufferUsageHandle { state: Arc<BufferUsageData>, } impl BufferUsageHandle { ...
// Copyright (c) 2019 Libgirl // // Released under Apache 2.0 license as described in the file LICENSE.txt. use crate::events::{Event, SpikeEvent}; use crate::models::{Neuron, NeuronActivity}; use crate::network::Network; use crate::ode::rk4; use crate::{Double, Parameters, Time}; pub struct Model { pub g_na: Dou...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{config::Config, errors::*}; use bytecode_verifier::{ verify_module, verify_module_dependencies, verify_script, verify_script_dependencies, }; use compiler::{compiler::compile_program, parser::parse_program, util::build_...
use crate::solution_template::Solution; pub struct CalculatorSolution; /// A child next to you on the plane asks for help with math homework. /// The math involves a series of addition and multiplication expressions /// which are calculated from left to right, ignoring order of operations. impl Solution for Calculato...
use std::collections::HashMap; use std::ops::Deref; use syn::{Attribute, AttributeArgs, Lit, Meta, NestedMeta}; use syn::Lit::*; use syn::Meta::*; use crate::common::*; pub const ERROR_ATTRIBUTE: &'static str = "error"; pub const MESSAGE: &'static str = "message"; pub const IMPL_FROM: &'static str = "impl_from"; //...
// Copyright 2020-2021 <NAME> // SPDX-License-Identifier: Apache-2.0 use serde_json::Map; use serde_json::Value; use crate::lib::*; /// JSON Web Token Claims /// /// [More Info](https://tools.ietf.org/html/rfc7519#section-4) #[derive(Clone, Debug, Default, PartialEq, Deserialize, Serialize)] pub struct JwtClaims<T =...
use std::fs::File; use std::io::prelude::*; use std::fmt; type Vector3 = (i32, i32, i32); #[derive(Clone)] struct MoonState { position: Vector3, velocity: Vector3 } impl fmt::Debug for MoonState { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!( f, "pos=<x={}, y={}, z...
use io::VolatileRW; use super::gpio::*; #[derive(Clone)] pub enum PortLetter { PortA = 0, PortB = 1, PortC = 2, PortD = 3, PortE = 4 } #[derive(Clone)] pub enum Pin{ Pin0 = 0, Pin1 = 1, Pin2 = 2, Pin3 = 3, Pin4 = 4, Pin5 = 5, Pin6 = 6, Pin7 = 7, Pin8 = 8, Pin...
use serde::Deserialize; use std::{error, fmt, io::Error as IoError}; #[cfg(feature = "toml")] use ::toml::de::Error as TomlDeError; #[cfg(feature = "toml")] use ::toml::ser::Error as TomlSerError; #[cfg(feature = "env")] use envy::Error as EnvyError; use hyper_old_types::Error as HeaderParseError; use reqwest::{header...
use super::{ super::{models, schema::users::dsl::*}, server::OauthConfig, wrapper, }; use actix_session::Session; use actix_web::{ error, http, web::{Data, Json, Path, Query}, Error, HttpResponse, Scope as ActixScope, }; use diesel::{ pg::PgConnection, r2d2::{ConnectionManager, Pool}, ...
/** * 线程不安全的堆,支持根据索引快速调整位置或删除 */ use std::cmp::{Ord, Ordering}; use std::fmt::{Debug, Formatter, Result as FResult}; use std::mem::transmute_copy; use std::ptr::write; use dyn_uint::UintFactory; pub struct Heap<T>(Vec<(T, usize)>, Ordering); impl<T: Ord> Heap<T> { //构建一个堆, 如果ord为Ordering::Less, 将创...
extern crate queues; extern crate sdl2; use crate::emulator::sdl; use queues::*; use sdl2::render::Canvas; use sdl2::video::Window; use std::fmt; use std::fs; use std::time::Duration; use std::time::Instant; use std::vec::Vec; use std::io::BufReader; use std::sync::mpsc; use std::sync::mpsc::{Receiver, Sender}; use ...
/** * \file flow-python/src/lib.rs * MegFlow is Licensed under the Apache License, Version 2.0 (the "License") * * Copyright (c) 2019-2021 Megvii Inc. All rights reserved. * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS...
//! Structures and trait for extracting standard components and properties //! of expression node. use std::collections::HashMap; use crate::model::node::Node; use crate::model::node_diff::NodeDiff; use crate::model::constant::ConstantScalar; /// Standard properties of expression node. pub struct NodeStdProp { ...
#[cfg(feature = "logging")] mod capture_logger { use log::{Level, LevelFilter, Metadata, Record}; use once_cell::sync::OnceCell; use std::sync::{Arc, Mutex}; #[derive(Debug, Default)] struct CapturedLogs { logs: Arc<Mutex<Vec<(Level, String)>>>, } struct Logger {} impl log::Lo...
mod account; mod calendar; mod error; mod event; mod job_schedulers; mod schedule; mod service; mod shared; mod status; mod user; use actix_cors::Cors; use actix_web::web::Data; use actix_web::{dev::Server, middleware, web, App, HttpServer}; use job_schedulers::{start_reminder_generation_job_scheduler, start_send_remi...
use std::fmt; use std::fmt::Error; use crate::misc::reverse_hex; #[derive(Clone, Debug, Eq, PartialEq)] pub struct Fixed8(pub i64); /** * A Fixed8 point notation used widely in the NEO system for representing decimals. * It is basically a hexideciaml integer that is divided by the 10^8. * Supports up to 8 decimal...
//! DQN agent implemented with tch-rs. use crate::{ dqn::{explorer::DQNExplorer, model::DQNModel}, model::{ModelBase, SubModel}, replay_buffer::{ReplayBuffer, TchBatch, TchBuffer}, util::{track, OptIntervalCounter}, }; use anyhow::Result; use border_core::{ record::{Record, RecordValue}, Agent, ...
/* MIT License Copyright (c) 2021 <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, merge, publish, distribut...
// 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 { fidl_fuchsia_wlan_common as fidl_common, fidl_fuchsia_wlan_mlme as fidl_mlme, futures::channel::mpsc, ieee80211::MacAddr, wlan_common...
use std::io::{self, BufRead, Read}; use byteorder::ReadBytesExt; use noodles_bam as bam; use crate::{ data_container::compression_header::{ preservation_map::Key, PreservationMap, SubstitutionMatrix, TagIdsDictionary, }, reader::num::read_itf8, record, }; pub fn read_preservation_map<R>(reade...
use std::collections::HashSet; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum Direction { Up, Down, Left, Right, UpLeft, UpRight, DownRight, DownLeft, } #[derive(Debug, Copy, Clone)] pub enum Axis { Vertical, Horizontal, } impl Direction { /// Returns the oppo...
//! Registry authentication support. use crate::sources::CRATES_IO_REGISTRY; use crate::util::{config, CargoResult, Config}; use anyhow::{bail, format_err, Context as _}; use cargo_util::ProcessError; use std::io::{Read, Write}; use std::path::PathBuf; use std::process::{Command, Stdio}; enum Action { Get, St...
/* Note about testing I have spent wayyyyy too long trying to get this working by using Read and Write traits to make it easily testable. I have now given up - so the core methods are not tested. Feel free to try get it working, I've realised I'm wasting my time and don't actually care. Good luck. */ use crate::pr...
#![cfg_attr(not(feature = "std"), no_std)] use frame_support::sp_runtime::traits::Convert; /// 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> pub use p...
use std::{fs::File, io::{Seek, SeekFrom}, path::PathBuf, thread::sleep}; use color_eyre::{eyre::Result, Help}; use hidapi::HidDevice; use image::{ imageops::{dither, grayscale, resize, BiLevel}, AnimationDecoder, ImageBuffer, Luma, }; use structopt::StructOpt; #[derive(Debug, StructOpt)] #[structopt(name = "s...
// Copyright 2020 <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 crate::oop::{self, consts as oop_consts, Oop, ValueType}; use crate::runtime::require_class2; use crate::types::ClassRef; use crate::types::*; use crate::util; use crate::util::PATH_SEP; use classfile::{ constant_pool, consts, flags::*, AttributeType, BytesRef, ConstantPool, ConstantPoolType, FieldInfo, U2,...
// 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 { anyhow::Error, carnelian::{ color::Color, drawing::path_for_rounded_rectangle, render::{BlendMode, Context as RenderC...
//! # [Day 2: Bathroom Security](https://adventofcode.com/2016/day/2) //! //! You arrive at Easter Bunny Headquarters under cover of darkness. However, you left in such a //! rush that you forgot to use the bathroom! Fancy office buildings like this one usually have //! keypad locks on their bathrooms, so you search th...
use crate::prelude::*; use crate::dap_codec::{DecoderError, DecoderResult}; use adapter_protocol::*; use futures::prelude::*; use std::collections::{hash_map::Entry, HashMap}; use std::io; use std::pin::Pin; use std::sync::{Arc, Weak}; use tokio::sync::{broadcast, mpsc, oneshot}; pub trait DAPChannel: Stream<Item...
use std::cell::RefCell; use std::convert::From; use std::rc::Rc; use super::cpu::IntFlag; use super::cpu::IntReg; use super::IOHandler; const SELECT_FUNC_KEY_MASK: u8 = 0b0010_0000; const SELECT_DIRECTION_KEY_MASK: u8 = 0b0001_0000; #[derive(Clone, PartialEq, Debug)] pub enum JoypadKey { Right, Left, Up,...