text
stringlengths
8
4.13M
use std::fs::File; use std::io::Read; fn main() { let mut file = File::open("d06-input").expect("file not found"); let mut input = String::new(); file.read_to_string(&mut input).expect("something went wrong reading file"); let mut sum = 0; let data: Vec<String> = input.split("\n\n").map(|s| s.to_string()).colle...
/// An implementation of deterministic SecureBroadcast. use std::collections::{HashMap, HashSet}; use crate::actor::{Actor, Sig}; use crate::traits::SecureBroadcastAlgorithm; use crdts::{CmRDT, CvRDT, Dot, VClock}; use ed25519_dalek::Keypair; use rand::rngs::OsRng; use serde::Serialize; use sha2::Sha512; #[derive(De...
use std::num::Wrapping; use std::u16; pub use euclid::{point2, size2}; pub type Point = euclid::default::Point2D<i32>; pub type Size = euclid::default::Size2D<i32>; pub type Rectangle = euclid::default::Box2D<i32>; /// ID referring to an allocated rectangle. #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq, Eq, Has...
extern crate tpp; fn main() { let args: Vec<String> = std::env::args().collect(); if args.len() < 2 { println!("Usage:\n\ttpp file"); return; } let r = tpp::parse_file(&args[1]); if let Ok(v) = r { tpp::start(v); return; } }
use ::*; pub const EMSCRIPTEN_EVENT_TOUCHSTART: EM_EVENT_TYPE = 22; pub const EMSCRIPTEN_EVENT_TOUCHEND: EM_EVENT_TYPE = 23; pub const EMSCRIPTEN_EVENT_TOUCHMOVE: EM_EVENT_TYPE = 24; pub const EMSCRIPTEN_EVENT_TOUCHCANCEL: EM_EVENT_TYPE = 25; #[repr(C)] #[derive(Debug)] pub struct EmscriptenTouchPoint { pub ident...
use super::flags::CARRY; use super::flags::HALF_CARRY; use super::flags::ZERO; use crate::cpu::CPU; use crate::mmu::MMU; pub fn execute_cb(cpu: &mut CPU, mmu: &mut MMU) -> u8 { let op_code = cpu.fetch_byte(mmu); match op_code { 0x00 => rlc(&mut cpu.regs.b, &mut cpu.regs.f), 0x01 => rl...
use std::fs::File; use std::io::{self, BufRead}; fn load_dictionary(filename: &str) -> std::io::Result<Vec<String>> { let file = File::open(filename)?; let mut dict = Vec::new(); for line in io::BufReader::new(file).lines() { dict.push(line?); } Ok(dict) } fn jaro_winkler_distance(string...
use bevy::{prelude::*,}; use bevy::asset::{AssetLoader, LoadContext, LoadedAsset}; use bevy::reflect::{TypeUuid}; use bevy::utils::{BoxedFuture}; use serde::Deserialize; use crate::{level_collision, cutscene, enemy}; // this is for hot reloading #[derive(Default)] pub struct LevelsAssetLoader; impl AssetLoader for L...
use alloc::string::String; use alloc::vec::Vec; use crate::Client; use chain::names::{AccountName, PermissionName}; use chain::permission_level::PermissionLevel; use rpc_codegen::Fetch; use serde::{Deserialize, Serialize}; #[derive(Fetch, Debug, Clone, Serialize)] #[api(path="v1/chain/get_account", http_method="POST"...
use sys::PAGE_SIZE; use core::ops::Range; use alloc::alloc::Layout; use crate::uses::*; // must be power of 2 for correct results pub const fn align_up(addr: usize, align: usize) -> usize { (addr + align - 1) & !(align - 1) } // must be power of 2 for correct results pub const fn align_down(addr: usize, align: usi...
#![deny(missing_docs, warnings, clippy::all, clippy::pedantic)] //! Scalable concurrent containers. //! //! # [`EBR`](ebr) //! //! The [`ebr`] module implements epoch-based reclamation for [`LinkedList`], [`HashMap`], //! [`HashIndex`], and [`TreeIndex`]. //! //! # [`LinkedList`] //! [`LinkedList`] is a type trait tha...
#[doc = "Reader of register CM4_CLOCK_CTL"] pub type R = crate::R<u32, super::CM4_CLOCK_CTL>; #[doc = "Writer for register CM4_CLOCK_CTL"] pub type W = crate::W<u32, super::CM4_CLOCK_CTL>; #[doc = "Register CM4_CLOCK_CTL `reset()`'s with value 0"] impl crate::ResetValue for super::CM4_CLOCK_CTL { type Type = u32; ...
/* irremocon <https://github.com/ak1211/irremocon> Copyright 2019 Akihiro Yamamoto 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 requ...
use proconio::{fastout, input}; #[fastout] fn main() { input! { mut n: i64, }; n -= 1; let mut ans: Vec<u8> = Vec::new(); loop { let remainder = n % 26; ans.push(b'a' + remainder as u8); if n < 26 { break; } n = n / 26 - 1; } print...
use crate::main::{same_necklace, rotate_n}; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use std::fs::File; use std::io::{BufRead, BufReader}; use std::collections::HashSet; mod main { pub fn rotate_n(s: &str, n: usize) -> String { let length = s.len(); let new_start: &s...
//! Data structures for tracking cell/value possibilities. use std::fmt; use std::io::Result as IOResult; use std::iter; use std::ops; use std::slice; /// Input/output for grids pub mod io { pub use super::super::io::*; } /// Cell value index. /// /// Represents a possible value of a cell, typically 1-9. #[deriv...
pub struct Triangle { side_1: u64, side_2: u64, side_3: u64 } impl Triangle { pub fn build(sides: [u64; 3]) -> Option<Triangle> { pub fn are_sides_valid(sides: [u64; 3]) -> bool { // all sides > 0 let positive_sides: bool = sides[0] > 0 && sides[1] > 0 && sides[2] > 0; ...
use tokio::process::Command; use anyhow::{Result, Context, Error}; use async_trait::async_trait; use crate::{helpers::{self, ExitStatusIntoUnit}, services::model::{Nameable, Ensurable, Removable}}; static NAME: &str = "k3d cluster"; #[derive(Default)] pub struct K3dService { k3d_cluster_name: String, ...
#[derive(Clone, Copy, PartialEq, Debug)] pub struct GlError(pub GLenum); #[derive(Debug)] pub enum InitError { GlError(GlError), CompileFailed(&'static str, String), LinkFailed(String), ComputeError(compute_shader::error::Error), InvalidSetting, } #[derive(Debug)] pub enum RasterError { GlErro...
use gotham::middleware::{Middleware, NewMiddleware}; use gotham::state::State; use gotham::handler::HandlerFuture; use std::io; use std::env; use state::AppConfig; use futures::{future, Future}; pub struct New {} impl NewMiddleware for New { type Instance = Ware; fn new_middleware(&self) -> io::Result<Self::Insta...
// Copyright 2012-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-MI...
$NetBSD: patch-.._vendor_serial-unix-0.4.0_src_error.rs,v 1.1 2023/08/30 08:30:17 pin Exp $ Add bsiegert@ unmerged pull request https://github.com/dcuddeback/serial-rs/pull/63 --- ../vendor/serial-unix-0.4.0/src/error.rs.orig 2017-07-02 01:20:06.000000000 +0000 +++ ../vendor/serial-unix-0.4.0/src/error.rs @@ -64,7 +6...
use crate::{backend::SchemaBuilder, prepare::*, types::*, SchemaStatementBuilder}; /// Drop a table /// /// # Examples /// /// ``` /// use sea_query::{*, tests_cfg::*}; /// /// let table = Table::drop() /// .table(Glyph::Table) /// .table(Char::Table) /// .to_owned(); /// /// assert_eq!( /// table.to_s...
use anyhow::Context; use pathfinder_lib::{ core::{Chain, StarknetBlockHash, StarknetBlockNumber}, sequencer::reply::{Block, Status}, state::block_hash::{verify_block_hash, VerifyResult}, storage::{ JournalMode, StarknetBlocksBlockId, StarknetBlocksTable, StarknetTransactionsTable, Storage, }...
/// /// Helper trait to convert C string into Rust one. /// /// Example: /// /// ```rust /// use qas::prelude::*; /// /// qas!("tests/c/string.c"); /// /// fn main() { /// assert_eq!(unsafe { hi().to_rust() }, "Hi there") /// } /// ``` /// pub unsafe trait CStringToRust { /// /// Unsafe because caller has t...
#[doc = "Register `STAR` reader"] pub type R = crate::R<STAR_SPEC>; #[doc = "Field `CCRCFAIL` reader - Command response received (CRC check failed) Interrupt flag is cleared by writing corresponding interrupt clear bit in SDMMC_ICR."] pub type CCRCFAIL_R = crate::BitReader; #[doc = "Field `DCRCFAIL` reader - Data block...
#![allow(dead_code)] // Fully Qualified Syntax 提供一种无歧义的函数调用语法,允许程序员精确地 // 指定想调用的是那个函数。以前也叫 UFCS(universal function call syntax), // 也就是所谓的"通用函数调用语法"。 // 这个语法可以允许使用类似的写法精确调用任何方法,包括成员方法和静态方法 // 其他一切函数调用语法都是它的某种简略形式 // 它的具体写法为 <T as TraitName>::item trait Cook { fn start(&self); } trait Wash { fn start(&self);...
// This file is part of Substrate. // Copyright (C) 2017-2020 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...
#[cfg(any(target_os = "linux", target_os = "android"))] #[path = "epoll.rs"] mod select; #[cfg(any( target_os = "bitrig", target_os = "dragonfly", target_os = "freebsd", target_os = "ios", target_os = "macos", target_os = "netbsd", target_os = "openbsd" ))] #[path = "kqueue.rs"] mod select;...
mod ring1 { pub mod ring2 { pub fn test() { println!("{:?}", "test"); super::ask(); // 能访问父级的方法, 并用它是 private 的 } } fn ask() { println!("{:?}", "ask"); } } fn main() { crate::ring1::ring2::test(); }
use std::ffi::OsStr; use anyhow::Result; mod block_device; mod ext4fs; mod fh; mod mappe; pub fn mount_and_run(what: &OsStr, whence: &OsStr) -> Result<()> { let filesystem = ext4fs::Ext4FS::new(what.to_os_string())?; let fuse_args: Vec<&OsStr> = vec![&OsStr::new("-o"), &OsStr::new("auto_unmount")]; fuse_...
//! 4 Dimensional Vector use super::common::{Vec4, Mat4, Quat, random_f32, hypot, EPSILON}; /// Creates a new, empty vec3. /// /// [glMatrix Documentation](http://glmatrix.net/docs/vec4.js.html) pub fn create() -> Vec4 { let out: Vec4 = [0_f32; 4]; out } /// Creates a new vec4 initialized with values from...
use crate::{Alphabet, LineModification, TextModifier}; use std::fmt::Debug; impl LineModification { // Changed(usize, String, String), //Insert(usize, String), pub fn get_line_number(&self) -> usize { match self { Self::Insert(line_number, _) => *line_number, Self::Changed(l...
use std::vec::Vec; pub fn is_prime(n: i32) -> bool { if n == 1 { false } else { let lim = (n as f64).sqrt().floor() as i32 + 1; for i in 2..lim { if n % i == 0 { return false; } } true } } pub fn sieve(n: usize) -> Vec<bool> {...
use num_integer::Integer; #[allow(dead_code)] fn read_line() -> String { let mut line = String::new(); std::io::stdin().read_line(&mut line).unwrap(); line.trim_end().to_owned() } const N_I: i64 = 10_000; const N_F: f64 = 10_000.0; fn main() { let stdin = read_line(); let mut iter = stdin.split_w...
use no_panic::no_panic; #[no_panic] async fn f() { g().await; } async fn g() {} fn main() {}
use std::io::{Read, BufReader, Write}; use std::net::{self, TcpStream}; use std::str::from_utf8; use std::cell::RefCell; use std::collections::HashSet; use url; use types::{RedisResult, Value, ToRedisArgs, FromRedisValue, from_redis_value, ErrorKind}; use parser::Parser; use cmd::{cmd, pipe, Pipeline}; #[cfg(unix)] ...
pub mod camera; pub mod game;
use crate::common::run_command; use crate::{Browser, BrowserOptions, Error, ErrorKind, Result, TargetType}; use log::trace; use std::io::{BufRead, BufReader}; use std::os::unix::fs::PermissionsExt; use std::path::{Path, PathBuf, MAIN_SEPARATOR}; use std::process::{Command, Stdio}; macro_rules! try_browser { ( $opt...
#[doc = "Register `RCC_RNG2CKSELR` reader"] pub type R = crate::R<RCC_RNG2CKSELR_SPEC>; #[doc = "Register `RCC_RNG2CKSELR` writer"] pub type W = crate::W<RCC_RNG2CKSELR_SPEC>; #[doc = "Field `RNG2SRC` reader - RNG2SRC"] pub type RNG2SRC_R = crate::FieldReader; #[doc = "Field `RNG2SRC` writer - RNG2SRC"] pub type RNG2SR...
pub trait SampleType: Copy + Default {} impl SampleType for u8 {} impl SampleType for i16 {} impl SampleType for f32 {}
// Copyright (c) 2017 oic developers // // 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. All files in the project carrying such notice may not be copied, // mo...
#![allow(clippy::too_many_arguments, dead_code)] use ash::version::{DeviceV1_0, InstanceV1_0}; use ash::vk::{ Buffer, BufferCreateInfo, BufferUsageFlags, DescriptorSetLayout, DescriptorSetLayoutBinding, DescriptorSetLayoutCreateInfo, DescriptorType, DeviceMemory, MemoryAllocateInfo, MemoryMapFlags, MemoryPr...
#[doc = "Register `AHBRSTR` reader"] pub type R = crate::R<AHBRSTR_SPEC>; #[doc = "Register `AHBRSTR` writer"] pub type W = crate::W<AHBRSTR_SPEC>; #[doc = "Field `IOPARST` reader - I/O port A reset"] pub type IOPARST_R = crate::BitReader<IOPARST_A>; #[doc = "I/O port A reset\n\nValue on reset: 0"] #[derive(Clone, Copy...
use { crate::schema::{Human, NewHuman}, juniper::FieldResult, std::{ collections::HashMap, sync::{Arc, RwLock}, }, }; #[derive(Debug, Default)] pub struct Database { humans: HashMap<u32, Human>, counter: u32, } /// Arbitrary context data. #[derive(Debug, Default)] pub struct Co...
use libc; pub const AF_UNSPEC: u16 = libc::AF_UNSPEC as u16; pub const AF_UNIX: u16 = libc::AF_UNIX as u16; // pub const AF_LOCAL: u16 = libc::AF_LOCAL as u16; pub const AF_INET: u16 = libc::AF_INET as u16; pub const AF_AX25: u16 = libc::AF_AX25 as u16; pub const AF_IPX: u16 = libc::AF_IPX as u16; pub const AF_APPLETA...
use rustimate_core::member::Member; use std::collections::HashMap; use uuid::Uuid; pub(crate) struct ResultSummary { valid_votes: Vec<(Uuid, String, Option<f64>)>, invalid_votes: Vec<(Uuid, Option<String>)>, mean: f64, median: f64, mode: f64 } impl ResultSummary { pub(crate) fn new(members: &[&Member], vo...
#[derive(Clone, Copy, PartialEq, Debug)] pub struct Coord { pub x: i16, pub y: i16, } impl Coord { pub fn is_outside(&self, top_left: Coord, bottom_right: Coord) -> bool { self.x < top_left.x || self.x > bottom_right.x || self.y < top_left.y || self.y > bottom_ri...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use actix::prelude::*; use anyhow::Result; #[derive(Debug, Clone)] pub enum NodeCommand { StartMiner(), StopMiner(), } impl Message for NodeCommand { type Result = Result<()>; }
extern crate nom; use nom::{IResult, le_u64, le_u32, le_u16, le_u8, rest}; use std::cmp::Ordering; // // PFS file header // #[derive(Debug, PartialEq, Eq)] pub struct PfsHeader { pub header_version : u32, pub data_size : u32, } pub fn pfs_header(input : &[u8]) -> IResult<&[u8], PfsHeader> { do_parse!( in...
//! Pagination support for Iron requests. //! //! Contains a trait, `Paginate`, that is implemented for `Iterator`, that can be used to subset an //! iterator based on Iron request parameters. use Result; use iron::{Plugin, Request}; use params::{Params, Value}; use std::iter::{Skip, Take}; /// The default page, if o...
use crate::data_buffer::DataBuffer; use tui::buffer::Buffer; use tui::layout::Rect; use tui::style::Color; use tui::widgets::Widget; pub struct WaveWidget<'a> { waveform: &'a DataBuffer, } impl<'a> WaveWidget<'a> { pub fn new(waveform: &'a DataBuffer) -> Self { Self { waveform } } } impl<'a> Widg...
use anyhow::Error; use serde_derive::{Deserialize, Serialize}; // use wasm_bindgen::JsValue; use yew::format::Json; // use yew::services::fetch::{FetchService, FetchTask, Request, Response}; use yew::services::websocket::{WebSocketService, WebSocketStatus, WebSocketTask}; use yew::{html, Component, ComponentLink, Html,...
// @TODO remove use crate::app::MessageMapper; use std::fmt; type _HookFn = Box<dyn FnMut(&web_sys::Node)>; // todo pub(crate) fn fmt_hook_fn<T>(h: &Option<T>) -> &'static str { match h { Some(_) => "Some(.. a dynamic handler ..)", None => "None", } } pub struct LifecycleHooks<Ms> { pub ...
use ::MessageHandler; use std::sync::mpsc::{Sender, Receiver,TryIter}; use errors::*; use mio::{Evented, Poll, Token, Ready, PollOpt, Registration,SetReadiness}; use std::io::Result as IOResult; pub fn write_pipeline(sender: Sender<MsgBuf>, receiver: Receiver<MsgBuf>) -> (MessageSource, MessageSink) { let (registr...
mod connect; mod disconnect; mod level_room; mod push_message; pub use connect::Connect; pub use disconnect::Disconnect; pub use push_message::MessagePayload; pub use push_message::MessagePayloadHeader; mod chat_server; pub use chat_server::ChatServer;
use rppal::gpio::*; use std::time::*; use std::thread::sleep; fn discharge(gnd: &mut IoPin, pin: &mut IoPin) { // pull to ground gnd.set_mode(Mode::Output); gnd.set_low(); pin.set_mode(Mode::Output); pin.set_low(); // approx discharge time <1ms (220nF) sleep(Duration::from_millis(10)); ...
pub use self::dao_user::*; mod dao_user;
use regex::Regex; #[derive(Debug, PartialEq)] pub struct Rule { field_name: String, fst_valid_first_idx: usize, fst_valid_last_idx: usize, snd_valid_first_idx: usize, snd_valid_last_idx: usize, } #[derive(Debug, PartialEq)] pub struct Ticket { fields: Vec<usize>, } #[aoc_generator(day16)] pub...
use std::error::Error; #[allow(unused_imports, dead_code)] mod minitrace_generated; use minitrace_generated::*; pub fn serialize_to_fbs<'a>( builder: &'a mut flatbuffers::FlatBufferBuilder, minitrace::TraceDetails { start_time_ns, elapsed_ns, cycles_per_second, spans, p...
use crate::{ command::{LapceUICommand, LAPCE_UI_COMMAND}, editor::Editor, editor::EditorState, editor::{EditorLocation, EditorView}, scroll::LapceScroll, state::LapceTabState, state::LapceUIState, state::LAPCE_APP_STATE, }; use std::{cmp::Ordering, sync::Arc}; use druid::{ kurbo::{L...
use std::fs::File; use std::io::Read; use regex::Regex; use std::collections::HashSet; fn get_directions(input: &str) -> Vec<(char, i32)> { let re = Regex::new(r"([RL])(\d+)").unwrap(); re.captures_iter(input).map(|cap| { (cap.get(1).unwrap().as_str().chars().nth(0).unwrap(), cap.get(2).unw...
// This file is part of Substrate. // Copyright (C) 2020 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 // // http://...
/// PullRequest represents a pull request #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct PullRequest { pub assignee: Option<crate::user::User>, pub assignees: Option<Vec<crate::user::User>>, pub base: Option<crate::pr_branch_info::PrBranchInfo>, pub body: Option<String>, pub cl...
#[doc = "Register `FLTR` reader"] pub type R = crate::R<FLTR_SPEC>; #[doc = "Register `FLTR` writer"] pub type W = crate::W<FLTR_SPEC>; #[doc = "Field `DNF` reader - Digital noise filter"] pub type DNF_R = crate::FieldReader<DNF_A>; #[doc = "Digital noise filter\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, Parti...
use helpers::Class; use super::{Artifact, Build, BuildStatus, ShortBuild}; use action::CommonAction; use changeset; use user::ShortUser; build_with_common_fields_and_impl!(/// A `Build` from a MatrixProject #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] pub struct MatrixBuild { /// Change set fo...
pub mod english; pub mod break_xor_cipher; pub mod frequency_analysis; #[cfg(test)] mod tests;
use std::num::Wrapping; pub fn test(a1: i32, a2: i32) -> i32 { (Wrapping(a1) + Wrapping(a2)).0 } pub struct Foo { Field: i32 } impl Foo { pub fn new(field: i32) -> Foo { Foo{ Field: field } } } pub struct Bar { } impl Bar { pub fn new() -> Bar { Bar{} } } pub trait ...
static mut FIRST_FREE_PAGE: usize = 0x800000; pub fn alloc_page(num: usize) -> usize { unsafe { let result = FIRST_FREE_PAGE; FIRST_FREE_PAGE += num * 4096; ::mem::memset(result + 0xFFFFFFFF_80000000, 0, num * 4096); result } }
use std::ops::Mul; trait HasArea<T> { fn area(&self)->T; } struct Square<T> { x: T, y: T, side: T, } impl<T> HasArea<T> for Square<T> where T: Mul<Output=T> + Copy { fn area(&self) -> T { self.y * self.x } } fn main() { let s = Square { x: 3.0f64, ...
use trillium::http_types::{auth::BasicAuth as AuthHeader, StatusCode}; use trillium::{async_trait, Conn, Handler}; pub struct BasicAuth { username: String, password: String, realm: Option<String>, } impl BasicAuth { pub fn new(username: impl Into<String>, password: impl Into<String>) -> Self { ...
use serde::Deserialize; use crate::{bson::Document, options::ClientOptions, test::run_spec_test}; #[derive(Debug, Deserialize)] struct TestFile { pub tests: Vec<TestCase>, } #[derive(Debug, Deserialize)] #[serde(rename_all = "camelCase")] struct TestCase { pub description: String, pub uri: String, pu...
pub enum JumpConditionError { InvalidLookupInput, } type JumpConditionValue = &'static str; type JumpConditionLookupResult = Result<JumpConditionValue, JumpConditionError>; pub const NZ: JumpConditionValue = "NZ"; pub const Z: JumpConditionValue = "Z"; pub const NC: JumpConditionValue = "NC"; pub const C: JumpCond...
use ash::version::DeviceV1_0; use ash::{vk, Device}; use rustc_hash::FxHashMap; use std::ffi::CString; use anyhow::Result; use crate::vulkan::render_pass::Framebuffers; use crate::vulkan::texture::{Gradients, Texture}; use crate::vulkan::GfaestusVk; use super::create_shader_module; pub struct GuiPipeline { des...
// vim: shiftwidth=2 use std::convert::TryInto; pub struct StructDeserializer<'a> { src: &'a Vec<u8>, ptr: usize } impl<'a> StructDeserializer<'a> { pub fn new(src: &'a Vec<u8>) -> StructDeserializer<'a> { StructDeserializer { src: src, ptr: 0 } } pub fn read_u16(self: &mut StructDe...
use std::u64; use amethyst::{ core::transform::components::Transform, ecs::prelude::{Component, VecStorage}, }; use crate::resources::{ ingame::game_world::{ChunkIndex, Planet, GameWorldError, TileIndex}, RenderConfig, }; /// This component stores the current chunk and tile the player resides on. #[d...
use crate::ray::Ray; use crate::vec3::Vec3; use crate::material::Material; use std::rc::Rc; pub struct HitRecord { pub p: Vec3, pub n: Vec3, pub material_ref: Rc<dyn Material>, pub t: f32, pub front_face: bool } impl HitRecord { pub fn new_zero(mat: Rc<dyn Material>) -> HitRecord { Hit...
pub trait Commit { type Log; #[must_use] fn commit(self) -> Self::Log; }
#[cfg(feature = "serde")] use serde::{Deserialize, Serialize}; use crate::shared::PackageWithVersion; #[derive(Debug, Clone, PartialEq, Eq)] #[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] pub struct PathItem { pub real: String, pub move_to: String, } #[derive(Debug, Clone, PartialEq, Eq, Copy...
use bigint::{Address, U256}; pub struct Block { pub beneficiary: Address, pub difficulty: U256, pub gas_limit: U256, pub number: U256, pub timestamp: U256, }
#[cfg(feature = "default")] #[test] fn test_error() { use relox::{Error, ErrorKind}; let error = Error::new(ErrorKind::InvalidData); assert_eq!(error.kind(), ErrorKind::InvalidData); assert_ne!(ErrorKind::NotEnoughData, ErrorKind::InvalidData); } #[cfg(feature = "default")] #[test] fn test_elf32rel() ...
#![deny(missing_docs)] //! # Legion Type Uuid //! //! legion-typeuuid provides the `SerializableTypeUuid` type key, which can be used with legion's `Registry` to provide stable component type ID mappings for world serialization. //! //! ```rust //! # use legion::*; //! # use legion_typeuuid::*; //! # #[derive(serde::S...
use crate::read_pattern::ReadPattern; #[derive(Copy, Clone, Debug)] pub struct ManyPattern<T>(pub T, pub u32); impl<T> ReadPattern for ManyPattern<T> where T: ReadPattern { fn read_pattern(&self, text: &str) -> Option<usize> { let mut len = 0; for _ in 0..self.1 { match self.0.re...
use std::os::unix::io::RawFd; use std::mem; use nix; use nix::sys::termios; use nix::sys::termios::{IGNBRK, BRKINT, PARMRK, ISTRIP, INLCR, IGNCR, ICRNL, IXON}; use nix::sys::termios::{OPOST, ECHO, ECHONL, ICANON, ISIG, IEXTEN, CSIZE, PARENB, CS8}; use nix::sys::termios::{VMIN, VTIME}; use nix::sys::termios::SetArg; us...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use super::{models, API_VERSION}; #[non_exhaustive] #[derive(Debug, thiserror :: Error)] #[allow(non_camel_case_types)] pub enum Error { #[error(transparent)] AuthorizationOperations_List(#[from] ...
//! Contains pre and post processing logic. pub mod post; pub mod pre;
use std::io; use std::io::BufRead; use std::io::BufReader; use std::io::Write; use std::net::TcpStream; use clap; use output::Output; use ::client::*; use ::misc::*; fn do_client_status ( output: & Output, arguments: & ClientStatusArguments, ) -> Result <bool, String> { let mut stream = io_result_with_prefix ...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// CheckCanDeleteSloResponse : A service level objective response containing the requested object. #...
use super::super::{ program::MaskProgram, webgl::{WebGlF32Vbo, WebGlI16Ibo, WebGlRenderingContext}, ModelMatrix, }; use super::TableBlock; use crate::{ block::{self, BlockId}, Color, }; use ndarray::Array2; use std::collections::HashMap; pub struct AreaCollectionRenderer { vertexis_buffer: WebG...
// 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. #![deny(warnings)] extern crate byteorder; extern crate failure; #[macro_use] extern crate fdio; extern crate fidl; extern crate fidl_fuchsia_wlan_tap as ...
use crate::common::factories::prelude::*; use std::net::{IpAddr, SocketAddr, SocketAddrV4, SocketAddrV6}; #[derive(Debug, Clone)] pub struct SocketAddrBuilder { pub ip_addr: IpAddr, pub port: u16, } impl SocketAddrBuilder { pub fn localhost_with_port(port: u16) -> Self { Self { ip_addr...
use log::{Level, Log, Metadata, Record}; use std::fs; use std::path::Path; use std::path::PathBuf; use std::{io, io::Write}; use crate::utils::time::{duration_since_epoch, timestamp_format, PROGRAM_START}; pub struct FileLoggerOptions { /// log directory pub directory: &'static str, /// current log name ...
use steel::steel_vm::engine::Engine; // It's possible to add a function that will get fun on every instruction call // For instance, if you wanted to see how far you were getting in the evaluation of a program // (perhaps you wanted to see that, idk) then you could add the closure using the // `on_progress` method // ...
use std::iter::{Fuse, Peekable}; use std::str::Chars; #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub enum Op { Add, Sub, Mul, Div, Eq, Neq, Lt, Gt, Lte, Gte, Not, And, Or, } #[derive(Debug, PartialEq, Eq, Clone)] pub enum Token { If, Then, Else, Tr...
//! Includes standard bundled widgets. pub mod button; pub mod scroll; pub mod list; pub mod slider; pub mod edit_text; pub mod image; pub mod glcanvas; pub mod text; pub mod prelude { pub use super::text::StaticTextStyle; pub use super::button::{ButtonStyle, ToggleButtonStyle, ToggleEvent}; pub use super...
//! Crate for interacting with the Kubernetes API //! //! This crate includes the tools for manipulating Kubernetes resources as //! well as keeping track of those resources as they change over time //! //! # Example //! //! The following example will create a [`Pod`](k8s_openapi::api::core::v1::Pod) //! and then watch...
pub mod ns; pub mod omission; pub mod void; pub mod whitespace;
use async_trait::async_trait; use hyper::{body::Body, client::connect::HttpConnector, Client, Response, StatusCode}; use hyper_tls::HttpsConnector; use native_tls::{Certificate, TlsConnector}; use rhodium::{errors::*, request::*, response::*, stack::*, *}; use std::net::{IpAddr, SocketAddr}; use std::str::FromStr; use ...
#[doc = "Register `PLL3DIVR` reader"] pub type R = crate::R<PLL3DIVR_SPEC>; #[doc = "Register `PLL3DIVR` writer"] pub type W = crate::W<PLL3DIVR_SPEC>; #[doc = "Field `PLL3N` reader - Multiplication factor for PLL3VCO Set and reset by software to control the multiplication factor of the VCO. These bits can be written o...
mod appearance; mod h24; mod solar; pub mod time; pub use appearance::{current_image_index_appearance, get_image_index_order_appearance}; pub use h24::{current_image_index_h24, get_image_index_order_h24, sort_time_items}; pub use solar::{current_image_index_solar, get_image_index_order_solar, sort_solar_items};