text
stringlengths
8
4.13M
#[doc = "Register `TTCTC` reader"] pub type R = crate::R<TTCTC_SPEC>; #[doc = "Field `CT` reader - Cycle Time"] pub type CT_R = crate::FieldReader<u16>; #[doc = "Field `CC` reader - Cycle Count"] pub type CC_R = crate::FieldReader; impl R { #[doc = "Bits 0:15 - Cycle Time"] #[inline(always)] pub fn ct(&self...
#[derive(PartialEq)] #[derive(Debug)] pub enum PrizeType { SPECIAL, GRAND, FIRST, SECOND, THIRD, FOURTH, FIFTH, SIXTH, ADDITIONAL, NONE } #[derive(Debug)] pub struct WinningNumbers { pub special_prize: String, pub grand_prize: String, pub regular_prizes: [String; 3]...
use chrono::{DateTime, Utc}; #[derive(Debug, Clone)] pub struct StatusItem<S> { date: DateTime<Utc>, status: S, } impl<S> StatusItem<S> { fn new(status: S) -> Self { StatusItem { date: Utc::now(), status, } } pub fn date(&self) -> &DateTime<Utc> { &...
use std::fmt; use std::io; use std::sync::Arc; use std::time::Duration; use crate::cancel::Cancel; use crate::config::config; use crate::join::{make_join_handle, Join, JoinHandle}; use crate::local::get_co_local_data; use crate::local::CoroutineLocal; use crate::park::Park; use crate::scheduler::get_scheduler; use cra...
//! The crate is basically just a permutation utility. With the goal of speed //! and the smallest possible runtime memory impact possible. And so, the goal //! of this crate is to be able to calculate and obtain a permutation of a value //! as soon as possible. //! //! # Examples //! Get all the permutations of a stri...
#[doc = "Register `ICR` reader"] pub type R = crate::R<ICR_SPEC>; #[doc = "Register `ICR` writer"] pub type W = crate::W<ICR_SPEC>; #[doc = "Field `PECF` reader - Parity error clear flag"] pub type PECF_R = crate::BitReader<PECF_A>; #[doc = "Parity error clear flag\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, Pa...
/// Context: /// * Rust does not have tail call optimization, so we cannot recurse wildly /// * data lifetimes makes sure that the result of a function applied to a producer cannot live longer than the producer's data (unless there is cloning) /// * previous implementation of Producer and Consumer spent its time copyin...
use crate::types::*; use nalgebra_glm as glm; // based on #6 Intro to Modern OpenGL Tutorial: Camera and Perspective // by thebennybox, https://www.youtube.com/watch?v=e3sc72ZDDpo impl Camera { pub fn new(pos: V3, fov: f32, aspect: f32, z_near: f32, z_far: f32) -> Camera { Camera { pos, fo...
#[doc = "Clock divisor register for state machine 0\\n Frequency = clock freq / (CLKDIV_INT + CLKDIV_FRAC / 256)\n\nThis register you can [`read`](crate::generic::Reg::read), [`reset`](crate::generic::Reg::reset), [`write`](crate::generic::Reg::write), [`write_with_zero`](crate::generic::Reg::write_with_zero), [`modify...
pub mod async_test; fn main() { async_test::async_test(); }
use super::message::MessageEntity; use crate::{ repository::{GetEntityFuture, Repository}, utils, Backend, Entity, }; use twilight_model::{ channel::Attachment, id::{AttachmentId, MessageId}, }; #[cfg_attr(feature = "serde", derive(serde::Deserialize, serde::Serialize))] #[derive(Clone, Debug, Eq, Part...
pub fn make_hey(name: &str) -> String { format!("Hey {} !!!", name) } pub fn make_bye(name: &str) -> String { format!("Bye {} !!!", name) }
use crate::{ db::HirDatabase, expressions::{ AscriptionExprData, AssignmentData, BlockExprData, CallExprData, ExpressionData, FieldExprData, IfExprData, LiteralData, LiteralKind, MatchExprData, RecordExprData, StatementData, }, ids::{ AscriptionExpr, Assignment, BlockExpr...
//! An `EngineDriver` drives multiple `SymbolicEngine`s, taking care of control flow from an //! `il::Program` and handling `Platform`-specific actions. //! //! An `EngineDriver` performs the following actions: //! * Keeps track of our current location in an `il::Program`. //! * Handles `SymbolicSuccessor` results ...
use nom::branch::alt; use nom::bytes::complete::{escaped, tag, take_until, take_while1}; use nom::character::complete::{ anychar, digit1, line_ending, none_of, not_line_ending, one_of, satisfy, }; use nom::character::{is_alphabetic, is_alphanumeric}; use nom::combinator::{complete, map, not, opt, peek, recognize, r...
use std::io::Cursor; use glium::texture::{MipmapsOption, Texture2d}; use glium::{texture::RawImage2d, Display}; pub fn load_png_texture(display: &Display, bytes: &[u8]) -> Texture2d { let image = image::load(Cursor::new(bytes), image::ImageFormat::Png) .unwrap() .to_rgba8(); let image_dimensio...
mod cmds; mod procs; use std::process::{abort, exit}; use self::cmds::Commands; use self::procs::{setup, run}; macro_rules! run_or_exit { ( $cmd:expr, $own_args:expr ) => { match run($cmd.exe().unwrap(), $cmd.args(), $own_args) { Ok(code) => if code != 0 { exit(code) }, Err(e) => {...
#[cfg(test)] #[macro_use] extern crate pretty_assertions; mod utils; #[cfg(test)] mod basic_directed_graph_tests { use crate::utils::assert_sorted_vec_eq; use graphific::{AnyGraph, BasicDirectedGraph, Edge, Kinship, Vertex}; #[test] fn new_basic_directed_graph() { let graph: BasicDirectedGrap...
/*! ```rudra-poc [target] crate = "flumedb" version = "0.1.4" indexed_version = "0.1.3" [report] issue_url = "https://github.com/sunrise-choir/flumedb-rs/issues/10" issue_date = 2021-01-07 rustsec_url = "https://github.com/RustSec/advisory-db/pull/661" rustsec_id = "RUSTSEC-2021-0086" [[bugs]] analyzer = "UnsafeDataf...
use util::*; const LEN: usize = 25; fn main() -> Result<(), Box<dyn std::error::Error>> { let timer = Timer::new(); let input = input::lines::<usize>(&std::env::args().nth(1).unwrap()); let mut lookup = vec![[0; LEN - 1]; input.len()]; for (i, n) in input.iter().enumerate() { let start = if i...
use exitfailure::ExitFailure; use std::path::PathBuf; use structopt::StructOpt; use structopt_flags::{ForceFlag, LogLevel, Verbose}; #[derive(Debug, StructOpt)] struct Opt { #[structopt(flatten)] verbose: Verbose, #[structopt(flatten)] force_flag: ForceFlag, /// Specify the database file you want t...
//! # The XML `<database>` format //! //! Before the FDB file format was created, older versions of the client used an XML //! file to store the client database. This was also used for LUPs to add their data //! independently of the rest of the game. use displaydoc::Display; use quick_xml::{events::Event, Reader}; use...
#![allow(non_camel_case_types)] use libusb_sys as ffi; use libc::{c_int,c_uchar}; use std::{mem::{MaybeUninit}, slice, ptr}; use log::{debug, info, error}; use snafu::{GenerateBacktrace}; use crate::ftdi::core::{FtdiError, Result}; use crate::ftdi::ftdi_context::ftdi_context; /// brief list of usb devices created by ...
#[doc = "Register `CFG1` reader"] pub type R = crate::R<CFG1_SPEC>; #[doc = "Register `CFG1` writer"] pub type W = crate::W<CFG1_SPEC>; #[doc = "Field `DSIZE` reader - Number of bits in at single SPI data frame"] pub type DSIZE_R = crate::FieldReader; #[doc = "Field `DSIZE` writer - Number of bits in at single SPI data...
const LOWER: i32 = 1; const UPPER: i32 = 1000; // Because the rule for our series is simply adding one, the number of terms are the number of // digits between LOWER and UPPER const NUMBER_OF_TERMS: i32 = (UPPER + 1) - LOWER; fn main() { // Formulaic method println!("{}", (NUMBER_OF_TERMS * (LOWER + UPPER)) /...
pub mod material; pub mod mesh; pub mod obj; pub mod shader; pub mod texture;
mod cfg; mod log_merge; mod server; mod tentacle; use crate::cfg::read_config; use crate::server::start_server; use std::error::Error; use std::sync::Arc; pub fn run<S: AsRef<str>>(maybe_settings: &Option<S>) -> Result<(), Box<dyn Error>> { let settings = Arc::new(read_config(maybe_settings)?); let sys = act...
use std::cmp::max; use std::io::{self, Cursor, Seek, SeekFrom, Write}; use std::ops::{Deref, DerefMut}; use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use bytes::Bytes; use snafu::{ResultExt, Snafu}; use crate::encoding_type::{EncodingError, EncodingType}; use crate::node_types::StandardType; #[derive(Debu...
use crate::cfg::CFG; use crate::gen::fs; use std::error::Error as StdError; use std::ffi::OsString; use std::fmt::{self, Display}; use std::path::Path; pub(super) type Result<T, E = Error> = std::result::Result<T, E>; #[derive(Debug)] pub(super) enum Error { NoEnv(OsString), Fs(fs::Error), ExportedDirNotA...
use crate::bytes_response::BytesResponse; use crate::BytesStream; use crate::StreamError; use bytes::Bytes; use futures::Stream; use futures::StreamExt; use http::{header::HeaderName, HeaderMap, HeaderValue, StatusCode}; use std::pin::Pin; type PinnedStream = Pin<Box<dyn Stream<Item = Result<Bytes, StreamError>> + Sen...
#[doc = "Register `AHB3SMENR` reader"] pub type R = crate::R<AHB3SMENR_SPEC>; #[doc = "Register `AHB3SMENR` writer"] pub type W = crate::W<AHB3SMENR_SPEC>; #[doc = "Field `PKASMEN` reader - PKA accelerator clock enable during CPU1 CSleep mode."] pub type PKASMEN_R = crate::BitReader; #[doc = "Field `PKASMEN` writer - P...
mod helpers; use helpers as h; use helpers::{Playground, Stub::*}; #[test] fn first_gets_first_rows_by_amount() { Playground::setup("first_test_1", |dirs, sandbox| { sandbox.with_files(vec![ EmptyFile("los.1.txt"), EmptyFile("tres.1.txt"), EmptyFile("amigos.1.txt"), ...
#[macro_use(accepts, to_sql_checked)] extern crate postgres; extern crate chrono; extern crate byteorder; extern crate num; #[macro_use(value_t)] extern crate clap; mod account; mod balance; mod currency; mod deposit; use clap::{App, ArgMatches}; fn prepare_interface<'a, 'b>() -> ArgMatches<'a, 'b> { // Top leve...
$NetBSD: patch-third__party_rust_authenticator_src_lib.rs,v 1.1 2023/02/05 08:32:24 he Exp $ --- third_party/rust/authenticator/src/lib.rs.orig 2020-08-28 21:33:54.000000000 +0000 +++ third_party/rust/authenticator/src/lib.rs @@ -5,7 +5,7 @@ #[macro_use] mod util; -#[cfg(any(target_os = "linux", target_os = "freeb...
use letters::LETTERS_POS; use colors::CPAIRS; use ncurses::*; use std::process::Command; pub type Color = i16; pub enum Source { StaticText(String), Subcommand(String), } impl Source { pub fn emit_string(&self) -> String { match *self { Source::StaticText(ref text) => text.clone(), ...
use super::*; /// A venue. #[derive(Debug,Deserialize)] pub struct Venue { /// The venue's location. pub location: Box<Location>, /// The name of the venue. pub title: String, /// The address of the venue. pub address: String, /// The venue's Foursquare identifier. pub foursquare_id: Op...
use rand::prelude::SliceRandom; use std::convert::TryInto; use std::fmt; use std::str::FromStr; #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq, Ord, PartialOrd)] #[repr(u8)] enum Facelet { White, Orange, Green, Red, Yellow, Blue, } impl fmt::Display for Facelet { fn fmt(&self, f: &mut fm...
fn main() -> std::io::Result<()> { let input = std::fs::read_to_string("examples/13/input.txt")?; let mut lines = input.lines(); let timestamp = lines.next().unwrap().parse::<u64>().unwrap(); let buses = lines .next() .unwrap() .split(',') .filter(|x| x != &"x") ....
/* * 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 */ /// SyntheticsTestProcessStatus : Status of a Synthetic test. /// Status of a Synthetic test. #[derive(...
// 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. //! Provides the main OPAQUE API use crate::{ errors::{utils::check_slice_size, InternalPakeError, PakeError, ProtocolError}, gro...
pub mod led_ctrl; pub mod config;
use std::collections::HashMap; use std::collections::hash_map; use std::hash::Hash; use std::borrow::Borrow; pub struct LazyHashMap<K, V> { map: Option<HashMap<K, V>>, } impl<K, V> LazyHashMap<K, V> where K: ::std::hash::Hash + Eq { pub fn new() -> LazyHashMap<K, V> { LazyHashMap { map: None } ...
use common::*; use standard; /// A Stream that produces a stream of random `u8`s with no delay #[derive(Debug)] pub struct Producer { next: standard::instant::Producer, } impl Producer { pub fn new() -> Producer { Producer{next: standard::instant::Producer::new()} } } impl Stream for Producer { type Item...
#[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::AUX7 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w mut ...
extern crate difference; extern crate getopts; use std::env; use getopts::Options; fn main() { let args: Vec<String> = env::args().collect(); let program = args[0].clone(); let mut opts = Options::new(); opts.optopt("s", "split", "", "char|word|line"); let matches = match opts.parse(&args[1..]) {...
use lib::{Token, Node, Pprint}; pub fn parse(token_vec: Vec<Token::Token>, filename: &str) -> Vec<Node::Node> { // println!(""); // println!("----------------"); // println!("[+] Parser:"); // Get the token vector let mut token_vec = token_vec; // Pprint::print_token(&token_vec); // Build AST l...
use hydroflow::hydroflow_syntax; fn main() { let mut df = hydroflow_syntax! { diff = difference(); source_iter([1]) -> [pos]diff; diff -> [neg]diff; }; df.run_available(); }
#[doc = "Register `C2SCR` writer"] pub type W = crate::W<C2SCR_SPEC>; #[doc = "Field `CH1C` writer - processor 2 Receive channel 1 status clear"] pub type CH1C_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>; #[doc = "Field `CH2C` writer - processor 2 Receive channel 2 status clear"] pub type CH2C_W<'a, REG, con...
#[doc = "Register `ILS` reader"] pub type R = crate::R<ILS_SPEC>; #[doc = "Register `ILS` writer"] pub type W = crate::W<ILS_SPEC>; #[doc = "Field `RF0NL` reader - Rx FIFO 0 New Message Interrupt Line"] pub type RF0NL_R = crate::BitReader; #[doc = "Field `RF0NL` writer - Rx FIFO 0 New Message Interrupt Line"] pub type ...
// 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...
#[doc = "Reader of register GPIO_OUT_CLR"] pub type R = crate::R<u32, super::GPIO_OUT_CLR>; #[doc = "Writer for register GPIO_OUT_CLR"] pub type W = crate::W<u32, super::GPIO_OUT_CLR>; #[doc = "Register GPIO_OUT_CLR `reset()`'s with value 0"] impl crate::ResetValue for super::GPIO_OUT_CLR { type Type = u32; #[i...
use crate::options::{ Frequenzy, NWeekday, NWeekdayIdentifier, Options, ParsedOptions, RRuleParseError, }; use crate::utils::is_some_and_not_empty; use chrono::prelude::*; use chrono_tz::{Tz, UTC}; // TODO: More validation here pub fn parse_options(options: &Options) -> Result<ParsedOptions, RRuleParseError> { ...
use nu_engine::CallExt; use nu_protocol::{ ast::{Call, CellPath}, engine::{Command, EngineState, Stack}, Category, Example, PipelineData, ShellError, Signature, Span, SyntaxShape, Value, }; #[derive(Clone)] pub struct SubCommand; impl Command for SubCommand { fn name(&self) -> &str { "into boo...
// Copyright 2020 IOTA Stiftung // // 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 w...
/// An enum to represent all characters in the Javanese block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Javanese { /// \u{a980}: 'ꦀ' SignPanyangga, /// \u{a981}: 'ꦁ' SignCecak, /// \u{a982}: 'ꦂ' SignLayar, /// \u{a983}: 'ꦃ' SignWignyan, /// \u{a984}: 'ꦄ' Lette...
use crate::lisp_object::{EvalError}; pub fn apply_unimpl() -> EvalError { EvalError::new("apply only implemented for Native, Lambda and Special Form".to_string()) } pub fn apply_empty() -> EvalError { EvalError::new("apply received empty form".to_string()) } pub fn unbound_symbol(sym: Option<&str...
use anyhow::Result; use console::{Emoji, Style}; use dialoguer::Password; use git2::{Cred, RemoteCallbacks, Repository}; use std::env; use std::path::PathBuf; pub(crate) fn clone(repository: &str, target_dir: &PathBuf, passphrase_needed: bool) -> Result<()> { let cyan = Style::new().cyan(); println!( "...
use crate::constraints::{JobSkills, SkillsModule}; use crate::extensions::create_typed_actor_groups; use crate::helpers::*; use hashbrown::HashSet; use std::iter::FromIterator; use std::sync::Arc; use vrp_core::construction::constraints::{ConstraintPipeline, RouteConstraintViolation}; use vrp_core::construction::heuris...
/* * Copyright Stalwart Labs Ltd. See the COPYING * file at the top-level directory of this distribution. * * Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or * https://www.apache.org/licenses/LICENSE-2.0> or the MIT license * <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your * optio...
#![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 ApiEndpoint { #[serde(default, skip_serializing_if = "Option::is_none")] pub endpoint: Option<String>, ...
use clap::Parser; use rand::prelude::*; /// Prints the evolution of the state of a cellular automaton to standard out. /// /// The cellular automaton is one dimensional with each Cell being in one of two states. The next /// state of each cell is only influenced by its state and the state of its two neighbours. The //...
#[macro_use] extern crate log; use rust_tdlib::{client::Client, types::*}; #[tokio::main] async fn main() { env_logger::init(); let tdlib_parameters = TdlibParameters::builder() .database_directory("tdlib") .use_test_dc(false) .api_id(env!("API_ID").parse::<i64>().unwrap()) .ap...
use crate::custom_types::exceptions::value_error; use crate::custom_types::range::Range; use crate::custom_var::CustomVar; use crate::int_var::IntVar; use crate::method::StdMethod; use crate::name::Name; use crate::operator::Operator; use crate::runtime::Runtime; use crate::std_type::Type; use crate::string_var::String...
extern crate vaas_server; use actix_codec::Framed; use actix_http::ws::Codec; use actix_web::{test, App}; use actix_web_actors::ws; use futures::{SinkExt, StreamExt}; use insta::assert_ron_snapshot; use std::env; use std::sync::Once; use std::time::Duration; use tokio::io::{AsyncRead, AsyncWrite}; use tokio::time::time...
#[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::BLEBUCKTONADJ { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R,...
use quick_xml::{XmlReader, XmlWriter, Element, Event}; use quick_xml::error::Error as XmlError; use fromxml::FromXml; use toxml::{ToXml, XmlWriterExt}; use error::Error; /// A representation of the `<textInput>` element. #[derive(Debug, Default, Clone, PartialEq)] pub struct TextInput { /// The label of the Submi...
use std::io; const BASE_PATTERN: [isize; 4] = [0, 1, 0, -1]; fn generate_multiplier(inpos: usize, outpos: usize) -> isize { let inpos = inpos + 1; // since we always want to skip the first output BASE_PATTERN[(inpos / (outpos + 1) % 4) as usize] } fn main() -> io::Result<()> { for y in 0..30 { for x in 0.....
/// An enum to represent all characters in the BassaVah block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum BassaVah { /// \u{16ad0}: '𖫐' LetterEnni, /// \u{16ad1}: '𖫑' LetterKa, /// \u{16ad2}: '𖫒' LetterSe, /// \u{16ad3}: '𖫓' LetterFa, /// \u{16ad4}: '𖫔' Let...
fn main() { cc::Build::new() .cpp(true) .file("include/farmhash.cc") .flag("-O3") .compile("libfarmhash.a"); }
use rppal::i2c::I2c; use ssd1306::{Builder, mode::GraphicsMode, interface::DisplayInterface}; use rppal::gpio::Gpio; use rppal::gpio::InputPin; use rppal::gpio::Level; mod launchkey; mod menu; struct Button { pin: Box<InputPin>, last_state: Level, has_been_pressed: bool } impl Button { fn new(pin: In...
use crate::{ backend::Token, data::{SharedDataDispatcher, SharedDataOps}, examples::{data::ExampleData, note_local_certs}, utils::{shell_quote, shell_single_quote, url_encode}, }; use drogue_cloud_service_api::endpoints::Endpoints; use patternfly_yew::*; use yew::prelude::*; #[derive(Clone, Debug, Prop...
pub trait TimeSystemExt { /// Create a new time system. The time the system is created is used as the time /// of the 0th frame. fn new() -> Self; /// Update the time system state, marking the beginning of a the next frame. /// /// The instant that this method is called is taken as the reference time for /// th...
use bs58; use super::validation::ValidationError; pub trait FromBase58 { fn from_base58(&self) -> Result<Vec<u8>, ValidationError>; } impl FromBase58 for str { fn from_base58(&self) -> Result<Vec<u8>, ValidationError> { bs58::decode(self) .into_vec() .map_err(|_| ValidationErr...
//! Wires up the application. #![feature(associated_consts)] #![allow(warnings)] #![feature(plugin)] #![cfg_attr(test, plugin(stainless))] #[macro_use] extern crate conrod; extern crate yaml_rust; extern crate notify; mod data; mod interface; mod util; pub fn main() { let data = data::Da...
// Copyright 2019 The vault713 Developers // // 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 a...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ #![warn(missing_docs)] //! Disk graph storage use std::sync::Arc; use crate::{model::{WindowsAlignedFileReader, IOContext, AlignedRead}, common::ANNResult}; /// Graph storage for disk index /// One thread has one ...
fn bottle_count<'a>(count: u8) -> String { match count { 1 => String::from("1 bottle"), _ => format!("{} bottles", count), } } pub fn verse<'a>(count: u8) -> String { match count { 0 => String::from("No more bottles of beer on the wall, no more bottles of beer.\nGo to the store and buy some more, 9...
use super::ExtractedSyntaxGrammar; use crate::generate::grammars::{Variable, VariableType}; use crate::generate::rules::{Rule, Symbol}; use std::collections::HashMap; use std::mem; struct Expander { variable_name: String, repeat_count_in_variable: usize, preceding_symbol_count: usize, auxiliary_variabl...
/* * Copyright (C) 2019 Intel Corporation. All rights reserved. * SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception */ use std::collections::HashMap; use std::collections::VecDeque; use std::cell::RefCell; fn main() { let mut vector = Vec::from([1, 2, 3, 4]); vector.push(12); let mut map: HashMa...
// 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. // // In an ideal world there would be a stable well documented set of crates containing a specific // version of the Rust compiler along w...
use bevy::math::Vec3; use bevy::reflect::TypeUuid; use bevy::render::renderer::RenderResources; #[derive(RenderResources, Default, TypeUuid)] #[repr(C)] #[uuid = "463e4b8a-d555-4fc2-ba9f-4c880063ba92"] pub struct RayUniform { pub camera_position: Vec3, pub model_translation: Vec3, pub light_translation: Vec3, pub ...
use std::os::raw::{c_int, c_uint, c_ulong}; use std::{ptr, slice}; use vpx_sys::vp8e_enc_control_id::*; use vpx_sys::vpx_codec_cx_pkt_kind::VPX_CODEC_CX_FRAME_PKT; use vpx_sys::*; const ABI_VERSION: c_int = 14; const DEADLINE: c_ulong = 1; pub struct Encoder { ctx: vpx_codec_ctx_t, width: usize, height: u...
extern crate actix; extern crate futures; extern crate tokio_core; use std::sync::Arc; use std::sync::atomic::{AtomicUsize, Ordering}; use std::time::Duration; use futures::{future, Future}; use tokio_core::reactor::Timeout; use actix::prelude::*; #[derive(Debug)] struct Ping(usize); impl actix::ResponseType for Pin...
use std::{thread, time}; pub use spacepacket::SpacePacket; pub use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::net::{ UdpSocket}; use std::net::{ SocketAddr, Ipv4Addr, TcpStream}; use std::collections::HashMap; use Config; use std::io::prelude::*; pub enum TlmCmds { ShutdownCommand, Destina...
//! Types used to describe bitfields. These describe structure and do not hold any actual values. use std::collections::HashMap; /// The size of a single bit field. pub type FieldSize = usize; /// The name of a bit field. pub type FieldName = String; /// A mapping between enum values and descriptions pub type EnumMap...
#[doc = "Register `SECBB1R4` reader"] pub type R = crate::R<SECBB1R4_SPEC>; #[doc = "Register `SECBB1R4` writer"] pub type W = crate::W<SECBB1R4_SPEC>; #[doc = "Field `SECBB1` reader - Secure/non-secure 8�Kbytes flash Bank 1 sector attributes"] pub type SECBB1_R = crate::FieldReader<u32>; #[doc = "Field `SECBB1` writer...
#![warn(rust_2018_idioms)] use ::log::{debug, error, info}; use env_logger; use std::env; use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; use std::str; use tokio; use tokio::io::{self, AsyncReadExt, AsyncWriteExt}; use tokio::net::{ lookup_host, tcp::{ReadHalf, WriteHalf}, TcpLi...
extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; extern crate time; mod api;
use std::collections::HashSet; pub struct CodeBlock { pub declared_variables: HashSet<String>, } impl CodeBlock { pub fn new() -> CodeBlock { CodeBlock { declared_variables: HashSet::new(), } } }
use SCHEDULER; use pi::timer; use traps::TrapFrame; use process::{Process, State}; use pi::console::kprintln; /// Sleep for `ms` milliseconds. /// /// This system call takes one parameter: the number of milliseconds to sleep. /// /// In addition to the usual status value, this system call returns one /// parameter: th...
//! Write a function that accepts an array of 10 integers //! (between 0 and 9), that returns a string of those numbers //! in the form of a phone number. use std::fmt::format; #[cfg(test)] mod tests { use super::*; #[test] fn returns_correct() { assert_eq!(create_phone_number(&[1, 2, 3, 4, 5, 6...
use library::lexeme::definition::TokenType::*; use library::lexeme::token::Token; /** * skip_stmt: * forwards the lookahead by one statement * returns the lookahead at the lexeme after the semi-colon */ pub fn skip_stmt(lexeme: &Vec<Token>, mut lookahead: usize) -> usize { while lexeme[lookahead].get_token_typ...
// // imports // use std::fmt; use std::fs::File; use std::path::Path; use std::result; use std::io::Read; pub type Result<T> = result::Result<T, &'static str>; // // Thermocouple struct // pub struct Thermocouple { spi: File, // the spidev interface to this thermocouple } // // Sample struct // #[allow(dead_code)]...
use crate::{BoxFuture, Entity, Result}; #[derive(Debug, Default)] pub struct LoadArgs { pub use_transaction: bool, } pub trait LoadAll<E: Entity, FILTER: Send + Sync, C>: Send + Sync where C: Default + Extend<(E::Key, E)> + Send, { fn load_all_with_args<'a>( &'a self, filter: &'a FILTER, ...
extern crate cc; use std::env; use std::path::PathBuf; fn main() { // let bindings = bindgen::Builder::default() // // The input header we would like to generate // // bindings for. // .header("wrapper.h") // // Finish the builder and generate the bindings. // .generate() ...
use std::{collections::HashMap, str::FromStr}; /// Reserved long flag name for help pub const HELP_LONG: &str = "help"; /// Reserved short flag name for help pub const HELP_SHORT: &str = "h"; /// Trait for types that can be converted from a flag. /// The parse_from function was made specific due to the dynamic nature...
#![allow(dead_code, unused_imports, unused_variables)] use std::collections::*; const DATA: &'static str = include_str!("../../../data/16"); #[derive(Debug, Default, Copy, Clone, Eq, PartialEq)] struct Device { registers: [usize; 4], } impl Device { fn parse(input: &str) -> Option<Device> { let pars...
//! An abstraction for Wasm benchmarks; this can verify whether the benchmark can be executed within the sightglass //! benchmarking infrastructure. use anyhow::Result; use std::{fmt, fs}; use std::{ fmt::{Display, Formatter}, fs::File, }; use std::{ io::Write, path::{Path, PathBuf}, }; use thiserror::E...
#![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 CheckNameAvailabilityInput { pub name: String, #[serde(rename = "type")] pub type_: check_name_availabi...
#![no_std] #![feature(fn_traits, unboxed_closures)] use core::ptr; /// A version of FnOnce that takes `self` by `&mut` reference instead of by value. /// /// This allows you to implement FnOnce on a type owning an FnMove trait object, as long as the wrapper type is Sized. /// /// This trait will be obsolete once th...