text
stringlengths
8
4.13M
//! Utilities for tracking time. //! //! This module provides a number of types for executing code after a set period of time. //! //! See [`tokio::time` module] for full documentation. //! //! [`tokio::time` module]: https://docs.rs/tokio/1.0.1/tokio/time/index.html pub use actix_rt::time::*;
extern crate amethyst; #[macro_use] extern crate serde; extern crate ron; extern crate serde_json; #[macro_use] extern crate log; pub extern crate crossterm; pub extern crate dirty; extern crate fern; pub extern crate partial_function; pub extern crate rand; //extern crate roman; #[macro_use] extern crate lazy_static; ...
use clap::{clap_app}; use baelte::new::{generate_new_application, generate_files}; fn main() { let matches = clap_app!(myapp => (version: env!("CARGO_PKG_VERSION")) (author: "Kenneth Larsen <hello@kennethlarsen.org>") (about: "CLI tool for Svelte") (@subcommand new => (ab...
#[global_allocator] static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc; use ntex::http::header::{HeaderValue, CONTENT_TYPE, SERVER}; use ntex::{http, util::Bytes, web}; use yarte::Serialize; mod utils; #[derive(Serialize)] pub struct Message { pub message: &'static str, } #[web::get("/json")] async fn json(...
// Copyright (c) 2020 DarkWeb Design // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publish...
use std::borrow::Cow; use super::map::MapMutator; use crate::{DefaultMutator, Mutator}; impl<T> DefaultMutator for Cow<'static, T> where T: DefaultMutator + Clone + 'static, { type Mutator = impl Mutator<Cow<'static, T>>; #[no_coverage] fn default_mutator() -> Self::Mutator { MapMutator::new(...
use crate::types_impl::lob::CharLobSlice; use crate::{HdbError, HdbResult}; pub(crate) fn io_error<E>(error: E) -> std::io::Error where E: Into<Box<dyn std::error::Error + Send + Sync>>, { std::io::Error::new(std::io::ErrorKind::Other, error) } // --- CESU8 Stuff --- // // Consumes the cesu8 bytes, returns a...
#[doc = "Description cluster[n]: Channel n event end-point"] pub struct EEP { register: ::vcell::VolatileCell<u32>, } #[doc = "Description cluster[n]: Channel n event end-point"] pub mod eep; #[doc = "Description cluster[n]: Channel n task end-point"] pub struct TEP { register: ::vcell::VolatileCell<u32>, } #[d...
pub mod context; pub mod error; pub mod security; pub mod tools; pub mod protocol; type Result<T> = error::Result<T>;
#[doc = "Writer for register DMAMUX_RGCFR"] pub type W = crate::W<u32, super::DMAMUX_RGCFR>; #[doc = "Register DMAMUX_RGCFR `reset()`'s with value 0"] impl crate::ResetValue for super::DMAMUX_RGCFR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Write proxy f...
/// Prints what CPU features are used by the compiler by default. /// /// Script from: /// - <https://stackoverflow.com/questions/65156743/what-target-features-uses-rustc-by-default> /// - <https://gist.github.com/AngelicosPhosphoros/4f8c9f08656e0812f4ed3560e53bd600> // This script prints all cpu features which active...
//! Memory allocation. use std::alloc::{GlobalAlloc, Layout}; /// An allocator that can be used as the Rust global allocator. /// /// Rust allocations will use Max's sysmem_newptr and sysmem_freeptr to allocate and deallocate /// memory. /// /// See the [global allocators documentation](https://doc.rust-lang.org/edit...
use crate::actor_proxy::ActorProxy; use crate::envelope::ManagerEnvelope; use crate::system::AddressBook; use crate::Actor; use async_std::{ sync::{channel, Arc, Receiver, Sender}, task::spawn, }; use dashmap::DashMap; use std::fmt::Debug; pub(crate) trait Manager: Send + Sync + Debug { fn end(&self); } #...
mod packets; use crate::packets::GettableEndPoints; use clap::Clap; use log::{error, info}; use pnet::datalink::{self, Channel::Ethernet}; use pnet::packet::{ ethernet::{EtherTypes, EthernetPacket}, ip::IpNextHeaderProtocols, ipv4::Ipv4Packet, ipv6::Ipv6Packet, tcp::TcpPacket, udp::UdpPacket, ...
use crate::Vector3; use crate::StaticObject; #[derive(Serialize, Deserialize, PartialEq, Debug, Clone)] pub struct SendStaticObject { pub pos: Vector3, pub size: Vector3, pub hitbox_scale: Vector3, pub model: String, } impl SendStaticObject { pub fn to_static_object(&self) -> StaticObject { StaticObjec...
// Quiet diesel warnings https://github.com/diesel-rs/diesel/issues/1785 #![allow(proc_macro_derive_resolution_fallback)] // Force these as errors so that they are not lost in all the diesel warnings #![deny(unreachable_patterns)] #![deny(unknown_lints)] #![deny(unused_variables)] #![deny(unused_imports)] // Unused res...
use codeframe::{capture_codeframe, Color}; use k9::*; macro_rules! get_codeframe { () => {{ let codeframe = capture_codeframe!(Color::Blue); codeframe }}; } macro_rules! get_codeframe_with_default_color { () => {{ let codeframe = capture_codeframe!(); codeframe }}; } ...
// Crates extern crate rusty_bot; // Use use rusty_bot::irc::*; fn main() { let config = irc::Config { nick: "rusty_the_bot".to_string(), server_address: "chat.freenode.com:6667".to_string(), channels_to_join: vec!["#bbtest".to_string()], }; let server = irc::Server::connect(config...
#[doc = "Reader of register DSI_LCCCR"] pub type R = crate::R<u32, super::DSI_LCCCR>; #[doc = "Reader of field `COLC`"] pub type COLC_R = crate::R<u8, u8>; #[doc = "Reader of field `LPE`"] pub type LPE_R = crate::R<bool, bool>; impl R { #[doc = "Bits 0:3 - Color Coding"] #[inline(always)] pub fn colc(&self)...
//! This crate provides the `hex!` macro for converting hexadecimal string literals //! to a byte array at compile time. //! //! # Examples //! ``` //! use hexlit::hex; //! //! fn main() { //! const DATA: [u8; 4] = hex!("01020304"); //! assert_eq!(DATA, [1, 2, 3, 4]); //! assert_eq!(hex!("a1b2c3d4"), [0xA1, 0xB2, 0xC3,...
use crate::constants; use bytes::{Bytes, BytesMut}; use futures::stream::Stream; use std::pin::Pin; use std::task::{Context, Poll}; pub(crate) struct StreamBuffer { pub(crate) eof: bool, pub(crate) buf: BytesMut, pub(crate) stream: Pin<Box<dyn Stream<Item = Result<Bytes, crate::Error>> + Send>>, pub(cr...
//! Filter on choices. use crate::ir::{self, Adaptable, SetRef}; use fxhash::{FxHashMap, FxHashSet}; use itertools::Itertools; use std; use std::collections::BTreeSet; use utils::*; /// Filters the set valid values. #[derive(Debug, Clone)] pub struct Filter { /// The variables on which the filter depends. pub ...
use crate::buffer::StreamBuffer; use std::task::Waker; pub(crate) struct MultipartState { pub(crate) buffer: StreamBuffer, pub(crate) boundary: String, pub(crate) stage: StreamingStage, pub(crate) is_prev_field_consumed: bool, pub(crate) next_field_waker: Option<Waker>, pub(crate) next_field_id...
extern crate lib; pub fn main() { lib::hello(); }
use crate::{ core::{error::Error, frame_buffer::FrameBuffer}, deep::{ deep_scan_line_input_file::DeepScanLineInputFile, deep_scan_line_input_part::DeepScanLineInputPart, }, }; use imath_traits::Bound2; use openexr_sys as sys; type Result<T, E = Error> = std::result::Result<T, E>; /// Allow...
// 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 according to those terms. use crate::lexer::preproc...
use hashbrown::{HashMap, HashSet}; use std::iter::FromIterator; use utils::interval_tree::{Interval, IntervalTree}; use std::{collections::binary_heap::Iter, unimplemented}; struct Ticket { values: Vec<usize>, } // #[test] pub fn run() { let input = read_input(include_str!("input/day16.txt"), 500); print...
{{#>set_constraints constraints~}} {{>filter_call body}} {{/set_constraints~}}
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct EyesPose(pub ::windows::core::IInspectable); i...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::storage::{ColumnFamilyName, KeyCodec, ValueCodec, WriteOp}; use anyhow::Result; use std::collections::{BTreeMap, HashMap}; #[derive(Debug, Default, Clone)] pub struct WriteBatch { pub rows: HashMap<ColumnFamilyName, ...
use bson; use bson::{Bson, DecoderError, EncoderError}; use mongo_driver::MongoError as MongoDriverError; use mongo_driver::client::{ClientPool, Uri}; use mongo_driver::collection::UpdateOptions; use mongo_driver::flags::UpdateFlag; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fmt::Debu...
use std::fs; use std::io; pub fn load_input(path: &str) -> Result<String, io::Error> { let data = fs::read_to_string(path)?; Ok(data.trim_end().to_string()) }
#[doc = "Reader of register ACTRL"] pub type R = crate::R<u32, super::ACTRL>; #[doc = "Writer for register ACTRL"] pub type W = crate::W<u32, super::ACTRL>; #[doc = "Register ACTRL `reset()`'s with value 0"] impl crate::ResetValue for super::ACTRL { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use std::cmp::Ordering; use std::path::Path; use std::str::FromStr; use std::sync::Arc; // use anyhow::{anyhow, Context, Error}; use crate::error::Error; use chrono::naive::NaiveDate; use chrono::Duration; use serde::{de::DeserializeOwned, Serialize}; use sled::IVec; use crate::fetcher::{self, Currency, Date}; pub f...
use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::higher; use clippy_utils::SpanlessEq; use if_chain::if_chain; use rustc_ast::ast::LitKind; use rustc_errors::Applicability; use rustc_hir::{lang_items::LangItem, BinOpKind, Expr, ExprKind, QPath, StmtKind}; use rustc_lint::{LateContext, LateLintPass};...
use input_i_scanner::InputIScanner; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; (($($t: ty),...
extern crate libc; use self::libc::{uint8_t}; #[allow(non_camel_case_types)] pub enum Pin { PI_GPIO_P1_03, PI_GPIO_P1_05, PI_GPIO_P1_07, PI_GPIO_P1_08, PI_GPIO_P1_10, PI_GPIO_P1_11, PI_GPIO_P1_12, PI_GPIO_P1_13, PI_GPIO_P1_15, PI_GPIO_P1_16, PI_GPIO_P1_18, PI_GPIO_P1_19...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)]...
use std::iter::IntoIterator; use std::iter::Iterator; pub struct NewStruct<T> { field1: T, field2: T, field3: T, field4: T, field5: T, } pub struct NewStructIterRef<'a,T> where T: 'a { count: usize, new_struct: &'a NewStruct<T>, } impl<'a,T> IntoIterator for &'a NewStruct<T> ...
use std::fmt::Display; use async_trait::async_trait; use data_types::{CompactionLevel, ParquetFile, ParquetFileId, ParquetFileParams, PartitionId}; use observability_deps::tracing::info; use super::{Commit, Error}; #[derive(Debug)] pub(crate) struct LoggingCommitWrapper<T> where T: Commit, { inner: T, } imp...
mod form_hashmap; pub use self::form_hashmap::FormHashMap;
fn main(){ println!("Helloe World!"); }
use proconio::input; use std::mem; fn main() { input! { a: isize, b: isize, c: isize, } let r = gcd(a, gcd(b, c)); println!("{}", (a / r) + (b / r) + (c / r) - 3); } fn gcd(mut a: isize, mut b: isize) -> isize { if b > a { mem::swap(&mut a, &mut b); } if a % b == 0 { return b; ...
use input_i_scanner::{scan_with, InputIScanner}; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); let s = scan_with!(_i_i, String); if s.ends_with("er") { println!("er"); } else { println!("ist"); } }
pub struct Test<'a> { pub name: &'a str, pub input: Input<'a>, } // #[derive(Clone, Debug)] pub enum Input<'a> { Static(&'static str), AString(String), Reader(Box<dyn std::io::BufRead + 'a>), } pub type Tests<'a> = Vec<Test<'a>>; use crate::data; pub fn get_tests() -> Tests<'static> { return...
// 2重累積和と2部探索 use std::cmp::{max, min}; use std::collections::{BinaryHeap, HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; fn main() { let (n, k): (usize, usize) = parse_line().unwrap(); let mut aaa: Vec<Vec<u64>> = vec![]; for _ in 0..n { let line = parse_line().unwrap();...
#[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::STARTERP1 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w...
// 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 ...
use std::collections::hash_map::Entry; use std::collections::HashMap; use std::iter; use std::mem; use std::ops::AddAssign; use crate::renderers::Renderer; const EPSILON: f64 = 1.0e-9; fn is_zero(value: f64) -> bool { value.abs() < EPSILON } macro_rules! pairify { ($function:ident) => { |(left, righ...
// Copyright (c) 2014 Michael Woerister // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to deal // in the Software without restriction, including without limitation the rights // to use, copy, modify, merge, publis...
use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Debug)] pub struct AddItemsParam { pub item_names: Vec<String>, }
use crate::auth; use crate::diesel::QueryDsl; use crate::diesel::RunQueryDsl; use crate::handlers::types::*; use crate::model::{NewUserTask, Space, SpaceUser, User, UserTask}; use crate::schema::spaces::dsl::*; use crate::schema::spaces_users::dsl::space_id as space_space_id; use crate::schema::spaces_users::dsl::user_...
use approx::relative_ne; use nalgebra::{Complex, DMatrix, DVector}; use rand::prelude::*; use std::convert::TryInto; use std::f64::consts::*; use std::mem::swap; mod helpers { use super::*; pub fn half_angle_factors(angle: f64) -> (C64, C64) { let half_angle = angle / 2.0; ( C64::n...
use io::Read; use std::{env, fs, io}; mod opcode; use opcode::Opcode; fn main() -> Result<(), String> { let filename = env::args().nth(1).ok_or("Please provide a filename")?; let metadata = fs::metadata(&filename).or(Err("Could not read file metadata"))?; let mut file = fs::File::open(filename).or(Err("Co...
//! A mapping of component ids to glyphs that contain that id //! //! this is used to invalidate glyphs appropriately when components change use std::borrow::Cow; use std::collections::HashMap; use std::sync::Arc; use druid::kurbo::{Affine, BezPath}; use druid::Data; use norad::{Glyph, GlyphName, Ufo}; const PRE_CAC...
pub const API_KEY: &str = "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9";
use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let a: Vec<u32> = rd.get_vec(3); let mut a = a; a.sort(); let ans = a[1..].iter().sum::<u32>(); println!("{}", ans); }
use crate::discovery::create_jwk_set; use actix_4_jwt_auth::{ AuthenticatedUser, Oidc, OidcConfig, OidcBiscuitValidator, biscuit::Validation }; use actix_web::{web, Error, HttpResponse}; use biscuit::jws::*; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::str; #[derive(Debug, PartialEq, C...
//! The `io_uring` library for Rust. //! //! The crate only provides a summary of the parameters. //! For more detailed documentation, see manpage. #![allow( non_camel_case_types, non_upper_case_globals, dead_code, non_snake_case )] #[macro_use] pub mod util; pub mod cqueue; pub mod opcode; mod register; pub mod sque...
//! Authentication features. /// Secure password handling pub mod pw; /// Request guard which checks that a valid authorization token was provided pub mod token;
#![feature(concat_idents)] #![feature(plugin)] #![plugin(regex_macros)] #[cfg(feature = "postgres")] extern crate postgres; #[cfg(feature = "postgres")] extern crate r2d2; #[cfg(feature = "postgres")] extern crate r2d2_postgres; extern crate time; extern crate regex; extern crate deuterium; extern crate byteorder; e...
use std::cmp::PartialEq; use std::ops::{Add, Div, Mul, Sub}; pub trait One { fn one() -> Self; } pub trait Zero { fn zero() -> Self; } impl One for i32 { fn one() -> Self { 1 } } impl Zero for i32 { fn zero() -> Self { 0 } } impl One for u8 { fn one() -> Self { 1...
use std::collections::hash_map::HashMap; use std::convert::TryInto; use std::fmt; use crate::battle_snake::structs::{POSSIBLE_MOVES, GameEnvironment, Move, Point, Snake}; #[derive(Clone)] pub enum SpaceType { Snake, Food, } #[derive(Clone)] pub struct Space { space_type: SpaceType, snake_id: Option<String>, ...
use std::fmt; use std::ops::Deref; use firefly_binary::{BinaryEntrySpecifier, Endianness}; use firefly_intern::Symbol; use firefly_number::{BigInt, Sign}; use paste::paste; use crate::dialect::llvm; use crate::ir::*; use crate::support::StringRef; /// Primary builder for the CIR dialect /// /// Wraps mlir::OpBuilder...
use { rough::noise::{fns::PerlinNoise, utils::*, NoiseArgs, Seed}, std::sync::Arc, }; fn main() { for seed in &[Seed::default(), Seed::new(2929)] { let args = NoiseArgs::new(*seed); let perlin = Arc::new(PerlinNoise::new(args)); PlaneMapBuilder::new(perlin) .set_x_bounds...
use core::ops::Add; use core::ops::Mul; pub trait Sequence<F>: Default + Clone + PartialEq + Add<Output = Self> + Mul<Output = F> where F: Sequence<F> { fn depth() -> u8; fn rotated(&self, other: &Self, inv: bool, bits: u8) -> Self; fn rotated_cyclic(&self, inv: bool, bits: u8) -> Self { self.rot...
fn main() { println!("Hello, world!"); another_func(); param_func(5); scopes_are_expressions(); let _five = five(); println!("Adding 1 to 5 is {}", add_one(_five)); let _empty_tuple = (); } fn another_func() -> () { println!("Another function"); } fn param_func(i: i32) { pri...
struct SummaryRanges { root: Tree, } impl SummaryRanges { fn new() -> SummaryRanges { SummaryRanges { root: None } } fn add_num(&mut self, val: i32) { self.root = add(self.root.take(), val); } fn get_intervals(&self) -> Vec<Vec<i32>> { let mut res = Vec::new(); w...
use std::fs::File; use std::io::prelude::*; use std::collections::HashMap; use rustc_serialize::json; #[derive(Debug, RustcDecodable)] pub struct ComposerVendorJson { pub packages : HashMap<String, HashMap<String, ComposerVendorJsonPackageVersion>> } #[derive(Debug, RustcDecodable)] pub struct ComposerVendorJso...
use crate::{errors::*, misc, tag::Tag, FIELD_TERMINATOR}; #[derive(Debug, Clone, PartialEq, Eq)] pub struct Directory { pub entries: Vec<(Tag, usize, usize)>, } impl Directory { pub fn parse(input: &[u8]) -> Result<Directory> { let mut entries = Vec::with_capacity(16); for chunk in input.chunk...
use nom::{ bytes::complete::take, combinator::{map, map_res}, multi::many_m_n, IResult, }; use rskafka_wire_format::{error::ParseError, parse_helpers, prelude::*, VarInt}; use std::borrow::Cow; #[derive(Debug, Clone, Eq, PartialEq)] pub struct RecordBatch<'a> { pub base_offset: i64, pub batch_l...
use util::*; use hyper::client::Response; fn with_path<F>(path: &str, f: F) where F: FnOnce(&mut Response) { run_example("query_string", |port| { let url = format!("http://localhost:{}{}", port, path); let ref mut res = response_for(&url); f(res) }) } mod get; mod all;
#[doc = "Reader of register IF2ARB2"] pub type R = crate::R<u32, super::IF2ARB2>; #[doc = "Writer for register IF2ARB2"] pub type W = crate::W<u32, super::IF2ARB2>; #[doc = "Register IF2ARB2 `reset()`'s with value 0"] impl crate::ResetValue for super::IF2ARB2 { type Type = u32; #[inline(always)] fn reset_va...
use std::collections::HashSet; use std::fs::File; use std::io::{BufReader, Lines}; #[derive(Debug)] struct Board { id: u64, rows: Vec<HashSet<u64>>, columns: Vec<HashSet<u64>>, } impl Board { fn new(id: u64) -> Self { Self { id: id, rows: Vec::new(), columns...
use std::{borrow::Cow, pin::Pin}; use futures_util::stream::{self, Stream}; use crate::{registry, Context, Response, ServerError, SubscriptionType}; /// Empty subscription /// /// Only the parameters used to construct the Schema, representing an /// unconfigured subscription. #[derive(Default, Copy, Clone)] pub stru...
mod errors; extern crate reqwest; extern crate serde_xml_rs; pub use self::errors::{UpdateError, UpdateResult}; use std::net::IpAddr; const API_URL: &str = "https://api.domrobot.com/xmlrpc/"; // not a constant because those can't be used in fmt macros macro_rules! api_xml { () => ("<?xml version=\"1.0\"?> <met...
// #![allow(dead_code)] // extern crate movegen; use movegen::board::Board; use movegen::moves::MoveList; fn main() { println!("Hello, world!"); let b = Board::standard(); let mut move_list = MoveList::new(); let white = true; b.move_list(white, &mut move_list); for m in move_list.iter() { ...
use std::{ fs::File, io::{BufWriter, Write}, }; use crate::read::{self, VariantListWriter}; pub fn write_variant_list_file(input: &str, output: &str) -> crate::Result<()> { let mut vcf_reader = read::get_vcf_reader(input)?; let out_writer = BufWriter::new(File::create(output)?); let mut list_write...
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; use rocket::response::Redirect; mod utils; #[get("/search?<cmd>")] fn search(cmd: String) -> Redirect { let command = utils::get_command_from_query_string(&cmd); let redirect_url = match command { "tw" => utils::twitter::c...
//! Implementations for different mathematical groups, each of which satisfies our //! `UnknownOrderGroup` trait. use crate::util::{int, TypeRep}; use rug::Integer; use std::hash::Hash; use std::fmt::Debug; pub mod classgroupsti; /// [Follow the idea from `https://github.com/cambrian/accumulator/src/group/mod.rs`] /...
use std::{future::Future, str::FromStr}; use async_graphql::{ http::{WebSocket as AGWebSocket, WebSocketProtocols, WsMessage, ALL_WEBSOCKET_PROTOCOLS}, Data, Executor, Result, }; use futures_util::{future, future::Ready, StreamExt}; use tide::Endpoint; use tide_websockets::{tungstenite::protocol::CloseFrame, M...
#![feature(i128_type)] use std::env; fn main() { println!("cargo:rerun-if-changed=build.rs"); let target = env::var("TARGET").unwrap(); // Emscripten's runtime includes all the builtins if target.contains("emscripten") { return; } // Forcibly enable memory intrinsics on wasm32 as we...
pub use VkBlendFactor::*; #[repr(u32)] #[derive(Clone, Copy, Debug, Eq, PartialEq)] pub enum VkBlendFactor { VK_BLEND_FACTOR_ZERO = 0, VK_BLEND_FACTOR_ONE = 1, VK_BLEND_FACTOR_SRC_COLOR = 2, VK_BLEND_FACTOR_ONE_MINUS_SRC_COLOR = 3, VK_BLEND_FACTOR_DST_COLOR = 4, VK_BLEND_FACTOR_ONE_MINUS_DST_CO...
#![feature(plugin)] #![feature(proc_macro_hygiene, decl_macro)] extern crate handlebars; #[macro_use] extern crate log; #[macro_use] extern crate rocket; extern crate rocket_contrib; #[macro_use] extern crate serde_derive; pub mod service; pub mod routes; mod handlebars_ext; mod templates;
pub enum SortOrder { ASCENDING, DESCENDING, } pub fn insertion<T>(collection: &mut std::vec::Vec<T>, order: SortOrder) -> &std::vec::Vec<T> where T: std::cmp::Ord, T: std::clone::Clone, { let cmp = match order { SortOrder::ASCENDING => std::cmp::Ordering::Greater, SortOrder::DESCEND...
pub mod diffed_pair; pub mod global_module; pub mod standard_module; use std::cmp::Ordering; use std::collections::HashMap; use std::io::Error; use std::path::PathBuf; use prettytable::{color, row, Attr, Cell, Row}; use regex::Regex; use crate::cli::Cli; use crate::pjson_detail::PjsonDetail; use crate::semver::Semve...
use std::io; fn main() { let mut input = String::new(); io::stdin().read_line(&mut input).unwrap(); let curr_time: i32 = input.trim().parse().unwrap(); input.clear(); io::stdin().read_line(&mut input).unwrap(); let (id, remain) = input.trim().split(",").filter(|&x| x != "x").map(|x| { ...
use opengl_graphics::shader_utils::{Shader, DynamicAttribute, compile_shader}; use opengl_graphics::gl::types::GLuint; use opengl_graphics::{gl, GlGraphics}; use opengl_graphics::GLSL; use opengl_graphics::shader_uniforms::{ShaderUniform, SUMat4x4}; use cgmath::{Matrix4, SquareMatrix, Vector3, Rad}; const FRAGMENT_SOU...
#[macro_use] extern crate glium; use glium::Surface; extern crate cgmath; #[derive(Copy, Clone)] pub struct Position{ pub position: [f32; 3] } implement_vertex!(Position, position); // 法线向量 #[derive(Copy, Clone)] pub struct Normal{ pub normal: [f32; 3] } implement_vertex!(Normal, normal); pub struct Cube { ...
/*! Shows you how to set the maximum/minimum size of a window */ extern crate native_windows_gui as nwg; extern crate native_windows_derive as nwd; use nwd::NwgUi; use nwg::NativeUi; #[derive(Default, NwgUi)] pub struct ResizeApp { #[nwg_control(size: (500, 310), position: (300, 300), title: "Resize example...
pub type FloatType = f64; pub type IntType = i32; pub type VectorRow4 = super::na::core::Matrix1x4<FloatType>; pub type VectorColumn4 = super::na::core::Vector4<FloatType>; pub type Matrix4 = super::na::core::Matrix4<FloatType>; pub type Matrix3 = super::na::core::Matrix3<FloatType>; pub type Point3 = super::na::Poi...
use std::collections::VecDeque; use proconio::{input, marker::Chars}; macro_rules! chmin { ($a: expr, $b: expr) => { if $a > $b { $a = $b; true } else { false } }; } fn main() { input! { h: usize, w: usize, row: [u64; h],...
use std::convert::From; use alga::general::Real; use na::{DMatrix, DVector}; use std::ops::Mul; use nt::{DiscreteSystemMatrix, DiscreteInputMatrix, SystemNoiseVarianceMatrix, StateVector, CovarianceMatrix, InputVector, Measurement, MeasurementMatrixRow, MeasurementNoiseVariance}; pub struct Kalma...
use audio_core::{Buf, Channel, ChannelMut, Channels, ChannelsMut, ExactSizeBuf}; /// A wrapper for a sequential audio buffer. /// /// See [wrap::sequential][super::sequential()]. pub struct Sequential<T> { value: T, channels: usize, } impl<T> Sequential<T> { pub(super) fn new(value: T, channels: usize) ->...
extern crate strum; #[macro_use] extern crate strum_macros; pub mod node_def; pub mod node_def_registry; pub mod node_value;
use crate::{ Dispatch, NodeId, NodeQueue, NodeQueueEntry, NodeStatus, NodeThreadPool, QueryEstimate, QueryId, ShardId, }; use std::cell::RefCell; use std::collections::HashSet; use std::rc::Rc; use rand_chacha::{rand_core::SeedableRng, ChaChaRng}; use simrs::{ClockRef, Key, QueueId, State}; #[derive(Debug, C...
use std::sync::Arc; use actix_files as fs; use actix_web::{App, HttpServer}; use actix_web::dev::Server; use actix_web::web::{self, Data, HttpRequest}; use actix_web::Result; use bytes::Bytes; use reqwest::Client; use serde::{Serialize, Deserialize}; use sqlx::PgPool; use validator::Validate; use common::{ Error,...
//! An allocator that can track and limit memory usage. //! //! **[Crates.io](https://crates.io/crates/cap) │ [Repo](https://github.com/alecmocatta/cap)** //! //! This crate provides a generic allocator that wraps another allocator, tracking memory usage and enabling limits to be set. //! //! # Example //! //! It can b...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::account_address::AccountAddress; use move_core_types::identifier::{IdentStr, Identifier}; use serde::{Deserialize, Serialize}; use star...
use ggez::{GameResult, Context}; use ggez::graphics::{Drawable, Image, Point2}; #[derive(Debug)] pub struct Assets { bg: Image, } pub fn load_assets(ctx: &mut Context) -> GameResult<Assets> { Ok( Assets { bg: Image::new(ctx, "/bg.jpg")?, } ) } pub fn draw_bg(ctx: &mut Context...