text
stringlengths
8
4.13M
//! Integral code supporting both scalars and vectors. use super::*; pub mod scalar; pub mod vector; use std::ops::{Add, Shl, Shr, Rem}; use num_traits::One; use arithimpl::traits::ConvertFrom; use std::marker::PhantomData; /// Integral code for scalars and vectors. pub struct Code<I> { /// Number of componen...
//Estimated number of people pub fn query_num() {} //Crowd portrait fn query_portrait() {} //User ids fn query_uesr_list() {}
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct WiFiAccessStatus(pub i32); impl WiFiAccessStatus { pub const Unspecified: Self = Self(0i32); pub const Allowed: Self = S...
//! User and Group ID types. #![allow(unsafe_code)] use crate::backend::c; /// A group identifier as a raw integer. #[cfg(not(target_os = "wasi"))] pub type RawGid = c::gid_t; /// A user identifier as a raw integer. #[cfg(not(target_os = "wasi"))] pub type RawUid = c::uid_t; /// `uid_t`—A Unix user ID. #[repr(trans...
use super::wizard::Wizard; use super::world::World; #[derive(Clone, Debug, PartialEq)] pub struct PlayerContext { pub wizards: Vec<Wizard>, pub world: World, }
use super::{exp, fabs, get_high_word, with_set_low_word}; /* origin: FreeBSD /usr/src/lib/msun/src/s_erf.c */ /* * ==================================================== * Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved. * * Developed at SunPro, a Sun Microsystems, Inc. business. * Permission to use...
const PATH: &str = "/v1/chain/push_transactions";
use crate::prelude::*; use rstar::*; pub struct HorizontalStrokes { points: Vec<Point2>, boundary_rtree: RTree<My<Point2>>, } pub fn new(app: &App, container: &Rect) -> HorizontalStrokes { let points = load_denormalized_points(app, container); let my_points: Vec<My<Point2>> = points.iter().map(|point|...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[doc(hidden)] pub struct IWalletItemSystemStore(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IWalletItemSystemStore { type Vtable =...
#![allow(clippy::type_complexity)] use crate::{ component::{Collider2d, Collider2dBody, Collider2dInner, RigidBody2d, RigidBody2dInner}, resource::Physics2dWorld, }; use core::{ app::AppLifeCycle, ecs::{ storage::ComponentEvent, Entities, Entity, Join, ReadExpect, ReadStorage, ReaderId, System,...
use std::fs::File; use std::io::{self, BufRead, Read}; pub struct Input<'a> { source: Box<dyn BufRead + 'a>, } impl<'a> Input<'a> { pub fn from_stdin(stdin: &'a io::Stdin) -> Input<'a> { Input { source: Box::new(stdin.lock()), } } pub fn from_file(path: &str) -> io::Result...
use alloc::alloc::{AllocError, Allocator}; use core::any::TypeId; use core::fmt; use core::hash::{Hash, Hasher}; use core::ptr; use seq_macro::seq; use firefly_alloc::gc::GcBox; use crate::function::ErlangResult; use super::{Atom, OpaqueTerm}; /// This struct unifies function captures and closures under a single t...
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0. use std::collections::HashMap; use std::sync::Arc; use std::sync::RwLock; use block_format::Block; use cid::Codec; use crate::error::{FormatError, Result}; use crate::format::Node; lazy_static::lazy_static! { static ref BLOCK_DECODERS: RwLock<Hash...
use aoc2019::aoc_input::get_input; use num_integer::Integer; use std::cmp::min; use std::collections::HashMap; use std::num::ParseIntError; use std::str::FromStr; #[derive(Debug, Clone, PartialEq, Eq)] enum ParseError { BadComponentCount, ParseIntError(ParseIntError), } impl From<ParseIntError> for ParseError...
use spin::rw_lock::RwLock; use crate::executor::EXECUTOR; use crate::prelude::*; use crate::sched::Affinity; /// A per-task scheduling-related info. pub struct SchedInfo { last_thread_id: AtomicU32, affinity: RwLock<Affinity>, } impl SchedInfo { pub fn new() -> Self { static LAST_THREAD_ID: Atomi...
//! Basic formula data types used by the Varisat SAT solver. /// Shortcut for tests #[cfg(any(test, feature = "internal-testing"))] #[doc(hidden)] #[macro_export] macro_rules! lit { ($x:expr) => { $crate::lit::Lit::from_dimacs($x) }; } /// Shortcut for tests #[cfg(any(test, feature = "internal-testing...
#[doc = "Reader of register AHBSMENR"] pub type R = crate::R<u32, super::AHBSMENR>; #[doc = "Writer for register AHBSMENR"] pub type W = crate::W<u32, super::AHBSMENR>; #[doc = "Register AHBSMENR `reset()`'s with value 0x0111_1301"] impl crate::ResetValue for super::AHBSMENR { type Type = u32; #[inline(always)]...
use std::collections::HashMap; use std::fs::File; use std::io::Read; struct Element { name: String, quantity: i64, } impl Element { fn new(name: String, quantity: i64) -> Element { Element { name, quantity } } fn from_string(string: &str) -> Element { let quantity_and_elem: Vec<&s...
//! Data point building and writing use snafu::{ensure, Snafu}; use std::{collections::BTreeMap, io}; /// Errors that occur while building `DataPoint`s #[derive(Debug, Snafu)] pub enum DataPointError { /// Returned when calling `build` on a `DataPointBuilder` that has no /// fields. #[snafu(display( ...
// TODO: synchronize, not synchronize. // // synchronize animation have a loop duration that is multiple of tempo (eg 0.5 tempo or 4 tempo) // then its image is computed from percentage of tempo and number of frame // // not sync have a framerate use std::collections::HashMap; include!(concat!(env!("OUT_DIR"), "/anim...
//! Decision heuristics. use partial_ref::{partial, PartialRef}; use varisat_formula::Var; use crate::{ context::{parts::*, Context}, prop::{enqueue_assignment, Reason}, }; pub mod vsids; /// Make a decision and enqueue it. /// /// Returns `false` if no decision was made because all variables are assigned....
// Copyright 2019 David Roundy <roundyd@physics.oregonstate.edu> // // Licensed under the GPL version 2.0 or later. //! This crate defines a macro for a database. extern crate proc_macro; use syn::spanned::Spanned; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } } enum ...
#[path = "with_empty_list_arguments/with_empty_list_options.rs"] mod with_empty_list_options; #[path = "with_empty_list_arguments/with_link_and_monitor_in_options_list.rs"] mod with_link_and_monitor_in_options_list; #[path = "with_empty_list_arguments/with_link_in_options_list.rs"] mod with_link_in_options_list; #[path...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - DMAMux - DMA request line multiplexer channel x control register"] pub c0cr: C0CR, #[doc = "0x04 - DMAMux - DMA request line multiplexer channel x control register"] pub c1cr: C1CR, #[doc = "0x08 - DMAMux - DMA request ...
#[cfg(feature = "debug-view")] mod debug_view; #[cfg(not(feature = "debug-view"))] mod dummy; #[cfg(feature = "debug-view")] pub use debug_view::*; #[cfg(not(feature = "debug-view"))] pub use dummy::*;
use ::ast; use std::collections::HashMap; use ::scope::{Scope, Variable, Function}; type PResult = Result<(),String>; fn error(txt: &str) -> PResult { Err(txt.to_string()) }
#![allow(dead_code)] use std::{cell::RefCell, collections::HashSet, ops::Range, ptr::NonNull}; use rand; use veclist::VecList; use allocator::{ArenaConfig, DynamicConfig}; use block::Block; use device::Device; use error::{AllocationError, MappingError, MemoryError, OutOfMemoryError}; use heaps::{Config, Heaps, Memor...
#[doc = "Reader of register DOUTR17"] pub type R = crate::R<u32, super::DOUTR17>; #[doc = "Writer for register DOUTR17"] pub type W = crate::W<u32, super::DOUTR17>; #[doc = "Register DOUTR17 `reset()`'s with value 0"] impl crate::ResetValue for super::DOUTR17 { type Type = u32; #[inline(always)] fn reset_va...
use crate::sys; use log::{Level as LogLevel, LevelFilter, Metadata, Record, SetLoggerError}; /// See Level enum defined in https://github.com/CommonWA/cwa-spec/blob/master/ns/log.md#write #[repr(i32)] #[derive(Debug)] /// Logging facade for olin. This will be exposed with the [log](https://docs.rs/log) /// crate, but ...
extern crate rand; use rand::Rng; #[derive(Debug)] enum CoinType { Copper, Silver, Electrum, Gold, Platinum } #[derive(Debug)] enum PotionType { Longevity, Love, Poison, Climbing, Delusion, Diminutiveness, ExtraGrowth, ExtraHealing, FireResist, Flying, ...
extern crate hyrohor; fn main() { hyrohor::serve(); }
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Channel group tasks."] pub tasks_chg0: TASKS_CHG, #[doc = "0x08 - Channel group tasks."] pub tasks_chg2: TASKS_CHG, _reserved0: [u8; 1264usize], #[doc = "0x500 - Channel enable."] pub chen: CHEN, #[doc = "0...
use std::fmt; use libc::c_int; use libc::{EACCES, EIO, ENOENT}; #[derive(Debug)] pub enum Error { NotFound, Forbidden, IOError, } impl Error { pub fn to_error_code(&self) -> c_int { match self { Error::NotFound => ENOENT, Error::Forbidden => EACCES, Error::...
// Copyright 2017 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 data; mod extension; pub use data::Data; pub use extension::ExtensionValue;
fn main() { let mut lines = aoc::file_lines_iter("./day13.txt"); let departure = lines.next().unwrap().parse::<u64>().unwrap(); let busses : Vec<_> = lines.next().unwrap().split(',').map(|s| s.to_string()).collect(); let bus_ids : Vec <u64> = busses.iter().filter(|v| v.as_str() != "x") ...
use std::ops::{Deref, DerefMut}; use serde::{Deserialize, Serialize}; pub use serde_json::value::RawValue as JsonRawValue; pub use serde_json::Value as JsonValue; use crate::database::{Database, HasArguments, HasValueRef}; use crate::decode::Decode; use crate::encode::{Encode, IsNull}; use crate::error::BoxDynError; ...
fn commands(input: &str) -> impl Iterator<Item = (&str, u32)> { input.lines().map(|line| { let (fst, sec) = line.split_once(' ').unwrap(); (fst, sec.parse().unwrap()) }) } fn part1(input: &str) -> u32 { let mut hpos = 0; let mut depth = 0; for (dir, amount) in commands(input) { ...
use {Script, Command, rect}; fn draw(x: u32, y: u32, w: u32, h: u32, fill: char) -> Command { rect(x, y, w, h, fill) } #[test] fn empty_space() { assert_eq!(Script::new(5, 3).run().as_slice(), ".....\n\ .....\n\ .....\n"); } #[test] fn three_by_three_b() { l...
use crate::geom::HitSide; use crate::math::{Unit3, Vec3}; pub fn cos_theta(dir: Unit3) -> f64 { dir[2] } pub fn sin_theta(dir: Unit3) -> f64 { (1. - cos_theta(dir).powi(2)).sqrt() } pub fn same_hemisphere(incoming: Vec3, outgoing: Vec3) -> bool { incoming[2] * outgoing[2] > 0. } #[derive(Debug, Clone, C...
use std::io; use std::fmt; use ocl; #[derive(Debug)] pub enum Error { Io(io::Error), Ocl(ocl::Error), Other(String), } impl fmt::Display for Error { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { Error::Io(e) => write!(f, "Io: {:?}\n{}", e.kind(), e), ...
extern crate actix_web; extern crate serde; use actix_web::{web, App, HttpRequest, HttpServer, Responder}; mod enums; mod packages; mod objects; use crate::objects::token::Token; fn greet(req: HttpRequest) -> impl Responder { let name = req.match_info().get("name").unwrap_or("World"); format!("Hello {}!", &n...
use super::abstract_container::AbstractContainer; use super::component::Component; use std::slice::IterMut; pub struct Container<T: Component> { components: Vec<T>, } impl<T: Component> Container<T> { pub fn new() -> Container<T> { Container { components: Vec::new(), } } p...
use std::any::TypeId; fn string() -> TypeId { TypeId::of::<String>() } fn foo(para_type: TypeId) { if TypeId::of::<String>() == para_type { println!("参数为类型 String"); } } fn main() { foo(string()); }
use super::{ flash::{ConfigWriter, FlashError}, BtnsType, NUM_BTS, }; use core::{ convert::TryFrom, sync::atomic::{compiler_fence, Ordering}, }; use debouncer::typenum::consts::*; use debouncer::{BtnState, PortDebouncer}; use heapless::spsc::Producer; use keylib::{ key_code::{ valid_ranges::...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[doc(hidden)] pub struct IPhoneCallOrigin(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IPhoneCallOrigin { type Vtable = IPhoneCallO...
//! /api/v0/pubsub module. //! //! /api/v0/pubsub/sub?arg=topic allows multiple clients to subscribe to the single topic, with //! semantics of getting the messages received on that topic from request onwards. This is //! implemented with [`tokio::sync::broadcast`] which supports these semantics. //! //! # Panics //! /...
use std::collections::HashSet; use std::error; use std::fs::File; use std::io::{BufRead, BufReader}; use std::path::PathBuf; use structopt::StructOpt; #[derive(StructOpt)] #[structopt( name = "solve", about = "solve the puzzles from the Advent of Code 2020, day 1" )] struct Opt { #[structopt(short, long, d...
extern crate green; // #[actix_web::main] fn main() -> std::io::Result<()> { green::run() }
use crate::query_log::QueryLog; use arrow::{datatypes::SchemaRef, error::Result as ArrowResult, record_batch::RecordBatch}; use async_trait::async_trait; use data_types::NamespaceId; use datafusion::error::DataFusionError; use datafusion::physical_plan::{DisplayAs, DisplayFormatType}; use datafusion::{ catalog::sch...
use accounts; use accounts::types::*; use db::Conn; use rocket_contrib::json::Json; use web::types::ApiResponse; /// Get all users #[get("/users")] pub fn all_users(user: CurrentUser, conn: Conn) -> ApiResponse<Vec<User>> { accounts::all_users(user, conn).map(|r| Json(r)) } /// Get user by id #[get("/users/<user_...
extern crate libc; use std::ptr; use std::fmt::{Show, Formatter, FormatError}; use self::libc::{c_char, c_int}; use git2::error::{GitError, get_last_error}; extern { fn git_oid_fromstrp(oid: *mut GitOid, s: *const c_char) -> c_int; fn git_oid_cmp(a: *const GitOid, b: *const GitOid) -> c_int; fn git_oid_t...
extern crate uuid; extern crate serde; extern crate serde_json; extern crate chrono; extern crate snowflake; mod order_id; mod order_id_generator; mod order_status; pub mod policy; use self::chrono::prelude::{DateTime, Utc}; use direction::Direction; use symbol::SymbolId; use execution::Execution; pub use self::orde...
use crate::{ graphics::{HitRecord, Ray}, math::Color, }; use super::Material; use rand::Rng; pub struct Dielectric { ir: f64, } impl Dielectric { pub fn new(ir: f64) -> Dielectric { Dielectric { ir } } } impl Dielectric { fn reflectance(cosine: f64, ref_idx: f64) -> f64 { le...
use clap::{App, Arg}; use regex::{Regex, RegexBuilder}; use std::{thread, time}; use std::process::exit; use sysinfo::{ProcessExt, System, SystemExt, Signal, Process}; fn main() { let matches = App::new("process-killer") .version("0.3.0") .about("A simple utility for for terminating processes quick...
mod collidable; mod simplex; pub use collidable::*; pub use simplex::*;
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CYPHER_BLOCK { pub data: [super::super::Foundation::CHAR; 8], } ...
// Copyright 2017 rust-ipfs-api Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accord...
fn main() { let input: String = include_str!("input").split("").filter(|x| !x.is_empty()).map(|digit| { let dec = u8::from_str_radix(digit, 16).unwrap(); let bin = format!("{:b}", dec); format!("{:0>4}", bin) }).collect(); let packet = parse_next_packet(input).0; println!("Part ...
use super::errors::{Error, ParamType}; use super::eval::eval_type; use crate::flat::*; use crate::lexer::Span; use crate::raw::Spanned; use std::collections::HashMap; // NOTE: this and type check can be modified not to take the cache arg. instead, // it will return a Kind and the Names that it has traversed, and the c...
// Copyright 2018 Grove Enterprises LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed ...
//! Synchronized droppable share-lock around internal state data. use crate::inv_error::*; use parking_lot::{Mutex, RwLock}; use std::sync::atomic; use std::sync::Arc; /// Callback for delayed initialization of InvShare pub type InvShareInitCb<T> = Box<dyn FnOnce(T) + 'static + Send>; /// Synchronized droppable shar...
use std::process::{Command, Child}; use env::EnvList; use super::Result; use error::BenvError; pub fn run(program_with_args: &str, env_list: EnvList) -> Result<Child> { let (program, args) = try!(split_program_and_args(program_with_args)); let mut command = Command::new(&program); command.args(&args); ...
#![cfg(feature = "inline")] use std::borrow::Cow; use std::fmt; use crate::text::{DiffableStr, TextDiff}; use crate::types::{Algorithm, Change, ChangeTag, DiffOp, DiffTag}; use crate::{capture_diff_deadline, get_diff_ratio}; use std::ops::Index; use std::time::{Duration, Instant}; use super::utils::upper_seq_ratio; ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type PreallocatedWorkItem = *mut ::core::ffi::c_void; pub type SignalHandler = *mut ::core::ffi::c_void; pub type SignalNotifier = *mut ::core::ffi::c_void;...
#![allow( clippy::missing_docs_in_private_items, clippy::missing_inline_in_public_items, clippy::implicit_return, clippy::result_unwrap_used, clippy::option_unwrap_used, clippy::print_stdout, clippy::use_debug, clippy::integer_arithmetic, clippy::default_trait_access, )] #![forbid(unsafe_code)] extern crate pest; #[ma...
use itertools::Itertools; use std::collections::HashMap; use std::collections::HashSet; fn main() { let input = std::fs::read_to_string("input").unwrap(); let foods: Vec<(Vec<&str>, HashSet<&str>)> = input .lines() .map(|l| { let mut food = l.trim_end_matches(")").split(" (contains ...
pub use VkSamplerMipmapMode::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq, Hash)] pub enum VkSamplerMipmapMode { VK_SAMPLER_MIPMAP_MODE_NEAREST = 0, VK_SAMPLER_MIPMAP_MODE_LINEAR = 1, }
use { std::{env, fs, io}, tracing::info, }; fn main() { tracing_subscriber::fmt().with_env_filter("info").init(); advent_of_code::init_parts(); // Get day string let args: Vec<String> = env::args().collect(); let mut year = String::new(); let mut day = String::new(); if args.len(...
//! Prints the elapsed time every 1 second and quits on Ctrl+C. #[macro_use] extern crate crossbeam_channel; extern crate signal_hook; use std::io; use std::thread; use std::time::{Duration, Instant}; use crossbeam_channel::{bounded, tick, Receiver}; use signal_hook::iterator::Signals; use signal_hook::SIGINT; // C...
use crate::raw_flash_algorithm::RawFlashAlgorithm; use crate::Chip; use serde::{Deserialize, Serialize}; use std::collections::HashMap; /// This describes a chip family with all its variants. #[derive(Debug, Clone, Serialize, Deserialize)] pub(crate) struct ChipFamily { /// This is the name of the chip family in b...
use crate::traits::RendererBase; use piston::input::{UpdateArgs, RenderArgs, Key}; use opengl_graphics::GlGraphics; use graphics::Context; use graphics::{rectangle}; use crate::audio::AnalyzedAudio; /** * Each renderer consists of three things. First, the struct defining its * state. Secondly, an impl that defines...
use std::error::Error; use std::io::prelude::*; use bio::io::fasta; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] pub struct Sequence<'a> { pub id: &'a str, pub description: Option<String>, pub sequence: &'a str, } impl<'a> From<Sequence<'a>> for fasta::Record { fn fr...
extern crate rustfft; extern crate ndarray; extern crate image; extern crate ofuton; use rustfft::{FFTplanner, FFTnum}; use rustfft::num_complex::Complex; use rustfft::num_traits::Zero; use ndarray::{Array, Array2, ArrayView, ArrayViewMut, ArrayViewMut2, Dimension}; use image::{ColorType, GenericImage, DynamicImage}; ...
use crate::{ feed_generator::FeedGenerator, utils::{now, NabuResult}, }; use atom_syndication::{Category, Content, Entry, Feed, FixedDateTime, Link, Person}; use reqwest; use serde::Deserialize; use serde_json; pub struct HotTopicsGenerator; #[derive(Debug, Deserialize)] struct Topic { node: Node, mem...
//! This module defines utilities for working with the [`std::option::Option`] type. /// Adds mapping methods to the `Option` type. pub trait OptionOps { type Item; fn map_none <F> (self , f:F) -> Self where F : FnOnce(); fn map_ref <U,F> (&self , f:F) -> Option<U> where F : FnOnce(&Se...
use crate::types::*; use neo4rs_macros::BoltStruct; #[derive(Debug, PartialEq, Clone, BoltStruct)] #[signature(0xB1, 0x71)] pub struct Record { pub data: BoltList, } #[cfg(test)] mod tests { use super::*; use crate::version::Version; use bytes::*; use std::cell::RefCell; use std::rc::Rc; ...
use anyhow::{anyhow, Context}; use byteorder::{BigEndian, WriteBytesExt}; use log::{debug, info, warn}; use pnet::packet::icmp::{ echo_request::{EchoRequestPacket, MutableEchoRequestPacket}, IcmpTypes, }; use pnet::packet::{ip::IpNextHeaderProtocols::Icmp, Packet}; use pnet::transport::{self, icmp_packet_iter, ...
use { super::{ChunkRenderMesher, RenderMeshedChunk}, rough::{ amethyst::{ assets::{AssetStorage, Handle, Loader}, core::{math::Point3, Transform}, ecs::prelude::*, renderer::{mtl::Material, visibility::BoundingSphere, Mesh}, }, log, ...
use std::sync::atomic::{AtomicU64, Ordering}; use std::{collections::HashMap, time::Instant}; use anyhow::{anyhow, ensure, Result}; use async_fuse::FileType; use config::Contents; use menmos_client::{Client, Meta, Query, Type}; use tokio::sync::Mutex; use crate::{cached_client::CachedClient, concurrent_map::Concurre...
use flate2::read::ZlibDecoder; use flate2::write::ZlibEncoder; use flate2::Compression; use sha1::{Digest, Sha1}; use std::fs::{create_dir_all, read, File}; use std::io::Cursor; use std::io::Read; use std::path::PathBuf; use std::time::SystemTime; // hack to import both Writes // https://stackoverflow.com/questions/59...
#[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::SSFSTAT2 { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R,...
use lazy_static::*; use num_derive::{FromPrimitive, ToPrimitive}; use std::sync::Mutex; #[derive(Copy, Clone, Hash, Debug, Eq, PartialEq, FromPrimitive, ToPrimitive)] pub enum VerbosityLevel { Errors = 0, Warnings = 1, Infos = 5, } lazy_static! { static ref VERBOSITY_LEVEL: Mutex<VerbosityLevel> = Mut...
/* 8 core power9 @ 3.8Ghz real 4m4.275s user 129m54.588s sys 0m7.761s */ #![feature(core_intrinsics)] mod vec3; use vec3::Vector3; use rayon::prelude::*; use std::{ sync::{Arc, RwLock}, intrinsics::{fmul_fast, fdiv_fast} }; const G: f32 = 6.673e-11; #[derive(Debug, Clone, Copy)] struct Body { p...
// 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 super::*; #[test] fn without_boolean_right_errors_badarg() { run!( |arc_process| strategy::term::is_not_boolean(arc_process.clone()), |right_boolean| { prop_assert_is_not_boolean!(result(false.into(), right_boolean), right_boolean); Ok(()) }, ); } // `with_...
use krnl::power::die; use core::fmt; #[lang = "eh_personality"] #[no_mangle] #[allow(private_no_mangle_fns)] pub extern "C" fn eh_personality() {} #[lang = "panic_fmt"] #[no_mangle] #[allow(private_no_mangle_fns)] pub extern "C" fn panic_fmt( _: fmt::Arguments, file: &'static str, line: u32, column: u32, ) ->...
use std::str::FromStr; use std::sync::Arc; use anyhow::Result; use hyper::header; use hyper::StatusCode; use hyper::{Body, Request, Response, Uri}; use routerify::{ext::RequestExt, RouterBuilder}; use zenith_utils::auth::JwtAuth; use zenith_utils::http::endpoint::attach_openapi_ui; use zenith_utils::http::endpoint::au...
/// Contoh penggunaan Option pada rust karena tidak ada null/nil /// Option sebagai parameter yang bisa berisi "nilai" atau "kosong"/None /// struct Person { fname: &'static str, lname: &'static str, mname: Option<&'static str>, } fn main() { // Mengambil nilai dari Option dengan "if let" // atau b...
// 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 ...
// 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 ...
//! Managing undo state use std::collections::VecDeque; // for no good reason const DEFAULT_UNDO_STACK_SIZE: usize = 128; /// A stack of states that can be undone and redone. #[derive(Debug)] pub(crate) struct UndoState<T> { max_undo_count: usize, stack: VecDeque<T>, /// The index in `stack` of the curre...
use std::fmt::Write as FormatWrite; use std::io; use std::io::Stderr; use std::io::Write; use std::thread; use std::thread::JoinHandle; use libc; use termion; use termion::event::Key; use termion::input::TermRead; use termion::raw::IntoRawMode; use termion::raw::RawTerminal; use backend::*; use output_log::*; pub s...
// Only used by non-unit zero-sized types // macro_rules! monomorphic_marker_type { ($name:ident, $field:ty) => { #[allow(non_upper_case_globals)] const _: () = { monomorphic_marker_type! {@inner $name, $field} }; }; (@inner $name:ident, $field:ty) => { const _ite...
//! Serial communication use crate::clock::Clocks; use crate::pac; use embedded_time::rate::{Baud, Extensions}; /// Serial error #[derive(Debug)] #[non_exhaustive] pub enum Error { /// Framing error Framing, /// Noise error Noise, /// RX buffer overrun Overrun, /// Parity check error Pa...
use anyhow::anyhow; use anyhow::{Context, Result}; use clap::{App, AppSettings, Arg, ArgMatches, SubCommand}; use control_plane::compute::ComputeControlPlane; use control_plane::local_env; use control_plane::storage::PageServerNode; use pageserver::defaults::{DEFAULT_HTTP_LISTEN_PORT, DEFAULT_PG_LISTEN_PORT}; use std::...
mod sync_channel; mod watch;
use std::sync::Arc; use super::Fact; pub enum Filter<In> { Fact(Box<dyn Fact<In>>), And(Vec<Self>), Or(Vec<Self>), } impl<In> Filter<In> { pub fn empty() -> Self { Self::And(vec![]) } pub fn fact<F: Fact<In> + 'static>(fact: F) -> Self { Filter::Fact(Box::new(fact)) } ...
macro_rules! header_display { ( ) => { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> { write!(f, "{}:{}", self.header_name(), self.value) } }; } macro_rules! header { ( $header:ident, $name:expr $(,$types:ty $(, $default:expr )?)? ) =>...
// // Sysinfo // // Copyright (c) 2018 Guillaume Gomez // use std::ffi::{OsStr, OsString}; use std::fmt::{Debug, Error, Formatter}; use std::str; use std::path::Path; use DiskExt; use winapi::um::fileapi::GetDiskFreeSpaceExW; use winapi::um::winnt::ULARGE_INTEGER; /// Enum containing the different handled disks t...