text
stringlengths
8
4.13M
#[cfg(test)] mod offset_tests { use ds::SeqOffset; use rand::prelude::*; use std::collections::HashMap; #[test] fn test_offset() { //test_seq_offset_one(1, 128, 32); //test_seq_offset_one(8, 1024, 32); test_seq_offset_one(64, 1024, 32); } // 一共生成num个offset,每interval...
#[doc = "Register `PRIVCFGR3` reader"] pub type R = crate::R<PRIVCFGR3_SPEC>; #[doc = "Register `PRIVCFGR3` writer"] pub type W = crate::W<PRIVCFGR3_SPEC>; #[doc = "Field `LPTIM6PRIV` reader - privileged access mode for LPTIM6"] pub type LPTIM6PRIV_R = crate::BitReader; #[doc = "Field `LPTIM6PRIV` writer - privileged a...
#![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 enum ServerVersion { #[serde(rename = "5.7")] N5_7, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] p...
use bincode::{serialize_into, Infinite}; use private; use serde::{Deserialize, Serialize}; use std::fmt; use std::fs; use std::io::{BufWriter, Write}; use std::marker::PhantomData; use std::path::{Path, PathBuf}; #[inline] fn u32tou8abe(v: u32) -> [u8; 4] { [v as u8, (v >> 8) as u8, (v >> 24) as u8, (v >> 16) as u...
//! ELF Linker/Loader use error::*; use goblin; use goblin::Hint; use loader::*; use loader::memory::*; use std::collections::{BTreeMap, BTreeSet}; use std::fs::File; use std::io::Read; use std::path::{Path, PathBuf}; // http://stackoverflow.com/questions/37678698/function-to-build-a-fixed-sized-array-from-slice/3767...
#[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::CTRL6 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut...
use crate::format_context::FormatContext; use crate::stream::Stream; use crate::tools::rational::Rational; use ffmpeg_sys_next::*; use log::LevelFilter; use std::collections::{BTreeMap, HashMap}; use std::fmt; #[derive(Debug, Deserialize, PartialEq, Serialize)] pub struct Probe { #[serde(skip_serializing)] filenam...
extern crate num_bigint; extern crate num_traits; use num_bigint::BigInt; use num_bigint::ToBigInt; use num_traits::{Zero, One}; use num_traits::ToPrimitive; use std::fs::File; use std::io::{BufRead, BufReader}; #[derive(Copy, Clone, PartialEq, Debug)] enum DealType { NewStack, WithIncrement(i64), Cut(i6...
#![no_std] use volatile_cell::VolatileCell; // Known to apply to (with exceptions noted): // [RM0360] STM32F030x4/6/8/C and STM32F070x6/B // [RM0091] STM32F0x1, STM32F0x2, STM32F0x8 // [RM0033] STM32F205xx, STM32F207xx, STM32F215xx and STM32F217xx // [RM0366] STM32F301x6/8 and STM32F318x8 // [RM0365] STM32F302xB...
#![ feature( optin_builtin_traits ) ] // Tested: // // - ✔ Send message to another thread // - ✔ Call actor in another thread // - ✔ Move the future from call to another thread and await it there mod common; use { futures :: { channel::oneshot } , thespis :: { * } , ...
use clap::{Arg, App}; #[derive(Debug, PartialEq)] pub struct Config { pub file: String, } impl Config { pub fn new() -> Self { let matches = App::new("predict") .version("0.1.0") .author("Simon Galasso <simon.galasso@hotmail.fr>") .about("Use save from the learn pro...
use super::{ErrorContext, ErrorKind, MessageType, UnderlyingError}; use std::fmt; /// An error that occurred in egg-lib pub struct Error { kind: ErrorKind, } // TODO: A recoverable error - ie a function return that is either a result or a response object, extension to Error trait impl Error { // Create a par...
use std::convert::TryInto; use std::ffi::CString; use std::ptr; use crate::error::{check_status, Error}; use crate::motherboard_eeprom::MotherboardEeprom; use crate::range::MetaRange; use crate::receive_info::ReceiveInfo; use crate::receive_streamer::ReceiveStreamer; use crate::stream::{Item, StreamArgs, StreamArgsC};...
use std::cmp::max; use std; use num; use crate::prelude::*; pub const SHADOW_EPSILON: f32 = 0.0001; pub const MACHINE_EPSILON: f32 = std::f32::EPSILON * 0.5; #[inline(always)] pub const fn gamma(n: i32) -> f32 { (n as f32 * MACHINE_EPSILON) / (1.0 - n as f32 * MACHINE_EPSILON) } #[inline(always)] pub fn gammaf(...
use tendermint_rpc::Address; #[cfg(feature = "integration")] use tendermint_rpc::{endpoints::Status, jsonrpc::Request}; /// Get the address of the local node pub fn localhost_rpc_addr() -> Address { "tcp://127.0.0.1:26657".parse().unwrap() } // TODO(tarcieri): chunked encoding support // `/net_info` endpoint inte...
use futures::try_ready; use log::{debug, error, info}; #[cfg(unix)] use nix::sys::statvfs::{statvfs, Statvfs}; use std::fs::{self, DirEntry, Metadata}; use std::io; use std::path::{Path, PathBuf}; #[cfg(windows)] use std::ptr::null_mut; use std::time::{Duration, Instant, SystemTime}; use tokio::prelude::*; use tokio::t...
use indexmap::IndexMap; use std::collections::HashSet; use syn::{Error, Result, Ident}; use super::component::{Child, Component}; use super::{AllComponents, AllUniques, TypeId}; #[derive(Debug)] pub struct Unique { pub id: TypeId, pub name: String, pub r#type: Ident, pub children: Vec<Child>, } impl U...
use axum::{extract, prelude::*, response}; use serde::{Deserialize, Serialize}; #[derive(Deserialize)] pub struct BeaconData { date: String, os: OSType, r#type: String, beacons: Vec<Beacon>, } #[derive(Deserialize)] pub struct Beacon { uuid: String, major: i64, minor: i64, rssi: f64, ...
use async_graphql::{value, EmptyMutation, EmptySubscription, Interface, Object, SimpleObject}; use async_graphql_relay::{RelayContext, RelayGlobalID, RelayNodeEnum}; #[derive(RelayGlobalID)] pub struct ID(pub String, pub SchemaNodeTypes); #[derive(Interface, RelayNodeEnum)] #[graphql(field(name = "id", type = "String...
use rand::Rng; pub struct Obstacles { // tuple vec of objects one for the top and one for the bottom pub obstacles: Vec<(i32, i32)>, // how frequently we want each to be created pub frequency_values: Vec<usize>, } // randomly picks a pair of obstacles to generate impl Obstacles { pub fn generate_...
use std::mem; pub fn run(){ let mut number: Vec<i32> = vec![1, 2, 3, 4, 5]; // Re-assign Value number[3] = 43; // Add to vector number.push(5); number.push(6); number.push(7); // Get the length of a vetor println!("The length of the vector {}", number.len() ); // Vector a...
use diesel::prelude::*; use crate::storage::db::models; use crate::storage::db::schema; pub fn create_user(conn: &SqliteConnection, user: models::NewUser) { diesel::insert_into(schema::users::table) .values(&user) .execute(conn) .expect("error creating new user"); } pub fn get_user_from_n...
//! Derive `NumBytes`. use crate::proc_macro::TokenStream; use quote::{quote, quote_spanned}; use syn::spanned::Spanned; use syn::{ parse_macro_input, parse_quote, Data, DeriveInput, Fields, GenericParam, Index, }; /// Expand input pub fn expand(input: TokenStream) -> TokenStream { let input = parse_macro_...
#[doc = "Register `SPI2S_IFCR` writer"] pub type W = crate::W<SPI2S_IFCR_SPEC>; #[doc = "Field `EOTC` writer - EOTC"] pub type EOTC_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `TXTFC` writer - TXTFC"] pub type TXTFC_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `UDRC`...
use iced::advanced::layout::{self, Layout}; use iced::advanced::overlay; use iced::advanced::renderer; use iced::advanced::widget::{self, Widget}; use iced::advanced::{self, Clipboard, Shell}; use iced::alignment::{Alignment, Horizontal, Vertical}; use iced::widget::tooltip::Position; use iced::widget::{ button, ho...
use regex::Regex; use std::convert::TryInto; use std::ops::Add; // use crate::FromStr; use crate::cipher::cryptomath::{modulus, find_mod_inverse}; // use std::error::Error; // use std::fmt; // use std::fmt::Formatter; use crate::{ErrorKind, Result, ResultExt}; use std::collections::HashMap; use std::iter::FromIterator;...
use anyhow::{Result, bail}; use serde_json::{from_str, from_value, Value, json}; use serde::{Serialize, Deserialize}; use std::path::Path; use std::io::{self, Write}; const PROBLEMS_URL: &str = "https://leetcode.com/api/problems/algorithms"; #[derive(Debug, Serialize, Deserialize)] pub struct CodeDefinition { pub...
use parameters::params::*; use find_folder; use std::path::PathBuf; use std::collections::HashMap; use csv::StringRecord; const FILE_RECORD_LEN: usize = 6; fn update_parameter(params: &Parameters, record: StringRecord) { if record.len() != FILE_RECORD_LEN { println!("Invalid file record len on line {}", ...
use itertools::Itertools; use std::{ collections::{HashMap, HashSet}, fs, path::Path, }; // fn read_input_lines<P, T>(path: P, transformer: fn(&'_ str) -> T) -> std::io::Result<Vec<T>> where P: AsRef<Path>, { let mut input: Vec<T> = vec![]; let contents = fs::read_to_string(path).unwrap(); ...
#[doc = "Register `DDRCTRL_INIT3` reader"] pub type R = crate::R<DDRCTRL_INIT3_SPEC>; #[doc = "Register `DDRCTRL_INIT3` writer"] pub type W = crate::W<DDRCTRL_INIT3_SPEC>; #[doc = "Field `EMR` reader - EMR"] pub type EMR_R = crate::FieldReader<u16>; #[doc = "Field `EMR` writer - EMR"] pub type EMR_W<'a, REG, const O: u...
use std::time::Instant; use std::io::{self, BufRead, Write}; struct Interval { work: u64, rest: u64, } impl std::default::Default for Interval { fn default() -> Self { Interval { work: 1, // TODO change to minutes after testing rest: 1, // TODO change to minutes after testi...
use crate::commands::wallet::wallet_update; use crate::lib::environment::Environment; use crate::lib::error::DfxResult; use clap::Clap; /// Set wallet name. #[derive(Clap)] pub struct SetNameOpts { /// Name of the wallet. name: String, } pub async fn exec(env: &dyn Environment, opts: SetNameOpts) -> DfxResul...
pub mod object_draw; pub mod system; pub mod ui_draw;
use regex::Regex; #[derive(Debug, PartialEq, Clone, Copy)] pub struct Color { pub r: u8, pub g: u8, pub b: u8, pub a: u8, } impl Color { pub fn new(color_name: &str) -> Option<Self> { if color_name.chars().next().unwrap() == '#' { return Color::hex_to_rgba(color_name); ...
use azure_cosmos::prelude::*; use std::error::Error; #[tokio::main] async fn main() -> Result<(), Box<dyn Error + Send + Sync>> { let database = std::env::args() .nth(1) .expect("please specify database name as first command line parameter"); let collection = std::env::args() .nth(2) ...
/* * 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 */ /// QueryValueWidgetDefinition : Query values display the current value of a given metric, APM, or log q...
fn main() { // let some_u8_value = Some(3u8); // match some_u8_value{ // Some(3) => println!("three"), // _ => () // } // if let Some(3) = some_u8_value{ // println!("three") // }; // let another_u8_value = Some(4u8); // if some_u8_value == another_u8_value { /...
/// haveibeenpwned.com password checking. /// /// Documented here: /// https://haveibeenpwned.com/API/v2#SearchingPwnedPasswordsByRange use sha1::Sha1; use std::io; use std::error::Error; use knock::{HTTP, response::Response}; use secstr::SecStr; static REQ_BASE: &str = "https://api.pwnedpasswords.com/range/"; static...
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) // from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70) // DO NOT EDIT use ffi; use std::ffi::CStr; lazy_static! { pub static ref DESKTOP_APP_INFO_LOOKUP_EXTENSION_POINT_NAME: &'static str = unsafe{CStr::from_ptr(ffi::G_DESKTOP_...
#[doc = "Register `SYSCFG_ITLINE25` reader"] pub type R = crate::R<SYSCFG_ITLINE25_SPEC>; #[doc = "Field `SPI1` reader - SPI1 interrupt request pending"] pub type SPI1_R = crate::BitReader; impl R { #[doc = "Bit 0 - SPI1 interrupt request pending"] #[inline(always)] pub fn spi1(&self) -> SPI1_R { SP...
use crate::libs::idb; use crate::libs::skyway::MeshRoom; use crate::model::config::Config; use futures::join; use js_sys::Promise; use std::rc::Rc; use wasm_bindgen::prelude::*; use wasm_bindgen::JsCast; use wasm_bindgen_futures::JsFuture; pub async fn initialize( config: Rc<Config>, common_db: Rc<web_sys::Idb...
// AST node use super::token::Token; pub struct AST { pub children: Vec<AST>, pub token: Token } impl AST { pub fn new(token: Token, children: Vec<AST>) -> AST { AST { token: token, children: children } } }
use std::{marker::PhantomData, ops::Deref}; use crate::{ResourceId, World}; /// A trait for accessing read/write multiple resources from a system. This can /// be used to create dynamic systems that don't specify what they fetch at /// compile-time. /// /// For compile-time system data this will all be done for you u...
use std::collections::HashMap; use std::collections::HashSet; use std::fs::read_to_string; fn part1(lines: &Vec<&str>) -> i32 { let mut num_twos: i32 = 0; let mut num_threes: i32 = 0; for line in lines { let mut char_freqs: HashMap<char, i32> = HashMap::new(); for chr in line.chars() { let count = char_fre...
//! Attacks against ciphers which use XOR as the encryption algorithm. use std::f64; use utils::data::Data; use utils::metrics; use utils::xor::xor; /// Finds the most likely single-byte key that was used to encrypt the given data. pub fn best_single_byte_key(data: &Data) -> (Data, f64) { // Keep track of the b...
#[doc = "Generate markdown from a document tree"]; import std::io; import std::io::writer_util; export mk_pass; fn mk_pass( writer: fn~() -> io::writer ) -> pass { ret fn~( _srv: astsrv::srv, doc: doc::cratedoc ) -> doc::cratedoc { write_markdown(doc, writer()); doc };...
use super::error::{NodError, Result}; use super::fetch; use super::path::WorkDir; use super::platform::{Arch, Platform}; use super::teewriter::ProgressWriter; use super::utils::{getarch, getplatform}; use super::version::Version; use libarchive::archive::{self, ReadFilter, ReadFormat}; use libarchive::reader::Builder;...
// vim:set et sw=4 ts=4 ft=rust: // Adapted from: https://github.com/steveyen/sqld3/blob/master/sql.pegjs // And: https://www.sqlite.org/lang.html use definitions::*; #[pub] rusql_stmt -> RusqlStatement = whitespace s:(alter_table_stmt) whitespace semicolon { s } / whitespace s:(create_table_stmt) whi...
//! Easy use of LEDs. use peripheral; /// All the LEDs. pub static LEDS: [Led; 4] = [Led { i: 12 }, Led { i: 13 }, Led { i: 14 }, Led { i: 15 }]; /// A single LED. pub struct Led { i: u8, } impl Led { /// Turns the LED on...
/* chapter 4 syntax and semantics */ fn main() { enum Message { Quit, ChangeColor(i32, i32, i32), Move { x: i32, y: i32 }, Write(&'static str), } fn quit() { println!("quit the program"); } fn change_color(r: i32, g: i32, b: i32) { let n = r + g + ...
use strum_macros::AsRefStr; #[derive(AsRefStr, Debug)] #[strum(serialize_all = "lowercase")] pub(crate) enum RequestType { Login, DbStats, Get, Set, }
#[macro_use] extern crate log; use clap::{App, Arg}; use std::path::PathBuf; use archiver::cli; use archiver::config; use archiver::ctx::Ctx; use archiver::manual_file::ManualFile; use archiver::staging; use archiver::mountable::Mountable; fn cli_opts<'a, 'b>() -> App<'a, 'b> { cli::base_opts() .about("S...
//mod historical; mod simulated; //pub use historical::Historical; pub use simulated::Simulated; use crate::economy::{Market, Monetary, AssetSymbol}; use crate::traders::{Order, Action}; use async_trait::async_trait; use binance_async::model::{Order as QueryOrder, Symbol}; use std::fmt::Debug; use std::time::Duration...
/// /// ## slip.rs /// /// support Serial Line IP protocol /// ref: IETF RFC1055 /// /// * special characters: END 192, ESC 219. /// * sending data: host sends data in the packet. /// * If a byte is the same code as an END character, a two byte sequence of ESC and /// 220 is sent instead. /// * If a byte ...
use crate::algorithms::Bounded; use euclid::{num::Zero, Length, Point2D, Size2D, Vector2D}; /// An axis-aligned bounding box. #[derive(Debug, PartialEq)] pub struct BoundingBox<S> { bottom_left: Point2D<f64, S>, top_right: Point2D<f64, S>, } impl<S> BoundingBox<S> { /// Create a new [`BoundingBox`] around...
#[doc = "Register `RCC_OCENCLRR` reader"] pub type R = crate::R<RCC_OCENCLRR_SPEC>; #[doc = "Register `RCC_OCENCLRR` writer"] pub type W = crate::W<RCC_OCENCLRR_SPEC>; #[doc = "Field `HSION` reader - HSION"] pub type HSION_R = crate::BitReader; #[doc = "Field `HSION` writer - HSION"] pub type HSION_W<'a, REG, const O: ...
pub mod account; pub mod loader_instruction; pub mod pubkey; extern crate bincode; extern crate bs58; extern crate generic_array; #[macro_use] extern crate serde_derive;
#[doc = "Reader of register FDCAN_TXBCF"] pub type R = crate::R<u32, super::FDCAN_TXBCF>; #[doc = "CF\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u32)] pub enum CF_A { #[doc = "0: No transmit buffer\r\n cancellation"] B_0X0 = 0, #[doc = "1: Transmit buffer cancell...
extern crate bulletrs; extern crate cgmath; use cgmath::{Vector3, Vector4}; use bulletrs::*; #[test()] fn set_gravity() { let configuration = CollisionConfiguration::new_default(); let mut dynamics_world = DynamicsWorld::new_discrete_world( CollisionDispatcher::new(&configuration), Broadphas...
extern crate libc; #[macro_use] extern crate serde_derive; extern crate serde; extern crate serde_json; extern crate termion; extern crate floating_duration; pub mod motor_controllers; pub mod elevator_drivers; pub mod buildings; pub mod physics; pub mod trip_planning; pub mod data_recorders; pub mod motion_controller...
use ffi; lazy_static! { pub static ref RTE_RING_NAMESIZE: usize = ffi::RTE_MEMZONE_NAMESIZE as usize - ffi::RTE_RING_MZ_PREFIX.len() + 1; }
/*! Convert values to color simply and securely. - Convert in hexadecimal, rgb, hsl, cmyk, hsv and hwb formats. - Case sensitive. - Always returns the same result for a string (Pure function). [![Crates.io](https://img.shields.io/crates/v/coloring)](https://crates.io/crates/coloring) &bull; [![Crates.io](https://img....
//! The module containing all outgoing packet implementations /*use super::super::deque_buffer::DequeBuffer; use super::super::game_connection::GameConnection; //It's super super super effective! use std::io::Write; //pub mod handshake; No handshake packets (yet)! pub mod status; /// A trait for outgoing packets pu...
fn main() { let x = Some(5); fn foo(x:i32){println!("{}", x);} match x{ Some(x) => {foo(x)}, None=>{} } if x.is_some() { let x = x.unwrap(); foo(x); } if let Some(x) = x{ foo(x); } else { println!("don't match"); ...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::hash::LedgerInfoHasher; use crate::impl_hash; use libra_crypto::HashValue; use serde::{Deserialize, Serialize}; use std::fmt::{Display, Formatter}; #[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)] pub struct ...
use std::collections::HashMap; use thiserror::Error; #[derive(Debug, Error)] #[error(r#"there's no "{field}" in `{type_str}`"#)] pub struct DeserializeMaskError { pub type_str: &'static str, pub field: String, pub depth: u8, } pub trait Maskable: Sized { type Mask; /// Perform a 'bitor' operatio...
use std::io::Result; use super::FileId; use crate::ArcDataSlice; /// Abstract interface to a multi-file log stream pub(super) trait FileStream { // Constant Maximum File Size fn const_max_file_size(&self) -> usize; /// Returns the current file Id, file UUID, Offset fn status(&self) -> (FileId, uuid:...
#![allow(unused_parens)] #![allow(unused_imports)] use frame_support::{traits::Get, weights::Weight}; use sp_std::marker::PhantomData; /// Weight functions for pallet_timestamp. pub struct WeightInfo<T>(PhantomData<T>); impl<T: frame_system::Config> pallet_timestamp::WeightInfo for WeightInfo<T> { fn set() -> Weight...
fn sum(v: &Vec<i32>) -> i32 { let mut sum = 0; // Borrow vector for loop. for i in v { sum = sum + i; } // Return the value. sum // Borrowing of v ends here. } fn main() { let v = vec![2, 3, 4]; // Pass ownership to sum function and rebind // v and answer from return va...
use crate::{util::CountryCode, BotResult, Database}; use dashmap::DashMap; use futures::stream::StreamExt; impl Database { #[cold] pub async fn get_snipe_countries(&self) -> BotResult<DashMap<CountryCode, String>> { let mut stream = sqlx::query!("SELECT * FROM snipe_countries").fetch(&self.pool); ...
use super::*; pub fn parse_rle_file<S: ToString>(s: &S) -> Result<Pattern, String> { let s = s.to_string(); let mut pattern = Pattern::default(); // Metadata let metadata = s.lines().take_while(|x| x.starts_with('#')); for line in metadata { let mut linedata = line.chars().skip(1); ...
mod core; mod derive; mod macros; mod settings; #[cfg(feature = "std")] mod matrix;
use std::ops::Add; pub trait Semigroup { fn combine(self, other: Self) -> Self; } impl<I> Semigroup for I where I: Add<I, Output = I>, { fn combine(self, other: I) -> I { self.add(other) } }
use crate::db::models::*; use bigdecimal::BigDecimal; use chrono::offset::Local; #[derive(Debug, Clone, Default)] pub struct UserBuilder { pub email: String, pub password: String, pub username: String, pub tags: Vec<String>, } impl UserBuilder { pub fn username(mut self, username: &str) -> Self { ...
//! The main interface for managing a waSCC host // Copyright 2015-2019 Capital One Services, LLC // // 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/LIC...
use std; use strum_macros::AsRefStr; /// Wrapped error sources for the geom crate. #[derive(Debug, AsRefStr)] pub enum Error { Sysctl(sysctl::SysctlError), Decode(quick_xml::DeError), Parse(strum::ParseError), Scan(scan_fmt::parse::ScanError), /// Some internal graph invariant was violated. Gra...
use crate::{components::Position, traits::*}; #[derive(Default)] pub struct AiPerson { texture_index: usize, position: Position, hunger: f32, traveling_to: Option<Position>, } impl IsDrawable for AiPerson { fn render_info(&self) -> (usize, &Position) { (self.texture_index, &self.position) ...
#![allow(non_snake_case)] #![allow(unused_assignments)] use libc::{c_int,c_uint, uint32_t,c_void}; use super::wnd::DWnd; pub type LPARAM = * const c_void; pub type WPARAM = * const c_void; pub static C_NULL:* const c_void = 0 as * const c_void; pub type WndProc =extern "stdcall" fn (DWnd, u32, WPARAM, LPARAM)->c_...
use serde::Serialize; use sqlx::types::ipnetwork::IpNetwork; use sqlx::types::Uuid; use crate::common::SideType; use crate::get5::serializer::{ deserialize_ipnetwork, deserialize_uuid, serialize_ipnetwork, serialize_uuid, }; pub type CountryCode = String; #[derive(Deserialize, Serialize, Debug, Clone, sqlx::From...
pub mod cli; mod flags; mod path_check; mod size; pub use flags::Flags; pub use path_check::Check; pub use size::{Size, SizeComparison};
#![doc = "Peripheral access API for STM32G473XX microcontrollers (generated using svd2rust v0.30.0 (8dd361f 2023-08-19))\n\nYou can find an overview of the generated API [here].\n\nAPI features to be included in the [next] svd2rust release can be generated by cloning the svd2rust [repository], checking out the above co...
fn main() { let s = "パトカー".to_string(); let t = "タクシー".to_string(); let mut u = String::new(); for i in 0..s.chars().count() { u = format!("{}{}{}", u, s.chars().nth(i).unwrap(), t.chars().nth(i).unwrap() ); } println!("{}", u); }
extern crate skim; use skim::prelude::*; struct MyItem { inner: String, } impl SkimItem for MyItem { fn text(&self) -> Cow<str> { Cow::Borrowed(&self.inner) } fn preview(&self, _context: PreviewContext) -> ItemPreview { if self.inner.starts_with("color") { ItemPreview::Ans...
use primal::{is_prime, Primes}; use std::time::Instant; fn main() { let now = Instant::now(); println!("e35:{:?}, {:?} seconds", e(), now.elapsed()); } fn e() -> usize { Primes::all() .take_while(|&p| p < 1000000) .filter(|p| is_odd_digits(p)) .filter(|p| is_cycle_prime(p)) ...
use super::DIMENSION; use tile::Tile; #[derive(Debug, Serialize, Deserialize)] pub struct Board { pub current_id: usize, pub grid: Vec<Vec<Tile>> } impl Board { pub fn new() -> Board { let mut id = 0; Board { grid: vec![0; DIMENSION] .iter() .ma...
use rocket::http::Status; use rocket::request::Request; use rocket::response::{self, Responder, Response}; use std::{error, fmt, io::Cursor}; #[derive(Debug, Clone)] pub struct ApiError { reason: &'static str, status: u16, } impl ApiError { pub fn new(reason: &'static str, status: u16) -> ApiError { ...
#[doc = "Register `FDCAN_TTILS` reader"] pub type R = crate::R<FDCAN_TTILS_SPEC>; #[doc = "Register `FDCAN_TTILS` writer"] pub type W = crate::W<FDCAN_TTILS_SPEC>; #[doc = "Field `SBCL` reader - SBCL"] pub type SBCL_R = crate::BitReader; #[doc = "Field `SBCL` writer - SBCL"] pub type SBCL_W<'a, REG, const O: u8> = crat...
#[cfg(test)] #[macro_use] extern crate assert_matches; mod automaton; mod distinct_map; mod query_builder; mod reordered_attrs; mod store; pub mod criterion; use std::fmt; use std::sync::Arc; use sdset::SetBuf; use serde::{Serialize, Deserialize}; use slice_group_by::GroupBy; use zerocopy::{AsBytes, FromBytes}; pub...
use itertools::Itertools; use std::collections::HashSet; pub mod part1; pub mod part2; pub fn run() { part1::run(); part2::run(); } pub fn default_input() -> &'static str { include_str!("input") } pub fn parse_input(input : &str) -> Vec<FoodLine> { input.lines().map(|l| { let split = l.split...
use std::cmp; use na::{DMatrix, Matrix4}; use nl::Eigen; use crate::proptest::*; use proptest::{prop_assert, proptest}; proptest! { #[test] fn eigensystem(n in PROPTEST_MATRIX_DIM) { let n = cmp::min(n, 25); let m = DMatrix::<f64>::new_random(n, n); if let Some(eig) = Eigen::new(m.cl...
use super::*; use crate::Name; impl<'a> Name<'a> for Document<'a> {} impl<'a> Name<'a> for Definition<'a> { fn name(&self) -> Option<&'a str> { match self { Definition::Schema(_) => None, Definition::Type(t) => t.name(), Definition::TypeExtension(te) => te.name(), ...
#[macro_use] extern crate log; extern crate async_std; extern crate getopts; extern crate stunnel; use std::env; use async_std::net::TcpListener; use async_std::prelude::*; use async_std::task; use stunnel::cryptor::Cryptor; use stunnel::logger; use stunnel::server::*; use stunnel::ucp::UcpListener; fn main() { ...
extern crate capstone; extern crate jazz_jit; use capstone::prelude::*; use jazz_jit::assembler::Assembler; use jazz_jit::assembler_x64::*; use jazz_jit::constants_x64::*; use jazz_jit::{get_executable_memory, Memory}; fn main() { let mut asm = Assembler::new(); emit_movl_imm_reg(&mut asm, 2, RAX); emit_...
use crate::Idx; use std::{fmt, marker::PhantomData, ops::Index}; /// A map from arena indexes to some other type. /// Space requirement is O(highest index). #[derive(Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct ArenaMap<K, V> { data: Vec<Option<V>>, _ty: PhantomData<K>, } impl<T, V: fmt::Debug> fm...
use { crate::{data::Value, result::Result}, serde::{Deserialize, Serialize}, serde_json::{Map as JsonMap, Value as JsonValue}, std::{collections::HashMap, fmt::Debug, ops::ControlFlow}, thiserror::Error as ThisError, }; #[derive(Debug, PartialEq, ThisError, Serialize)] pub enum MapError { #[err...
use crate::analyzer::dex::dex_class_node::DexClassNode; #[derive(Clone)] pub struct DexPackageNode { pub(crate) name: String, package_name: Option<String>, pub(crate) class_nodes: Vec<DexClassNode>, } impl DexPackageNode { pub fn new(name: String, package_name: Option<String>) -> DexPackageNode { ...
use std::env; use std::fs; use std::path::Path; use std::collections::HashMap; const MATRIX_SIZE:usize = 8; fn read_instructions(filename:&str) ->String{ let fpath = Path::new(filename); let abspath = env::current_dir() .unwrap() .into_boxed_path() .join(&fpath); let contents = fs:...
#[doc = "Reader of register MT_DELAY_CFG3"] pub type R = crate::R<u32, super::MT_DELAY_CFG3>; #[doc = "Writer for register MT_DELAY_CFG3"] pub type W = crate::W<u32, super::MT_DELAY_CFG3>; #[doc = "Register MT_DELAY_CFG3 `reset()`'s with value 0"] impl crate::ResetValue for super::MT_DELAY_CFG3 { type Type = u32; ...
use nom::{ branch::alt, bytes::complete::{escaped, is_not, tag, take_till, take_till1, take_until}, character::complete::one_of, IResult, }; use crate::StraceEvent; pub fn read_while_args(mut input: &str) -> IResult<&str, Vec<&str>> { //TODO this sucks let mut args = vec![]; input = &inpu...
use crate::database::DbConn; use yew::prelude::*; pub struct Person { id: Option<u32>, can_write: bool, go_to_persons_list: Option<Callback<()>>, db_conn: DbConn, state: State, link: ComponentLink<Self>, } struct State { is_inserting: bool, name_value: String, } pub enum Msg { Ch...