text
stringlengths
3.09k
13.9k
use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; use crate::utils::serde::parse_intbool; use super::annotations::Annotations; use super::common::ID; use super::tags::Tags; /// type alias: a list of entries as returned from some endpoints pub type Entries = Vec<Entry>; /// A struct representing an e...
use rand::Rng; use super::util; use super::error::GarchError; use rand_distr::{Normal, Distribution}; use rustimization::lbfgsb_minimizer::Lbfgsb; use finitediff::FiniteDiff; /// Compute $sigma_2$ over a time series of residuals pub fn garch_recursion(omega: f64, alpha: &[f64], beta: &[f64], eps: &[f64]) -> Vec<f64> {...
// Suppress the unused warnings from rustc, as eventually // everything in this module will be used. #![allow(unused)] use std::ptr; use std::{ mem::{self, ManuallyDrop, MaybeUninit}, ops::{Index, IndexMut}, }; // This is akin to a transmute from MaybeUninit<T> -> T, as // neither mem::transmute nor MaybeUnin...
// Copyright 2019-2020 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 super::{create_buffer_with_fallback, Buffer, BufferError, WriteType}; use crate::{ renderer::{device::Dev, UpdateRecordInfo}, ReAllocatableBuffer, SimpleBuffer, }; use ash::{version::DeviceV1_0, vk}; use core::slice; use std::mem; pub struct MemMapHandle<'a, T> { ptr: *mut T, ptr_len: usize, // ele...
use ast::validation::ValidationError; use ast::AstNode; use errors::Error; use hir_lower::LowerResult; use hir_ty::InferResult; use line_index::{ColNr, LineIndex, LineNr}; use lsp_types::{ Diagnostic, DiagnosticSeverity, Position, Range, SemanticToken, TextDocumentContentChangeEvent, Url, }; use parser::Parse; ...
use std::{ convert::TryFrom, env, io::{self, Write}, path::PathBuf, sync::{atomic, Arc}, thread, time::Duration, }; use crossterm::{ cursor, event, execute, queue, style::{ style, Attribute, Color, Print, PrintStyledContent, SetAttribute, SetForegroundColor, Stylize,...
use byteorder::{ReadBytesExt, WriteBytesExt}; use messages::block_header::BlockHeader; use messages::message::Payload; use std::fmt; use std::io; use std::io::{Read, Write}; use util::{var_int, Error, Hash256, Result, Serializable}; /// Collection of block headers #[derive(Default, PartialEq, Eq, Hash, Clone)] pub str...
/*! Metal Shading Language (MSL) backend ## Binding model Metal's bindings are flat per resource. Since there isn't an obvious mapping from SPIR-V's descriptor sets, we require a separate mapping provided in the options. This mapping may have one or more resource end points for each descriptor set + index pair. ## O...
use std::collections::HashSet; #[derive(Clone, Debug, PartialEq)] struct Board { rows: [HashSet<u8>; 10], } impl Board { fn from_grid(grid: &[[u8; 5]; 5]) -> Board { let mut rows: [HashSet<u8>; 10] = Default::default(); for i in 0..5 { rows[i].extend(grid[i]); for j in ...
//! This file generates the Sobol direction vectors used by this crate's //! Sobol sequence. use std::{env, fs::File, io::Write, path::Path}; /// How many components to generate. const NUM_DIMENSIONS: usize = 256; /// What file to generate the numbers from. const DIRECTION_NUMBERS_TEXT: &str = include_str!("directio...
#![feature(proc_macro_hygiene)] #![feature(track_caller)] #![feature(exclusive_range_pattern)] #![feature(or_patterns)] #![feature(box_syntax, box_patterns)] #![recursion_limit = "512"] extern crate packed_struct; #[macro_use] extern crate packed_struct_codegen; #[macro_use] extern crate structopt; extern crate clap; ...
use base64::{decode, encode}; #[cfg(debug_assertions)] use headless_chrome::protocol::page::ScreenshotFormat; use headless_chrome::Tab; use rand::{thread_rng, Rng}; use serde::{Deserialize, Serialize}; use std::env::var_os; pub use std::env::{set_var, var}; #[cfg(debug_assertions)] use std::io::Write; use std::ops::Der...
// Copyright (c) SimpleStaking, Viable Systems and Tezedge Contributors // SPDX-License-Identifier: MIT //! Implementation of string interning used to implement hash-consing for context path fragments. //! This avoids un-necessary duplication of strings, saving memory. use std::{collections::hash_map::DefaultHasher, ...
use core::marker::PhantomData; use necsim_core::{ cogs::{ coalescence_sampler::CoalescenceRngSample, event_sampler::EventHandler, Backup, CoalescenceSampler, DispersalSampler, EmigrationExit, EventSampler, GloballyCoherentLineageStore, Habitat, LineageReference, MathsCore, RngCore, ...
use flex_error::define_error; use tendermint::abci::Code; use tendermint_rpc::endpoint::broadcast::tx_commit::TxResult; // Provides mapping for errors returned from ibc-go and cosmos-sdk define_error! { SdkError { Client [ ClientError ] |_| { "ICS02 Client Error" }, Unexpec...
// Copyright (c) 2019 Chaintope Inc. // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. use log::Level::Trace; use log::{log_enabled, trace}; use serde::Deserialize; use tapyrus::Address; use crate::errors::Error; use tapyrus::blo...
//! Models for representing plugins use std::collections::HashMap; use std::sync::Arc; use async_trait::async_trait; use log::trace; use serde::{Deserialize, Serialize}; use serde_json::Value; use crate::child_process::ChildPluginProcess; use crate::proto::*; use crate::proto::pact_plugin_client::PactPluginClient; ...
//! test script: //! //! ```shell-session //! $ for i in {1..1000}; do clear; cat /path/to/heartbeat; usleep 500000; done //! ``` #![allow(clippy::unnecessary_mut_passed)] #![deny(clippy::unimplemented)] use polyfuse_examples::prelude::*; use chrono::Local; use futures::{channel::oneshot, io::AsyncReadExt, lock::Mut...
// // Copyright 2021 <NAME> // This file is part of the Ida compiler. // Ida is licensed under the BSD-3 license. See the COPYING file for more information. // use parser::ltac::{LtacInstr, LtacType, LtacArg}; use crate::asm::*; // Builds a function declaration pub fn arm64_build_func(code : &mut Vec<Arm64Instr>, ins...
// // <NAME> <<EMAIL>> // // vim: set expandtab softtabstop=4 tabstop=4 shiftwidth=4: // use serde::{Deserialize, Serialize}; use crate::{game, deck, table, actions, repr}; pub use game::PlayerGameView; pub use table::PlayerTpos; /// Server <-> client interaction #[derive(Debug, Clone, Default, Serialize, Deseriali...
// Based upon RustyChat by <NAME> // https://github.com/SambaDialloB/RustyChat // // Adapted to use rf95modem and lora for communication use cursive::align::HAlign; use cursive::traits::*; use cursive::Cursive; use std::sync::mpsc::{channel, Receiver, Sender}; use std::thread; use cursive::view::ScrollStrategy; use c...
#![cfg(feature = "kinesis")] extern crate rusoto_core; extern crate rusoto_kinesis; use std::cell::RefCell; use std::future::Future; use std::panic::AssertUnwindSafe; use std::time::Duration; use async_trait::async_trait; use futures::FutureExt; use futures::stream::StreamExt; use rand::distributions::Alphanumeric; ...
#![allow(unused)] // when not applicable, tests should still compile use std::os::unix::net::{UnixStream, UnixDatagram}; use std::io::{self, ErrorKind::*}; use std::fs::remove_file; extern crate uds; use uds::{ConnCredentials, UnixStreamExt, UnixSeqpacketConn, UnixDatagramExt}; extern crate libc; use libc::{getpid, ...
use serde::{Serialize, Deserialize}; use crate::consts::*; use super::frame::Frame; mod draw; #[macro_export] macro_rules! rgb { ($r:expr, $g:expr, $b:expr) => {crate::components::drawpad::Color::new($r as u8,$g as u8,$b as u8)}; } type Data = [[Color; DRAWPAD_H]; DRAWPAD_W]; #[inline] fn clear(data:&mut Data) ...
#[macro_use] extern crate rocket; use glob::glob; use rocket_dyn_templates::Template; use rocket::form::{Form, Contextual}; use rocket::fs::{FileServer, TempFile}; use rocket::http::{ContentType, Status}; use rocket::serde::Serialize; use std::fs; use std::process::Command; #[derive(Debug, FromForm)] struct DeleteS...
// Chariot: An open source reimplementation of Age of Empires (1997) // Copyright (c) 2016 <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 ...
use { aho_corasick::AhoCorasick, cdc::{Polynom64, Rabin64, RollingHash64, SeparatorIter}, clap::{App, Arg}, indicatif::{ParallelProgressIterator, ProgressIterator}, itertools::Itertools, log::{info, warn}, rayon::{iter::IntoParallelIterator, iter::ParallelIterator, slice::ParallelSlice}, ...
//! A very simple, and fast, constant propagation //! //! Each location has the known constant values for all variables before //! execution of that location. //! //! Calling Constants::eval() uses the known constant values to replace scalars, //! and then attempts to evaluate the expression to an `il::Constant`. use...
use crate::config; use vcell::VolatileCell; /// Read LPO TRIM value from OTP memory pub fn lpo_trim_value() -> u16 { const LPO_TRIM_ADDR: *const u32 = 0xF008_01B4 as *const u32; unsafe { (::core::ptr::read_volatile(LPO_TRIM_ADDR) >> 16) as u16 } } /// Check if there is a valid LPO TRIM value in OTP memory #[i...
// * Daily Coding Problem May 14 2020 // * [Medium] -- Snapchat // * Given a string of digits, generate all possible valid IP address combinations. // * IP addresses must follow the format A.B.C.D, where A, B, C, and D are numbers between 0 and 255. // * Zero-prefixed numbers, such as 01 and 065, are not allowed, e...
#[macro_use] extern crate clap; #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_json; extern crate base64; extern crate bytes; extern crate env_logger; extern crate futures; extern crate hyper; extern crate hyper_tls; extern crate libc; extern crate serde; extern c...
//! Positions, dimensions, and position transformations. use std::default::Default; /// A position on the board or in a piece. /// /// Origin is in the upper left. #[derive(Debug, Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Serialize, Deserialize)] pub struct Position { pub x: usize, pub y: usize, } impl Po...
mod handshaking; mod login; mod status; use crate::players::PlayerList; use crate::Config; use mc_packet_protocol::packet::{ MovableAsyncRead, MovableAsyncWrite, PacketReadWriteLocker, PacketReader, PacketWriter, WritablePacket, }; use mc_packet_protocol::protocol_version::MCProtocol; use mc_packet_protocol::r...
use super::{super::SQLiteDatabase, conversions::value_into_table_factor}; use crate::database::values::{definitions::ConnectionDb, dsl::ExprDb}; use nu_engine::CallExt; use nu_protocol::{ ast::Call, engine::{Command, EngineState, Stack}, Category, Example, IntoPipelineData, PipelineData, ShellError, Signatu...
//! Provides Alphabet used for Base32 encoding and decoding use std::{error, fmt}; pub const ALPHABET_SIZE: usize = 32; #[derive(Clone, Debug, Eq, PartialEq)] pub enum EncodeOrder { OrderInversed, OrderNormal } /// Defines alphabet - 32 characters used for Base32 #[derive(Clone, Debug, Eq, PartialEq)] pub st...
// 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 writ...
use crate::priv_prelude::*; /// Builder for creating a `Ipv4Router`. pub struct Ipv4RouterBuilder { ipv4_addr: Ipv4Addr, connections: Vec<(Ipv4Plug, Vec<Ipv4Route>)>, } impl Ipv4RouterBuilder { /// Start creating a new `Ipv4Router` with the given IP address. pub fn new(ipv4_addr: Ipv4Addr) -> Ipv4Rout...
#![feature(test)] extern crate test; use test::Bencher; use byteorder::{ByteOrder, LittleEndian}; use cairo; use std::sync::{Arc, Mutex, RwLock}; use media::{ sample_extractor, AudioBuffer, AudioChannel, AudioChannelSide, SampleExtractor, SampleIndex, SampleIndexRange, Timestamp, }; use mediatocrenderers::...
/* Copyright (C) 2017 Open Information Security Foundation * * You can copy, redistribute or modify this Program under the terms of * the GNU General Public License version 2 as published by the Free * Software Foundation. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARR...
/*=====================================================================*\ ** NotVeryMoe Astro | Copyright 2021 NotVeryMoe (<EMAIL>) ** \*=====================================================================*/ const PERF_PRINT_DEBUG: bool = false; const PERF_TEST_SIZE: usize = if PERF_PRINT_DEBUG { 1 } else { 1_...
use super::Error; use event::{tags, Metric}; use tokio::io::AsyncBufReadExt; /// Exposes UDP total lengths of the rx_queue and tx_queue /// from `/proc/net/udp` and `/proc/net/udp6` pub async fn gather(proc_path: &str) -> Result<Vec<Metric>, Error> { let mut metrics = Vec::new(); if let Ok(v4) = net_udp_summa...
use crate::*; /// A WinRT array stores elements contiguously in a heap-allocated buffer. pub struct Array<T: RuntimeType> { data: *mut T::DefaultType, len: u32, } impl<T: RuntimeType> Default for Array<T> { fn default() -> Self { Array { data: std::ptr::null_mut(), len: 0, ...
use std::net::ToSocketAddrs; use std::path::Path; use std::sync::Arc; use futures::future; use h3_quinn::quinn; use tokio::{self, io::AsyncWriteExt}; use tracing::info; mod certs_configuration; mod env_parser; pub async fn run_client() -> Result<(), Box<dyn std::error::Error>> { tracing_subscriber::fmt() ...
/* * Copyright 2020 Fluence Labs 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 a...
use std::io::{BufRead, BufReader, Error, ErrorKind, Result}; /***********************************************/ const INPUT_FILE:&str = "20211224.txt"; /***********************************************/ fn read_input(filename: &str) -> Result<Vec<String>> { BufReader::new(std::fs::File::open(filename)?) ....
use std::{env, fs, collections::{BTreeMap, BTreeSet}}; #[allow(unused_imports)] use itertools::Itertools; fn main() { let args: Vec<String> = env::args().collect(); let mut reversed_args: Vec<_> = args.iter().map(|x| x.as_str()).rev().collect(); reversed_args .pop() .expect("Expected the ...
extern crate argparse; extern crate rpassword; mod error; mod ftp_client; mod stream; mod commands; use std::io::Write; use std::net::SocketAddr; use std::str::FromStr; use ftp_client::{FtpClient, FtpMode}; use error::FtpError; use argparse::{ArgumentParser, Print, Store, StoreOption}; use rpassword::read_password; ...
use std::collections::HashMap; use std::sync::Arc; use actix::prelude::*; use actix_web::{Error, FromRequest, Json}; use futures::{future, Future}; use serde::{Deserialize, Serialize}; use relay_common::ProjectKey; use crate::actors::project::{LimitedProjectState, ProjectState}; use crate::actors::project_cache::{Ge...
#![doc = include_str!("../README.md")] /// An enum representing different color types applied to a StyledString. pub mod color; /// Various constants used by the library, including the base ANSI color values. pub mod constants; /// A struct representing an RGB (red, green, blue) value. pub mod rgb; /// Trait implement...
//! Contains the binary logic of Ion. mod designators; mod prompt; mod readln; mod terminate; use self::prompt::{prompt, prompt_fn}; use self::readln::readln; use self::terminate::{terminate_quotes, terminate_script_quotes}; use super::{FlowLogic, Shell, ShellHistory}; use super::flow_control::Statement; use super::st...
use std::path::Path; use std::ffi::OsStr; use uuid::Uuid; use crate::structs::{HeliumConfig, env_holder, DefaultReturn}; use std::env; use std::collections::{HashMap, HashSet}; use serde::Deserialize; use envy::Error; use std::panic::PanicInfo; use std::fs::File; use std::io::Read; use crate::enums::PermissionLvl; use ...
//! Graph loading: runs .ninja parsing and constructs the build graph from it. use crate::graph::{FileId, RspFile}; use crate::parse::Statement; use crate::{db, eval, graph, parse, trace}; use anyhow::{anyhow, bail}; use std::borrow::Cow; use std::collections::HashMap; /// A variable lookup environment for magic $in/...
use std::io; use std::mem; use std::net::Shutdown; use std::os::unix::io::{AsRawFd, RawFd}; use std::pin::Pin; use std::task::{Context, Poll}; use bdaddr::BdAddr; use futures_core::ready; use futures_core::stream::Stream; use socket2::{Domain, Protocol, SockAddr, Socket, Type}; use tokio::io::unix::AsyncFd; use tokio:...
use bevy_app::Events; use bevy_ecs::prelude::*; use bevy_math::Vec3; use crossbeam::channel::Receiver; use heron_core::{CollisionEvent, Gravity}; use crate::convert::IntoRapier; use crate::rapier::dynamics::{IntegrationParameters, JointSet, RigidBodySet}; use crate::rapier::geometry::{ BroadPhase, ColliderHandle,...
//! Module with the remove blob operation. use std::future::Future; use std::pin::Pin; use std::task::{self, Poll}; use std::time::SystemTime; use heph::{actor, rt, ActorRef}; use log::debug; use crate::db::{self, RemoveBlobResponse}; use crate::op::{commit_query, consensus, db_rpc, DbRpc, Outcome}; use crate::passp...
extern crate rugcc; use self::rugcc::common::{IR, IRType, IRInfoType, Function}; use REGS; fn alloc(ir_reg: usize, reg_map: &mut Vec<i32>, used: &mut Vec<bool>) -> usize{ if reg_map[ir_reg] != -1 { let r = reg_map[ir_reg] as usize; assert!(used[r]); return r; } for i in 0..REGS.len...
use crate::types::*; use neo4jrs_macros::BoltStruct; #[derive(Debug, PartialEq, Clone, BoltStruct)] #[signature(0xB3, 0x50)] pub struct BoltPath { pub nodes: BoltList, pub rels: BoltList, pub ids: BoltList, } impl BoltPath { pub fn nodes(&self) -> Vec<BoltNode> { let mut nodes = Vec::with_capa...
use crate::{ io::{Data, Write}, Size, UniqueIdentifier, Update, }; use glob::{glob, GlobError, PatternError}; use serde::{Deserialize, Serialize}; use std::{ fs::File, path::{Path, PathBuf}, sync::Arc, }; use uid_derive::UID; #[derive(Debug, thiserror::Error)] pub enum DomeSeeingError { #[error...
use crate::analysis::reaching_defns::{ GroupOrInvoke, ReachingDefinitionAnalysis, }; use crate::ir::traversal::{Action, Named, VisResult, Visitor}; use crate::ir::{self, Builder, Cell, CloneName, LibrarySignatures, RRC}; use std::{collections::HashMap, rc::Rc}; #[derive(Default)] pub struct RegisterUnsharing { ...
//! A library for extracting and validating links. //! //! The majority of this code has been extracted from the //! [`mdbook-linkcheck`](https://crates.io/crates/mdbook-linkcheck) plugin, so //! it may have some bias towards the way `mdbook` works. //! //! # Examples //! //! If you were validating links in batches, th...
mod aat; mod at; mod util; use super::internal::{self, raw_tag, Bytes, RawFont}; use super::{FontRef, Tag}; use crate::text::{Language, Script}; const DFLT: u32 = raw_tag(b"DFLT"); #[derive(Copy, Clone)] enum Kind { None, /// GSUB, GPOS offsets At(u32, u32), /// Morx offset, kerning available Aat...
// Copyright 2020 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3-Clause>, at your option. This file may not be copied, // modified, or di...
use std::path::Path; use chrono::{Utc, TimeZone}; use rlua::{FromLuaMulti, Number}; use rust_decimal::{Decimal, prelude::FromPrimitive}; /// /// Plug-in global Rust functions that can be called from Lua script. /// pub fn init_context(lua_ctx: &rlua::Context, global_lua: &Option<String>, lookup_path: &Path) -> Result<...
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ use serde::Serialize; use serde_json::{json, Value}; use std::time::Instant; #[derive(Debug, Clone)] pub enum Mar...
use sodiumoxide::crypto::hash::sha256::Digest; use godcoin::blockchain::{Block, SignedBlock}; use godcoin::crypto::{double_sha256, SigPair}; use sodiumoxide::crypto::sign::Signature; use godcoin::asset::Asset; use neon::prelude::*; use godcoin::tx::*; use crate::crypto::JsPublicKey; use crate::asset::JsAsset; macro_r...
use std::collections::HashMap; use std::io; use std::io::prelude::*; use std::net::{TcpListener, TcpStream}; use std::os::unix::io::{AsRawFd, RawFd}; #[allow(unused_macros)] macro_rules! syscall { ($fn: ident ( $($arg: expr),* $(,)* ) ) => {{ let res = unsafe { libc::$fn($($arg, )*) }; if res == -1...
//! Implementation of a USTAR file system use crate::arch::ata; use core::{mem, slice, str}; pub const BLOCK_SIZE: usize = 512; extern "C" { static _kernel_size: usize; } fn fs_start_lba() -> usize { unsafe { // Symbol is initialized by the linker (&_kernel_size as *const _ as usize / BLOCK_...
use crate::api::{self, Api, CommitListRequest, CommitMetadataRequest}; use crate::commit::CommitInfo; use crate::range::Range; use http::StatusCode; use log::*; use std::cell::RefCell; use std::collections::HashMap; use std::fmt::Debug; use std::hash::Hash; use std::rc::Rc; use yew::services::fetch::FetchTask; const C...
use gloo::timers::callback::Timeout; use serde::{Deserialize, Serialize}; use std::{collections::HashSet, sync::Arc}; use crate::{ rpc::{Message, Recipient}, NodeState, }; use super::Node; #[derive(Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Debug)] pub enum Role { Follower, Candidate, Le...
// Copyright ©️ <NAME> 2021 use std::path::{Path, PathBuf}; use std::io::Write; use std::fmt; pub const TMP_DIR: &'static str = "/tmp/magick"; pub struct MoveInfo { pub source: PathBuf, pub dest: PathBuf } impl fmt::Display for MoveInfo { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { wri...
use std::collections::{BTreeSet, HashMap, HashSet}; use std::num::NonZeroUsize; use super::{ Node, Order, PartitionIndex, Planner, ResourceAccess, ResourceType, SendSystemIndex, UnsendSystemIndex, WakeupState, }; use crate::system; /// Stores the topology of the schedule, /// including the dependency and excl...
extern crate rand; use rand::Rng; use crate::constants::PlayField; use crate::constants::Type; use crate::constants::GameState; const WIDTH: u32 = 800; const M: usize = 40; const N: usize = 40; const SNAKE_WIDTH: u32 = WIDTH / 40; pub struct Snake { rng: rand::rngs::ThreadRng, game_state: GameState, wra...
use crate::types::*; use crate::errors::*; use uuid::Uuid; /// Describes a join response candidate for interaction with tgcalls #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct GroupCallJoinResponseCandidate { #[doc(hidden)] #[serde(rename(serialize = "@type", deserialize = "@type"))] td_n...
use anyhow::Result; use crate::btree::{BTree, SearchMode}; use crate::buffer_pool_manager::{BufferPoolManager}; use crate::disk_manager::PageId; use crate::{btree, tuple}; pub type Tuple = Vec<Vec<u8>>; pub type TupleSlice<'a> = &'a [Vec<u8>]; pub enum TupleSearchMode<'a> { Start, Key(&'a [&'a [u8]]), } imp...
/* Copyright 2021 Integritee AG and Supercomputing Systems AG 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...
use std::fmt::Display; /// 泛型練習 pub(crate) fn run() -> () { let interger = Point { x: 5, y: 10 }; let float = Point { x: 1.0, y: 4.0 }; println!("p.x = {}", interger.x()); println!("p distance from origin = {}", float.distance_from_origin()); let tweet = Tweet { username: String::from("ho...
//! Currency support (i.e. assets) use crate::networks::terra::denom::Denom; use crate::Error; use serde::{de, ser, Deserialize, Serialize}; use std::{ fmt::{self, Display}, str::FromStr, }; /// Currencies for use in trading pairs #[derive(Clone, Debug, Eq, PartialEq, PartialOrd, Ord)] pub enum Currency { ...
#![allow( dead_code, unused_imports, clippy::needless_range_loop, clippy::ptr_arg, clippy::char_lit_as_u8 )] use std::char; use std::cmp::{max, min}; use std::fmt; use std::io::BufRead; use std::iter::*; use std::ops::*; use std::str; use std::str::FromStr; use std::{io, process}; use failure::bai...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] use diem_infallible::RwLock; use diem_types::{epoch_change::EpochChangeProof, transaction::TransactionListWithProof}; use serde::{Deserialize, Serialize}; use std::sync::Arc; use storage_interface::DbReaderWrite...
use crate::field::Fp; use crate::polynomial::Polynomial; use std::convert::TryInto; pub fn decode_poly(wD: Polynomial, borrows: &[u8], t: Fp) -> Polynomial { // Compute syndromes poly let sD = compute_syndroms_poly(&wD, t); println!("Syndromes Poly: {:?}", sD); // Compute borrows localizator poly l...
//! Client to manage nodes and players. use crate::{ model::{IncomingEvent, OutgoingEvent}, node::{Node, NodeConfig, NodeError, Resume}, player::{Player, PlayerManager}, }; use dashmap::{mapref::one::Ref, DashMap}; use futures_channel::mpsc::{TrySendError, UnboundedReceiver}; use std::{ error::Error, ...
use core::sync::atomic::Ordering; use twizzler_abi::upcall::UpcallFrame; use x86_64::{instructions::segmentation::Segment64, VirtAddr}; use crate::{syscall::SyscallContext, thread::current_thread_ref}; use super::thread::{Registers, UpcallAble}; #[derive(Default, Clone, Copy)] #[repr(C)] pub struct X86SyscallContex...
mod utils; use wasm_bindgen::prelude::*; pub enum RuntimeError { Undefined(String), Simulator(String), } impl std::fmt::Debug for RuntimeError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { match self { Self::Simulator(e) => write!(f, "simulator error: {}", e),...
use crate::constants::FINALIZER_MAIN; use crate::crd_ext::CrdExt; use crate::{Agent, TaskState}; use k8s_openapi::apimachinery::pkg::apis::meta::v1::ObjectMeta; use kube::CustomResource; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::borrow::Cow; /// A TestSys Test. The `CustomResource` derive...
use crate::cell::chemistry::{distrib_gens, RgtpDistribution}; use crate::exp_setup::markers::ALL; use crate::parameters::quantity::{ Force, General, Length, Quantity, Stress, Time, Tinv, Viscosity, }; use crate::parameters::{ CharQuantities, RawCoaParams, RawInteractionParams, RawParameters, RawPhysicalCont...
use ::protobuf::*; use mytypes::types::*; use tokio_linux_aio::AioContext; use futures_cpupool::CpuPool; use std::convert; use std::mem; use memmap; use libc::{c_void, mlock}; use libc::{close, open, O_DIRECT, O_RDONLY}; use std::os::unix::io::RawFd; use std::os::unix::ffi::OsStrExt; use futures::*; use futures; use st...
use fall_parse::runtime as rt; pub use self::rt::ERROR; pub const WHITESPACE: rt::NodeType = rt::NodeType(100); pub const RAW_STRING: rt::NodeType = rt::NodeType(101); pub const FOO: rt::NodeType = rt::NodeType(102); pub const BAR: rt::NodeType = rt::NodeType(103); pub const T1: rt::NodeType = rt::NodeType(104); pub c...
use std::collections::VecDeque; struct Fifo<T> { inner: VecDeque<T>, depth: usize, } impl<T> Fifo<T> { fn new(depth: usize) -> Fifo<T> { Fifo { inner: VecDeque::new(), depth: depth, } } fn is_empty(&self) -> bool { self.inner.len() == 0 } f...
mod child_processes; mod fileio; mod threads; pub fn run_threads() { threads::basic(); threads::map_reduce(); threads::improved_map_reduce(); } pub fn channels() { use std::sync::mpsc; use std::sync::mpsc::{Receiver, Sender}; use std::thread; static NTHREADS: i32 = 3; // Channels have two endpoints:...
use proc_macro2::{token_stream::IntoIter, TokenTree, TokenTree::*}; use quote::quote; use syn::Type; pub fn are_matching_types(left_ty: &Type, right_ty: &Type) -> bool { compare_types(left_ty, right_ty, true) } pub fn ty_inferred_by(field_ty: &Type, implicit_ty: &Type) -> bool { compare_types(field_ty, implic...
pub mod queries; pub mod sub; use crate::graphql::ContextData; use crate::{blocks::block::BlockObject, users::user::UserObject}; use async_graphql::*; use block_tools::use_diesel::*; use block_tools::{ auth::permissions::{has_perm_level, PermLevel}, models::{Block, NewNotification, User}, NoAccessSubject, UserError,...
pub mod commands; mod end_board_with_moves; // Imports. use game::Game; use self::commands::Command; use board::Board; use game::move_direction::MoveDirection; use pieces::piece_type::PieceType; use self::end_board_with_moves::EndBoardWithMoves; // Struct representing the Autoplayer. // Make it printabl...
// Copyright 2021 Xayn AG // // 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...
//! Implements the Map phase. //! #![allow(dead_code)] use std::collections::BTreeMap; use std::io::Write; use phases::output::SinkGenerator; use mapreducer::{Mapper, Sharder}; use parameters::MRParameters; use record_types::{Record, MEmitter}; use sort::DictComparableString; /// This is the base of the mapping pha...
use std::{borrow::Cow, collections::HashMap}; mod spotify; mod twitch; mod util; use util::{ Either::{Left, Right}, FutureExt as _, }; // TODO this could borrow from the queue (and be covariant to 'static) type SpotifyCallback = fn(&spotify::Queue<spotify::Song>) -> Reply<'static>; #[derive(Default)] struct...
#![feature(use_extern_macros)] extern crate sgx_types; extern crate base64; extern crate futures; extern crate futures_cpupool; extern crate grpc; extern crate protobuf; extern crate reqwest; extern crate thread_local; extern crate time; extern crate tls_api; extern crate tokio_core; #[macro_use] extern crate clap; ...
// Copyright © 2017-2018 Mozilla Foundation // // This program is made available under an ISC-style license. See the // accompanying file LICENSE for details. use ffi; use std::str; use util::opt_bytes; /// The state of a device. #[derive(PartialEq, Eq, Clone, Debug, Copy)] pub enum DeviceState { /// The device ...
//! Code to watch configuration files for any changes. use std::collections::HashSet; use std::path::{Path, PathBuf}; use std::sync::mpsc::channel as std_channel; use std::time::Duration; use arti_client::config::Reconfigure; use arti_client::TorClient; use arti_config::ArtiConfig; use notify::Watcher; use tor_rtcomp...
// Copyright 2018 <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...