text
stringlengths
3.09k
13.9k
use std::any::Any; use std::cell::{Cell, RefCell}; use std::rc::Rc; use ranger::{ animation::motion::AngularMotion, geometry::point::Point, nodes::{ custom_nodes::{orbit_anchor_node::OrbitAnchorNode, transform_filter::TransformFilter}, node_functions::NodeFunctions, node_group::Node...
//! This example is currently broken because I don't understand the new egui //! textures since 0.17 #![cfg(feature = "egui")] use std::ops::{Deref, DerefMut}; use crate::{BindGroup, Buffer, Gpu, RenderPass, RenderPipeline, Sampler}; pub struct Egui { pub ctx: egui::Context, gpu: Gpu, vertex_buffers: Ve...
mod authentication; mod v0; use actix_service::ServiceFactory; use actix_web::{ dev::{MessageBody, ServiceRequest, ServiceResponse}, middleware, App, HttpServer, }; use rustls::{ internal::pemfile::{certs, rsa_private_keys}, NoClientAuth, ServerConfig, }; use std::{fs::File, io::BufReader,...
// Copyright 2020-2021, <NAME>, <NAME>, <NAME>, <NAME>, <NAME>, <NAME> // SPDX-License-Identifier: MIT OR Apache-2.0 #![warn(clippy::all, clippy::style, clippy::pedantic)] #![allow(dead_code, clippy::module_name_repetitions, clippy::filter_map)] #[macro_use] extern crate log; use std::{env, fs::File, net::SocketAddr...
// 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, distri...
use iced::{ button, executor, keyboard, Align, Application, Button, Checkbox, Clipboard, Column, Command, Container, Element, HorizontalAlignment, Length, Settings, Subscription, Text, }; use iced_native::{ keyboard::{ Event::{KeyPressed, KeyReleased}, KeyCode, }, Event::{self, Keybo...
//! Operations on a net_prio subsystem. //! //! [`Subsystem`] implements [`Cgroup`] trait and subsystem-specific operations. //! //! For more information about this subsystem, see the kernel's documentation //! [Documentation/cgroup-v1/net_prio.txt]. //! //! # Examples //! //! ```no_run //! # fn main() -> controlgroup:...
//! Client specific web API (proxy and storage). use std::collections::HashMap; use std::sync::{Arc, Mutex}; use std::path::PathBuf; use std::marker::PhantomData; use serde::Serialize; use rocket::{ self, State, Request, http::{Status, Cookie, Cookies}, response::{NamedFile, Responder}, }; use rocket_contrib::...
/*! **TODO:** This submodule contains the table parsing functions, that the state machine uses as helpers in constructing tables. Copyright © 2020 <NAME> */ use crate::parser::line_cursor::LineCursor; use crate::parser::Parser; use crate::parser::types_and_aliases::TextBlockResult; #[derive(Debug)] /// A data struct...
use regex::Regex; use std::collections::HashMap; #[cfg(test)] mod tests { use super::*; #[test] fn no1_sample_test() { let input = indoc!( "p=<3,0,0>, v=<2,0,0>, a=<-1,0,0> p=<4,0,0>, v=<0,0,0>, a=<-2,0,0>" ); assert_eq!(0, run1(input)); } #[test] fn no2_sample_test() { let in...
use core::cmp::{max, min}; use lazy_static::lazy_static; use std::collections::HashMap; use std::sync::Mutex; use wasm_bindgen::prelude::*; mod g; use crate::g::*; #[wasm_bindgen] extern "C" { #[wasm_bindgen(js_namespace = console)] fn log(s: &str); } struct Grid { width: i32, min_x: i32, min_y: ...
use super::prelude::*; use chrono::{Duration, SecondsFormat, Utc}; use chrono_humanize::{Accuracy, HumanTime, Tense}; use chrono_tz::{Tz, UTC}; use futures::stream::StreamExt; use nanorand::Rng; use serde::{Deserialize, Serialize}; use serenity::model::interactions::message_component::ButtonStyle; use strum::EnumIter...
use rayon::prelude::*; use std::io::{stdin, BufRead}; #[cfg(test)] use std::time::Instant; enum SnowmanResult { Success(String), NoMoreWords(bool), Considering(Vec<String>, char), ConsideringMany(usize, char), UnknownError, } const WORDS_LIST: &str = include_str!("word_list.txt"); const CHARS: [char; 26] = [ 'a...
use clap::{crate_authors, crate_description, crate_name, crate_version, App, Arg, ArgMatches}; use std::path::Path; pub const PS_AUTHENTICODE_HEADER: &str = "# SIG # Begin signature block"; pub const PS_AUTHENTICODE_FOOTER: &str = "# SIG # End signature block"; pub const PS_AUTHENTICODE_LINES_SPLITTER: &str = "# "; pu...
use crate::dns_packet::{BufferIO, Packet, Query, QueryType, ReturnCode}; use crate::packet_buffer::PacketBuffer; use std::net::{IpAddr, Ipv4Addr, SocketAddr, UdpSocket}; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; pub struct Resolver { socket: UdpSocket, } impl Resolver { pub fn new...
pub mod endian; pub mod geo; pub mod headers; pub mod hrap; pub mod read_bytes; pub mod utils; pub mod xmrg_version; use std::fs::File; use std::io; use std::io::prelude::*; use std::io::BufReader; use std::io::SeekFrom; use endian::get_endian; use geo::Feature; use headers::{build_4_2_reader, Header, Metadata}; use ...
// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use crate::{ packet::number::PacketNumberSpace, path::MINIMUM_MTU, recovery::{ pacing::{Pacer, INITIAL_INTERVAL, N, SLOW_START_N}, RttEstimator, }, time::{Clock, NoopClock, T...
//! A proc macro for pretty-printing ASTs (and nested structures in general). #![feature(proc_macro_diagnostic)] extern crate syn; #[macro_use] extern crate quote; mod gen; use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::ToTokens; use syn::{spanned::Spanned, Ident, ItemEnum, Item...
#![cfg_attr(feature = "cargo-clippy", allow(needless_pass_by_value))] //! This is a webui about to replace the TUI, to be nice, better accessable, and //! new technology using websockets mod actors; mod json; mod pages; mod rest_mod; use super::{ super::{ common::{config, paths::SearchPath}, ctrl:...
use crate::{ cache::AssetMap, key::AnyAsset, source::Source, utils::{HashMap, OwnedKey}, AnyCache, Compound, SharedString, }; use super::{dependencies::DepsGraph, records::Dependencies}; pub(crate) type ReloadFn = fn(cache: AnyCache, id: &str) -> Option<Dependencies>; #[derive(Clone, Copy)] struc...
use lru_cache::LruCache; use percent_encoding::{utf8_percent_encode, AsciiSet, CONTROLS}; use pnet::datalink; use regex::Regex; use std::cmp::Ordering; use std::net::IpAddr; use crate::types::{Container, Item, ListItem, ListItemWrapper, Res}; const FRAGMENT: &AsciiSet = &CONTROLS .add(b' ') .add(b'"') .ad...
use std::marker::PhantomData; use std::mem::MaybeUninit; use std::sync::Arc; use crate::{Address, EnetKeepAlive, Error, Event, Peer}; use enet_sys::{ enet_host_bandwidth_limit, enet_host_channel_limit, enet_host_check_events, enet_host_connect, enet_host_destroy, enet_host_flush, enet_host_service, ENetHost, ...
//! Implements a command for showing infos from Sentry. use std::cmp::min; use std::collections::HashMap; use std::env; use std::fs; use std::io::{BufRead, BufReader}; use std::path::Path; use clap::{App, Arg, ArgMatches}; use failure::Error; use regex::Regex; use sentry::capture_event; use sentry::protocol::{Event, E...
// html_processor_mod.rs use crate::html_templating_data_trait_mod::*; use crate::trait_utils_mod; use dev_bestia_string_utils::*; use lazy_static::lazy_static; use unwrap::unwrap; // conditional only for wasm (on web-browser client) #[cfg(target_arch = "wasm32")] lazy_static! { pub static ref PREFIX: PrefixForT...
use anyhow::{self, Context}; use aoc_2021::input::get_input_file; use std::fmt::{self, Display}; use std::io::prelude::*; fn main() -> anyhow::Result<()> { let (drawn_numbers, mut boards) = get_problem_input().context("Could not get problem input.")?; let mut last_winning_board_idx = None; let num...
//! # Common types for HTTP operations. //! //! `http-types` provides shared types for HTTP operations. It combines a performant, streaming //! interface with convenient methods for creating headers, urls, and other standard HTTP types. //! //! # Example //! //! ``` //! # fn main() -> Result<(), http_types::url::ParseE...
use cfg_if::cfg_if; use serde::Deserialize; use js_sys::*; use std::collections::HashMap; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::*; use web_sys::*; cfg_if! { // When the `console_error_panic_hook` feature is enabled, we can call the // `set_panic_hook` function at least once during initializat...
use crate::settings; #[derive(Debug)] pub struct Blit { format: wgpu::TextureFormat, pipeline: wgpu::RenderPipeline, constants: wgpu::BindGroup, texture_layout: wgpu::BindGroupLayout, sample_count: u32, targets: Option<Targets>, } impl Blit { pub fn new( device: &wgpu::Device, ...
use crate::consts::{constant, Constant}; use crate::utils::paths; use crate::utils::{is_direct_expn_of, is_expn_of, match_function_call, snippet_opt, span_lint_and_help}; use if_chain::if_chain; use rustc_hir::{Expr, ExprKind, PatKind, UnOp}; use rustc_lint::{LateContext, LateLintPass}; use rustc_session::{declare_lint...
use std::cell::RefCell; use std::rc::Rc; use gtk::prelude::*; use gtk::{glib, pango}; use nvim_rs::Tabpage; use crate::nvim_gio::{GioNeovim, GioWriter}; use crate::ui::color::{Color, HlDefs, HlGroup}; use crate::ui::common::{calc_line_space, spawn_local}; use crate::ui::font::{Font, FontUnit}; #[derive(Default)] pu...
use anyhow::Result; use once_cell::sync::OnceCell; use serde::Deserialize; use std::{ net::SocketAddr, num::ParseIntError, path::{Path, PathBuf}, time::Duration, }; use tokio::fs; static CONFIG: OnceCell<Config> = OnceCell::new(); /// Parse the configuration from a given file pub async fn parse<P: AsR...
use std::fmt; use std::fmt::Display; use std::convert::TryFrom; use std::slice::Iter; #[derive(Debug, )] pub enum Sharpness { Red, Orange, Yellow, Green, Blue, White, Purple, } impl Sharpness { pub fn get_raw_multiplicity(&self) -> f32 { match self { Self::Red => 0....
use dotenv::dotenv; use std::env; use serde::{Deserialize, Serialize}; use serde_json::{json}; #[derive(Deserialize, Serialize)] #[serde(rename_all = "camelCase")] struct Params { #[serde(skip_serializing_if="Option::is_none")] context: Option<wa::UnknownType>, #[serde(skip_serializing_if="Option::is_none"...
use fp2::Fp2; use fp::Fp; use subtle::{Choice, ConditionallyAssignable}; use typenum; use rand; #[derive(Copy, Clone)] pub struct G2Projective { pub x: Fp2, // (2, 2) pub y: Fp2, // (2, 2) pub z: Fp2, // (2, 2) pub infinity: Choice, } pub struct G2Affine { pub x: Fp2, // (1, 1) pub y: Fp2, // ...
extern crate chrono; extern crate failure; extern crate futures; #[macro_use] extern crate hyper; extern crate hyper_tls; #[macro_use] extern crate json_api; #[macro_use] extern crate log; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate tokio_core; extern crate uuid; m...
/* * Copyright (c) 2020 <NAME> * All rights reserved. * 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 * ...
// Copyright (c) 2021 Quark Container 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 ...
// Copyright (c) Microsoft. All rights reserved. impl crate::ex_data::HasExData<crate::ex_data::KeyExData> for openssl_sys::EC_KEY { unsafe fn index() -> openssl::ex_data::Index<Self, crate::ex_data::KeyExData> { crate::ex_data::ex_indices().ec_key } } #[no_mangle] #[allow(clippy::similar_names)] unsa...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] use crate::cli::{abort_on_error, abort_with_error, Options, INLINE_PRELUDE}; use crate::translator::{BoogieTranslator, FunctionInfo, ModuleInfo}; use bytecode_source_map::source_map::SourceMap; use bytecode_ver...
//! ## TinyTemplate //! //! TinyTemplate is a minimal templating library originally designed for use in [Criterion.rs]. //! It deliberately does not provide all of the features of a full-power template engine, but in //! return it provides a simple API, clear templating syntax, decent performance and very few //! depen...
use core::mem::size_of; #[cfg(feature = "std")] use std::io::{self, Write}; use bytemuck::{bytes_of, Pod, Zeroable}; #[cfg(feature = "std")] use crate::std140::Writer; /// Trait implemented for all `std140` primitives. Generally should not be /// implemented outside this crate. pub unsafe trait Std140: Copy + Zeroab...
use ring::digest; use std::mem; use msgs::codec::Codec; use msgs::message::{Message, MessagePayload}; /// This deals with keeping a running hash of the handshake /// payloads. This is computed by buffering initially. Once /// we know what hash function we need to use we switch to /// incremental hashing. /// /// For...
// #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] #![allow(improper_ctypes)] use std::ffi::CString; use std::mem; use std::os::raw::c_void; use std::ptr::{null, null_mut}; use winapi::LUID; use winapi::winerror::ERROR_SUCCESS; use winapi::winnt; use kernel32; use advapi32; type BYTE ...
use crate::service::{ServiceConf, KafkaConf}; use log::debug; use serde::Deserialize; use serde_json; use std::fs; pub struct ServcieRegistryConf { pub file: Option<String>, pub consul: Option<ConsulConf>, } pub struct ConsulConf { pub addr: String, pub channel_path: String, } pub struct ServiceRegis...
use crate::completions::{ CommandCompletion, Completer, CompletionOptions, CustomCompletion, DirectoryCompletion, DotNuCompletion, FileCompletion, FlagCompletion, MatchAlgorithm, VariableCompletion, }; use nu_parser::{flatten_expression, parse, FlatShape}; use nu_protocol::{ engine::{EngineState, Stack, Sta...
use std::net::IpAddr; use std::str::FromStr; use bgp_models::mrt::{Bgp4MpType, CommonHeader, EntryType, MrtMessage, MrtRecord}; use bgp_models::network::{Afi, AsnLength}; use serde_json::Value; use crate::{BgpElem, Elementor}; use crate::parser::bgp::parse_bgp_message; use crate::parser::DataBytes; use crate::parser::r...
#![allow(unused)] use poisson::{Type, Builder, Vector, Float, algorithm}; use rand::SeedableRng; use rand::rngs::SmallRng; use rand::FromEntropy; extern crate num_traits; use self::num_traits::NumCast; extern crate alga; use self::alga::general::AbstractField; use self::alga::linear::{NormedSpace, FiniteDimVectorSpa...
use std::sync::mpsc::Sender; use mysql_async::Conn; use mysql_async::prelude::*; use scraper::{Html, Selector}; use urlencoding::encode; use crate::parser::ico::{get_ico_text_status, ICO}; use crate::synchronizer::config::MySQLConfig; use reqwest::{Response, Error}; pub mod ico; pub struct Parser { mysql_connec...
//! A module for handling accesses to the device memory. use std::fmt; use crate::ir::{self, dim, InstId, Type}; use fxhash::FxHashSet; use serde::{Deserialize, Serialize}; use utils::*; // TODO(cleanup): move layouts into internal blocks. /// Uniquely identifies a block. #[derive( Clone, Copy, PartialEq, Eq, H...
//! Types and functions dealing with positions within the source code //! use std::ops::{self, Add, Sub}; use std::cmp::{min, max}; use std::fmt; // Helps implementing basic operators, like `Add` and `Sub` macro_rules! impl_math { ($ty_name:ident, $trait_name:ident, $fun_name:ident) => { impl $trait_name ...
use crate::{ circuits::{ gate::CircuitGate, gates::poseidon::{self, ROUNDS_PER_ROW}, wires::{Wire, COLUMNS}, }, prover_index::testing::new_index_for_test, verifier::batch_verify, }; use crate::{prover::ProverProof, prover_index::ProverIndex}; use ark_ff::{UniformRand, Zero}; use ...
#[doc = "Reader of register EMACTRL"] pub type R = crate::R<u32, super::EMACTRL>; #[doc = "Writer for register EMACTRL"] pub type W = crate::W<u32, super::EMACTRL>; #[doc = "Register EMACTRL `reset()`'s with value 0"] impl crate::ResetValue for super::EMACTRL { type Type = u32; #[inline(always)] fn reset_va...
//! Clock applet //! //! Show the current time in the bottom left corner of the screen. #![no_std] // rustc warnings #![warn(unused)] #![warn(missing_debug_implementations)] #![allow(unused_unsafe)] #![allow(unreachable_code)] #![allow(dead_code)] #![cfg_attr(test, allow(unused_imports))] // rustdoc warnings #![warn...
#[doc = "Reader of register R5VADCCTRL"] pub type R = crate::R<u32, super::R5VADCCTRL>; #[doc = "Writer for register R5VADCCTRL"] pub type W = crate::W<u32, super::R5VADCCTRL>; #[doc = "Register R5VADCCTRL `reset()`'s with value 0"] impl crate::ResetValue for super::R5VADCCTRL { type Type = u32; #[inline(always...
use std::ops::{Add, Sub, Mul}; use std::num::Wrapping; macro_rules! wrapping_impl { ($trait_name:ident, $method:ident, $t:ty) => { impl $trait_name for $t { #[inline] fn $method(&self, v: &Self) -> Self { <$t>::$method(*self, *v) } } }; ($...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Version ID Register"] pub verid: crate::Reg<verid::VERID_SPEC>, #[doc = "0x04 - Parameter Register"] pub param: crate::Reg<param::PARAM_SPEC>, #[doc = "0x08 - Module Control Register"] pub mcr: crate::Reg<mcr::MCR_S...
use std::{ collections::{btree_map, BTreeMap, HashSet}, iter::{Iterator, Peekable}, }; use oasis_core_runtime::storage::mkvs; use super::Store; pub struct OverlayStore<S: Store> { parent: S, overlay: BTreeMap<Vec<u8>, Vec<u8>>, dirty: HashSet<Vec<u8>>, } impl<S: Store> OverlayStore<S> { pub ...
// # Custom collector example // // This example shows how you can implement your own // collector. As an example, we will compute a collector // that computes the standard deviation of a given fast field. // // Of course, you can have a look at the tantivy's built-in collectors // such as the `CountCollector` for more...
// Copyright 2018 Google Inc. All rights reserved. // // 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...
//! Function components are a simplified version of normal components. //! They consist of a single function annotated with the attribute `#[function_component(_)]` //! that receives props and determines what should be rendered by returning [`Html`]. //! //! ```rust //! # use yew_functional::function_component; //! # u...
use bit_manager::data::BitStore; use bit_manager::{BitRead, BitWrite, Result}; use nalgebra::{Point2, Rotation2, Vector2}; use specs::prelude::{Component, DenseVecStorage, FlaggedStorage, VecStorage}; use specs::storage::NullStorage; use registry::Registry; use repl; use repl::interp::Interp; pub fn register(reg: &...
use tract_core::internal::*; use crate::tfpb::node_def::NodeDef; use crate::model::ParsingContext; pub fn pack(_ctx: &ParsingContext, pb: &NodeDef) -> TractResult<Box<InferenceOp>> { let dtype = pb.get_attr_datum_type("T")?; let n = pb.get_input().len(); let axis = pb.get_attr_int("axis")?; Ok(Box::n...
#![macro_use] use nrf52840_hal as _; use nrf_softdevice::pac; use nrf_softdevice_defmt_rtt as _; // global logger use panic_probe as _; use alloc_cortex_m::CortexMHeap; use core::alloc::Layout; use core::sync::atomic::{AtomicUsize, Ordering}; use defmt::{panic, *}; // this is the allocator the application will use #...
// Day 8: Seven Segment Search // https://adventofcode.com/2021/day/8 use std::collections::HashMap; use std::collections::HashSet; use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; use structopt::StructOpt; /// parse command line arguments #[derive(StructOpt)] struct Cli { #[structopt(default...
use crate::hal::scaler::FontScaler; use crate::hal::{Font, Shader, VertexArray, VertexArrayEntry, BACKEND}; use crate::prelude::Tile; use crate::BResult; use bracket_color::prelude::RGBA; pub struct SimpleConsoleBackend { vao: VertexArray, vertex_counter: usize, index_counter: usize, previous_console :...
use std::io::BufRead; use std::str::FromStr; use std::time::Instant; use aoc_2021::shared; fn main() { let start = Instant::now(); let args = shared::get_args(); let mut row = 0; let mut num_line: String = FromStr::from_str("").unwrap(); let mut board_lines: Vec<String> = Vec::new(); shared::g...
use bitcoin_fee_model::process_blocks; use bitcoin_fee_model::{bitcoin, get_model_high, get_model_low}; use bitcoincore_rpc::bitcoin::consensus::serialize; use bitcoincore_rpc::bitcoin::Block; use bitcoincore_rpc::bitcoincore_rpc_json::bitcoin::consensus::Decodable; use bitcoincore_rpc::{Auth, Client, RpcApi}; use log:...
// This is a part of Chrono. // See README.md and LICENSE.txt for details. //! ISO 8601 week. use core::fmt; use super::internals::{DateImpl, Of, YearFlags}; /// ISO 8601 week. /// /// This type, combined with [`Weekday`](../enum.Weekday.html), /// constitues the ISO 8601 [week date](./struct.NaiveDate.html#week-da...
use std::convert::TryInto; use std::{io::Read, sync::Arc}; use parquet_format_async_temp::thrift::protocol::TCompactInputProtocol; use crate::compression::Compression; use crate::error::Result; use crate::metadata::ColumnDescriptor; use crate::page::{ read_dict_page, CompressedDataPage, DataPageHeader, DictPage,...
// Copyright 2016 FullContact, Inc // // 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 accordin...
/// Event is a report of an event somewhere in the cluster. It generally denotes some state change in the system. /// Events have a limited retention time and triggers and messages may evolve /// with time. Event consumers should not rely on the timing of an event /// with a given Reason reflecting a consistent underl...
// http://rosettacode.org/wiki/Arithmetic/Rational #![feature(zero_one)] use std::num::{Zero, One}; use std::fmt; use std::cmp::Ordering; use std::ops::{Add, Mul, Neg, Sub, Div}; fn main() { for p in perfect_numbers(1 << 19) { println!("{} is perfect", p); } } fn perfect_numbers(max: i64) -> Vec<i64...
/* * 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 cosignerd::{ config::Config, daemonize::daemonize, database::setup_db, keys::{read_bitcoin_privkey, read_or_create_noise_key}, processing::process_sign_message, }; use revault_net::{ message::cosigner::SignRequest, noise::{PublicKey as NoisePubkey, SecretKey as NoisePrivkey}, sodiumo...
#![feature(test)] extern crate test; #[macro_use] extern crate lazy_static; use std::collections::{HashMap, HashSet}; lazy_static! { static ref INPUT: Data<String> = include_str!("../input").parse().expect("invalid input"); } #[derive(Clone)] struct Data<T>(Vec<(HashSet<T>, HashSet<T>)>); impl<T: Eq + std::has...
// The MIT License (MIT) // // Copyright (c) 2014 <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, mo...
use super::rk4; use traits::*; pub enum Method { //RK2, RK4, } /** * # Default values * * When creating a new `Solver` with `Solver::new()`, this is the default * configuration: * * - [method](struct.Solver.html#method.method): `Method::RK4` * * - [weights](struct.Solver.html#method.weights) for the i...
use std::marker::PhantomData; use crate::common::models::DerivativeParameter; use crate::simulation::monte_carlo::{MonteCarloPathSimulator, PathEvaluator}; use crate::simulation::sde::gbm::GeometricBrownianMotion; pub struct MonteCarloEuropeanOption<SeedRng> where SeedRng: rand::SeedableRng + rand::RngCore, { ...
use cosmwasm_std::{Addr, Binary, Timestamp, Uint128}; use cw20::{Cw20Coin, Expiration, Logo, MinterResponse}; use cw20_base::msg::InstantiateMarketingInfo; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::state::Redeem; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pu...
// Copyright (c) 2019, Arm Limited, All Rights Reserved // 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.apache.org/license...
use serde::{Deserialize, Serialize}; use std::convert::{TryFrom, TryInto}; lazy_static! { static ref RESPONSE_HEADER_SIZE: u64 = bincode::serialized_size(&ResponseHeader::default()) .expect("Unable to get size of default RequestHeader."); } // The actual data is appended after this header has been seriali...
use std::str::from_utf8; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; use crate::arm7tdmi::{ bus::{Bus, MemoryAccess, MemoryAccessWidth}, Addr, }; use crate::sysbus::WaitState; use crate::util::read_bin_file; use crate::GBAError; /// From GBATEK /// /// The first 192 bytes at 8000000h-80000BFh...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - CIR Transmit Global Register"] pub cir_tglr: crate::Reg<cir_tglr::CIR_TGLR_SPEC>, #[doc = "0x04 - CIR Transmit Modulation Control Register"] pub cir_tmcr: crate::Reg<cir_tmcr::CIR_TMCR_SPEC>, #[doc = "0x08 - CIR Transmi...
use crate::{ proto::packet_ids::play as packet_ids, writer::StructuredWriter, BinaryReader, BinaryWriter, Error, }; use async_std::io::{Read, Write}; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GameModeKind { Survival, Creative, Adventure, Spectator, } impl From<GameModeKind> for u8 ...
//! Provides types for working with request and response bodies. use crate::io::Text; use crate::task::Join; use bytes::Bytes; use futures_io::AsyncRead; use futures_util::io::{AsyncReadExt, Cursor}; use std::fmt; use std::io::{self, Read}; use std::pin::Pin; use std::str; use std::task::{Context, Poll}; /// Contains...
//! A module containing a virtio network driver. //! //! The module contains ... use alloc::collections::VecDeque; use alloc::rc::Rc; use alloc::vec::Vec; use core::cell::RefCell; use crate::arch::kernel::pci::PciAdapter; use crate::drivers::net::virtio_net::constants::FeatureSet; use crate::drivers::net::virtio_net:...
use heapless::{consts::*, Vec}; use crate::system::actor::{Actor, ActorContext, CURRENT}; use crate::system::device::Lifecycle; use core::cmp::PartialEq; use core::sync::atomic::{AtomicU8, Ordering}; use core::task::{Context, Poll, RawWaker, RawWakerVTable, Waker}; #[derive(PartialEq)] pub(crate) enum ActorState { ...
use std::time; use actix_codec::{AsyncRead, AsyncWrite}; use bytes::Bytes; use futures::future::{err, Either}; use futures::{Async, Future, Poll}; use h2::{client::SendRequest, SendStream}; use http::header::{HeaderValue, CONNECTION, CONTENT_LENGTH, TRANSFER_ENCODING}; use http::{request::Request, HttpTryFrom, Method,...
use std::ffi::OsStr; use std::fmt::{self, Display, Formatter}; use std::fs; use std::path::PathBuf; use console::style; use notion_core::session::{ActivityKind, Session}; use notion_core::{path, shim}; use notion_fail::{ExitCode, Fallible, ResultExt}; use semver::Version; use Notion; use command::{Command, CommandNam...
use lazy_static::lazy_static; use regex::Regex; use tokio::io; use crate::types::*; use crate::utils::parse_value; lazy_static! { static ref RE_RESIST: Regex = Regex::new(r"resistances: (.+)\n*").unwrap(); } pub fn resistances(mut result: ClassInfo, data: &str) -> Option<ClassInfo> { for cap in RE_RESIST.cap...
//! Monte-Carlo radiative transfer simulation binary. //! Compute the radiative field for a given set of setup and light source. use Aetherus::{ args, data::Histogram, fs::{File, Load, Save}, geom::{Grid, Tree}, img::{Colour, Image}, ord::{Build, Link, Register, Set, X, Y}, report, sim:...
//! Error management module /// The error type used by this crate. #[derive(Debug)] pub enum Error { /// IO error Io(::std::io::Error), /// Utf8 error Utf8(::std::str::Utf8Error), /// Unexpected End of File UnexpectedEof(String), /// End event mismatch EndEventMismatch { /// Exp...
//! Terminal handling code //! //! Some portions borrowed from the Cargo project: https://github.com/rust-lang/cargo //! These portions are redistributed under the same license as Cargo (shared by cargo-audit itself) use isatty::stdout_isatty; use std::{ cell::RefCell, fmt, io::{self, prelude::*}, sync...
use crate::util::point_2d::Point2d; use std::collections::{HashMap, HashSet}; #[derive(Debug, PartialEq)] pub struct BingoBoard { numbers_to_locations: HashMap<u32, Point2d<u32>>, marked_columns: HashMap<u32, HashSet<u32>>, marked_rows: HashMap<u32, HashSet<u32>>, winning_number: Option<u32>, ...
extern crate log; use kube::{Api, Client, CustomResource}; use kube::api::{PatchParams}; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{Error, finalizer}; /// Specification of an H2O cluster in a Kubernetes cluster. /// Determines attributes like cluster size, resources (cpu, memory) and ...
use std::fmt; use na::DMatrix; // TODO: update util error handling // TODO: add util assertions #[derive(Debug, Clone)] pub struct MatrixCompareError; impl fmt::Display for MatrixCompareError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "Matrix dimensions not consistent!") } } ...
/*! Compile-time implementation of value capturing. This module generates calls to `rt::capture`. */ use std::fmt::Write; use proc_macro2::{Ident, TokenStream}; use quote::ToTokens; use syn::{ parse::{self, Parse, ParseStream}, punctuated::Punctuated, visit_mut::{self, VisitMut}, Expr, ExprLit, ExprM...
extern crate drm; extern crate image; mod utils; use utils::*; use drm::control::Device as ControlDevice; use drm::Device as BasicDevice; use drm::buffer::DrmFourcc; use drm::control::ResourceHandle; use drm::control::{self, atomic, connector, crtc, property, AtomicCommitFlags}; fn find_prop_id<T: ResourceHandle>(...
#![crate_name = "rv32i"] #![crate_type = "rlib"] #![feature(asm, const_fn, lang_items, global_asm)] #![feature(crate_visibility_modifier)] #![no_std] pub mod machine_timer; pub mod plic; pub mod support; extern "C" { // Where the end of the stack region is (and hence where the stack should // start). stat...
//! Naive x86-64 code generator for expression in reverse polish form. //! Takes an expression on the command-line and emit nasm assembly on stdout. //! //! As the goal is to play with code generation, the input language is minimal. //! There is notably no lexical analyzer. All tokens are one ASCII character long //! ...