text
stringlengths
8
4.13M
use log::{level_filters::LevelFilter, Level}; use nimiq_log::{Formatting, MaybeSystemTime, TargetsExt}; use tracing_subscriber::{ filter::Targets, fmt::format::Pretty, layer::SubscriberExt, util::SubscriberInitExt, Layer, }; use tracing_web::{performance_layer, MakeConsoleWriter}; use crate::{config::config_file::...
use nimiq_keys::SecureGenerate; use nimiq_serde::{Deserialize, Serialize}; use wasm_bindgen::prelude::*; /// The secret part of the BLS keypair. /// This is specified in the config file, and is used by Validators to vote. #[wasm_bindgen] pub struct BLSSecretKey { inner: nimiq_bls::SecretKey, } #[wasm_bindgen] imp...
pub const ADDRESS: u32 = 0x40011800; /// Port configuration register low (GPIOn_CRL) pub mod crl { pub const OFFSET: u32 = 0x0; pub const REGISTER_ADDRESS: u32 = super::ADDRESS + OFFSET; pub struct ReadonlyCache([u8;16]); impl ::core::ops::Index<u8> for ReadonlyCache { type Output = u8; ...
#[macro_use] extern crate emacs; use emacs::{Result, Env}; use std::{borrow::Cow, mem, rc::Rc}; emacs::plugin_is_GPL_compatible!(); #[emacs::module(name = "access-rc")] fn init(_: &Env) -> Result<()> { Ok(()) } type SharedFoo = Rc<Foo>; struct Foo{ string: String } struct Bar <'a>{ sub_str:...
// This file is part of Substrate. // Copyright (C) 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.a...
pub fn public_function() { println!("called rary's `public_function()`"); } fn private_function() { println!("called rary's `private_function()`"); } pub fn indirect_access() { print!("called rary's `indirect_access()`, that\n> "); private_function(); } #[cfg(test)] mod tests { #[test] fn it...
extern crate sort; #[macro_use] extern crate criterion; use sort::*; use criterion::Criterion; fn merge_sort_10(c: &mut Criterion) { let arr_size = 10; c.bench_function("merge sort 1T 10", move |b| { b.iter_with_setup(|| sorted_vec_u64(arr_size), move |mut vals: Vec<u64>| merge_sort(&mut vals)); } ); } fn me...
pub use super::fic::*; use std::collections::HashMap; use std::ffi::OsString; use std::path::Path; pub struct Fold { pub name: OsString, //folder's name (only it: not the full path!!) pub fics: HashMap<OsString, Fic>, //files inside the folder pub folds: HashMap<OsString, Fold>, //sub-fi...
// Copyright 2020 Datafuse Labs. // // 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 ...
use serde_json::Value; use log::{error, warn, info, debug, trace}; use super::{Database, Permission, DatabaseInterface}; use crate::args::Arguments; use chashmap::CHashMap; use crate::{BUILD_VERSION, COMPATIBLE_VERSIONS}; /// Extract a string from a json value, or throw an error fn extract_string(val: &Value, title...
use maplit::hashmap; use optional_index::{OptionalIndex, OptionalIndexMut}; use std::collections::HashMap; #[derive(Clone, Debug, PartialEq, Eq)] struct Map<T>(HashMap<&'static str, T>); impl OptionalIndex<&'static str> for Map<Map<usize>> { type Output = Map<usize>; fn optional_index(&self, index: &'static ...
//! Common definitions of frequent constants use dsl::nil; use crate::{ common::sourcemap::Smid, eval::machine::intrinsic::{Const, StgIntrinsic}, }; use super::{ syntax::{ dsl::{self, data, let_, lref, value}, LambdaForm, }, tags::DataConstructor, }; /// KNIL - unit pub struct KN...
#[test] fn test_hello() { assert_wasi_output!( "../../wasitests/hello.wasm", "hello", vec![], vec![], vec![], "../../wasitests/hello.out" ); }
use std::cell::{Ref, RefCell, RefMut}; use std::sync::{ mpsc::{channel, Receiver, Sender}, Arc, Mutex, }; use std::thread; pub struct LazyCell<T> { resource: RefCell<Option<T>>, loading: Arc<Mutex<bool>>, loaded: RefCell<bool>, txrx: (Sender<T>, Receiver<T>), } impl<T> LazyCell<T> where T:...
use rustc_serialize::base64::{STANDARD, ToBase64}; use rustc_serialize::json::{Json, ToJson}; use {Cbor, CborFloat, CborSigned, CborUnsigned}; /// A trait for converting values to CBOR. pub trait ToCbor { /// Return a CBOR representation of `self`. fn to_cbor(&self) -> Cbor; } impl ToJson for Cbor { fn t...
use std::io::Write; use anyhow::{anyhow, Result}; use wasmer::{imports, Function, Instance, Module, Store, Value as WasmValue}; use wasmer_wasi::WasiState; use crate::value::Value; pub struct Runtime {} impl Runtime { pub fn new() -> Runtime { Runtime {} } pub fn _run(&mut self, wat: &str) -> R...
pub struct NeuralNetwork(Vec<Vec<Neuron>>); pub type Layout = Vec<usize>; fn amount_of_weights(l: &Layout) -> usize { l.iter() .zip(l[1..].iter()) .map(|(n1, n2)| (n1 + 1) * n2) .sum() } impl NeuralNetwork { pub fn random(layers: Layout) -> NeuralNetwork { let layers = layers ...
/* --- Day 4: Passport Processing --- You arrive at the airport only to realize that you grabbed your North Pole Credentials instead of your passport. While these documents are extremely similar, North Pole Credentials aren't issued by a country and therefore aren't actually valid documentation for travel in most of th...
//! //! This library purpose is to stack writers (and subsequently read with similar stack). //! //! This allow composition of writers. //! //! The library uses std::io::write and std::io::read for basis, but semantically Write and Read //! implementation requires a bit of care (see examples). //! //! Ext trait add a...
// This file is part of Substrate. // Copyright (C) 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.a...
use std::net::SocketAddr; use native_tls::TlsAcceptor; use std::sync::mpsc::{channel}; use std::sync::{Arc, Mutex}; use futures::sync::mpsc::Receiver as FutureReceiver; use futures::sync::mpsc::Sender as FutureSender; use futures::sync::mpsc::channel as future_channel; use std::collections::BTreeSet; use std::collectio...
mod timer; mod handler; pub mod context; pub fn init() { handler::init(); timer::init(); println!("mod interrupt initialized"); }
use std::{ ops, fmt }; use super::NumType; #[derive(Debug, Clone, PartialEq)] pub struct Point { pub x: NumType, pub y: NumType } impl Point { /// Returns a new `Point` with the passed `x` and `y` values. /// # Example /// ``` /// use noframe::geo::point::Point; /// /// let point = Point::new(32...
use config::{Config, ConfigError, File, FileFormat}; use serde::Deserialize; use std::{fs, path::Path, sync::RwLock, io::Write}; static CONFIG_PATH: &'static str = "$HOME/.config/purr/config.toml"; lazy_static! { static ref SETTINGS: RwLock<Settings> = RwLock::new(Settings::new().unwrap()); } #[derive(Deserializ...
// Copyright 2020-2023 The NATS Authors // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
use crate::state; use cosmwasm_std::{ to_binary, Api, Binary, CanonicalAddr, Extern, HumanAddr, Querier, QueryRequest, StdResult, Storage, Uint128, WasmQuery, }; use cw20::{BalanceResponse, Cw20QueryMsg, TokenInfoResponse}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; #[derive(Serialize, Dese...
use frame_support::{*, pallet_prelude::inject_runtime_type}; use static_assertions::assert_type_eq_all; pub trait Config { type RuntimeCall; } struct Pallet; #[register_default_impl(Pallet)] impl Config for Pallet { #[inject_runtime_type] type RuntimeCall = (); } struct SomePallet; #[derive_impl(Pallet...
// vim: tw=80 use galvanic_test::test_suite; test_suite! { name basic; use bfffs::common::{ Error, vdev::*, vdev_leaf::*, vdev_file::* }; use divbuf::DivBufShared; use futures::{future, Future}; use galvanic_test::*; use pretty_assertions::assert_eq; use...
// Michael Koeppl 4AHIF // Queens puzzle // 13 June 2016 // // 12 fundamentally different solutions // 92 distinct solutions static mut count: i32 = 0; const NUM_OF_QUEENS: i8 = 8; fn insert(field: &mut Vec<i32>, curr_col: i32, curr_row: i32) { field[curr_col as usize] = curr_row; } fn search(queen_count: i8, fi...
mod list; mod list_item; pub use list::List; pub use list_item::ListItem;
use crate::{CommitLog, Position, Record}; use std::io; use std::result::Result; use derive_more::From; #[derive(Debug, From)] pub enum Error { Io(io::Error), Segment(super::segment::Error), InvalidPosition, } pub struct Reader<'a> { pub commit_log: &'a CommitLog, } impl<'a> Reader<'a> { /// Rea...
// Copyright 2019 Conflux Foundation. All rights reserved. // Conflux is free software and distributed under GNU General Public License. // See http://www.gnu.org/licenses/ use crate::{Error, ErrorKind, ThrottlingReason}; use byte_unit::n_mb_bytes; use lazy_static::lazy_static; use metrics::{Gauge, GaugeUsize}; use pa...
// Everything is transposed because OpenGL is weird in this regard pub struct Vec3([f32; 3]); #[derive(Debug)] pub struct Mat4([f32; 16]); impl Vec3 { pub fn new(xyz: [f32; 3]) -> Self { Vec3(xyz) } } impl Mat4 { pub const fn new() -> Self { Self([ 1., 0., 0., 0., 0., 1., 0., ...
#![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] #[repr(C)] #[derive(Debug, Default, Copy, Clone, Hash, PartialEq, Eq)] pub struct RandomTemplate { pub _address: u8, } pub type ShouldBeOpaque = u8; pub type ShouldNotBeOpaque = RandomTemplate;
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct CloudAccessCluster { /// A list of accounts created on the cluster with this guid #[serde(rename = "accounts")] pub accounts: Option<Vec<String>>, /// Whether the guid is that of the current (local) clus...
pub mod digest; use tonic::transport::Server; mod metrics; mod server; mod temporary_file; mod validate; use log::{debug, warn}; use server::trow_server::admission_controller_server::AdmissionControllerServer; use server::trow_server::registry_server::RegistryServer; use server::TrowServer; use std::future::Future; us...
use crate::vector::{Vec3, Vec4}; use std::ops; #[derive(Debug, Clone, Copy)] pub struct Mat4([f32; 16]); impl Mat4 { pub fn new() -> Mat4 { Mat4([0.0; 16]) } pub fn identity() -> Mat4 { Mat4([ 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0, 0.0, 0.0, 1.0, ...
#[macro_export] macro_rules! marge_error { ($expression:expr) => {{ let bold = Style::new().bold().red(); let error_style = Style::new().red(); println!( "{} {}", bold.apply_to("Error:"), error_style.apply_to($expression) ); }}; }
use crate::ram::Ram; use crate::display::Display; use crate::keyboard::Keyboard; use std::fmt; pub(crate) struct Bus { ram: Ram, keyboard: Keyboard, display: Display, delay_timer: u8, } impl Bus { pub fn new() -> Bus { Bus { ram: Ram::new(), keyboard: Keyboard::new(...
// Copyright 2021 Datafuse Labs. // // 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 std::io::Error; use tailcall::*; /// Factorial artificial wrapped in a Result fn factorial(input: u64) -> Result<u64, Error> { #[tailcall] fn factorial_inner( accumulator: Result<u64, Error>, input: Result<u64, Error>, ) -> Result<u64, Error> { let inp = input?; let acc ...
//! The compiler binary of the vague-search project. //! //! Read a file composed of `<WORD> <FREQUENCY>` lines and create a compiled //! dictionary from it. use error::*; use patricia_trie::PatriciaNode; use snafu::*; use std::path::PathBuf; use vague_search_core::{CompiledTrie, DictionaryFile}; mod error; mod patr...
use std::collections::HashMap; use std::rc::Rc; use rustc_serialize::{Decodable, Decoder}; use animation::{AnimationClip, ClipInstance}; use transform::Transform; /// Identifier for an AnimationClip within a BlendTreeNodeDef pub type ClipId = String; /// Identifier for animation controller parameter, within a Lerp...
use crate::*; /// approval callbacks from NFT Contracts #[derive(Serialize, Deserialize)] #[serde(crate = "near_sdk::serde")] pub struct SaleArgs { pub sale_conditions: SaleConditions, pub token_type: TokenType, #[serde(skip_serializing_if = "Option::is_none")] pub is_auction: Option<bool>, } trait N...
//! TODO(doc): @quake use crate::db::cf_handle; use crate::schema::Col; use crate::{internal_error, Result}; use rocksdb::{OptimisticTransactionDB, WriteBatch}; use std::sync::Arc; /// TODO(doc): @quake pub struct RocksDBWriteBatch { pub(crate) db: Arc<OptimisticTransactionDB>, pub(crate) inner: WriteBatch, } ...
//! Register token tags and their traits. //! //! The following table shows relations between all types and traits within this //! module: //! //! | Type \ Trait | [`RegTag`] | [`RegAtomic`] | [`RegOwned`] | //! |--------------------------|------------|---------------|--------------| //! | [`Urt`] (Unsynchr...
use super::commands::AppParams; use super::manifest::{Manifest, Project}; use std::path::{Path, PathBuf}; /// Read the manifest file, do some basic checks and call a function with the right parameters pub(crate) fn on_project<F, R>( app_params: &AppParams, /* manifest_file: &str, out_dir: &str, pro...
extern crate sudoku; extern crate regex; extern crate term_painter; #[cfg(test)] mod test; use sudoku::board::*; use sudoku::solver::*; use sudoku::hintmap::HintMap; use std::{env, io, time}; use std::io::Read; use std::io::prelude::*; use std::fs::File; use regex::Regex; use term_painter::ToStyle; use term_paint...
// Copyright 2020 Parity Technologies // // 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 accor...
// This file is part of Substrate. // Copyright (C) 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.a...
// Copyright (C) 2016 Symtern Project Contributors // // 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...
// Copyright 2023 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 //! INX plugin API-related types like responses and DTOs. pub mod indexer; pub mod participation;
#[allow(unused_imports)] use tracing::{info, debug, warn, error, trace}; use std::sync::{Arc}; use tokio::sync::RwLock; use std::sync::RwLock as StdRwLock; use btreemultimap::BTreeMultiMap; use crate::trust::*; use crate::spec::*; use crate::compact::*; use crate::error::*; use crate::index::*; use crate::transaction:...
extern crate clap; use clap::{Arg, App}; fn is_factor(n: i32, f: i32) -> bool { n % f == 0 } fn factorize(n: i32) -> Vec<i32> { let mut factors = vec![]; let mut i: i32 = 0; while i < n { i += 1; if is_factor(n, i) { factors.push(i); } } factors } fn is_...
pub mod discount_option_data;
// This file is part of Substrate. // Copyright (C) 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 Softwa...
use qurate::backends::graph::*; use qurate::core::*; fn main() { // 初期状態を準備(0 -> 2へテレポートする) let q0_0 = init_graph_qubit(QBasis::Zero); let q1_0 = init_graph_qubit(QBasis::Zero); let q2_0 = init_graph_qubit(QBasis::Zero); // 1にH let q1_1 = GraphHadamard::apply(q1_0); // 1,2にCNOT let (q...
table! { tbl_accounts (id) { id -> Int8, created_at -> Timestamptz, email -> Nullable<Text>, password -> Text, last_ip -> Text, last_seen_at -> Timestamptz, active -> Bool, } } table! { tbl_profiles (id) { id -> Int8, account_id -> Int...
use serde::{Serialize, Deserialize}; use chrono::{DateTime, Utc}; use super::user::User; use super::label::Label; #[derive(Serialize, Deserialize, Debug)] pub struct Task { pub assignees: Option<Vec<User>>, pub created: DateTime<Utc>, #[serde(rename = "createdBy")] pub created_by: User, pub descrip...
use crate::prelude::*; pub fn chasing( mut move_events: EventWriter<WantsToMove>, mut attack_events: EventWriter<WantsToAttack>, movers: Query<(Entity, &PointC, &FieldOfView), With<ChasingPlayer>>, positions: Query<(Entity, &PointC), With<Health>>, player: Query<&PointC, With<Player>>, map: Res...
mod vector; fn main() { // let mut a ={ // let v:Vec<i32>= Vec::new(); // v // }; // println!("a is : {:?}",a); // a.push(8); // println!("a is : {:?}",a); // a.push(3); // println!("a is : {:?}",a); // a.push(5); // println!("...
use crate::memory::Memory; use crate::stack::Stack; use std::io::{Read, Write}; use wain_ast::ValType; pub enum ImportInvalidError { NotFound, SignatureMismatch { expected_params: &'static [ValType], expected_ret: Option<ValType>, }, } pub enum ImportInvokeError { Fatal { message: Stri...
use indexmap::IndexMap; use std::hash::Hash; pub trait IteratorExt: Iterator { fn ordered_group_by<K, F>(self, mut key: F) -> IndexMap<K, Vec<Self::Item>> where Self: Sized, F: FnMut(&Self::Item) -> K, K: PartialEq + Eq + Hash, { let mut result = IndexMap::new(); fo...
use emulator::{Debugger}; use emulator::cpu::{Cpu, OnDecodeError}; use types::Register; #[repr(C)] pub struct CRegisters { pub a: u16, pub b: u16, pub c: u16, pub i: u16, pub j: u16, pub x: u16, pub y: u16, pub z: u16, pub pc: u16, pub ia: u16, pub sp: u16, pub ex: u16, ...
// Copyright 2020 EinsteinDB Project Authors & WHTCORPS INC. Licensed under Apache-2.0. use std::collections::hash_map::Entry; use std::fs::File; use std::io::{Error as IoError, ErrorKind, Result as IoResult}; use std::path::{Path, PathBuf}; use std::sync::{Arc, RwLock}; use std::time::{Duration, SystemTime, UNIX_EPOC...
use vec::MyVec; use std::hash::{Hash, Hasher}; use std::collections::hash_map::DefaultHasher; enum HashElement<T> { Empty, Deleted, Valid(T), } pub struct MyHashSet1<T> { my_vec: MyVec<HashElement<T>>, } impl<T> MyHashSet1<T> where T: PartialEq, T: Eq, T: Hash { pub fn new() -> Self { let...
use std::{thread, time::Duration}; use opencv::{core, highgui, imgproc, objdetect, prelude::*, types, videoio, Result}; fn main() -> Result<()> { let window = "video capture"; highgui::named_window(window, 1)?; let (xml, mut cam) = { ( core::find_file("haarcascades/haarcascade_frontalface_alt.xml", true, fals...
// This file is part of Substrate. // Copyright (C) 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 Softwa...
use std::sync::Arc; use std::time::Duration; use bytes::BytesMut; use futures01::{future::IntoFuture, Future, Stream}; use parking_lot::Mutex; use rusoto_s3::S3; use tokio::codec::{BytesCodec, FramedRead}; use crate::actors::objects::common::prepare_download_paths; use crate::actors::objects::{DownloadPath, DownloadS...
extern crate rustc_serialize; use std::io::prelude::*; use std::fs::File; use std::io::Error; use std::env; use rustc_serialize::json; #[derive(RustcDecodable, RustcEncodable, Clone)] pub struct HoursData { ticket: String, description: String, time: String, status: String, //TODO: Needs to be imp...
//! Configure interrupts for the stm32f3xx. //! //! See Jayce Boyd's guide here: //! https://github.com/jkboyce/stm32f3xx-hal/blob/master/examples/gpio_interrupt.rs //! See ref manual page 249+ //! //! Special thanks to Jayce Boyd and Adam Greig, for being super bros. //! //! For RTC interrupts, see the stm32f3...
extern crate textnonce; use std::collections::HashMap; use super::ast; #[derive(Serialize, Deserialize)] #[derive(Clone, Debug)] pub enum Value { Int(i32), Str(String), Object(Obj), } impl PartialEq for Value { fn eq(&self, other: &Value) -> bool { match self { &Value::Int(x) => ...
//! # DOM API //! //! This module includes implementations of a subset of DOM API (https://dom.spec.whatwg.org/). use std::ffi::c_void; use super::{set_accessor_to, set_constant_to, set_function_to, set_property_to}; use crate::{ core::dom::{Node, NodeType}, javascript::{api::request_rerender, JavaScriptRunti...
use gdnative::*; use std::sync::atomic::{AtomicUsize, Ordering as AtomicOrdering}; use std::sync::Arc; #[no_mangle] pub extern "C" fn run_tests( _data: *mut gdnative::libc::c_void, _args: *mut gdnative::sys::godot_array, ) -> gdnative::sys::godot_variant { let mut status = true; status &= gdnative::tes...
use hackrfone::{HackRfOne, UnknownMode}; fn main() { let radio: HackRfOne<UnknownMode> = HackRfOne::new().expect("Failed to open HackRF One"); println!("Board ID: {:?}", radio.board_id()); println!("Version: {:?}", radio.version()); println!("Device version: {:?}", radio.device_version()); }
use crate::{document::Document, error::Error, options::Options}; /// Highest level representation of hex viewer, abstracts away all login and allows it to be ran. pub struct Hexi { document: Document, } impl Hexi { /// Creates a hex viewer implementation, getting the file name from the first argument passed t...
pub mod clause; pub mod frame; use pyo3::prelude::*; #[pymodule] #[pyo3(name = "instance")] pub fn init(py: Python, m: &PyModule) -> PyResult<()> { m.add_class::<self::frame::InstanceFrame>()?; register!(py, m, InstanceFrame, "collections.abc", MutableSequence); m.add("__name__", "fastobo.instance")?; ...
extern crate reservoir; extern crate rand; use std::env::args; use std::io::{stdin, BufRead}; use std::str::FromStr; use reservoir::sample; fn main() { let count = args().nth(1).and_then(|s| FromStr::from_str(s.as_ref()).ok()).unwrap_or(10); let input = stdin(); let input_lines = input.lock().lines().m...
// Global Heap Allocator const HEAP_SIZE: usize = 1 * 4 * 1024; // 4KiB #[link_section = ".bss.heap"] static mut SBI_HEAP: [u8; HEAP_SIZE] = [0; HEAP_SIZE]; use buddy_system_allocator::LockedHeap; #[global_allocator] static mut HEAP_ALLOCATOR: LockedHeap<32> = LockedHeap::empty(); pub fn init() { unsafe { HEAP_...
pub mod vector; pub mod point; pub mod rec; pub mod size;
fn main() { // 线程安全 { // 启动线程 { // 通常的使用方法 use std::io; use std::io::prelude::*; use std::thread; // JoinHandle<ClosureType> let child = thread::spawn(move || { // 这里是新建线程的执行逻辑 let stdout = i...
use crate::info::info_field::{InfoField, InfoType}; pub struct LocInfo { pub lines_of_code: usize, } impl InfoField for LocInfo { const TYPE: InfoType = InfoType::LinesOfCode; fn value(&self) -> String { self.lines_of_code.to_string() } fn title(&self) -> String { String::from("L...
// Copyright 2020 Datafuse Labs. // // 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 ...
use crate::model::*; use super::*; pub struct SimGame { pub my_id: i32, pub current_tick: i32, pub units: Vec<SimUnit>, pub projectiles: Vec<SimProjectile>, pub zone: Zone, } impl SimGame { pub fn new(game: &Game) -> Self { Self { my_id: game.my_id, current_tick...
extern crate cast; #[macro_use] extern crate failure; extern crate heck; extern crate ordered_float; extern crate result; extern crate yaml_rust; mod render; mod swagger; use failure::Error; use failure::ResultExt; use std::io::Write; use swagger::NamingType; pub fn go<W: Write>(mut into: W) -> Result<(), Error> { ...
#![no_std] extern crate alloc; #[cfg(test)] #[macro_use] extern crate std; pub mod ecdh; pub mod secp256k1; #[derive(Debug)] pub enum KeyError { InvalidSeedLength, SecretStringError(sp_core::crypto::SecretStringError), }
/* * ORY Hydra * * Welcome to the ORY Hydra HTTP API documentation. You will find documentation for all HTTP APIs here. * * The version of the OpenAPI document: v1.10.6 * * Generated by: https://openapi-generator.tech */ /// ContainerWaitOkBodyError : ContainerWaitOKBodyError container waiting error, if any ...
mod program; mod complete_commands; mod complete_command; mod and_or; mod pipeline; mod command; mod arg; mod term_op; mod redirect; pub use program::*; pub use complete_commands::*; pub use complete_command::*; pub use and_or::*; pub use pipeline::*; pub use command::*; pub use arg::*; pub use term_op::*; pub use red...
use crate::{Field, Hl7ParseError, Separators}; use std::fmt::Display; use std::ops::Index; /// A generic bag o' fields, representing an arbitrary segment. #[derive(Debug, PartialEq, Clone)] pub struct Segment<'a> { pub source: &'a str, delim: char, pub fields: Vec<Field<'a>>, } impl<'a> Segment<'a> { ...
// Copyright 2020 EinsteinDB Project Authors & WHTCORPS INC. Licensed under Apache-2.0. use edb::EncryptionMethod as DBEncryptionMethod; use ekvproto::encryption_timeshare::EncryptionMethod; use openssl::symm::{self, Cipher as OCipher}; use rand::{rngs::OsRng, RngCore}; use crate::{Error, Result}; #[causet(not(featu...
use riscv::register::time; use crate::sbi::set_timer; use crate::config::CLOCK_FREQ; const TICKS_PER_SEC: usize = 100; //const MSEC_PER_SEC: usize = 1000; const USEC_PER_SEC: usize = 1000000; pub fn get_time() -> usize { time::read() } /* pub fn get_time_ms() -> usize { time::read() / (CLOCK_FREQ / MSEC_PER_...
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::BCDR { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut ...
use serde::de::IntoDeserializer; use crate::easy::de::Error; pub(crate) struct InlineTableMapAccess { iter: indexmap::map::IntoIter<crate::InternalString, crate::table::TableKeyValue>, value: Option<crate::Item>, } impl InlineTableMapAccess { pub(crate) fn new(input: crate::InlineTable) -> Self { ...
use std::iter::FromIterator; // a list of valid operators pub const OPERATORS: [&str; 17] = [ "(", ":", ",", ".", ")", "{", "}", ">", "=", "+", "-", "*", "/", "=>", "//", "/*", "*/", ]; // a list of characters which are considered whitespace const WHITESPACE: [char; 4] = [' ', '\n', '\t', '\r']; // tells the token...
#![allow(non_snake_case)] use crate::ipa::alm_zk; use crate::math_utils::vandemonde_challenge; use crate::matrix::*; use crate::transcript::TranscriptProtocol; use curve25519_dalek::{ ristretto::{CompressedRistretto, RistrettoPoint}, scalar::Scalar, traits::VartimeMultiscalarMul, }; use merlin::Transcript; ...
const HELP: &'static str = r#" Opens a reverse-proxy tunnel. EXAMPLE 1 cix ssh reverse-tunnel user1 host2:22 0.0.0.0:19998 localhost:19998 Please note that incoming connections only from `127.0.0.1` on remote machine will be accepted by default. You need to modify `sshd`'s `GatewayPorts` configuration to open ...
use std::collections::HashMap; use std::hash::Hash; use std::cmp::Ordering; use strum_macros::Display; use serde::{ Deserialize , Serialize}; use tokio::sync::mpsc; use warp::ws::Message; use strum::IntoEnumIterator; use strum_macros::EnumIter; use rand::distributions::{Distribution, Uniform}; use rand::prelude::*; use...
// Copyright 2020 Conflux Foundation. All rights reserved. // Conflux is free software and distributed under GNU General Public License. // See http://www.gnu.org/licenses/ mod epoch_queue; mod poll_manager; mod subscribers; mod variadic_value; pub use epoch_queue::EpochQueue; pub use subscribers::{Id as SubscriberId...
//! Asynchronous Mesos Client //! //! This crate provides an asynchronous client for the Mesos //! [Scheduler HTTP API](http://mesos.apache.org/documentation/latest/scheduler-http-api). //! //! ## Installation //! //! Simply add the dependency to your `Cargo.toml` //! //! ```toml //! [dependencies] //! async_mesos = 0....
use std::io; use std::net::{self, Shutdown, SocketAddr, ToSocketAddrs}; use std::os::unix::io::{AsRawFd, RawFd}; use std::pin::Pin; use std::task::{Context, Poll}; use futures_io::{AsyncRead, AsyncWrite, IoSlice, IoSliceMut}; use socket2::{Domain, Protocol, Socket, Type}; use crate::io::Async; #[derive(Debug)] pub s...