text
stringlengths
8
4.13M
#[doc = "Register `DINR15` reader"] pub type R = crate::R<DINR15_SPEC>; #[doc = "Field `DIN15` reader - Input data received from MDIO Master during write frames"] pub type DIN15_R = crate::FieldReader<u16>; impl R { #[doc = "Bits 0:15 - Input data received from MDIO Master during write frames"] #[inline(always)...
//! A LED roulette! #![deny(unsafe_code)] #![deny(warnings)] #![feature(proc_macro)] #![no_std] extern crate f3; #[macro_use(iprint, iprintln)] extern crate cortex_m; extern crate cortex_m_rtfm as rtfm; // extern crate nb; // use cast::{usize, u8}; // use cortex_m::peripheral::SystClkSource; // use f3::led::{self, LE...
#![allow(dead_code)] use ahash::AHasher; use rand; use std::collections::hash_map::DefaultHasher; use std::hash::{Hash, Hasher}; use std::io::{Error, ErrorKind}; use std::marker::PhantomData; #[derive(Clone)] struct Row<T: Hash + Clone> { data: Vec<u64>, width: u64, a: u128, b: u128, p: PhantomData...
use dsp::ControllableLink; use event::ControlEvent; use types::{Float, Stereo, PI}; #[derive(Debug, Clone, Copy)] pub enum FilterType { LP, HP, BP, Notch, } pub struct Filter { sample_rate: usize, filter_type: FilterType, fc: Float, q: Float, w: Float, a: Float, coeffs: ([F...
use memory::alloc; use ::core; // TODO: make private pub struct Pair<T> { head: T, tail: *mut LinkedList<T> } pub enum LinkedList<T> { Empty, List(Pair<T>) } fn start_cons<T>(head: T) -> core::result::Result<Pair<T>, T> { match alloc::alloc_type::<LinkedList<T>>(LinkedList::Empty) { Ok(ta...
//! Sets of component data. use std::marker::PhantomData; use std::mem; use std::sync::{Mutex, MutexGuard}; use super::*; trait IsSame { fn is_same() -> bool { false } } impl<A, B> IsSame for (A, B) {} impl<A> IsSame for (A, A) { #[inline] fn is_same() -> bool { true } } #[inline] fn same<A, B>() ->...
// See also: https://github.com/rayon-rs/rayon/blob/fc69e50f298b2f5fa2ce9be27827a0850f3bc8f2/rayon-core/build.rs // // We need a build script to use `links = "relative"`. But we're not // *actually* linking to anything, just making sure that we're the only // relative in use. fn main() { // we don't need to rebuild f...
// 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 Cancellable; use DataStreamByteOrder; use Error; use FilterOutputStream; use OutputStream; use Seekable; use ffi; use glib; use glib::object::Downcast; use gl...
#![no_std] #![feature(lang_items)] #![feature(start)] #[lang="panic_fmt"] extern fn panic_fmt(_: ::core::fmt::Arguments, _: &'static str, _: u32) -> ! { loop {} } // cannot use #![no_main] due to Fatal error "Unknown start function: `$main`" (I suspect something in the wasm assembler) #[start] pub fn main(_argc: is...
use criterion::{black_box, criterion_group, criterion_main, Criterion}; use multiversion::multiversion; #[cfg(feature = "std")] #[multiversion(targets = "simd", dispatcher = "indirect")] fn indirect_fn(values: &mut [f32]) { for v in values { *v *= *v; } } #[cfg(feature = "std")] #[multiversion(targets...
// This file is part of Substrate. // Copyright (C) 2017-2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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 // // ht...
use azure_core::AppendToUrlQuery; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ContinuationNextTableName(String); impl ContinuationNextTableName { pub fn new(continuation_next_table_name: String) -> Self { Self(continuation_next_table_name) } pub fn as_str(&self) -> &str ...
use crate::ast::*; use std::collections::HashMap; use std::f64::consts::*; fn too_x_params(call: &Call, count: u8, x: &str) -> Result<f64, String> { Err(format!( "Call to {}() has to {} parameters; expected {} but found {}.", call.name, x, count, call.params.len() )) } fn too_few_params(call: &Call, count...
#[derive(RustcDecodable, RustcEncodable)] pub struct MoveMessage { pub from: u8, pub to: u8, } #[derive(RustcEncodable)] pub struct StateMessage { pub my_hand: Vec<u8>, pub my_taken: Vec<u8>, pub his_hand_count: u8, pub his_taken: Vec<u8>, pub table: Vec<u8>, pub deck_left: u8, }
/*! * Perseus is a blazingly fast frontend web development framework built in Rust with support for major rendering strategies, * reactivity without a virtual DOM, and extreme customizability. It wraps the lower-level capabilities of[Sycamore](https://github.com/sycamore-rs/sycamore) * and provides a NextJS-like API...
use std::cmp; use std::fs; use std::path::Path; use std::str; pub fn generate_thumb_path(path: &str, w: u32, h: u32, path_suffix: &str) -> String { return format!("{}_{}x{}px_{}w.{}", path, w, h, w, path_suffix); } // @ToDo: Skip if not .jpg pub fn get_file_name(path: &str) -> String { return Path::new(path) ...
use std::str::Chars; #[derive(Clone)] pub struct Newlinehandler<'a> { source: Chars<'a>, chr0: Option<char>, chr1: Option<char>, } impl<'a> Newlinehandler<'a> { pub fn new<T: AsRef<str> + ?Sized>(source: &'a T) -> Self { let mut nlh = Self { source: source.as_ref().chars(), ...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub mod management_locks { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub a...
use serial; #[lang = "panic_fmt"] #[linkage = "weak"] unsafe extern "C" fn panic_fmt( _args: ::core::fmt::Arguments, _file: &'static str, _line: u32, ) -> ! { print!("panicked at '"); serial::print(_args); println!("', {}:{}", _file, _line); asm!("brk #0" :::: "volatile"); loop {} } ...
//! Simulation control management module. pub mod input; pub mod output; pub mod parameters_builder; pub mod parameters_linker; pub use self::{input::*, output::*, parameters_builder::*, parameters_linker::*};
//! Support for generating R1CS from [Bellperson]. //! //! [Bellperson]: https://github.com/filecoin-project/bellperson pub mod r1cs; pub mod shape_cs; pub mod solver;
use guess_number::main_logic; fn main() { loop{ main_logic::start(); } }
use std::{collections::HashSet, hash::Hash}; /// Find a first element that is equal to another element in `s`. #[allow(dead_code)] pub fn find_dup<T>(iter: T) -> Option<T::Item> where T: Iterator, T::Item: Eq + Hash + Clone, { let mut uniq = HashSet::new(); for item in iter { if !uniq.insert(it...
use filehandler; use std::env; #[test] fn test_read_file() { // Debug-Ausgabe: let currentWD = env::current_dir().unwrap(); println!("Current Directory: {}", currentWD.display()); let mut content:String = String::new(); let mut filename:String; filename = currentWD.display().to_string(); filename.push_s...
use k8s_openapi::api::admissionregistration::v1::MutatingWebhookConfiguration; use krator_derive::AdmissionWebhook; use kube::CustomResource; pub use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use std::cmp::PartialEq; // TODO: follow up on https://github.com/clux/kube-rs/issues/264#issuecomment-7483279...
#![cfg_attr(all(test, feature = "nightly"), feature(test))] #[cfg(all(test, feature = "nightly"))] extern crate test; mod day01; mod day02; mod day03; mod day04; mod day05; mod day06; mod day07; mod day08; mod day09; mod day10; mod day11; mod day12; mod utils; use std::fmt::Display; use std::fs::File; use std::io::R...
mod args_parser; mod dns_error; mod ip; mod output; use crate::args_parser::Color; use atty::Stream; use dns_error::error_message; use maxminddb::{MaxMindDBError, Reader}; use output::Format; use std::net::IpAddr; use std::path::PathBuf; use std::process::exit; const NAME: &'static str = env!("CARGO_PKG_NAME"); const...
//! Rendy's top level crate. //! Reexports all others. #![forbid(overflowing_literals)] #![deny(missing_copy_implementations)] #![deny(missing_debug_implementations)] #![deny(missing_docs)] #![deny(intra_doc_link_resolution_failure)] #![deny(path_statements)] #![deny(trivial_bounds)] #![deny(type_alias_bounds)] #![de...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::schema::{ensure_slice_len_eq, CHANNEL_WRITE_SET_CF_NAME}; use anyhow::Result; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use libra_types::transaction::Version; use schemadb::{ define_schema, schema::...
#[doc = "Register `GICD_SGIR` writer"] pub type W = crate::W<GICD_SGIR_SPEC>; #[doc = "Field `SGIINTID` writer - SGIINTID"] pub type SGIINTID_W<'a, REG, const O: u8> = crate::FieldWriter<'a, REG, 4, O>; #[doc = "Field `NSATT` writer - NSATT"] pub type NSATT_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc ...
// Copyright 2015 The Rust-Windows Project Developers. See the // COPYRIGHT file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MI...
// Copyright 2013-2015 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>...
#[doc = "Register `OTG_HPTXFSIZ` reader"] pub type R = crate::R<OTG_HPTXFSIZ_SPEC>; #[doc = "Register `OTG_HPTXFSIZ` writer"] pub type W = crate::W<OTG_HPTXFSIZ_SPEC>; #[doc = "Field `PTXSA` reader - PTXSA"] pub type PTXSA_R = crate::FieldReader<u16>; #[doc = "Field `PTXSA` writer - PTXSA"] pub type PTXSA_W<'a, REG, co...
use rand::prelude::*; pub fn create_rand_range() -> f32{ let mut rng = rand::thread_rng(); rng.gen() }
// Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. use std::sync::{mpsc, Arc}; use std::thread; use std::time::Duration; use grpcio::{ChannelBuilder, Environment}; use kvproto::kvrpcpb::*; use kvproto::metapb::{Peer, Region}; use kvproto::tikvpb::TikvClient; use test_raftstore::*; use tikv_util::Hand...
use super::error::{CurrentDirectoryPathError, ProjectRootPathError}; use crate::domain::command_line::ICommandLineHandler; use anyhow::Result; use std::{env, fs, path::Path, process::Command}; pub struct CommandLineHandler; impl ICommandLineHandler for CommandLineHandler { fn current_path() -> Result<String> { ...
use crate::db::money_nodes; use crate::graphql::Context; use crate::models::money_node::{MoneyNode, NewMoneyNode, UpdateMoneyNode}; use diesel::PgConnection; use juniper::{FieldError, FieldResult}; pub struct MoneyNodeQuery; pub struct MoneyNodeMutation; impl MoneyNodeQuery { pub fn all(ctx: &Context) -> FieldRes...
extern crate rand; use super::{Coin}; use std::collections::HashMap; use std::any::TypeId; use std::marker::Reflect; #[derive(Debug)] pub enum InvErr { Maxed, Limit, Empty, Invalid, } pub type InvItem<K> = (u32,K); pub trait InvWork<K> { fn add (&mut self, mut k:K) -> Result<u32,...
use super::fuse3_sys::{ fuse_session_destroy, fuse_session_fd, fuse_session_mount, fuse_session_new, fuse_session_unmount, }; use super::{ensure_last_os_error, with_fuse_args, MountOption}; use std::{ ffi::{c_void, CString}, fs::File, io, os::unix::{ffi::OsStrExt, io::FromRawFd}, path::Path,...
#![deny(missing_docs)] //! Library to display images in the terminal. //! //! This library contains functionality extracted from the [`viu`](https://github.com/atanunq/viu) crate. //! It aims to provide an easy to use interface to print images in the terminal. Uses some abstractions //! provided by the [`image`] crate...
use std::time::Instant; use async_trait::async_trait; use messagebus::{ derive::Message, error, receivers::BufferUnorderedConfig, AsyncHandler, Bus, Message, }; use thiserror::Error; #[derive(Debug, Error, messagebus::derive::Error)] enum Error { #[error("Error({0})")] Error(anyhow::Error), } impl<M: Mes...
//! Staking for domains use crate::pallet::{ DomainStakingSummary, NextOperatorId, Nominators, OperatorIdOwner, Operators, PendingDeposits, PendingNominatorUnlocks, PendingOperatorDeregistrations, PendingOperatorSwitches, PendingOperatorUnlocks, PendingSlashes, PendingStakingOperationCount, PendingWithdraw...
use nu_engine::get_full_help; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{Category, IntoPipelineData, PipelineData, ShellError, Signature, Value}; #[derive(Clone)] pub struct Hash; impl Command for Hash { fn name(&self) -> &str { "hash" } ...
use super::super::actions::*; use super::super::keybinds::*; use zellij_tile::data::Key; #[test] fn merge_keybinds_merges_different_keys() { let mut mode_keybinds_self = ModeKeybinds::new(); mode_keybinds_self.0.insert(Key::F(1), vec![Action::NoOp]); let mut mode_keybinds_other = ModeKeybinds::new(); m...
use nom::{branch::alt, bytes::complete::tag, IResult}; use super::{parse_args, ModifierTrait}; #[derive(Debug, Default, PartialEq, Eq)] pub struct SelectModifier { /// 0-indexed pub select: u32, } impl ModifierTrait for SelectModifier { fn parse(input: &str) -> IResult<&str, Self> { // 1-indexed ...
// This file is part of Substrate. // Copyright (C) 2020 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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://...
use std::fmt; use std::iter::Iterator; use std::ops::Index; use std::str; use typed_arena::Arena; use crate::error::Error; use crate::trie::TrieNode; use crate::multivec::{Vec2, Vec3}; pub struct Board<'word> { board: Vec<&'word [u8]>, letters: [bool; 26], } impl<'word> fmt::Debug for Board<'word> { fn ...
//! These are internal helper functions used when creating a new [`Mnemonic`][Mnemonic], and when turning a [`Mnemonic`][Mnemonic] //! into a [`Seed`][Seed]. //! //! [Mnemonic]: ../mnemonic/struct.Mnemonic.html //! [Seed]: ../seed/struct.Seed.html //! extern crate rand; use self::rand::{thread_rng, RngCore}; use hmac:...
use std::fs; use crate::command::CommandResult; use crate::domain::model::Favorite; use colored::Colorize; pub fn print_favorites(favorites: Vec<Favorite>) { for favorite in favorites { println!(" {} -> {}", favorite.name(), favorite.path()); } } pub fn error(message: &str) { println!("{} {...
extern crate clap; extern crate termion; extern crate rand; use std::io::{self, Read, Write}; use std::collections::BTreeSet; struct TextShiftMatrix { width: u16, height: u16, cells: Vec<char>, targetcells: Vec<char>, vocabulary: BTreeSet<char>, probability: f64, defaulttarget: char } im...
use core::{ cmp::Ordering, convert::TryFrom, fmt, hash::{Hash, Hasher}, iter::Sum, ops::{Add, AddAssign, Div, Mul}, }; use serde::{Deserialize, Serialize}; use crate::{ClosedUnitF64, PositiveF64}; #[derive(Debug)] #[allow(clippy::module_name_repetitions)] pub struct NonNegativeF64Error(f64); ...
#![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 QueryRequest { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub subscriptions: Vec<String>, ...
const INF: i64 = 1 << 61; // adjacent list struct Graph { edges: Vec<(usize, usize, i64)>, // adjacent list n: usize } impl Graph { fn new(n: usize) -> Self { Graph { edges: vec![], n: n } } fn add_costs(&mut self, from: usize, to: usize, cost: i64, direct...
extern crate base64; use std::io::prelude::*; use std::path::Path; use chrono::{Local, NaiveDateTime}; use diesel::{self, prelude::*}; use rocket::response::{status, Failure, NamedFile}; use rocket::data::Data; use rocket::http::Status; use rocket_contrib::{Json, Template}; use DbConn; use dbtools; use {contexts, co...
#[derive(VulkanoShader)] #[ty = "fragment"] #[src = " #version 450 layout(location = 0) out uint out_color; void main() { out_color = 1; } "] struct _Dummy;
use std::error::Error; fn main() { return_from_match(); square_from_str(); } // match分支内return, 跳过函数后面程序执行 fn return_from_match() { let s: Option<&str> = None; match s { None => { return; // 直接退出函数 } s => { println!("{}", s.unwrap()); } } ...
use serde::{Deserialize, Serialize}; use serde_json::Result; use super::Loan; use comfy_table::presets::UTF8_FULL; use comfy_table::CellAlignment::Right; use comfy_table::*; #[derive(Serialize, Deserialize)] pub struct LoansInfo { pub loans: Vec<Loan>, } impl LoansInfo { pub fn new() -> LoansInfo { L...
use std::collections::HashSet; use syn::visit::{visit_path, visit_type, Visit}; use syn::{ext::IdentExt, GenericParam, Generics, Ident, Type}; pub struct GenericParamSet { idents: HashSet<Ident>, } impl GenericParamSet { pub fn new(generics: &Generics) -> Self { let mut idents = HashSet::new(); ...
use rand::seq::SliceRandom; use rand::thread_rng; use std::collections::HashMap; use std::fmt::Debug; use std::mem; use crate::action::{Action, ActionOptions, Borrow, Borrowing}; use crate::card::{Card, Colour}; use crate::game::VisibleGame; use crate::power::ScienceItem; use crate::power::{Power, ProducedResources}; ...
use super::blockid::BlockId; use super::filemanager::FileMgr; use super::logiterator::LogIterator; use super::page::Page; use anyhow::Result; use std::cell::RefCell; use std::mem; use std::sync::Arc; pub struct LogMgr { fm: Arc<RefCell<FileMgr>>, logfile: String, logpage: Page, currentblk: BlockId, ...
struct MyStruct { a: u32, b: f32, c: String } enum Term { TermVal { value: String }, TermVar { symbol: String }, TermApp { f: Box<Term>, x: Box<Term> }, TermAbs { arg: String, body: Box<Term> } } fn main() { let x = { fn f(x: u32) -> u32 { x*x } let...
#[doc = "Register `IPCC_C1TOC2SR` reader"] pub type R = crate::R<IPCC_C1TOC2SR_SPEC>; #[doc = "Field `CHxF` reader - CHxF"] pub type CHX_F_R = crate::FieldReader; impl R { #[doc = "Bits 0:5 - CHxF"] #[inline(always)] pub fn chx_f(&self) -> CHX_F_R { CHX_F_R::new((self.bits & 0x3f) as u8) } } #[d...
use crate::*; const CTRL: u32 = mmio::BASE + 0x00104000; const STATUS: u32 = mmio::BASE + 0x00104004; const DATA: u32 = mmio::BASE + 0x00104008; const INT_MASK: u32 = mmio::BASE + 0x00104010; pub struct Rand {} impl Rand { pub fn new() -> Self { // TODO: init hardware random-number generator mmi...
// Generated by `scripts/generate.js` use std::os::raw::c_char; use std::ops::Deref; use std::ptr; use std::cmp; use std::mem; use utils::c_bindings::*; use utils::vk_convert::*; use utils::vk_null::*; use utils::vk_ptr::*; use utils::vk_traits::*; use vulkan::vk::*; use vulkan::vk::{VkStructureType,RawVkStructureType...
extern crate net2; extern crate hyper; use settings::Settings; use futures::{Stream, Future}; use hyper::server::Http; use hyper::Client; use tokio_core::reactor::Core; use tokio_core::net::TcpListener; use net2::unix::UnixTcpBuilderExt; use std::sync::Arc; use std::net::SocketAddr; use router::Proxy; use host_r...
use std::fs::File; use std::io; use std::io::Read; use std::path::Path; use serde::{Deserialize, Deserializer}; use crate::logger; static DEFAULT_CONFIG: &str = indoc!(r#" # Control the level of verbosity of logging. # Valid values are: "trace", "debug", "info", "warn", "error", "fatal" log_level = "info" #...
#[doc = "Register `MACCR` reader"] pub type R = crate::R<MACCR_SPEC>; #[doc = "Register `MACCR` writer"] pub type W = crate::W<MACCR_SPEC>; #[doc = "Field `RE` reader - Receiver enable"] pub type RE_R = crate::BitReader; #[doc = "Field `RE` writer - Receiver enable"] pub type RE_W<'a, REG, const O: u8> = crate::BitWrit...
#[test] fn test_queue() { let a = Queue::new() .push_back(1) .push_back(2); let b = a .push_back(3) .push_back(4); let c = a .push_back(5) .push_back(6); let b1 = b .pop_front().unwrap().0 .pop_front().unwrap().0; let c1 = c .po...
use async_trait::async_trait; use messagebus::{derive::Message, error, AsyncHandler, Bus, Handler, Message, TypeTagged}; use thiserror::Error; #[derive(Debug, Error, messagebus::derive::Error)] enum Error { #[error("Error({0})")] Error(anyhow::Error), } impl<M: Message> From<error::Error<M>> for Error { f...
#[doc = "Register `SDMMC_MASKR` reader"] pub type R = crate::R<SDMMC_MASKR_SPEC>; #[doc = "Register `SDMMC_MASKR` writer"] pub type W = crate::W<SDMMC_MASKR_SPEC>; #[doc = "Field `CCRCFAILIE` reader - Command CRC fail interrupt enable Set and cleared by software to enable/disable interrupt caused by command CRC failure...
mod args; mod class; mod codegen; mod context; mod executor; mod method; #[cfg(feature = "perf")] mod perf; pub mod vm_inst; pub use args::*; pub use class::*; pub use codegen::{Codegen, ISeq, ISeqPos}; pub use context::*; pub use executor::*; pub use method::*;
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate::test::types::{ StepResult, StepResultItem, TestPlan, TestPlanTest, TestResult, TestResultItem, TestResults, }, fidl_fuchsi...
use crate::thread_pool::ThreadPool; use crossbeam::channel::{unbounded, Receiver, Sender}; use std::thread; /// ShareQueueThreadPool #[derive(Debug)] pub struct SharedQueueThreadPool { sender: Sender<ThreadPoolMessage>, } impl ThreadPool for SharedQueueThreadPool { fn new(size: u32) -> crate::Result<Self> ...
use crate::parser::tokens::TokenType; use crate::parser::{ ast::{Atom, Begin, ExprKind, LambdaFunction, List, Set}, parser::SyntaxObject, }; use std::collections::HashSet; use super::{Folder, VisitorMutUnit}; struct FlattenBegin {} impl FlattenBegin { fn flatten(expr: ExprKind) -> ExprKind { Flatt...
use crate::instruction::Instruction; use std::collections::BTreeMap; use crate::interpreter::world::World; #[cfg(feature = "bignum")] use num_bigint::{BigInt, RandBigInt, Sign}; use num_integer::Integer as _; #[cfg(feature = "bignum")] use num_traits::cast::ToPrimitive; use std::cell::RefCell; use std::convert::TryInt...
#[doc = "Register `FMC_BCHICR` writer"] pub type W = crate::W<FMC_BCHICR_SPEC>; #[doc = "Field `CDUEF` writer - CDUEF"] pub type CDUEF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CDERF` writer - CDERF"] pub type CDERF_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CD...
fn main() { let string = String::from("Wizz air"); let wizz = &string[0..=3]; let air = &string[5..]; println!("First is '{}' and then is '{}'", wizz, air); let greeting = String::from("Hello world!"); println!("First word is '{}'", first_word(&greeting)); } fn first_word(s: &str) -> &str { ...
#[doc = "Register `FDCAN_IR` reader"] pub type R = crate::R<FDCAN_IR_SPEC>; #[doc = "Register `FDCAN_IR` writer"] pub type W = crate::W<FDCAN_IR_SPEC>; #[doc = "Field `RF0N` reader - Rx FIFO 0 new message"] pub type RF0N_R = crate::BitReader; #[doc = "Field `RF0N` writer - Rx FIFO 0 new message"] pub type RF0N_W<'a, RE...
/* type checking and inference stack machine execution x64 assembly output ??? */ mod builder; mod lexer; mod parser; mod strtab; fn main() { use parser::Parser; let filename = "input.txt".to_string(); let mut parser = Parser::new_file(filename); let ast_module = parser.module(); let m...
use std::sync::Arc; use serde::{Deserialize, Serialize}; use tracing::debug; use tracing::instrument; use htsget_config::types::Format; use htsget_search::htsget::HtsGet; use crate::ConfigServiceInfo; use crate::{Endpoint, READS_FORMATS, VARIANTS_FORMATS}; /// A struct representing the information that should be pr...
use std::fmt; use std::fs; use std::path::PathBuf; use crate::common::*; const EXCLUDED_FILES: &[&str] = &[".envrc"]; #[derive(Clone, Debug, Eq, Ord, PartialEq, PartialOrd)] pub struct FileEntry { pub path: PathBuf, pub file_name: String, pub total_lines: usize, } impl fmt::Display for FileEntry { f...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 pub mod file_wallet_store; pub mod keystore_wallet; #[cfg(test)] mod test { use crate::file_wallet_store::FileWalletStore; // use starcoin_types::account_address::AccountAddress; use std::collections::HashMap; use w...
#[macro_use] extern crate glsl_linalg; use glsl_linalg::vector::{FloatVector, Vector}; #[test] fn v_mul_f() { let f = 2.0; let v = vec4!(3.0); assert_eq!(vec4!(6.0), v * f); } #[test] fn v_div_f() { let f = 4.0; let v = vec4!(8.0); assert_eq!(vec4!(2.0), v / f); } #[test] fn v_add_v() { ...
use crate::components::SayComponent; use crate::indices::*; use crate::intents::{Intents, SayIntent}; use crate::profile; use crate::storage::views::{UnsafeView, UnwrapViewMut}; use std::mem::take; use tracing::trace; type Mut = ( UnsafeView<EntityId, SayComponent>, UnwrapViewMut<EmptyKey, Intents<SayIntent>>,...
#[doc = "Register `CR1` reader"] pub type R = crate::R<CR1_SPEC>; #[doc = "Register `CR1` writer"] pub type W = crate::W<CR1_SPEC>; #[doc = "Field `UE` reader - USART enable"] pub type UE_R = crate::BitReader<UE_A>; #[doc = "USART enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub enum UE_A ...
pub struct Number { pub num: Num } pub enum Num { PosInt(u64), NegInt(i64), Float(f64), }
#![cfg(feature = "runtime-benchmarks")] use super::*; use crate as NFT; use frame_benchmarking::{account, benchmarks}; use frame_support::traits::Get; use frame_system::RawOrigin; use sp_runtime::traits::UniqueSaturatedInto; use sp_std::vec; const SEED: u32 = 0; const ENDOWMENT: u32 = 1_000_000; fn create_account<T...
// This file is part of Substrate. // Copyright (C) 2018-2020 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 clap::{App, Arg}; use std::fs::File; use std::io::Read; use std::error::Error; #[tokio::main] pub async fn main() -> Result<(), Box<dyn Error>> { let matches = App::new("rsnova") .version("0.1.0") .author("yinqiwen<yinqiwen@gmail.com>") .about("Private proxy solution & network troubles...
use std::io::prelude::*; use std::{fs::File, io::BufReader}; use crate::solver::Solver; pub struct Solution; type Policy = (usize, usize, char); impl Solver for Solution { type Input = Vec<String>; type Output1 = u32; type Output2 = u32; fn parse_input(&self, file: File) -> Self::Input { Bu...
use std::borrow::Borrow; use std::collections::HashMap; use std::error::Error; pub(crate) struct HttpRequest { url: String, method: String, } #[derive(Debug, Clone)] struct HttpResponse { status_code: u8, map: HashMap<String, String>, } impl HttpRequest { async fn get(&self) -> Result<HttpRespons...
use std::path::PathBuf; use rustyline::{error::ReadlineError, Editor}; #[derive(Debug)] pub(crate) struct ReadLine { editor: Editor<()>, prompt: String, history_path: PathBuf, } impl Default for ReadLine { fn default() -> Self { let history_path = { let mut p = dirs::home_dir().ex...
#![recursion_limit = "128"] extern crate proc_macro; extern crate syn; #[macro_use] extern crate quote; use proc_macro::TokenStream; use quote::Tokens; use syn::{Body, DeriveInput, Field, Ident, PathParameters, Ty, VariantData}; #[proc_macro_derive(ComponentGroup)] pub fn component_group(input: TokenStream) -> Token...
use necsim_core_bond::NonNegativeF64; use crate::{cogs::Habitat, landscape::Location}; #[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait TurnoverRate<H: Habitat>: crate::cogs::Backup + core::fmt::Debug { #[must_use] #[debug_requires(habitat.contains(location), "locati...
use middle::middle::*; use ast::name::Name; use rbtree::RbMap; use std::borrow::ToOwned; #[derive(Debug, Clone)] pub struct Stack { // The number of variables stored in the local stack frame. // This is the number of dwords between `esp` and `ebp`. pub size: u32, // The index of each variable, relative...
#[doc = "Reader of register INIT_WINDOW_OFFSET"] pub type R = crate::R<u32, super::INIT_WINDOW_OFFSET>; #[doc = "Reader of field `INIT_WINDOW_NI`"] pub type INIT_WINDOW_NI_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:15 - Initiator Window offset captured at conn request. This value is in 1.25ms slots"] #[in...
use std::collections::VecDeque; use std::future::Future; use std::pin::Pin; use std::sync::{Arc, Mutex}; use std::task::Context; use futures::task; use tokio::sync::{mpsc, oneshot}; type Responder<T> = oneshot::Sender<T>; pub struct Req { pub resp: Responder<usize>, } pub struct Toykio { tasks: Arc<Mutex<Ve...
pub mod generation; pub mod processing;
use super::{Pages, Pagination}; use crate::{commands::osu::MapSearchArgs, embeds::MapSearchEmbed, BotResult, Context}; use rosu_v2::prelude::{Beatmapset, BeatmapsetSearchResult}; use std::{collections::BTreeMap, iter::Extend, sync::Arc}; use twilight_model::channel::Message; pub struct MapSearchPagination { msg: ...
use egui::plot::Value; #[derive(Clone, Copy)] pub struct NoiseGenerator { pub x_min: f64, pub x_max: f64, pub y_min: f64, pub y_max: f64, pub resolution: f64, } impl Default for NoiseGenerator { fn default() -> Self { Self { x_min: -20., x_max: 20., ...