text
stringlengths
8
4.13M
#[macro_use] extern crate criterion; #[macro_use] extern crate lazy_static; extern crate lab; extern crate rand; use criterion::Criterion; use rand::distributions::Standard; use rand::Rng; lazy_static! { static ref RGBS: Vec<[u8; 3]> = { let rand_seed = [0u8; 32]; let rng: rand::rngs::StdRng = ran...
use advent_libs::input_helpers; fn main() { println!("Advent of Code 2020 - Day 1"); println!("---------------------------"); // Read puzzle input let mut input_str = input_helpers::read_puzzle_input_to_string(1); // Strip out the carriage returns (on Windows) input_str.retain(|c| c != '\r'); ...
use specs::*; use types::Score; #[derive(Clone, Debug, Copy, Component, Default)] pub struct PlayersGame(pub u32); #[derive(Clone, Debug, Copy, Component, Default)] pub struct TotalKills(pub u32); #[derive(Clone, Debug, Copy, Component, Default)] pub struct TotalDeaths(pub u32); #[derive(Clone, Debug, Copy, Compone...
// Copyright © 2019 Bart Massey // [This program is licensed under the "MIT License"] // Please see the file LICENSE in the source // distribution of this software for license terms. // Harmonizer demo example using synthkit-rs. use synthkit::*; fn main() { let wav = std::env::args().nth(1).unwrap(); let soun...
use bevy::{ecs::system::Command, prelude::*}; use crate::{Prefab, PrefabNotInstantiatedTag}; struct SpawnPrefab<B> { prefab_handle: Handle<Prefab>, overrides: B, } impl<B> Command for SpawnPrefab<B> where B: Bundle + Send + Sync + 'static, { fn write(self: Box<Self>, world: &mut World) { let ...
use std::{thread, time}; //takes a vector representing the amplitude of sampled frequencies //determines a colour representing the sample fn audio_to_weighted_colour(spectrum_sample : &Vec<f32>) -> std::io::Result<([u8;3])> { let ratio = 3; let colour_byte = 255.0f32; let split_to : usize = spectrum_sample.len...
#![feature(core_slice_ext, core_str_ext, core_intrinsics)] #![feature(no_std)] #![feature(const_fn)] #![no_std] #![no_main] extern crate armstrong; macro_rules! wait_for { ($cond:expr) => { while ! $cond {}; }; } #[derive(Copy, Clone)] struct Volatile<T> { value: T } impl<T> Volatile<T> { p...
use sdl2::pixels::Color; use sdl2::event::Event; const BACKGROUND: Color = Color::RGB(18, 18, 18); fn main() -> Result<(), String> { let sdl_context = sdl2::init()?; let video_subsystem = sdl_context.video()?; let window = video_subsystem.window("4D", 800, 600) .position_centered() .resiza...
use crate::ray::Ray; use vec3D::Vec3D; fn random_in_unit_disk() -> Vec3D { let mut p: Vec3D; loop { p = Vec3D::new(rand::random::<f64>(), rand::random::<f64>(), 0.0) * 2.0 - Vec3D::new(1.0, 1.0, 0.0); if p.dot(p) < 1.0 { break; } } p } pub struct Camera { pub ...
use async_trait::async_trait; use common::result::Result; use crate::domain::author::{Author, AuthorId}; #[async_trait] pub trait AuthorRepository: Sync + Send { async fn next_id(&self) -> Result<AuthorId>; async fn find_all(&self) -> Result<Vec<Author>>; async fn find_by_id(&self, id: &AuthorId) -> Res...
#[doc = "Reader of register CLK_TRIM_ILO_CTL"] pub type R = crate::R<u32, super::CLK_TRIM_ILO_CTL>; #[doc = "Writer for register CLK_TRIM_ILO_CTL"] pub type W = crate::W<u32, super::CLK_TRIM_ILO_CTL>; #[doc = "Register CLK_TRIM_ILO_CTL `reset()`'s with value 0x2c"] impl crate::ResetValue for super::CLK_TRIM_ILO_CTL { ...
#[cfg(test)] use il; #[cfg(test)] use engine; #[cfg(test)] use executor; mod simple_0; #[test] fn il_constants () { let expr = il::Expression::add(il::expr_const(10, 32), il::expr_const(20, 32)).unwrap(); assert_eq!(executor::constants_expression(&expr).unwrap().value(), 30); } #[test] fn simplify_expression...
use red; use common::*; use gfx_h::Canvas; use rand::prelude::*; use red::glow::RenderLoop; use red::{glow, Frame, GL}; use sdl2::event::Event; use sdl2::keyboard::Keycode; use std::time::Duration; mod plot; use plot::{render_plot, TeleGraph}; fn main() -> Result<(), String> { let sdl_context = sdl2::init().unw...
mod clear_messages_builder; mod create_queue_builder; mod delete_message_builder; mod delete_queue_builder; mod get_messages_builder; mod get_queue_acl_builder; mod get_queue_metadata_builder; mod get_queue_service_properties_builder; mod get_queue_service_stats_builder; mod list_queues_builder; mod peek_messages_build...
extern crate firmat; use std::fs::File; use std::io::Read; use firmat::fdt; pub const DTS_VER_STRING: &str = "/dts-v1/;"; fn indent(times: u32) { for _ in 0..times { print!(" "); } } fn isprint(character: u8) -> bool { (character > 0x1F) && (character < 0x7f) } const NULL_CHAR: u8 = '\0' as...
#[no_mangle] pub extern fn div(a:i32, b:i32) -> i32 { a / b } #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }
use clap::Parser; use do_core::core::Core; use do_core::Error; #[derive(Parser)] #[clap(version, author)] struct DoCoreOpts { /// DO Core instruction #[clap(short, long)] insn: String, } fn main() -> Result<(), Error> { let mut cpu = Core::new(); let opts: DoCoreOpts = DoCoreOpts::parse(); cp...
extern crate block_modes; mod actions; mod file; mod help; mod input; use actions::*; use clap::{App, Arg}; const VERSION: &str = env!("CARGO_PKG_VERSION"); fn main() { let matches = App::new("ares") .version(VERSION) .about("File encryption made easy") .author("https://github.com/ivan77...
#[doc = "Register `L2CLUTWR` writer"] pub type W = crate::W<L2CLUTWR_SPEC>; #[doc = "Field `BLUE` writer - Blue value"] pub type BLUE_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 8, O>; #[doc = "Field `GREEN` writer - Green value"] pub type GREEN_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 8, O>; #[d...
use std::{ cmp, io::{Read, Write}, net::TcpStream, time::Instant, }; use url::Url; pub fn make_request(url: &Url) -> String { let host = url.host_str().unwrap(); let path = url.path(); //println!("Hostname: {}", host); //println!("Path: {}", path); let mut stream = TcpStream::con...
use state::database_config::DatabaseConfig; use state::github::GithubAuth; use state::gitlab::GitlabAuth; use std::fs::File; use std::io::Read; use toml::de::from_slice; #[derive(Deserialize, Debug)] pub struct GlobalConfig { github: GithubAuth, gitlab: GitlabAuth, database: DatabaseConfig, } impl GlobalC...
pub mod healthz; pub mod ping;
use proc_macro as pm; use crate::new_id; pub(crate) fn rewrite(_attr: syn::AttributeArgs, item: syn::ItemFn) -> pm::TokenStream { let block = &item.block; let id = item.sig.ident; let component_id = new_id(format!("{}Component", id)); let run_id = new_id(format!("{}_run", id)); quote::quote! ( ...
static INPUT: &str = include_str!("input"); fn main() { println!("Day 8, Part 1: {}", part1(&INPUT)); println!("Day 8, Part 2: {}", part2(&INPUT)); } fn part1(input: &str) -> usize { let mut tree = nodes(input); sum_metadata(&mut tree) } fn part2(input: &str) -> usize { let mut tree = nodes(input...
#![allow(dead_code)] use nalgebra; use nalgebra::geometry::{Point3, UnitQuaternion, Quaternion, Translation3}; use nalgebra::core::{Matrix4}; pub fn m16_to_4x4(mat: [f32; 16]) -> [[f32;4]; 4]{ let mat = [ [mat[0], mat[1], mat[2], mat[3]], [mat[4], mat[5], mat[6], mat[7]], [mat[8], mat[9], m...
#![no_main] use libfuzzer_sys::fuzz_target; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::{Context, Poll}; use async_std::io::Cursor; use futures_io::{AsyncRead, AsyncWrite}; #[derive(Clone, Debug)] struct RwWrapper(Arc<Mutex<Cursor<Vec<u8>>>>); impl RwWrapper { fn new(input: Vec<u8>) -> Self {...
extern crate RustSucT4ever_lib; extern crate bv; use RustSucT4ever_lib::range_min_max; use bv::{BitVec}; #[test] fn test_rank_0(){ let test_tree = create_rmm_test_tree(); let result = test_tree.rmm_rank_zero(12); assert_eq!(result, 5); } #[test] fn test_rank_1(){ let test_tree = create_rmm_test_tree()...
#[derive(Options)] pub struct CommandOptions { #[options(help = "print help message")] help: bool, #[options(help = "be verbose")] pub verbose: bool, #[options(help = "overwrites file if exists")] pub overwrite: bool, #[options(help = "config file name. Default is \"config.toml\"")] pub ...
use std::sync::mpsc::Sender; use crate::nfc::{mifare_desfire, utils, MiFareDESFire, NfcError, NfcResult}; use crate::utils::CheckedSender; use crate::web::http_client::*; use crate::Message; const DEFAULT_KEY: [u8; 16] = hex!("00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00"); const PICC_KEY: [u8; 16] = hex!("00 00 0...
use std::collections::*; use super::stats::ResultStat; mod cli; mod qt; mod html; pub fn output(gathered: &BTreeMap<String, ResultStat>) { #[cfg(all(feature = "cli", not(feature = "qt"), not(feature = "html")))] cli::output(gathered); #[cfg(feature = "qt")] qt::output(gathered); #[cfg(feature =...
pub fn convert(s: String, num_rows: i32) -> String { if num_rows <= 1 { return s; } let s = s.as_bytes(); let num_rows = num_rows as usize; let n = s.len(); let mut ret = String::with_capacity(n); let cycle_len = num_rows + num_rows - 2; for i in 0..num_rows { for j in (0...
use json::{ListTypeDefinition, MapTypeDefinition, OptionTypeDefinition, SchemaTypeDefinition}; use quote::Tokens; use std::cell::RefCell; use std::collections::HashMap; use std::rc::Rc; use syn::Ident; use user_type::UserType; pub trait Type { fn rust_type_name(&self) -> String; fn rust_qualified_name(&self) -...
use crate::{ component::{CompositeMesh, CompositeRenderable, CompositeSurfaceCache}, composite_renderer::{Command, Mask, PathElement, Renderable, Triangles}, math::Vec2, mesh_asset_protocol::{Mesh, MeshAsset, MeshVertex}, }; use core::{ assets::{asset::AssetId, database::AssetsDatabase}, ecs::{C...
use std::collections::HashMap; use std::f64; use std::path::Path; use std::path::PathBuf; use std::fs; use chrono::{DateTime, Utc, TimeZone}; use geo::point; use geo::prelude::HaversineDistance; use http; use geo::polygon; use geo::algorithm::intersects::Intersects; use geo::algorithm::contains::Contains; use gdal::{Da...
use std::ops::{Add, AddAssign, Sub, SubAssign, Div, DivAssign, Mul, MulAssign, Index, IndexMut, Neg}; /// Represents an RGB pixel. pub struct RGB { data: Vec3 } /// RGB Vector implementation, mostly a wrapper around a `Vec3`. impl RGB { pub fn zero() -> RGB { RGB { data: Vec3::zero() ...
use bincode::{serialize_into, deserialize_from}; use serde::{Deserialize, Serialize}; use log::debug; use std::env::{current_dir, current_exe}; use std::fs::{create_dir_all, File}; use std::io::{BufReader, BufWriter, ErrorKind, Write}; use std::path::PathBuf; use crate::error::{BoxResult, NoneError}; pub trait Storag...
mod shapes; mod formatter; use std::net::{TcpListener}; use std::io::Write; #[macro_use] extern crate log; extern crate simple_logger; extern crate rand; fn main() { simple_logger::init().unwrap(); info!("starting server..."); let listener = TcpListener::bind("0.0.0.0:55555").unwrap(); info!("server s...
use crate::constants::*; use crate::core::*; use std::sync::Mutex; lazy_static! { static ref GAME: Mutex<Option<Box<dyn BasicGame>>> = Mutex::new(None); } pub trait BasicGame: Send + Sync { fn get_scene(&self) -> &Scene; fn run(&mut self, _delta_time: f64) {} fn key_up(&mut self, _key_code: f64) {} ...
mod evenger; mod error; mod srcdev; mod destdev; mod rule; pub use evenger::Evenger; pub use error::Error; pub type Result<T> = std::result::Result<T, Error>; pub type DeviceId = std::rc::Rc<String>;
//! [Smart Pointers] examples //! //! [smart pointers]: https://doc.rust-lang.org/book/ch15-00-smart-pointers.html pub mod sec01; pub mod sec02; pub mod sec03; pub mod sec04; pub mod sec05; pub mod sec06; pub mod sec07; pub mod sec08;
use crate::error::Error; use bytes::{Buf, BufMut, Bytes, BytesMut}; use std::fmt; /// errorCauseCode is a cause code that appears in either a ERROR or ABORT chunk #[derive(Debug, Copy, Clone, PartialEq, Eq, Default)] pub(crate) struct ErrorCauseCode(pub(crate) u16); pub(crate) const INVALID_STREAM_IDENTIFIER: ErrorC...
/// CreateOrgOption options for creating an organization #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct CreateOrgOption { pub description: Option<String>, pub full_name: Option<String>, pub location: Option<String>, pub repo_admin_change_team_access: Option<bool>, pub username:...
// MIT License // // Copyright (c) 2021 Miguel Peláez // // 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, modif...
#[doc = "Reader of register ADDR0"] pub type R = crate::R<u32, super::ADDR0>; #[doc = "Reader of field `SUBREGION_DISABLE`"] pub type SUBREGION_DISABLE_R = crate::R<u8, u8>; #[doc = "Reader of field `ADDR24`"] pub type ADDR24_R = crate::R<u32, u32>; impl R { #[doc = "Bits 0:7 - See corresponding field for PPU struc...
use super::databus::Databus; use super::state::State; use super::state; use super::addressing::AddressingMode; use super::cpu; use crate::cpu::state::{Status, SR_MASK_BREAK, SR_MASK_B_FLAG}; #[allow(non_camel_case_types)] #[derive(Clone, Copy, PartialEq)] enum Operation { ADC_IMM, ADC_MEM, AND_IMM, AND...
use crate::Lox; use lazy_static::lazy_static; use super::token::{Token, TokenType, Literal}; use std::collections::HashMap; // ======== LEXICAL GRAMMAR ======== // NUMBER → DIGIT+ ( "." DIGIT+ )? ; // STRING → "\"" <any char except "\"">* "\"" ; // IDENTIFIER → ALPHA ( ALPHA | DIGIT )* ; // ALPHA ...
use dynasmrt::aarch64::Assembler; use dynasmrt::{DynasmApi, ExecutableBuffer}; pub struct Function { _func: ExecutableBuffer, entry: unsafe extern "C" fn(a: i32, b: i32) -> i32, } impl Function { pub fn new() -> Function { let mut ops = Assembler::new().unwrap(); let start = ops.offset();...
//! Defines the VMF file abstract syntax tree use std::fmt::{self, Write, Display, Formatter, Result}; /// Utility struct for pretty-printing blocks /// from https://github.com/rust-lang/rust/blob/master/src/libcore/fmt/builders.rs struct PadAdapter<'a> { fmt: &'a mut Write, on_newline: bool, } impl<'a> PadA...
#[cfg(feature = "gui")] mod gui; #[cfg(not(feature = "gui"))] pub fn run() { panic!("gui has not been compiled in"); } #[cfg(feature = "gui")] pub fn run() { gui::run(); }
//! Testing & asserting & case-generating solutions for leetcode. pub mod tree; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }
use grid::Grid; use regex::Regex; use std::collections::HashSet; use std::fmt; use std::str::FromStr; use std::string::ParseError; struct Inch { id: i32, multiple: bool, } impl fmt::Display for Inch { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { if self.multiple { return write!(f, "X"); ...
use super::{RepositorySnapshots, SnapshotBuilder, SnapshotId}; use crate::{working::WorkingDirectory, atomic::AtomicUpdate, error::Error, storage::LocalStorage}; use std::path; impl RepositorySnapshots { // TODO: Need to check if there is any point in creating this snapshot - ie has something changed - this can b...
use nom::*; use lexer::*; use ast::*; use ast::ConstLiteral::*; macro_rules! tag_token ( ($i: expr, $tag: expr) => ({ let (i1, t1) = try_parse!($i, take!(1)); if t1.toks.is_empty() { IResult::Incomplete::<_,_,u32>(Needed::Size(1)) } else { if t1.toks[0] == $tag { ...
use super::*; use winit::*; use std::rc::Rc; use std::cell::RefCell; use buffer::Buffer; use std::path::Path; #[derive(Debug)] pub enum CommandError { UnknownCommand, InvalidCommand(Option<&'static str>) } impl Error for CommandError { fn description(&self) -> &str { use self::CommandError::*; ...
pub mod gaussian; pub mod geometric; pub mod laplace; pub mod stability; use crate::util; use std::os::raw::c_char; #[no_mangle] pub extern "C" fn opendp_meas__bootstrap() -> *const c_char { let spec = r#"{ "functions": [ { "name": "make_base_laplace", "args": [ ["const char *", "selector"], ["void *"...
// use std::env; use std::time::{Duration, Instant}; // NOTE: Rust doesn't have a built-in random number generator so I did need to use a package for that use rand::distributions::{Distribution, Uniform}; fn main() { let min = 500; let max = 5_000; let step = 500; let mut durations = Vec::new(); ...
use crate::*; use std::collections::HashMap; pub type BuiltinFunc = fn(vm: &mut VM, self_val: Value, args: &Args) -> VMResult; pub type MethodTable = HashMap<IdentId, MethodRef>; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub struct MethodRef(u32); impl std::hash::Hash for MethodRef { fn hash<H: std::hash::Ha...
#[doc = "Reader of register CFG1"] pub type R = crate::R<u32, super::CFG1>; #[doc = "Writer for register CFG1"] pub type W = crate::W<u32, super::CFG1>; #[doc = "Register CFG1 `reset()`'s with value 0x0007_0007"] impl crate::ResetValue for super::CFG1 { type Type = u32; #[inline(always)] fn reset_value() ->...
#[doc = "Register `RF1R` reader"] pub type R = crate::R<RF1R_SPEC>; #[doc = "Register `RF1R` writer"] pub type W = crate::W<RF1R_SPEC>; #[doc = "Field `FMP1` reader - FMP1"] pub type FMP1_R = crate::FieldReader; #[doc = "Field `FULL1` reader - FULL1"] pub type FULL1_R = crate::BitReader; #[doc = "Field `FULL1` writer -...
use std::marker::PhantomData; use hyper::method::Method; use response; use request::RequestBuilder; use request::DoRequest; impl<'t> RequestBuilder<'t, response::SshKeys> { pub fn create(self, name: &str, pub_key: &str) -> RequestBuilder<'t, response::SshKey> { // POST: "https://api.digitalocean.com/v2/a...
macro_rules! gen_bench { ($Type:tt, $Words:ty, $NBITS:expr, $BOUND:expr) => { use compacts::bit_set::{self, BitSet}; use {rand, rand::prelude::*, test::Bencher}; type Ty = $Words; type BitSetType = $Type<Ty>; macro_rules! bits { ($nbits: expr,$range: expr,$rng:...
// 2019-07-11 // Le fameux cours sur les Mutex ! use std::sync::Mutex; fn main() { let m = Mutex::new(5); { // la méthode lock() permet d'acquérir les droits de changement sur les // données. Cette méthode renvoie la valeur contenue par le Mutex, // on la traite comme une référence m...
// inspired by https://github.com/mmckegg/rust-loop-drop/blob/master/src/midi_time.rs // http://www.deluge.co/?q=midi-tempo-bpm use std::time::{Duration, Instant}; use std::thread::{sleep, spawn}; use std::sync::mpsc::{channel, Sender, TryRecvError}; use num::rational::Ratio; use num::integer::Integer; use metronome;...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - TIM17 control register 1"] pub tim17_cr1: TIM17_CR1, _reserved1: [u8; 0x02], #[doc = "0x04 - TIM17 control register 2"] pub tim17_cr2: TIM17_CR2, _reserved2: [u8; 0x06], #[doc = "0x0c - TIM17 DMA/interrupt enabl...
use crate::paxos::paxos_server::Paxos; use crate::paxos::{Acceptor, Proposer, RoundNum}; use std::collections::HashMap; use std::sync::{Arc, Mutex}; use tonic::{Request, Response, Status}; #[derive(Debug)] pub struct PaxosService { pub storage: Arc<Mutex<HashMap<String, Acceptor>>>, } #[tonic::async_trait] impl P...
// Copyright 2019, 2020 Wingchain // // 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...
/// Returns a ConnectableObservable. A ConnectableObservable Observable /// resembles an ordinary Observable, except that it does not begin emitting /// items when it is subscribed to, but only when the Connect operator is /// applied to it. In this way you can wait for all intended observers to /// subscribe to the Ob...
use std::collections::HashMap; use std::fs::File; use fuse::FileAttr; use grammers_client::ext::MessageMediaExt; use grammers_client::{Client, ClientHandle, Config, InputMessage}; use grammers_session::Session; use grammers_tl_types as tl; use tempfile::NamedTempFile; use crate::serialization::{from_str, to_string}; ...
#![cfg(test)] use super::*; use crate::physics::single_chain::test::Parameters; mod base { use super::*; use rand::Rng; #[test] fn init() { let parameters = Parameters::default(); let _ = SWFJC::init(parameters.number_of_links_minimum, parameters.link_length_reference, par...
/** Window Procedure Functions (Windows) **/ use super::super::prelude::{ HWND , UINT , WPARAM , LPARAM , LRESULT }; #[link(name = "User32")] extern "stdcall" { pub fn DefWindowProcW( /* _In_ */ hWnd : HWND , /* _In_ */ Msg : UINT , /* _In_ */ wParam : WP...
// Copyright (c) 2016, <daggerbot@gmail.com> // This software is available under the terms of the zlib license. // See COPYING.md for more information. mod device; mod display; mod event; mod pixel_format; mod window; use std::mem; use std::rc::Rc; use std::os::raw::*; use aurum::linear::Vec2; use x11_dl::xlib; use...
use crate::{AlertMessage, EpochNumber, Timestamp}; use ckb_types::U256; use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize, Debug)] pub struct ChainInfo { // network name pub chain: String, // median time for the current tip block pub median_time: Timestamp, // the current epoch n...
use graphics::color::hex; use graphics::types::Color; lazy_static! { pub static ref BLACK: Color = hex("000000"); pub static ref RED: Color = hex("9e1316"); pub static ref MARS: Color = hex("aa4337"); }
#[macro_use] extern crate log; extern crate env_logger; extern crate actix_web; extern crate listenfd; use listenfd::ListenFd; use actix_web::{server, App}; mod routes; mod middlewares; fn main() { std::env::set_var("RUST_LOG", "actix_web=info,my_rust_api=info"); env_logger::init(); info!("Starting up ....
extern crate libc; extern crate kernel32; extern crate checked_int_cast; extern crate winapi; #[macro_use] extern crate lazy_static; use std::iter; use std::ptr; use std::mem::transmute; use winapi::minwindef::{HMODULE, FARPROC}; use std::ffi::{OsStr, OsString}; use std::os::windows::ffi::{OsStrExt, OsStringExt}; use ...
extern crate patronus; use patronus::{Patronus, Properties}; fn main() { let sentence = "Tou manny misteaks woudl confuez an horse. Naturally, mistakes are good."; let lang = "en"; let checker = Patronus::new(); let properties = Properties { primary_language: String::from(lang), }; f...
use std::{ fs::File, io::Read, }; use gl::types::*; fn compile_shader(filename: &str, shader_type: GLenum) -> GLuint { let mut src = Vec::with_capacity(512); File::open(filename) .unwrap_or_else(|e| { panic!("Could not open shader source `{}`: {}", filename, e) }) ...
mod toggle; use toggle::{Side, State, ToggleCount}; use std::ops::{Deref, DerefMut}; use std::slice; use std::sync::atomic::AtomicUsize; use std::sync::atomic::Ordering; use std::sync::Mutex; #[derive(Debug)] pub struct OwnedDoublet { header: Header, left_buffer: Vec<u8>, right_buffer: Vec<u8>, has...
use async_std::{ task, fs, path::PathBuf, net::{TcpStream, UdpSocket, TcpListener}, io::{self, Read, Write, ReadExt, prelude::*}, prelude::* }; pub async fn udp() -> io::Result<()> { let socket = UdpSocket::bind("127.0.0.1:8080").await?; println!("Listening on {}", socket.local_addr()?); ...
use crate::grammar::ast::Block; use crate::grammar::ast::{ BinaryExpression, BinaryOp, BooleanLit, Conditional, Expression, NumLit, Parens, ScopedName, SelfLit, StringLit, }; use crate::grammar::model::WrightInput; use crate::grammar::parsers::expression::binary_expression::primary::range::range_primary; use cr...
// =============================================================================== // Authors: AFRL/RQQA // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division // // Copyright (c) 2017 Government of the United State of America, as represented by // the Secretary of th...
// Copyright 2020 Parity Technologies (UK) Ltd. // This file is part of Substrate. // Substrate is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any la...
use crate::scene::commands::camera::SetColorGradingLutCommand; use crate::{ command::Command, physics::{Collider, Joint, RigidBody}, scene::{ clipboard::DeepCloneResult, commands::{ camera::{ SetCameraPreviewCommand, SetColorGradingEnabledCommand, SetExposureComma...
use super::*; pub struct HandleScope { scope_: V8::HandleScope, } impl HandleScope { pub fn new() -> HandleScope { HandleScope { scope_: unsafe { V8::HandleScope::new(Isolate::raw()) }, } } } impl Drop for HandleScope { fn drop(&mut self) { unsafe { sel...
use {Term, Type}; extern crate lalrpop_util as __lalrpop_util; mod __parse__Term { #![allow(non_snake_case, non_camel_case_types, unused_mut, unused_variables, unused_imports)] use {Term, Type}; extern crate lalrpop_util as __lalrpop_util; #[allow(dead_code)] pub enum __Symbol<'input> { Te...
use error; pub type FromBeamResult<T> = Result<T, error::FromBeamError>;
extern crate encoding; extern crate regex; extern crate console; extern crate pbr; use crate::config::{ClientConfig, BUFFER_SIZE}; use crate::config::{ACK_MESSAGE, PREPARE_TRANSFER_MESSAGE, CANNOT_FIND_FILE_MESSAGE, REMOVED_OK_MESSAGE, REM...
//! A [`StorageBackend`](crate::storage::StorageBackend) that uses a local filesystem, like a traditional FTP server. use crate::storage::{Error, ErrorKind, Fileinfo, Metadata, Result, StorageBackend}; use async_trait::async_trait; use futures::prelude::*; use std::{ fmt::Debug, path::{Path, PathBuf}, time...
pub mod smallstep;
extern crate ggez; extern crate nalgebra; use ggez::*; use ggez::graphics::{DrawMode, Mesh, Rect, Color, Point2, Vector2}; type Matrix2 = nalgebra::Matrix2<f32>; pub const G: f32 = 1.; pub struct Body { // TODO add forces pub pos: Point2, pub vel: Vector2, pub mass: f32, } impl Body { pub fn ap...
use std::{borrow::Cow, iter, marker::PhantomData, ops}; use crate::{ bit_set, bit_set::ops::*, bit_set::{Bits, Index, Run, Word}, }; use super::{And, AndEntries}; impl<'r, 'a, T> Index<&'r Bits<'a, T>> for ops::RangeFull { type Output = Bits<'a, T>; fn get(&self, range: &'r Bits<'a, T>) -> Self::...
iter x() -> int { } fn f() -> bool { for each i: int in x() { ret true; } ret false; } fn main(args: [str]) { f(); }
/* * 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 */ /// GcpAccount : Your Google Cloud Platform Account. #[derive(Clone, Debug, PartialEq, Serialize, Des...
mod info; pub use info::*;
#![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)] Alerts_List(#[from] alerts::list::Err...
use serde::{Deserialize, Serialize}; use serde_json::Result; #[derive(Serialize, Deserialize)] pub struct Story { pub story_name: String, pub scenes: Vec<NamedScene>, } #[derive(Serialize, Deserialize)] pub struct NamedScene { pub scene_name: String, pub scene: Scene, } #[derive(Serialize, Deserializ...
// Copyright 2021 Red Hat, Inc. // // 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 i...
/* Copyright (c) 2023 Uber Technologies, Inc. <p>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 <p>http://www.apache.org/licenses/LICENSE-2.0 <p>Unless required by applicable law or agreed to ...
#[doc = "Register `SDMMC_ID` reader"] pub type R = crate::R<SDMMC_ID_SPEC>; #[doc = "Field `IP_ID` reader - SDMMC IP identification."] pub type IP_ID_R = crate::FieldReader<u32>; impl R { #[doc = "Bits 0:31 - SDMMC IP identification."] #[inline(always)] pub fn ip_id(&self) -> IP_ID_R { IP_ID_R::new(...
use std::collections::HashMap; use regex::Regex; use crate::layout::LayoutDirection; pub enum MarkupLength { Dp(f32), Star(f32), Content, Fill, } pub struct MarkupElement { pub node_name: String, pub number: i32, pub attributes: HashMap<String, String>, pub children: Vec<MarkupElemen...