text
stringlengths
8
4.13M
#[doc = "Register `BGCLUT` reader"] pub type R = crate::R<BGCLUT_SPEC>; #[doc = "Register `BGCLUT` writer"] pub type W = crate::W<BGCLUT_SPEC>; #[doc = "Field `BLUE` reader - BLUE"] pub type BLUE_R = crate::FieldReader; #[doc = "Field `BLUE` writer - BLUE"] pub type BLUE_W<'a, REG, const O: u8> = crate::FieldWriter<'a,...
use bytecheck::CheckBytes; use redb::{RedbValue, TypeName}; use rkyv::{Archive, Deserialize, Serialize}; use std::collections::HashMap; use std::fmt::{Debug, Formatter}; use std::ops::Add; use std::time::{Duration, SystemTime}; pub struct RequestMetaInfo { pub raft_group: Option<u16>, pub inode: Option<u64>, /...
// 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 criterion::{criterion_group, criterion_main, BatchSize, BenchmarkId, Criterion}; use rand::Rng; use std::time::Duration; use winter_ma...
#![no_std] pub mod ble; use core::sync::atomic::{AtomicUsize, Ordering}; use defmt_rtt as _; // global logger use nrf52840_hal as _; // memory layout #[panic_handler] fn panic(_: &core::panic::PanicInfo) -> ! { loop { cortex_m::asm::bkpt(); } } static COUNT: AtomicUsize = AtomicUsize::new(0); defmt...
use crate::{ cmd::*, keypair::Keypair, result::Result, traits::{TxnEnvelope, TxnFee, TxnSign}, }; use serde::Deserialize; #[derive(Debug, StructOpt)] /// Onboard one (or more) validators with this wallet. /// /// The payment is not submitted to the system unless the '--commit' option is /// given. ///...
use std::io; use sqlparser::{ tokenizer::TokenizerError, parser::ParserError, }; use thiserror::Error; #[derive(Debug, Error)] pub enum SqlError { #[error(transparent)] IO(#[from] io::Error), #[error(transparent)] Json(#[from] serde_json::Error), #[error("tokenizer error at line {} char {}...
#![feature(test)] extern crate test; extern crate rsmath; #[cfg(test)] mod tests { use rsmath::algebra::matrix::*; use test::Bencher; #[bench] fn create_random_bench(b: &mut Bencher) { let range: [f32; 2] = [0.0, 5.0]; b.iter(|| Matrix::<f32>::random(3, 3, &range)); } }
use core::ops::RangeInclusive; use aoc_runner_derive::{aoc, aoc_generator}; use bstr::{BString, ByteSlice}; use once_cell::sync::Lazy; use regex::Regex; static REGEX: Lazy<Regex> = Lazy::new(|| Regex::new("(\\d+)-(\\d+) (.): (.+)").unwrap()); struct PasswordEntry { range: RangeInclusive<usize>, character: ch...
//! Low-level packet access and construction. //! //! The `wire` module deals with the packet *representation*. It provides two levels //! of functionality. //! //! * First, it provides functions to extract fields from sequences of octets, //! and to insert fields into sequences of octets. This happens through the ...
use std::mem::swap; use redo::{Record, Command}; use math::{Rect, Point2, Vector2}; use draw::{ self, Bounded, CanvasRead, CanvasWrite, Frame, Palette, Shape, }; use super::{ Brush, Receiver, }; #[derive(Debug)] pub struct DrawCommand { page: Frame, frame: usize, laye...
use super::Terminal; use crate::Event; use std::sync::mpsc; impl Terminal { pub fn event_channel(&mut self) -> mpsc::Receiver<Event> { let (tx, rx) = mpsc::channel(); let mut senders = self.event_channels.lock().unwrap(); senders.push(tx); rx } }
#![no_std] use crate::hal::clock::*; use crate::hal::pin::*; pub static mut CLOCK: PMCControl<sam3x8e::PMC> = PMCControl { rf: None }; // Frequency settings pub const MAINFRDY: u32 = 0x00010000; pub const MAINF_MASK: u32 = 0x0000ffff; pub const SLOW_CLOCK_FREQUENCY_HZ: u32 = 32_768; pub const PMC_MCKR_PRES_CLK_2: u...
use rust_embed::RustEmbed; #[derive(RustEmbed)] #[folder = "static/"] struct Asset; pub fn static_resources_tests() { for file in Asset::iter() { println!("{}", file.as_ref()); } if Asset::get("lorem_ipsum.txt").is_none() { panic!("lorem_ipsum.txt should exist"); } let lorem_ipsum ...
pub fn common_func() { println!("Common called"); }
use git2::{TreeEntry, ObjectType}; /// A set of extension methods for the `Tree` type in `git2`. pub trait TreeEntryExt { /// Returns whether this entry in the tree represents a subtree, which would be a subdirectory /// on disk. fn is_dir(&self) -> bool; } impl<'repo> TreeEntryExt for TreeEntry<'repo> { ...
use rand::*; use std::fmt; use std::ops::*; use std::vec::Vec; pub struct Ray { origin: Vec3, dir: Vec3, } impl Ray { pub fn get_dir(&self) -> Vec3 { self.dir } pub fn get_origin(&self) -> Vec3 { self.origin } pub fn point_at_parameter(&self, t: f32) -> Vec3 { sel...
use std::fmt::{Debug, Formatter, Result}; use std::iter::FromIterator; pub trait PriorityQueue<T> : Iterator<Item=T> { fn new() -> Self; fn is_empty(&self) -> bool; fn len(&self) -> usize; fn push(&mut self, value: T); fn peek(&self) -> Option<&T>; } #[derive(Clone, Default)] pub struct MaxHeap<T>(Vec<T>); con...
use crate::er::{self, FailExt, Result}; use crate::utils::{self, CliEnv}; use failure::format_err; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; use std::io; use std::net::{TcpListener, TcpStream}; use std::path::{Path, PathBuf}; #[derive(Serialize, Deserialize, Clone)] pub struct Serv...
use amethyst::ecs::prelude::{Component, VecStorage}; use crate::resources::RenderConfig; /// This component stores some data for the camera. /// - Zoom /// - - current /// - - min /// - - max /// - Offset to player /// TODO: Use as component. #[derive(Debug)] pub struct CameraProperties { pub player_id: usize, ...
// LNP/BP client-side-validation library implementing respective LNPBP // specifications & standards (LNPBP-7, 8, 9, 42) // // Written in 2019-2021 by // Dr. Maxim Orlovsky <orlovsky@pandoracore.com> // // To the extent possible under law, the author(s) have dedicated all // copyright and related and neighboring ri...
#[macro_use] extern crate anyhow; use std::env::var; use anyhow::Result; use sqlx::postgres::PgPool; use svc_authz::cache::{create_pool, AuthzCache, RedisCache}; use tracing::warn; use tracing_subscriber::layer::SubscriberExt; use tracing_subscriber::EnvFilter; const APP_VERSION: &str = env!("CARGO_PKG_VERSION"); co...
use std::env; use std::process::exit; use clap::Clap; mod rusty_hook; #[derive(Clap)] #[clap(author, about, version)] enum RustyHookOpts { /// Initialize rusty-hook's git hooks in the current directory. #[clap(author, version)] Init { #[clap(long)] skip_hook_list: Option<String>, }, ...
// Copyright (c) 2018, Maarten de Vries <maarten@de-vri.es> // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are met: // // * Redistributions of source code must retain the above copyright notice, this // list of conditions ...
#[macro_use] extern crate spectra; use spectra::bootstrap::{FreeflyHandler, WindowOpt}; use spectra::camera::Camera; use spectra::framebuffer::Framebuffer2D; use spectra::luminance::buffer::{Binding, Buffer}; use spectra::luminance::pipeline::Pipeline; use spectra::luminance::shader::program; use spectra::luminance::t...
use crate::errors::unknown_option; pub enum Feature { Unknown, DollarIsPc, LabelsWithoutColons, LooseStringTerm, LooseCharTerm, AtInIdentifiers, DollarInIdentifiers, LeadingDotInIdentifiers, OrgPerSeg, PcAssignment, MissingCharTerm, UbiquitousIdents, CComments, ForceRange, UnderlineInNumb...
use lazy_static::lazy_static; use regex::Regex; use std::path::Path; use std::process::Command; use std::sync::Arc; use threadpool::ThreadPool; lazy_static! { static ref RE: Regex = Regex::new("(?P<url>\\(https.*?\\))").unwrap(); } fn main() { let urls = Arc::new( std::fs::read_dir("./arl") ...
use std::convert::TryInto; #[derive(Copy, Clone, Eq, PartialEq)] pub struct PSR(u8); //Processor Status Register #[derive(Copy, Clone, Eq, PartialEq)] pub struct MCR(u8); //Mode Control Register #[derive(Copy, Clone, Eq, PartialEq)] pub struct IFR(u8); //Interrupt Flag Register #[derive(Copy, Clone, Eq, PartialEq)]...
use diesel::{PgConnection, RunQueryDsl}; use crate::models::contacts::ContactEmail; use crate::schema::contact_emails; use radmin::uuid::Uuid; #[derive(Debug, PartialEq, Clone, Default, Insertable)] #[table_name = "contact_emails"] pub struct ContactEmailFactory { contact_id: Uuid, email_id: Uuid, email_t...
use crate::import::*; use crate::{Broadcast, MethodCall}; use crate::process::DispatchError; pub struct RegisterRecipient<M>(pub Recipient<M>) where M: Message + Send, M::Result: Send; impl<M> Message for RegisterRecipient<M> where M: Message + Send, M::Result: Sen...
fn main() { let mut current = 0; while (current * current) % 1_000_000 != 269_696 { current += 1; } println!( "The smallest number whose square ends in 269696 is {}", current ); }
mod reservoir; mod rain; use rayon::prelude::*; use std::f64; use roots::SimpleConvergency; use roots::find_root_brent; pub struct FilteringResult { alpha: f64, beta: f64, q: Vec<f64>, r: Vec<f64>, v: Vec<f64>, ups: Vec<bool> } impl FilteringResult { pub fn to_vec_for_r(&self) -> Vec<f64> { let mut result: ...
#[doc = "Register `RCC_MP_IWDGFZCLRR` reader"] pub type R = crate::R<RCC_MP_IWDGFZCLRR_SPEC>; #[doc = "Register `RCC_MP_IWDGFZCLRR` writer"] pub type W = crate::W<RCC_MP_IWDGFZCLRR_SPEC>; #[doc = "Field `FZ_IWDG1` reader - FZ_IWDG1"] pub type FZ_IWDG1_R = crate::BitReader; #[doc = "Field `FZ_IWDG1` writer - FZ_IWDG1"] ...
use std::time::{Duration, Instant}; pub(crate) struct FrogPower { // Experience points max_xp: usize, xp: usize, // Power points (not a presentation) max_pp: usize, pp: usize, cooldown: Duration, start: Instant, } impl FrogPower { fn new() -> Self { Self { max...
use bitvec::prelude::*; use bytes::{ Bytes, Buf, BytesMut, BufMut }; #[derive(Debug, PartialEq, Clone)] pub struct SerialAPIGetCapabilitiesResponse { pub api_version_major: u8, pub api_version_minor: u8, pub manufacturer_id: u16, pub product_type: u16, pub product_id: u16, pub api_mas...
//! Camera lens implementation. /// Lens structure. #[derive(Debug)] pub enum Lens { /// Perspective projection. Perspective { /// Horizontal field-of-view [rad]. fov: f64, }, /// Orthographic projection. Orthographic { /// Horizontal field-width [m]. field: f64, ...
#[macro_use] extern crate lazy_static; extern crate regex; use std::time::{Duration, Instant}; mod solution; fn main() { let now = Instant::now(); solution::day1::solve(); solution::day2::solve(); solution::day3::solve(); solution::day4::solve(); solution::day5::solve(); solution::day6::...
use crate::decoder::{DecodeError, DecodeResult, Decoder}; use crate::types::Index; use std::io::Read; pub struct FunctionSection(Vec<Index>); impl FunctionSection { pub fn decode<R: Read>(decoder: &mut Decoder<R>) -> DecodeResult<Self> { Ok(Self(decoder.vec(Decoder::index)?)) } }
mod entity; mod component; mod system; mod world; pub use self::entity::*; pub use self::component::*; pub use self::system::*; pub use self::world::*;
// std pub(crate) use std::{ collections::BTreeMap, env, ffi::{OsStr, OsString}, fmt::{self, Display, Formatter}, fs::{self, DirEntry}, io::{self, Cursor}, path::{Path, PathBuf}, process::{Command, ExitStatus}, str::FromStr, }; // dependencies pub(crate) use log::info; pub(crate) use semver::Version;...
use crate::error::{StringifyError, StringifyResult}; use crate::newline::Newline; use std::collections::BTreeMap; use std::ops; #[macro_export] macro_rules! styles { ( $($key:expr => $value:expr),* ) => {{ use std::collections::BTreeMap; #[allow(unused_mut)] let mut btmap = BTreeMap::ne...
use self::event_horizon::expand; use crate::singularity::accretion; pub fn feed() { crate::singularity::black_hole::accretion_disk::add_material(); accretion::add_material(); event_horizon::expand(); } pub mod event_horizon { pub fn expand(){ println!("zooooooop") } } pub mod accre...
// Copyright 2019 Amar Singh // This file is part of Sunshine, licensed with the MIT License // Voting Algorithms // --> provide default implementations of each // but making them into traits allows them to be overwritten trait VoteParadime { // OBJECTIVE: abstract all voting functionality // provide gener...
//! //! A Decimal implementation written in pure Rust suitable //! for financial calculations that require significant integral //! and fractional digits with no round-off errors. //! //! The binary representation consists of a 96 bit integer number, //! a scaling factor used to specify the decimal fraction and a 1 //!...
#[doc = "Register `TZC_FAIL_ADDRESS_LOW1` reader"] pub type R = crate::R<TZC_FAIL_ADDRESS_LOW1_SPEC>; #[doc = "Field `ADDR_STATUS_LOW` reader - ADDR_STATUS_LOW"] pub type ADDR_STATUS_LOW_R = crate::FieldReader<u32>; impl R { #[doc = "Bits 0:31 - ADDR_STATUS_LOW"] #[inline(always)] pub fn addr_status_low(&se...
pub mod connection; pub mod schema; pub mod user;
use super::prelude::{ UINT , CCINT , DWORD }; pub type DialogBoxCommand = CCINT; pub type MessageBoxStyle = UINT; pub type WindowClassStyle = UINT; pub type WindowShowStyleCommand = CCINT; pub type WindowStyle = DWORD; pub type ExtendedWindowStyle = DWORD; pub type StockLogicalObject = CCINT; pub type WindowMess...
mod ast; mod color; mod parse; mod property_name; pub use crate::css::ast::{Block, Declaration, Selector, Specificity, StyleSheet, Unit, Value}; pub use crate::css::color::Color; pub use crate::css::parse::parse_css; pub use crate::css::property_name::{property_to_string, property_type};
//! This module provides utilities for implementing recursive //! descent parsers. It offers a sort of halfway house between //! using a true parser combinator library and writing a recursive //! descent parser from scratch. It provides a standard type for //! parsers, `Parser<T>`, a few basic parsers such as parsers f...
use std::path::PathBuf; use anyhow::{anyhow, Result}; use serde::Deserialize; use serde_json::json; use crate::previewer::{preview_file, preview_file_at}; use crate::stdio_server::{write_response, MethodCall}; pub fn preview_quickfix_entry(msg: MethodCall) { tokio::spawn(async move { preview_quickfix_entry_impl(...
// extern crate num_traits; #[macro_use] pub mod vec; pub mod id; pub use vec::IdVec; pub use id::Id; #[cfg(test)] mod examples { use super::*; #[test] fn nodes() { #[derive(Debug)] struct Node { parent: Option<Id<Node>>, name: String, } let m...
use byteorder::{ByteOrder, NetworkEndian}; use rodio::Sink; use rodio::{Sample, Source, source::UniformSourceIterator}; use std::net::UdpSocket; use std::sync::Arc; use std::time::Duration; use cpal::SampleFormat; use getopts; use crossbeam_queue::{SegQueue}; use cpal::traits::DeviceTrait; type SampleType = f32; const...
use nannou::rand::random_range; use crate::maze::wall::Direction::*; use crate::maze::{Maze, Wall}; use super::MazeGenerator; #[derive(Debug)] struct Field { x: usize, y: usize, width: usize, height: usize, } impl Field { fn split_vertically(self) -> (Field, Field) { let left_width = ran...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. #[derive(std::fmt::Debug)] pub(crate) struct Handle { client: aws_hyper::Client<aws_hyper::conn::Standard>, conf: crate::Config, } #[derive(Clone, std::fmt::Debug)] pub struct Client { handle: std::sync::Arc<Handle>, } impl Cl...
#![no_std] /// Public key pub type SolPubkey = [u8; 32]; /// Keyed Account pub struct SolKeyedAccount<'a> { /// Public key of the account pub key: &'a SolPubkey, /// Public key of the account pub is_signer: bool, /// Number of lamports owned by this account pub lamports: u64, /// On-chain ...
#[doc = "Register `C2TOC1SR` reader"] pub type R = crate::R<C2TOC1SR_SPEC>; #[doc = "Field `CH1F` reader - CH1F"] pub type CH1F_R = crate::BitReader<CH1F_A>; #[doc = "CH1F\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum CH1F_A { #[doc = "0: Channel free, data can be written by the sendi...
use bidule::Stream; use serde_json::{Value,json}; use strum::EnumString; fn simple_observer () { let my_stream: Stream<i32> = Stream::new(); my_stream.observe(|sig| { // print the signal on stdout each time it’s flowing in println!("signal: {:?}", sig); }); my_stream.send(&1); my_st...
use SafeWrapper; use ir::{Constant, Type, User}; use sys; /// A constant value of zero of any type. pub struct ConstantAggregateZero<'ctx>(Constant<'ctx>); impl_subtype!(ConstantAggregateZero => Constant); impl<'ctx> ConstantAggregateZero<'ctx> { /// Creates a new zero constant. pub fn new(ty: &Type) -> Self ...
// (c) Facebook, Inc. and its affiliates. Confidential and proprietary. use cxx::CxxString; use oxidized::relative_path::RelativePath; use rust_facts_ffi::extract_as_json_ffi0; #[cxx::bridge] mod ffi { extern "Rust" { pub fn hackc_extract_as_json_cpp_ffi( flags: i32, filename: &Cxx...
use ferris_base; mod utils; #[test] // Baba is you: Forest A fn you_and_swap() { let start = vec![ "🦀🚩........", "............", "............", "Fe==U &&Sw..", ]; let inputs = vec![ferris_base::core::direction::Direction::RIGHT]; let end = vec![ "🚩🦀...........
use proc_macro2::TokenStream as TokenStream2; use syn::visit; use syn::{DeriveInput, Ident}; use crate::utils::CollectFields; pub fn impl_kv(ast: &DeriveInput) -> TokenStream2 { let name = &ast.ident; let mut cf = CollectFields::default(); visit::visit_derive_input(&mut cf, &ast); let fields = cf.fie...
use super::ProposalId; pub struct Learner { quorum_size: u8, highest_proposal_id: Option<ProposalId>, accepted_peers: u64, resolved_value: Option<bool> } impl Learner { pub fn new(num_peers: u8, quorum_size: u8) -> Learner { assert!(quorum_size >= num_peers/2 + 1); Learner { ...
use super::*; #[test] fn test_unlinking_unlinked() { let data = init(); assert!(add_subnet(data, 0)); let comp = add_component(data, ComponentId::Buffer); assert!(!unlink(data, comp, 0, 0)); exit(data); } #[test] fn test_removing_all_links() { let data = init(); assert!...
use crate::{ ast::{ exp::ASTExp_, field::{FieldData, FieldList}, stm::{StmList, Stm_}, var::Var, }, wasm::il::{ module::{Module, Module_}, stm::Stm_ as WASMStm_, }, }; use super::{ entry_map::EnvEntry, laze_type::{LazeType, LazeTypeList, LazeType_...
//! Module implements emulation of sound chip AY, Spectrum Beeper and Mixer #[cfg(feature = "ay")] pub mod ay; pub mod sample; pub(crate) mod beeper; pub(crate) mod mixer;
//! Safe implementation of thread-local storage. //! //! This module provides lightweight abstractions for TLS similar to the ones provided by libstd. use core::{marker, mem}; use shim::thread_destructor; /// A thread-local container. pub struct Key<T: 'static> { /// The inner data. inner: T, } impl<T: 'sta...
mod audio; mod command; mod error; mod network; mod notifications; mod state; use crate::state::State; use crate::network::{tcp, udp}; use futures_util::{SinkExt, StreamExt}; use log::*; use mumlib::command::{Command, CommandResponse}; use mumlib::setup_logger; use std::sync::Arc; use tokio::sync::RwLock; use tokio::...
#[cfg(test)] mod timer_test; pub(crate) mod ack_timer; pub(crate) mod rtx_timer;
use super::lib; // 5 call expensive func // or |intensity: u32| -> u32 // type infer, similar to variable fn generate_workout = |intensity| { println!("팔굽혀 펴기 {} 회 실시", lib::expensive_calcultation.value(intensity)); println!("윗몸 일으키기 {} 회 실시", lib::expensive_calcultation.value(intensity)); println!("퍽 {} ...
use SafeWrapper; use ir::{User, Instruction, TerminatorInst, CleanupPadInst, Block}; use sys; pub struct CleanupReturnInst<'ctx>(TerminatorInst<'ctx>); impl<'ctx> CleanupReturnInst<'ctx> { /// Creates a new cleanup return instruction. pub fn new(cleanup_pad: &CleanupPadInst, unwind_block: &Bloc...
// Written in 2014 by Violet D. Watson. Doesn't actually work at this point. #![feature(macro_rules)] mod ops; mod cpu; mod mmu; fn main () { let cpu = &mut cpu::reset(); let mmu = &mut mmu::Mmu {empty: false}; cpu.debug_print(); run(cpu, mmu); } fn run (cpu: &mut cpu::Cpu, mmu: &mut mmu::Mmu) { ...
use db::postgres_db::Connection; use repository::client_repository::Client; use rocket::Route; use rocket_contrib::json::{Json, JsonValue}; pub fn get_routes() -> Vec<Route> { routes![ read, find_by_id, find_by_name, find_like_name, create, update, ...
use crate::components::{Player, PlayerState}; use crate::resources::Sprites; use bevy::prelude::*; use bevy::sprite::Rect; pub fn setup( mut commands: Commands, mut sprites: ResMut<Sprites>, asset_server: Res<AssetServer>, mut texture_atlases: ResMut<Assets<TextureAtlas>>, ) { let texture = asset_server.load...
// q0168_excel_sheet_column_title struct Solution; impl Solution { const BASE: [char; 26] = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', ]; pub fn convert_to_title(n: i32) -> String { let base =...
fn main() { println!("正方形"); let c:Square = Square{x: 2.0}; println!("2*2 = {}",graphics_area(c)); println!("三角形"); let b: Triangle = Triangle{x: 2.0, y: 2.0}; println!("2*2/2 = {}", graphics_area(b)); } fn graphics_area<T: Area>(item: T) -> f64 { item.area() } // 三角形 struct Triangle { ...
use std::io::{self, BufRead}; use std::collections::{HashMap, LinkedList}; fn main() { let stdin = io::stdin(); let line = stdin.lock().lines().next().unwrap().unwrap(); let m = line.parse::<i32>().unwrap(); let line = stdin.lock().lines().next().unwrap().unwrap(); let iter = line.split_whitespace(); le...
extern crate getopts; use getopts::Options; use std::env; mod encrypt; // Just parsing cmd args and calling encrypt function fn main() { let args: Vec<String> = env::args().collect(); let mut opts = Options::new(); opts.optopt("f", "file", "input file path", "input.txt"); opts.optopt("s", "sec_file",...
use crate::chunked::{ChunkedDecoder, ChunkedEncoder}; use crate::fast_buf::FastBuf; use crate::share::is_closed_kind; use crate::AsyncRead; use crate::Error; use futures_util::ready; use std::fmt; use std::io; use std::pin::Pin; use std::str::FromStr; use std::task::{Context, Poll}; /// Limit reading data given config...
extern crate openal; use serenity::client::bridge::voice::ClientVoiceManager; use serenity::prelude::Mutex; use serenity::voice::AudioReceiver; extern crate typemap; use self::typemap::Key; use std::cmp; use std::collections::HashMap; use std::f32; use std::sync::Arc; use player::Player; use player::Vector3; pub s...
pub mod mls_client { tonic::include_proto!("mls_client"); }
//! Hooks the splash screen to display our "CLEO" numberplate, and also provides a Rust interface for some //! common UIKit code. use crate::{call_original, targets}; use log::trace; use objc::{ runtime::{Object, Sel}, *, }; use std::os::raw::c_long; #[repr(C)] #[derive(Clone, Copy)] pub struct CGSize { p...
use bech32::{Bech32, FromBase32, ToBase32}; use chain_core::mempack::{ReadBuf, ReadError, Readable}; use chain_core::property::Serialize; use chain_impl_mockchain::certificate::Certificate; type StaticStr = &'static str; custom_error! {pub Error Bech32 { source: bech32::Error } = "failed to parse bech32", For...
#[doc = "Reader of register DMAMUX1_RGSR"] pub type R = crate::R<u32, super::DMAMUX1_RGSR>; #[doc = "Reader of field `OF0`"] pub type OF0_R = crate::R<bool, bool>; #[doc = "Reader of field `OF1`"] pub type OF1_R = crate::R<bool, bool>; #[doc = "Reader of field `OF2`"] pub type OF2_R = crate::R<bool, bool>; #[doc = "Rea...
extern crate unicode_normalization; extern crate varint; use crate::query::DocResult; use std::cmp::Ordering; use std::io::Cursor; use std::str; use self::varint::VarintWrite; /// For index header. This constant isn't actually used in the code, but provided here for /// completeness. pub const _KEY_PREFIX_HEADER: ch...
// Copyright 2015 The Rust Project Developers. 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 ...
/* ** Мир загружает чанки, к которым подходят игроки. ** Мир освобождает чанки, от которых ушли все игроки. ** Нельзя взаимодействовать с чанками, которые не загрузились. ** Нельзя освобождать чанки, которые не сохранились. ** ** При загрузке чанка: ** он должен сгенерироваться, а для этого: ** рассчитываю...
mod audio; mod midi; mod synth; mod midi_controller; mod synth_controller; mod button_map; use std::error::Error; use std::sync::mpsc; use clap::{App, Arg}; use crate::midi_controller::MidiController; fn main() { match run() { Ok(_) => (), Err(err) => println!("Error: {}", err), } } fn lis...
#[derive(Debug)] pub enum RunnerError<E: std::error::Error> { WmError(E), Custom(String), } impl<E: std::error::Error> std::fmt::Display for RunnerError<E> { fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result { match self { Self::WmError(e) => write!(f, "{}", e), ...
/// Maximum number of consecutive polls in a loop pub const MAX_SYNC_POLLS: u32 = 1000;
use async_graphql::http::{playground_source, GraphQLPlaygroundConfig}; use async_graphql::{EmptyMutation, EmptySubscription, Schema}; use async_graphql_warp::{BadRequest, Response}; use http::StatusCode; use starwars::{QueryRoot, StarWars}; use std::convert::Infallible; use warp::{http::Response as HttpResponse, Filter...
use ggez::{ Context, graphics, GameResult, graphics::Rect, nalgebra::{ Vector2, Point2 } }; use rand::Rng; use crate::particle::Particle; // Powerups #[derive(Clone)] pub enum Powerups { PiercingBullet((f32, u8)), SpeedBoost((f32, f32)), Heal(u8), AmmoRestock(u32) } pub struct Powerup { ...
use nom::number::complete::{le_u8, le_i8, le_u16, le_f32}; use serde_derive::{Serialize}; use super::parserHeader::*; #[derive(Debug, PartialEq, Serialize)] pub struct CarStatusData { pub m_tractionControl: u8, pub m_antiLockBrakes: u8, pub m_fuelMix: u8, pub m_frontBrakeBias: u8, pub m_pitLimiterS...
//! Module that handles calling out to `cargo bench` and parsing the machine-readable messages //! to compile the benchmarks and collect the information on the benchmark executables that it //! emits. use crate::bench_target::BenchTarget; use anyhow::{Context, Result}; use std::path::PathBuf; use std::process::{Comman...
use chrono::{NaiveDateTime, NaiveDate}; use rusqlite::{params, Connection, Result, Error}; use rusqlite::NO_PARAMS; #[derive(Debug)] pub struct LogRecord { pub id: u32, pub message: String, pub time: NaiveDateTime } pub struct DbManager { connection: Connection } impl DbManager { pub fn new(db_fi...
use crate::{ from_slice, common::{ add_object_to_map, AdnlCryptoUtils, AdnlHandshake, AdnlPingSubscriber, deserialize, get256, hash, KeyId, KeyOption, KeyOptionJson, Query, QueryCache, QueryId, serialize, Subscriber, TARGET, UpdatedAt, Version } }; use aes_ctr::stream_cipher::Syn...
#![cfg(all(test, feature = "test_e2e"))] mod setup; use azure_core::prelude::*; use azure_cosmos::prelude::*; use azure_cosmos::resources::collection::*; use futures::stream::StreamExt; #[tokio::test] async fn create_and_delete_collection() { const DATABASE_NAME: &str = "test-cosmos-db-create-and-delete-collectio...
// 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. // // A test that assigns to a location that is unknown at compile time. pub fn main() { do_join(true); } fn do_join(cond: bool) { ...
extern crate image; use std::collections::HashMap; mod dom; mod html; mod css; mod style; mod layout; mod painting; use std::fs::File; use std::path::Path; fn main() { println!("Hello, world!"); let node = dom::Node::text("First Node".to_string()); println!("{:?}", node); let node = dom::Node::ele...
use std::ffi::{ CString, CStr }; use std::fs; use std::path::Path; use std::ptr; /// Loads a OpenGL shader program and cleans up when it's deleted. #[derive(Debug)] pub struct ShaderProgram(gl::types::GLuint); impl ShaderProgram { pub fn load_from<V, F>(v: V, f: F) -> Result<Self, String> where V: AsRef<P...
//! Components for receiving incoming request bodies. use { super::localmap::{local_key, LocalData}, crate::error::HttpError, bytes::{Buf, Bytes, BytesMut}, futures01::{Async, Future, Poll}, http::StatusCode, izanami::{ h1::{Data as H1Data, RequestBody as H1Body}, h2::{Data as H...
//! GBA ROM fixer. //! //! Currently does not accept any arguments beyond `--help` #![feature(with_options)] #![allow(unused_assignments)] use std::fs::File; use std::io::{Read, Seek, SeekFrom, Write}; use std::mem::size_of; use std::path::Path; extern crate gba_core; use gba_core::header::Header; /// Computes the ...