text
stringlengths
3.09k
13.9k
pub use openstack::Error; use std::net::IpAddr; use std::process::{Command, Output}; use std::thread; use std::time::Duration; use fallible_iterator::FallibleIterator; use log::*; use openstack::auth::Password; use openstack::network::FloatingIpStatus; use openstack::{Cloud, ErrorKind, Refresh}; use waiter::Waiter; ...
use crate::core::{ types::{SettlementAccount, SE_ILP_ADDRESS}, SettlementClient, }; use async_trait::async_trait; use futures::TryFutureExt; use interledger_packet::{ErrorCode, FulfillBuilder, RejectBuilder}; use interledger_service::{Account, IlpResult, IncomingRequest, IncomingService}; use std::marker::Phant...
//! Uniform point distribution in an annulus using Bridson’s algorithm for //! Poisson-disc sampling. //! //! <NAME>. "Fast Poisson disk sampling in arbitrary dimensions." ACM //! SIGGRAPH. Vol. 2007. 2007. //! //! See also [Visualizing Algorithms](http://bost.ocks.org/mike/algorithms/). extern crate docopt; extern cra...
// SPDX-License-Identifier: Apache-2.0 AND MIT //! `ProducerBuilder` and `Producer` structs use futures_util::stream::StreamExt; /// A [non-consuming] [Producer] builder. /// /// [Producer]: struct.Producer.html /// [non-consuming]: https://doc.rust-lang.org/1.0.0/style/ownership/builders.html#non-consuming-builders-(...
mod util; #[cfg(test)] mod tests { use super::util as u2; use log::debug; use sloppy_auth::{ aws::{auth, s3}, chunk, util, }; use std::collections::HashMap; use std::env; use url::Url; #[test] fn aws_s3_putobject_small() { u2::init_log(); let access...
use super::*; use ic_types::crypto::threshold_sig::ni_dkg::DkgId; use std::collections::VecDeque; #[cfg(test)] mod tests; /// A store for data required to verify threshold signatures. /// /// The data that can be stored comprises /// * the `CspPublicCoefficients` for a particular DKG instance, /// * the `NodeIndex`es...
// MakAir Telemetry // // Copyright: 2020, <NAME> // License: Public Domain License /// Error code of RMC SW 1 pub const RMC_SW_1: u8 = 12; /// Error code of RMC SW 2 pub const RMC_SW_2: u8 = 11; /// Error code of RMC SW 3 pub const RMC_SW_3: u8 = 14; /// Error code of RMC SW 4 pub const RMC_SW_4: u8 = 40; /// Error c...
// Copyright 2019-2021 Parity Technologies (UK) Ltd. // This file is part of Parity Bridges Common. // Parity Bridges Common 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, ...
use std::fs; use std::str::Chars; fn main() { println!("part 1 result: {:?}", part1(&read_input_file())); println!("part 2 result: {:?}", part2(&read_input_file())); } fn read_input_file() -> String { fs::read_to_string("input.txt").expect("Something went wrong reading the file") } #[derive(Debug)] enum ...
use std::{error::Error, io}; use crossterm::{event, style, terminal}; use crate::{ error::ErrorKind, Attribute, Clear, Color, Event, KeyCode, KeyEvent, KeyModifiers, MouseButton, MouseEvent, }; impl From<Attribute> for style::Attribute { fn from(attribute: Attribute) -> Self { match attribute { ...
use std::{ collections::BTreeMap, error::Error, fmt::{self, Display, Formatter}, io::{self, Read}, mem, str::FromStr, }; type Result<ContentT> = std::result::Result<ContentT, Box<dyn Error>>; fn main() -> Result<()> { let mut input = String::new(); io::stdin().read_to_string(&mut input...
//! Definition of the Rust `fimo-core` interface. use fimo_ffi_core::ArrayString; use fimo_module_core::rust::{ModuleInterfaceArc, ModuleObject}; use fimo_module_core::{DynArc, DynArcBase, DynArcCaster, ModuleInterfaceDescriptor, ModulePtr}; use fimo_version_core::{ReleaseType, Version}; use std::any::Any; /// Name of...
use crate::{ast::Value, connector::queryable::TakeRow, error::ErrorKind}; #[cfg(feature = "chrono-0_4")] use chrono::{DateTime, Datelike, NaiveDate, NaiveDateTime, NaiveTime, Timelike, Utc}; use mysql_async as my; use mysql_async::Value as MyValue; use rust_decimal::prelude::ToPrimitive; use std::convert::TryFrom; pub...
//Copyright (C) <NAME> 2020 //This code is licensed under the BSD 3-clause license. see LICENSE.txt for more //information. use std::io::{SeekFrom, prelude::*}; use std::collections::HashMap; use std::collections::hash_map::Keys; use std::fmt; use std::error; use byteorder::{ReadBytesExt, LittleEndian}; const ENCRYPTE...
extern crate byteorder; use std::collections::HashMap; use std::io::Write; use byteorder::{LittleEndian, WriteBytesExt}; #[derive(Hash, Eq, PartialEq, Clone, Debug)] struct Frac(u64, u64); type Memory = HashMap<Frac, f64>; fn simplify(Frac(a, b): Frac) -> Frac { fn gcd(x: u64, y: u64) -> u64 { if y == 0...
//! Storage for items or variants with data. use syn::{ token::{Brace, Paren}, FieldPat, FieldsNamed, FieldsUnnamed, Ident, Pat, PatIdent, PatStruct, PatTuple, PatTupleStruct, Path, Result, Token, }; #[cfg(all(not(feature = "nightly"), feature = "safe"))] use {std::iter, syn::punctuated::Punctuated, syn::PatRest}; ...
#![allow(non_camel_case_types)] use std::collections::HashMap; use std::ptr::null; use std::slice; use failure::Fallible; use failure::ResultExt; use ffi_utils::*; pub mod asr; pub mod audio_server; pub mod dialogue; pub mod hotword; pub mod injection; pub mod nlu; pub mod tts; pub use self::asr::*; pub use self::a...
extern crate andrew; extern crate smithay_client_toolkit as sctk; use std::io::{Read, Seek, SeekFrom, Write}; use std::time::{Duration, Instant}; use sctk::reexports::client::protocol::{wl_seat::WlSeat, wl_shm, wl_surface}; use sctk::shm::{DoubleMemPool, MemPool}; use sctk::window::{ConceptFrame, Event as WEvent}; u...
// Copyright 2019 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // https://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
use super::{ pause_scene::PauseScene, select_ability_scene::SelectAbilityScene, shop_scene::ShopScene, }; use crate::scene::{Data, Scene, Transition}; use ggez::event::KeyCode; use ggez::graphics; use ggez::Context; use ggez::GameResult; use ggez::{event::KeyMods, timer}; pub struct NovelScene { pub text: Opti...
use imgui::im_str; use sdl2::{event::Event, mouse::MouseWheelDirection}; use crate::{model::image_manager::ImageManager, utility::get_mouse_pos}; use super::PresenterMode; pub struct DualImagePresenter { current_image_keys: (String, String), } impl DualImagePresenter { const MODE_NAME: &'static str = "dual"...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use actix::prelude::*; use anyhow::Result; use futures::channel::mpsc::UnboundedReceiver; use futures::channel::{mpsc, oneshot}; use starcoin_logger::prelude::*; use std::any::{Any, TypeId}; use std::collections::HashMap; use std::f...
// Copyright 2021 <NAME>. // // 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 according to thos...
use super::util; #[derive(Clone, Copy, Debug)] pub enum Component { CPU, GPU, Network, } #[derive(Clone, Copy, Debug)] pub enum RunMode { Always, Auto, Never, Restore, } #[derive(Clone, Copy, Debug)] pub enum CpuSched { Uninitialized, Preempted, Scheduled, } #[derive(Clone, C...
mod auth; mod item; mod size; mod storage; mod sync; // There are a number of techniques used to make this code faster. // - jemalloc seems to be faster for allocation and deallocation of the many serde objects // - buffering peristence I/O (easy to forget that Rust files are not buffered by default) // - adding a sel...
mod cleaner; mod database; mod merger; #[cfg(target_arch = "wasm32")] mod wasi; use crate::cleaner::clean; use crate::database::Database; use crate::merger::{merge_databases, Message}; use anyhow::{anyhow, bail, ensure, Context, Result}; use serde::{Deserialize, Serialize}; use tracing::{event, Level}; use std::io::{...
use std::{fs::File, path::PathBuf}; use anyhow::{ensure, Result}; use nalgebra as na; use yaml_rust::Yaml; use crate::{load_yaml, Timestamp}; const DATA_CSV: &str = "data.csv"; const SENSOR_YAML: &str = "sensor.yaml"; #[derive(Debug)] pub struct ImuData { path: PathBuf, } impl ImuData { pub fn new(path: Pa...
use std::collections::HashMap; use timely::dataflow::channels::pact::Exchange; use timely::dataflow::{Scope, Stream}; use crate::queries::{NexmarkInput, NexmarkTimer}; use faster_rs::FasterRmw; use timely::dataflow::operators::generic::operator::Operator; use timely::dataflow::operators::map::Map; use std::str::FromS...
use crate::token::ComFrom; use super::token::Token; use super::time; use super::Behavior; use super::{ captcha::{get_captcha, DoubleBuffer}, token::Res, token::TokenError, }; use josekit::{ jwe::{JweHeader, A128KW}, jwt::{self, JwtPayload}, JoseError, Map, Value, }; use rocket::http::Header; us...
use std::path::PathBuf; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::Arc; use std::thread; use std::time::{Duration, Instant}; use ckb_index::{with_index_db, IndexDatabase}; use ckb_sdk::GenesisInfo; use ckb_sdk::HttpRpcClient; use ckb_types::{ core::{service::Request, BlockView}, prelude::*, ...
use crate::atoms::AtomType; use crate::repr::{ DatatypeIdent, DatatypeIx, DatatypeRepr, DatatypeVariantRepr, ModuleDatatypesRepr, ModuleFuncsRepr, ModuleIx, ModuleRepr, }; use crate::MemArea; use cranelift_entity::{EntityRef, PrimaryMap}; pub fn std_module() -> ModuleRepr { ModuleRepr { datatypes: ...
//! Org-mode elements pub(crate) mod block; pub(crate) mod clock; pub(crate) mod comment; pub(crate) mod cookie; pub(crate) mod drawer; pub(crate) mod dyn_block; pub(crate) mod emphasis; pub(crate) mod fixed_width; pub(crate) mod fn_def; pub(crate) mod fn_ref; pub(crate) mod inline_call; pub(crate) mod inline_src; pub...
use chain_addr::{Address, AddressReadable}; use chain_impl_mockchain::transaction::{Balance, Input, InputEnum, InputType, Output}; use jcli_app::{ transaction::{common, staging::Staging, Error}, utils::io, }; use std::{collections::HashMap, io::Write, path::PathBuf}; use strfmt::strfmt; use structopt::StructOpt...
#[derive(Serialize, Clone, Debug, PartialEq)] pub enum WiiPixelFormat { I4, I8, IA4, IA8, RGB565, RGB5A3, RGBA8, CI4, CI8, CMPR4, Unknown (u32) } impl WiiPixelFormat { pub(crate) fn _new(value: u32) -> Self { match value { 0x0 => WiiPixelFormat::I4, ...
#[derive(Clone, Copy, PartialEq, Eq, Hash, Debug)] pub enum Key { Char(char), Key(u16), } impl Key { pub fn control(ch: char) -> Option<Key> { if ch as u32 > 0xFF { return None } Some(Key::Key(match ch { '2'|'~' => 0, 'a'...'z' => ch as u16 - 'a' ...
// Copyright 2021 Arm Limited (or its affiliates). All rights reserved. // Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 pub mod dist_regs; pub mod gicv3; pub mod gicv3_its; pub mod icc_regs; pub mod redist_regs; pub use self::dist_regs::{get_dist_regs,...
use std::{fmt, slice}; use libusb1_sys::*; use crate::interface_descriptor::{self, Interface}; /// Describes a configuration. pub struct ConfigDescriptor { descriptor: *const libusb_config_descriptor, } impl Drop for ConfigDescriptor { fn drop(&mut self) { unsafe { libusb_free_config_des...
/* Copyright 2020 <NAME> (github.com/erwanM974) 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 wri...
use crate::Plugin; use indexmap::IndexMap; use nu_errors::ShellError; use nu_protocol::{CallInfo, EvaluatedArgs, ReturnSuccess, ReturnValue, UntaggedValue, Value}; use nu_source::Tag; pub struct PluginTest<'a, T: Plugin> { plugin: &'a mut T, call_info: CallInfo, input: Value, } impl<'a, T: Plugin> PluginT...
use std::path::Path; use std::io::{self, Read, Write}; use std::fs::{File, OpenOptions}; use std::cell::RefCell; use std::ops::Deref; extern crate clap; use clap::{Arg, App, AppSettings, SubCommand}; extern crate hyper; use hyper::header; use hyper::server::{Server, Request, Response}; use hyper::uri::RequestUri; us...
use crate::prelude::*; pub fn clif_intcast( fx: &mut FunctionCx<'_, '_, impl Backend>, val: Value, to: Type, signed: bool, ) -> Value { let from = fx.bcx.func.dfg.value_type(val); match (from, to) { // equal (_, _) if from == to => val, // extend (_, types::I128...
use crate::InMemoryCache; use twilight_model::{ channel::{ message::{Message, MessageFlags, MessageType}, ChannelType, GuildChannel, Reaction, ReactionType, TextChannel, }, gateway::payload::{MessageCreate, ReactionAdd}, guild::{Emoji, Member, PartialMember, Permissions, Role}, id::{...
use errors::{OutputSuffix, SpecialProductTerm}; // // blueprint.rs: Assembly-ready representation // // Blueprint is an intermediate form where the initial equations are // converted into a form that are ready to be made into fuse maps. // Each output pin is configured via an "OLMC" data structure. // use crate::{ ...
// Copyright (C) 2019-2021 <NAME> <<EMAIL>> // SPDX-License-Identifier: (Apache-2.0 OR MIT) extern crate proc_macro; use proc_macro::TokenStream; use proc_macro2::TokenStream as Tokens; use quote::quote; use syn::AttributeArgs; use syn::ItemFn; use syn::Meta; use syn::NestedMeta; use syn::parse_macro_input; use syn...
use crate::assets::mesh_adv::material_db::{ MaterialDBUploadQueue, MaterialDBUploadQueueContext, MeshAdvMaterial, MeshAdvMaterialDef, }; use crate::assets::mesh_adv::MeshAdvMaterialData; use crossbeam_channel::{Receiver, Sender}; use distill::loader::handle::Handle; use distill::loader::LoadHandle; use fnv::FnvHash...
use crate::prelude::*; use core::convert::Infallible; use core::marker::{Send, Sync}; use ibc_proto::ibc::core::client::v1::ConsensusStateWithHeight; use prost_types::Any; use serde::Serialize; use tendermint_proto::Protobuf; use crate::clients::ics07_tendermint::consensus_state; use crate::core::ics02_client::clien...
// 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...
//! High-level intermediate representation //! //! Parses debris code into a hir. //! This intermediate representation is very similar to a typical abstract syntax tree, //! but the some desugaring gets applied. // Oof. Seems like the only way to not get clippy complaining about the generated rules enum. #![allow(clip...
// Copyright 2020-2021, The Tremor Team // // 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 agr...
//! Hash functions and hash utilities //! //! With the `fast-sha1` feature, the `Sha1` hash type will use a more elaborate implementation utilizing hardware support //! in case it is available. Otherwise the `sha1` feature should be set. `fast-sha1` will take precedence. //! Otherwise, a minimal yet performant implemen...
// The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // Copyright (c) 2014 The Rust Project Developers // // All rights reserved. // // Redistribution and use in source and binary forms, with or without // modification, are permitted prov...
use crate::storage::Storage; use ::chain::BlockNumber; use phala_mq::{MessageSendQueue, Sr25519Signer}; use serde::{Deserialize, Serialize}; type SigningMessage = phala_mq::SigningMessage<Sr25519Signer>; pub struct PollContext<'a> { pub block_number: BlockNumber, pub send_mq: &'a MessageSendQueue, pub sto...
extern crate docopt; extern crate filetime; extern crate rustc_serialize; extern crate snap; use std::error; use std::fs::{self, File}; use std::io::{self, Read, Write}; use std::path::Path; use std::process; use std::result; use docopt::Docopt; use filetime::{FileTime, set_file_times}; const USAGE: &'static str = "...
use std::convert::TryFrom; use crate::extn::prelude::*; use crate::sys::protect; #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] pub enum ElementReference { Empty, Index(Int), StartLen(Int, usize), } pub fn element_reference( interp: &mut Artichoke, elem: Value, len: Optio...
// Copyright 2019 Zhizhesihai (Beijing) Technology 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 a...
// Copyright 2018-2020 argmin developers // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://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 according...
use crate::astree::GroupKeySource; use crate::ciphersuite::HkdfExt; use crate::tree_math::LeafSize; use hkdf::Hkdf; use secrecy::{ExposeSecret, SecretVec}; use sha2::digest::{generic_array, BlockInput, FixedOutput, Input, Reset}; pub struct EpochSecrets<D: Input + BlockInput + FixedOutput + Reset + Default + Clone> { ...
use crate::common::{CommonState, RoadColorer, RoadColorerBuilder}; use crate::game::{State, Transition, WizardState}; use crate::helpers::ID; use crate::ui::UI; use ezgui::{Choice, Color, EventCtx, GeomBatch, GfxCtx, Key, Line, Text, WarpingItemSlider}; use geom::{Circle, Distance, Pt2D}; use map_model::{BusRoute, BusR...
use crate::derive_utils::PyFunctionArguments; use crate::exceptions::PyValueError; use crate::prelude::*; use crate::{ ffi, impl_::pymethods::{self, PyMethodDef}, types, AsPyPointer, }; use std::os::raw::c_void; /// Represents a builtin Python function object. #[repr(transparent)] pub struct PyCFunction(Py...
//! # Complex Sound //! //! Module containing types implementing the ability to run multiple //! [`Generator`]s and [`Modifier`]s within a single object, granting the //! ability to create complex systems like those found in digital synthesizers. //! //! [`Generator`]: ../../generators/trait.Generator.html //! [`Modi...
use std::mem::replace; use std::sync::Arc; use std::time::Duration; use futures::Future; use tokio; use tokio::sync::mpsc; use tokio::sync::oneshot::{error::TryRecvError, Receiver, Sender}; use tokio::task::JoinHandle; use tonic; use epaxos::conf::ClusterInfo; use epaxos::conf::NodeId; use epaxos::qpaxos::Instance;...
extern crate libc; extern crate tempfile; static CARGO_TOML_TEMPLATE: &str = r#" [package] name = "sandstone" version = "0.1.0" edition = "2018" [dependencies] libc = "0.2.51" seccomp-sys = "0.1.2" "#; static MAIN_TEMPLATE: &str = r#" #![feature(nll)] extern crate libc; extern crate seccomp_sys; use seccomp_sys::*;...
use chrono::naive::NaiveDate; use rusoto_s3::{GetObjectRequest, S3Client, S3}; use std::cmp::Ordering; use std::fmt::{self, Write}; use std::io::Read; use tokio::io::AsyncReadExt; #[derive(Debug, serde::Deserialize)] struct Manifest { files: Vec<ManifestFile>, } #[derive(Debug, serde::Deserialize)] struct Manifes...
use crate::internals::*; use proc_macro2::Span; use proc_macro2::TokenStream; use quote::{quote, ToTokens}; use syn::Meta::*; use syn::NestedMeta::*; use syn::{Lit, MetaNameValue}; /// Parsed field attributes. #[derive(Default)] pub(crate) struct FieldAttrs {} /// Parsed field attributes. #[derive(Default)] pub(crate...
// Basic tests (using vectors) - list multiline post-comment is indented on its own fn main() { let v = [ "A", /* item A comment */ "BBB", /* item B comment */ "CCCCCC", /* item C comment line 1 * item C comment line 2 */ "D", /* item D comment line 1...
use core::time; use std::thread; use filament_bindings::{ backend, filament::{ Engine, IndirectLightBuilder, LightBuilder, LightType, LinearColor, MaterialBuilder, RgbType, SkyboxBuilder, Viewport, }, filameshio::MeshReader, image::{ktx, KtxBundle}, math::{Float3, Mat4f}, }; us...
// Copyright 2017 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. //! Type-safe bindings for Zircon vmar objects. use crate::ok; use crate::{object_get_info, ObjectQuery, Topic}; use crate::{AsHandleRef, Handle, HandleBa...
use shogi::{Color, Move, SfenError, TimeControl}; use std::sync::mpsc::Sender; use std::sync::{Arc, RwLock}; use usi::{ BestMoveParams, EngineCommand, EngineOutput, GameOverKind, GuiCommand, InfoParams, ScoreKind, ThinkParams, UsiEngineHandler, }; use crate::environment::*; use crate::error::Error; use crate::...
// Copyright 2018-2021 Parity Technologies (UK) Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicab...
extern crate simple_matrix; use rand::rngs::ThreadRng; use rand::Rng; use simple_matrix::Matrix; use std::f32::consts::E as Eul; /// The neural network struct is meant to represent a simple feed forward neural network /// with the ability to manipulate it's weights and biases, and feed forward a 1D vector /// of a pr...
#![forbid(unsafe_code)] #![warn(rust_2018_idioms)] fn main() { println!("\n## Start testing Diesel SQLite"); test_sqlite(); println!("## End testing Diesel SQLite\n"); println!("\n## Start testing Diesel PostgreSQL"); test_postgres(); println!("## End testing Diesel PostgreSQL\n"); printl...
use crate::core::{ registry::Registry, wrapper::{NodeWrapper, PoolWrapper}, }; use common_lib::types::v0::{ message_bus::{Child, ChildUri, Replica}, store::{ nexus_child::NexusChild, nexus_persistence::{ChildInfo, NexusInfo}, replica::ReplicaSpec, }, }; #[derive(Debug, Clone...
use libc::*; use std; use std::mem; use super::types::*; type StartupFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int; type ShutdownFunc = extern "C" fn(type_: c_int, module_number: c_int) -> c_int; type InfoFunc = extern "C" fn(); type GlobalsCtorFunc = extern "C" fn(global: *const c_void) -> c_void...
use bevy::app::AppExit; use super::components::*; use super::laser::*; use super::state::*; use super::START_LIFE; use bevy::prelude::*; use bevy_rapier2d::{ na::Vector2, physics::{RapierConfiguration, RigidBodyHandleComponent}, rapier::{ dynamics::{RigidBodyBuilder, RigidBodySet}, geometry...
use aoc::prelude::*; use glam::IVec3; use itertools::Itertools; use lazy_static::lazy_static; use rayon::prelude::*; use std::{ collections::HashSet, convert::TryInto, f32, ops::{Deref, DerefMut}, }; /// Transform a vector into 24 possible axis-aligned cube orientations. fn rotations(vec: impl Into<IVe...
// This file is part of Substrate. // Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // ht...
// TODO: In v1.8 timeframe delete this module and use `send_and_confirm_messages_with_spinner()` // from the Gemachain monorepo use { gemachain_client::{ rpc_client::RpcClient, rpc_config::RpcSendTransactionConfig, rpc_request::MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS, rpc_respon...
use crate::serialization::SubgraphSerializer; use aws_lambda_events::event::s3::{ S3Bucket, S3Entity, S3Event, S3EventRecord, S3Object, S3RequestParameters, S3UserIdentity, }; use chrono::Utc; use grapl_graph_descriptions::graph_description::*; use lambda_runtime::Context; use log::*; use rusoto_core::{HttpClient, ...
use json::read::internal_reader::InternalReader; use std::{error, fmt, io::{Error, Read}, str::from_utf8}; pub struct ByteToChar<R> { iter: InternalReader<R>, } impl<R: Read> ByteToChar<R> { #[inline] pub fn new(read: R, buffer_size: usize) -> Result<Self, Error> { Ok(ByteToChar { iter...
// Copyright 2021 The Chromium OS Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use std::cell::RefCell; use std::os::unix::net::UnixStream; use std::path::Path; use std::thread; use base::{error, Event, RawDescriptor}; use cros_as...
use crate::opcode::OpCode; use crate::token::{Token, TokenType}; use crate::label::Label; use crate::parser::parser::InstrParser; use crate::{ get_cpn, expect_token, get_number, get_creg, get_reg, get_token, get_label }; pub struct CpOpsParser; impl CpOpsParser { /// Return the binary representation of the "C...
use std::cmp; pub fn main(input: &str) -> Result<(usize, usize), String> { let mut new = Vec::new(); for line in input.lines() { new.push(parse_str(line)); } let mut result = new[0].clone(); for next in &new[1..] { result = reduce(add(&result, &next)); } let part1 = magnitu...
#![allow(dead_code)] use std::time::{Instant}; mod parsefa; mod splitter; mod align; mod cliparameters; use std::fs::File; use std::io::{Error, Write}; extern crate bincode; extern crate chrono; use chrono::Local; mod serializer; mod indexscan; mod em; use colored::*; use std::hash::{Hash, Hasher}; use std::col...
//! Build program to generate a program which runs all the testsuites. //! //! By generating a separate `#[test]` test for each file, we allow cargo test //! to automatically run the files in parallel. //! //! Idea adapted from: https://github.com/CraneStation/wasmtime/blob/master/build.rs //! Thanks @sunfishcode fn m...
use std::sync::Arc; use std::{io, net::SocketAddr}; use async_trait::async_trait; use futures::future::select_ok; use futures::TryFutureExt; use log::*; use socket2::{Domain, Socket, Type}; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::net::TcpStream; use crate::{common::dns_client::DnsClient, common::resolver::...
// Copyright 2017 <NAME>. See the COPYRIGHT file at the top-level // directory of this distribution and at http://rust-lang.org/COPYRIGHT. // // 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/li...
extern crate pkg_config; use std::env; use std::ffi::{OsStr, OsString}; use std::process::Command; use std::path::Path; macro_rules! ci_stderr_log { () => (eprint!("\n")); ($($arg:tt)*) => ({ if env::var_os("CI_STDERR_LOG").is_some() { eprintln!($($arg)*) } }) } fn rbconfig(key: &str) -> String { ...
use aoc_common::*; use itertools::Itertools; fn main() { run_vec(parse, part1, part2); } struct DisplayLine { signal: Vec<String>, output: Vec<String>, } fn parse(contents: &str) -> Vec<DisplayLine> { contents .lines() .into_iter() .map(|x| { let mut parts = x.spli...
use std::sync::Once; use windows::{ core::{Interface, Result}, Foundation::Numerics::Vector2, Graphics::SizeInt32, Win32::{ Foundation::{HWND, LPARAM, LRESULT, PWSTR, RECT, WPARAM}, System::{LibraryLoader::GetModuleHandleW, WinRT::Composition::ICompositorDesktopInterop}, UI::Win...
use crate::prelude::*; #[derive(Default)] pub struct Hud; impl Hud { pub fn new() -> Self { Default::default() } pub fn add_node() -> Handle<Self> { scene::add_node(Self::new()) } } impl Node for Hud { fn draw(_: RefMut<Self>) { let game_state = scene::find_node_by_type::...
use anyhow::{bail, Result}; use async_trait::async_trait; use chrono::{DateTime, Duration, NaiveDate, Utc}; use macros::db; use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use crate::{ airtable::AIRTABLE_BOOKINGS_TABLE, companies::Company, core::UpdateAirtableRecord, db::Database, schema::bookings, ...
use crate::core::*; use crate::renderer::*; use std::rc::Rc; /// /// A 3D model consisting of a triangle mesh and any material that implements the `Material` trait. /// pub struct Model<M: Material> { context: Context, mesh: Rc<Mesh>, aabb: AxisAlignedBoundingBox, aabb_local: AxisAlignedBoundingBox, ...
//编译标签 #![cfg_attr(not(feature = "std"), no_std)] pub use pallet::*; //引入测试模块 //编译标签,测试的时候才编译 #[cfg(test)] mod mock; #[cfg(test)] mod tests; ///存证模块 #[frame_support::pallet] pub mod pallet { // 引入依赖 // frame_support::dispatch::DispatchResultWithPostInfo 可调用函数的返回结果 // frame_support::pallet_prelude::* 常用...
use lazy_static::lazy_static; use itertools::Itertools; use std::collections::HashMap; use std::collections::BTreeSet; use std::iter::FromIterator; lazy_static! { static ref SEGMENTS: [BTreeSet<usize>; 10] = [ BTreeSet::from_iter([0, 1, 2, 4, 5, 6]), BTreeSet::from_iter([2, 5]), BTreeSet:...
use crate::{ LibsodiumError, sodium_bindings::{ sodium_init, crypto_sign_ed25519_keypair, crypto_sign_ed25519_sk_to_pk, crypto_sign_ed25519_detached, crypto_sign_ed25519_verify_detached, crypto_sign_ed25519_BYTES, crypto_sign_ed25519_SECRETKEYBYTES, crypto_sign_ed25519_PUBLICKEYBYTES } }; use std::{ ptr, er...
use std::{ cmp::Ordering, collections::{btree_set, BTreeSet}, hash::Hasher, ops::Bound, }; use twox_hash::XxHash64; /// A tree that sorts based on a seeded hash value. /// /// This is responsible for storing the membership in the `View` module. It allows /// `O(log n)` access to the all the queries. Th...
use crate::mdc_sys::MDCSelect; use web_sys::Element; use wasm_bindgen::{prelude::*, JsCast}; use yew::prelude::*; pub mod helper_line; pub use helper_line::HelperLine; pub struct Select { node_ref: NodeRef, inner: Option<MDCSelect>, props: Props, link: ComponentLink<Self>, change_callback: Closu...
use std::process::exit; const TONES: [&'static str; 12] = ["A", "A#", "B", "C", "C#", "D", "D#", "E", "F", "F#", "G", "G#"]; const B_DIGIT: i32 = 98; const HASH_DIGIT: i32 = 35; fn parse_tones() -> Vec<i32> { let mut string_tones_line = String::new(); std::io::stdin().read_line(&mut string_tones_line).unwrap...
use std::array; use bytemuck::{Pod, Zeroable}; use crate::{Vector, Scalar, Float}; /// A point in `N`-dimensional space with scalar type `T`. It represents /// a *location* in space. #[derive(Clone, Copy, PartialEq, Eq, Hash)] #[repr(transparent)] pub struct Point<T: Scalar, const N: usize>(pub(crate) [T; N]); /// ...
use std::net::{IpAddr, Ipv4Addr}; use std::sync::Arc; use clap::{Parser, Subcommand}; use gethostname::gethostname; use mac_address::get_mac_address; use tokio::net::TcpListener; use tracing::info; pub mod directory; use directory::readserv; mod consensus; mod read_meta; pub mod server_conn; mod write_meta; #[derive...