text
stringlengths
8
4.13M
pub mod configuration; pub mod error; pub mod message; pub mod startup; pub mod subsystems; pub mod telemetry; pub mod websocket; pub use startup::Application;
//! Input structures that can be fed into an [`Engine`](crate::engine::Engine). //! //! The engine itself is generic in the [`Input`] trait declared here. //! There are a couple of different built-in implementations, each //! suitable for a different scenario. Consult the module-level //! documentation of each type to ...
use super::raster::*; use crate::engine::base::*; use crate::engine::frame::*; use crate::engine::program::{Program, ShaderData}; pub struct Context { pub near: f64, pub far: f64, pub current_program: Program, pub current_buffers: Vec<Vec<Vec4>>, pub current_frame: Frame, } #[derive(Debug)] struct...
// =============================================================================== // Authors: AFRL/RQQA // Organization: Air Force Research Laboratory, Aerospace Systems Directorate, Power and Control Division // // Copyright (c) 2017 Government of the United State of America, as represented by // the Secretary of th...
use futures::{task, Async, Future, Poll}; use super::{QuicError, QuicResult}; use conn_state::ConnectionState; use parameters::ClientTransportParameters; use streams::Streams; use handshake; use std::net::{SocketAddr, ToSocketAddrs}; use std::time::Duration; use tokio::net::UdpSocket; use tokio::prelude::future::Sele...
use specs::*; use GameMode; use GameModeWriter; use SystemInfo; use types::*; use systems::handlers::packet::LoginHandler; use component::channel::*; use protocol::{PlaneType, PlayerStatus}; pub struct InitTraits { reader: Option<OnPlayerJoinReader>, } #[derive(SystemData)] pub struct InitTraitsData<'a> { pub c...
mod config; mod error; mod forwarded_header; mod handler; mod logging; mod tls_utils; use std::sync::Arc; use std::time::Duration; use actix_web::client::{ClientBuilder, Connector}; use actix_web::{web, App, HttpServer}; use clap::Parser; use log::trace; use rustls::{ Certificate, ClientConfig, NoClientAuth, Root...
use std::sync::Arc; use lambda_http::http; use tracing::info; use tracing::instrument; use htsget_http::get_service_info_json as get_base_service_info_json; use htsget_http::Endpoint; use htsget_search::htsget::HtsGet; use crate::handlers::FormatJson; use crate::ServiceInfo; use crate::{Body, Response}; /// Service...
#[doc = "Reader of register CFG2"] pub type R = crate::R<u32, super::CFG2>; #[doc = "Writer for register CFG2"] pub type W = crate::W<u32, super::CFG2>; #[doc = "Register CFG2 `reset()`'s with value 0"] impl crate::ResetValue for super::CFG2 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
//! Module containing functions executed by the thread in charge of parsing sniffed packets and //! inserting them in the shared map. use std::sync::{Arc, Mutex}; use std::thread; use etherparse::PacketHeaders; use pcap::{Active, Capture}; use crate::countries::country_utils::COUNTRY_MMDB; use crate::networking::man...
#![feature(custom_inner_attributes)] #[macro_use] extern crate compact_macros; pub mod actor; // #[macro_use] // extern crate serde_derive; // use serde; // use serde::{Deserialize, Serialize};
use crate::object::TaggedValue; use crate::runtime::Symbol; use crate::Object; use crate::SchemeExpression; use std::sync::atomic::{AtomicUsize, Ordering}; #[derive(Clone)] pub enum Expression { Nil, Integer(i64), Float(f64), Variable(Symbol), Lambda(Vec<Symbol>, Box<Expression>), Primitive, ...
use super::super::prelude::{ HMENU }; pub type Menu = HMENU;
use std::rc::Rc; use hyper; use super::configuration::Configuration; pub struct APIClient { capabilities_api: Box<dyn crate::apis::CapabilitiesApi>, data_api: Box<dyn crate::apis::DataApi>, } impl APIClient { pub fn new<C: hyper::client::Connect>(configuration: Configuration<C>) -> APIClient { le...
use canvas; use gfx; use gfx::format::{ U8Norm, Srgba8, Swizzle, Format, ChannelType, DepthStencil, Rgba8, Srgb, R8_G8_B8_A8, SurfaceType, Uint, }; use gfx::buffer::{ Role, CreationError, }; use gfx::memory::Usage; use gfx::{ Resources, Factory, Bind, ...
//! `rusx` is an ergonomic syntax for creating a parent-child tree of nodes, inspired by JSX. //! //! ```rust //! use rusx::prelude::*; //! //! #[derive(Default)] //! struct Foo { //! bar: u32, //! orb: bool //! } //! //! let tree = rusx! { //! <Foo bar=10, orb=true { //! <orb=false, bar=230>, //! <bar=100> //! ...
use crate::homebrew::{HomebrewClient, HomebrewFormula, HomebrewGraph}; use anyhow::Result; use std::collections::HashSet; use tui::widgets::ListState; pub struct State<'a> { pub selected_formula: ListState, pub formulae: Vec<&'a HomebrewFormula>, pub graph: &'a HomebrewGraph, pub all_formulae: &'a [Hom...
use super::{CLINTDriver, GPIODriver}; use register::{mmio::*, register_bitfields, register_structs}; use crate::arch::riscv32; use core::fmt::Write; register_bitfields! { u32, TXDATA [ DATA OFFSET(0) NUMBITS(8) [], FULL OFFSET(31) NUMBITS(1) [ EMPTY = 0, FULL = 1 ...
use std::iter::Iterator; pub type Offset = (u64, u64); #[derive(Debug)] pub struct OffsetMap { inner: vec_collections::VecMap<[Offset; 4]>, } impl OffsetMap { fn new() -> Self { Self { inner: vec_collections::VecMap::default(), } } pub fn insert(&mut self, key: u64, value...
table! { use diesel::sql_types::*; /// Representation of the `passwords` table. /// /// (Automatically generated by Diesel.) passwords (id) { /// The `id` column of the `passwords` table. /// /// Its SQL type is `Unsigned<Integer>`. /// /// (Automatically gen...
fn increment(input: &String) -> String { let mut result: String = String::new(); let mut carry: u8 = 0; let mut inc: u8 = 1; for c in input.chars().rev() { if c == 'z' && (inc == 1 || carry == 1){ result.push('a'); carry = 1; } else { ...
/// Tuple-Like Structs pub struct Bounds(pub usize, pub usize); #[derive(Debug)] struct PrivateBounds(usize, usize); impl PrivateBounds { pub fn new(x: usize, y: usize) -> PrivateBounds { PrivateBounds(x, y) } } pub fn usage_private_bounds(x: usize, y: usize) -> usize { let pbound = PrivateBounds...
use super::audio::*; use super::audit::*; use super::creative_attribute::*; use super::display::*; use super::media_rating::*; use super::video::*; use crate::openrtb3::bool::*; use crate::openrtb3::language::*; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug, PartialEq)] pub struct MediaAd...
use crate::clients::QueueClient; use crate::responses::*; use azure_core::headers::{add_mandatory_header, add_optional_header}; use azure_core::prelude::*; use std::convert::TryInto; #[derive(Debug, Clone)] pub struct SetQueueMetadataBuilder<'a> { queue_client: &'a QueueClient, timeout: Option<Timeout>, cl...
// file: types.rs // // Copyright 2015-2017 The RsGenetic 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 require...
// io => input/output use std::io; // compare somtething use std::cmp::Ordering; // Random numbers use rand::Rng; fn main() { println!("Guess the number!"); let secret_number = rand::thread_rng().gen_range(1, 101); println!("The secret number is: {}", secret_number); loop { println!("Please ...
use crate::error::*; use jsonwebtoken::Algorithm; use serde::{ de::{self, Deserializer, Visitor}, ser::Serializer, Deserialize, Serialize, }; use std::{ env, fmt, fs::{self, File}, io::{self, Read}, net::SocketAddr, ops::Deref, path::PathBuf, time::Duration, }; #[derive(Debug, D...
#[doc = "Register `DCR1` reader"] pub type R = crate::R<DCR1_SPEC>; #[doc = "Register `DCR1` writer"] pub type W = crate::W<DCR1_SPEC>; #[doc = "Field `CKMODE` reader - Mode 0/Mode 3 This bit indicates the level taken by the CLK between commands (when NCS = 1)."] pub type CKMODE_R = crate::BitReader; #[doc = "Field `CK...
// 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. mod traits; pub use traits::{FieldElement, StarkField}; pub mod f128; pub mod f62; mod extensions; pub use extensions::QuadExtensionA;
use anyhow::{Error, Result}; use uuid::Uuid; use crate::config::Config; use super::Client; use super::{FetchChatMessagesResponse, MeResponse}; pub struct Api { client: Client, } impl Api { pub async fn new(config: &Config) -> Result<Self> { let mut client = Client::new(config.server_address.as_str()...
extern crate graphml2mm; #[macro_use] extern crate structopt; use graphml2mm::*; use structopt::*; use std::*; use std::path::*; use std::fs::*; #[derive(StructOpt, Debug)] #[structopt(name = "grahml2mm")] struct Opt { /// input file #[structopt(name = "IN", parse(from_os_str))] graphml_path: PathBuf, ...
#![allow(dead_code)] pub fn reverse(input: &str) -> String { input.chars().rev().collect() } pub fn strings_test() { let s: &'static str = "This is a test string"; println!("{}", s); let s1: &'static str = "Lorem Ipsum is simply dummy text of the printing and typesetting industry."; let mut s1_...
//! # Embedded graphics //! //! This crate aims to make drawing 2D graphics primitives super easy. It currently supports the //! following: //! //! * [1 bit-per-pixel images](./image/type.Image1BPP.html) //! * [8 bits-per-pixel images](./image/type.Image8BPP.html) //! * [16 bits-per-pixel images](./image/type.Image16BP...
#[doc = "Reader of register CRCPOLY"] pub type R = crate::R<u32, super::CRCPOLY>; #[doc = "Writer for register CRCPOLY"] pub type W = crate::W<u32, super::CRCPOLY>; #[doc = "Register CRCPOLY `reset()`'s with value 0x07"] impl crate::ResetValue for super::CRCPOLY { type Type = u32; #[inline(always)] fn reset...
// Make sure that fn-to-block coercion isn't incorrectly lifted over // other tycons. fn main() { fn f(f: native fn(native fn(native fn()))) { } fn g(f: native fn(fn())) { } f(g); //!^ ERROR mismatched types: expected `native fn(native fn(native fn()))` }
pub mod bounded; pub mod unordered; pub use self::bounded::{queue, Sender, Receiver, SendError, RecvError}; #[cfg(test)] mod tests;
#![feature(proc_macro_hygiene, decl_macro)] extern crate chrono; #[macro_use] extern crate serde_derive; #[macro_use] extern crate rocket; extern crate rocket_contrib; use chrono::prelude::*; use rocket::response::content::Html; use rocket_contrib::json::Json; #[derive(Serialize)] struct Timestamp { t: String, }...
use std::mem; type Array4 = [i32; 4]; type OArray4 = [Option<i32>; 4]; fn main() { println!("size of i32 = {}", mem::size_of::<i32>()); println!("size of i32 = {}", mem::size_of::<Option<i32>>()); println!("size of [i64: 4] = {}", mem::size_of::<Array4>()); println!("size of [Option<i64>: 4] = {}", m...
use crate::grid::dir::Dir; use crate::grid::grid::Grid; use crate::grid::tile::Tile; use crate::CELL_SIZE; use quicksilver::geom::Vector; pub fn sub_save(first: f32, second: f32) -> f32 { if first <= second { 0. } else { first - second } } #[derive(Clone)] pub struct Moveable { pub loca...
// Copyright 2018 Vlad Yermakov // // 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 observable_btree::{model::Types, BTree}; #[tokio::main] async fn main() { let btree = BTree::start(1000); let ins = btree.insert("hello".to_string(), 546).await; assert!(ins.unwrap().is_none()); let ins = btree.insert("wow".to_string(), 5).await; assert!(ins.unwrap().is_none()); let ins ...
// SPDX-FileCopyrightText: 2020-2021 HH Partners // // SPDX-License-Identifier: MIT use serde::{Deserialize, Serialize}; /// Possible algorithms to be used for SPDX's /// [package checksum](https://spdx.github.io/spdx-spec/3-package-information/#310-package-checksum) /// and [file checksum](https://spdx.github.io/spd...
#![feature(advanced_slice_patterns, slice_patterns, box_patterns)] extern crate simplerepl; use std::path::Path; use std::fs::File; use std::io::Read; use simplerepl::{REPL, ReplState}; use tokenizer::tokenize; mod tokenizer; use parser::{parse}; mod parser; use eval::{Evaluator}; mod eval; use compilation::{com...
use core::convert::TryInto; use core::fmt::Debug; use core::fmt::Display; use core::fmt::Formatter; use core::hash::Hash; use core::hash::Hasher; use core::marker::PhantomData; use ed25519_dalek::{PUBLIC_KEY_LENGTH, SECRET_KEY_LENGTH, SIGNATURE_LENGTH}; use getrandom::getrandom; use libhash::Hash as LibHash; use libsig...
mod worker; pub use self::worker::init_worker;
//#![rustc_const_unstable] // https://github.com/rust-lang/rust/issues/49146 pub struct PMCControl<PMC> { pub rf: Option<PMC>, } pub trait PMCConfigure<DEVICES> { fn set_hw_device(&mut self, devs: DEVICES); } pub trait PMCRead { fn get_master_clk(&self) -> u32; fn get_main_clock_frequency_hz(&self) ...
use std::{ collections::{BTreeSet, BTreeMap}, mem, fmt, }; use varisat::{Var, Lit, ExtendFormula, solver::SolverError}; use crate::{ ContextHandle, Contextual, DotId, AtomId, ForkId, JoinId, Wedge, AcesError, AcesErrorKind, atom::Atom, sat::{CEVar, CELit, Encoding, Search, Clause, Formula}, }; #[de...
//! Code for writing extracted information specific to books. use serde::Serialize; use crate::arrow::*; use crate::cleaning::isbns::{parse_isbn_string, ParseResult}; use crate::cleaning::names::clean_name; use crate::marc::flat_fields::FieldOutput; use crate::marc::MARCRecord; use crate::prelude::*; /// Structure re...
use crate::css::Color; use crate::layout::{LayoutBox, Rect}; use crate::paint::{build_display_list, DisplayCommand}; use std::iter::repeat; #[derive(Debug)] pub struct Canvas { pub pixels: Vec<Color>, pub width: usize, pub height: usize, } impl Canvas { fn new(width: usize, height: usize) -> Canvas { ...
extern crate i2cdev; extern crate webthing; #[macro_use] extern crate serde_json; use std::thread; use std::time::Duration; use i2cdev::core::*; use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError}; use std::sync::{Arc, RwLock, Weak}; use webthing::{BaseProperty, BaseThing, Thing, Action, WebThingServer}; use webthi...
use std::collections::VecDeque; use crate::ast::expressions; const DEBUG: bool = false; #[derive(Debug)] pub enum Element { Single(Box<dyn expressions::Expression>), Repetition(VecDeque<Box<dyn expressions::Expression>>), Optional(Option<Box<dyn expressions::Expression>>), } #[derive(Debug, Default)] pu...
// // Copyright 2021 The Project Oak Authors // // 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 o...
extern crate notify; use self::notify::Event; use self::notify::op; use std::fs::metadata; use std::path::PathBuf; use watcher::FileOp; pub enum Error { IgnoredPath, IgnoredOperator, NotAFile, Unknown, } fn validate_path(path: PathBuf) -> Result<PathBuf, Error> { match metadata(&path) { Ok(m) => if ...
//! In VST terminology, the editor is a graphical window that can be used to display and interact //! with a plugin using a custom visual appearance. //! //! The editor interface runs fully on the UI thread. It manages an OS window through a //! cross-platform API exposed by the `vst_window` crate. It displays the stat...
#[macro_use] extern crate log; extern crate xml; extern crate time; extern crate crypto; extern crate reqwest; extern crate url; pub mod speedtest; pub mod distance; pub mod error; pub use self::error::{Result, Error};
use crate::*; use riddle_math::{Rect, SpacialNumericConversion, Vector2}; const ERR_UNABLE_TO_FIT_IMAGES: &str = "Unable to fit all images in to packed image"; const ERR_NO_SOURCE_IMAGES: &str = "No source images supplied"; /// Utility for packing multiple images to a single image. /// /// # Example /// /// ``` /// ...
extern crate cgmath; extern crate noise; extern crate rand; use std::error::Error; use draw::icosphere::icosphere; use draw::util::Interpolator; use glium::*; use glium::backend::Facade; use glium::index::{PrimitiveType, NoIndices}; use self::cgmath::conv::*; use self::cgmath::{Matrix4, Vector3, InnerSpace}; use se...
#![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 FirewallRuleProperties { #[serde(rename = "startIpAddress", default, skip_serializing_if = "Option::is_none")] ...
// Copyright 2017 Google Inc. // // 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 std::collections::hash_map::Keys; use std::collections::HashMap; /// The resulting environment Direnv after running Direnv. Note: /// Direnv returns `{ "varname": null, "varname": "something" }` /// so the value type is `Option<String>`. This makes `.get()` /// operations clunky, so be prepared to check for `Some(...
#[doc = "Reader of register OA1_SW"] pub type R = crate::R<u32, super::OA1_SW>; #[doc = "Writer for register OA1_SW"] pub type W = crate::W<u32, super::OA1_SW>; #[doc = "Register OA1_SW `reset()`'s with value 0"] impl crate::ResetValue for super::OA1_SW { type Type = u32; #[inline(always)] fn reset_value() ...
use std::error::Error; use skulpin::*; use winit::dpi::LogicalSize; use winit::event::{Event, WindowEvent}; use winit::event_loop::{ControlFlow, EventLoop}; #[cfg(target_family = "unix")] use winit::platform::unix::*; use winit::window::WindowBuilder; mod app; mod assets; mod net; mod paint_canvas; mod ui; mod util; ...
mod vga_buffer; #[allow(dead_code)] #[derive(Debug,Clone,Copy,PartialEq,Eq)] #[repr(u8)] pub enum Color { Black = 0, Blue = 1, Green = 2, Cyan = 3, Red = 4, Magenta = 5, Brown = 6, LightGray = 7, DarkGray = 8, LightBlue = 9, LightGreen = 10, LightCyan = 11, LightRed =...
#[doc = "Register `MPCBB2_VCTR29` reader"] pub type R = crate::R<MPCBB2_VCTR29_SPEC>; #[doc = "Register `MPCBB2_VCTR29` writer"] pub type W = crate::W<MPCBB2_VCTR29_SPEC>; #[doc = "Field `B928` reader - B928"] pub type B928_R = crate::BitReader; #[doc = "Field `B928` writer - B928"] pub type B928_W<'a, REG, const O: u8...
use crate::error::PacError; use crate::Result; use ez_io::{ReadE, WriteE}; use std::io::{Read, Seek, Write}; #[derive(Clone)] pub struct PacCompressedPacking { pub data: PacData, pub info: Vec<PacInfo>, } #[derive(Clone)] pub struct PacData { pub magic_number: [u8; 4], /// Number of PacInfo sections ...
struct Entry<'a> { position1: u32, position2: u32, letter: char, pass: &'a str, } pub fn a(input: String) -> String { let res = input .lines() .map(|l| l.split_whitespace()) .map(|mut i| { let mut split = i.next().unwrap().split('-'); Entry { ...
use async_graphql::{InputObject, SimpleObject}; use sqlx::types::Uuid; use crate::common::SideType; use crate::database; #[derive(SimpleObject)] pub struct Team { pub id: Uuid, pub name: String, pub country: Option<String>, pub logo: Option<String>, pub players: Vec<Player>, } #[derive(SimpleObje...
use super::prelude::*; pub(crate) fn config(cfg: &mut web::ServiceConfig) { cfg.service(show_one_day_tasks_state); } #[get("/api/tasks_state/one_day")] async fn show_one_day_tasks_state(pool: ShareData<db::ConnectionPool>) -> HttpResponse { use db::schema::task_log; use state::task_log::State; if let...
// The total number of grains on tile s is // // Tile (s): 1 2 3 4 5 6 ... s // Grains : 1 2 4 8 16 32 ... 2^(s - 1) // pub fn square(s: u32) -> u64 { if s < 1 || s > 64 { panic!("Square must be between 1 and 64") } 2u64.pow(s - 1) } // The total number of grain...
/* * Copyright (c) Microsoft Corporation. All rights reserved. * Licensed under the MIT license. */ mod index_logger; pub use index_logger::IndexLogger; mod disk_index_build_logger; pub use disk_index_build_logger::DiskIndexBuildLogger;
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use super::{models, API_VERSION}; #[non_exhaustive] #[derive(Debug, thiserror :: Error)] #[allow(non_camel_case_types)] pub enum Error { #[error(transparent)] Operations_List(#[from] operations::l...
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 hydroflow::hydroflow_syntax; pub fn main() { let mut df = hydroflow_syntax! { source_iter(["Hello World"]) -> assert_eq(["Hello World"]); }; df.run_available(); } #[test] fn test() { main(); }
use std::error::Error; use crate::modules::intcode; pub fn run_part1(input: &str, noun: i32, verb: i32) -> Result<String, Box<dyn Error>> { let mut machine = intcode::build_intcode_from_input(input)?; machine.set_noun(noun); machine.set_verb(verb); machine.run(); Ok(format!("Intcode ...
use crate::problem_datatypes::Solution; use crate::problem_datatypes::DataPoints; use crate::problem_datatypes::Constraints; use crate::fitness_evolution::FitnessEvolution; use crate::arg_parser::ProgramParameters; use crate::utils; use crate::arg_parser::SearchType; use crate::algorithms::local_search; use rand::rngs...
use std::fs; use std::collections::HashMap; use std::io::Write; use std::path::PathBuf; use std::str; use rust_htslib::bam; use rust_htslib::bam::Read; use assign::*; use barcode_group::*; use depth::*; use purity::*; #[derive(Debug)] pub struct Config { pub bowtie_bam: PathBuf, pub align_start: usize, ...
//! Message and relevant types. use super::channel; use super::timetoken::Timetoken; use json::JsonValue; /// # PubNub Message /// /// This is the message structure yielded by [`Subscription`]. /// /// [`Subscription`]: crate::Subscription #[derive(Debug, Clone, PartialEq)] pub struct Message { /// Enum Type of M...
extern crate libc; extern crate rctl; fn main() { println!("RCTL is {}", rctl::State::check()); let uid = unsafe { libc::getuid() }; let subject = rctl::Subject::user_id(uid); let usage = subject.usage().expect("Could not get RCTL usage"); println!("{:#?}", usage); }
use std::process::Command; use block::Block; use util::Align; #[derive(Default)] pub struct Date { pub icon: Option<(String, Align)>, pub format: String, } impl Date { pub fn new(format: &str) -> Date { Date { icon: None, format: String::from(format), } } ...
//! HID-to-UART driver for CP2110/CP2114 chipset. //! //! See more information [here][1]. //! [1]: https://www.silabs.com/products/interface/usb-bridges/classic-usb-bridges/device.cp2110-f01-gm extern crate hid; #[macro_use] extern crate error_chain; use std::cmp::min; use std::default::Default; use std::time::{Durat...
use bincode::rustc_serialize::{encode_into, decode}; use bincode::SizeLimit; use byteorder::{ByteOrder, BigEndian}; const MESSAGE_TO_SERVER_LIMIT: u64 = 16*1024; const MESSAGE_TO_CLIENT_LIMIT: u64 = 64*1024; #[derive(RustcEncodable, RustcDecodable)] pub enum ClientToServerTCPPacket{ ClientError( String ), Cli...
use crate::RenderContext; pub trait Renderable: Sync + Send { fn render<'a>(&'a self, render_context: &mut RenderContext<'a>); }
#![feature(plugin)] #![plugin(rocket_codegen)] use std::env; use std::env::vars_os; use std::iter; extern crate rocket; use rocket::Request; extern crate postgres; use postgres::{Connection, TlsMode}; #[get("/")] fn index() -> &'static str { "Hello, world!" } #[get("/world")] fn world() -> &'static str { ...
use actix_web::{web, HttpResponse, Responder}; use crate::{authentication, errors::MetaphraseError}; #[derive(Deserialize)] pub struct CreateUserFormData { email: String, password: String, } pub async fn create( form: web::Json<CreateUserFormData>, ) -> Result<impl Responder, MetaphraseError> { let i...
fn main() { //let number = 13;// -> A teen //let number = 20;// -> Ain't special //let number = 1;// -> One! //let number = 5;// -> This is a prime let number = 4;// -> Ain't special println!("Tell me about {}", number); match number { 1 => println!("One!"), 2 | 3 | 5 | 7 | ...
pub mod params; pub mod rescue; pub use self::rescue::*;
mod modA { mod modB { mod modC { mod modD { mod modE { fn func() { state . rule (Rule :: myrule , | state | { state . sequence (| state | { state . sequence (| state | { state . match_string ("abc") . and_then (| state | { super :: hidd...
mod cell; mod context; mod excel; mod excel_writer; mod row; mod shared_strings; mod sheet; mod workbook; pub use { cell::{Cell, ColIndex, Number}, context::Context, excel::Excel, row::{Row, RowIndex}, sheet::{MergeCell, Sheet, SheetIndex}, workbook::Workbook, };
use super::{u256mod, ModulusTrait}; // Division impl<M: ModulusTrait> std::ops::Div for &u256mod<M> { type Output = u256mod<M>; fn div(self, other: &u256mod<M>) -> u256mod<M> { return self * other.mul_inverse(); } } // Versions with different reference combinations impl<M: ModulusTrait> std::ops:...
#[macro_use] extern crate serde_derive; extern crate serde_json; #[macro_use] extern crate tantivy; extern crate tempdir; mod data; mod searching; use searching::Searcher; fn main() { let searcher = Searcher::default(); println!("Searcher is ready!"); for docs in searcher.search("Hello", 10) { p...
extern crate curl; extern crate exonum; extern crate exonum_configuration; extern crate exonum_rocksdb; extern crate serde; extern crate serde_derive; extern crate clap; extern crate serde_json; extern crate dmbc; mod flag; mod keyfile; use dmbc::config; use dmbc::currency::Service; use exonum::blockchain; use exonu...
pub use bson; use bson::spec::ElementType::ObjectId; pub use super::User; pub use serde_json; // trait User { // fn to_json(&self) -> String; // } impl User { pub fn all() -> String { let person = User { id: "12345".to_string(), username: "Emma".to_string(), passwo...
use std::str; use xmlwriter::{XmlWriter, Options}; #[derive(Clone, Copy, PartialEq)] struct TStr<'a>(pub &'a str); macro_rules! text_eq { ($result:expr, $expected:expr) => { assert_eq!($result, $expected) }; } #[test] fn write_element_01() { let mut w = XmlWriter::new(Options::default()); w.start_elemen...
use serde::Deserialize; use warp::{filters::BoxedFilter, Filter, Rejection}; use crate::response::{Response, ResponseBuilder}; use crate::PgPooled; use crate::{helpers, models, views}; pub fn router(pg: BoxedFilter<(crate::PgPooled,)>) -> BoxedFilter<(Response,)> { //impl Filter<Extract = (Response,), Error = Rej...
// program API, (de)serializing instruction data // defines the "API" of a program // despite having only one entrypoint, execution can flow different // depending on data decoded in instruction.rs use std::convert::TryInto; use solana_program::program_error::ProgramError; use crate::error::EscrowError::InvalidIn...
pub mod fix; pub mod source; pub struct Text { pub text: String, pub source: String, } impl Text { pub fn new(text: String, source: String) -> Self { Text { text: text.trim().to_string(), source: source.trim().to_string(), } } } impl std::fmt::Display for Text ...
#[doc = "Reader of register CMD"] pub type R = crate::R<u32, super::CMD>; #[doc = "Writer for register CMD"] pub type W = crate::W<u32, super::CMD>; #[doc = "Register CMD `reset()`'s with value 0"] impl crate::ResetValue for super::CMD { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
use core::num::NonZeroU32; use serde::{Deserialize, Serialize}; #[derive(Eq, PartialEq, PartialOrd, Ord, Clone, Hash, Debug, Serialize, Deserialize)] #[cfg_attr(feature = "cuda", derive(rust_cuda::rustacuda_core::DeviceCopy))] #[cfg_attr(feature = "cuda", rustacuda(core = "rust_cuda::rustacuda_core"))] #[cfg_attr(fea...
#[doc = "Reader of register ADDCTL"] pub type R = crate::R<u32, super::ADDCTL>; #[doc = "Writer for register ADDCTL"] pub type W = crate::W<u32, super::ADDCTL>; #[doc = "Register ADDCTL `reset()`'s with value 0x8000_0000"] impl crate::ResetValue for super::ADDCTL { type Type = u32; #[inline(always)] fn rese...
#[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - UART Data Register"] pub dr: DR, #[doc = "0x04 - UART Status Register"] pub rsr: RSR, _reserved0: [u8; 16usize], #[doc = "0x18 - Flag Register"] pub fr: FR, _reserved1: [u8; 4usize], #[doc = "0x20 - IrD...