text
stringlengths
8
4.13M
#[doc = "Register `CSGCM2R` reader"] pub type R = crate::R<CSGCM2R_SPEC>; #[doc = "Register `CSGCM2R` writer"] pub type W = crate::W<CSGCM2R_SPEC>; #[doc = "Field `CSGCM2` reader - CSGCM2"] pub type CSGCM2_R = crate::FieldReader<u32>; #[doc = "Field `CSGCM2` writer - CSGCM2"] pub type CSGCM2_W<'a, REG, const O: u8> = c...
#![feature(uniform_paths, nll)] use std::time::{Duration, Instant}; mod domain; mod data; use domain::entities::{User, Task}; fn main() { use domain::Repository; /* let mut user_repo = data::TrivialRepository::new(); let mut task_repo = data::HashRepository::new(); */ let mut repo = data::...
// Copyright 2019 Google 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/LICENSE-2.0 // // Unless required by applicable law or agreed to in ...
use log; static LOGGER: Logger = Logger; struct Logger; impl log::Log for Logger { fn enabled(&self, _metadata: &log::Metadata) -> bool { true } fn log(&self, record: &log::Record) { if !self.enabled(record.metadata()) { return; } eprintln!("{:5} [{}] {}", rec...
#[doc = "Register `IMR` reader"] pub type R = crate::R<IMR_SPEC>; #[doc = "Register `IMR` writer"] pub type W = crate::W<IMR_SPEC>; #[doc = "Field `DINIE` reader - Data input interrupt enable"] pub type DINIE_R = crate::BitReader; #[doc = "Field `DINIE` writer - Data input interrupt enable"] pub type DINIE_W<'a, REG, c...
use utils::timer::*; lazy_static! { pub static ref INVALID: TimerEventType = register_event_type(); pub static ref PING_DISPATCH: TimerEventType = register_event_type(); pub static ref AFK_TIMER: TimerEventType = register_event_type(); pub static ref SCORE_BOARD: TimerEventType = register_event_type(); pub static...
use std::path::PathBuf; use std::thread; use std::time::Duration; use log::*; use async_trait::async_trait; use kevlar::*; use thirtyfour::remote::command::{Command, SessionId}; use thirtyfour::remote::connection_async::RemoteConnectionAsync; use thirtyfour::remote::connection_common::CommandError; #[tokio::main] as...
pub use agent::Agent; pub use neuro_evolution_agent::NeuroEvolutionAgent; pub use q_table_agent::QTableAgent; mod agent; mod neuro_evolution_agent; mod q_table_agent;
use std::collections::HashMap; use std::sync::Arc; use futures3::channel::mpsc::{self, Sender, UnboundedSender}; use futures3::{SinkExt, StreamExt, TryFutureExt}; use tokio2::spawn; use rayon::{iter::IntoParallelIterator, iter::ParallelIterator, ThreadPoolBuilder}; use serde_derive::{Deserialize, Serialize}; use slog...
use std::fmt::{Display, Formatter}; use std::ops::Add; #[derive(Copy, Clone, Default, Eq, PartialEq, Debug)] pub struct Stats { pub strength: u16, pub critical_chance: u16, pub critical_damage: u16, } impl Add for Stats { type Output = Self; fn add(self, other: Self) -> Self { Self { ...
use core::option::Option; use core::option::Option::Some; use core::result::Result; use core::result::Result::{Err, Ok}; use std::io::Error; use regex::Regex; /// EventFilters describes two optional lists of regular expressions used to filter events. /// /// If provided, each expression is used in either negatively (...
//! ACL Macroses /// Macros used adding permissions to user. #[macro_export] macro_rules! permission { ($resource:expr) => { Permission { resource: $resource, action: Action::All, scope: Scope::All, } }; ($resource:expr, $action:expr) => { Permiss...
struct Cipher { a: Vec<char>, b: Vec<char>, } impl Cipher { fn new(map1: &str, map2: &str) -> Cipher { Cipher{ a: map1.chars().collect(), b: map2.chars().collect(), } } fn encode(&self, string: &str) -> String { let mut to_convert: Vec<char> = string.chars().collect(); ...
use super::file_loader; mod day_9_computer; use day_9_computer::IntCodeComputer; pub fn run(part: i32) { let input = file_loader::load_file("9.input"); let intcode: Vec<i64> = input.split(",") .map(|number| number.parse::<i64>().unwrap()) .collect(); let result = result_for_part(&intcode...
use actix_web::{web, App, HttpServer, Responder}; use listenfd::ListenFd; use std::net::TcpListener; use tokio::signal::unix::{signal, SignalKind}; use tokio::stream::StreamExt; async fn index(info: web::Path<(String, u32)>) -> impl Responder { format!("Hello {}! id:{}", info.0, info.1) } #[actix_rt::main] async ...
enum Void {} fn main() { let mut x: (Void, usize); let y = 1; x.1 = 0; println!("{}", y) }
#[doc = "Reader of register DFSDM_CH1AWSCDR"] pub type R = crate::R<u32, super::DFSDM_CH1AWSCDR>; #[doc = "Writer for register DFSDM_CH1AWSCDR"] pub type W = crate::W<u32, super::DFSDM_CH1AWSCDR>; #[doc = "Register DFSDM_CH1AWSCDR `reset()`'s with value 0"] impl crate::ResetValue for super::DFSDM_CH1AWSCDR { type T...
v1_imports!(); use std::collections::HashMap; use bigdecimal::BigDecimal; use rocket::Route; use db::{project, session, staff, student, user}; pub fn get_routes() -> Vec<Route> { routes![ get_sessions_full, new_session, archive_session, rm_session, get_session_report ...
pub mod variable; pub mod datatype;
use std::net::{SocketAddr, ToSocketAddrs }; use std::collections::HashMap; use toml::Table; use std::sync::mpsc::{SyncSender}; use serde_json::Value as JValue; use std::fmt::{self, Display, Debug, Formatter}; use std::thread::{JoinHandle}; use std::sync::Arc; use output; #[derive(Debug)] pub enum Filter { IfHasFi...
use std::fs; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } } fn read_file(filename: &str) -> String { fs::read_to_string(filename).expect("Something went wrong reading the file") } pub fn day1_input() -> Vec<usize> { let input = read_file("../data/day1.txt"); ...
use env_logger::{Builder, Env}; use log::info; use std::{ sync::{Arc, Mutex}, thread, time::Duration, }; use stepper::*; fn main() { Builder::from_env(Env::default().default_filter_or("info")).init(); let n_steps = std::env::args().nth(1).map(|x| x.parse().unwrap()).unwrap_or(500); let delay =...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{get_available_port, BaseConfig, ChainNetwork, ConfigModule, StarcoinOpt}; use anyhow::Result; use serde::{Deserialize, Serialize}; use std::net::SocketAddr; pub static DEFAULT_STRATUM_SERVER_PORT: u16 = 9940; #[derive(...
#[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::INTCLR { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mu...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use crate::utils::are_equal; use winterfell::{ math::{fields::f128::BaseElement, FieldElement}, Air, AirContext, Assertion, Evalua...
//! Implementation of the SEGGER RTT Protocol //! //! --- #![no_main] #![no_std] use core::cell::RefCell; use core::ptr::{write_volatile, read_volatile, copy_nonoverlapping}; use core::marker::Send; use cortex_m::interrupt; use cortex_m::interrupt::Mutex; use cortex_m::asm; use core::fmt::{self, Write}; use core::c...
/* Copyright 2021 Al Liu (https://github.com/al8n). Licensed under Apache-2.0. * * Copyright 2017 The Hashicorp's Raft repository authors(https://github.com/hashicorp/raft) authors. Licensed under MPL-2.0. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in com...
use actix_web::{get, web, App, HttpResponse, HttpServer, Responder}; #[get("/")] async fn index() -> impl Responder { HttpResponse::Ok().body("Rust service prototype") } #[get("/healthcheck")] async fn healthcheck() -> impl Responder { HttpResponse::Ok().body("I'm alive!") } pub fn init(config: &mut web::Ser...
use bitvec::prelude::*; use parity_scale_codec::{Decode, Encode}; use rayon::prelude::*; use std::ops::{Deref, DerefMut}; use std::{mem, slice}; use subspace_core_primitives::checksum::Blake3Checksummed; use subspace_core_primitives::crypto::blake3_hash; use subspace_core_primitives::{ Blake3Hash, HistorySize, Piec...
use crate::config::Config; use super::query::Search; use super::request_counter::RequestCounter; use super::ApiError; use reqwest::header::{HeaderMap, HeaderValue, USER_AGENT}; use reqwest::Response; use url::Url; use std::sync::Arc; /* API reference: * https://app.swaggerhub.com/apis-docs/NexusMods/nexus-mods_pub...
use proc_macro2::TokenStream; use crate::attributes::{ ParentDataType }; use crate::util::{ ident_from_str }; use super::derivable::Derivable; use crate::struct_compiler::bit_index::{ get_byte_indices, get_slice_indices }; pub fn get_field(parent_data_type : ParentDataType, derivable : Derivable, preceeding_bits : &To...
use std::fs::File; use std::io::Read; use std::io::BufReader; fn find_result(in_vec : &[i32]) -> i32 { let mut result = 0; for val1 in in_vec.iter() { for val2 in in_vec.iter() { if val1 + val2 == 2020 { result = val1 * val2; break; } } ...
use crate::{ grid::{ color::AnsiColor, config::{ColoredConfig, Entity}, }, settings::{CellOption, Color, TableOption}, }; /// Set a justification character and a color. /// /// Default value is `' '` (`<space>`) with no color. /// /// # Examples /// /// Setting a justification character. //...
use crate::chiapos::constants::PARAM_EXT; use crate::chiapos::table::metadata_size_bytes; use crate::chiapos::utils::EvaluatableUsize; use core::iter::Step; use core::mem; use core::ops::Range; use derive_more::{Add, AddAssign, From, Into}; /// Stores data in lower bits #[derive(Debug, Copy, Clone, Ord, PartialOrd, Eq...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - GPIO port mode register"] pub gpioz_moder: GPIOZ_MODER, #[doc = "0x04 - GPIO port output type register"] pub gpioz_otyper: GPIOZ_OTYPER, #[doc = "0x08 - GPIO port output speed register"] pub gpioz_ospeedr: GPIOZ_OSP...
use crate::{ physics::{Collider, Joint, Physics, RigidBody}, scene::GraphSelection, GameEngine, }; use rg3d::{ core::pool::Handle, scene::{graph::Graph, node::Node, Scene}, }; use std::collections::HashMap; pub struct Clipboard { graph: Graph, physics: Physics, empty: bool, } impl Defa...
//! Runs Postgres instances. //! //! `pgdb` supports configuring and starting a Postgres database instance through a builder pattern, //! with shutdown and cleanup on `Drop`. //! //! # Example //! //! ``` //! let user = "dev"; //! let pw = "devpw"; //! let db = "dev"; //! //! // Run a postgres instance on port `15432`....
use std::fs::File; use std::io::Write; use std::{ env, fs, path::{Path, PathBuf}, }; use anyhow::{bail, Context, Ok, Result}; use directories::ProjectDirs; use serde::{Deserialize, Serialize}; use crate::constants::{APP_NAME, APP_QUALIFIER}; use crate::geo::Coords; const CONFIG_FILE_NAME: &str = "config.toml...
use std::io::{stdin, Read, StdinLock}; use std::str::FromStr; #[allow(dead_code)] struct Scanner<'a> { cin: StdinLock<'a>, } #[allow(dead_code)] impl<'a> Scanner<'a> { fn new(cin: StdinLock<'a>) -> Scanner<'a> { Scanner { cin: cin } } fn read<T: FromStr>(&mut self) -> Option<T> { let t...
use sudo_test::{Command, Env, User}; use crate::{Result, PASSWORD, USERNAME}; #[test] fn it_works() -> Result<()> { let hostname = "container"; let env = Env(format!("{USERNAME} ALL=(ALL:ALL) ALL")) .user(User(USERNAME).password(PASSWORD)) .hostname(hostname) .build()?; let output...
mod content; mod error; mod lexer; mod tokens; type Result<T> = std::result::Result<T, error::ParsingError>;
use super::*; pick! { if #[cfg(target_feature="avx2")] { #[derive(Default, Clone, Copy, PartialEq, Eq)] #[repr(C, align(32))] pub struct i32x8 { avx2: m256i } } else if #[cfg(target_feature="sse2")] { #[derive(Default, Clone, Copy, PartialEq, Eq)] #[repr(C, align(32))] pub struct i32x8 { pu...
#[cfg(test)] #[path = "tests.rs"] mod tests; use self::Normalization::*; use crate::directory::Directory; use crate::run::PathDependency; use std::cmp; use std::path::Path; #[derive(Copy, Clone)] pub struct Context<'a> { pub krate: &'a str, pub source_dir: &'a Directory, pub workspace: &'a Directory, ...
use std::fmt::Write; use rosu_v2::prelude::{Beatmap, GameMods, RankStatus, Score, User}; use crate::{ embeds::Author, util::{ constants::MAP_THUMB_URL, numbers::{round, with_comma_float}, }, }; pub struct FixScoreEmbed { author: Author, description: String, thumbnail: String, ...
use crate::{canvas::Canvas, util::*}; impl Canvas { pub fn bucket(&mut self, point: Point, color: Color) { let first_color = self.get_color(point); if first_color == color { return; } let mut points = Vec::<Point>::new(); let mut new_points = Vec::<Point>::new();...
use crate::my_ndarray; use crate::split::split; use ndarray::LinalgScalar; #[cfg(test)] use ndarray::{linalg, Array}; use ndarray::{ArrayView, ArrayViewMut, Axis, Ix1, Ix2}; #[cfg(test)] use rand::Rng; use rayon_adaptive::prelude::*; use rayon_adaptive::Policy; use std::ops::AddAssign; use std::fmt::Debug; pub fn mult...
use std::io::{stderr, Write}; use crate::{ ast::op::Oper, wasm::semantic::laze_type::{LazeType, LazeType_}, }; use super::{ exp::{Exp, ExpList, Exp_}, module::{Module, ModuleList, Module_}, stm::{Stm, StmList, Stm_}, }; pub type WasmTypeList = Vec<WasmType>; pub struct WasmExpTy { pub ty: La...
use ordered_float::OrderedFloat; use std::cmp::Ordering; use uuid::Uuid; #[derive(Clone, Hash)] pub struct State { pub id: Uuid, pub score: OrderedFloat<f32>, pub scorea: OrderedFloat<f32>, pub scoreb: OrderedFloat<f32>, pub scorec: OrderedFloat<f32>, pub scored: OrderedFloat<f32>, } impl Part...
use crate::ranges::exclude_addresses; use std::fs::{self, DirBuilder}; use std::net::{Ipv4Addr, SocketAddrV4}; use std::path::{Path, PathBuf}; use std::process; use base64; use chrono::Local; use clap::{App, Arg, ArgGroup}; use colored::Colorize; use ipnet::Ipv4Net; use itertools::Itertools; use rand_core::{OsRng, Rng...
//! ### Implement PatternToNumber //! //! Convert a DNA string to a number. //! //! **Given:** A DNA string Pattern. //! //! **Return:** `PatternToNumber(Pattern)` extern crate bio_algorithms as bio; use std::fs::File; use std::io::prelude::*; use bio::bio_types::DNA_Sequence; fn main() { let mut f = File::open...
pub mod cli; pub mod inline; pub mod default; pub trait InputInterface { fn get_ob_diff_history_files(&self) -> &str; fn get_trade_history_files(&self) -> &str; fn get_order_datetime_colname(&self) -> &str; fn get_order_id_colname(&self) -> &str; fn get_order_price_colname(&self) -> &str; fn ge...
#![allow(unused)] use card_engine::learning::neural_net::*; use clap::{App, Arg}; use ndarray::linalg::general_mat_vec_mul; use ndarray::prelude::*; use once_cell::sync::Lazy; use rand::{thread_rng, Rng}; use std::cmp; const FL: ActivationFunction = ActivationFunction::Sigmoid; fn f1(v: &ArrayView<f32, Ix1>) -> Arra...
use analyser::interface::expressions::Expression; use analyser::interface::expressions::IntoExpression; use analyser::interface::expressions::Output; use analyser::interface::path::{get_path, set_path, Path}; use analyser::types::{Fact, IntFact, SpecialKind, TensorFact}; use Result; use std::fmt; /// A structure that...
use image::GenericImageView; use image::{DynamicImage, Rgba}; use imageproc::geometric_transformations::Projection; use rand::prelude::*; use rand::Rng; #[derive(Copy, Clone)] pub enum Transform { Edges(f32, f32, Rgba<u8>, Rgba<u8>), OverlayEdges(f32, f32, Rgba<u8>), Noise(f64, f64, u64), Threshold(u32...
// Copyright 2021 IPSE Developer. // This file is part of IPSE // 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 ap...
#![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 ReportConfigDefinition { #[serde(rename = "type")] pub type_: report_config_definition::Type, pub timef...
#[derive(Debug)] pub enum Environment { Production, Custom(url::Url), } impl<'a> From<&'a Environment> for url::Url { fn from(environment: &Environment) -> Self { match environment { Environment::Production => { url::Url::parse("https://api.cloudflare.com/client/v4/").un...
extern crate specs; #[cfg(feature="serialize")] extern crate serde; #[cfg(feature="serialize")] #[macro_use] extern crate serde_derive; extern crate serde_json; #[cfg(feature="serialize")] mod s { use serde::{self, Serialize}; use serde_json; use specs::{self, Join, PackedData, Gate}; #[derive(Debug,...
fn get_middle(s: &str) -> String { if s.len() % 2 == 0 { return s[s.len() / 2 - 1 .. s.len() / 2 + 1].to_string(); } s[s.len() / 2 .. s.len() / 2 + 1].to_string() } fn main() { println!("Hello, world!"); } #[test] fn example_tests() { assert_eq!(get_middle("test"),"es"); assert_eq!(get_middle("testing")...
pub mod kit; pub mod kit_configuration; pub mod kit_rpc; pub mod me; pub mod peripheral_definition; pub mod permission; pub mod quantity_type; pub mod user; pub mod measurement;
#[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::CTRL { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut ...
//! comment for module /// comment for function /* static PI: f64 = 3.14; fn get_cir(radius: f64) -> f64 { 2.0 * PI * radius } fn get_area(radius: f64) -> f64 { PI * radius * radius } static mut PI: f64 = 3.14; fn get_cir(radius: f64) -> f64 { unsafe { 2.0 * PI * radius } } fn get_area(radius: f64) -...
#[doc = "Reader of register MDMA_C0ISR"] pub type R = crate::R<u32, super::MDMA_C0ISR>; #[doc = "TEIF0\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum TEIF0_A { #[doc = "0: No transfer error on stream\r\n x"] B_0X0 = 0, #[doc = "1: A transfer error occurred on strea...
//! Memoize functions across frames. //! //! Typically a [`MemoCache`] will last the duration of a UI component, whereas //! a [`MemoFrame`] will last the duration of a single render. use std::{ any::{Any, TypeId}, cell::RefCell, collections::HashMap, hash::Hash, mem, rc::Rc, }; type SharedMemo...
pub mod options; use crate::bson::Document; use self::options::*; use serde::{Deserialize, Serialize}; use typed_builder::TypedBuilder; /// Specifies the fields and options for an index. For more information, see the [documentation](https://www.mongodb.com/docs/manual/indexes/). #[derive(Clone, Debug, Default, Dese...
#[doc = "Register `PUPDR` reader"] pub type R = crate::R<PUPDR_SPEC>; #[doc = "Register `PUPDR` writer"] pub type W = crate::W<PUPDR_SPEC>; #[doc = "Field `PUPDR0` reader - 1:0\\]: Port x configuration bits (y = 0..15) These bits are written by software to configure the I/O pull-up or pull-down"] pub type PUPDR0_R = cr...
use async_trait::async_trait; use crate::{ auth::UserDetail, server::{ controlchan::error::ControlChanError, controlchan::middleware::ControlChanMiddleware, ftpserver::options::FtpsRequired, session::SharedSession, Command, ControlChanErrorKind, Event, Reply, ReplyCode, }, storage::{Met...
// Copyright 2021 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 //! General-purpose functions use crate::context::{CInitializeArgs, Info, Pkcs11}; use crate::error::{Result, Rv}; use cryptoki_sys::{CK_C_INITIALIZE_ARGS, CK_INFO}; use paste::paste; use std::convert::TryFrom; // See public ...
// cd C:\Users\むずでょ\source\repos\practice-rust\async-await // cargo check --example join // cargo build --example join // cargo run --example join // // See also: // https://crates.io/ use futures::executor::block_on; use std::thread; use std::time::Duration; async fn say_apple() { print!("app"); thread::sleep...
/// bindings for ARINC653P1-5 3.7.2.3 semaphore pub mod basic { use crate::bindings::*; use crate::Locked; pub type SemaphoreName = ApexName; /// According to ARINC 653P1-5 this may either be 32 or 64 bits. /// Internally we will use 64-bit by default. /// The implementing Hypervisor may cast ...
use crate::part::Part; use std::io::{BufRead, BufReader}; use std::{collections::BTreeMap, fs::File}; #[derive(Debug)] enum Instr { SetMask(Vec<(usize, i64)>), Write(i64, i64), } fn decode_v1_mask(mask: &[(usize, i64)]) -> (i64, i64) { let base: i64 = 2; mask.iter().filter(|(_, c)| *c >= 0).fold( ...
extern crate ndarray; mod parser; mod pretty_printer; use ndarray::{ArrayBase, Dim, OwnedRepr}; use std::error::Error; type Matrix<T> = ArrayBase<OwnedRepr<T>, Dim<[usize; 2]>>; type Executable = Result<(), Box<dyn Error>>; fn main() -> Executable { let matrix_bytes = include_bytes!("matrix.txt"); let mat...
use itertools::Itertools; const YEAR: usize = 2020; fn find_sum(expenses: &[usize], k: usize) -> usize { expenses .iter() .copied() .combinations(k) .find(|v| v.iter().sum::<usize>() == YEAR) .expect("There should be a pair") .into_iter() .product() } #[cfg...
//! Code is based on https://github.com/chris-morgan/mopa //! with the macro inlined for `Resource`. License files can be found in the //! directory of this source file, see COPYRIGHT, LICENSE-APACHE and //! LICENSE-MIT. #[cfg(test)] mod tests; use std::any::TypeId; use crate::Resource; impl dyn Resource { /// ...
extern crate mio; extern crate regex; pub mod http; mod event_loop; mod app_server; pub mod http_file; pub mod handlers; pub mod handler_lib; use app_server::*; use handler_lib::*; pub struct WebServer { host: String, handlers: Vec<HandlerRoute>, num_workers: usize, } impl WebServer { pub fn new(hos...
mod expense; mod group; mod person; mod schema; mod user; pub(super) use self::{expense::*, group::*, person::*, user::*}; use crate::infrastructure::config; use anyhow::Context; use diesel::{pg::PgConnection, r2d2::ConnectionManager}; use r2d2::Pool; /// The Postgres-specific connection pool managing all database co...
#[doc = "Reader of register IPRIORITYR7"] pub type R = crate::R<u32, super::IPRIORITYR7>; #[doc = "Writer for register IPRIORITYR7"] pub type W = crate::W<u32, super::IPRIORITYR7>; #[doc = "Register IPRIORITYR7 `reset()`'s with value 0"] impl crate::ResetValue for super::IPRIORITYR7 { type Type = u32; #[inline(...
use actix_web::middleware::Logger; pub fn init() -> Logger { return Logger::new("%r - %s - %a - %D"); }
fn main(){ let mut v : Vec<i32> = vec![5,2,4,6,1,3]; selection_sort(&mut v); //swap let mut v : Vec<i32> = vec![3,4,5,6,2]; println!("v[0]:{}",v[0]); println!("v[1]:{}",v[1]); v.swap(0,1); println!("swap!"); println!("v[0]:{}",v[0]); println!("v[1]:{}",v[1]); //println...
use quote::{quote_spanned, ToTokens}; use syn::parse_quote; use super::{ DelayType, FlowProperties, FlowPropertyVal, OperatorCategory, OperatorConstraints, OperatorWriteOutput, WriteContextArgs, RANGE_0, RANGE_1, }; use crate::graph::{OperatorInstance, PortIndexValue}; /// > 2 input streams of the same type T...
use crate::util::{bytes_to_u16, bytes_to_u32}; use log::{debug, warn}; use num_derive::{FromPrimitive, ToPrimitive}; use num_traits::{FromPrimitive, ToPrimitive}; use std::collections::HashMap; #[derive(Copy, Clone, PartialEq, FromPrimitive, Debug)] #[repr(C)] pub enum TransProto { NotSet, Tcp, Udp, Sc...
use cranelift::prelude::*; use std::ops::{Deref, DerefMut}; #[derive(Clone, Copy, PartialEq, Eq)] #[allow(non_camel_case_types)] #[repr(C)] pub enum Op { /// Removes an item from the top of the stack. It is undefined what happens if /// the stack is empty. /// /// `( a -- )` OP_DROP = 0, /// Du...
// Copied from https://github.com/mvirkkunen/usbd-serial #![allow(dead_code)] use core::convert::TryInto; use core::mem; use usb_device::class_prelude::*; use usb_device::Result; /// This should be used as `device_class` when building the `UsbDevice`. pub const USB_CLASS_CDC: u8 = 0x02; const USB_CLASS_CDC_DATA: u8 ...
//! TODO: add ability to revoke refresh tokens. use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize)] enum TokenType { Refresh, Access, } #[derive(Debug)] pub enum Error { Expired, Other, } #[derive(Debug, PartialEq, Serialize, Deserialize, Clone)] pub struct AuthenticationState { ...
use goose::prelude::*; fn main() -> Result<(), GooseError> { let _goose_metrics = GooseAttack::initialize()? .register_taskset(taskset!("LoadtestTasks") // Register the greeting task, assigning it a weight of 1. .register_task(task!(loadtest_root).set_name("root").set_weight(1)?) ...
use super::{Pusherator, PusheratorBuild}; pub struct Inspect<Next, Func> { next: Next, func: Func, } impl<Next, Func> Pusherator for Inspect<Next, Func> where Next: Pusherator, Func: FnMut(&Next::Item), { type Item = Next::Item; fn give(&mut self, item: Self::Item) { (self.func)(&item)...
// Copyright 2020 EinsteinDB Project Authors. Licensed under Apache-2.0. #[cfg(test)] pub mod datadriven_test; pub mod joint; pub mod majority; use std::collections::HashMap; use std::fmt::{self, Debug, Display, Formatter}; /// VoteResult indicates the outcome of a vote. #[derive(Clone, Copy, Debug, PartialEq)] pub e...
use std::collections::HashMap; use serde::Deserialize; use serde::Serialize; use crate::api::models::delegate::Delegate; use crate::common::deserialize_as_u64_from_number_or_string; #[derive(Clone, Debug, Default, PartialEq, Serialize, Deserialize)] #[serde(rename_all = "camelCase")] pub struct Wallet { pub addr...
#![feature (specialization, iterator_step_by, integer_atomics)] extern crate rand; extern crate fluidsynth; extern crate hound; extern crate dsp; extern crate ordered_float; #[macro_use] extern crate lazy_static; extern crate portaudio; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_jso...
use crate::{smmo::SmmoModel, Player, Reqwest, SmmoResult, DB}; use crate::{SmmoError, SmmoPlayer}; use serenity::{ client::Context, framework::standard::{macros::command, CommandResult}, model::channel::Message, }; use sqlx::query_as; #[command] pub async fn me(ctx: &Context, msg: &Message) -> CommandResul...
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use crate::OptionalEpoch; use address::Address; use cid::Cid; use clock::ChainEpoch; use crypto::Signature; use num_bigint::biguint_ser::{BigUintDe, BigUintSer}; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use vm::{Padde...
use std::f32::consts::PI; use alga::general::SubsetOf; pub fn create_wall_side_draw<'a>( pos: ::na::Isometry3<f32>, radius: f32, color: ::graphics::Color, groups: Vec<u16>, static_draws: &mut ::specs::WriteStorage<'a, ::component::StaticDraw>, graphics: &::specs::Fetch<'a, ::resource::Graphics>...
#![allow(dead_code)] use super::imagemagick_commands; use super::op_types::{ImageMagickOpType}; use image_tools::image_ops::{ElementaryPageOperations, Pixels, Direction}; use image_tools::image_ops::ImageResolution; use image_tools::image_ops::RunOperation; use image_tools::image_ops::OperationResults; use image_tools:...
mod ser_bots; mod ser_resources; mod ser_structures; mod util; mod world_events; use caolo_sim::{ components::RoomComponent, prelude::{Axial, Hexagon, TerrainComponent, World}, }; use std::collections::HashMap; use std::sync::Arc; use tokio::sync::{ broadcast::{error::RecvError, Sender}, mpsc, }; use t...
use ggez::{ self, graphics::{self, Text, DrawMode}, input::keyboard::{self, KeyCode}, nalgebra as na, Context, GameResult,event }; pub mod utilities; pub mod constants; pub struct MainState { player_1_pos: na::Point2<f32>, player_2_pos: na::Point2<f32>, ball_pos: na::Point2<f32>, ball_...
// fn main() { // println!("Hello, world!"); // } #![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; use rocket::http::RawStr; #[get("/hello/<name>")] fn hello(name: &RawStr) -> String { format!("Hello, {}!", name.as_str()) } #[get("/")] fn index() -> &'static str { let output...
//! Implement custom IdentityPolicy that stores a session id //! with the `CookieSessionPolicy` and the session data in the database use actix_identity::CookieIdentityPolicy; use actix_identity::Identity; use actix_identity::IdentityPolicy; use actix_web::dev::{Payload, ServiceRequest, ServiceResponse}; use actix_web::...
use green::EventLoop; use rustuv; test!(fn callback_run_once() { let mut event_loop = rustuv::EventLoop::new().unwrap(); let mut count = 0; let count_ptr: *mut int = &mut count; event_loop.callback(proc() { unsafe { *count_ptr += 1 } }); event_loop.run(); assert_eq!(count, 1); })
use core::mem; use core::fmt; #[derive(Copy, Clone, Debug)] #[repr(C, packed)] pub struct Rsdp { signature: Signature8, checksum: u8, oemid: OemId, revision: u8, rsdt_address: u32, length: u32, xsdt_address: u64, extended_checksum: u8, reserved: [u8; 3] } #[derive(Copy, Clone, Debu...
use crate::config::{Named, Test}; use crate::docker::Verification; use crate::error::ToolsetError::InvalidFrameworkBenchmarksDirError; use crate::error::{ToolsetError, ToolsetResult}; use crate::metadata; use crate::results::Results; use chrono::Utc; use colored::Colorize; use std::collections::HashMap; use std::env; u...