text
stringlengths
8
4.13M
//! Queries the major, minor and build version of Windows (NT) efficiently //! with usage of undocumented NTDLL functions. **This crate is no_std.** //! //! It only has one function: [get](fn.get.html), //! and it's recommended you use it explicitly like `nt_version::get()` because of this. //! //! //! ## Build Error? ...
#![feature(try_trait)] extern crate reqwest; extern crate serde_json; extern crate time; use serde_json::Value; use std::io::Read; static BASE_URL: &str = "https://min-api.cryptocompare.com/data/"; pub struct Options<'a> { pub exchanges: &'a str, pub try_conversion: bool } #[derive(Debug)] pub struct Data...
#[doc = "Reader of register COMP4_CSR"] pub type R = crate::R<u32, super::COMP4_CSR>; #[doc = "Writer for register COMP4_CSR"] pub type W = crate::W<u32, super::COMP4_CSR>; #[doc = "Register COMP4_CSR `reset()`'s with value 0"] impl crate::ResetValue for super::COMP4_CSR { type Type = u32; #[inline(always)] ...
#[doc = "Reader of register APB2RSTR"] pub type R = crate::R<u32, super::APB2RSTR>; #[doc = "Writer for register APB2RSTR"] pub type W = crate::W<u32, super::APB2RSTR>; #[doc = "Register APB2RSTR `reset()`'s with value 0"] impl crate::ResetValue for super::APB2RSTR { type Type = u32; #[inline(always)] fn re...
use kind::*; use square::*; use castle::Castle; use castle; use std::fmt::{Display, Formatter, Result}; #[derive(Eq, Hash, Debug, Copy, Clone, PartialEq)] pub struct Move { pub from: Square, pub to: Square, pub promote: Kind, pub castle: Castle, } const CASTLE_Q: Move = Move { from: UNDEFINED_SQUA...
use std::{fmt, mem, usize}; use std::iter::IntoIterator; use std::ops::{Index, IndexMut}; use token::Token; /// A preallocated chunk of memory for storing objects of the same type. pub struct Slab<T> { // Chunk of memory entries: Vec<Entry<T>>, // Number of elements currently in the slab len: usize, ...
use crate::datastore::RECENT_FILES_IN_MEMORY; use crate::stdio_server::handler::CachedPreviewImpl; use crate::stdio_server::provider::{ClapProvider, Context}; use anyhow::Result; use parking_lot::Mutex; use paths::AbsPathBuf; use printer::Printer; use serde_json::{json, Value}; use std::sync::Arc; use types::{ClapItem,...
use serde::{Deserialize, Serialize}; #[derive(Clone, Serialize, Deserialize)] pub struct Config { pub db_url: String, pub uid: u32, pub gid: u32, pub pid_file: String, pub working_dir: String, pub socket: String, } #[derive(Serialize, Deserialize)] pub enum Action { Stop, Alive, Su...
use{ crate::{ structs::{CustomerData,DriverData,RecordInstruction,SingleInstruction} } }; pub const DUMMY_TX_ID: &str = "0000000000000000000000000000000000000000000"; pub const DUMMY_CREATED_ON: &str = "0000000000000000"; pub const DUMMY_LATLONG: &str="00000000"; pub const DUMMY_COST: &str="00000000000...
#![no_main] #![no_std] extern crate bme280; extern crate cortex_m; extern crate cortex_m_rt as rt; extern crate cortex_m_rtfm as rtfm; extern crate embedded_hal; extern crate heapless; extern crate il3820; #[cfg(not(test))] extern crate panic_semihosting; extern crate portable; extern crate pwm_speaker; extern crate s...
use std::collections::HashMap; use std::net::{SocketAddr, UdpSocket}; use std::sync::{Arc, mpsc, Mutex}; use std::thread; use std::time::Instant; use crate::event::NetworkEvent; use crate::event::core::ShutdownEvent; use crate::network::MAX_PACKET_SIZE; use crate::network::connection_data::{ ConnectionData, P...
use std::error::Error as StdError; use std::io::stdin; use std::result::Result as StdResult; type Result<T> = StdResult<T, Box<StdError>>; fn main() -> Result<()> { println!("Hello, there! What is your name?"); let buffer = &mut String::new(); stdin().read_line(buffer)?; // <- API requires buffer pa...
use std::{ borrow::{Borrow, Cow}, cell::UnsafeCell, cmp::Ordering, collections::HashMap, fmt::{Debug, Display, Formatter, Result as FmtResult}, io::Write, sync::Arc, }; pub trait WithChromSet<H: ChromSetHandle> { type Result; fn with_chrom_set(self, handle: &mut H) -> Self::Result; ...
use std::cmp::{max, min}; use std::collections::{HashMap, HashSet, VecDeque}; use itertools::Itertools; use whiteread::parse_line; fn main() { let (h, w): (usize, usize) = parse_line().unwrap(); let mut map: Vec<Vec<char>> = vec![]; for _ in 0..h { let line: String = parse_line().unwrap(); ...
mod file_list; mod line_by_line; mod page; mod side_by_side; pub(crate) mod utils; pub use self::file_list::FileListPrinter; pub use self::line_by_line::LineByLinePrinter; pub use self::page::PagePrinter; pub use self::side_by_side::SideBySidePrinter;
use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use cosmwasm_std::Addr; #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct InstantiateMsg { pub count: i32, } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] #[serde(rename_all = "snake_case")] pub...
use serde::{Deserialize}; use serde_json; #[derive(Deserialize)] pub struct Configuration { pub account_name: String, pub cookie: String, } pub fn load_configuration(file: &str) -> Result<Configuration, String> { let res = std::fs::read_to_string(file); match res { Ok(contents) => ...
// MinIO Rust Library for Amazon S3 Compatible Cloud Storage // Copyright 2022 MinIO, Inc. // // 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...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[cfg(feature = "Devices_I2c_Provider")] pub mod Provider; #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct I2cBusSpeed(pub i32); impl I2cBusSpeed { pub const StandardMode: ...
#![allow(dead_code)] // Not yet in use. use crate::graphics::{render_target, DrawMode, Drawable}; use gl_bindings::{Buffer, BufferType}; use na::Matrix4; use std::f32; const POINTS: usize = 40; /// Represents a drawable circle. pub struct Circle { pos: (f32, f32, f32), rotation: f32, rotation_axis: (f32, ...
use jwt::{self, Header, Algorithm, errors::Result, Validation, TokenData}; const KEY: &str = "secret"; #[derive(Debug, Serialize, Deserialize)] pub struct Claims { pub user_id: String, } pub fn encode(claim: &Claims) -> Result<String> { jwt::encode(&Header::default(), claim, KEY.as_ref()) } pub fn decode(to...
use eosio::*; pub struct StoredChainParams { pub chain_id: Checksum256, pub chain_name: String, pub icon: Checksum256, pub hash: Checksum256, pub next_unique_id: u64, } pub struct ContractAction { pub contract: AccountName, pub action: ActionName, } pub struct StoredManifest { pub uni...
#![allow(dead_code)] use abi_stable::{ abi_stability::abi_checking::check_layout_compatibility, erased_types::IteratorItem, std_types::*, DynTrait, StableAbi, }; macro_rules! mod_iter_ty { ( mod $module:ident; type Item<$lt:lifetime>=$ty:ty; ) => { pub mod $module { ...
/// Construct a [`CloudEvent`] according to spec version 0.2. /// /// # Errors /// /// If some of the required fields are missing, or if some of the fields /// have invalid content an error is returned. /// /// # Example /// /// ``` /// use cloudevents::cloudevent_v0_2; /// use std::error::Error; /// /// fn main() -> R...
// 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. #![feature(asm)] extern crate peridot_public_lib_ledger_fidl; extern crate peridot_bin_ledger_fidl; extern crate fidl; extern crate futures; extern crate g...
// SPDX-License-Identifier: MIT // Copyright (c) 2021-2022 brainpower <brainpower at mailbox dot org> #![allow(dead_code)] use std::collections::BTreeMap; use crate::{CheckArg, Opt, ValueType, RC}; type CheckArgFP = dyn Fn(&CheckArg, &str, &str) -> Result<(), ()>; impl<'a> CheckArg<'a> { pub fn new(appname: &str) ...
// 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 crate::parser_common::{ all_consuming, bool_literal, compound_identifier, map_err, numeric_literal, string_literal, using_list, ws, BindParserE...
#![recursion_limit = "256"] #![doc(html_root_url = "https://docs.rs/auto_enums_derive/0.6.3")] #![doc(test( no_crate_inject, attr(deny(warnings, rust_2018_idioms, single_use_lifetimes), allow(dead_code)) ))] #![warn(unsafe_code)] #![warn(rust_2018_idioms, unreachable_pub)] #![warn(single_use_lifetimes)] #![warn...
#![allow(dead_code)] use std::mem::transmute; use std::ptr::copy_nonoverlapping; macro_rules! write_num_bytes { ($ty:ty, $size:expr, $dst:expr, $n:expr, $which:ident) => ({ assert!($size <= $dst.len()); unsafe { // N.B. https://github.com/rust-lang/rust/issues/22776 let byt...
use std::net::{SocketAddr, TcpListener}; use std::{thread, time}; use failure::Error; use failure::ResultExt; use rand::Rng; // We do this shenanigans to (hopefully) avoid a race condition where // two threads test that a port is "free" one after the other, but before // either is able to start it's driver. pub fn ...
use std::old_io::TcpStream; use std::old_io::IoResult; use std::rand; use std::rand::Rng; use std::old_io::Timer; use std::time::duration::Duration; use std::os; use std::num::Float; fn main() { let mut dbname = "house.floor1.room1.sensor1".to_string(); let args: Vec<String> = os::args(); if args.len() >= 2 { ...
use crate::utils::*; pub(crate) const NAME: &[&str] = &["futures01::Stream"]; pub(crate) fn derive(data: &Data, items: &mut Vec<ItemImpl>) -> Result<()> { let crate_ = quote!(::futures); derive_trait!( data, parse_quote!(#crate_::stream::Stream)?, parse_quote! { trait Stre...
use std::fmt::Debug; use std::fmt::Display; //Trait可以让Rust编译器知道某个特定类型具有的功能,并可以与其他类型共享 //使用Trait可以以抽象的方式定义共享行为 //我们可以使用Trait界限来指定泛型可以是任何具有特定行为的类型 //类似于Java中的接口 pub fn trait_demo() { let tweet = Tweet { username: String::from("horse_ebooks"), content: String::from("of course, as you probably already k...
mod sort; mod sort_test;
pub const PINB: *mut u8 = 0x23 as *mut u8; pub const DDRB: *mut u8 = 0x24 as *mut u8; pub const PORTB: *mut u8 = 0x25 as *mut u8; pub const PINC: *mut u8 = 0x26 as *mut u8; pub const DDRC: *mut u8 = 0x27 as *mut u8; pub const PORTC: *mut u8 = 0x28 as *mut u8; pub const PIND: *mut u8 = 0x29 as *mut ...
use proc_macro2::Span; use syn::parse::{Parse, ParseStream, Result}; use syn::{LitInt, Path, Token}; pub enum Args { None, With(Path, LitInt), } impl Parse for Args { fn parse(input: ParseStream) -> Result<Self> { if input.is_empty() { Ok(Args::None) } else { let pa...
use models::node::{ closest_packable_fee_amount, is_fee_amount_packable, FranklinTx, Nonce, Token, TokenLike, }; use num::BigUint; use crate::{error::ClientError, operations::SyncTransactionHandle, wallet::Wallet}; #[derive(Debug)] pub struct ChangePubKeyBuilder<'a> { wallet: &'a Wallet, onchain_auth: boo...
//! Display images in your terminal, kind of //! //! ![DS3 SS example](https://cdn.rawgit.com/nabijaczleweli/termimage/master/assets/DS3-result.jpg) //! //! # Library doc //! //! This library is used by `termimage` itself for all its function and is therefore contains all necessary functions. //! //! ## Data flow //! /...
// Copyright 2023 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 customer::Customer; use fakedb; /// Method to check eligibility of each card. /// Returns a Vec<> of cards the customer is eligible for. pub fn checker(customer: Customer) -> Vec<fakedb::Card> { // create a vector to store eligible cards in let mut eligible_cards = Vec::new(); //put a clone of each card in the...
use clap::{App, Arg, AppSettings, SubCommand, Shell}; pub fn cli() -> App<'static, 'static> { App::new("tdo") .version(crate_version!()) .author("Felix Wittwer <dev@felixwittwer.de>, Felix Döring <development@felixdoering.com>") .about("A todo list tool for the terminal") .setting(A...
use crate::{ app::config::{self}, coords::{ScreenCoords, XYCoords}, gui::{ plot_context::{PlotContext, PlotContextExt}, utility::plot_curve_from_points, Drawable, DrawingArgs, }, }; use gtk::cairo::{FontFace, FontSlant, FontWeight}; use metfor::{CelsiusDiff, Quantity}; mod fire_...
use crate::content_disposition::ContentDisposition; use crate::helpers; use crate::state::{MultipartState, StreamingStage}; use bytes::{Bytes, BytesMut}; use encoding_rs::{Encoding, UTF_8}; use futures::stream::{Stream, TryStreamExt}; use http::header::HeaderMap; #[cfg(feature = "json")] use serde::de::DeserializeOwned...
// 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 agre...
#![allow(incomplete_features)] #![feature(const_generics)] pub mod executor; pub mod join; pub mod storage; pub use crossbeam_channel; pub use fxhash; pub use hibitset; pub use parking_lot; #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Entity(u32); impl Entity { pub fn new(id: u...
//! Common functions, definitions and extensions for code generation, used by this crate. pub(crate) mod default; pub(crate) mod deprecation; mod description; pub(crate) mod diagnostic; pub(crate) mod field; pub(crate) mod gen; pub(crate) mod parse; pub(crate) mod rename; pub(crate) mod scalar; mod span_container; pu...
// Interior vector utility functions. import option::none; import option::some; import uint::next_power_of_two; import ptr::addr_of; type operator2[T, U, V] = fn(&T, &U) -> V ; native "rust-intrinsic" mod rusti { fn ivec_len[T](v: &T[]) -> uint; } native "rust" mod rustrt { fn ivec_reserve_shared[T](v: &mut...
//! This module houses the structures that are specific to the management of a CrystalOrb game //! client. //! //! The [`Client`] structure is what you create, store, and update, analogous to the //! [`Server`](crate::server::Server) structure. However, there isn't much functionality you can //! directly access from a ...
enum Hint { Glyph(char), LineStart, LineEnd, PageStart } struct LayoutState { // measure the width when breaking here real: FlexMeasure, // imag: FlexMeasure, hint: Hint, score: f32 } trait Item { fn apply(&self, state: LayoutState) -> LayoutState; } struct ...
use base64::prelude::BASE64_STANDARD; use base64::Engine; use bytes::Bytes; use http::header::AsHeaderName; use http::uri::Authority; use http::HeaderMap; use http_body::Body as HttpBody; use hyper::Body; use pin_project::pin_project; use std::marker::PhantomData; use std::pin::Pin; use std::sync::atomic::{AtomicU64, O...
//! Functions returning the stdio file descriptors. //! //! # Safety //! //! These access the file descriptors by absolute index value, and nothing //! prevents them from being closed and reused. They should only be used in //! `main` or other situations where one is in control of the process' //! stdio streams. #![all...
#[cfg(test)] mod test; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use crate::runtime::registry; #[native_implemented::function(erlang:registered/0)] pub fn result(process: &Process) -> exception::Result<Term> { registry::names(proc...
pub type Typeidx = u32; pub type Funcidx = u32; pub type Tableidx = u32; pub type Memidx = u32; pub type Globalidx = u32; pub type Localidx = u32; pub type Labelidx = u32; #[derive(Debug)] pub enum ValType { I32(i32), I64(i64), F32(f32), F64(f64), }
use nalgebra::Vector2; use sdl2::event::Event; use sdl2::gfx::primitives::DrawRenderer; use sdl2::keyboard::Keycode; use sdl2::mouse::MouseButton; use sdl2::pixels::Color; use sdl2::rect::Rect; use std::env::args; use std::error::Error; use std::time::Duration; use std::time::SystemTime; use tokio::net::{TcpStream, Udp...
use actix_web::{HttpRequest, HttpResponse, FutureResponse, AsyncResponder, HttpMessage, http}; use futures::Future; use apps::app::AppState; use database::{db, models}; #[derive(Deserialize, Serialize, Debug)] pub struct NewUser { email: String, } pub fn user_create_handler(req: &HttpRequest<AppState>) -> Future...
use serde::{Deserialize, Serialize}; use std::sync::{Arc, RwLock}; use bully::{MembershipList, Port}; #[derive(Debug, Serialize, Deserialize)] pub struct Gossip { hostname: String, port: Port, pub membership_list: Arc<RwLock<MembershipList>>, } impl Gossip { pub fn new(hostname: String, port: Port, i...
#[link( name = "rush", vers = "0.1.0", uuid = "636e5f0c-2815-11e3-989c-6bd39c248c79" )]; #[desc = "A shell written in Rust"]; #[license = "GPLv3"]; #[feature(globs)]; extern mod extra; use std::os; mod rush; fn main() { let args: ~[~str] = os::args(); ::rush::start(args); }
// Copyright (c) 2019 Aigbe Research // ts_36211.rs // TS 36.211: Physical channels and modulation // // Physical layer processing: // scrambling // modulation // layer mapping // precoding // mapping to resource elements // OFDM signal generation // // Input to the physical layer: codewords ...
fn main(){ //创建空字符串 let str:String = String::new(); //从abc字面量字符串创建String类型 let str1:String = String::From("abc"); //从abc字面量字符串创建String类型,与上一句作用相同 let str2:String = "abc".to_string(); //以上字符串不可修改,均为只读,未加mut修饰符 }
use game_lib::{ bevy::{ ecs::{self as bevy_ecs, component::Component, schedule::ShouldRun, system::BoxedSystem}, prelude::*, }, derive_more::{Display, Error}, }; use std::fmt::Debug; #[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)] enum ModeState { Started, Changed, Unchanged,...
#![windows_subsystem = "windows"] use chrono::{Datelike, NaiveDate, NaiveTime, Weekday}; use notify_rust::Notification; use serde::Deserialize; #[derive(Debug)] enum WeekType { A, B, C, } #[derive(Debug)] struct Bell { bell: String, time: NaiveTime, } #[derive(Debug)] struct Bells { status: ...
use super::Result; ///! Helpers functions to output `cargo:` lines suitable for build.rs output. use std::env; use std::path::Path; /// Find out if we are cross-compiling. pub fn is_cross_compiling() -> Result<bool> { Ok(env::var("TARGET")? != env::var("HOST")?) } /// Adds a `cargo:rustc-link-lib=` line. pub fn ...
use proconio::{input, marker::Usize1}; fn dfs(i: usize, p: usize, g: &Vec<Vec<usize>>, size: &mut Vec<usize>) { size[i] = 1; for &j in &g[i] { if j == p { continue; } dfs(j, i, g, size); size[i] += size[j]; } } fn solve(i: usize, p: usize, g: &Vec<Vec<usize>>, s...
use anyhow::Result; use std::sync::Arc; #[derive(Debug)] pub struct RenderTexture { pub texture: Arc<wgpu::Texture>, pub size: wgpu::Extent3d, pub view: wgpu::TextureView, } impl RenderTexture { pub fn new(width: u32, height: u32, device: &wgpu::Device) -> Result<Self> { let size = wgpu::Exten...
/* * RustCat - A port of NetCat to Rust. * Written by Noah Snelson, in the year of Our Lord 2019. */ #[macro_use] extern crate clap; use std::fs::{File, remove_file}; mod connect; mod listen; use rustcat::lib::CliArgs; fn main() { let matches = clap_app!(rustcat => (version: "0.1.0") (autho...
use egg::*; define_language! { enum Prop { Bool(bool), "pr" = Pr([Id; 2]), "vec" = PVec([Id; 4]), "&" = And(Id), "~" = Not(Id), "pi1" = Pi1(Id), "pi2" = Pi2(Id), // "|" = Or([Id; 2]), // "->" = Implies([Id; 2]), "x" = X, } } type ...
/* * 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...
//! Loading executable binaries into Falcon. //! //! ``` //! # use falcon::Error; //! use falcon::loader::Elf; //! use falcon::loader::Loader; //! use std::path::Path; //! //! # fn example () -> Result<(), Error> { //! // Load an elf for analysis //! let elf = Elf::from_file(Path::new("test_binaries/simple-0/simple-0")...
use crate::generate::ToneKind; #[derive(Debug, PartialEq, Clone)] pub struct Note { frequency: f32, tone: ToneKind, volume_from: f32, volume_to: f32, offset: f32, start_at: f32, end_at: f32, } impl Note { pub fn is_over(&self, position: f32) -> bool { self.end_at <= position ...
use error::{Error, ErrorKind, Result, StateProblem}; use handshakestate::HandshakeState; #[cfg(feature = "nightly")] use std::convert::{TryFrom, TryInto}; #[cfg(not(feature = "nightly"))] use utils::{TryFrom, TryInto}; use transportstate::*; /// A state machine for the entire Noise session. /// /// Enums provide a con...
use std::cmp::{PartialEq, PartialOrd}; use std::ops::{Range, RangeFrom, RangeFull, RangeTo}; use std::str; /// Set relationship. pub trait Set<T> { /// Whether a set contains an element or not. fn contains(&self, elem: &T) -> bool; /// Convert to text for display. fn to_str(&self) -> &str { "<set>" } } impl<T...
use challenges::chal43::{dsa_leaky_k_attack, hash_msg_to_hexstr, DsaPublicParam, DsaSignature}; use challenges::{mod_inv, mod_sub}; use num::BigUint; use serde::Deserialize; use std::collections::HashMap; use std::fs; use std::process; fn main() { println!("🔓 Challenge 44"); let msgs = read_data(); let p...
use level::place_mob; use level::tile::{Terrain, TileView}; use prelude::*; use rand::{thread_rng, Rng}; use world::mob::PLAYER_ID; pub fn rest(_mob_id: MobId, _world: &mut World) -> Result<(), ()> { Ok(()) } pub fn walk(mob_id: MobId, direction: Direction, world: &mut World) -> Result<(), ()> { let target_po...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2 use jsonrpc_core::Result; use jsonrpc_derive::rpc; pub use self::gen_client::Client as DebugClient; #[rpc] pub trait DebugApi { #[rpc(name = "debug.set_log_level")] fn set_log_level(&self, level: String) -> Result<()>; ...
/*! */ use std::time::Duration; const REMOTE_MAC: [u8; 6] = *b"RSK\x12\x34\x56"; const LOCAL_MAC: [u8; 6] = *b"RSK\xFE\xFE\xFE"; pub mod tcp; pub mod ipv4; pub mod ethernet; pub struct TestFramework { socket: std::net::UdpSocket, remote_addr: std::net::SocketAddr, process: std::process::Child, logfi...
// 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 crate::stdio_server::handler::{initialize_provider, CachedPreviewImpl, PreviewTarget}; use crate::stdio_server::provider::{BaseArgs, ClapProvider, Context, ProviderSource}; use crate::stdio_server::vim::VimProgressor; use anyhow::Result; use filter::{FilterContext, ParallelSource}; use parking_lot::Mutex; use print...
// File: Rust built-in function checker // Purpose: Take the input function name to match with built-in // function of Rust that is recorded and return the cooresponding // return type. // Author : Ziling Zhou (802414) #[derive(Debug,Clone)] pub enum Ty{ Ref, NonPrimitive, ...
use std::error::Error; use std::fmt; use std::io::Error as IOError; use std::string::FromUtf8Error; use serde_json::error::Error as SerdeError; #[cfg(not(feature = "no_dir_source"))] use walkdir::Error as WalkdirError; use crate::template::Parameter; /// Error when rendering data on template. #[derive(Debug)] pub st...
pub mod airtime_tracker; pub mod broadcaster; pub mod chunk_stream; pub mod clock_synchronizer; pub mod command_util; pub mod config; pub mod datetime_ext; pub mod eit_feeder; pub mod epg; pub mod error; pub mod filter; pub mod job; pub mod models; pub mod mpeg_ts_stream; pub mod service_scanner; pub mod string_table; ...
// 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 core::convert::TryFrom; use failure::{err_msg, Error}; use fidl_fuchsia_ui_text as txt; /// A version of txt::TextFieldState that does not have mandat...
use rand::Rng; use std::borrow::BorrowMut; fn Initialize() -> u8 { let mut rng = rand::thread_rng(); let num = rng.gen_range(32, 125); num as u8 } pub fn scamble_w_char_key<'a>(mut wcToScramble: &mut String, mut key : &mut String) -> (String, String) { // let wc_key = Initialize(); let hexes = wc...
use super::*; use std::sync::Arc; use proptest::strategy::{BoxedStrategy, Just, Strategy}; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use crate::erlang::charlist_to_string::charlist_to_string; // `with_20_digits_is_the_same_as_float_to_list_1` in integration tests // `r...
//! Tests auto-converted from "sass-spec/spec/parser/interpolate/26_escaped_literal_quotes" #[allow(unused)] use super::rsass; #[allow(unused)] use rsass::precision; /// From "sass-spec/spec/parser/interpolate/26_escaped_literal_quotes/01_inline" #[test] fn t01_inline() { assert_eq!( rsass( ".r...
extern crate fiemap; use std::io::Error; use std::env::args; fn main() -> Result<(), Error> { for f in args().skip(1) { println!("{}:", f); for fe in fiemap::fiemap(f)? { println!(" {:?}", fe?); } } Ok(()) }
// // Author: Shareef Abdoul-Raheem // File: sr.rs // pub mod lexer; pub mod ast; pub mod ast_processor; pub mod c_api;
mod validate_position; mod validate_move; mod pawn_moves; mod king_moves; mod wrappers; mod root; pub use self::root::Position;
use thiserror::Error; use super::time::{Milliseconds, Monotonic}; #[derive(Debug, Error)] #[error("invalid timeout value, must be `infinity` or a non-negative integer value")] pub struct InvalidTimeoutError; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Timeout { Immediate, Duration(Milliseconds), ...
use cw::{CVec, Range}; use dict::{Dict, PatternIter}; /// An iterator over all possibilities to fill one of the given ranges with a word from a set of /// dictionaries. pub struct WordRangeIter<'a> { ranges: Vec<(Range, CVec)>, dicts: &'a Vec<Dict>, range_i: usize, dict_i: usize, pi: Option<Pattern...
extern crate libc; use libc::{c_void, c_int, c_char, c_float, c_ushort};//, c_ulong, c_long, c_uint, c_uchar, size_t}; pub type RustCb = extern fn(data : *mut c_void); #[repr(C)] pub struct wl_display; #[repr(C)] pub struct wl_client; #[repr(C)] pub struct wl_event_loop; #[repr(C)] pub struct wl_signal; #[repr(C)] ...
use std::{collections::hash_map::HashMap, str::from_utf8}; use strum_macros::FromRepr; use crate::VEError; // Data types type Watt = i32; type Percent = f32; type Volt = f32; type Ampere = f32; type Minute = i32; type KiloWattHours = i32; // Type conversion errors impl From<std::num::ParseIntError> for VEError { ...
use std::error::Error as StdError; use futures::{Future, IntoFuture}; use body::Payload; use super::{MakeService, Service}; /// An asynchronous constructor of `Service`s. pub trait NewService { /// The `Payload` body of the `http::Request`. type ReqBody: Payload; /// The `Payload` body of the `http::Res...
// 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 ...
//! Types and traits for implementing query plans. use std::collections::HashSet; use std::ops::Deref; use std::sync::atomic::{self, AtomicUsize}; use timely::dataflow::scopes::child::Iterative; use timely::dataflow::Scope; use timely::progress::Timestamp; use differential_dataflow::lattice::Lattice; use crate::bin...
use crate::reader::get_lines; use std::collections::{HashMap, HashSet}; use std::fs::File; use std::io::{BufReader, Lines}; pub fn part_1(filename: &str) -> usize { get_paths(filename, false) } pub fn part_2(filename: &str) -> usize { get_paths(filename, true) } fn get_paths(filename: &str, allow_revisits :...
extern crate wasm_bindgen; mod common; mod strategy; use crate::common::{Board, Coordinate, Player}; use crate::strategy::random::RandomStrategy; use crate::strategy::minmax::MinMaxStrategy; use crate::strategy::naive::NaiveStrategy; use crate::strategy::Strategy; use wasm_bindgen::prelude::*; #[wasm_bindgen] extern ...
use opengl_graphics::{GlGraphics, OpenGL}; use graphics::{Context, Graphics}; use std::collections::HashMap; use piston::window::{Window, WindowSettings}; use piston::input::*; use piston::event_loop::*; #[cfg(feature = "include_sdl2")] use sdl2_window::Sdl2Window as AppWindow; #[cfg(feature = "include_glfw")] use gl...
use std::collections::HashSet; use nalgebra::Vector3; use crate::{ prelude::*, material::*, }; /// Gives the color to an existing material. #[derive(Clone, Debug)] pub struct Colored<M: Material> { pub material: M, pub color: Vector3<f64>, } impl<M: Material> Colored<M> { pub fn new(material: M, c...
test_stdout!( without_normal_exit_in_child_process_exits_linked_parent_process, "{child, exited, abnormal}\n" ); test_stdout!( with_normal_exit_in_child_process_exits_linked_parent_process, "{child, exited, normal}\n" );
use diesel::deserialize::{self, FromSql}; use diesel::pg::Pg; use diesel::serialize::{self, IsNull, Output, ToSql}; use diesel::sql_types::Text; use schema::{profiles, sessions, users}; use std::io::Write; use validator::Validate; #[derive(Clone, Queryable)] pub struct Session { pub id: i32, pub uid: i32, ...