text
stringlengths
8
4.13M
// Copyright 2020 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 { crate::blob::{Blob, BlobDataFactory, Compressibility, CreationError}, crate::io::Directory, crate::utils::BLOCK_SIZE, log::{debug, er...
use libm::{fabs, modf}; use crate::{scales, utils::f64_eq, BaseUnit, FormatSizeOptions, Kilo, ToF64, Unsigned}; pub struct ISizeFormatter<T: ToF64, O: AsRef<FormatSizeOptions>> { value: T, options: O, } impl<V: ToF64, O: AsRef<FormatSizeOptions>> ISizeFormatter<V, O> { pub fn new(value: V, options: O) ->...
//! Some common code used by both the event and reply modules. use std::collections::HashMap; use serde_json as json; use reply; /// Recursively build the tree of containers from the given json value. pub fn build_tree(val: &json::Value) -> reply::Node { reply::Node { nodes: match val.find("nodes") { ...
//! This crate helps with cache directories creation in a system-agnostic way. //! //! The [`CacheDirConfig`] type helps define the desired location(s) where attempts to create //! the cache directory should be made and also helps with the creation itself. //! //! The [`CacheDir`] type holds the path to the created cac...
//! Brotli Compression/Decompression for Rust //! //! This crate is a binding to the [official brotli implementation][brotli] and //! provides in-memory and I/O streams for Rust wrappers. //! //! [brotli]: https://github.com/google/brotli //! //! # Examples //! //! ``` //! use std::io::prelude::*; //! use brotli2::read...
#![warn(clippy::all)] #![warn(clippy::pedantic)] fn main() { run(); } fn run() { let start = std::time::Instant::now(); // code goes here let res: u64 = primes_under(2_000_000).iter().sum(); let span = start.elapsed().as_nanos(); println!("{} {}", res, span); } /// iterative implementation of Sieve of ...
use std::process::Command; use super::transpile::*; use crate::text_io::*; use std::io::Write; use std::fs::File; use std::str; pub fn repl() { let mut leave = String::from("#include \"engppstd.hpp\"\n"); let mut lines :Vec<String> = Vec::new(); let mut stack :Vec<char> = Vec::new(); let mut leave_main...
extern crate chrono; use chrono::Local; use std::string::ToString; /// Get the current timestamp formated to apply to the ISO 8601. /// # Return Value /// /// A String containing the current timestamp. pub fn get_timestamp() -> String { let now = Local::now(); return now.format("%Y-%m-%dT%H:%M:%S%z").to_string...
#![deny(clippy::all)] mod error; pub mod aws; pub mod nomad; pub mod vault; pub use crate::error::Error; use std::fmt; use std::ops::Deref; use futures::future::Future; use rusoto_core::credential::AwsCredentials; use rusoto_core::{DefaultCredentialsProvider, ProvideAwsCredentials, Region}; use serde::{Deserialize...
//! NDSP (Audio) service. //! //! The NDSP service is used to handle communications to the DSP processor present on the console's motherboard. //! Thanks to the DSP processor the program can play sound effects and music on the console's built-in speakers or to any audio device //! connected via the audio jack. #![doc(a...
#[macro_use] extern crate nickel; extern crate rustc_serialize; use nickel::Nickel; use std::env; mod fakedb; mod router; mod customer; mod eligibility; /// Simple function to get the "PORT" environment variable, or default to 6767. /// The method will panic if the variable exists but is not an unsigned int. fn get_...
use std::error::Error; use crate::command::exec; use crate::commands::Command; use crate::show_info; pub struct InitOpt { git: String, } // init repo with git (optional) impl InitOpt { pub fn new(git: String) -> InitOpt { InitOpt { git } } } impl Command for InitOpt { fn run(&self) -> Result...
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),...
pub struct Solution; impl Solution { pub fn search(nums: Vec<i32>, target: i32) -> i32 { let n = nums.len(); if n == 0 { return -1; } let (mut a, mut b) = if nums[0] > nums[n - 1] { let mut a = 0; let mut b = n - 1; while a + 1 < b { ...
#[allow(unused_imports)] use proconio::{marker::*, *}; #[allow(unused_imports)] use std::{cmp::Ordering, convert::TryInto}; #[fastout] fn main() { input! { t: i32, n: i32, range: [(i32, i32); n], } // diff[0] = 0 // diff[i] = 時刻 i-1 から時刻 i の従業員の増減 (i > 0) let mut diff = ve...
extern crate prometheus_exposition_format_rs; use prometheus_exposition_format_rs::parse_complete; use prometheus_exposition_format_rs::types::{Err, Metric}; use std::fs; const PATH: &str = "fixtures"; fn read_fixture(s: &str) -> Result<Vec<Metric>, Err> { parse_complete(&fs::read_to_string(s).unwrap()) } fn as...
use failure::Fail; #[derive(Debug, Fail)] pub enum ErrorKind { #[fail(display = "TraceNotFound")] TraceNotFound, }
extern crate nalgebra_glm as glm; use std::fs::File; use std::io::Read; use std::sync::{Arc, Mutex, RwLock}; use std::thread; use std::{f32::consts, mem, os::raw::c_void, ptr}; // New import for Exercise 3 mod mesh; mod scene_graph; mod toolbox; mod shader; mod util; use glutin::event::{ DeviceEvent, Element...
// cargo-deps: boolinator="=0.1.0" // You can also leave off the version number, in which case, it's assumed // to be "*". Also, the `cargo-deps` comment *must* be a single-line // comment, and it *must* be the first thing in the file, after the // hashbang. extern crate boolinator; use boolinator::Boolinator; fn main...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qpoint.h // dst-file: /src/core/qpoint.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= mai...
use crate::{ mock::{ Extrinsic, Origin, ProviderMembers, Test, TestAuth, TestEvent, TestProvider, Tokens, USD_ASSET, }, Call, OffchainPairPricesPayload, PairPrices, OFFCHAIN_KEY_TYPE, }; use frame_support::{assert_noop, assert_ok, storage::StorageValue}; use frame_system::offchain::{SignedPa...
#[doc = "Reader of register TAFCR"] pub type R = crate::R<u32, super::TAFCR>; #[doc = "Writer for register TAFCR"] pub type W = crate::W<u32, super::TAFCR>; #[doc = "Register TAFCR `reset()`'s with value 0"] impl crate::ResetValue for super::TAFCR { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
// This file is adapted from async_std use core::cell::UnsafeCell; use crate::prelude::*; #[derive(Debug)] pub struct LocalKey<T: Send + 'static> { init: fn() -> T, key: AtomicU32, } impl<T: Send + 'static> LocalKey<T> { pub const fn new(init: fn() -> T) -> Self { let key = AtomicU32::new(0); ...
use std::sync::Arc; use data_types::{NamespaceId, ParquetFileParams, PartitionKey, TableId, TransitionPartitionId}; use observability_deps::tracing::*; use parking_lot::Mutex; use schema::sort::SortKey; use thiserror::Error; use tokio::{ sync::{oneshot, OwnedSemaphorePermit}, time::Instant, }; use uuid::Uuid; ...
mod common; use common::exe; use duct::cmd; #[test] fn no_args() { // Implicitly checks that exit code is zero. let stdout = cmd!(exe(), "yes") .pipe(cmd!("head", "-n", "5")) .read() .unwrap(); assert_eq!(stdout, ["y"].repeat(5).join("\n")); } #[test] fn one_arg() { let stdout = cmd!(exe(), "yes",...
use stm32f1::stm32f103::{RCC, GPIOB}; pub fn init(rcc: &mut RCC, gpiob: &mut GPIOB) { // enable gpiob rcc.apb2enr.write(|w| w.iopben().enabled()); // configurate PB12 as push-pull output gpiob.crh.write(|w| w.mode12().output50().cnf12().push_pull()); } pub fn set(on: bool) { let gpiob = unsafe { ...
const INPUT: &str = include_str!("./input"); fn parse_policy(policy: &str) -> (usize, usize, char) { let mut iter = policy.split_whitespace(); let range = iter.next().unwrap(); let c = iter.next().unwrap(); let mut iter = range.split('-'); let min = iter.next().map(|v| v.parse().unwrap()); let...
pub fn sort(arr: &mut [isize]) { for i in 0..arr.len() { for j in (0..i).rev() { if arr[j] >= arr[j + 1] { arr.swap(j, j + 1); } else { break } } } } #[cfg(test)] pub mod test { use super::sort; #[test] fn basics()...
pub mod search; use reason_othello::game::{self, GameState}; /// Solve the game, trying to determine the exact score. /// Takes longer, but can be valuable for debugging or winning by a margin. pub fn solve_exact(state: GameState) -> i8 { search::window(state, -game::MAX_SCORE, game::MAX_SCORE) } // Solve the ga...
extern crate image; extern crate proc_macro; extern crate rusttype; pub mod prelude; use crate::prelude::*; use std::fs; use std::io::prelude::*; #[repr(align(32))] pub struct AlignedData<T>(pub T); pub struct GCNFont { pub width: u32, pub height: u32, pub size: f32, pub space_advance: f32, pub...
fn main (){type V=[f32; 3 ]; let mut t=0f32; let dot=|[x,y,z] :V,[a,b,c]:V|x*a +y*b+z*c;let dot2= |a|dot(a,a);let cross =|[x,y,z]:V,[a,b,c]:V |[y*c-z*b,z*a-x*c,x*b-y* a];let smul=|[x,y,z]:V,a|[ x*a,y*a,z*a];let m=|[x,y,z]: V,[a,b,c]:V|[x-a,y-b,z-c];let n2=|[x,y,z]:V|(x*x+y*y+z*z);let triangle_sdf=|p,a,b,c|{let[...
extern crate libc; pub use ffi::{ zmq_msg_t, zmq_free_fn, zmq_event_t, zmq_pollitem_t, zmq_version, zmq_errno, zmq_strerror, zmq_ctx_new, zmq_ctx_term, zmq_ctx_shutdown, zmq_ctx_set, zmq_ctx_get, zmq_init, zmq_term, zmq_ctx_destroy, zmq_msg_init, zm...
use core::f32; use super::sqrtf; #[cfg_attr(all(test, assert_no_panic), no_panic::no_panic)] pub fn hypotf(mut x: f32, mut y: f32) -> f32 { let x1p90 = f32::from_bits(0x6c800000); // 0x1p90f === 2 ^ 90 let x1p_90 = f32::from_bits(0x12800000); // 0x1p-90f === 2 ^ -90 let mut uxi = x.to_bits(); let mut...
/// Plugin architecture /// /// We do not want "spooky action at a distance" (Spukhafte Fernwirkung) (A. Einstein) /// /// Plugin::draw() -> VectorBackend::draw(Primitive::Variant) -> Primite::draw pub trait Plugin : Flex { fn min_size(&self, pagewidth) -> Size; // covered by Flex // fn height_for_wid...
/* 135. Candy Hard Share There are n children standing in a line. Each child is assigned a rating value given in the integer array ratings. You are giving candies to these children subjected to the following requirements: Each child must have at least one candy. Children with a higher rating get more candies than th...
#[derive(Clone, Copy, Debug, PartialEq)] pub struct SearchHostile { pub search_range: f32, pub is_active: bool, }
use std::process::Command; use glob::glob; use parser::{expand_string, ExpanderFunctions}; use parser::peg::RedirectFrom; #[derive(Debug, PartialEq, Clone, Copy)] pub enum JobKind { And, Background, Last, Or, Pipe(RedirectFrom) } #[derive(Debug, PartialEq, Clone)] pub struct Job { pub command: String, pub ar...
pub fn verification_email(token: &String) -> String { let template = format!( " <h1>Welcome to Spaces</h1> Click the link to verify account<br/> <a href='http://localhost:5000/user/verify?token={}'>click</a> ", token ); template } pub fn forgot_password_email(password: &Stri...
//! This crate defines the `C99Display` trait which should be used to display constructs in //! a C99-compatible syntax, and implements it for the various `llir` constructs. //! //! In the future, it should define additional shared constructs for C-based backends such as the //! x86 and MPPA backends. use std::fmt; u...
use bevy::{prelude::Mesh, render::mesh::Indices, render::mesh::VertexAttribute, render::pipeline::PrimitiveTopology}; pub struct MeshMaker { pub vert_pos: Vec<[f32; 3]>, pub vert_norm: Vec<[f32; 3]>, pub vert_uvs: Vec<[f32; 2]>, // pub vert_colors: Vec<[f32; 4]>, // pub vert_textures: Vec<f32>, ...
use super::WordSelection; use yew::prelude::*; #[derive(PartialEq)] pub struct SingleWordSelection(Option<String>); impl WordSelection for SingleWordSelection { type Properties = Option<Callback<Option<String>>>; fn create(_properties: &Self::Properties) -> Self { Self(None) } fn select(&mut...
// xfail-boot // xfail-stage0 use std; import std._task; fn main() -> () { test00(); } fn start(int task_number) { log "Started / Finished Task."; } fn test00() { let int i = 0; let task t = spawn thread "child" start(i); // Sleep long enough for the task to finish. _task.sleep(1...
use libengine::engine::*; #[allow(unused_imports)] use std::io::prelude::*; use std::iter::Iterator; use std::sync::{Arc, Mutex}; #[derive(Default)] pub struct FaceFactory; impl IFaceFactory for FaceFactory { fn spawn(&mut self) -> Arc<Mutex<dyn IFace>> { Arc::new(Mutex::new(InterfaceMercury { ...
use std::cell::Cell; pub struct Gamepad { pub a: bool, pub b: bool, pub select: bool, pub start: bool, pub up: bool, pub down: bool, pub left: bool, pub right: bool, byte: Cell<u8>, polling: bool, } impl Default for Gamepad { fn default() -> Self { Gamepad::new() ...
#[doc = "Writer for register SICR"] pub type W = crate::W<u32, super::SICR>; #[doc = "Register SICR `reset()`'s with value 0"] impl crate::ResetValue for super::SICR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Write proxy for field `DATAIC`"] pub struct D...
use crate::state::Shared; use super::peer::Peer; use super::protocol::Protocol; use futures::SinkExt; use std::error::Error; use std::sync::Arc; // use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::TcpListener; use tokio_stream::StreamExt; // use tokio::sync::Mutex; use std::net::SocketAddr; use tokio::ne...
use std::mem; use std::ops::DerefMut; use neon::prelude::*; use manifest::{Manifest, format}; use ::MANIFEST; /// Creates a new manifest. /// /// # Arguments /// None /// /// # Return /// None /// /// # Exceptions /// None pub fn create_manifest(mut cx: FunctionContext) -> JsResult<JsNull> { info!("Creating n...
//! Hardware checksum engine use bl602_pac::CKS; /// Checksum engine abstraction /// /// # Examples /// /// ```no_run /// use bl602_hal::pac; /// use bl602_hal::checksum::{Checksum, Endianness}; /// /// fn main() -> ! { /// let dp = pac::Peripherals::take().unwrap(); /// let checksum = Checksum::new(dp.CKS, E...
fn str_ref( s: &str ) { println!("{}", &s[0..4]); } fn str_append( s: &mut String ) { s.push_str("TTTT"); } fn iter_ex() { let names = vec!["Bob", "Frank", "Ferris"]; // borrowing iterator: iter for name in names.iter() { match name { &"Ferris" => println!("There is a rustac...
use std::fmt; use super::lexer::{Token, Keyword}; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum TyKind { U8, U16, U32, U64, I8, I16, I32, I64, Void, } #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub struct Ty { kind: TyKind, indirection: usize, } impl Ty {...
use {IsZero, Dot, Lerp, Point}; use std::ops::*; use std::fmt::{self, Debug, Formatter}; use std::slice; // VECTOR 3 // ================================================================================================ #[derive(Clone, Copy, PartialEq)] #[repr(C)] pub struct Vector3 { pub x: f32, pub y: f32, ...
use std::path::Path; use amiga_hunk_parser::{Hunk, HunkParser, SourceLine}; pub struct DebugInfo { pub hunks: Vec<Hunk>, } impl DebugInfo { pub fn new() -> DebugInfo { DebugInfo { hunks: Vec::new(), } } pub fn load_info(&mut self, uae_path: &str, amiga_exe: &str) { ...
// 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 ...
mod entry; mod error; mod node; mod rpc; mod tests; mod timer; pub use node::Node;
#![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 ActivitySensorTrigger(pub ::windows::core::IIn...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type DisplayAdapter = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct DisplayBitsPerChannel(pub u32); impl DisplayBitsPerChannel { pub const N...
//! Module providing the abstractions needed to read files from an storage //! pub mod local; use std::{cmp::Ordering, path::PathBuf}; use thiserror::Error; use crate::htsget::{Class, Url}; type Result<T> = core::result::Result<T, StorageError>; /// An Storage represents some kind of object based storage (either l...
use std::cell::RefCell; pub struct Ctxt { errors: RefCell<Vec<syn::Error>>, } impl Ctxt { pub fn new() -> Self { Ctxt { errors: RefCell::new(vec![]), } } pub fn push(&self, err: syn::Error) { self.errors.borrow_mut().push(err) } pub fn check(self) -> Resul...
use sea_orm::{entity::prelude::*, ActiveValue}; use serde::{Deserialize, Serialize}; use crate::seconds_since_epoch; #[derive(Copy, Clone, Default, Debug, DeriveEntity)] pub struct Entity; impl EntityName for Entity { fn table_name(&self) -> &str { "access_token" } } #[derive(Clone, Debug, PartialEq...
pub use self::variance::Variance; pub mod variance;
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtGui/qpolygon.h // dst-file: /src/gui/qpolygon.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block begin => // <= m...
/// Error Function Trait /// /// Implementation based on [Netlib Specfun 2.5](http://www.netlib.org/specfun/) /// /// Translated from Fortran March 2019 /// /// ## References /// - Cody, W. (1990), Performance evaluation of programs for the error /// and complementary error functions, ACM Transactions on Mathema...
#[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); let c1 = |num| { num }; let c2 = |num: u32| -> u32 { num }; fn add_one_v1(x: u32) -> u32 { x + 1 } let add_one_v2 = |x: u32| -> u32 { x + 1 }; let add...
// boxed variable fn box_int(a: i32) -> Box<i32> { let x: Box<i32> = Box::new(a); x } fn process(a: &mut Box<i32>){ **a = **a * **a; } fn main(){ println!("this is us {:?}", box_int(199)); let mut val = box_int(21); process(&mut val); println!("{}", val); }
use bindgen::Builder; use cmake::Config; use std::{env, path::PathBuf}; fn main() { let target = Config::new("libwebp").build_target("webp").build(); println!("cargo:rustc-link-search=native={}/build", target.display()); println!("cargo:rustc-link-lib=static=webp"); let out_path = PathBuf::from(env::v...
//! Command `source` use crate::{registry::Registry, result::Result}; use std::cmp::Ordering; const MAX_PACKAGE_NAME_LEN: usize = 50; fn cap(mut name: String) -> String { name.push_str(&" ".repeat(MAX_PACKAGE_NAME_LEN - name.len())); name } /// Exec command `source` pub fn exec(query: String, version: bool) ...
use nalgebra::Vector3; use std::io::{Read, Result as IOResult, Error as IOError, ErrorKind}; use crate::{PrimitiveRead, LumpData, LumpType}; pub struct DispInfo { pub start_position: Vector3<f32>, pub disp_vert_start: i32, pub disp_tri_start: i32, pub power: i32, pub min_tess: i32, pub smoothing_angle: f32...
//! //! ticks.rs //! //! Created by Mitchell Nordine at 08:46PM on November 02, 2014. //! //! use num::{FromPrimitive, ToPrimitive}; use std::ops::{Add, Sub, Mul, Div, Rem, Neg, AddAssign, SubAssign, MulAssign, DivAssign, RemAssign}; use super::calc; use super::{ Bars, Bpm, Ms, ms_from...
//! Memory profiling support using heappy //! //! Compiled only when the "heappy" feature is enabled use heappy::{self, HeapReport}; use observability_deps::tracing::info; use snafu::{ResultExt, Snafu}; use std::{thread, time}; #[derive(Debug, Snafu)] pub enum Error { #[snafu(display("{}", source))] HeappyErr...
mod file_mode; mod stat_buf; pub use rcore_fs::vfs::{FileSystem, FileType, FsError, INode, Metadata, Timespec, PATH_MAX}; pub use self::file_mode::FileMode; pub use self::stat_buf::{StatBuf, StatFlags, StatMode}; #[derive(Debug, Copy, Clone, PartialEq, Eq)] pub enum SeekFrom { Start(u64), End(i64), Curre...
#![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 GameListCategory(pub i32); impl GameListCategory { pub const Candidate: Self = Self(0i32); pub const ConfirmedBySystem: ...
extern crate pine; // use pine::error::PineError; use pine::ast::input::*; use pine::ast::name::*; use pine::ast::op::*; use pine::ast::stat_expr_types::*; use pine::ast::string::*; mod utils; pub use utils::*; #[test] fn expression_test() { assert_eq!( pine::parse_ast("m = (high + low + close) / 3\n"), ...
use vec3::*; use ray::Ray; use hitable::*; use material::*; use util::*; use aabb::*; use onb::*; use pdf::*; #[derive(Debug, Clone)] pub struct Sphere { center: Vec3<f64>, radius: f64, material: Rc<Material>, } impl Sphere { pub fn new(cen: Vec3<f64>, r: f64, material: Rc<Material>) -> Sphere { ...
use super::*; #[derive(Debug)] pub enum GameSettings { NewGame { player_name: String }, LoadGame { path: String }, } #[derive(Debug)] pub enum Screen { MainMenu { player_name: String }, } #[derive(Debug)] pub enum Action { Cancel, StartGame, ReadChar(char, bool), DeleteChar, InvalidKe...
use actix_web::{http::StatusCode, HttpResponse, Json, Path, Query}; use auth::user::User as AuthUser; use bigneon_db::models::*; use bigneon_db::utils::errors::Optional; use db::Connection; use diesel::PgConnection; use errors::*; use helpers::application; use models::{ Paging, PagingParameters, PathParameters, Pay...
use leptos::*; use openapi::models::LoginRequest; use crate::auth; use crate::components::Button; use crate::components::TextInput; #[component] pub fn Login(cx: Scope) -> impl IntoView { let login = create_rw_signal(cx, String::new()); let password = create_rw_signal(cx, String::new()); let login_action ...
/// A decision to apply to the domain. #[derive(PartialEq, Eq, Hash, Debug, Clone, Copy, Serialize, Deserialize, Ord, PartialOrd)] #[repr(C)] pub enum Action { {{~#each choices}} /// cbindgen:field-names=[{{~#each arguments}}{{this.[0]}}, {{/each~}}domain] {{to_type_name name}}( {{~#each arg...
use crate::repo_cache::RepoCacheOptions; use crate::subprocess::{exec, ExecError}; use fn_search_backend::Config; use std::process::Command; use std::string::FromUtf8Error; use std::time::Duration; use std::{error::Error, fmt}; pub fn chrome_dl(url: &str, config: &Config, o: &RepoCacheOptions) -> Result<String, Chrome...
pub mod enemies; pub mod levels; pub mod objects;
//! WebSocketcommunication.rs - module that cares about WebSocket communication //region: use use crate::rootrenderingcomponent::RootRenderingComponent; use crate::statusinviteasked; use crate::statusinviteaskbegin; use crate::statusplaybefore1stcard; use crate::statusplaybefore2ndcard; use crate::statustaketurnbegin...
//! [Exampwe of ewwonyenyonyuns code:](https://twitter.com/plaidfinch/status/1176637387511934976) //! //! This library implements streaming owoification. //! //! Get the binary on [Crates.io](https://crates.io/crates/wustc)! //! //! # Special thanks //! //! To all who support further development on [Patreon](https://pa...
use std::ops::{Add, Sub, Mul, Div, AddAssign, SubAssign, MulAssign, DivAssign}; use std::time::Duration; #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub struct Round(pub usize); // Essentially "Instant" at the round level #[derive(Debug,Clone,Copy,PartialEq,Eq,PartialOrd,Ord,Hash)] pub struct Rounds(...
use super::host; use crate::sys::{errno_from_host, fdentry_impl}; use std::fs; use std::io; use std::mem::ManuallyDrop; use std::path::PathBuf; #[derive(Debug)] pub enum Descriptor { File(fs::File), Stdin, Stdout, Stderr, } #[derive(Debug)] pub struct FdObject { pub file_type: host::__wasi_filety...
use std::path::PathBuf; use std::sync::mpsc; use std::time; use notify::{Watcher, RecursiveMode, watcher, DebouncedEvent, ReadDirectoryChangesWatcher}; use super::calibration; use nalgebra::{Translation3, UnitQuaternion}; pub struct ProfileProvider { path: PathBuf, watcher: ReadDirectoryChangesWat...
use crate::algebra::Magma; /// A commutative magma. /// /// # Laws /// * Commutativity: ∀`x` ∀`y` (`x.op(&y)` = `y.op(&x)`) pub trait CommutativeMagma: Magma {}
#![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 IWCNConnectNotify(pub ::windows::core::IUnknow...
pub mod endings { use regex::Regex; pub fn ends_with(field_value : &str, ending : &str) -> bool { field_value.ends_with(ending) } pub fn base64_offset_contains(b64 : &str, value : &str) -> bool { //TODO: improve b64.contains(value) } pub fn regex(field_value : &str, reg...
use std::io::prelude::*; fn main() { let stdin = std::io::stdin(); let l = stdin.lock().lines().next().unwrap().unwrap(); let a = l.chars().rev().collect::<String>(); println!("{}",a); }
//! A vector of slices. use std::iter::{FusedIterator, IntoIterator}; /// A vector of slices. /// /// Each slice is stored inline so as to be efficiently iterated through linearly. #[derive(Debug)] pub struct SliceVec<T> { data: Vec<T>, counts: Vec<usize>, indices: Vec<usize>, } impl<T> Default for Slice...
// 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 ...
use crate::protocol::parts::option_part::OptionId; use crate::protocol::parts::option_part::OptionPart; use crate::protocol::parts::option_value::OptionValue; // An Options part that provides source and line information. pub type CommandInfo = OptionPart<CommandInfoId>; impl CommandInfo { pub fn new(linenumber: i...
use rune_tests::*; #[test] fn test_binary_exprs() { assert_parse_error! { r#"pub fn main() { 0 < 10 >= 10 }"#, span, PrecedenceGroupRequired => { assert_eq!(span, Span::new(16, 22)); } }; // Test solving precedence with groups. assert_parse!(r#"pub fn main() { (0 < ...
/* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ extern crate serde; extern crate base64; extern crate openssl; extern crate reqwest; extern crate hawk; extern cr...
use crate::error; use crate::state; use crossbeam::channel::{select, Receiver}; use regex::{self, Regex}; use std::fmt; use std::io; use std::io::BufRead; use std::sync::{Arc, Mutex}; use std::thread; use termion::clear; use termion::color; use termion::event::Key; use termion::style; use termion::terminal_size; pub ...
use crate::make::scan_sheet_elements::{ScanSheetElements, ElementKind, BAR_WIDTH, BAR_LENGTH, FIELD_FONT_SIZE, ALIGNER_OUTER_RADIUS}; use crate::make::scan_sheet_elements::Element; use svg; use std::collections::{HashSet}; use crate::parse::BarsFound; const TEXT_WIDTH_MULTIPLIER: f64 = 0.6; // characters are how many ...
// revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir trait Dummy { fn dummy(&self); } fn foo1<'a:'b,'b>(x: &'a mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { // Here, we are able to coerce x } fn foo2<'a:'b,'b>(x: &'b mut (dyn Dummy+'a)) -> &'b mut (dyn Dummy+'b) { //...
use std::fs::File; use std::io::Write; use std::path::Path; use super::Color; #[derive(Debug)] pub enum CanvasError { InvalidIndex, } /// Rectangular grid of pixels pub struct Canvas { width: usize, height: usize, pixels: Vec<Color>, } impl Canvas { pub fn new(width: usize, height: usize) -> Sel...
use png::PngData; pub fn reduce_alpha_channel(png: &mut PngData, bpp_factor: usize) -> Option<Vec<u8>> { let mut reduced = Vec::with_capacity(png.raw_data.len()); let byte_depth: u8 = png.ihdr_data.bit_depth.as_u8() >> 3; let bpp: usize = bpp_factor * byte_depth as usize; let colored_bytes = bpp - byte...
use nom::Err; use nom::ErrorKind; use nom::types::CompleteStr; use CompoundUnit; use Expr; use Num; use QualifiedUnit; use SiPrefix; use SimpleUnit; use Value; use errors::*; #[repr(u32)] #[derive(Copy, Clone)] enum Fail { Input, Summands, SummandsFollow, Factors, FactorsFollow, Value, Num...
// Copyright 2016 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 ...