text
stringlengths
8
4.13M
use super::*; /// One special entity in a text message, for example: hashtags, usernames, /// URLs, etc. #[derive(Debug,Deserialize)] pub struct MessageEntity { /// Type of the entity, can be *mention*, *hashtag*, *bot_command*, /// *url*, *email*, *bold*, *italic*, *code*, *pre*, *text_link* or /// *text_...
#![feature(async_await)] use { romio::tcp :: { TcpListener, TcpStream } , futures :: { prelude::* } , async_runtime :: { rt, RtConfig } , futures_codec :: { Framed, LinesCodec } , }; // This test caught a bug in FramedWrite2::poll_flush. The written out bytes did not get remove...
use aide::openapi::v3::macros::api; /// A generic error. #[api] pub struct GenericError { pub message: String, } impl Default for GenericError { fn default() -> Self { Self { message: "an unexpected error happened".to_string() } } }
pub mod opencl;
fn main(){ let y = true; let x = if y {"y"} else {"n"}; println!("{}", x); }
use std::num; use std::iter::Range; #[macro_export] macro_rules! use_test( ($name:ident, $test:expr) => ( #[test] fn $name () { $test; } ); ) pub trait Countable { fn biject(number: uint) -> Self; } impl Countable for uint { fn biject (number: uint) -> uint ...
use abin::{Bin, BinFactory, NewBin, NewSBin, SBin}; use std::collections::HashMap; /// binary is compatible with hash map. #[test] fn use_bin_slice_in_hash_map() { let mut map = HashMap::<Bin, String>::default(); map.insert(NewBin::from_static(&[]), "empty".to_owned()); map.insert(NewBin::from_static(&[4]...
extern crate markov; use markov::gen; #[test] fn test_gen() { let input = "Welcome to the jungle we've got fun and games We got everything you want honey, we know the names We are the people that can find whatever you may need If you got the money, honey we got your disease."; let res = gen(input, "welc...
use std::char; fn main() { const PI: f64 = 3.14; let radius: i32 = 10; let cir = 2 as f64 * PI * radius as f64; println!("cir = {}", cir); let x: i32 = 25; let x_string: String = x.to_string(); println!("x_string = {}", x_string); let x_str: &str = &x.to_string(); println!("x_str...
use std::cmp::Ord; use std::cmp::Ordering; #[derive(Eq)] pub struct TokenMatch<'a> { pub literal: String, pub begin_segmet: usize, pub end_segment: usize, pub rule: &'a TokenRules<'a>, } #[derive(PartialEq, Eq, Debug)] pub enum TokenError { EmptyLineOfCode, MatchingError, NoMatch, } #[der...
mod header; use self::header::Header; use gtk; use gtk::*; use std::process; const CSS: &str = include_str!("styles/app.css"); use crate::db; pub struct App { pub window: Window, pub header: Header, } impl App { pub fn new(conn: db::DataConect) -> App { if gtk::init().is_err() { ...
use hlist::*; use hlist::{ self, }; use ty::{ _0, Ap, Ap1, Cmp1, Eval, Eval1, Infer, MkStore, infer, nat, }; /// Type-level zippers for lists #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub enum Zipper {} /// Zipper constructor #[derive(Clone, Copy, ...
use super::{Pages, Pagination}; use crate::{embeds::MostPlayedEmbed, BotResult}; use rosu_v2::prelude::{MostPlayedMap, User}; use twilight_model::channel::Message; pub struct MostPlayedPagination { msg: Message, pages: Pages, user: Box<User>, maps: Vec<MostPlayedMap>, } impl MostPlayedPagination { ...
extern crate rpcre; #[test] fn simple() { run_match("d1", vec![ "d12", "d18", "1d12" ], vec![ "d212", "d8" ]); run_match("^d1", vec![ "d12", "d18" ], vec![ "1d12", "d2fd18" ]); } fn run_match(pattern: &'static str, positive_values: Vec<&'static str>, negative_values: Vec<&'static str>) { for val in positi...
mod core; use crate::core::run; fn main() { pollster::block_on(run()); }
/* Bit definition for RCC_AHB1ENR register */ macro_rules! RCC_AHB1ENR_GPIOAEN {() => (0x00000001u32 as uint32_t);} macro_rules! RCC_AHB1ENR_GPIOBEN {() => (0x00000002u32 as uint32_t);} macro_rules! RCC_AHB1ENR_GPIOCEN {() => (0x00000004u32 as uint32_t);} macro_rules! RCC_AHB1ENR_GPIODEN {...
#[doc = "Reader of register HSEM_HWCFGR1"] pub type R = crate::R<u32, super::HSEM_HWCFGR1>; #[doc = "Reader of field `NBINT`"] pub type NBINT_R = crate::R<u8, u8>; #[doc = "Reader of field `NBSEM`"] pub type NBSEM_R = crate::R<u8, u8>; impl R { #[doc = "Bits 8:11 - NBINT"] #[inline(always)] pub fn nbint(&se...
#![allow(clippy::redundant_closure_call)] pub mod err; use std::iter::Peekable; use crate::{ prelude::{Span, P}, Token, }; use self::err::*; use crate::ast::*; pub struct Parser<L> { pub lexer: L, } macro_rules! expect { ($self:expr, $($pat:pat)|+) => { $self .next_if(|token| ma...
pub mod noise; pub mod kyber; //pub mod classicmceliece; pub mod sikes;
#[derive(Debug)] pub struct Position { pub line: u64, pub character: u64, } /** * The end position is exclusive. */ pub struct Range { start: Position, end: Position, } pub struct Location { uri: String, range: Range, } pub struct Diagnostic { range: Range, severity: Option<Diagnost...
use std::os::raw::c_uint; use crate::appkit::NSEvent; use crate::appkit::NSEventSubtype; use crate::base::id; use crate::tap::Flags; use crate::tap::Key; #[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Event { pub flags: Flags, pub key: Key, pub pressed: bool, pub repeat: bool, } imp...
/// Module for representing data. pub mod variable; pub mod decoder; //pub use self::tree::DataStructure; mod output; use ::std::ops::Deref; use ::indextree::Arena; //pub struct Program(Arena<Box<Data>>); pub type Program = Arena<Box<prelude::Data>>; pub mod prelude { pub use super::output::Represent; /// C...
#[doc = "Reader of register IC_CLR_TX_ABRT"] pub type R = crate::R<u32, super::IC_CLR_TX_ABRT>; #[doc = "Reader of field `CLR_TX_ABRT`"] pub type CLR_TX_ABRT_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - Read this register to clear the TX_ABRT interrupt (bit 6) of the IC_RAW_INTR_STAT register, and the IC_TX_...
#[doc = "Register `EXTICR3` reader"] pub type R = crate::R<EXTICR3_SPEC>; #[doc = "Register `EXTICR3` writer"] pub type W = crate::W<EXTICR3_SPEC>; #[doc = "Field `EXTI8` reader - EXTI 8 configuration bits"] pub type EXTI8_R = crate::FieldReader<EXTI8_A>; #[doc = "EXTI 8 configuration bits\n\nValue on reset: 0"] #[deri...
use tonic::{transport::Server, Request, Response, Status}; use plugin_registry::registry::plugin::plugin_server::{Plugin, PluginServer}; use plugin_registry::registry::plugin::{Function, ListFunctionResponse, ExecuteRequest, ExecuteResponse, Empty}; #[cfg(unix)] use tokio::net::UnixListener; use std::path::Path; use f...
use super::*; /// DecInt ::= '[0-9]' /// DecInt_ ::= '[0-9_]' /// BinInt ::= '[0-1]' /// BinInt_ ::= '[0-1_]' /// HexInt ::= '[0-9a-fA-F]' /// HexInt_ ::= '[0-9a-fA-F_]' /// DecInt ::= DecDigit DecDigit_* /// BinInt ::= BinDigit BinDigit_* /// HexInt ::= HexDigit HexDigit_* /// Float ::= DecInt "." DecInt /// SimpleC...
use bevy::prelude::*; #[derive(Debug)] pub enum MapEvents { LoadMap(String), } #[derive(Default)] pub struct MapEventsListener { pub reader: EventReader<MapEvents>, }
pub mod p1; pub mod p2; pub mod p3; pub mod p4; pub mod p5; pub mod p6; pub mod p7; pub struct Solution {}
/// An enum to represent all characters in the Ugaritic block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Ugaritic { /// \u{10380}: '𐎀' LetterAlpa, /// \u{10381}: '𐎁' LetterBeta, /// \u{10382}: '𐎂' LetterGamla, /// \u{10383}: '𐎃' LetterKha, /// \u{10384}: '𐎄' ...
//! Rust port of Peter Shirley's *Ray Tracing in One Weekend*. #![warn(missing_docs, rust_2018_idioms, unsafe_code)] #![allow(clippy::suspicious_arithmetic_impl, clippy::suspicious_op_assign_impl)] pub mod aabb; pub mod aarect; pub mod bvh; pub mod camera; pub mod conversion; pub mod hittable; pub mod material; pub mo...
use futures::future::BoxFuture; use http::header::{CONTENT_LENGTH, CONTENT_TYPE}; use hyper::Response as HyperResponse; use std::{ io, path::{Path, PathBuf}, sync::Arc, }; use tokio::fs::File; use trek_core::{Body, Context, Handler, IntoResponse, Response, Result}; mod template; mod utils; use utils::*; ...
#[doc = "Reader of register INTR_HOST_EP_CAUSE_LO"] pub type R = crate::R<u32, super::INTR_HOST_EP_CAUSE_LO>; #[doc = "Reader of field `EP1DRQ_INT`"] pub type EP1DRQ_INT_R = crate::R<bool, bool>; #[doc = "Reader of field `EP1SPK_INT`"] pub type EP1SPK_INT_R = crate::R<bool, bool>; #[doc = "Reader of field `EP2DRQ_INT`"...
use crate::component::Component; use clap::{App, Arg, ArgMatches}; use digitalocean::prelude::*; use failure::Error; use std::{fs::File, io::Read}; pub struct Create; impl Component for Create { const DEFAULT_OUTPUT: Option<&'static str> = Some("debug"); fn app() -> App<'static, 'static> { ...
#![deny(clippy::all)] #[macro_use] extern crate osgood_v8; #[macro_use] extern crate osgood_v8_macros; #[macro_use] extern crate log; #[macro_use] extern crate clap; use futures::sink::Sink; use futures::sync::oneshot; use futures::{future, Future}; use hyper::header::HeaderValue; use hyper::service::service_fn; use...
extern crate piston; extern crate rand; use rand::prelude::*; pub use graphics::*; pub struct Location { pub x: f64, //horizontal axis pub y: f64, //vertical axis } pub struct Invader { pub rotation: f64, //rotation of the object pub position: Location, pub velocity: [f64; 2], //velocity pub ...
use crate::Config; use reqwest::{Client, Error, Method, RequestBuilder}; /// Returns a 'reqwest' request-builder for a given method and path /// And configures security headers according to configuration. pub fn get_request_builder(cfg: &Config, method: Method, path: String) -> RequestBuilder { let client = get_cl...
#[macro_use] extern crate log; use azure_core::prelude::*; use azure_storage::core::prelude::*; use azure_storage_queues::prelude::*; use chrono::{Duration, Utc}; use std::error::Error; #[tokio::main] async fn main() -> Result<(), Box<dyn Error + Send + Sync>> { // First we retrieve the account name and master key...
fn main() { println!("Hello, world!"); } #[test] fn test1(){ for i in (10..=1).rev(){ println!("{}",i); } for i in (1..=10).rev(){ println!("{}",i); } }
// Basic mem impls on STD basis. use interface::*; use errors::*; /// Simple `Vec`-based memory block. /// Should suffice basic RAM needs. pub struct MemVector { size: Addr, mem: Vec<Byte>, } impl MemoryCreator<MemVector> for MemVector { fn new(size: Addr) -> MemVector { // Allocate a vector, fil...
use hyper::server::Request; use std::sync::Mutex; extern crate redis; extern crate byteorder; extern crate hyper; use common::*; use self::byteorder::{BigEndian, WriteBytesExt}; use std::net::IpAddr; extern crate time; use std::error::Error; use std::str::FromStr; enum IPVersion { V4, V6 } enum Event { Un...
use math::Ray; pub use self::sphere::Sphere; mod sphere; pub const INFINITY: f64 = 1.0e10; pub const EPSILON: f64 = 1.0e-4; pub trait Geometry { fn intersect(self, ray: Ray) -> Option<f64>; } pub fn intersect(ray: Ray, spheres: &[Sphere]) -> Option<(f64, usize)> { let mut t_out = INFINITY; let mut id_o...
// Copyright (c) 2016 mussh developers // // 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>, at your // option. All files in the project carrying such notice may not be copied, // ...
//! # Implementations for the [`zerovec`] crate //! //! [`zerovec`]: https://docs.rs/zerovec use crate::{error::ModuloMismatch, generic, Offset}; use zerovec::ule::{AsULE, EqULE, PlainOldULE, ULE}; macro_rules! as_ule { ($ty:ty = $ule:ty) => { unsafe impl EqULE for $ty {} impl AsULE for $ty { ...
use maud::{html, Markup}; use rustimate_service::RequestContext; pub(crate) fn gallery(ctx: &RequestContext) -> Markup { html! { (navbar(ctx)) div.uk-section { div.uk-container { div data-uk-grid? { div.("uk-width-2-3@m") { (breadcrumbs()) article.uk-article { ...
/* * 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...
use { crate::{ encoder::{Encoder, EncoderCommon, RenderPassEncoder, RenderPassEncoderHRTB}, capability::{Supports, Graphics, Transfer, Compute}, }, super::{ CommandBuffer, state::{ExecutableState, RecordingState}, usage::Usage, }, }; impl<B, C, U, P, L, R> Comma...
#![macro_use] use downcast_rs::Downcast; mod empty_element; mod image; pub type EmptyElement = empty_element::EmptyElement; pub type Image = image::Image; use std::fmt; use super::super::ctx::Ctx; use super::CanvasContext; pub trait ElementContent: Downcast + Send + fmt::Debug { fn name(&self) -> &'static str; ...
use super::{Object, TaggedValue}; use crate::error::{ErrorKind, Result}; use crate::SchemeExpression; impl Object { pub fn get_ref(&self, idx: usize) -> Option<&Object> { if idx == 0 { self.car() } else { self.cdr().and_then(|cdr| cdr.get_ref(idx - 1)) } } p...
//! use this crate to embed repository and build metadata at compile time //! //! This project uses procedural macros to provide you with this metadata, //! exposing three macros: //! //! * `head!()`: the name of the current git branch or tag you are in //! * `commit!()`: short git commit id //! * `time!()`: UTC build ...
/** <summary> All defined in MSDN: [Window Functions (Windows)]/[ShowWindow function] Controls how the window is to be shown. This parameter is ignored the first time an application calls **ShowWindow**, if the program that launched the application provides a [!MSDN=STARTUPINFO] s...
use std::path::PathBuf; use clap::Parser; /// Compiler of Open Street Data from osm.pbf format to osm.flatdata format #[derive(Debug, Parser)] #[clap(about, version, author)] pub struct Args { /// Verbose mode (-v, -vv, -vvv, etc.) #[clap(short, long, action = clap::ArgAction::Count)] pub verbose: u8, ...
use std::{ fmt, thread, time::{Duration, Instant}, }; use crate::{ node::{Node, Tickable}, status::Status, }; /// Main behavior tree struct. pub struct BehaviorTree<'a, W> { /// Root node of the behavior tree. root: Node<'a, W>, } impl<'a, W> BehaviorTree<'a, W> { /// Create a new behavior...
pub trait Monoid: SemiGroup { fn zero() -> Self; } pub trait SemiGroup { fn plus(&self, another: &Self) -> Self; } pub enum FreeMonoid<T: SemiGroup> { Zero, Some(T), } impl <T: SemiGroup + Clone> SemiGroup for FreeMonoid<T> { fn plus(&self, another: &Self) -> Self { match (self, another) ...
// this is only used externally by examples // `cargo run` does not use this file pub mod math; pub mod general;
use std::fmt::Debug; use std::iter::Iterator; use std::fmt; use std::str; use collections::BTreeMap; use constants; #[derive(Clone, Copy, Eq, PartialEq)] pub struct Region { base: u64, size: u64 } #[derive(Debug, Clone)] struct AddressSpace { by_base: BTreeMap<u64, Region>, by_end: BTreeMap<u64, Re...
#![allow(dead_code)] use std::sync::mpsc::Receiver; use std::sync::mpsc::Sender; #[derive(PartialEq, Eq, Copy, Clone)] enum Op { Add, Mul, } #[derive(PartialEq, Eq, Copy, Clone)] enum Cnd { True, False, } #[derive(PartialEq, Eq, Copy, Clone)] enum Cmp { LessThan, Equal, } #[derive(PartialEq, Eq...
use super::element::*; pub enum Rule { NounIsNominalRule(NounIsNominalRule), NounsGroupIsNominalsGroupRule(NounsGroupIsNominalsGroupRule), NounOnNounsGroupIsNominalsGroupRule(NounOnNounsGroupIsNominalsGroupRule), NounHasNounsRule(NounHasNounsRule), QualifiedNounIsNominalsGroupRule(QualifiedNounIsNo...
//! # Generic structures //! //! This module contains #[repr(C)] #[derive(Debug, Copy, Clone, PartialEq, Eq)] /// A address+length combination pub struct Array<Addr, Len> { /// The base offset of the array (offset of the first item) pub base: Addr, /// The number of entries in the array pub length: Len,...
///// chapter 4 "structuring data and matching patterns" ///// program section: // fn main() { let rgvec: Vec<u32> = (0..7).collect(); println!("collected the range into: {:?}", rgvec); } ///// output should be: /* */// end of output
static mut DEBUG_COMMAND: Option<Box<dyn Fn(String)>> = None; static mut DEBUG_RESPONSE: Option<Box<dyn Fn(String)>> = None; pub unsafe fn debug_command_via(f: impl Fn(String) + 'static) { DEBUG_COMMAND = Some(Box::new(f)); } pub unsafe fn debug_response_via(f: impl Fn(String) + 'static) { DEBUG_RESPONSE = So...
mod codes; mod error; mod file; mod flags; mod helpers; mod reader; mod signatures; mod tables; pub use codes::*; pub use error::*; pub use reader::*; pub use signatures::*; pub use tables::*;
use std::collections::HashMap; #[derive(Debug, Clone)] pub(crate) enum ResourceKind { Topic, Subscription, } impl ResourceKind { pub(crate) fn from_str(str: &str) -> Self { match str { "aws_sns_topic" => ResourceKind::Topic, "aws_sns_topic_subscription" => ResourceKind::Sub...
use std::iter::FromIterator; use std::sync::Arc; use std::sync::atomic::{AtomicIsize, Ordering}; use Void; use super::{BrokenPromiseError, Future, InnerState}; #[doc(hidden)] pub struct Any<'a, T: 'a, E: 'a = Void> { left: Arc<AtomicIsize>, promise: Arc<InnerState<'a, T, E>>, } impl<'a, T, E> Any<'a, T, E> {...
use crate::optimizer::{Optimizer, Solution, StockPiece}; use std::ptr; #[no_mangle] pub extern "C" fn opt_create(decimal_places: usize) -> *mut Optimizer { Box::into_raw(Box::new(Optimizer::new(decimal_places))) } #[no_mangle] pub unsafe extern "C" fn opt_add_stock_length( opt: *mut Optimizer, stock_lengt...
fn main() { let mut x = 10; let xr = &mut x; *xr += 1; println!("{}", x); }
#![feature(const_fn, nll)] #![recursion_limit="512"] pub mod disasm; pub mod isa;
#[derive(Debug)] enum Action { N(isize), E(isize), S(isize), W(isize), L(usize), R(usize), F(isize), } #[derive(Clone, Copy, Debug)] struct Pos { ns: isize, ew: isize, } impl Pos { fn add(&self, other: Pos) -> Pos { Pos { ns: self.ns + other.ns, e...
#[doc = "Register `AHB3SECSR` reader"] pub type R = crate::R<AHB3SECSR_SPEC>; #[doc = "Field `FSMCSECF` reader - FSMCSECF"] pub type FSMCSECF_R = crate::BitReader; #[doc = "Field `OSPI1SECF` reader - OSPI1SECF"] pub type OSPI1SECF_R = crate::BitReader; impl R { #[doc = "Bit 0 - FSMCSECF"] #[inline(always)] ...
use crossbeam_queue::{ArrayQueue, PushError}; use printer::{print, println}; use spin::{Mutex, MutexGuard, Once}; use crate::task::Task; /// Only 1000 processes are allowed in the ready queue static PROCESS_CAPACITY: usize = 1000; /// Only 100 processes are allowed in the new queue static NEW_CAPACITY: usize = 100; ...
pub fn add_edge(&mut self, n1: i64, n2: i64, e: Edge) { // [..] // link up adjecents let n1_idx = self.nodes_idx.get(&n1).unwrap(); let n2_idx = self.nodes_idx.get(&n2).unwrap(); // [..] }
// =============================================================================== // 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 new_crate::module_a; //use new_crate::module_b; fn main() { }
extern crate bincode; extern crate memmap; use std::path::Path; use std::io::BufReader; #[derive(Serialize, Deserialize, Debug, Clone, Copy)] pub enum PackedSubjectSubtype { Unknown, TV, OVA, Web, Movie, } #[derive(Serialize, Deserialize, Debug, Clone)] pub struct PackedSubject { pub sub...
use sorbet::foundation::NSBundle; use sorbet::ui::Notification; use sorbet::ui::NotificationImage as Image; use sorbet::ui::NotificationSound as Sound; use std::env::var; fn main() { unsafe { NSBundle::swap() } Notification::new() .title("My Notification") .info("Hello, World!") .content_image(Image::...
use crate::config; use crate::neatns::agent::Agent; use rand::Rng; /// Collection of similar agents // The lock is used to add new agents without affecting the reproduction of the previous generation. // It is unlocked after reproduction, which will remove the previous generation and keep the new. pub struct Species {...
use std::collections::HashMap; //use std::fs::OpenOptions; use std::fs::{self, File}; use std::io::prelude::*; use std::io::{self, ErrorKind}; //use std::os::unix::fs::OpenOptionsExt; use std::path::PathBuf; use dirs; use libreauth::oath::TOTPBuilder; use serde_json; pub type IOError = io::Error; fn home_dir() -> io...
type Link<T> = Option<Box<Node<T>>>; /*#[derive(Clone)]*/ struct Node<T> { key: T, left: Link<T>, right: Link<T>, } /*create a mutable Link, since Rust does not support NULL ptr, there is no need for handling NULL parameter*/ impl<T: Ord/* + Clone*/> Node<T> { fn new_link(key: T) -> Link<T> { ...
fn main() { let condition = true; let test1 = if condition{5} else{3}; println!("test1 ist: {}", test1); let iftest = 3; if iftest !=5{ println!("test ist kleiner 5"); } else { println!("test ist größer gleich 5"); } another_function(7.2); println!(...
#[doc = "Reader of register RCC_TZCR"] pub type R = crate::R<u32, super::RCC_TZCR>; #[doc = "Writer for register RCC_TZCR"] pub type W = crate::W<u32, super::RCC_TZCR>; #[doc = "Register RCC_TZCR `reset()`'s with value 0x03"] impl crate::ResetValue for super::RCC_TZCR { type Type = u32; #[inline(always)] fn...
pub mod generation; mod world; mod world_coordinate; pub use self::world::{World, LOAD_DISTANCE}; pub use self::world_coordinate::WorldCoordinate;
pub fn two_sum(nums: Vec<i32>, target: i32) -> Vec<i32> { let mut map = std::collections::HashMap::new(); for (i, num) in nums.iter().enumerate() { let complement = target - *num; if let Some(v) = map.get(&complement) { return vec![*v, i as i32]; } map.insert(*num, i ...
extern crate env_logger; extern crate getopts; extern crate isatty; extern crate pnet; extern crate rayon; extern crate serde_json; extern crate solana; use getopts::Options; use isatty::stdin_isatty; use pnet::datalink; use rayon::prelude::*; use solana::crdt::{Crdt, ReplicatedData}; use solana::mint::MintDemo; use s...
use std::alloc::GlobalAlloc; use stats_alloc::{Region, Stats, StatsAlloc}; pub struct Memory<'a, T: GlobalAlloc + 'a> { alloc: &'a StatsAlloc<T>, } pub fn mem_scoped<'b, TGa, A, TFn, TRet>( alloc: &'b StatsAlloc<TGa>, mem_assert: &A, fun: TFn, ) -> TRet where TGa: GlobalAlloc + 'b, A: MemAsse...
#[repr(C)] #[derive(Copy, Clone)] pub enum Clock { AES = 0x40300, ACMP0 = 152064, ADC0 = 172544, LFA = 0x60002, LFB = 0x120003, LFC = 0x1E0006, I2C0 = 0x2b200, CORE = 0x40020, DMA = 0x41300, HFPER = 0x28110,...
extern crate prometheus_exporter_base; extern crate serde; #[macro_use] extern crate serde_derive; extern crate rmp_serde as rmps; extern crate clap; use lib::datatypes::ServerStatistics; use std::collections::HashMap; use std::sync::mpsc::channel; use std::sync::Arc; use std::sync::Mutex; use std::sync::atomic::Atomic...
/// # SourceTargetMap /// /// This is an universal Structure that holds two Strings. /// One as source of something that needs to be converted or /// is related to the seconde one the target. Can be used /// whenever it is needed. #[derive(Clone)] pub struct SourceTargetMap { pub source: String, pub target: Str...
use super::schema::{create_context, Schema}; use crate::{db::MysqlPool, utils::Auth}; use actix_identity::Identity; use actix_web::{web, Error, HttpResponse}; use juniper::http::{graphiql::graphiql_source, GraphQLRequest}; use std::sync::Arc; pub fn client() -> HttpResponse { let html = graphiql_source("http://loc...
//! A k-mer is a string of length k. We define Count(Text, Pattern) as the number of times that //! a k-mer Pattern appears as a substring of Text. //! //! To compute Count(Text, Pattern), our plan is to “slide a window” down Text, checking whether //! each k-mer substring of Text matches Pattern. //! //! ```text //! P...
extern crate byteorder; use std::str; use std::fmt; use byteorder::{ByteOrder,NativeEndian}; use super::SMBIOSHeader; #[derive(Debug)] pub struct SM3EntryPoint { pub checksum: u8, pub length: u8, pub version_major: u8, pub version_minor: u8, pub doc_rev: u8, pub eps_revision: u8, pub res...
use serde::{Deserialize, Serialize}; use structopt::StructOpt; use persist_core::error::Error; use persist_core::protocol::StopRequest; use crate::daemon; use crate::format; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize, StructOpt)] pub struct Opts { /// Stop all processes #[structopt(long)] p...
use std::ops::{Index, IndexMut, Deref, DerefMut, Range, RangeFrom, RangeTo, RangeFull}; use std::mem::{MaybeUninit, transmute}; use std::hash::Hash; use std::fmt::Debug; pub unsafe trait Array: Sized { type Item; type Index: ArrayIndex; fn len() -> usize; fn as_ptr(&self) -> *const Self::Item; fn ...
mod audio; mod bullet; mod enemies; mod player; mod ui; mod walls; mod world; use crate::enemies::{homing_mine_spin, move_bouncing_enemy, update_mines}; use crate::player::{mouse_click, new_player, update_cool_down}; use crate::ui::{init_fonts, init_press_space_to_play, init_timer, init_ui_background, remove_left_cli...
// Copyright 2018-2019 Mozilla // // 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 writing, sof...
#![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)] ProviderOperations_List(#[from] provi...
pub mod level; mod tests; pub use self::level::*; use error::*; use id::*; use petgraph::algo::astar; use petgraph::graphmap::UnGraphMap; use qdf::*; use rayon::prelude::*; use std::collections::{HashMap, HashSet}; /// Object that represents space level of details. /// This gives you the ability to sample space area ...
use std::{mem, time::Duration}; use log::warn; use crate::{errors::Result, types::OptionsSource, Client, ClientHandle, Pool}; pub(crate) async fn retry_guard( handle: &mut ClientHandle, source: &OptionsSource, pool: Option<Pool>, max_attempt: usize, duration: Duration, ) -> Result<()> { let m...
use super::feature_table::FeatureTable; // A record of an embl-like entry. pub struct Embl { pub annotations: Vec<Annotation>, pub features: FeatureTable, pub sequence: String } pub struct Annotation { pub name: String, pub values: Vec<String>, }
pub fn contains_nearby_almost_duplicate(nums: Vec<i32>, k: i32, t: i32) -> bool { if k <= 0 { return false } else if t < 0 { return false } use std::collections::BTreeSet; let k = k as usize; let t = t as i64; let mut set = BTreeSet::new(); for (i, &num) in nums.iter()...
use super::{color::Color, js_object::Object, random_id::U128Id}; use js_sys::Array; use std::{ collections::{HashMap, HashSet}, rc::Rc, }; use wasm_bindgen::{prelude::*, JsCast}; #[wasm_bindgen(raw_module = "../src/libs/skyway/skyway.js")] extern "C" { pub type Peer; #[wasm_bindgen(constructor)] p...
use helper_functions; use types::consts::*; use types::{ beacon_state::*, config::{Config, MainnetConfig}, }; // use types::types::*; use crate::attestations::attestations::AttestableBlock; use helper_functions::beacon_state_accessors::*; use helper_functions::beacon_state_mutators::*; use helper_functions::mat...