text
stringlengths
8
4.13M
use std::io; use std::sync::atomic::Ordering; #[cfg(feature = "io_timeout")] use std::time::Duration; use super::super::{co_io_result, from_nix_error, IoData}; #[cfg(feature = "io_cancel")] use crate::coroutine_impl::co_cancel_data; use crate::coroutine_impl::{is_coroutine, CoroutineImpl, EventSource}; use crate::io::...
pub trait RLayout { fn layout( &self ); }
use std::default::Default; /// A resource holding the render settings that can be adjusted by the player. #[derive(Debug, Clone)] pub struct RenderConfig { /// The size of a tile in Pixels in f32. Needed to calculate offsets, /// otherwise width and height could only be retrieved from the Sprite itself, which ...
use core::borrow::{Borrow, BorrowMut}; use core::convert::{AsMut, AsRef}; use core::fmt; use core::marker::PhantomData; use core::mem::{self, ManuallyDrop}; use core::ops::{Deref, DerefMut}; use core::ptr::NonNull; cfg_if::cfg_if! { if #[cfg(feature = "std")] { use std::boxed::Box; } else { use...
use std::io::{Read, Write, Result}; use std::mem; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; pub fn read_string(read: &mut Read) -> Result<String> { let string_length = try!(read.read_u16::<BigEndian>()) as usize; let mut string_bytes = Vec::with_capacity(string_length); unsafe { st...
use crate::Result; use byteorder::*; #[repr(u32)] #[derive(Copy, Clone)] pub enum Shdr_type { NULL = 0x0, PROGBITS = 0x1, SYMTAB = 0x2, STRTAB = 0x3, RELA = 0x4, HASH = 0x5, DYNAMIC = 0x6, NOTE = 0x7, NOBITS = 0x8, REL = 0x9, SHLIB = 0x0A, DYNSYM = 0x0B, INIT_ARR...
fn diverges() { println!("fuck you"); panic!(); } fn return_i(x: i32) -> i32 { println!("hello there"); if x==40 { x } else { println!("oh god are you kidding me"); diverges(); } } fn main() { println!("start"); let x: i32=return_i(42); x; println!("end"); }
#[doc = "Reader of register RANDOMBIT"] pub type R = crate::R<u32, super::RANDOMBIT>; #[doc = "Reader of field `RANDOMBIT`"] pub type RANDOMBIT_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0"] #[inline(always)] pub fn randombit(&self) -> RANDOMBIT_R { RANDOMBIT_R::new((self.bits & 0x01) != 0) ...
// // Process viewer // // Copyright (c) 2019 Guillaume Gomez // use gtk::glib; use gtk::prelude::*; use serde_derive::{Deserialize, Serialize}; use std::cell::RefCell; use std::fs::{create_dir_all, File}; use std::io::Read; use std::path::{Path, PathBuf}; use std::rc::Rc; use crate::utils::{get_app, get_main_windo...
//! Defines common `async` tasks used by Krator's Controller //! [Manager](crate::manager::Manager). use std::future::Future; use futures::FutureExt; use kube::{api::ApiResource, api::GroupVersionKind, Resource}; use kube_runtime::watcher::Event; use tracing::{debug, info, warn}; use crate::{ manager::controlle...
use super::{ Action, Pause, Initialization}; use dotrix::ecs::{ Mut, Const }; use dotrix::{ Window, State}; use dotrix::math::{ Vec2i, Vec2u }; use dotrix::services::{ Input, }; use dotrix::overlay::Overlay; use dotrix::window::{ Fullscreen, }; use dotrix::egui::{ self, Egui, }; pub struct Settings { pub...
#[doc = "Register `TTOST` reader"] pub type R = crate::R<TTOST_SPEC>; #[doc = "Register `TTOST` writer"] pub type W = crate::W<TTOST_SPEC>; #[doc = "Field `EL` reader - Error Level"] pub type EL_R = crate::FieldReader; #[doc = "Field `EL` writer - Error Level"] pub type EL_W<'a, REG, const O: u8> = crate::FieldWriter<'...
extern crate bodyparser; extern crate exonum; extern crate iron; extern crate router; extern crate serde; extern crate serde_json; use std::collections::HashMap; use exonum::api::Api; use exonum::blockchain::Blockchain; use exonum::crypto::PublicKey; // use exonum::encoding::serialize::FromHex; use hyper::header::Con...
use Packages_and_Crates::mode1::detail as A; use rand::Rng; use Packages_and_Crates::HashMap; fn main() { // Externel Crates from crate.io let number = rand::thread_rng().gen_range(1,11); println!("{}",number); let mut v = HashMap::new(); v.insert("1","Abbas"); println!("Hello, world!"); detail(); A(); } ...
use std::mem; use std::rc::Rc; #[derive(Debug)] pub struct ParseTree<K> { pub kind: K, pub span: Span, pub child: Option<Rc<ParseTree<K>>>, pub sibling: Option<Rc<ParseTree<K>>>, } #[derive(Debug)] pub struct Span { pub lo: usize, pub hi: usize, } pub const DUMMY_SPAN: Span = Span { lo: 0, hi...
#[cfg(test)] mod param_test; pub(crate) mod param_chunk_list; pub(crate) mod param_forward_tsn_supported; pub(crate) mod param_header; pub(crate) mod param_heartbeat_info; pub(crate) mod param_outgoing_reset_request; pub(crate) mod param_random; pub(crate) mod param_reconfig_response; pub(crate) mod param_requested_hm...
/*! Day2 * http://adventofcode.com/2018/day/2 */ extern crate day02; type Result<T> = std::result::Result<T, Box<std::error::Error>>; static INPUT: &'static str = include_str!("../../input.txt"); pub fn main() { println!( "Solution 2a: {}", day02::solve2a(parse_input(INPUT).expect("Error Parsi...
mod async_smoltcp; mod virtual_tun; pub mod socket; pub mod vpn_client; pub use async_smoltcp::*; pub const DEFAULT_MTU: usize = 1500;
mod weather; use serde_json; use std::{fs, env}; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error + Send + Sync>> { // Load config let contents = fs::read_to_string("config.json")?; let cfg: serde_json::Value = serde_json::from_str(&contents)?; // Load args let args: Vec<Str...
use std::collections::HashMap; use std::collections::HashSet; use std::io; use std::io::BufRead; use std::io::BufReader; use std::num::ParseIntError; use std::str::FromStr; #[derive(Debug)] struct Program { name: String, weight: u32, children: Vec<String>, } impl FromStr for Program { type Err = Parse...
#[doc = "Register `RCC_AHB3RSTSETR` reader"] pub type R = crate::R<RCC_AHB3RSTSETR_SPEC>; #[doc = "Register `RCC_AHB3RSTSETR` writer"] pub type W = crate::W<RCC_AHB3RSTSETR_SPEC>; #[doc = "Field `DCMIRST` reader - DCMIRST"] pub type DCMIRST_R = crate::BitReader; #[doc = "Field `DCMIRST` writer - DCMIRST"] pub type DCMI...
use std::cmp::Ordering; use std::time::Duration; use std::{env, path}; use ggez::event::{self, EventHandler}; use ggez::nalgebra::Point2; use ggez::{filesystem, graphics, timer}; use ggez::{Context, GameResult}; impl EventHandler for SemiFixedTimeStep { fn update(&mut self, ctx: &mut Context) -> GameResult<()> { ...
mod piece; pub use piece::*; mod bishop; pub use bishop::*; mod king; pub use king::*; mod knight; pub use knight::*; mod pawn; pub use pawn::*; mod queen; pub use queen::*; mod rook; pub use rook::*;
use core::ffi::c_void; use std::mem::{size_of, transmute, MaybeUninit}; use std::ptr; use std::slice; use ash::prelude::VkResult; use ash::version::{DeviceV1_0, InstanceV1_0}; use ash::{self, vk}; use super::error::VulkanError; #[allow(unused_unsafe)] pub unsafe fn create_empty_image( instance: &ash::Instance, ...
#![allow(unstable)] #![feature(quote)] #![feature(plugin_registrar)] extern crate lalr; extern crate syntax; use lalr::*; use syntax::ast; use syntax::codemap::{self, DUMMY_SP}; use syntax::ext::base::ExtCtxt; use syntax::ext::build::AstBuilder; use std::collections::BTreeMap; use syntax::parse::token::str_to_ident; ...
pub fn lin_grad(c1 : [u8;3], c2 : [u8;3], n : u32) -> Vec<[u8;3]> { let mut grad = Vec::new(); for i in 0..= n { let t = (i as f32)/(n as f32); let [r1, g1, b1] = c1; let [r2, g2, b2] = c2; let r = ((r1 as f32) * (1.0 - t) + (r2 as f32)*t).round() as u8; let g = ((g1 as f...
/// An enum to represent all characters in the Ahom block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Ahom { /// \u{11700}: '𑜀' LetterKa, /// \u{11701}: '𑜁' LetterKha, /// \u{11702}: '𑜂' LetterNga, /// \u{11703}: '𑜃' LetterNa, /// \u{11704}: '𑜄' LetterTa, ...
use serde::Deserialize; use crate::geometry2d::*; use super::{Asset, AssetExt, AssetResult, AssetError, category}; // ------------------------------------------------------------------------------------------------- #[derive(Copy, Clone, Eq, PartialEq, Debug)] pub enum ImageFormat { RGB24, RGBA32, } impl Im...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - DCMI control register"] pub dcmi_cr: DCMI_CR, #[doc = "0x04 - DCMI status register"] pub dcmi_sr: DCMI_SR, #[doc = "0x08 - DCMI_RIS gives the raw interrupt status and is accessible in read only. When read, this register...
use std::io::Write; use std::collections::HashMap; use parser::html::Expression as Expr; use parser::html::Statement as Stmt; use parser::html::Statement::{Store}; use util::join; use super::Generator; use super::ast::{Statement, Param, Expression}; use super::ast::Expression as E; use super::ast::Statement as S; fn...
use physics::{ElevatorState, MAX_JERK, MAX_ACCELERATION, MAX_VELOCITY}; use buildings::{Building, getCumulativeFloorHeight}; pub trait MotionController { fn init(&mut self, esp: Box<Building>, est: ElevatorState); fn adjust(&mut self, est: &ElevatorState, dst: u64) -> f64; } pub struct SmoothMotionController { ...
mod server; mod handler; pub use self::server::*; // ex: noet ts=4 filetype=rust
extern crate dbus; use dbus::{Connection, BusType, Message}; use dbus::arg::Array; use std::fmt::Write; fn main() { let c = Connection::get_private(BusType::Session).unwrap(); let m = Message::new_method_call("com.example.dbustest", "/hello", "com.example.dbustest", "Hello").expect("failed to create method")...
#[doc = "Register `TIM15_EGR` reader"] pub type R = crate::R<TIM15_EGR_SPEC>; #[doc = "Register `TIM15_EGR` writer"] pub type W = crate::W<TIM15_EGR_SPEC>; #[doc = "Field `UG` writer - Update generation This bit can be set by software, it is automatically cleared by hardware."] pub type UG_W<'a, REG, const O: u8> = cra...
use core::u32; extern "C" { pub fn kReadCPUID( dwEAX: u32, pdwEAX: *mut u32, pdwEBX: *mut u32, pdwECX: *mut u32, pdwEDX: *mut u32, ); pub fn kSwitchAndExecute64BitKernel(); }
// This file is part of Substrate. // Copyright (C) 2018-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0 // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the F...
use crate::bits2d::Bits2D; use std::fmt; #[derive(Clone, PartialEq, Eq, Hash, Debug)] pub struct Shape(Bits2D); impl fmt::Display for Shape { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let data = &self.0; for line in 1..=data.length2() { let y = data.length2() - line; ...
extern crate serde; use self::serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::vec::Vec; #[derive(Serialize, Deserialize, Debug)] pub struct KeyProviderInput { op: String, pub keywrapparams: KeyWrapParams, pub keyunwrapparams: KeyUnwrapParams, } #[derive(Serialize, Deserialize, De...
use std::fs; #[derive(Copy, Clone)] struct PasswordTuple<'a> { min_occ: i32, max_occ: i32, letter: char, password: &'a str, } impl <'a>PasswordTuple<'a> { fn is_valid (&'a self) -> bool { let mut first_matched = false; let mut second_matched = false; for (position, charact...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - TZIC interrupt enable register 1"] pub ier1: IER1, #[doc = "0x04 - TZIC interrupt enable register 2"] pub ier2: IER2, #[doc = "0x08 - TZIC interrupt enable register 3"] pub ier3: IER3, _reserved3: [u8; 0x04], ...
mod target; mod drawable; mod builder; use builder::WindowBuilder; pub use target::DrawTarget; pub use drawable::Drawable; #[derive(Copy, Clone)] pub struct Window(usize); impl Window { #[inline] pub fn new() -> WindowBuilder { WindowBuilder::default() } #[inline] pub fn draw(self) -> D...
// use std::io; // use std::io::prelude::*; // use regex::Regex; // fn main() { // let mut input = String::new(); // print!("Numbers to sort: "); // io::stdout().flush().unwrap(); // io::stdin().read_line(&mut input).ok().expect("failed to read line"); // let re = Regex::new(r"\s+").unwrap(); // ...
//! MIPS CP0 ErrorEPC register register_rw!(30, 0);
use array2d::Array2D; use rand::Rng; use std::ops::Range; use std::collections::HashSet; use rand::distributions::Uniform; use std::fmt; struct Grid { grid: Array2D<bool> } // To achieve uniform distribution of grids fn random_indexes_in_range(range: Range<usize>, expected: usize) -> HashSet<usize> { let mut ...
use websocket::sync::Client; use std::net::TcpStream; use std::thread; use std::sync::mpsc; use websocket::{Message, OwnedMessage}; pub struct WsClient { pub conn: Client<TcpStream>, } impl WsClient { pub fn run(self, receiver: mpsc::Receiver<Vec<u8>>) { let (mut rstream, mut sstream) = self.conn.split().unwrap...
fn main(){ struct Home { name: String, rooms: i32, sold: bool, } let mut home1 = Home { name: String::from("myhome"), rooms: 13, sold: false, }; home1.sold = true; println!("sold = {}", home1.sold); }
use crate::model::model_utils::{GridPosition, grid_to_position}; use cgmath; pub struct FoxHole<T> { pub entry: T, pub exit: T, pub used: bool, pub entry_sprite: i32, pub exit_sprite: i32, pub closed_sprite: i32, } impl<T> FoxHole<T> { pub fn new(entry: T, exit: T, used: Option<bool>) -> F...
fn main() { let mut x: i32 = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); let _c = 'z'; let _z = 'Z'; let heart_eyed_cat = '😻'; println!("{}", heart_eyed_cat); }
pub mod command; pub mod commands { pub mod add; pub mod clear; pub mod delete; pub mod jump; pub mod list; pub mod ls; pub mod rename; } pub mod domain { pub mod command_line; pub mod model; pub mod repository; pub mod service; } pub mod infrastructure { pub mod comma...
use super::*; #[test] fn traverse_at_root_dir() { assert_eq!(traverse_reduce("c:/").unwrap(), "c:/"); assert_eq!(traverse_reduce("D:/").unwrap(), "D:/"); assert_eq!(traverse_reduce("c:\\").unwrap(), "c:/"); assert_eq!(traverse_reduce("D:\\").unwrap(), "D:/"); assert_eq!(traverse_reduce("c:").unwrap...
use serenity::builder::CreateEmbed; use serenity::framework::standard::{Args, CommandError}; use serenity::model::channel::Message; use serenity::prelude::Context; use crate::commands::servers::lobby_details; use crate::commands::servers::*; use crate::db::{DbConnection, DbConnectionKey}; use crate::model::enums::{Nat...
use crate::{execute::ExecuteArgs, Client, ClientFactory, Execute, Parameter, QueryRows, ToSql}; use futures::{Stream, StreamExt, TryStreamExt}; use std::{ borrow::Cow, fmt::Debug, pin::Pin, sync::{ atomic::{AtomicBool, Ordering::Relaxed}, Arc, }, task::{Context, Poll}, }; use sto...
pub mod data; mod query; #[cfg(test)] mod test; use hyper::{body::HttpBody as _, client::HttpConnector, Client}; use hyper_tls::HttpsConnector; use percent_encoding::{utf8_percent_encode, NON_ALPHANUMERIC}; use data::{MVGError}; use data::location::{Location, Locations}; use data::departure::{Departure, DepartureInf...
const AVERAGE_EARTH_RADIUS: f64 = 6371000.0; #[no_mangle] pub unsafe extern "C" fn haversine(lat1:f64, lon1:f64, lat2:f64, lon2:f64) -> f64 { let d_lat = (lat2 - lat1).to_radians(); let d_lon = (lon2 - lon1).to_radians(); let l1 = (lat1).to_radians(); let l2 = (lat2).to_radians(); let a = ((d_lat...
use crate::{definitions::*, packet::*}; use bytes::{BufMut, Bytes, BytesMut}; use num_traits::ToPrimitive; pub fn encode_fix_header(src: FixHeader, bytes: &mut BytesMut) { bytes.put_u8((src.control_packet_type.to_u8().unwrap() << 4) | src.flags.0 | (src.flags.1 << 1) | (src.flags.2 << 2) | (src.flags.3 << 3)); } p...
/// Compare two errors /// /// Used for testing only #[macro_export] macro_rules! assert_error_eq { ($left:expr, $right:expr) => { assert_eq!( Into::<$crate::Error>::into($left).to_string(), Into::<$crate::Error>::into($right).to_string(), ); }; ($left:expr, $right:ex...
use solana_program::{ account_info::{next_account_info, AccountInfo}, entrypoint::ProgramResult, msg, program_error::ProgramError, pubkey::Pubkey, }; // use solana_program::{borsh}; use borsh::{BorshDeserialize, BorshSerialize}; pub trait Serdes: Sized + BorshSerialize + BorshDeserialize { fn pack(&self, dst: &m...
use crate::config::QTableProps; use crate::data::DataTable; use crate::data::DataTableExt; use crate::group::Groups; use crate::limits::LimitsTableExt; use crate::limits::{Limits, LimitsExt, LimitsTable, YieldOk}; use crate::numbers::{F64Ext, Numbers}; use crate::pdf::{tint, Pdf, Pos, Tint}; use crate::table::{CellCont...
use std::env; use std::fs; fn main(){ let args : Vec<String> = env::args().collect(); if args.len() < 2 { return; } let input = fs::read_to_string(&args[1]).unwrap() .strip_suffix('\n').unwrap() .parse::<i32>().unwrap(); let mut elves = Vec::<i32>::new(); for i in 1..in...
#![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct EhNamespaceListResult { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec<EhNamespace...
extern crate sack; use sack::data_store::kv_store::{KVSack, WriteableKVSack}; fn main() { let mut s: KVSack<i32, i32> = KVSack::default(); let foo = s.insert(1, 2); println!("s: {:?}", foo); } // impl<C,D> SackBacker for BTreeMap<C,D>{} // #[derive(Clone,Ord,Eq,PartialOrd,PartialEq,Debug)] // pub struct...
use diesel::ExpressionMethods; use diesel::pg::PgConnection; use diesel::query_builder::SqlQuery; use diesel::query_dsl::QueryDsl; use diesel::RunQueryDsl; use diesel::sql_query; use std::slice::SliceConcatExt; use std::sync::mpsc; use std::sync::mpsc::{Receiver, Sender}; use std::sync::Arc; use epoch; use epoch::*; u...
use connection::Connection; use key_exchange::{KexResult, KeyExchange}; use message::MessageType; use num_bigint::{BigInt, RandBigInt, ToBigInt}; use packet::{Packet, ReadPacketExt, WritePacketExt}; use rand; const DH_GEX_GROUP: u8 = 31; const DH_GEX_INIT: u8 = 32; const DH_GEX_REPLY: u8 = 33; const DH_GEX_REQUEST: u8...
use std::env; use std::fs::*; use clap::*; use serde::{Serialize, Deserialize}; use std::io::prelude::*; #[derive(Clone, Debug, Serialize, Deserialize)] pub struct ProgramArgs { pub input_file: String, pub output_file: String, pub pixel_size: u32, pub thread_count: u8, pub create_joined: bool, ...
use crate::grandpa::GrandpaJustification; use crate::{Config, EncodedBlockHash, EncodedBlockNumber, Error}; use codec::Decode; use frame_support::Parameter; use num_traits::AsPrimitive; use sp_runtime::generic; use sp_runtime::traits::{ AtLeast32BitUnsigned, Hash as HashT, Header as HeaderT, MaybeDisplay, Maybe...
#[derive(Debug, PartialEq)] pub struct Error<T> { msg: T, } // brute force fn __is_prime(n: i32) -> bool { if n < 2 { return false; } for y in (2..n).rev() { if n % y == 0 { return false; } } return true; } // AKS (?) fn is_prime(n: i32) -> bool { if n <...
pub use self::platform::*; #[cfg(target_os = "linux")] #[path = "linux/mod.rs"] mod platform; #[cfg(target_os = "windows")] #[path = "windows/mod.rs"] mod platform;
use super::{check_dtype, HasPandasColumn, PandasColumn, PandasColumnObject}; use crate::errors::ConnectorXPythonError; use anyhow::anyhow; use chrono::{DateTime, Utc}; use fehler::throws; use ndarray::{ArrayViewMut2, Axis, Ix2}; use numpy::PyArray; use pyo3::{FromPyObject, PyAny, PyResult}; use std::any::TypeId; // da...
#[doc = "Register `FMC_PCR` reader"] pub type R = crate::R<FMC_PCR_SPEC>; #[doc = "Register `FMC_PCR` writer"] pub type W = crate::W<FMC_PCR_SPEC>; #[doc = "Field `PWAITEN` reader - PWAITEN"] pub type PWAITEN_R = crate::BitReader; #[doc = "Field `PWAITEN` writer - PWAITEN"] pub type PWAITEN_W<'a, REG, const O: u8> = cr...
use crate::config; use std::fs; pub fn get_file_list(storage: &str) -> String { let mut msg = String::new(); for entry in fs::read_dir(storage).unwrap() { let entry = entry.unwrap(); let path = entry.path(); if !path.is_dir() { let fullpath = String::from(entry.path().to_st...
#![feature(alloc)] extern crate byteorder; #[macro_use] extern crate enum_primitive; extern crate num; pub mod bytecode; pub mod context; pub mod cst; pub mod environment; pub mod function; pub mod io; pub mod scribe;
// cargo-deps: maze="^0.1.2" // A demonstration of the A* algorithm in Rust. extern crate maze; macro_rules! impl_ord_supertraits { ( $name:tt, $( $params:tt ),* ) => { impl< $( $params ),* > PartialEq for $name < $( $params ),* > { fn eq(&self, other: &$name < $( $params ),* >) -> bool { ...
//! Module with hardware key port\masks /// Struct, which contains mast and port of key #[rustfmt::skip] #[cfg_attr(feature = "strum", derive(strum::EnumIter))] #[derive(Debug, Clone, Copy)] pub enum ZXKey { // Port 0xFEFE Shift, Z, X, C, V, // Port 0xFDFE A, S, D, F, G, // Port 0xFBFE Q, W, E,...
extern crate day_01_inverse_captcha; extern crate utils; use day_01_inverse_captcha::inv_captcha; use utils::{file2str, str2vec_u32}; fn main() { let puzzle_string = file2str("puzzle.txt"); let puzzle_vec = str2vec_u32(&puzzle_string); let sum = inv_captcha(puzzle_vec); println!("The sum is: {}", sum);...
use crate::{ components::{Human, MovementState, Player}, utils, }; use amethyst::{ derive::SystemDesc, ecs::{Join, Read, ReadStorage, System, SystemData, WriteStorage}, input::{InputHandler, StringBindings}, }; #[derive(SystemDesc)] pub struct InputMovement; fn movement_multiplier(raw_movement_x: ...
extern crate patronus; extern crate patronus_provider; pub use patronus_provider::{Annotation, AnnotationArray, Properties, Suggestion}; use std::ffi::{CStr, CString}; use std::os::raw::c_char; /// Opaque wrapper for `Patronus` struct. pub enum Patronus {} /// Creates an instance of `Patronus` checker. /// The retur...
use amethyst::{ core::bundle::{Result, SystemBundle}, ecs::DispatcherBuilder, prelude::*, }; use crate::level; use crate::system; #[derive(Default)] pub struct LevelBundle; impl<'a, 'b> SystemBundle<'a, 'b> for LevelBundle { fn build(self, builder: &mut DispatcherBuilder<'a, 'b>) -> Result<()> { ...
use super::{ActivationFrame, CodePointer}; use crate::vm::VirtualMachine; #[derive(Debug, Copy, Clone)] pub struct Closure { code: CodePointer, closed_environment: &'static ActivationFrame, } impl Closure { pub fn new(code: CodePointer, env: &'static ActivationFrame) -> Self { Closure { ...
#[doc = "Register `DDRPERFM_CNT2` reader"] pub type R = crate::R<DDRPERFM_CNT2_SPEC>; #[doc = "Field `CNT` reader - CNT"] pub type CNT_R = crate::FieldReader<u32>; impl R { #[doc = "Bits 0:31 - CNT"] #[inline(always)] pub fn cnt(&self) -> CNT_R { CNT_R::new(self.bits) } } #[doc = "DDRPERFM event...
#[doc = "Register `BMCR` reader"] pub type R = crate::R<BMCR_SPEC>; #[doc = "Register `BMCR` writer"] pub type W = crate::W<BMCR_SPEC>; #[doc = "Field `BME` reader - Burst Mode enable"] pub type BME_R = crate::BitReader<BME_A>; #[doc = "Burst Mode enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq...
use std::collections::{HashMap, HashSet}; use rand::distributions::Distribution; use rand::Rng; use crate::topology::{PixelLoc, Topology}; pub struct PointTracker { frontier: Vec<PixelLoc>, frontier_map: HashMap<PixelLoc, usize>, used: Vec<bool>, topology: Topology, } impl PointTracker { pub fn ...
// Generated by `scripts/generate.js` pub type VkRayTracingShaderGroupType = super::super::khr::VkRayTracingShaderGroupType; #[doc(hidden)] pub type RawVkRayTracingShaderGroupType = super::super::khr::RawVkRayTracingShaderGroupType;
use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use near_sdk::{env, near_bindgen, AccountId, PanicOnDefault, assert_one_yocto, Promise, log}; use near_sdk::json_types::{ValidAccountId, U128}; use near_sdk::collections::{LookupMap}; near_sdk::setup_alloc!(); use crate::utils::{ext_fungible_token, GAS_FO...
use num_derive::FromPrimitive; use num_enum::IntoPrimitive; pub mod dataframe; #[derive(FromPrimitive, IntoPrimitive)] #[repr(u8)] pub enum Type { ACK = 0x6, NAK = 0x15, CAN = 0x18, DATAFRAME = 0x01, } #[derive(Debug, PartialEq)] pub enum Message { Ack, Nak, Can, DataFrame(datafra...
use std::process::Command; pub enum Align { Left, Center, Right, None, } #[derive(Debug)] pub enum WindowManagers { Bspwm, I3, } pub fn run_command<T: Into<String>>(cmd: T) -> String { let command = Command::new("bash") .arg("-c") .arg(cmd.into()) .output().unwrap_...
use std::ffi::CString; use std::os::raw::c_char; #[no_mangle] pub fn get_message() -> *mut c_char { CString::new(String::from("hello world")).unwrap().into_raw() }
use serde_derive::{Deserialize, Serialize}; use crate::{ entity::{Item, Room}, player::Player, types::{CmdResult, ItemMap, RoomMap}, util::dont_have, }; // Represents a world for the player to explore that consists of a grid of Rooms. // A World is a graph data structure that encapsulates a collection...
#![allow(unused_variables, dead_code, unreachable_code)] pub mod machine; pub mod xstate; pub type XState<'i, 'h, Id, Context, Event> = xstate::XState<'i, 'h, Id, Context, Event>; pub type Machine<'s, 'i, 'h, Id, Context, Event> = machine::Machine<'s, 'i, 'h, Id, Context, Event>; pub type TaskResult = Result<TaskOutp...
use crate::ir::{function::*, module::*, opcode::*, types::*, value::*}; use rustc_hash::FxHashMap; #[derive(Debug, Clone, PartialEq)] pub enum ConcreteValue { Void, Int1(bool), Int32(i32), Mem(*mut u8), } #[derive(Debug)] pub struct Interpreter<'a> { module: &'a Module, } impl<'a> Interpreter<'a>...
//use crate::rust_decimal::prelude::FromPrimitive; //use crate::rust_decimal::prelude::ToPrimitive; //use crate::rust_decimal::prelude::Zero; //// use common::bitmap::bitmap; // #[test] // fn bitmap() { // //{{{ // /* // use rbtree::RBTree; // let mut m = RBTree::new(); // assert_eq!(m.len(), 0)...
pub type Result<T> = std::result::Result<T, Error>; #[derive(thiserror::Error, Debug)] pub enum Error { #[error("error parsing socket address: {0}")] AddrParseError(#[from] std::net::AddrParseError), #[error("error during hyper operation: {0}")] HyperError(#[from] hyper::Error), #[error("error du...
use nom::{IResult, InputTakeAtPosition, AsChar, InputIter}; use nom::sequence::tuple; use nom::character::complete::multispace0; use nom::number::complete::{float, le_u8, le_f32, le_u32, be_u8}; use crate::PrimShape::{*}; use std::convert::TryFrom; use nom::error::ErrorKind; use nom::multi::separated_list0; use nom::co...
const REPORT_LEN: i64 = 10000000; fn main() { let mut a: f64 = 1.0; let mut b: f64 = 0.0; //println!("Hello, world"); loop { for _i in 0..REPORT_LEN { b += 1.0 / a; a += 1.0; } println!("{}", b); } }
#[doc = "Register `DINR5` reader"] pub type R = crate::R<DINR5_SPEC>; #[doc = "Field `DIN5` reader - Input data received from MDIO Master during write frames"] pub type DIN5_R = crate::FieldReader<u16>; impl R { #[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"] #[inline(always)] ...
//! Tests auto-converted from "sass-spec/spec/libsass-todo-issues/issue_2295/error" #[allow(unused)] use super::rsass; // From "sass-spec/spec/libsass-todo-issues/issue_2295/error/basic.hrx" // Ignoring "basic", error tests are not supported yet. // From "sass-spec/spec/libsass-todo-issues/issue_2295/error/wrapped.h...
/* * 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 */ /// PagerDutyServiceName : PagerDuty service object name. #[derive(Clone, Debug, PartialEq, Serialize...
pub fn part_01(data: &str) -> usize { use std::collections::HashSet; data .split_terminator("\n\n") .map(|v| v.replace("\n", "")) .map(|v| v .chars() .collect::<HashSet<char>>().len()) .sum() } pub fn part_02(data: &str) -> usize { use std::collectio...
use kappa::Rule; pub fn bind(label: &str) -> Rule { let name = format!("bind | target == {0}", label); rule!( ?name { MACHINE(ip[.], state{bind}, target{?label}), PROG(cm[.], ins[0]), LBL(prog[0], l{?label}) } => { MACHINE(ip[1], state{run}, targ...
pub mod alternative; pub mod issue; pub mod session; pub mod user; pub mod vote; use actix::prelude::*; use sqlx::{ postgres::{PgConnectOptions, PgPoolOptions}, PgPool, }; #[derive(Debug)] pub struct DbExecutor(pub PgPool); impl DbExecutor { pub fn pool(&mut self) -> PgPool { self.0.clone() }...
use crate::material::Material; use crate::types::{Face, MeshVertex, Vertex}; unzip_n::unzip_n!(4); #[derive(Debug)] pub struct Mesh { pub faces: Vec<[u32; 3]>, pub positions: Vec<[f32; 3]>, pub uvs: Option<Vec<[f32; 2]>>, pub normals: Option<Vec<[f32; 3]>>, pub tangents: Option<Vec<[f32; 3]>>, ...