text
stringlengths
3.09k
13.9k
use std::{ collections::{HashMap, HashSet}, hash::Hash, sync::Arc, }; use crate::types::{Command, DBValue, MergeCommand, MoiraCommand, Transaction, TransactionResult}; use serde::{de::DeserializeOwned, Serialize}; use std::fmt::Debug; use tokio::sync::{mpsc::UnboundedSender, oneshot}; #[derive(Debug, Clon...
// 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 writi...
use crate::{ error::Result, types::{Point, Region}, window::WindowPtr, }; use std::{fmt, rc::Rc}; //use web_sys::console; // TODO YOU CAN IMPL TRAIT FOR BOX<dyn TRAIT> - do I care? // it should also be able to auto-derive get_region(), that's a solved problem /// Trait representing things that can be draw...
use std::str::FromStr; use libeir_diagnostics::*; use libeir_intern::Symbol; use libeir_ir::Integer; use libeir_util_parse::{Scanner, Source}; macro_rules! pop { ($lex:ident) => {{ $lex.skip(); }}; ($lex:ident, $code:expr) => {{ $lex.skip(); $code }}; } #[derive(Debug, Clone, ...
/* This example is a simple iOS-style calculator. This particular example can run any platform - Web, Mobile, Desktop. This calculator version uses React-style state management. All state is held as individual use_states. */ use dioxus::events::*; use dioxus::prelude::*; fn main() { use dioxus::desktop::tao::dpi:...
use schema::Snowflake; use sdk::models::*; use thorn::pg::Json; use crate::{ ctrl::{util::encrypted_asset::encrypt_snowflake_opt, Error}, web::auth::Authorization, ServerState, }; pub async fn get_one( state: ServerState, auth: Authorization, room_id: Snowflake, msg_id: Snowflake, ) -> Re...
// Copyright 2019 <NAME> // Copyright (c) 2013, <NAME> // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distribu...
use std::{ collections::{ HashMap, HashSet, }, string::ToString, sync::Arc, }; use async_trait::async_trait; use rand::{ self, rngs::SmallRng, Rng, SeedableRng, }; use tokio::{ pin, select, sync::{ oneshot, Mutex, }, time::{ sl...
// Copyright Materialize, Inc. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance with // the Business Source License, use of this software will be governed // by the Apache License...
use super::*; use serde::ser::{SerializeStruct, Serializer}; use serde::Serialize; use crate::documents::BuildXML; use crate::xml_builder::*; #[derive(Debug, Clone, Serialize, PartialEq)] pub struct Drawing { pub position_type: DrawingPositionType, pub position_h: DrawingPosition, pub position_v: DrawingP...
/* Copyright (c) 2019 <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 use, copy, modify, merge, publish, distribute...
// External uses use jsonrpc_core::{BoxFuture, Result}; use jsonrpc_derive::rpc; // Local uses use super::{ types::{ BlockInfo, BlockNumber, Bytes, CallRequest, Filter, Log, Transaction, TransactionReceipt, H160, H256, U256, U64, }, Web3RpcApp, }; pub type BoxFutureResult<T> = BoxFuture<Res...
use rand::Rng; use std::io; use colored::*; type GameState = [i8; 9]; const X: i8 = -1; const O: i8 = 1; const EMPTY: i8 = 0; const MAX: f32 = 1000.0; const MIN: f32 = -1.0 * MAX; struct Node { game_state: GameState, value: f32, children: Vec<Node> } fn minimax_rec( node: &mut Node, player: i8...
//! Implementation of the Halo2 lookup argument. //! //! References: //! - https://zcash.github.io/halo2/design/proving-system/lookup.html //! - https://www.youtube.com/watch?v=YlTt12s7vGE&t=5237s use std::cmp::Ordering; use itertools::Itertools; use plonky2::field::extension_field::Extendable; use plonky2::field::fi...
/// Additional problems /// VI. /// 1. O(b), addition once for every b pub fn vi_1_product(a: i32, b: i32) -> i32 { let mut sum: i32 = 0; for _i in 0..b { sum += a; } sum } /// 2. O(b), function called once for every b pub fn vi_2_power(a: i32, b: i32) -> Option<i32> { if b < 0 { ...
use tol::Tol; use vectorspace::{PointT, to_pt, PV, NVS, Cross}; use curve::{Curve, Domain}; use std::f64::INFINITY; use std::f64; use point::Pt3; pub struct Line<P: PointT> { start: P, dir: P, } impl<P: PointT> Line<P> { fn start_pt(&self) -> &P { &self.start } fn direction(&self) -> <P as ...
// Traits use std::str::FromStr; // Direction #[derive(Debug,Clone,Copy,Eq,PartialEq)] enum Direction { Up, Down, Left, Right } impl FromStr for Direction { type Err = String; fn from_str(s: &str) -> Result<Self, Self::Err> { match s { "U" => Ok(Self::Up), "D" =>...
use crate::msg::StateResponse; /// /// This is a minimal example enabling the following interaction: /// /// 1. [Contract A: InitiateTransfer] A user initiates a transfer of their assets. /// 2. [Contract B: LockFunds] The funds need to be locked within the contract. /// Here it's just dummy lock of already sent coi...
use super::generators::{IndexedPolygon, SharedVertex}; use super::{Polygon, Quad, Triangle}; use std::f32::consts::PI; use {Normal, Position, Vertex}; /// Represents a cylinder with radius of 1, height of 2, /// and centered at (0, 0, 0) pointing up (to 0, 0, 1). #[derive(Clone, Copy)] pub struct Cylinder { u: usi...
/* MIT License Copyright (c) 2017 <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, distrib...
// 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. // Do not depend on this crate. Instead, use the `fuchsia_inspect_derive` crate. #![recursion_limit = "128"] extern crate proc_macro; use proc_macro::To...
use crate::{ ast::{BackendNode, NodeResult}, crocoi::stdlib::BuiltinCallback, parser::TypedArg, symbol::FunctionDecl, }; use crate::{error::CrocoError, token::CodePos}; use crate::{symbol::Decl, symbol::SymTable, token::Identifier}; use crate::{symbol_type::SymbolType, token::LiteralEnum}; use std::cell...
use ash::vk; use crate::pipeline::pass::subpass::AttachmentRawType; use crate::types::format::Format; pub trait RenderAttType: Sized { const IMAGE_LAYOUT: vk::ImageLayout; const CLEAR_VALUE: vk::ClearValue; const RAW_TYPE: AttachmentRawType; fn build() -> vk::AttachmentDescription; fn frame_view...
/*! Crypto things */ use ring::aead::BoundKey; use ring::pbkdf2; use std::num::NonZeroU32; /// ring requires an implementor of `NonceSequence`, /// which if a wrapping trait around `ring::aead::Nonce`. /// We have to make a wrapper that can pass ownership /// of the nonce exactly once. struct OneNonceSequence { i...
use crate::coercions::ContentType; use crate::errors::FunctionError; use hyper::{ header::CONTENT_TYPE, header::{HeaderName, HeaderValue}, HeaderMap, StatusCode, }; use lazy_static::lazy_static; use std::collections::HashMap; use std::convert::TryFrom; use std::str::FromStr; use std::sync::Arc; lazy_static...
use futures_util::StreamExt; use reqwest::Client; use std::cmp::min; use tokio_util::io::ReaderStream; use crate::address::ParsedAddress; use crate::bar::WrappedBar; use crate::consts::*; use crate::error::ValidateError; use crate::hash::HashChecker; use crate::io; pub struct HTTPSHandler; impl HTTPSHandler { pub...
use std::fs; pub fn part_1() { let input = parse_to_bin("./input/day_16.txt"); let mut cursor_pos = 0; let out = read_packet(&input, &mut cursor_pos, true); println!("{:?}", out); println!("{:?}", get_version_sum(out)); } pub fn part_2() { let input = parse_to_bin("./input/day_16.tx...
use crate::comms::*; use crossbeam::channel::*; use crossbeam::unbounded; use log::*; use std::{fmt, sync::atomic::AtomicBool, thread::sleep, time}; use std::{ net::{SocketAddr, TcpListener, TcpStream}, sync::Arc, }; use std::{sync::atomic::Ordering, thread}; #[derive(Debug)] pub enum CommsError { Disconne...
use crate::edit::apply_map_edits; use crate::game::{State, Transition, WizardState}; use crate::sandbox::{GameplayMode, SandboxMode}; use crate::ui::UI; use abstutil::Timer; use ezgui::{ hotkey, Choice, EventCtx, GfxCtx, HorizontalAlignment, Key, Line, ModalMenu, Text, VerticalAlignment, }; use geom::Duration; ...
#[macro_use] extern crate derive_more; extern crate bytes; extern crate futures; extern crate rand; extern crate tokio; extern crate libdingy; use libdingy::command::*; use libdingy::sync::*; use crate::server::CommandSender; use crate::server::WeechatServer; use futures::future::lazy; use futures::sync::mpsc; use std...
extern crate getopts; extern crate rev_lines; #[macro_use] extern crate prettytable; use prettytable::{Table}; use rev_lines::RevLines; use std::cmp::Ordering; use std::collections::BTreeSet; use std::fs::File; use std::io::BufReader; use std::path::Path; use std::io::Read; use getopts::Options; use std::env; u...
// Copyright 2020 Veil Rust Developers // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, // this list of conditions and the following disc...
use super::Operator; use crate::common::{CanCastTo, QError}; use std::convert::TryFrom; use std::fmt::Display; /// The optional character postfix that specifies the type of a name. /// Example: A$ denotes a string variable #[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)] pub enum TypeQualifier { /// `!` Single-p...
//! copyright //! 微信第三方平台的ticket获取存储 use super::{Component, TripartiteConfig}; use form_urlencoded; use serde::{Deserialize, Serialize}; use serde_json::json; use std::collections::HashMap; use std::fs::File; use std::io::prelude::*; use std::sync::{Arc, Mutex}; use std::time::{SystemTime, UNIX_EPOCH}; use wechat_sdk:...
// Copyright 2014 <NAME>. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. #![macro_use] use std::fmt; use std::mem; use std::num::NumCast; use std::ops::{ Index, Mul, }; use std::raw::Slice; use blas::matrix::Matrix; use blas::matrix:...
use crate::algorithms::offline::multi_dimensional::optimal_graph_search::{ optimal_graph_search, Options as OptimalGraphSearchOptions, }; use crate::algorithms::offline::multi_dimensional::Vertice; use crate::algorithms::offline::Cache; use crate::algorithms::offline::OfflineAlgorithm; use crate::algorithms::online...
#[macro_use] extern crate quicli; extern crate indicatif; extern crate regex; extern crate reqwest; use regex::Regex; use quicli::prelude::*; use std::fs; use std::io::Read; use std::net::IpAddr; use std::path::PathBuf; use std::str::FromStr; use indicatif::{HumanBytes, ProgressBar, ProgressStyle}; #[derive(Debug)...
//! A tool for analysis of binary files. use std::io::Write; use std::io; use clap::App; use clap::AppSettings; use clap::Arg; use clap::ArgMatches; use VERSION; use analysis::AnalysisArguments; use error::Result; use error::ResultExt; use file::File; use fileinfo::Fileinfo; use settings::Settings; fn parse_args<'a...
use std::cmp; use std::collections::BTreeMap; use std::ffi::OsStr; use std::fmt::Write as _; use std::fs; use std::ops::Bound; use std::path::{Path, PathBuf}; use crate::cli; use crate::config::Config; pub fn resolve(name: &str, args: &cli::Args, config: &Config) -> crate::Result<PathBuf> { if let Some(path) = re...
//! A problem based on the benchmark described in [Tabular Benchmarks for Joint Architecture and Hyperparameter Optimization][paper]. //! //! [paper]: https://arxiv.org/abs/1905.04970 use hdf5file::{self, DataObject, Hdf5File}; use kurobako_core::domain; use kurobako_core::problem::{ Evaluator, Problem, ProblemFact...
use snark_gadgets::fields::FieldGadget; use bitvec::prelude::*; use algebra::curves::bls12_381::Bls12_381 as Bls12; use algebra::curves::jubjub::JubJubProjective as JubJub; use dpc::{ crypto_primitives::crh::{pedersen::PedersenCRH, pedersen::PedersenParameters, FixedLengthCRH}, gadgets::crh::{ pederse...
use crate::instruction::{self, Instruction, Operand, Mnemonic, parse_instruction}; use crate::instruction::Operand::*; use crate::mmu::MMU; use crate::registers::{Registers, FlagsRegister, Register, self}; use crate::rom::ROM; use std::fmt; use std::io::Read; pub struct CPU { pub registers: Registers, uptime:...
//! Loading .wav files use std::fs::File; use std::path::Path; use std::io::{self, Read}; use std::error; use std::fmt; use std::mem; use std::slice; use super::*; const HEADER_SIZE: usize = 44; pub fn load<P: AsRef<Path>>(path: P) -> Result<AudioBuffer, WavError> { let path = path.as_ref(); let mut file =...
//! RCC peripheral patches. use anyhow::Result; use drone_svd::{Access, Device}; pub fn fix_1(dev: &mut Device) -> Result<()> { dev.periph("RCC").new_reg(|reg| { reg.name = "CCIPR2".to_string(); reg.description = "Peripherals independent clock configuration register".to_string(); reg.addre...
//! The Config module aims to parse gccrs target options and translate them to an output //! similar to what rustc does. This module parses a file previously created by the //! [`Gccrs::dump_config()`] function. This corresponds to invoking gccrs with the //! `-frust-dump-target_options` argument. use super::{Error, R...
use crate::{ methods::Method, request::Request, types::{ChatId, Integer, MessageId, ParseMode, ReplyMarkup, TextEntity}, }; use serde::Serialize; /// Copy messages of any kind /// /// The method is analogous to the method forwardMessages, /// but the copied message doesn't have a link to the original messa...
use proc_macro2::{Span, TokenStream}; use serde::Deserialize; use std::{fs, path::PathBuf}; use syn::{ spanned::Spanned, AttributeArgs, Error, Ident, ItemEnum, Lit, Meta, MetaNameValue, NestedMeta, Path, Result, Variant, }; #[derive(Debug)] pub struct Passes { pub base_enum: ItemEnum, pub config: Nanop...
use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Clone, Debug, Default, PartialEq)] pub struct TradeCaptureReportRequest { /// MsgType = AD #[serde(flatten)] pub standard_message_header: super::super::standard_message_header::StandardMessageHeader<'A', 'D'>, /// Identifier for the trade reque...
use crate::storage::Entry; use crate::{RaftApp, RaftCore}; use futures::StreamExt; use std::path::{Path, PathBuf}; use std::sync::Arc; use std::time::Duration; use tokio::sync::Mutex; use tokio_util::time::DelayQueue; pub(crate) struct InsertSnapshot { pub e: Entry, } pub(crate) struct SnapshotQueue { q: Mutex...
use std::convert::TryFrom; use std::error::Error; use std::fmt::Display; use std::result; use reqwest; use scraper::{node::Element, node::Node, ElementRef, Html, Selector}; use selectors::attr::CaseSensitivity; const RANKING_URL: &str = "https://ranking.cvgo.re/"; type Result<T> = result::Result<T, Box<dyn Error + S...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Port 3 Resistor Enable"] pub p3ren: P3REN, _reserved1: [u8; 7usize], #[doc = "0x08 - Port 3 Input"] pub p3in: P3IN, #[doc = "0x09 - Port 3 Output"] pub p3out: P3OUT, #[doc = "0x0a - Port 3 Direction"] pu...
use super::config::S3StoreConfig; use crate::*; use aws_s3::bucket::Bucket; use aws_s3::Region; use awscreds::Credentials; pub fn create(config: &S3StoreConfig) -> Result<Bucket, StoreError> { if let None = config.bucket_name { return Err(StoreError::BadConfiguration( "bucket_name not defined"....
use bus::{TrapContext}; use memory_manager::{MemorySet, PhysPageNum, KERNEL_SPACE, VirtAddr}; use crate::context::{TaskContext}; use bus::controller::mess_handler; use bus::config::{TRAP_CONTEXT}; use crate::pid::*; use alloc::sync::{Weak, Arc}; use alloc::vec::Vec; use spin::{Mutex, MutexGuard}; pub struct TaskContro...
/*! Type definition for a single running full node. */ use core::str::FromStr; use core::time::Duration; use eyre::eyre; use eyre::Report as Error; use ibc::core::ics24_host::identifier::ChainId; use ibc_relayer::config; use ibc_relayer::keyring::Store; use std::sync::{Arc, RwLock}; use tendermint_rpc::Url; use cr...
// Copyright 2020 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 use crate::{ constants::tss::{ TPM2_HT_AC, TPM2_HT_HMAC_SESSION, TPM2_HT_LOADED_SESSION, TPM2_HT_NV_INDEX, TPM2_HT_PCR, TPM2_HT_PERMANENT, TPM2_HT_PERSISTENT, TPM2_HT_POLICY_SESSION, TPM2_HT_SAVED_SESSION, ...
use bincode::deserialize_from; use byteorder::{BigEndian, ReadBytesExt}; use flate2::read::DeflateDecoder; use private; use serde::de::DeserializeOwned; use std::io::{BufReader, ErrorKind, Read, Seek, SeekFrom}; use std::iter::IntoIterator; use std::marker::PhantomData; use std::path::{Path, PathBuf}; use std::sync::at...
use std::fmt::Display; use iced::{ button::{self, Button}, Column, Container, Row, Sandbox, Settings, Text, }; use iced_aw::{number_input, NumberInput, Wrap}; use rand::Rng; fn main() -> iced::Result { RandStrings::run(Settings::default()) } struct RandStrings { vbuttons: Vec<StrButton>, hbuttons...
// 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 crate::{ errors::InternalPakeError, group::Group, hash::Hash, map_to_curve::GroupWithMapToCurve, serialization::serialize, }; ...
use amethyst_assets::{Format, Handle, PrefabData, ProgressCounter}; use amethyst_core::ecs::prelude::{Entity, ReadExpect, WriteStorage}; use amethyst_error::Error; use serde::{Deserialize, Serialize}; use crate::{ mtl::{Material, MaterialDefaults, TextureOffset}, transparent::Transparent, }; use super::{Text...
mod request_message; mod response_body; mod response_head; mod response_message; mod scope; use std::{ convert::{Infallible, TryFrom}, net::SocketAddr, }; use futures::{ channel::mpsc, channel::oneshot, future::{self, AbortHandle}, stream, Future, FutureExt, Stream, StreamExt, }; use http::{re...
#![allow(unsafe_code)] use std::{cell::UnsafeCell, ptr}; use super::lru::CacheAccess; /// A simple doubly linked list for use in the `Lru` #[derive(Debug)] pub(crate) struct Node { inner: UnsafeCell<CacheAccess>, next: *mut Node, prev: *mut Node, } impl std::ops::Deref for Node { type Target = Cache...
mod datasets_paths; mod utils; use criterion::{criterion_group, criterion_main}; use milli::update::Settings; use utils::Conf; #[cfg(target_os = "linux")] #[global_allocator] static ALLOC: jemallocator::Jemalloc = jemallocator::Jemalloc; fn base_conf(builder: &mut Settings) { let displayed_fields = ["id"...
#![cfg_attr(not(feature = "std"), no_std)] // Needed for deriving `Serialize` and `Deserialize` for various types. // We only implement the serde traits for std builds - they're unneeded // in the wasm runtime. #[cfg(feature = "std")] #[macro_use] extern crate serde; extern crate parity_codec; extern crate sr_primit...
use { EventMapper, string }; use error::*; use event::Event; use event_handler_map::EventHandlerMap; use file_funcs; use libflo_func::{ FuncMapper, Parameter, Result as FuncResult }; use libflo_func::serialization::ParameterSerde; use libflo_module::{ ModuleMapper, PathResolver, self_module_name }; use serialization::{...
use crate::lib::error::DfxResult; use crate::{error_invalid_argument, error_invalid_data, error_unknown}; use candid::parser::typing::{check_prog, TypeEnv}; use candid::types::{Function, Type}; use candid::{parser::value::IDLValue, IDLArgs, IDLProg}; use net2::TcpListenerExt; use net2::{unix::UnixTcpBuilderExt, TcpBui...
// Copyright 2019, 2020 Finastate // // 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...
// 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 writi...
use std::panic; use riptables::RIPTables; use riptables::rule::Archive; fn riptables() -> RIPTables { riptables::new(false).unwrap() } //#[test] //fn test_split() { // let vec = riptables::split_quoted("-m comment --comment \"double-quoted comment\" -j ACCEPT"); // println!("{:?}", vec) //} #[test] fn nat() { ...
#![recursion_limit = "128"] //! An attribute-like procedural macro for unrolling for loops with integer literal bounds. //! //! This crate provides the [`unroll_for_loops`] attribute-like macro that can be applied to //! functions containing for-loops with integer bounds. This macro looks for loops to unroll and //! ...
use anyhow::{anyhow, Context, Result}; use camino::Utf8PathBuf; use which::which; use std::{convert::TryFrom, fs, str}; use crate::{ tools::Runner, utils::{CommandOutput, PKG_PROJECT_ROOT, PKG_VERSION}, }; pub(crate) struct NpmRunner { runner: Runner, npm_installer_package_directory: Utf8PathBuf, ...
mod utils; mod utils_toml; mod wasm; mod build; mod patch; mod verify; use anyhow::Context; use clap::Clap; use std::path::PathBuf; #[derive(Clap, Debug)] /// Either a path, git repo or crates.io crate pub struct Input { #[clap(default_value = ".")] path: PathBuf, #[clap(long, conflicts_with = "path")] ...
extern crate num_traits; use num_traits::Zero; use std::ops::{Add, Sub}; use std::mem; use std::cmp; use std::fmt::Debug; use cmap::*; /***************************************************************************** * Binary Index Tree, per <NAME> **********************************************************************...
use std::cmp::min; use std::ops::Deref; use std::path::Path; use std::rc::Rc; use terminus_spaceport::devices::term_exit; use terminus_spaceport::memory::region::{BytesAccess, Region, U64Access, GHEAP}; use terminus_spaceport::memory::MemInfo; use terminus_spaceport::space::Space; use terminus_spaceport::{space, EXIT_C...
//! System modules, formerly known as "system contracts" pub mod auction; pub mod mint; pub mod proof_of_stake; pub mod standard_payment; pub use error::Error; pub use system_contract_type::{ SystemContractType, AUCTION, MINT, PROOF_OF_STAKE, STANDARD_PAYMENT, }; mod error { use failure::Fail; use crate...
#[cfg(feature = "failure")] use failure::Error; #[cfg(feature = "signals")] use mio::unix::EventedFd; #[cfg(feature = "signals")] use nix::sys::{ signal::{self, SigSet}, signalfd::{SignalFd, SfdFlags} }; #[cfg(feature = "signals")] use std::os::unix::io::AsRawFd; use mio::*; use pseudoterm::RawTerminal; use st...
// You can run this example from the root of the mio repo: // cargo run --example tcp_listenfd_server --features="os-poll net" // or with wasi: // cargo +nightly build --target wasm32-wasi --example tcp_listenfd_server --features="os-poll net" // wasmtime run --tcplisten 127.0.0.1:9000 --env 'LISTEN_FDS=1' target/wasm...
use ndarray::{s, ArrayBase, DataMut, Ix2}; use ndarray_linalg::{c32, c64, error::LinalgError, AllocatedArray, MatrixLayout, Pivot, Scalar}; use std::cmp; /// Computes P * L after LU decomposition. #[allow( clippy::cast_sign_loss, clippy::cast_possible_truncation, clippy::cast_possible_wrap )] pub(crate) fn...
use std::prelude::v1::*; use crate::msgs::codec::{Codec, Reader}; use crate::msgs::base::Payload; use crate::msgs::alert::AlertMessagePayload; use crate::msgs::ccs::ChangeCipherSpecPayload; use crate::msgs::handshake::HandshakeMessagePayload; use crate::msgs::enums::{ContentType, ProtocolVersion}; use crate::msgs::enu...
//! # UART IRQ Echo Example //! //! This application demonstrates how to use the UART Driver to talk to a serial //! connection. In this example, the IRQ owns the UART and you cannot do any UART //! access from the main thread. //! //! The pinouts are: //! //! * GPIO 0 - UART TX (out of the RP2040) //! * GPIO 1 - UART ...
/*! # Reading and loading hyphenation dictionaries To hyphenate words in a given language, it is first necessary to load the relevant hyphenation dictionary into memory. This module offers convenience methods for common retrieval patterns, courtesy of the [`Load`] trait. ``` use hyphenation::Load; use hyphenation::{S...
#![allow(dead_code)] use std::fs::{create_dir_all, remove_dir_all, File}; use std::io::{self, Cursor, Read, Seek}; use std::path::Path; use criterion::BenchmarkId; use heed::EnvOpenOptions; use milli::documents::DocumentBatchReader; use milli::update::{IndexDocumentsMethod, Settings, UpdateBuilder}; use milli::{Filte...
//! This module implements the required conversions from Rust types to TVM types. //! //! In TVM frontend only conversions from 32bits numeric types (i32, u32, f32) //! and 64bits pointers are supported. //! //! # Example //! //! ``` //! let dtype = TVMType::from("float"); //! println!("dtype is: {}", dtype); //! ``` ...
use crate::types::{SignedData, SignedTransaction, H256}; use std::error::Error; use std::fmt::{Display, Formatter, Result as FmtResult}; /// Data for recovering the public address of signed data. /// /// Note that the signature data is in 'Electrum' notation and may have chain /// replay protection applied. That means...
// 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 writi...
extern crate env_logger; #[macro_use] extern crate log; #[macro_use] extern crate error_chain; extern crate futures; extern crate hyper; extern crate structopt; #[macro_use] extern crate structopt_derive; extern crate futures_cpupool; extern crate rand; extern crate sse; extern crate tokio_core; extern crate tokio_time...
use std::collections::BTreeMap; use std::sync::Arc; use std::{fmt, result}; use derivative::Derivative; use hex_fmt::HexFmt; use log::debug; use serde_derive::Serialize; use super::proposal_state::{ProposalState, Step as ProposalStep}; use super::{Error, Message, MessageContent, Result}; use rand::Rand; use {util, Di...
use std::io::{Read, Write}; use bitflags::bitflags; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use super::{ header::{Header, OpCode}, util::CountReader, }; use crate::{ cmap::conn::command::Command, error::{ErrorKind, Result}, }; use crate::bson::{self, Document}; /// Represents an O...
// -*- mode: rust; -*- // // This file is part of redjubjub. // Copyright (c) 2019-2021 Zcash Foundation // Copyright (c) 2017-2021 <NAME>, <NAME> // See LICENSE for licensing information. // // Authors: // - <NAME> <<EMAIL>> // - <NAME> <<EMAIL>> // - <NAME> <<EMAIL>> use std::{borrow::Borrow, fmt::Debug}; use jubju...
use thoth_api::model::funder::Funder; use thoth_api::model::{Doi, DOI_DOMAIN}; use thoth_errors::ThothError; use yew::html; use yew::prelude::*; use yew::ComponentLink; use yew_router::agent::RouteAgentDispatcher; use yew_router::agent::RouteRequest; use yew_router::route::Route; use yewtil::fetch::Fetch; use yewtil::f...
use rustual_boy_core::rom::*; use rustual_boy_core::sinks::*; use rustual_boy_core::sram::*; use rustual_boy_core::virtual_boy::VirtualBoy; use rustual_boy_middleware::{Anaglyphizer, GammaAdjustSink, MostRecentSink}; use minifb::{WindowOptions, Window, Scale}; use std::collections::VecDeque; use std::io::{self, Read...
#![deny(rust_2018_idioms)] #![warn( missing_debug_implementations, clippy::explicit_iter_loop, clippy::use_self )] use arrow_deps::{arrow::record_batch::RecordBatch, datafusion::logical_plan::LogicalPlan}; use async_trait::async_trait; use data_types::{ data::ReplicatedWrite, partition_metadata::Table ...
//! Higher-level git operations //! //! These are closer to what you expect to see for porcelain commands, rather than just plumbing. //! They serve as both examples on how to use `git2` but also should be usable in some limited //! subset of cases. use itertools::Itertools; /// Lookup the commit ID for `HEAD` pub fn...
use serde::{Deserialize, Serialize}; use std::{env, fs, path::Path}; #[derive(Hash, PartialEq, Eq, Serialize, Deserialize)] struct BindSource { group: u32, binding: u32, } #[derive(Serialize, Deserialize)] struct BindTarget { #[serde(default)] buffer: Option<u8>, #[serde(default)] texture: Opt...
use proc_macro2::{Group, Ident, Literal, TokenStream, TokenTree}; use std::iter::FromIterator; mod error; mod tokenizer; use error::Error; use tokenizer::{TagOpen, Token}; pub struct RegularElement { open: TagOpen, children: Vec<Element>, } pub enum Element { Regular(RegularElement), Literal(Literal...
// Copyright (c) SimpleStaking and Tezedge Contributors // SPDX-License-Identifier: MIT use std::mem::size_of; use getset::Getters; use serde::{Deserialize, Serialize}; use tezos_encoding::encoding::{Encoding, Field, HasEncoding, Tag, TagMap}; use tezos_encoding::has_encoding; use crate::cached_data; use crate::p2p...
// Copyright 2018-2019 the Deno authors. All rights reserved. MIT license. use crate::array_buffer::Allocator; use crate::promise::PromiseRejectMessage; use crate::support::Delete; use crate::support::Opaque; use crate::support::UniqueRef; use crate::Local; use crate::Message; use crate::Value; use std::ops::Deref; use...
use core::marker::PhantomData; use core::sync::atomic::{AtomicPtr, Ordering}; use core::ptr; use crate::{Result, UsbDirection}; use crate::bus::UsbBus; /// Trait for endpoint type markers. pub trait EndpointDirection { /// Direction value of the marker type. const DIRECTION: UsbDirection; } /// Marker type fo...
// Copyright 2020 Google LLC // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not be copied, modified, or distributed // except according to...
use std::fmt; use std::str::FromStr; use serde::{Deserialize, Serialize}; use crate::error::Error; use crate::{AscDesc, Member, UserError}; #[derive(Debug)] pub enum CriterionError { InvalidName { name: String }, ReservedName { name: String }, ReservedNameForSort { name: String }, ReservedNameForFilt...
use std::io::{self, BufRead, Read, Write}; use threads::{detailed::Detailed, Actor, Root}; fn usage(code: i32) -> ! { print!( "\ Dummy client to interact with threads, from the perspective of each actor. USAGE: cargo run -- SUBCOMMAND FLAGS: -h, --help Prints help information -a, --acto...