text
stringlengths
8
4.13M
// Copyright 2019, 2020 Wingchain // // 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...
pub mod pin; pub mod clock; pub mod serial; pub mod time; pub mod peripheral;
#![feature(global_allocator)] extern crate libc; extern crate jemalloc_sys as ffi; extern crate jemallocator; use std::ptr; use std::mem; use libc::{c_void, c_char}; use jemallocator::Jemalloc; #[global_allocator] static A: Jemalloc = Jemalloc; #[test] fn test_basic_alloc() { unsafe { let exp_size = ff...
use draw::DrawContext; use std::os::raw::c_int; use ui_sys::{self, uiDrawFillMode, uiDrawFillModeAlternate, uiDrawFillModeWinding, uiDrawPath}; pub struct Path { ui_draw_path: *mut uiDrawPath, } impl Drop for Path { fn drop(&mut self) { unsafe { ui_sys::uiDrawFreePath(self.ui_draw_path) } } } ///...
use std::{error::Error, fs}; use std::{path::PathBuf, str::FromStr}; use super::temps::{GPUTempReader, GPUTemps}; use serde::Serialize; #[derive(Serialize, Clone)] pub struct GPUStatus { pub voltage: Option<f32>, pub power_consumption: Option<f32>, pub fan_speed: Option<i32>, pub temps: Option<GPUTemp...
use crate::{root::AppRoute, services::is_authenticated}; use yew::prelude::*; use yew_router::{ agent::RouteRequest, prelude::{Route, RouteAgentDispatcher}, RouterState, }; pub struct Token<STATE: RouterState = ()> { router: RouteAgentDispatcher<STATE>, } pub enum Message { ChangeRoute(AppRoute), ...
// Copyright 2017 rust-ipfs-api Developers // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the MIT license <LICENSE-MIT or // http://opensource.org/licenses/MIT>, at your option. This file may not be // copied, modified, or distributed except accord...
use date_tuple::DateTuple; use date_utils; use regex::Regex; use std::cmp::Ordering; use std::convert::From; use std::fmt; use std::str::FromStr; const MONTH_STRINGS: [&str; 12] = [ "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec", ]; pub type Month = MonthTuple; /// A container...
/* * Copyright (c) Meta Platforms, Inc. and affiliates. * All rights reserved. * * This source code is licensed under the BSD-style license found in the * LICENSE file in the root directory of this source tree. */ //! tests for delaying signal delivery //! SIGALRM: suppressed //! SIGVTALRM: delayed about 500ms, ...
use atty::Stream; use color_eyre::{Help, Report}; use csv::Reader; use dialoguer::Confirm; use std::process; use std::{fs::File, fs::OpenOptions, io, path::PathBuf}; use tracing::instrument; use crate::{ cli::args::{MultipleReports, SingleReport}, BinError, }; pub mod abundance_csv; pub mod newick; pub mod re...
use clap::{App, Arg, ArgMatches, SubCommand}; use std::process; mod mix_peer; mod node; fn main() { let arg_matches = App::new("Nym Mixnode") .version("0.1.0") .author("Nymtech") .about("Implementation of the Loopix-based Mixnode") .subcommand( SubCommand::with_name("ru...
use async_trait::async_trait; use uuid::Uuid; use common::cache::Cache; use common::error::Error; use common::infrastructure::cache::InMemCache; use common::result::Result; use crate::domain::reader::{Reader, ReaderId, ReaderRepository}; use crate::mocks; pub struct InMemReaderRepository { cache: InMemCache<Read...
// Copyright © 2015, Peter Atashian // Licensed under the MIT License <LICENSE.md> extern crate googl; use std::env::{args}; use std::fs::{File}; use std::io::{Read}; use std::path::{Path}; fn main() { let longurl = args().nth(1).unwrap(); let mut file = File::open(&Path::new("key.txt")).unwrap(); let mut...
// Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{context::Context, filters}; use diem_genesis_tool::validator_builder::ValidatorBuilder; use diem_temppath::TempPath; use diem_types::chain_id::ChainId; use diem_vm::DiemVM; use diemdb::DiemDB; use executor::db_bootstrapper;...
use crate::dna::{Base, DNA}; /// The `dna` value is consumed since the implementation does not follow the /// specification about mutation of `dna` in the step where the program ends. pub fn execute(mut dna: DNA, mut rna_sink: impl FnMut(DNA)) { // TODO: these lines are just for testing. Remove soon. rna_sink(...
#[macro_use] extern crate criterion; use criterion::{BatchSize, Criterion}; use hacspec_dev::rand::random_byte_vec; use hacspec_gf128::*; use hacspec_lib::prelude::*; fn benchmark(c: &mut Criterion) { c.bench_function("GCM", |b| { b.iter_batched( || { let key = Gf128Key::from_p...
extern crate ph; fn main() { ph::start(); }
use std::sync::atomic::{AtomicUsize, Ordering}; use crate::config::config; use crate::coroutine_impl::CoroutineImpl; use crossbeam::queue::SegQueue; use generator::Gn; /// the raw coroutine pool, with stack and register prepared /// you need to tack care of the local storage pub struct CoroutinePool { // the pool...
use crate::util::Point2; #[derive(Debug, Clone, Copy)] pub enum Identifier { Empty = 0, Wall = 1, Block = 2, Paddle = 3, Ball = 4, } impl From<i64> for Identifier { fn from(o: i64) -> Self { match o { 0 => Identifier::Empty, 1 => Identifier::Wall, 2 ...
use specs::{self, Component}; use components::InitFromBlueprint; #[derive(Copy, Clone, Debug, Deserialize, Eq, PartialEq)] pub enum Faction { Neutral, Player, Enemy, } impl Default for Faction { fn default() -> Self { Faction::Neutral } } impl Component for Faction { type Storage = s...
use { crate::hdl_reactor::HdlReactor, crate::models::internal_action, crate::state::State, crate::xlibwrapper::DisplayServer, crate::xlibwrapper::{action, xlibmodels::*}, reducer::*, std::rc::Rc, std::sync::mpsc::*, x11_dl::xlib, }; pub fn run(xlib: Box<Rc<dyn DisplayServer>>, sende...
// implements the optimization submodule pub fn gradient() /*-> vector */ { } pub fn gradient_decent() /*-> vector */ { } pub fn adam() /*-> vector */ { } // TODO: how do I best structure this module for use with kernels?
use std::net::TcpStream; use std::io::{Write, Error}; use commands::ClientCommand; use ser_de::ser; pub struct Writer { to_write: Vec<u8>, } impl Writer { pub fn new() -> Writer { Writer { to_write: Vec::new(), } } pub fn write(&mut self, stream: &mut TcpStream) -> Re...
use serde::{Serialize}; #[derive(Queryable, Serialize)] pub struct Article { pub id: i32, pub title: String, pub discribe: String, pub body: String, }
use crate::hook; use failure::Error; use std::path::PathBuf; use std::vec::Vec; /// Execute the provided command (argv) after loading the environment from the current directory pub fn run(pathbuf: PathBuf, shadowenv_data: String, argv: Vec<&str>) -> Result<(), Error> { if let Some((shadowenv, _)) = hook::load_env(...
use crate::common; use crate::vector3::Vector3; use std::cmp; use std::convert::From; use std::f32::EPSILON; use std::fmt; use std::fmt::{Display, Formatter}; use std::ops::{ Index, IndexMut, Neg, Add, AddAssign, Sub, SubAssign, Mul, MulAssign, Div, DivAssign, }; #[repr(C,...
//! SPI Commands for the Waveshare 4.2" E-Ink Display use crate::traits; /// EPD4IN2 commands /// /// Should rarely (never?) be needed directly. /// /// For more infos about the addresses and what they are doing look into the pdfs /// /// The description of the single commands is mostly taken from IL0398.pdf #[allow(de...
use codespan_reporting::diagnostic::{Diagnostic as CodespanDiagnostic, Label}; use either::Either::*; use walrus_semantics::{ diagnostic::Diagnostic, hir::{Field, Module}, ty::InferenceId, }; pub fn render_diagnostic(module: &Module, diag: &Diagnostic) -> CodespanDiagnostic<()> { match diag { D...
mod mks; Q!(self::mks, u32);
impl Solution { pub fn reverse(x: i32) -> i32 { let mut res = 0; let mut x = x; while x != 0{ //max 和 min in rust if res > i32::MAX / 10 || res < i32::MIN / 10{ return 0; } res = res * 10 + x % 10; x /= 10; }...
use super::{ AzureCliCredential, EnvironmentCredential, ImdsManagedIdentityCredential, TokenCredential, }; use azure_core::TokenResponse; #[derive(Debug, Default)] /// Provides a mechanism of selectively disabling credentials used for a `DefaultAzureCredential` instance pub struct DefaultAzureCredentialBuilder { ...
pub mod sync; pub use sync::*; pub fn nop() { unsafe { asm!("nop"); } } pub fn get_csr_hart_id() -> usize { let mut hart_id; unsafe { asm!("csrrs {0}, mhartid, zero", out(reg) hart_id, options(nostack)); } hart_id } pub fn get_csr_mcycle() -> usize { let mut mcycle; ...
fn read_nums() -> Vec<i32> { let mut input_str = String::new(); std::io::stdin().read_line(&mut input_str).expect("Read error."); input_str.split_whitespace() .map(|s| s.parse::<i32>().expect("Failed to parse number.")) .collect() } fn main() { let (alice, bob) = (read_nums(),...
use async_std; use async_std::io::ReadExt; use async_std::stream::StreamExt; use async_std::task::spawn; use crate::{BoxedError, BoxedErrorResult}; use crate::component_manager::*; use crate::constants; use crate::easyhash::{EasyHash, Hex}; use crate::globals; use crate::heartbeat; use crate::operation::*; use serde::{...
//! An exfiltrator providing the raw [`siginfo_t`]. // Note on unsafety in this module: // * Implementing an unsafe trait, that one needs to ensure at least store is async-signal-safe. // That's done by delegating to the Channel (and reading an atomic pointer, but that one is // primitive op). // * A bit of juggli...
#[macro_export] macro_rules! duk_error { ($msg: expr) => { return Err($crate::error::ErrorKind::Error($msg.to_owned()).into()); }; } #[macro_export] macro_rules! duk_type_error { ($msg: expr) => { return Err($crate::error::ErrorKind::TypeError($msg.to_owned()).into()); }; } #[macro_exp...
/* MIT License Copyright (c) 2017 Frederik Delaere Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publis...
// This file is part of Substrate. // Copyright (C) 2017-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 futures::stream::{Stream, BoxStream, MergedItem}; use futures::{Async, Future, Poll}; pub use neovim_lib::{Neovim, NeovimApi, Session}; use slog::*; use std::sync::mpsc; use std::sync::Mutex; use std::collections::VecDeque; use broker::Event; mod rpc_types; pub use self::rpc_types::NeovimRPCEvent; pub type Neovi...
// This file is part of Substrate. // Copyright (C) 2019-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 bevy::{ math::*, render2::{ color::Color, }, }; #[derive(Debug, Clone)] pub struct Bloom { pub threshold: f32, pub intensity: f32, pub scatter: f32, pub tint: Color, pub clamp: f32, } impl Default for Bloom { fn default() -> Self { Self { ...
pub mod api_info; pub mod api_response;
use uart_16550::SerialPort; use spin::Mutex; use lazy_static::lazy_static; use core::fmt; lazy_static! { static ref SERIAL1: Mutex<SerialPort> = { let mut sp = unsafe { SerialPort::new(0x03F8 as u16) }; sp.init(); Mutex::new(sp) }; } #[macro_export] macro_rules! serial_print { ($...
pub const CONVERT_TEMP: u8 = 0x44; pub const WRITE_SCRATCHPAD: u8 = 0x4E; pub const READ_SCRATCHPAD: u8 = 0xBE; pub const COPY_SCRATCHPAD: u8 = 0x48; pub const RECALL_EEPROM: u8 = 0xB8;
#[allow(non_camel_case_types,dead_code)] pub enum Layout { None = 0, PIP4_In = 1, PIP4_Out = 2, PIP3_Vert_1_2 = 3, PIP3_Vert_2_1 = 4, } pub fn layout(layout: Layout) -> Vec<String> { vec![String::from(format!("{}pL", layout as u8))] }
use std::io::stdout; use crossterm::{cursor, style, terminal, ExecutableCommand, Result}; /// Prints a string in the middle of the terminal output fn main() -> Result<()> { // get terminal size let (terminal_width, terminal_height) = terminal::size()?; // string to print out let string_to_print = "thi...
use diesel::{ pg::PgConnection, r2d2::{ConnectionManager, Pool as PgPool, PooledConnection}, }; /* * ========= * Internals * ========= */ pub type Connection = PooledConnection<ConnectionManager<PgConnection>>; #[derive(Clone)] pub struct Postgres { pool: PgPool<ConnectionManager<PgConnection>>, } im...
/* * 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 = "Register `CTR` reader"] pub type R = crate::R<CTR_SPEC>; #[doc = "Register `CTR` writer"] pub type W = crate::W<CTR_SPEC>; #[doc = "Field `EN` reader - Cache enable"] pub type EN_R = crate::BitReader; #[doc = "Field `EN` writer - Cache enable"] pub type EN_W<'a, REG, const O: u8> = crate::BitWriter<'a, REG, O>...
#[doc = "Register `PCR3` reader"] pub type R = crate::R<PCR3_SPEC>; #[doc = "Register `PCR3` writer"] pub type W = crate::W<PCR3_SPEC>; #[doc = "Field `PWAITEN` reader - PWAITEN"] pub type PWAITEN_R = crate::BitReader; #[doc = "Field `PWAITEN` writer - PWAITEN"] pub type PWAITEN_W<'a, REG, const O: u8> = crate::BitWrit...
fn factorial(n:i32) { let mut fac = n; let mut index = n; if fac < 0 { fac = 0; } else if fac == 0 { fac = 1; } else { while (index - 1) >= 1 { fac *= index - 1; index -= 1; } } println!("{}", fac); } fn main() { factorial(3); }
pub use glyph_brush::Layout as TextLayout; pub use glyph_brush::Section as TextSection; pub use glyph_brush::Text;
//! # Adafruit_gps //! This is a port from the adafruit python code that reads the output from their GPS systems. //! This crate has been tested on a MTK3339 chip on a raspberry pi zero. //! //! ## Links //! - Python code: https://github.com/adafruit/Adafruit_CircuitPython_GPS //! - GPS module docs: https://learn.adafr...
pub mod active_lineager_sampler; pub mod emigration_exit; pub mod event_sampler;
#[doc = "Register `ITLINE15` reader"] pub type R = crate::R<ITLINE15_SPEC>; #[doc = "Field `TIM2` reader - TIM2"] pub type TIM2_R = crate::BitReader; impl R { #[doc = "Bit 0 - TIM2"] #[inline(always)] pub fn tim2(&self) -> TIM2_R { TIM2_R::new((self.bits & 1) != 0) } } #[doc = "interrupt line 15...
use day02::{part_1, part_2}; fn main() { let result_1 = part_1(12, 2); println!("The result of the program part 1 is {}", result_1); match part_2(19690720) { Some((input_1, input_2)) => { println!("The noun={} and the verb={}", input_1, input_2); println!("Thus the answer i...
mod app; mod gif; mod camera; mod wgpu_state; mod draw; pub use wgpu_state::WgpuState; pub use self::app::render_window; #[cfg(target_arch = "wasm32")] pub use self::app::render_window_wasm; pub use self::gif::render_gif; pub use self::gif::render_gif_blocking;
#![feature(split_ascii_whitespace)] use lazy_static::lazy_static; type Datum = u8; struct Node { children: Vec<Node>, metadata: Vec<Datum>, } impl Node { fn build<I: Iterator<Item = Datum>>(iter: &mut I) -> Self { let num_children = iter.next().unwrap(); let num_metadata = iter.next().un...
pub mod models; pub mod operations; #[allow(dead_code)] pub const API_VERSION: &str = "2021-10-15";
// TODO : In the future registry will be downloaded from this repository. // https://github.com/vincent-herlemont/short-template-index use std::collections::HashSet; use std::fs::{read_dir, read_to_string}; use std::path::Path; use anyhow::{Context, Result}; use git2::Repository; use crate::template::template::Templ...
fn main() { // 変数のポインタを取得する let a: i32 = 10 ; let a_ptr: *const i32 = &a ; println!("a is {:?}", a ); println!("a_ptr is {:?}", a_ptr ); // 文字列のポインタを取得する let a = "rust" ; println!("a is {:?}", a ); println!("a_ptr is {:?}", a.as_ptr() ); } fn main2() { let a = Person{name: "masu...
#![allow(non_snake_case)] use aes_gcm::Aes256Gcm; use aead::{NewAead, AeadInPlace}; use crate::utils; use crate::encoder::EncoderBasicTrait; #[derive(Clone)] pub struct AES256GCM { key_bytes: [u8;32], size_xor_bytes: [u8;32], cipher: Aes256Gcm, } impl AES256GCM { pub fn new(KEY:&'static str, otp:u32)...
use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::fs::{File, OpenOptions}; use std::io::{Read, Write}; #[derive(Serialize, Deserialize, Debug)] pub struct Stat { tutorial_version: String, current_lesson: String, finished_lessons: Vec<String>, total_lessons: u32, hints_use...
use crate::{ topic, BundleFor, BundleReceiver, GossipMessage, GossipMessageHandler, GossipValidator, LOG_TARGET, }; use futures::{future, FutureExt, StreamExt}; use parity_scale_codec::{Decode, Encode}; use parking_lot::Mutex; use sc_network_gossip::GossipEngine; use sp_runtime::traits::Block as BlockT; use std...
#[macro_use] extern crate log; extern crate env_logger; extern crate lapin_futures as lapin; extern crate futures; extern crate tokio; extern crate uuid; use futures::future::Future; use futures::Stream; use tokio::executor::current_thread::CurrentThread; use tokio::net::TcpStream; use tokio::io::{ AsyncRead, AsyncW...
pub use self::metrics::{ levenshtein_distance, word_error_rate, word_accuracy }; mod metrics { use itertools::Itertools; use len_trait::len::Len; use std::ops::Index; use std::cmp::min; use crate::graphemes_struct::Graphemes; /// Calculates the levenshtein distance between two word...
use proc_macro::TokenStream; use proc_macro2::TokenStream as TokenStream2; use quote::ToTokens; use crate::attr_parser::ProvidesAttr; use crate::component::type_to_inject::TypeToInject; use crate::component::{generate_dependencies_create_code, generate_inject_dependencies_tuple}; use std::ops::Deref; use syn::spanned:...
use chrono::prelude::*; use chrono_tz::{Europe::London, Tz}; macro_rules! term { // "to" the day on which term ends (usually a Friday). ($name:ident, $sy:literal-$sm:literal-$sd:literal to $ey:literal-$em:literal-$ed:literal) => {{ let start = London.ymd($sy, $sm, $sd).and_hms(0, 0, 0); let end...
#![feature(libc)] #![feature(rustc_private)] extern crate libc; use libc::{c_char, int32_t, c_int}; use std::ffi::CString; /* * For Initialization */ extern {fn register_all_sql_mappers();} extern {fn mcsql_set_db_file(dbname: *const c_char);} /* * Database Handle */ extern {fn mcsql_arc_get_all() -> *mut c_char;} e...
use std::borrow::Cow; use std::convert::Into; use std::str::Chars; use unicode_normalization::UnicodeNormalization; const CHARS_TO_DELIMIT: &'static [char] = &[' ', ',', '.', '/', '\\', '-', '_', '=']; const CHARS_TO_REMOVE: &'static [char] = &['\'']; const DEFAULT_DELIMITER: char = '-'; pub struct Slugger<'a> { ...
use core::fmt; use std::fmt::Formatter; use std::marker::PhantomData; use serde::de; use serde::de::Visitor; use crate::{AnyBin, AnyStr}; pub struct ReIntegrationStrVisitor<TReIntegrator> { _phantom: PhantomData<TReIntegrator>, } impl<TReIntegrator> ReIntegrationStrVisitor<TReIntegrator> { pub fn new() -> S...
const REPO_OWNER: &str = "GlebIrovich"; const REPO_NAME: &str = "rudo"; const EXE_NAME: &str = "rudo"; pub const CURRENT_APP_VERSION: &str = "0.2.3"; pub fn update() -> Result<String, Box<dyn ::std::error::Error>> { let status = self_update::backends::github::Update::configure() .repo_owner(REPO_OWNER) ...
pub mod client_error; pub mod clientlog; pub mod race_event; pub mod logline_generator; use common::race_run::ZoneEntry; use common::race_run::LevelUp; use client::clientlog::ClientLogLine; use self::race_event::SimpleEvent; use chrono::Local; use chrono::DateTime; use self::client_error::{ClientResult, ClientError}; ...
mod builder; mod method; pub use self::builder::*; pub use self::method::{Instance, Method}; pub fn build<'a>() -> Builder<'a> { Builder::default() } #[cfg(test)] pub mod tests { use super::super::types::Object; use super::super::Context; use super::method::Instance; #[test] fn class_builder...
use cgmath::{ElementWise, Vector2}; use std::f32; use std::cmp::Ordering; use std::cmp::Ordering::*; use math::IntAabb; const EPSILON: f32 = 1e-7; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] pub enum AabbRelation { Disjoint, Intersects, Contains, ContainedBy, } #[derive(Copy, Clone, Debug)]...
use super::*; use crate::{Client, Error, HyperTransport}; use std::collections::HashMap; #[derive(Clone)] pub struct Writer(Arc<EavesdropRecorder>); impl Writer { pub fn write_as_fixture(&self) { self.0.write_as_fixture() } } pub async fn new_eavesdrop_device( uri: http::Uri, ) -> Result< ( ...
extern crate sd12; use sd12::pixels::Color; use std::thread; fn main() { let sd1_context = sd12::init().video().build().unwrap(); // 创建窗口 let window = sd1_context .window("ArcadeRS Shooter", 800, 600) .position_centered() .opengl() .build() .unwrap(); let mut r...
// Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 //! This module translates the bytecode of a module to Boogie code. use std::collections::BTreeSet; use itertools::Itertools; use log::info; use stackless_bytecode_generator::{ stackless_bytecode::StacklessBytecode::{self, *}, ...
// Copyright 2019, 2020 Wingchain // // 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...
// A demonstration of an offchain worker that sends onchain callbacks which originally attributed from FRAME example-offchain-worker // More detail of original FRAME example can find here https://github.com/paritytech/substrate/blob/master/frame/example-offchain-worker/src/lib.rs #![cfg_attr(not(feature = "std"), no_s...
#![allow(dead_code)] use core::convert::TryInto; use core::convert::TryFrom; #[derive(Debug)] struct BillAmount { value: f32 } impl From<i32> for BillAmount { fn from(amount: i32) -> Self { BillAmount { value: amount as f32 } } } impl TryFrom<String> for BillAmount { type Error = (); fn...
use crate::core::{ authentication_barcode, authentication_nfc, authentication_password, Account, Permission, Pool, ServiceResult, }; use crate::identity_policy::{Action, RetrievedAccount}; use crate::login_required; use crate::web::utils::{EmptyToNone, HbData}; use actix_web::{http, web, HttpRequest, HttpRespon...
//! The backend target code. pub use self::registry::Registry; pub use self::machine::Machine; pub use self::compilation::Compilation; // Reexports. pub use sys::target::FileType; pub mod registry; pub mod machine; pub mod compilation; use SafeWrapper; use sys; use std::{ffi, fmt}; /// A target triple. pub struct...
use std::cell::{RefCell}; use std::rc::{Rc, Weak}; pub type ColumnIndex = usize; pub type RowIndex = usize; /// `NodeExtra` contains the information specific to a node's /// type. For instance, only constraint (column) header nodes require /// a count of how many nodes are contained in the column. The type of /// nod...
//use futures::future; use linkerd_app_core::{svc::stack::Predicate, svc::stack::Switch, Error}; /// A connection policy that drops #[derive(Copy, Clone, Debug)] pub struct PreventLoop { port: u16, } #[derive(Copy, Clone, Debug)] pub struct LoopPrevented { port: u16, } impl From<u16> for PreventLoop { fn...
pub type HttpParserResult<T> = Result<T, HttpParserError>; pub enum HttpParserError { }
use std::fs::{File, read_dir}; use std::io::{Error, Read}; /// Obtains a list of video extensions from the `/etc/mime.types` file on Linux. pub fn get_extensions(kind: &'static str) -> Result<Vec<String>, Error> { let mut extension_list = Vec::new(); let mut buffer = String::new(); for extension_file in r...
#[test] fn test() { }
//! An almost exact copy of the example of a custom drawing widget from Druid itself //! We plan to draw tablature use core::f64; use druid::kurbo::Line; use druid::piet::{FontFamily, ImageFormat, InterpolationMode, Text, TextLayoutBuilder}; use druid::widget::prelude::*; use druid::{ Affine, AppLauncher, Color, F...
use std::env; extern crate rand; use self::rand::Rng; use yak_client::Client; pub fn open_from_env(env_var: &str, name: &str, test_id: u64) -> Client { let yak_url = env::var(env_var).ok() .expect(&format!("env var {} not found", env_var)); let full_url = format!("{}-{}-{:x}", yak_url, name, test_id); info!...
use std::env; use roman::convert_and_print_numerals; const HELP_COPY: &str = "Please specify either one or multiple: a) Roman numerals to be converted to Arabic numerals b) Arabic numerals to be converted to Roman numerals"; fn main() { let args: Vec<String> = env::args().collect(); match args.len()...
use core::cmp::min; use micromath::F32Ext; use crate::pac::{rcc, FLASH, RCC}; use crate::time::Hertz; /// Extension trait that constrains the `RCC` peripheral pub trait RccExt { /// Constrains the `RCC` peripheral so it plays nicely with the other abstractions fn constrain(self) -> Rcc; } impl RccExt for RC...
use core::cmp::PartialEq; use core::hash::Hash; use im::HashSet; use itertools::Itertools; use rustc_errors::MultiSpan; use rustc_span::Span; use serde::{ser::SerializeSeq, Serialize, Serializer}; use std::fmt; #[derive(Clone, Hash, PartialEq, Eq, PartialOrd, Ord, Debug, Copy)] pub struct RustspecSpan(pub Span); impl...
#[macro_export] macro_rules! bitflags { ( $vis:vis enum $name:ident: $type:ty { $( $vname:ident = $value:expr, )+ } ) => { #[repr(transparent)] #[derive(Clone, Copy, PartialEq, Hash, PartialOrd)] $vis struct $name { ...
#![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 Aggregations { #[serde(flatten)] pub resource: Resource, #[serde(flatten)] pub aggregations_kind: A...
use crate::models::MultiLanguageString; use crate::{Result, VGMError}; use select::node::Node; use select::predicate::Attr; fn parse_month(input: &str) -> Result<u8> { // Months // Jan, Feb, Mar, Apr, May, Jun, Jul, Aug, Sep, Oct, Nov, Dec // January, February, March, April, May, June, July, August, Septem...
use std::convert::{AsMut, AsRef, From, Into}; use std::mem; use std::ptr; use crate::base::allocator::Allocator; use crate::base::dimension::{U1, U2, U3, U4}; use crate::base::storage::{ContiguousStorage, ContiguousStorageMut, Storage, StorageMut}; use crate::base::{DefaultAllocator, Matrix, OMatrix, Scalar}; macro_r...
$NetBSD: patch-vendor_target-lexicon_src_targets.rs,v 1.10 2023/07/10 12:01:24 he Exp $ Add aarch64_eb, mipsel and riscv64gc for NetBSD. --- vendor/target-lexicon/src/targets.rs.orig 2021-05-03 21:35:46.000000000 +0000 +++ vendor/target-lexicon/src/targets.rs @@ -1357,6 +1357,7 @@ mod tests { "aarch64-un...
use gltf; use render::Node; use render::math::*; use shader::Shader; pub struct Scene { pub name: Option<String>, pub nodes: Vec<Node>, } impl Scene { pub fn from_gltf(g_scene: gltf::scene::Scene) -> Scene { Scene { // TODO! name: None, //g_scene.name().map(|s| s.into()), ...
use log::debug; use serde::{Serialize,Deserialize}; use crate::{ParticipantId, ParticipantKey, Participant, rand, total_stakes2, ParticipantIdx}; use std::collections::HashMap; pub type Id = u32; #[derive(Serialize, Deserialize, Debug, Clone)] pub struct Slot { pub id:Id, pub leader:ParticipantKey, commit...