text
stringlengths
8
4.13M
use crate::{ bson::{doc, Document}, bson_util, cmap::StreamDescription, operation::{test::handle_response_test, ListCollections, Operation}, options::ListCollectionsOptions, }; fn build_test(db_name: &str, mut list_collections: ListCollections, mut expected_body: Document) { let mut cmd = list_...
/// TrackedTime worked time for an issue / pr #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct TrackedTime { pub created: Option<String>, pub id: Option<i64>, pub issue: Option<crate::issue::Issue>, /// deprecated (only for backwards compatibility) pub issue_id: Option<i64>, ...
use super::traits::NodeBuilder; use super::traits::NodeBuilderResolver; use super::style::TextStyleBuilder; use crate::node::Heading; use crate::node::Node; use crate::node::NodeKind; use regex::Regex; use regex::RegexBuilder; lazy_static! { static ref PATTERN: &'static str = r"^ *(?P<level>#{1,6}) *(?P<header>.*)...
use sudo_test::{ helpers::{self, PsAuxEntry}, Command, Env, }; use crate::{Result, SUDOERS_ALL_ALL_NOPASSWD}; #[derive(Debug)] struct Processes { original: PsAuxEntry, monitor: PsAuxEntry, command: PsAuxEntry, } fn fixture() -> Result<Processes> { let env = Env([SUDOERS_ALL_ALL_NOPASSWD, "Def...
use crate::utils::get_fl_name; use proc_macro::TokenStream; use quote::*; use syn::*; pub fn impl_widget_base_trait(ast: &DeriveInput) -> TokenStream { let name = &ast.ident; let name_str = get_fl_name(name.to_string()); let ptr_name = Ident::new(name_str.as_str(), name.span()); let new = Ident::new(f...
#[doc = "Register `OFR2` reader"] pub type R = crate::R<OFR2_SPEC>; #[doc = "Register `OFR2` writer"] pub type W = crate::W<OFR2_SPEC>; #[doc = "Field `OFFSET2` reader - ADC offset number 2 offset level"] pub type OFFSET2_R = crate::FieldReader<u16>; #[doc = "Field `OFFSET2` writer - ADC offset number 2 offset level"] ...
use itertools::Itertools; use std::fs; fn do_the_thing(input: &str) -> usize { // Since with a VecDeque (see first.rs) we have to make_contiguous() // at every step, we might as well use a Vec and remove the first // element, which also causes a copy, but less copies than // make_contiguous(). let ...
use super::{DataClass, DataIdDefinition}; use ::std::marker::PhantomData; pub type DataIdSimpleType = u8; pub(crate) static DATAID_DEFINITION : DataIdDefinition<DataIdSimpleType, DataIdType> = DataIdDefinition { data_id: 4, class: DataClass::RemoteCommands, read: true, write: true,...
/* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ use crate::BoxError; use http::Request; use hyper::client::ResponseFuture; use hyper::Response; use smithy_http::body::SdkBody; use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}...
use crate::{ast::*, visitor::Visitor}; #[cfg(feature = "sqlite")] use sqlite::{Bindable, Result as SqliteResult, Statement}; #[cfg(feature = "rusqlite")] use rusqlite::{ types::{Null, ToSql, ToSqlOutput}, Error as RusqlError, }; /// A visitor for generating queries for an SQLite database. Requires that /// `...
use stdweb::web::event::PopStateEvent; use stdweb::web::window; use stdweb::web::EventListenerHandle; use stdweb::web::History; use stdweb::web::IEventTarget; use stdweb::web::Location; use yew::callback::Callback; pub struct HistoryService { history: History, event_listeners: Vec<EventListenerHandle>, } impl...
extern crate bio_algorithms as bio; use std::fs::File; use std::io::prelude::*; use bio::bio_types::DNA_Sequence; fn main() { let mut f = File::open("test_files/1d.txt").expect("Coudln't open file"); let mut file_text = String::new(); f.read_to_string(&mut file_text) .expect("Couldn't read file")...
#![feature(proc_macro_diagnostic)] use proc_macro::TokenStream; use syn::parse_macro_input; use std::convert::TryFrom; pub(crate) type TypeId = usize; mod codegen; mod parsing; mod validation; use parsing::ParseEcs; use validation::ValidatedEcs; #[proc_macro] pub fn create_ecs(input: TokenStream) -> TokenStream {...
// languages have "runtime system" provides an environment in which programs run, addresses issues including layout of memory, how the program accesses variables, // mechanisms for passing parameters between procedures, interfacing with the operating system, so it is reposible things like ( java: garbage collection, g...
trait Trait1 { fn function1(&self); } trait Trait2 { fn function2(&self); } struct Struct { data : i32 } impl Trait1 for Struct { fn function1(&self) { } } impl Trait2 for Struct { fn function2(&self) { } } fn main() { let var1 = Box::new(Struct{data:0}); let var2 = Box::new(St...
use crate::{ unpack_named_slots, widget, widget::{component::containers::size_box::SizeBoxProps, unit::size::SizeBoxNode, WidgetId}, widget_component, widget_hook, }; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct ButtonMessage { #[serde(default)] pu...
use super::{RepositorySnapshots, SnapshotsState}; use crate::{atomic::AtomicUpdate, error::{Error, UnderlyingError}}; use std::path; use std::collections::HashMap; impl RepositorySnapshots { pub const SNAPSHOTS_PATH: &'static str = "snapshots"; /// Initializes the snapshots system based on the current reposit...
use super::organism::room_modeless_boxblock::{self, RoomModelessBoxblock}; use super::organism::room_modeless_character::{self, RoomModelessCharacter}; use super::organism::room_modeless_chat::{self, RoomModelessChat}; use super::organism::room_modeless_craftboard::{self, RoomModelessCraftboard}; use super::organism::r...
//! CoAP context command handlers //! //! Contains actors that handles commands for CoAP endpoint use crate::{error::CoapEndpointError, HEADER_COMMAND}; use actix_rt::time::timeout; use coap_lite::{CoapRequest, CoapResponse, ResponseType}; use drogue_cloud_endpoint_common::command::Commands; use drogue_cloud_service_c...
#[cfg(feature = "_test_fuzzing")] mod test_diffing { use proptest::proptest; use puck_liveview::prelude::{BodyNode, IntoWrappedBodyNode}; proptest! { #[test] fn pt_test_diffing(before: BodyNode, after: BodyNode) { test_diffing_inner(before, after); } } fn test_d...
mod create_record; mod find_record; mod find_user_by_name; mod get_budgets; mod get_records; mod get_user_tags; mod set_user_tags; mod update_record; pub use create_record::CreateRecord; pub use find_record::FindRecord; pub use find_user_by_name::FindUserByName; pub use get_budgets::GetBudgets; pub use get_records::Ge...
#![no_main] #![no_std] use stm32f4::stm32f401; use cortex_m_rt::entry; #[allow(unused_extern_crates)] extern crate panic_halt; // panic handler fn delay() { for _i in 0..25000 { // do nothing } } #[entry] fn main() -> ! { // get peripherals let peripherals = stm32f401::Peripherals::take().unwrap(); // u...
// Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // 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 // // Unl...
use std::fmt::Debug; use std::collections::Bound; use std::collections::range::{RangeArgument as RangeArg}; use std::collections::btree_set::{Range as BRange}; use std::collections::BTreeSet; use std::cmp::{Ordering}; use std::marker::PhantomData; pub mod leapfrog { use super::*; // use super::LUB; pub tr...
mod basic; mod size_limit; pub use basic::MiningBasic; pub use size_limit::TemplateSizeLimit;
// #![allow(unused)] use std::io::BufReader; use std::io::prelude::*; use std::fs::File; fn main() { let mut plan = values(); let rows = plan.len(); let cols = plan[0].len(); for i in 0..rows { for j in 0..cols { print!("{}", plan[i][j]); // print!("{}", adjacent_seats(...
// Generated from swizzle_impl.rs.tera template. Edit the template, not the generated file. use crate::{IVec2, IVec3, IVec4, Vec2Swizzles}; impl Vec2Swizzles for IVec2 { type Vec3 = IVec3; type Vec4 = IVec4; #[inline] fn xx(self) -> IVec2 { IVec2 { x: self.x, y: self....
use std::cmp::Ord; use std::collections::hash_map::DefaultHasher; use std::collections::{HashMap, HashSet}; use std::ffi::CString; use std::hash::BuildHasherDefault; use std::path::PathBuf; use super::{quickcheck, Gen, QuickCheck, TestResult}; #[test] fn prop_oob() { fn prop() -> bool { let zero: Vec<bool...
pub mod transaction_dao; pub mod budget_dao; pub mod account_dao; pub mod search_dao;
pub const CHUNK_SIZE: usize = 10; pub const CHUNK_SIZE_CUBE: usize = CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE; pub const CHUNKS_LOADED: usize = 9; pub const MIN_FORCE: f64 = 0.01; pub const MIN_VELOCITY: f64 = 0.01; pub const MAX_MASS: f64 = 1.0e32; pub const MAX_SPEED: f64 = PHYSICS_C * 0.1; // pub const MAX_MASS: f32 =...
use std::{ marker::PhantomData, ops::{Index, IndexMut} }; use crate::{DataSet, ItemSet}; /// A boolean matrix, for test purposes only. In a real life scenario, one should use a bit /// matrix. #[derive(Clone, PartialEq, Eq, Hash)] pub struct Matrix<I> { data: Box<[bool]>, height: usize, width: usize, phantom: ...
use std::ptr::NonNull; use std::sync::atomic::{AtomicU32, AtomicUsize, Ordering}; pub trait OffsetSequence { fn next(&self, offset: usize) -> usize; } // 提供单调访问的buffer。访问buffer的offset是单调增加的 // 支持多写一读。 pub struct MonoRingBuffer { // 这个偏移量是全局递增的偏移量。不是data内部的偏移量 r_offset: AtomicUsize, // 这个偏移量是全局递增的偏移量。不...
// Do not edit: This code was generated by flatdata's generator. #[allow(missing_docs)] pub mod osm { #[allow(unused_imports)] use flatdata::{flatdata_read_bytes, flatdata_write_bytes}; /// Special value which represents an invalid index. pub const INVALID_IDX: u64 = 1_099_511_627_775; /// Metadata attached to th...
use crate::sketch; pub enum Instruction { Perform(Perform), Done, } pub struct Perform { pub op: Op, pub level_index: usize, pub block_index: usize, pub next: Continue, } pub enum Op { BlockStart { items_count: usize, }, BlockItem { index: usize, }, BlockFinish, } pub struct Cont...
#[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct GetOrgsOrgTeamsSearchResponse { pub data: Option<Vec<crate::team::Team>>, pub ok: Option<bool>, } impl GetOrgsOrgTeamsSearchResponse { /// Create a builder for this object. #[inline] pub fn builder() -> GetOrgsOrgTeamsSearchRespons...
//! An implementation of [MOBI](https://wiki.mobileread.com/wiki/MOBI) format data parsing and manipulation, written in Rust. //! //! The code is available on [GitHub](https://github.com/wojciechkepka/mobi-rs) //! //! License: [*Apache-2.0*](https://github.com/wojciechkepka/mobi-rs/blob/master/license) //! mod lz77; us...
use std::fs::ReadDir; use types::Identifier; pub(crate) struct Library; /// Grabs all `Library` entries found within a given directory pub(crate) struct LibraryIterator { directory: ReadDir, } impl LibraryIterator { pub(crate) fn new(directory: ReadDir) -> LibraryIterator { LibraryIterator { directory } } } ...
mod types; use super::errors::*; use crate::infrastructure::{config, repositories, security}; use types::*; use unicode_segmentation::UnicodeSegmentation; pub struct Query; #[juniper::object(Context = Context)] impl Query { // FIXME: Extract domain and repository logic to own module /// Login a user. fn l...
#[doc = "Reader of register SPD"] pub type R = crate::R<u32, super::SPD>; #[doc = "Writer for register SPD"] pub type W = crate::W<u32, super::SPD>; #[doc = "Register SPD `reset()`'s with value 0"] impl crate::ResetValue for super::SPD { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
use super::{ModInfo, Queriable}; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] pub struct Md5Search { pub results: Md5Results, } #[derive(Serialize, Deserialize)] pub struct Md5Results { pub r#mod: ModInfo, // Needs to be named "mod" for serialization to succeed pub file_details: ...
use std::sync::Arc; use crate::{ _utils::{ error::EmailError, string::{escape_double_quote, escape_new_line, escape_new_line_with_br}, }, config::service::{ConfigService, Stage}, }; pub struct EmailService { config_service: Arc<ConfigService>, } impl EmailService { pub fn new(config_service: Arc<Co...
#![feature(test)] extern crate extended_collections; extern crate test; use extended_collections::arena::Entry; use extended_collections::arena::TypedArena; use test::Bencher; const CHUNK_SIZE: usize = 1024; const NUM_OF_ALLOCATIONS: usize = 100; #[bench] fn bench_arena(b: &mut Bencher) { struct Test { ...
///////////////////////////////////////////////////////////////////////////// // trait ColorElement ///////////////////////////////////////////////////////////////////////////// /// A type that represents a single channel in a color value. pub trait ColorElement: Copy + Default { const ZERO: Self; const SATURATED: S...
/* * 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 */ /// SlackIntegrationChannelDisplay : Configuration options for what is shown in an alert event message. ...
use std::io; use std::os::unix::net::{self, SocketAddr}; use std::sync::atomic::Ordering; #[cfg(feature = "io_cancel")] use crate::coroutine_impl::co_cancel_data; use crate::coroutine_impl::{is_coroutine, CoroutineImpl, EventSource}; use crate::io::sys::{co_io_result, IoData}; use crate::io::{AsIoData, CoIo}; use crat...
use proconio::{fastout, input}; use std::collections::HashMap; #[fastout] fn main() { input! { n: i64, } let root_n: i64 = (n as f64).sqrt().floor() as i64; let mut ans = 0; for i in 1..=root_n { let sums = ((n / i) * (n / i + 1)) / 2 - (i * (i - 1)) / 2; ans += 2 * sums * i...
use std::fs; fn main() { let input = fs::read_to_string("./input.txt").unwrap_or_default(); let mut acc: i32 = 0; for a in input.chars() { acc += match a { '(' => 1, ')' => -1, _ => 0 }; } dbg!(acc); }
extern crate pest; #[macro_use] extern crate pest_derive; extern crate chrono; pub mod day_selector; pub mod extended_time; pub mod parser; #[macro_use] pub mod schedule; pub mod time_domain; pub mod time_selector; mod utils; #[cfg(test)] mod tests; pub use parser::parse;
#[macro_use] extern crate extra; use extra::io::WriteExt; use std::collections::HashMap; use std::io::{self, BufRead, BufReader, Write}; use std::mem; /// The number of factors. const FACTORS: usize = 7; /// Construct a dependency in a struct-like manner. macro_rules! dep { { gdp: $gdp:expr, agb...
#![recursion_limit = "64"] use std::env; use aoc20::days; fn main() { println!("Advent of Code 2020"); let args: Vec<String> = env::args().collect(); if args.len() < 2 { println!("Missing input day"); std::process::exit(1); } let (day, dayargs) = (&args[1], &args[2..]); match d...
use super::{Token, FilterTypedKeyValuePairs, TokenType, TokenReader}; /// Applies convenience constructors to all `Iterator<Item=Token>` types pub trait IteratorExt: Iterator<Item=Token> { /// Returns an Iterator which filters key=value pairs, if `value.kind` matches /// the given `token_type`. /// /...
pub mod ctrl { pub mod enable { pub fn get() -> u32 { unsafe { core::ptr::read_volatile(0xE000E010u32 as *const u32) & 0x1 } } pub fn set(val: u32) { unsafe { let mut reg = core::ptr::read_volatile(0xE000E010u32 as *const u...
// Copyright (C) 2019-2021 Parity Technologies (UK) Ltd. // Copyright (C) 2021 Subspace Labs, Inc. // 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 // ...
mod game; mod util; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::sync::{Arc, Mutex}; use std::time::{SystemTime, UNIX_EPOCH}; use std::{ thread, time::{Duration, Instant}, }; use ws::{listen, CloseCode, Handler, Message, Result, Sender}; #[derive(Serialize, Deserialize, Debug, D...
extern crate irc; extern crate futures; extern crate time; extern crate regex; #[macro_use] extern crate lazy_static; extern crate rand; use rand::prelude::*; use irc::client::prelude::*; use tokio::timer::Interval; use futures::{stream, Stream}; use std::time::Duration; mod parse; use core::ops::Add; use regex::Regex...
const LN2: f64 = 0.693147180559945; const SQUARE_LN2: f64 = 0.480453013918201; pub struct Bloom { bits: u32, hashes: i32, bf: Vec<u8>, ready: bool } impl Bloom { pub fn new<'a>(entries: i32, error_rate: f64) -> Result<Bloom, &'a str> { if entries < 1 || error_rate <= 0.0 || error_rate >= 1...
/* * 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 */ /// SyntheticsLocation : Synthetic location that can be used when creating or editing a test. #[deriv...
use std::error::Error; use std::path::Path; use clap::{AppSettings, Clap}; use simple_logger::SimpleLogger; use crate::qsv::{ execute_analysis, execute_query, execute_statistics, write_to_stdout, write_to_stdout_with_header, Options, }; mod csv; mod db; mod parser; mod qsv; #[derive(Clap)] #[clap( versi...
//! check input extern crate chrono; extern crate csv; extern crate enumflags2; extern crate itertools_num; extern crate num; extern crate printpdf; use self::enumflags2::BitFlags; use crate::data::create_limits_file; use crate::group::GroupBy; use crate::pdf::Paper; use crate::qtable::{default_columns, Align, Column,...
extern crate rand; mod entry; mod tests; use self::rand::Rng; use self::rand::distributions::{Distribution, WeightedIndex, WeightedError}; use self::entry::Entry; use std::fs::{read_dir, ReadDir, File, OpenOptions}; use std::io::{BufRead, BufReader, Write, stdin, stdout}; use std::path::Path; const BOX_DEFAULT_CAPAC...
use rustcc1::exercises::ex1; use rustcc1::exercises::ex2; use rustcc1::exercises::ex3; use rustcc1::exercises::ex4; use rustcc1::exercises::ex5; use rustcc1::exercises::ex6; use rustcc1::exercises::ex7; use rustcc1::exercises::ex8; // use rustcc1::final_project; fn main() { ex1::main(); ex2::main(); ex3::m...
extern crate pest; #[macro_use] extern crate pest_derive; use std::fs; use pest::iterators::Pair; use pest::Parser; use crate::ast::*; mod ast; #[derive(Parser)] #[grammar = "grammar.pest"] pub struct JSParser; fn parse_program(pair: Pair<Rule>) -> JSProgram { match pair.as_rule() { Rule::program => JS...
use actix_web::{web, HttpResponse, Responder}; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; use std::convert::TryFrom; use std::io::{self, ErrorKind}; use std::path::Path; mod converters; pub mod descriptions; pub mod echoinfo; pub mod hex; pub mod line_driver; mod lineproto; use con...
use rand::distributions::{Distribution, Uniform}; #[derive(Debug, PartialEq)] enum OddEven { Odd, Even, } #[derive(Debug, PartialEq)] enum RedBlack { Red, Black, } // Roulette bet types as defined in: https://en.wikipedia.org/wiki/Roulette#Types_of_bets #[derive(Debug, PartialEq)] enum BetType { ...
// This file is part of Substrate. // Copyright (C) 2018-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...
use super::*; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub enum Stmt { Expr { expr: Expr, semicolon: Option<Semicolon>, }, Let { kw_let: KwLet, pat: Pat, ascription: Option<Ascription>, eq: Eq, expr: Expr, semicolon: Semicolon, }, ...
use super::*; use stainless_ffmpeg::video_decoder::VideoDecoder; #[derive(Clone, Debug, Deserialize, PartialEq, Serialize)] pub enum VideoFilter { Crop(RegionOfInterest), Resize(VideoScaling), Format(VideoFormat), Generic(GenericFilter), } impl VideoFilter { pub fn as_generic_filter(&self, video_decoder: &V...
use crate::{common::Solution, reparse}; use lazy_static::lazy_static; use regex::Regex; use std::str::FromStr; use std::string::ParseError; lazy_static! { static ref PARSE_PATTERN: Regex = Regex::new(r"(\d+)-(\d+) (\w): (\w+)").unwrap(); } struct PasswordCheck { min: usize, max: usize, character: char...
#[doc = "Register `CR` reader"] pub type R = crate::R<CR_SPEC>; #[doc = "Register `CR` writer"] pub type W = crate::W<CR_SPEC>; #[doc = "Field `TXMODE` reader - Type of Tx packet Writing the bitfield triggers the action as follows, depending on the value: Others: invalid From V1.1 of the USB PD specification, there is ...
use super::*; use serde::Serialize; use serde_bolt::to_value; fn ser<T: PartialEq + Debug + Serialize>(value: &T, expected: &Value) { let result = to_value(value); assert!(result.is_ok()); assert_eq!(&result.unwrap(), expected); } #[test] fn unit() { ser(&(), &Value::Null); } #[test] fn bool() { ...
use std::net::{SocketAddr, ToSocketAddrs}; pub fn host_addr(uri: &http::Uri) -> Option<SocketAddr> { uri.authority().and_then(|auth| { auth.as_str() .to_socket_addrs() .expect("Unable to parse connect header") .next() }) }
use std::ops::{Deref, DerefMut}; use std::sync::Arc; use std::collections::HashMap; use num::{BigInt, ToPrimitive}; use itertools::Itertools; use crate::parser::ast::{SExpr, SExprKind, Atom}; use crate::util::ArcString; use super::super::{AtomID, Span, Elaborator, ElabError, ObjectKind}; use super::*; use super::super:...
extern crate sdl2; pub struct Input { up: bool, down: bool, left: bool, right: bool, inventory: bool, } impl Input { pub fn new() -> Input { Input { up: false, down: false, left: false, right: false, inventory: false, ...
extern crate serde; #[macro_use] extern crate serde_derive; extern crate sevent; extern crate mio_more; extern crate lazycell; use std::io; use std::io::BufRead; use std::io::Write; use std::thread; use std::sync::mpsc; use lazycell::LazyCell; use mio_more::channel; use sevent::iobuf::IoBuffer; #[derive(Serialize,...
use std::{ collections::BTreeMap, time::{Instant, SystemTime}, }; use sentry_core::{ protocol::{self, Breadcrumb, TraceContext, TraceId, Transaction, Value}, types::Uuid, Envelope, Hub, }; use tracing_core::{span, Event, Level, Metadata, Subscriber}; use tracing_subscriber::{ layer::{Context, L...
use crate::{ bson::{doc, Document}, change_stream::{event::ResumeToken, ChangeStreamData, WatchArgs}, cmap::{Command, RawCommandResponse, StreamDescription}, cursor::CursorSpecification, error::Result, operation::{append_options, OperationWithDefaults, Retryability}, options::{ChangeStreamOp...
extern crate lodepng; extern crate rgb; extern crate argparse; mod ffmpeg; mod transition; use std::process::exit; use argparse::{ArgumentParser, Store, List, Print}; use transition as ts; use ffmpeg::Render; fn main() { // transition values let mut transitions: Vec<f32> = vec![0.0, 1.0, 1.0, 0.0]; //...
//! 线形映射出现在KNRNEL //! 不能全部线性,由此基于Page分配出现用户 //! enum and struct 封装内存段映射的类型和其本身 //! 映射类型 [`MapType`] 和映射片段 [`Segment`] use crate::memory::{address::*, mapping::Flags, range::Range}; // ********************************************************** /// 映射的类型 //#[derive(Debug)] // 23 | pub map_type: MapType, // | ...
use backend::*; use backend::errors::*; use backend::for_context::ForContext; use backend::models as m; use codeviz::python::*; use naming::{self, FromNaming}; use options::Options; use std::collections::HashMap; use std::collections::hash_map::Entry; use std::fs::File; use std::fs; use std::io::Write; use std::path::P...
// More advanced server example. // This is supposed to look like a D-Bus service that allows the user to manipulate storage devices. // Note: in the dbus-codegen/example directory, there is a version of this example where dbus-codegen // was used to create some boilerplate code - feel free to compare the two example...
//! This module contains all the logic dealing with images: //! Parsing the config file data, shuffling pixels of big images, //! ordering pixels of small images and sorting the signatures to the end. use crate::ascii_art::DEFAULT_IMAGES; use crate::ascii_art::IMAGE_KNOWN_SIGNATURES; use crate::dictionary::ConfigParse...
extern crate proc_macro; use std::str::FromStr; use proc_macro_hack::proc_macro_hack; use quote::quote; use syn::parse_macro_input; macro_rules! impl_hack { ($name:ident, $type:ident) => { #[proc_macro_hack] pub fn $name(input: proc_macro::TokenStream) -> proc_macro::TokenStream { ...
// Import hacspec and all needed definitions. use hacspec_lib::*; use crate::ec::arithmetic::{self, Affine}; public_nat_mod!( type_name: FieldElement, type_of_canvas: FieldCanvas, bit_size_of_field: 384, modulo_value: "FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF00000000000...
use std::collections::HashMap; use std::collections::HashSet; fn main() { proconio::input! { n: usize, w: i32, h: i32, a: [i32; n], m: usize, xy: [(i32, i32); m], s: String, } let cs: Vec<char> = s.chars().collect(); let pb: Vec<String> = cs.iter().map(|x| x.to_s...
extern crate openssl; extern crate toml; #[macro_use] extern crate serde_derive; extern crate clap; extern crate regex; #[macro_use] extern crate byteorder; extern crate anyhow; extern crate dirs; extern crate globset; extern crate self_update; use anyhow::{anyhow, format_err, Context, Error}; use clap::{Arg}; use f...
use std::collections::{HashSet}; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; use std::io::Write; use std::sync::mpsc::Receiver; use crate::{Method, Style}; use crate::block::Block; fn calculate_hash<T: Hash>(t: &T) -> String { let mut s = DefaultHasher::new(); t.hash(&mut s)...
use serde::{Deserialize, Serialize}; use std::collections::HashMap; use pasture_core::{ math::AABB, nalgebra::{Matrix4, Vector3}, }; /// 3D Tiles refinement strategy #[derive(Copy, Clone, Serialize, Deserialize, PartialEq, Eq, Debug)] pub enum Refinement { /// Refine by replacing the tileset #[serde(r...
use std::convert::TryFrom; use syn::{Error, Result}; use syn::ExprLit; use quote::quote; use crate::{ glsl::Glsl, yasl_type::{Typed, YaslScalarType, YaslType}, }; #[derive(Debug)] pub struct YaslExprLit { lit: syn::Lit, } impl Typed for YaslExprLit { fn get_type(&self) -> Option<YaslType> { ...
use xml::Element; use ::{ElementUtils, NS, Person, ViaXml}; /// [The Atom Syndication Format § The "atom:contributor" Element] /// (https://tools.ietf.org/html/rfc4287#section-4.2.3) #[derive(Default)] pub struct Contributor(pub Person); impl ViaXml for Contributor { fn to_xml(&self) -> Element { let m...
use crate::datetime::{get_weekday_val, DTime}; use crate::parse_options::parse_options; use chrono::prelude::*; use chrono_tz::{Tz, UTC}; use serde::{Deserialize, Serialize}; use std::error::Error; use std::fmt::{Display, Formatter}; #[derive(Serialize, Deserialize, Debug, PartialEq, PartialOrd, Clone)] pub enum Frequ...
use crate::common::*; pub(crate) trait Keyed<'key> { fn key(&self) -> &'key str; } impl<'key, T: Keyed<'key>> Keyed<'key> for Rc<T> { fn key(&self) -> &'key str { self.as_ref().key() } }
// TODO write a better description here //! Template stuff //! #![deny( missing_docs, missing_debug_implementations, missing_copy_implementations, trivial_casts, trivial_numeric_casts, dead_code, unsafe_code, unstable_features, unused_import_braces, unused_qualifications )] #[do...
#![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)] DatabaseAccounts_Get(#[from] database...
/* Known mishandled cases: macro_rules! a { ($x:type) => { foo(x: y as $x < z) } // correct parse depends on whether $x is a type or ident } */ use std::mem::{replace, size_of, transmute}; use std::slice; use std::ptr; use std::str; #[cfg(not(feature = "println_spam"))] macro_rules! if_println_spam { {$($stuf...
#![allow(clippy::needless_lifetimes)] #[rustversion::since(1.51)] #[multiversion::multiversion(targets( "x86_64+avx2+avx", "x86_64+avx", "x86+avx2+avx", "x86+avx", "x86+sse" ))] fn pass<'a>(x: &'a i32) -> &'a i32 { x } #[rustversion::since(1.51)] #[multiversion::multiversion(targets( "x86_...
// This file was generated mod path_private { pub trait Sealed { } } /// Extension for [`Path`](std::path::Path) pub trait IsntPathExt: path_private::Sealed { /// The negation of [`is_absolute`](std::path::Path::is_absolute) #[must_use] fn is_not_absolute(&self) -> bool; /// The negation of [`is_relat...
/// An enum to represent all characters in the Devanagari block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Devanagari { /// \u{900}: 'ऀ' SignInvertedCandrabindu, /// \u{901}: 'ँ' SignCandrabindu, /// \u{902}: 'ं' SignAnusvara, /// \u{903}: 'ः' SignVisarga, /// \u{9...
use crate::{ generate, green::{GBranchData, GGlobalData, GRangeUnit, GreenNode, GreenTree}, range::Range, red::{RedNode, RedPtr}, root::{OwnedRoot, RefRoot, RootOwnership, TreeRoot}, Direction, LeafAtOffset, WalkEvent, }; use core::{ hash::{Hash, Hasher}, iter::from_fn, ops::Range as...
use crate::common::*; use anyhow::{bail, Result}; use serde::{Deserialize, Serialize}; use serde_aux::prelude::*; use std::str; #[derive(Serialize, Deserialize, Debug)] pub struct UserGroup { #[serde(deserialize_with = "deserialize_number_from_string")] guid: GroupId, } #[derive(Serialize, Deserialize, Debug)...
use serde::{Deserialize, Serialize}; #[derive(Debug, Clone)] pub enum FileContent { Text(String), Binary(Vec<u8>), } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Config { #[serde(default)] pub templates: Vec<Template>, } #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Templat...