text
stringlengths
8
4.13M
use specs::*; use component::flag::{IsDead, IsSpectating}; #[derive(SystemData)] pub struct IsAlive<'a> { pub is_spec: ReadStorage<'a, IsSpectating>, pub is_dead: ReadStorage<'a, IsDead>, } impl<'a> IsAlive<'a> { pub fn get(&self, ent: Entity) -> bool { let is_spec = self.is_spec.get(ent).is_none(); let is_de...
use datum::Datum; use spell::Instruction; use spell::Local; /// A call stack is a sequence of stack frames. #[derive(Debug)] pub struct CallStack<'a> { pub stack_frames: Vec<StackFrame<'a>>, } /// A stack frame consists of a program counter and local variables. /// /// A stack frame represents an active spell inv...
use std::net::SocketAddr; use std::sync::Arc; use mio::{Events, Interest, Poll, Token}; use mio::net::{TcpListener, TcpStream}; use utils::contexts::Message::{Threads, NewConnection}; use utils::contexts::PaxyThread; use packet_transformation::handling::HandlingContext; use packets::{c2s, s2c}; use std::{sync, thread...
use nom::IResult; use crate::kraken::Indent; pub fn spaces_and_rest(input: &[u8]) -> IResult<&[u8], Vec<&[u8]>> { nom::multi::fold_many0( nom::bytes::complete::tag(" "), Vec::new(), |mut acc: Vec<_>, item| { acc.push(item); acc }, )(input) } pub fn par...
use std::collections::HashSet; use std::fs::File; use std::io::prelude::*; pub struct Group { answers: Vec<HashSet<u8>>, } impl Group { pub fn new(answers: &str) -> Group { let mut all_answers = Vec::new(); for answer in answers.split("\n").map(|x| String::from(x)) { let mut chars:...
use anyhow::{format_err, Error}; use lazy_static::lazy_static; use log::{debug, error, info}; use smallvec::{smallvec, SmallVec}; use stack_string::{format_sstr, StackString}; use std::{collections::HashMap, process::Stdio}; use tokio::{ io::{stdout, AsyncBufReadExt, AsyncWriteExt, BufReader}, process::Command,...
#[cfg(feature = "logs")] extern crate rayon_logs as rayon; use ndarray::Array; use rayon::subgraph; use rayon::ThreadPoolBuilder; use rayon_adaptive::prelude::*; use rayon_adaptive::Policy; use matrix_mult::matrix; use matrix_mult::matrix_adaptive; use ndarray::{linalg,ArrayView,ArrayViewMut}; use rand::Rng; use matri...
// 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. use async; use failure::ResultExt; use futures::channel::mpsc; use futures::{FutureExt, StreamExt}; use parking_lot::RwLock; use std::sync::Arc; use commo...
๏ปฟ//============================================================================= // vector3.rs // // Created by Victor on 2019/10/27 //============================================================================= use std::ops::{Add, Div}; /// A three-dimensional vector pub struct Vector3 { pub x: f32, pub y: ...
#[doc = "Register `GICD_ISPENDR0` reader"] pub type R = crate::R<GICD_ISPENDR0_SPEC>; #[doc = "Register `GICD_ISPENDR0` writer"] pub type W = crate::W<GICD_ISPENDR0_SPEC>; #[doc = "Field `ISPENDR0` reader - ISPENDR0"] pub type ISPENDR0_R = crate::FieldReader<u32>; #[doc = "Field `ISPENDR0` writer - ISPENDR0"] pub type ...
use crate::ast; use crate::{Parse, Spanned, ToTokens}; /// An else branch of an if expression. #[derive(Debug, Clone, ToTokens, Parse, Spanned)] pub struct ExprElse { /// The `else` token. pub else_: ast::Else, /// The body of the else statement. pub block: Box<ast::ExprBlock>, }
fn main() { let user1 = User { name: String::from("hdl"), age: 18, }; // user1.age = 19; // ไธๆ˜ฏ mut ๆ— ๆณ•ๆ”นๅ˜ๅ€ผ println!("{:?}", user1); let mut user2 = User { name: String::from("hdl"), age: 18, }; user2.age = 19; // mut ๅˆ™ๅฑžๆ€งๅฏไปฅ่ขซไฟฎๆ”น println!("{:?}", user2); } #[...
//! ODBC types those representation is compatible with the ODBC C API. //! //! This layer has not been created using automatic code generation. It is incomplete, i.e. it does //! not contain every symbol or constant defined in the ODBC C headers. Symbols which are //! deprecated since ODBC 3 have been left out intentio...
use super::{check_proposer_block_exists, check_voter_block_exists}; use crate::block::voter::Content; use crate::blockchain::BlockChain; use crate::blockdb::BlockDatabase; use crate::crypto::hash::H256; pub fn get_missing_references( content: &Content, blockchain: &BlockChain, _blockdb: &BlockDatabase, )...
use euler::utils::sieve; fn main() { let mut ans: i64 = 0; let prime_flags = sieve(2_000_000); for i in 2..2_000_000 { if prime_flags[i] { ans += i as i64; } } println!("{}", ans); }
/// An enum to represent all characters in the Kharoshthi block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Kharoshthi { /// \u{10a00}: '๐จ€' LetterA, /// \u{10a01}: '๐จ' VowelSignI, /// \u{10a02}: '๐จ‚' VowelSignU, /// \u{10a03}: '๐จƒ' VowelSignVocalicR, /// \u{10a05}...
use badgeland::Badge; fn main() { let badge = Badge::new().text("Badge Maker"); println!("{}", badge); }
pub mod digital; pub mod pin;
use super::Sorter; pub struct SelectionSort; impl Sorter for SelectionSort { fn sort<T: Ord>(self, slice: &mut [T]) { for cursor in 0..slice.len() { let mut min_value_index = cursor; for rest_cursor in cursor..slice.len() { if &slice[rest_cursor] < &slice[min_value...
//! Management of the index of a registry source //! //! This module contains management of the index and various operations, such as //! actually parsing the index, looking for crates, etc. This is intended to be //! abstract over remote indices (downloaded via git) and local registry indices //! (which are all just p...
mod constants; mod file_wrapper; mod game; mod keybindings; mod rectangle; mod run; mod tile; mod utility; mod vector; use crate::serialization; pub use file_wrapper::FileWrapper; use game::Game; pub use keybindings::Keybindings; pub use rectangle::Rectangle; pub use run::run_internal; use serialization::MapDistance; ...
use serde::{Serialize, Deserialize}; use std::sync::atomic::{AtomicUsize, AtomicU64, AtomicU32, Ordering, AtomicBool}; use std::time::{SystemTime, UNIX_EPOCH, Duration}; lazy_static! { pub static ref PERFORMANCE_COUNTER: Counter = { Counter::default() }; } #[derive(Default)] pub struct Counter { scale_id: Ato...
table! { transactions (id) { id -> Int4, transaction_date -> Varchar, transaction_details -> Varchar, funds_out -> Numeric, funds_in -> Numeric, } }
use std::fs::OpenOptions; use std::fs::{read_dir, File}; use std::io::{Read, Write}; fn main() { let mut ups = vec![]; for it in read_dir("migrations").unwrap() { let it = it.unwrap(); if it.metadata().unwrap().is_dir() { let mut path = it.path().to_path_buf(); path....
use std::mem::MaybeUninit; use crate::plan::Plan; use crate::policy::largeobjectspace::LargeObjectSpace; use crate::policy::mallocspace::MallocSpace; use crate::policy::space::Space; use crate::util::alloc::LargeObjectAllocator; use crate::util::alloc::MallocAllocator; use crate::util::alloc::{Allocator, BumpAllocator...
//! Simple parsing functionality for extracting SBP //! messages from binary streams use byteorder::{LittleEndian, ReadBytesExt}; use nom::Err as NomErr; use crate::{messages::SBP, Error, Result, SbpString}; pub fn read_string(buf: &mut &[u8]) -> Result<SbpString> { let amount = buf.len(); let (head, tail) =...
pub mod cors; pub mod trace;
pub mod act1;
//! //! This module specifies the `Numeric` trait. //! use crate::prelude::*; /// Common trait for all byte arrays and sequences. pub trait SeqTrait<T: Clone>: Index<usize, Output = T> + IndexMut<usize, Output = T> + Sized { fn len(&self) -> usize; fn iter(&self) -> core::slice::Iter<T>; fn create(len...
#[cfg(test)] mod cli { use std::process::Command; use assert_cmd::prelude::*; use predicates::prelude::*; #[test] fn should_return_exitcode_0_when_matches_are_found() { let mut cmd = Command::main_binary().unwrap(); cmd.arg("-c").arg(".name"); let mut stdin_cmd = cmd.with...
use std::env; use std::fs; use std::path::PathBuf; fn main() { if env::var_os("CARGO_FEATURE_RT").is_some() { let out = &PathBuf::from(env::var_os("OUT_DIR").unwrap()); println!("cargo:rustc-link-search={}", out.display()); let device_file = if env::var_os("CARGO_FEATURE_STM32L412").is_some(...
use std::{cell::RefCell, rc::Rc}; use crate::prelude::World; use cao_alloc::linear::LinearAllocator; use cao_lang::prelude::*; use super::*; fn init_basic_storage() -> World { World::new() } fn get_alloc() -> Rc<RefCell<LinearAllocator>> { Rc::new(RefCell::new(LinearAllocator::new(100_000_000))) } #[test] ...
use std::collections::{HashSet, VecDeque}; use crate::util::{lines, time}; pub fn day6() { println!("== Day 6 =="); let input = "src/day6/input.txt"; time(part_a, input, "A"); time(part_b, input, "B"); } fn part_a(input: &str) -> usize { find_seq(lines(input)[0].as_str(), 4) } fn find_seq(input:...
use std::time::SystemTime; use bonsaidb::{ core::{ schema::{Collection, CollectionName, InvalidNameError, Schematic}, Error, }, local::{config::Configuration, Database}, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize, Deserialize)] struct Message { pub timestamp: Sys...
extern "C" { fn evenmorehello(); } pub fn helloer() { println!("I'm saying \"hello\" again!"); unsafe { evenmorehello() }; }
use crate::errors::*; use crate::types::*; use uuid::Uuid; /// Describes the photo of a chat #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct ChatPhoto { #[doc(hidden)] #[serde(rename(serialize = "@type", deserialize = "@type"))] td_name: String, #[doc(hidden)] #[serde(rename(ser...
use crate::transaction::{PackageStatus, PackageStatusError}; use pahkat_types::package::Version; pub(crate) fn cmp( installed_version: &str, candidate_version: &Version, ) -> Result<PackageStatus, PackageStatusError> { let installed_version = match Version::new(installed_version) { Ok(v) => v, ...
use crate::player::Player; /* On main led 7 segments * 0 * -- * 1| 3|2 * -- * 5| |4 * -- * 6 */ // we use u8 for bits because it is more visual and easy to edit than bool const PINS_0: [u8; 7] = [1, 1, 1, 0, 1, 1, 1]; const PINS_1: [u8; 7] = [0, 0, 1, 0, 1, 0, 0]; const PINS_2: [u8; 7] = [1, 0...
use url::Url; use WebSocket::{ Result, Error, ErrorKind }; use httparse; use crypto::sha1; use crypto::hmac::Hmac; use crypto::mac::Mac; use chrono::Utc; use hex::ToHex; use settings::auth::Authorization; pub struct HttpData { url: Url, auth: Authorization } impl HttpData { pub fn new(path: &str, auth: Authoriz...
use std::io::{Read, Write}; use dencode::{Decoder, Encoder, FramedRead, FramedWrite, IterSinkExt}; use serde_json::ser::Formatter; use sbp::{ codec::{ json::{Json2JsonDecoder, Json2JsonEncoder, JsonDecoder, JsonEncoder}, sbp::{SbpDecoder, SbpEncoder}, }, Error, Result, }; pub fn json2sbp<...
use std::env; use std::path::PathBuf; extern crate spatialos_gdk_codegen; fn main() { let json_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("json"); let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()).join("generated.rs"); spatialos_gdk_codegen::codegen(json_path, out_path); }
use crate::snapshot_utils::ArchiveFormat; use crate::snapshot_utils::SnapshotVersion; use solana_sdk::clock::Slot; use std::path::PathBuf; /// Snapshot configuration and runtime information #[derive(Clone, Debug)] pub struct SnapshotConfig { /// Generate a new full snapshot archive every this many slots pub fu...
use chrono::prelude::*; use std::fs::File; use std::io::prelude::*; use uuid::Uuid; #[cfg(feature = "mocks")] use mocktopus::macros::*; pub fn now() -> chrono::naive::NaiveDateTime { Utc::now().naive_local() } pub fn read_file_to_string(path: &String) -> std::io::Result<String> { let mut file = File::open(pa...
#[cfg(feature = "serde1")] mod serde; use core::num::NonZeroU64; /// Handle to an entity. /// /// It has two parts, an index and a generation. #[derive(Clone, Copy, Hash, PartialEq, Eq, PartialOrd, Ord)] #[repr(transparent)] pub struct EntityId(pub(super) NonZeroU64); impl EntityId { // Number of bits used by ...
//! Types for change streams using sessions. use serde::de::DeserializeOwned; use crate::{ cursor::{BatchValue, NextInBatchFuture}, error::Result, ClientSession, SessionCursor, }; use super::{ event::{ChangeStreamEvent, ResumeToken}, get_resume_token, ChangeStreamData, WatchArgs, }; /...
extern crate bindgen; use cmake; use std::env; use std::path::PathBuf; fn main() { let out_dir = PathBuf::from(env::var("OUT_DIR").unwrap()); let mut dir_builder = std::fs::DirBuilder::new(); dir_builder.recursive(true); // Build cyclonedds let cyclonedds_dir = out_dir.join("cyclonedds-build"); ...
mod api { // GET pub const INFO: &'static str = "https://api.tumblr.com/v2/user/info"; pub const DASHBOARD: &'static str = "https://api.tumblr.com/v2/user/dashboard"; pub const LIKES: &'static str = "https://api.tumblr.com/v2/user/likes"; pub const FOLLOWING: &'static str = "https://api.tumblr.com/v...
use pasture_core::{ containers::{ InterleavedPointBufferMutExt, PerAttributePointBufferMutExt, PerAttributeVecPointStorage, PointBufferExt, }, nalgebra::Vector3, }; use pasture_core::{ containers::{InterleavedVecPointStorage, PerAttributePointBuffer}, layout::{ attributes::{I...
extern crate env_logger; extern crate svg2polylines; use std::env; use std::fs; use std::io::Read; use std::process::exit; use svg2polylines::Polyline; fn main() { // Logging env_logger::init(); // Argument parsing let args: Vec<_> = env::args().collect(); match args.len() { 2 => {}, ...
#[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct ThemeImages { directory_icon: String, file_icon: String, save_icon: String, settings_icon: String, } impl ThemeImages { pub fn new( directory_icon: String, file_icon: String, save_icon: String, set...
use crate::{ bin_u32, classification::{depth::DepthBlock, quotes::QuoteClassifiedBlock}, debug, input::InputBlock, }; use std::marker::PhantomData; const SIZE: usize = 32; /// Works on a 32-byte slice, but uses a heuristic to quickly /// respond to queries and not count the depth exactly unless /// ne...
extern crate cc; #[cfg(feature = "sse4")] fn is_enable_sse() -> bool { true } #[cfg(not(feature = "sse4"))] fn is_enable_sse() -> bool { false } fn main() { let mut build = cc::Build::new(); if is_enable_sse() { build.flag("-msse4"); } build .file("deps/picohttpparser/picoht...
use std::cell::RefCell; use std::rc::Rc; use criterion::{black_box, criterion_group, criterion_main, BenchmarkId, Criterion}; use monkey::compiler; use monkey::evaluator; use monkey::evaluator::objects; use monkey::lexer; use monkey::parser; use monkey::vm; fn run_vm(input: String) -> objects::Object { let mut c...
use super::Collector; use DocId; use Result; use Score; use SegmentLocalId; use SegmentReader; /// `CountCollector` collector only counts how many /// documents match the query. /// /// ```rust /// #[macro_use] /// extern crate tantivy; /// use tantivy::schema::{SchemaBuilder, TEXT}; /// use tantivy::{Index, Result}; ...
#![allow(missing_docs)] use thiserror::Error; #[derive(Error, Debug)] pub enum Error { #[error("couldn't convert request from actix-web format to perseus format")] RequestConversionFailed { #[source] source: actix_web::client::HttpError, }, }
use std::{ collections::HashMap, fmt::Display, sync::{Arc, Mutex}, }; use crate::{ interpreter::{Interpreter, InterpreterError}, token::Token, }; use super::{CallableValue, RuntimeValue, UserFunction}; #[derive(Debug)] pub struct ClassDefinitionStorage { name: Token, superclass: Option<Cl...
use crate::GetFieldExt; #[cfg(feature="alloc")] use crate::pmr::Box; use core_extensions::{SelfOps,Void}; use core_extensions::type_asserts::AssertEq; #[cfg(feature="alloc")] #[test] fn boxed_fields() { let mut f = Box::new((0, 1, Box::new((20, 21)), 3)); let (f_0, f_1, f_2_0, f_2_1, f_3) = f.fields_mut(fp!...
pub mod adt_blog; pub mod blog; pub mod idiomatic_blog; /************************************* * 17.1 examples (encapsulation) *************************************/ #[derive(PartialEq, Debug)] pub struct AveragedCollection { list: Vec<i32>, average: f64, } impl AveragedCollection { pub fn add(&mut sel...
use super::preludes::*; use vm::convert::ToBytes; use vm::opcode; pub type Instruction = u8; #[derive(Clone, Debug, Default, Eq, PartialEq, Hash, Ord, PartialOrd)] pub struct Instructions(pub Vec<Instruction>); impl From<Vec<Instruction>> for Instructions { fn from(value: Vec<Instruction>) -> Self { Ins...
/** * cargo new ep1 * cd C:\Users\ใ‚€ใšใงใ‚‡\OneDrive\ใƒ‰ใ‚ญใƒฅใƒกใƒณใƒˆ\practice-rust\concurrency\ep1 * cargo build --example channel-3 * cargo run --example channel-3 * * [ใƒกใƒƒใ‚ปใƒผใ‚ธๅ—ใ‘ๆธกใ—ใ‚’ไฝฟใฃใฆใ‚นใƒฌใƒƒใƒ‰้–“ใงใƒ‡ใƒผใ‚ฟใ‚’่ปข้€ใ™ใ‚‹](https://doc.rust-jp.rs/book/second-edition/ch16-02-message-passing.html) */ use std::thread; use std::sync::mpsc; fn main() {...
#![no_std] #![feature(start)] #![no_main] use ferr_os_librust::{io, syscall, interfaces::keyboard}; mod action; mod direction; mod errors; mod state; mod snake; mod point_generator; mod game; use action::Action; use direction::Dir; use errors::SnakeError; use state::State...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Clock control register"] pub cr: CR, #[doc = "0x04 - Internal clock sources calibration register"] pub icscr: ICSCR, #[doc = "0x08 - Clock configuration register"] pub cfgr: CFGR, #[doc = "0x0c - PLL configurati...
#![allow(clippy::upper_case_acronyms)] // Table B.1 #[derive(Clone, Copy, Debug, PartialEq)] pub enum Marker { ZERO, /// Start Of Frame markers SOF(SOFType), /// Reserved for JPEG extensions JPG, /// Define Huffman table(s) DHT, /// Define arithmetic coding conditioning(s) DAC, ...
pub mod auth_service; pub mod link; pub mod session; pub mod user;
pub mod icmp; pub mod tcp; pub mod udp; use std::collections::HashMap; use std::net::IpAddr; use std::net::Ipv4Addr; use pnet::packet::ip::{IpNextHeaderProtocol, IpNextHeaderProtocols}; pub fn handle_transport_protocol(interface_name: &str, source: IpAddr, de...
#[doc = "Reader of register INTR_CAUSE"] pub type R = crate::R<u32, super::INTR_CAUSE>; #[doc = "Reader of field `M`"] pub type M_R = crate::R<bool, bool>; #[doc = "Reader of field `S`"] pub type S_R = crate::R<bool, bool>; #[doc = "Reader of field `TX`"] pub type TX_R = crate::R<bool, bool>; #[doc = "Reader of field `...
use std::str::FromStr; #[derive(Debug)] pub struct KnownTag { pub tag: String, } impl From<OpenTracingTag> for KnownTag { fn from(tag: OpenTracingTag) -> KnownTag { let tag_str: &'static str = tag.into(); KnownTag { tag: tag_str.to_string(), } } } impl From<IkrellnTags> ...
mod passport; pub mod validate; pub fn solve_1() { let input = include_str!("input.txt"); let parsed = passport::parse(input); println!( "{} valid passwords found (of {} total).", parsed.iter().filter(|p| p.is_ok()).count(), parsed.len() ); for pass in parsed { println!("{:?}", pass); } }
use common::tokio::time::Instant; use std::time::Duration; use super::super::{TIMER_G, TIMER_H, TIMER_T2}; #[derive(Debug, Clone, Copy)] pub struct Completed { pub entered_at: Instant, pub retransmissions_count: u8, pub last_retransmission_at: Instant, } impl Completed { pub fn next_retrasmission(&se...
#[doc = "Register `DDRCTRL_DFITMG0` reader"] pub type R = crate::R<DDRCTRL_DFITMG0_SPEC>; #[doc = "Register `DDRCTRL_DFITMG0` writer"] pub type W = crate::W<DDRCTRL_DFITMG0_SPEC>; #[doc = "Field `DFI_TPHY_WRLAT` reader - DFI_TPHY_WRLAT"] pub type DFI_TPHY_WRLAT_R = crate::FieldReader; #[doc = "Field `DFI_TPHY_WRLAT` wr...
use hyper::{Client, Url}; use serde_json; use ::{Package}; use ::package::PackageError; pub struct Search { query: String } impl Search { pub fn new(query: &str) -> Search { Search { query: String::from(query) } } pub fn execute(&self) -> Result<Vec<Package>, PackageError> { Package:...
use std::sync::{Arc, Mutex}; use std::vec::Vec; use std::{panic, vec}; use crate::{Busy, Error, PinState, Ready, Reset, Transaction, Transactional}; use embedded_hal::blocking::delay::DelayMs; use embedded_hal::blocking::spi; use embedded_hal::digital::v2; /// Base mock type pub struct Mock { inner: Arc<Mutex<In...
#[cfg(test)] mod url_test; use crate::errors::*; use util::Error; use std::borrow::Cow; use std::convert::From; use std::fmt; /// The type of server used in the ice.URL structure. #[derive(PartialEq, Debug, Copy, Clone)] pub enum SchemeType { /// The URL represents a STUN server. Stun, /// The URL repr...
use isahc::{prelude::*, Request}; pub fn notmain() -> Result<String, isahc::Error> { let mut response = Request::get("https://hurrxycxigvviayjhlxr.supabase.co/rest/v1/anime?select=link") .header("apikey", "anon-key") .header("Authorization", "Bearer token") .body(r#"{"ne...
//! PEG parser for name variants. use super::types::*; peg::parser! { grammar name_parser() for str { rule space() = quiet!{[' ' | '\n' | '\r' | '\t']} rule digit() = quiet!{['0'..='9']} rule trailing_junk() = [',' | '.'] space()* ![_] rule year_range() -> String = range:...
use crate::enums::{ Align, CallbackTrigger, Color, Damage, Event, Font, FrameType, LabelType, Shortcut, }; use crate::image::Image; use crate::prelude::*; use crate::utils::FlString; use fltk_sys::button::*; use std::{ ffi::{CStr, CString}, mem, os::raw, }; /// Creates a normal button #[derive(WidgetBa...
// Copyright (c) 2016 Anatoly Ikorsky // // 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, // m...
use criterion::{criterion_group, criterion_main, Criterion}; use nu_plugin::{EncodingType, PluginResponse}; use nu_protocol::{Span, Value}; // generate a new table data with `row_cnt` rows, `col_cnt` columns. fn new_test_data(row_cnt: usize, col_cnt: usize) -> Value { let columns: Vec<String> = (0..col_cnt).map(|x...
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate serde_derive; #[macro_use] extern crate rocket; use rocket::{get, routes}; use rocket::http::RawStr; use std::fs; #[derive(Deserialize, Debug)] #[derive(FromForm)] struct OaiQuery { verb: Option<String>, #[serde(rename = "metadataPrefix")] ...
pub mod bitutil; pub mod flat_map;
#[doc = "Register `CR2` reader"] pub type R = crate::R<CR2_SPEC>; #[doc = "Register `CR2` writer"] pub type W = crate::W<CR2_SPEC>; #[doc = "Field `ADDM7` reader - 7-bit Address Detection/4-bit Address Detection"] pub type ADDM7_R = crate::BitReader<ADDM7_A>; #[doc = "7-bit Address Detection/4-bit Address Detection\n\n...
use hyper::{ server::Server, service::{make_service_fn, service_fn}, Error, }; use std::{convert::Infallible, fmt, sync::Arc}; use crate::{middleware::NotFound, Context, Router}; pub struct Trek<State> { state: State, router: Router<Context<State>>, } impl<State: Send + Sync + 'static> Trek<State...
/// a renderer is something that abstracts all of `gfxal` away from the client, using a /// renderer should not require any raw gfx-hal calls, or any calls inside gfxal. /// This said they should still be powerful. pub trait Renderer { /// begins the scene, this should be used for stuff that needs to happen before ...
mod utils; mod fraction; mod primes; mod fib; mod queue; mod poker; mod euler; use euler::phi; use fraction::Fraction; use utils::check_permutation; fn main() { let mut res = 0; let mut min = Fraction::new(10, 1); for i in 2..=500_000 { if i % 10_000 == 0 { println!("i: {}", i); ...
use crate::prelude::*; pub mod prelude { pub use super::BitvecConst; } /// A constant bitvec term expression. #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct BitvecConst { /// The constant bitvec value. pub val: Bitvec, } impl BitvecConst { /// Creates a new `BitvecConst` for the given bit wi...
//! This example demonstrates using [`IterTable`], an [allocation](https://doc.rust-lang.org/nomicon/vec/vec-alloc.html) //! free [`Table`] alternative that translates an iterator into a display. //! //! * Note how [`IterTable`] supports the familiar `.with()` syntax for applying display //! modifications. //! //! * [`...
// implements the color space submodule pub enum ColorTransform { BGR_to_RGB, BGR_to_HSV, BGR_to_GREY, RGB_to_BGR, RGB_to_HSV, RGB_to_GREY, HSV_to_BGR, HSV_to_RGB, HSV_to_GREY, } pub fn color_space(/*image: &Image,*/ color_space: ColorTransform) /*->Image*/ { }
// Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. The ASF licenses this file // to you under the Apache License, Version 2.0 (the // "License"); you may...
use apllodb_shared_components::UnaryOperator; use apllodb_sql_parser::apllodb_ast; use crate::ast_translator::AstTranslator; impl AstTranslator { pub(crate) fn unary_operator(ast_unary_operator: apllodb_ast::UnaryOperator) -> UnaryOperator { match ast_unary_operator { apllodb_ast::UnaryOperato...
#![feature(collection_placement)] #![feature(placement_in_syntax)] #![feature(test)] // #[macro_use] // extern crate serde_derive; #[macro_use] extern crate log; extern crate flexi_logger; #[macro_use] extern crate serde_json; extern crate rand; extern crate serde; extern crate test; extern crate veloci; #[macro_u...
use crate::{ApertureShape, Camera, Device}; use cgmath::prelude::*; use cgmath::{Matrix4, Point3, Vector3}; use js_sys::Error; use zerocopy::{AsBytes, FromBytes}; #[repr(align(16), C)] #[derive(AsBytes, FromBytes, Debug, Default)] pub struct CameraData { aperture_settings: [f32; 4], camera_transform: [[f32; 4]...
#![no_std] #![no_main] #![feature(abi_x86_interrupt)] #![feature(custom_test_frameworks)] #![test_runner(xagima::testing::runner)] #![reexport_test_harness_main = "test_main"] #![feature(default_alloc_error_handler)] use bootloader::BootInfo; use core::panic::PanicInfo; #[panic_handler] fn panic(_: &PanicInfo) -> ! {...
#![doc = include_str!("../README.md")] #[cfg(feature = "python")] pub mod py; /// Mathematical methods. pub mod math; /// Models for polymer physics. pub mod physics;
use ggez; use ggez::{event, timer}; use ggez::graphics; use ggez::nalgebra as na; use ggez::{Context, GameResult}; use ggez::conf::NumSamples; use ggez::input::keyboard::KeyCode; use ggez::event::KeyMods; #[derive(Debug)] struct InputState { xaxi: f32, yaxi: f32 } impl Default for InputState { fn default() -> Self...
#[doc = "Register `IFCR` reader"] pub type R = crate::R<IFCR_SPEC>; #[doc = "Field `CGIF1` reader - Clear channel 1 global interrupt flag"] pub type CGIF1_R = crate::BitReader<CGIF1_A>; #[doc = "Clear channel 1 global interrupt flag\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum CGIF1_A { ...
use clap::{App, Arg, ArgMatches, Values}; pub mod check; pub mod generate; pub mod import; pub mod solve; use std::fs::File; use std::io::{stdout, BufReader, BufWriter, Write}; use std::process; use std::str::FromStr; use vrp_cli::extensions::check::check_pragmatic_solution; pub(crate) fn create_write_buffer(out_fil...
#![feature(alloc)] #![feature(core_intrinsics)] #![feature(heap_api)] #![feature(raw)] #![feature(unique)] //! # mo-gc //! //! A pauseless, concurrent, generational, parallel mark-and-sweep garbage collector. //! //! This is an experimental design to research an idea into a pauseless garbage collector. //! //! The GC...
use crate::engine::cache::{CachedEntities, CachedEntity}; use crate::frame::frame::ConcreteGraphicsPipeline; use crate::scene::camera::CameraMatrices; use crate::scene::lights::Light; use crate::scene::lights::PointLight; use vulkano::descriptor::descriptor_set::PersistentDescriptorSetBuf; use vulkano::descriptor::desc...
use crate::error::Error; use std::cell::RefCell; use std::fs::{self, File}; use std::path::{Path, PathBuf}; use tar::Builder; pub struct ManifestIterator { paths: Vec<PathBuf>, } // move impl IntoIterator for ManifestIterator { type Item = PathBuf; type IntoIter = std::vec::IntoIter<Self::Item>; fn i...
//! This is a mod for storing and parsing configuration //! //! According to shadowsocks' official documentation, the standard configuration //! file should be in JSON format: //! //! ```ignore //! { //! "server": "127.0.0.1", //! "server_port": 1080, //! "local_port": 8388, //! "password": "the-passwor...