text
stringlengths
8
4.13M
use std::io::Read; fn main() { let mut input = String::new(); std::io::stdin().read_to_string(&mut input).unwrap(); // Changing this to usize works, but more than doubles the runtime type ItemType = u32; const FULL_CUP_COUNT: ItemType = 1000000; let initial_cups: Vec<_> = input.trim().chars()....
/// Find all prime numbers less than `n`. /// For example, `sieve(7)` should return `[2, 3, 5]` pub fn sieve(n: u32) -> Vec<u32> { let mut prime = vec![true; n as usize]; let upper = (n as f64).sqrt() as u32 + 1; for i in 2..upper { let mut j = i*i; while j < n { prime[j as usize...
// This file is part of linux-epoll. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
use std::cmp::min; use handlebars::Handlebars; use v_htmlescape::escape; use super::utils::{self, rematch, Difference}; use crate::{config::Diff2HtmlConfig, parse}; static GENERIC_COLUMN_LINE_NUMBER: &'static str = include_str!("../templates/generic-column-line-number.hbs"); static GENERIC_EMPTY_DIFF: &'static s...
use byteorder::{BigEndian, WriteBytesExt}; use naia_shared::{ wrapping_diff, ActorType, Event, EventPacketWriter, EventType, LocalActorKey, ManagerType, Manifest, MTU_SIZE, }; use super::command_receiver::CommandReceiver; const MAX_PAST_COMMANDS: u8 = 2; /// Handles writing of Event & Actor data into an out...
// Copyright (c) 2018-2022 Ministerio de Fomento // Instituto de Ciencias de la Construcción Eduardo Torroja (IETcc-CSIC) // 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 ...
mod webgl2_render_context; //mod webgl2_render_graph_executor; mod utils; mod webgl2_render_resource_context; pub use webgl2_render_context::*; //pub use webgl2_render_graph_executor::*; pub use webgl2_render_resource_context::*; pub use js_sys; pub use wasm_bindgen::JsCast; pub use web_sys::{ WebGl2RenderingCont...
pub mod claims;
use crate::diesel::ExpressionMethods; use crate::diesel::QueryDsl; use crate::diesel::RunQueryDsl; use crate::models; use crate::schema::users; use crate::virtual_schema::users_todos; use bcrypt; use diesel::result; use diesel::sql_query; use serde::ser::SerializeStruct; use uuid::Uuid; /// Main user model that will b...
use crate::spatial_ref::SpatialRef; use crate::utils::{_last_null_pointer_err, _string}; use crate::vector::layer::Layer; use gdal_sys::{ self, OGRFeatureDefnH, OGRFieldDefnH, OGRFieldType, OGRGeomFieldDefnH, OGRwkbGeometryType, }; use libc::c_int; use crate::errors::*; /// Layer definition /// /// Defines the fi...
mod image; mod root_entry; mod bios_param; pub use self::image::Image; pub use self::root_entry::RootEntry; pub use self::bios_param::BIOSParam; pub fn cluster_num_is_valid(cluster_num: u16) -> bool { 2 <= cluster_num && cluster_num < 0xff0 }
use crate::tag::Tag; /// View into a subfield of a MARC field pub struct Subfield<'a> { tag: Tag, identifier: u8, data: &'a [u8], }
use crate::{client::*, match_controller::*}; use futures::prelude::*; use mahjong::{match_state::*, messages::*}; use std::{collections::HashMap, sync::Arc}; use thespian::*; use tracing::*; use tracing_futures::Instrument; use warp::Filter; mod client; mod match_controller; #[tokio::main] async fn main() { // Se...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - clock control register"] pub cr: CR, #[doc = "0x04 - RCC Internal Clock Source Calibration Register"] pub icscr: ICSCR, #[doc = "0x08 - RCC Clock Recovery RC Register"] pub crrcr: CRRCR, _reserved3: [u8; 4usize]...
use alloc::string::String; use core::slice; use device_tree::{DeviceTree, Node}; use super::virtio::virtio_probe; use super::CMDLINE; const DEVICE_TREE_MAGIC: u32 = 0xd00dfeed; fn walk_dt_node(dt: &Node) { if let Ok(compatible) = dt.prop_str("compatible") { // TODO: query this from table if comp...
//! Where the StableAbi trait is declared,as well as related types/traits. use core_extensions::type_level_bool::{Boolean, False, True}; use std::{ cell::{Cell, UnsafeCell}, marker::{PhantomData, PhantomPinned}, mem::ManuallyDrop, num::{NonZeroU16, NonZeroU32, NonZeroU64, NonZeroU8, NonZeroUsize, Wrapp...
use core::ptr::null_mut; use {ffi, Bitmap}; pub struct BitmapGlyph { library_raw: ffi::FT_Library, raw: ffi::FT_BitmapGlyph } impl BitmapGlyph { pub unsafe fn from_raw(library_raw: ffi::FT_Library, raw: ffi::FT_BitmapGlyph) -> Self { ffi::FT_Reference_Library(library_raw); BitmapGlyph { li...
use bytemuck::{Pod, Zeroable}; use glam::Vec3; use lucien_core::logger::logger; use slog::warn; #[repr(C)] #[derive(Default, Debug, Copy, Clone)] pub struct Vertex { pub position: [f32; 3], pub normal: [f32; 3], pub tex_coord: [f32; 2], } unsafe impl Pod for Vertex {} unsafe impl Zeroable for Vertex {} #...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::FIFOCTL { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, ...
//! Simple, CPU cache-friendly epoch-based reclamation (EBR). //! //! ```rust //! use rsdb::ebr::Ebr; //! //! let mut ebr: Ebr<Box<u64>> = Ebr::default(); //! //! let mut guard = ebr.pin(); //! //! guard.defer_drop(Box::new(1)); //! ``` use std::{ collections::{BTreeMap, VecDeque}, mem::{take, MaybeUninit}, ...
use libc::{fopen, mmap, PROT_READ, PROT_WRITE, MAP_PRIVATE, msync, munmap, MS_ASYNC, fclose}; use std::mem::size_of; use std::os::raw::c_void; use std::ptr; struct Record { id: u32, name: u32 } fn main() { unsafe { let fp_name = b"mmap.dat\x00".as_ptr(); let fp = fopen(fp_na...
use embedded_hal::{ digital::v2::OutputPin, timer::{CountDown, Periodic}, }; use nb::block; use stm32f4xx_hal::{prelude::*, time::Hertz}; const SYMBOLS: [u8; 16] = [ 0xd, 0xe, 0x13, 0x15, 0x16, 0x19, 0x1a, 0x1c, 0x23, 0x25, 0x26, 0x29, 0x2a, 0x2c, 0x32, 0x34, ]; #[derive(Debug)] pub enum Error { Port,...
#[doc = r"Value read from the register"] pub struct R { bits: u8, } #[doc = r"Value to write to the register"] pub struct W { bits: u8, } impl super::TXCSRH3 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
use cluFullTransmute::contract::Contract; /* For example, we will sign a contract to convert a String to a Vec<u8>, although this may not be exactly the case. Contracts are needed to create more secure APIs using transmutation in situations where it can't be proven. */ /// struct MyData { data: Contract<&'...
use std::boxed::Box; // Took a swing at it myself, got a bad-but-working // version, then followed this tutorial: // https://rust-unofficial.github.io/too-many-lists/second-iter-mut.html #[derive(Debug)] struct Node<T> { value: T, next: Option<Box<Node<T>>>, } #[derive(Debug)] pub struct LinkedList<T> { ...
// Copyright 2019 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. use std::collections::HashMap; use ethernet as eth; use netstack3_core::{DeviceId, IdMapCollection, IdMapCollectionKey}; pub type BindingId = u64; /// K...
// Copyright 2018 Parity Technologies (UK) Ltd. // // 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, mer...
// Copyright 2019 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. use fuchsia_criterion::{criterion, FuchsiaCriterion}; fn fib(n: u64) -> u64 { match n { 0 => 1, 1 => 1, n => fib(n - 1) + fib(...
use crate::image_range::ImageRange; use crate::semi_dense::fusion::fusion; use crate::semi_dense::numeric::Inverse; use crate::semi_dense::stat; use crate::warp::{PerspectiveWarp, Warp}; use ndarray::{arr1, Array, Array2, Data}; use std::collections::HashMap; fn propagate_variance( depth0: f64, depth1: f64, ...
/* * File : test/mod.rs * Purpose: test module * Program: red * About : command-line text editor * Authors: Tommy Lincoln <pajamapants3000@gmail.com> * License: MIT; See LICENSE! * Notes : Notes on successful compilation * Created: 10/26/2016 */ // *** Bring in to namespace *** ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type AccountsSettingsPane = *mut ::core::ffi::c_void; pub type AccountsSettingsPaneCommandsRequestedEventArgs = *mut ::core::ffi::c_void; pub type AccountsS...
use libc; use libc::strcmp; pub unsafe fn single_argv(mut argv: *mut *mut libc::c_char) -> *mut libc::c_char { if !(*argv.offset(1)).is_null() && strcmp( *argv.offset(1), b"--\x00" as *const u8 as *const libc::c_char, ) == 0 { argv = argv.offset(1) } if (*argv.offset(1)).is_null() || !(...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn ApplicationRecoveryFinished<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::BOOL>>(bsuccess: Param0) { #[...
pub fn test_number(num: u64) -> bool { let mut last_digit = num % 10; let mut number = num / 10; let mut pair_found = false; while number != 0 { let current_digit = number % 10; if current_digit > last_digit { return false; } if last_digit == current_digit {...
use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let a: u32 = rd.get(); let b: u32 = rd.get(); if a <= b { println!("{}", b - a + 1); } else { println!("0"); } }
use ocl; use rand::{Rng, thread_rng}; use crate::Context; /// Buffer that stores necessary data for rendering (e.g. collected statistics, rng seeds, etc). pub struct RenderBuffer { context: Context, random: ocl::Buffer<u32>, color: ocl::Buffer<f32>, n_passes: usize, dims: (usize, usize), } impl R...
//! Helper functions for multipart encodings #[cfg(feature = "multipart_form")] pub mod form; #[cfg(feature = "multipart_related")] pub mod related;
pub mod io; pub mod exchange; pub mod simulation; pub mod order; pub mod controller; pub mod utility; use crate::exchange::order_book::Book; use crate::order::TradeType; use crate::exchange::queue::Queue; use crate::controller::State; #[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_json; use...
#[derive(Debug)] pub struct Spu; impl Spu { pub fn new() -> Spu { Spu {} } #[allow(unused_variables)] pub fn write(&mut self, addr: u16, val: u8) {} #[allow(unused_variables)] pub fn read(&self, addr: u16) -> u8 { 0 } }
// Copyright 2021 Datafuse Labs. // // 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 ...
use std::fmt; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum Opcode { Query, IQuery, Status, Notify, Update, Reserved, } impl Opcode { pub fn new(value: u8) -> Self { match value { 0 => Opcode::Query, 1 => Opcode::IQuery, 2 => Opcode::Stat...
use std::{sync::Arc, time::Duration}; use futures::Future; use observability_deps::tracing::*; use tokio::sync::oneshot; use tokio_util::sync::CancellationToken; use crate::{ ingest_state::{IngestState, IngestStateError}, partition_iter::PartitionIter, persist::{drain_buffer::persist_partitions, queue::Pe...
use proc_macro2::TokenStream; use quote::ToTokens; use syn::{visit_mut::VisitMut, *}; use crate::utils::*; mod context; mod expr; #[cfg(feature = "type_analysis")] mod type_analysis; mod visitor; use self::context::{Context, VisitLastMode, VisitMode, DEFAULT_MARKER}; use self::expr::child_expr; /// The attribute na...
use proconio::input; fn main() { input! { n: usize, }; println!("{}{}", n / 10 % 10, n % 10); }
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::term::prelude::*; /// `xor/2` infix operator. /// /// **NOTE: NOT SHORT-CIRCUITING!** #[native_implemented::function(erlang:xor/2)] pub fn result(left_boolean: Term, right_boolean: Term) -> exceptio...
mod sha256; mod sha512; pub use sha256::*; pub use sha512::*;
pub struct Base { pub title: String, pub status: String } impl Base { pub fn new(input_title: String, input_status: String) -> Base { return Base {title: input_title, status: input_status} } }
mod tcp; pub use self::tcp::{TcpStream,TcpClient};
// SPDX-License-Identifier: MIT // Copyright (c) 2021-2022 brainpower <brainpower at mailbox dot org> #![feature(assert_matches)] #[cfg(test)] mod tests { use checkarg::{CheckArg, ValueType, RC}; use std::assert_matches::assert_matches; fn triggering_help(option: &str) { let argv = vec!["/test01", option]; ...
pub use VkComponentSwizzle::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkComponentSwizzle { VK_COMPONENT_SWIZZLE_IDENTITY = 0, VK_COMPONENT_SWIZZLE_ZERO = 1, VK_COMPONENT_SWIZZLE_ONE = 2, VK_COMPONENT_SWIZZLE_R = 3, VK_COMPONENT_SWIZZLE_G = 4, VK_COMPONENT_SWIZZLE_B =...
use std::cmp::Reverse; use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; const ten97: usize = 1000000007; fn alphabet2idx(c: char) -> usize { if c.is_ascii_lowercase() { c as u8 as usize - 'a' as u8 as usize } else if c.is_ascii_up...
#[cfg(feature = "client")] mod playdevice; #[cfg(feature = "client")] mod recdevice; #[cfg(feature = "client")] pub use self::playdevice::*; #[cfg(feature = "client")] pub use self::recdevice::*; use crate::vars::DEFAULT_SAMPLES_PER_SECOND; use std::io::Write; use std::path::Path; #[cfg(feature = "client")] use std:...
use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] pub struct Message { pub targets: Vec<String>, pub message: String, } impl Message { pub fn easy_parse(input: &str) -> Option<Message> { let (dest, msg) = input .find(':') .map(|idx| (&input[..idx...
use crate::error; use arrow::datatypes::{DataType, TimeUnit}; use datafusion::common::tree_node::{Transformed, TreeNode, VisitRecursion}; use datafusion::common::{DFSchemaRef, Result}; use datafusion::logical_expr::utils::expr_as_column_expr; use datafusion::logical_expr::{lit, Expr, ExprSchemable, LogicalPlan, Operato...
// Copyright (c) 2020 Allen Wild // SPDX-License-Identifier: MIT OR Apache-2.0 use yall::log_macros::*; use yall::Logger; fn main() { let count: usize = match std::env::args().nth(1) { Some(c) => c.parse().unwrap(), None => 100, }; Logger::new().init(); for i in 1..=count { i...
use super::*; use crate::mock::{Currency, ExtBuilder, Faucet, Origin, Test, ALICE, HDX}; use frame_support::traits::OnFinalize; use frame_support::{assert_noop, assert_ok}; #[test] fn rampage_mints() { ExtBuilder::default().build_rampage().execute_with(|| { assert_ok!(Faucet::rampage_mint(Origin::signed(ALICE), HDX...
use std::collections::HashMap; use std::sync::{Arc, RwLock}; fn main() { let lotable: Arc<RwLock<HashMap<String, u64>>> = Arc::new(RwLock::new(HashMap::default())); // RW from 1_000 threads concurrently. let thread_count = 8; let mut threads = vec![]; for thread_no in 0..thread_count { le...
use std::fmt; #[derive(Debug)] #[derive(PartialEq)] pub struct Clock { hours: i32, minutes: i32 } impl Clock { pub fn new(hours: i32, minutes: i32) -> Self { Clock { hours: Clock::initiate_hours(hours, minutes), minutes: Clock::roll_over_minutes(minutes) } } ...
use actix_web::{test, FromRequest, HttpRequest, State}; use bigneon_api::config::{Config, Environment}; use bigneon_api::mail::transports::TestTransport; use bigneon_api::server::AppState; pub struct TestRequest { pub request: HttpRequest<AppState>, pub config: Config, } impl TestRequest { pub fn test_tra...
#![allow(dead_code)] use crate::{regex}; use lazy_static::lazy_static; use regex::Regex; use std::collections::HashMap; lazy_static! { static ref MEM_REGEX: Regex = regex!(r"^mem\[([0-9]+)\] = ([0-9]+)$"); static ref MASK_REGEX: Regex = regex!(r"^mask = ([X01]+)$"); } pub fn day15() { println!("rambuncti...
use types::{int_t}; #[no_mangle] pub extern fn isalnum(c: int_t) -> int_t { match c as u8 as char { 'a'...'z' => 1, 'A'...'Z' => 1, '0'...'9' => 1, _ => 0, } } #[no_mangle] pub extern fn isalpha(c: int_t) -> int_t { match c as u8 as char { 'a'...'z' => 1, ...
use anyhow::Result; use std::rc::Rc; use std::include_str; pub use simple_gl::graphics::*; pub struct Graphics { pub program: Program } impl Graphics { pub fn new() -> Result<Graphics> { let vert_shader = VertexShader::from_source( include_str!("../../resources/shaders/cube/cube.vert") ...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ...
use projecteuler::helper; use projecteuler::modulo; fn main() { helper::check_bench(|| { solve(1000); }); assert_eq!(solve(1000), 9110846700); dbg!(solve(1000)); } //sadly this overflows for the question if only using usize (on a 64 bit machine) //thats why I also implemented a version using 1...
use anyhow::Result; use qapi::qga; use clap::Parser; use tokio::time::{Duration, timeout}; use super::{GlobalArgs, QgaStream}; #[derive(Parser, Debug)] /// Displays information about the guest, and can be used to check that the guest agent is running pub(crate) struct Info { #[clap(short = 'O', long = "os")] os_info...
use super::{dump::dump_data_frames, read_group_data, run_data_test, InfluxRpcTest}; use async_trait::async_trait; use futures::{prelude::*, FutureExt}; use generated_types::{ node::Logical, read_response::frame::Data, storage_client::StorageClient, ReadFilterRequest, }; use influxdb_iox_client::connection::GrpcConn...
#[macro_use] extern crate clap; #[macro_use] extern crate slog; extern crate slog_term; use slog::Drain; use std::process; use clap::{Arg, ArgMatches, App, SubCommand}; arg_enum! { #[derive(Debug)] enum Algorithm { SHA1, SHA256, Argon2 } } fn run(matches: ArgMatches) -> Result<()...
#[doc = "Reader of register ITLINE27"] pub type R = crate::R<u32, super::ITLINE27>; #[doc = "Reader of field `USART1`"] pub type USART1_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - USART1"] #[inline(always)] pub fn usart1(&self) -> USART1_R { USART1_R::new((self.bits & 0x01) != 0) } }
use crate::position::*; use crate::types::*; use crate::util::*; use itertools::Itertools; use lsp_types::*; use ropey::{Rope, RopeSlice}; use std::collections::HashSet; use std::fs::File; use std::io::{BufReader, BufWriter, Write}; use std::os::unix::io::FromRawFd; pub fn apply_text_edits_to_file( uri: &Url, ...
// Copyright 2014 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 ...
use alloc::collections::VecDeque; use spin::Mutex; pub static LOG: Mutex<Option<Log>> = Mutex::new(None); pub fn init() { *LOG.lock() = Some(Log::new(1024 * 1024)); } pub struct Log { data: VecDeque<u8>, size: usize, } impl Log { pub fn new(size: usize) -> Log { Log { data: VecDe...
//! Worst-case optimal, n-way joins. //! //! This is an extended implementation of Delta-BiGJoin, by Ammar, McSherry, //! Salihoglu, and Joglekar ([paper](https://dl.acm.org/citation.cfm?id=3199520)). //! //! The overall structure and the CollectionExtender implementation is adapted from: //! https://github.com/frankmc...
use serde_json::{Map, Value}; use std::fmt; #[derive(Debug)] pub struct ParseError; impl fmt::Display for ParseError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "ParseError") } } impl From<serde_json::Error> for ParseError { fn from(_: serde_json::Error) -> Self { P...
mod pathfinder; mod printer; mod renamer; use printer::Print; use renamer::Renamer; use std::io::{stdin, Read}; fn main() { let mut renamer = Renamer::new(); if let Err(e) = renamer.start() { Print::error(format!("Project rename failed: {}", e)); } Print::prompt("Press Enter to exit."); ...
use crate::{client::StdoutWriter, requests::Request, responses::Response}; use async_trait::async_trait; /// Trait for an debug adapter. /// /// Adapters are the main backbone of a debug server. They get a `accept` call for each /// incoming request. Responses are the return values of these calls. #[async_trait] pub t...
#![no_std] extern crate alloc; use alloc::borrow::ToOwned; use alloc::boxed::Box; use alloc::string::ToString; use alloc::vec; use alloc::vec::Vec; use prost::Message; extern crate tests_infra; pub mod foo { pub mod bar_baz { include!(concat!(env!("OUT_DIR"), "/foo.bar_baz.rs")); } } pub mod nesti...
pub static STDLIB :&[u8] = b" #ifndef _ENPPSTD_ #define _ENPPSTD_ #include <type_traits> #include <algorithm> #include <iostream> #include <fstream> #include <numeric> #include <vector> #include <string> #include <thread> #include <future> #include <chrono> #include <regex> #include <tuple> #include <map> #ifdef __cpp_...
#![no_std] extern crate rand; use rand::SeedableRng; use rand::rngs::SmallRng; use rand::distributions::{Distribution, Bernoulli}; /// This test should make sure that we don't accidentally have undefined /// behavior for large propabilties due to /// https://github.com/rust-lang/rust/issues/10184. /// Expressions li...
use std::io::prelude::*; use serde::{Serialize, ser, serde_if_integer128}; use std::fmt::Display; use super::write::*; pub struct MCProtoSerializer<W: Write> { pub writer: W } impl<W: Write> MCProtoSerializer<W> { /// Creates a new Serializer with the given `Write`r. pub fn new(w: W) -> MCProtoSerializer...
//#[macro_use] extern crate log; #[macro_use] extern crate lazy_static; #[macro_use] extern crate serenity; extern crate requests; extern crate typemap; mod commands; mod shared; use serenity::framework::standard::{DispatchError, StandardFramework, HelpBehaviour, help_commands}; use serenity::http; use serenity::pre...
use std::fmt::Debug; use std::str::FromStr; #[allow(dead_code)] #[allow(deprecated)] fn read_line_from_stdin() -> String { let mut buffer = String::new(); std::io::stdin().read_line(&mut buffer).unwrap(); buffer.trim_right().to_owned() } #[allow(dead_code)] #[allow(deprecated)] fn parse_line_to_single<T>(...
// Copyright 2019 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. pub enum VoilaMessage { ReplicaConnectivityToggled(u32), }
#[cfg(unix)] use std::os::unix::prelude::*; #[cfg(windows)] use std::os::windows::prelude::*; use std::borrow::Cow; use std::fmt; use std::fs; use std::io; use std::iter; use std::iter::repeat; use std::mem; use std::path::{Component, Path, PathBuf}; use std::str; use crate::other; use crate::EntryType; /// Represen...
// Copyright 2018 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. pub mod psk; use crate::rsna::{Dot11VerifiedKeyFrame, UpdateSink}; use failure; use zerocopy::ByteSlice; #[derive(Debug, PartialEq)] pub enum Method { ...
#![feature(num_as_ne_bytes)] #![feature(option_result_contains)] pub mod database; pub mod user; pub mod chatroom; pub mod data; pub mod protocol; pub mod ui;
use derive_more::Display; use std::fmt::{self, Debug, Display, Formatter}; type BoxError = Box<dyn std::error::Error + Send + Sync>; /// A set of errors that can occur during parsing multipart stream and in other operations. #[derive(Display)] #[display(fmt = "multer: {}")] pub enum Error { /// An unknown field i...
use crate::{DocBase, VarType}; const DESCRIPTION: &'static str = r#" The dmi function returns the directional movement index. "#; const EXAMPLE: &'static str = r#" ```pine study(title="Directional Movement Index", shorttitle="DMI", format=format.price, precision=4) len = input(17, minval=1, title="DI Length") lensig ...
use std::fmt; #[derive(PartialEq, Copy, Clone)] pub enum Color { White, Black, } #[derive(PartialEq, Clone, Debug)] pub enum PieceType { Pawn, Rook, Knight, Bishop, King, Queen, } #[derive(Clone)] pub struct Piece { pub color: Color, pub piece_type: PieceType, pub movement:...
//! A mock state. #![cfg(test)] use async_trait::async_trait; use futures::{ channel::mpsc::{Receiver, Sender}, future::BoxFuture, SinkExt, StreamExt, }; use k8s_openapi::{apimachinery::pkg::apis::meta::v1::ObjectMeta, Metadata}; /// The kind of item-scoped operation. #[derive(Debug, PartialEq, Eq)] pub ...
use anyhow::Context; use pathfinder_common::{ContractAddress, StorageValue}; use stark_hash::Felt; use crate::params::{params, RowExt}; /// This migration adds the system contract updates which were mistakenly never inserted. /// /// Thankfully we can avoid looking these values up in the state trie as the values can ...
#![allow(unused_imports)] use ::error::{ RedisError, RedisErrorKind }; use std::io; use std::io::{ Error as IoError, Cursor }; use std::sync::Arc; use std::str; use std::collections::{ HashMap }; use std::fmt::{ Write }; use bytes::{ BytesMut, BufMut, Buf }; use super::types::{ CR, LF, NU...
#[doc = "Reader of register APB2ENR"] pub type R = crate::R<u32, super::APB2ENR>; #[doc = "Writer for register APB2ENR"] pub type W = crate::W<u32, super::APB2ENR>; #[doc = "Register APB2ENR `reset()`'s with value 0"] impl crate::ResetValue for super::APB2ENR { type Type = u32; #[inline(always)] fn reset_va...
// Copyright 2022 Datafuse Labs. // // 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 ...
use input_i_scanner::InputIScanner; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; (($($t: ty),...
use std::io; use std::io::Read; use regex::Regex; fn main() { let mut input = String::new(); io::stdin().read_to_string(&mut input).unwrap(); let re = Regex::new(r"(?m)^(\d+)-(\d+) (\w): (\w+)$", ).unwrap(); let count = re.captures_iter(&input).filter(|x| { let (first, second, letter, password...
pub mod clint; pub mod plic; pub mod uart; pub mod virtio_block_disk;
use amethyst::{ core::transform::Transform, prelude::*, renderer::{Camera}, ui::{Anchor, UiTransform}, }; use crate::sprite::storage::SpriteSheetStorage; use crate::component::player::Player; use crate::component::def::Side; use crate::component::score::ScoreText; use crate::component::rule::Rules; use super::...
#[macro_use] extern crate rental; pub trait MyTrait { } pub struct MyStruct { } impl MyTrait for MyStruct { } rental! { pub mod rentals { use ::MyTrait; #[rental] pub struct RentTrait { my_trait: Box<MyTrait + 'static>, my_suffix: &'my_trait (MyTrait + 'static), } } } #[test] fn new() { l...
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; fn main() { let (h, w): (usize, usize) = parse_line().unwrap(); let mut aa: Vec<Vec<usize>> = vec![]; for _ in 0..h { aa.push(parse_line().unwrap()); } let mut gyousums...
use super::ppu::Ppu; use super::spu::Spu; use super::cpu::Cpu; use super::GameboyType; use super::interconnect::Interconnect; pub use super::ppu::VideoSink; pub use super::gamepad::{InputEvent,Gamepad,Button,ButtonState}; pub use super::cart::Cart; pub struct Console { cpu: Cpu, } impl Console { pub fn new(c...