text
stringlengths
8
4.13M
#[doc = "Register `CRYP_SR` reader"] pub type R = crate::R<CRYP_SR_SPEC>; #[doc = "Field `IFEM` reader - IFEM"] pub type IFEM_R = crate::BitReader; #[doc = "Field `IFNF` reader - IFNF"] pub type IFNF_R = crate::BitReader; #[doc = "Field `OFNE` reader - OFNE"] pub type OFNE_R = crate::BitReader; #[doc = "Field `OFFU` re...
use general::TryReader; use sourcecode::Span; use sourcecode::Code; use token::Token; use token::Bracket; use token::BracketSide; use token::ReservedWord; use parse::SyntaxTree; use parse::Expression; pub struct Func { pub name: String, pub args: Vec<String>, pub body: Expression, span: Span, } imp...
#[doc = "Register `CR2` reader"] pub type R = crate::R<CR2_SPEC>; #[doc = "Register `CR2` writer"] pub type W = crate::W<CR2_SPEC>; #[doc = "Field `SADD` reader - Slave address bit (master mode)"] pub type SADD_R = crate::FieldReader<u16>; #[doc = "Field `SADD` writer - Slave address bit (master mode)"] pub type SADD_W...
mod v2017; mod v2018; mod v2019; mod v2020; mod v2021; mod v2022; pub mod module { pub use super::v2017::modules::*; pub use super::v2018::modules::*; pub use super::v2019::modules::*; pub use super::v2020::modules::*; pub use super::v2021::modules::*; pub use super::v2022::modules::*; } pub m...
// use std::mem; // use str::is_char_boundary // use std::slice; #![feature(str_char)] use std::io; use std::str; use std::string::String; use std::usize; use std::io::Write; fn main() { println!("Why, hello there. i don't think we met."); println!("would you kindly please tell me your name?"); let mut na...
struct CupCycle { cups: Vec<usize>, current_index: usize, } impl CupCycle { fn new(start: &[usize]) -> CupCycle { CupCycle { cups: start.to_vec(), current_index: 0, } } fn read_from_position(&self, i: usize) -> usize { let number_of_cups = self.cups....
extern crate cgmath; extern crate rand; use std::io::prelude::*; use std::io::BufWriter; use std::fs::File; use cgmath::Vector3; use cgmath::InnerSpace; type Vec3 = Vector3<f32>; mod materials; use materials::Lambertian; use materials::Metal; use materials::Dielectric; mod util; use util::Hitable; use util::HitableLi...
use std::{sync::{Arc, Mutex, mpsc::{self, SendError}}, thread, usize}; pub struct ThreadPool { threads_num: u16, workers_pool: Vec<Worker>, sender: mpsc::Sender<JobOrDrop>, } impl ThreadPool { pub fn new(threads_num: u16) -> ThreadPool { let (sender, receiver) = mpsc::channel(); let re...
// // Register interfaces for STM32F0x1, STM32F0x2 and STM32F0x8 // // See ST reference manual RM0091 // #![no_std] pub mod rcc; use crc; use gpio; use rtc; use timer; extern { #[link_name="stm32f0x1_CRC"] pub static CRC: crc::CRC; #[link_name="stm32f0x1_GPIOA"] pub static GPIOA: gpio::GPIO; ...
fn solve_01() {} fn solve_02() {} pub fn solve(input: &str) { dbg!(solve_01()); dbg!(solve_02()); } #[cfg(test)] mod tests { use super::*; #[test] fn part_one() { unimplemented!(); } #[test] fn part_two() { unimplemented!(); } }
use std::io::BufWriter; use std::fs::File; use std::vec::*; use ndarray::*; use ndarray_linalg::*; use read_and_write::*; #[derive(Clone)] pub struct KalmanFilterMember{ pub x: Array1<f64>, pub v: Array2<f64>, pub f: Array2<f64>, pub g: Array2<f64>, pub h: Array2<f64>, pub q: Array2<f64>, pub r: Array2<f64> } pub ...
use crate::board::Board; use rand::Rng; pub trait Player { fn play(&mut self, board: &mut Board) { let mut rng = rand::thread_rng(); loop { if board.drop_piece(self.get_symbol(),rng.gen_range(0..7)) { break; } } } fn get_symbol(&self) -> char; }
//! Implementation of http transport #[cfg(feature = "blocking")] mod blocking; #[cfg(feature = "blocking")] pub use blocking::Http; #[cfg(feature = "non-blocking")] mod non_blocking; #[cfg(feature = "non-blocking")] pub use non_blocking::Http as AsyncHttp;
// 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...
extern crate backtrace; extern crate once_cell; // This module must be declared before the others because it exports a `log!` macro that everyone // else uses. #[macro_use] pub mod logger; pub mod human_panic; pub mod utils;
#[doc = "Reader of register RXF%s"] pub type R = crate::R<u32, super::RXF>; impl R {}
use glium::program::ProgramChooserCreationError; use glium::texture::Texture2d; use glium::vertex::VertexBufferSlice; use glium::{ backend::Facade, uniforms::{MagnifySamplerFilter, MinifySamplerFilter}, }; use glium::{program, uniform}; use glium::{DrawError, DrawParameters, Program, Surface}; use euclid::Tran...
//! Processor core registers //#![rustfmt::skip] #[macro_use] mod macros; mod lr; mod sp; mod cpsr; // Export only the R/W traits and the static reg definitions pub use register::cpu::*; pub use self::lr::LR; pub use self::sp::SP; pub use self::cpsr::CPSR;
pub fn run() { println!("\n====5.27 Overview===="); println!(" ? | python analog | what is it?"); println!("---------------+--------------------+------------"); println!(" Vec<T> | list | Dynamic array"); println!(" VeDeque<T> | collections.deque | Double-en...
//! Hydroflow declarative macros. /// [`assert!`] but returns a [`Result<(), String>`] instead of panicking. #[macro_export] macro_rules! rassert { ($cond:expr $(,)?) => { $crate::rassert!($cond, "assertion failed: `{}`", stringify!($cond)) }; ($cond:expr, $fmt:literal) => { $crate::rassert...
// Copyright 2019 CoreOS, 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...
/// A resource quota for the given resource kind /// /// A collection of this type is often returned in responses allowing you to /// know how much of a given resource you can use. #[allow(missing_docs)] #[derive(Debug, Clone, PartialEq, PartialOrd)] pub enum ResourceQuota { Databases(u64), StoredProcedures(u64...
enum IpAddrKind { V4(u8, u8, u8, u8), // 带 多个 参数的成员 V6(String), } struct IpAddr { kind: IpAddrKind, address: String, } fn main() { let homev4 = IpAddrKind::V4(127, 0, 0, 1); let homev4 = IpAddrKind::V6(String::from("::1")); }
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>,...
//! A helper struct for evenly "mixing" together two PDFs. use crate::{pdf::PDF, vec3::Vec3}; use rand::prelude::*; /// A helper struct for evenly "mixing" together two PDFs. The method /// `MixturePDF::value()` will average out the calls to `value()` for the two /// PDFs, the the method `MixturePDF::generate()` has ...
use std::collections::HashMap; use gtk::prelude::*; use crate::view::*; // Shared state for communication between buttons and drawingarea pub struct State { pub parameter_a : f64, pub parameter_b : f64, pub parameter_c : f64, pub approx : f64, pub move_x : f64, pu...
fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } fn read_vec<T: std::str::FromStr>() -> Vec<T> { read::<String>() .split_whitespace() .map(|e| e.parse().ok().unwrap()) .collect() } fn rea...
use specs::Join; pub struct FollowPlayerSystem; impl<'a> ::specs::System<'a> for FollowPlayerSystem { type SystemData = ( ::specs::ReadStorage<'a, ::component::FollowPlayer>, ::specs::ReadStorage<'a, ::component::Player>, ::specs::ReadStorage<'a, ::component::PhysicBody>, ::specs::...
use ad_hoc_gen::org::company as host; use host::Client as packs; use ad_hoc_gen::sys; use std::sync::mpsc::*; use host::Communication; const some_usize: usize = 0_usize; const some_u16: u16 = 0u16; const some_u8: u8 = 0u8; const some_u8s: [u8; 1] = [0u8; 1]; const some_u16s: [u16; 1] = [0u16; 1]; use host::Communica...
use clap::{App, Arg, ArgMatches, SubCommand}; use std::{io, process}; use database::DB; pub fn make_subcommand<'a, 'b>() -> App<'a, 'b> { SubCommand::with_name("delete") .about("Delete bookmark") .arg(Arg::from_usage("<ID>... 'Delete bookmarks matching the specified ids{n}\ ...
/* * 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 sdl2::pixels::Color; #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct SerdeColor { pub r: u8, pub g: u8, pub b: u8, pub a: u8, } impl SerdeColor { pub fn new(r: u8, g: u8, b: u8, a: u8) -> Self { Self { r, g, b, a } } } impl Into<Color> for &SerdeColor { f...
use tokio::io::{AsyncRead, AsyncWrite, ReadBuf}; use std::io::Result; use std::pin::Pin; use std::task::{Context, Poll}; use std::time::Instant; use protocol::Resource; pub(crate) struct Writer<W> { w: W, metric_id: usize, } impl<W> Writer<W> { pub(crate) fn from(w: W, addr: &str, resource: Resource, bi...
// Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MI...
use std::vec::Vec; #[derive(Clone)] pub enum Difference { Minus, Plus, } #[derive(Clone)] pub struct Entry { pub line_num: i32, pub difference: Difference, pub line: String, } impl Entry { fn new(line_num: i32, difference: Difference, line: String) -> Entry { Entry { line_...
// // #![allow(unused)] // use std::io::{self, BufReader}; // use std::io::prelude::*; // use std::fs::File; // use regex::Regex; // use std::collections::HashMap; // // Exo 1 // fn main() -> std::io::Result<()> { // let f = File::open("input")?; // let f = BufReader::new(f); // let bags: HashMap<String, S...
// #![allow(warnings)] use std::{fmt, io, thread}; use std::net::{TcpListener, TcpStream, Shutdown}; use std::io::{Read, Write}; use std::sync::{Arc, Mutex}; use std::rc::Rc; // use closure::closure #[derive(Copy, Clone)] pub struct bankAccount{ balance: i16, id: i16, } impl bankAccount{ ...
#[doc = "Register `ATCR2` reader"] pub type R = crate::R<ATCR2_SPEC>; #[doc = "Register `ATCR2` writer"] pub type W = crate::W<ATCR2_SPEC>; #[doc = "Field `ATOSEL1` reader - ATOSEL1"] pub type ATOSEL1_R = crate::FieldReader; #[doc = "Field `ATOSEL1` writer - ATOSEL1"] pub type ATOSEL1_W<'a, REG, const O: u8> = crate::F...
pub mod assets; pub mod errors; pub mod hierarchy_util; pub mod mesh; pub mod materials;
use cgmath::Vector2; use specs::{Component, Entity, VecStorage, World, WorldExt}; mod kinematics; pub mod systems; mod transform; use crate::geometry::gridstore::{GridStore, GridStoreHandle}; pub use kinematics::*; pub use transform::*; #[derive(Clone, Copy)] pub struct PhysicsObject { pub dir: Vector2<f32>, ...
// Copyright 2021. The Tari Project // SPDX-License-Identifier: BSD-3-Clause use crate::{ ristretto::{RistrettoPublicKey, RistrettoSecretKey}, signatures::CommitmentAndPublicKeySignature, }; /// # A commitment and public key (CAPK) signature implementation on Ristretto /// /// `RistrettoComAndPubSig` utilises...
#![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; #[macro_use] extern crate rocket_contrib; use rocket_contrib::json::{Json, JsonValue}; #[get("/")] fn index() -> &'static str { "Kefran api!" } #[get("/appliances/<name>")] fn oven(name: String) -> JsonValue { json!({ "status": "o...
#[derive(Debug)] struct EntryPartOne { lower: usize, upper: usize, character: char, password: Vec<char>, } #[derive(Debug)] struct Entry { pos_1: usize, pos_2: usize, character: char, password: Vec<char>, } pub fn solve_part_one(input: &str) -> usize { input .split('\n') ...
pub mod pokedex;
use imgui::Ui; pub mod docking; pub trait UIComponent<TCb> { type Model; fn draw(&mut self, ui: &Ui, model: &Self::Model, cmd: &mut TCb); } use std::any::Any; pub trait UIComponentAny<TCb> { fn draw_any(&mut self, ui: &Ui, model: &dyn Any, cmd: &mut TCb); } impl<T, TCb> UIComponentAny<TCb> for T where ...
use std::env; use std::fs; #[derive(Copy, Clone, Debug)] enum Dir { N(i32), E(i32), S(i32), W(i32), } impl Dir { fn execute(&self, pos: Position) -> Position { match *self { Dir::N(amount) => Position { y: pos.y + amount, ..pos }, ...
#![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)] ApiExport_Get(#[from] api_export::get...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ convert_account_address_to_peer_id, convert_peer_id_to_account_address, helper::convert_boot_nodes, }; use libra_crypto::{ ed25519::{Ed25519PrivateKey, Ed25519PublicKey}, test_utils::KeyPair, }; use cra...
use glow::HasContext; use gl::types::GLuint; use cgmath::*; use std::sync::atomic::{AtomicI32, Ordering}; static DIRECTIONAL_LIGHT_COUNT: AtomicI32 = AtomicI32::new(0); pub trait IsLight { fn count_ref(&self) -> &AtomicI32; fn upload_fields(&self, gl: &glow::Context, handle: GLuint); } pub struct Direction...
pub mod server; mod config; pub use config::Config; mod error; pub use error::{Error, Result};
fn main() { let end = 10; let closure = |start| { for val in (start..end).rev() { println!("{}", val); } }; closure(0); // Pattern matching let music_style= vec!["Experimental", "Hard", "Modern"]; let music_type = vec!["Jazz", "Rock", "Classical"]; let...
#[doc = "Register `OUTBR` reader"] pub type R = crate::R<OUTBR_SPEC>; #[doc = "Register `OUTBR` writer"] pub type W = crate::W<OUTBR_SPEC>; #[doc = "Field `POL1` reader - Output 1 polarity"] pub type POL1_R = crate::BitReader<POL1_A>; #[doc = "Output 1 polarity\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, Partia...
/** * Bindings the runtime's random number generator (ISAAC). */ native "rust" mod rustrt { type rctx; fn rand_new() -> rctx; fn rand_next(c: rctx) -> u32; fn rand_free(c: rctx); } type rng = obj { fn next() -> u32; }; resource rand_res(c: rustrt::rctx) { rustrt::rand_free(c); } ...
#[doc = "Register `AHB2SMENR` reader"] pub type R = crate::R<AHB2SMENR_SPEC>; #[doc = "Register `AHB2SMENR` writer"] pub type W = crate::W<AHB2SMENR_SPEC>; #[doc = "Field `GPIOASMEN` reader - IO port A clocks enable during Sleep and Stop modes"] pub type GPIOASMEN_R = crate::BitReader; #[doc = "Field `GPIOASMEN` writer...
/// Type-level bit `0` #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub enum _0 {} /// Type-level bit `1` #[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)] pub enum _1 {}
use rppal::gpio::*; use std::time::*; use std::thread::sleep; // row and column pins in BCM format const ROW: [u8; 7] = [ 21, 20, 16, 26, 19,13, 6 ]; const COL: [u8; 7] = [ 10, 9, 11, 25, 8, 7, 1 ]; // we use u8 for bit because it is more visual and easy to edit than bool const PINS_0: [u8; 7] = [ 1, 1, 1, 0, 1, 1, 1 ...
use std; use std::mem; use std::process; use std::any::Any; /// A trait for things than can watch for signals sent when applying a Change. pub trait Watcher<ST> { fn send_signal(&mut self, signal: ST); } /// A no-op implementation of Watcher. pub struct NoWatcher; impl<ST> Watcher<ST> for NoWatcher { fn send_signal...
/* ---Complimentary DNA--- Deoxyribonucleic acid (DNA) is a chemical found in the nucleus of cells and carries the "instructions" for the development and functioning of living organisms. If you want to know more http://en.wikipedia.org/wiki/DNA In DNA strings, symbols "A" and "T" are complements of each other, as "C"...
extern crate rustc_plugin; #[macro_use] extern crate syntax; extern crate syntax_pos; extern crate syntax_ext; extern crate rustc_errors as errors; use self::syntax::ext::base::{ExtCtxt, MacResult, MacEager}; use self::syntax_pos::Span; use self::syntax::parse::token; use self::syntax::tokenstream::TokenTree; use self:...
use middle::*; use typed_walker::*; struct Reachability; impl<'a, 'ast> Walker<'a, 'ast> for Reachability { fn walk_method_impl(&mut self, method: MethodImplRef<'a, 'ast>) { if let Some(ref body) = *method.body { let out_maybe = check_block(body); if out_maybe && !matches!(Type::Vo...
pub mod a_sync; pub mod splittable; // RaspberryPi model B+ physical pins to BCM map #[allow(dead_code)] const PIN_TO_GPIO_REV3: [i8; 41] = [ -1, -1, -1, 2, -1, 3, -1, 4, 14, -1, 15, 17, 18, 27, -1, 22, 23, -1, 24, 10, -1, 9, 24, 11, 7, -1, 7, -1, -1, 5, -1, 6, 12, 13, -1, 19, 16, 26, 20, -1, 21, ]; // Raspbe...
mod board; pub use board::*;
use serde::{Serialize, Deserialize}; use std::collections::HashMap; use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] #[serde(untagged)] pub enum NetworkGeocodingStatus { NetworkGeocodingSuccess(NetworkGeocodingResponse), NetworkGeocodingError(ErrorMessage), } #[derive(Debug, Serialize, Deserial...
//! Translates native architectures to Falcon IL. use error::*; use il::*; use std::boxed::Box; use std::collections::{BTreeMap, VecDeque}; pub mod x86; /// The endianness of the native architecture. pub enum Endian { Big, Little } const DEFAULT_TRANSLATION_BLOCK_BYTES: usize = 64; /// This trait is used ...
use af; use af::{Dim4, Array, MatProp}; use activations; use initializations; use layer::{Layer, Input}; #[allow(non_snake_case)] pub struct Dense { weights: Vec<Array>, bias: Vec<Array>, delta: Array, inputs: Input, activation: &'static str, } impl Dense { pub fn new(input_size: u64, output_size: u64 ...
// Generated by diesel_ext #![allow(unused)] #![allow(clippy::all)] use super::schema::constr_attr; use super::schema::contract; use super::schema::department; use super::schema::department_head; use super::schema::eng_attr; use super::schema::eq_group_list; use super::schema::equipment; use super::schema::equipment_t...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - GICH hypervisor control register"] pub gich_hcr: GICH_HCR, #[doc = "0x04 - GICH VGIC type register"] pub gich_vtr: GICH_VTR, #[doc = "0x08 - GICH virtual machine control register"] pub gich_vmcr: GICH_VMCR, _res...
//! ABI encoder. use util::pad_u32; use {Word, Token, Bytes}; fn pad_bytes(bytes: &[u8]) -> Vec<Word> { let mut result = vec![pad_u32(bytes.len() as u32)]; result.extend(pad_fixed_bytes(bytes)); result } fn pad_fixed_bytes(bytes: &[u8]) -> Vec<Word> { let len = (bytes.len() + 31) / 32; let mut result = Vec::wit...
#[doc = "Register `COUNT3_TX` reader"] pub type R = crate::R<COUNT3_TX_SPEC>; #[doc = "Register `COUNT3_TX` writer"] pub type W = crate::W<COUNT3_TX_SPEC>; #[doc = "Field `COUNT3_TX` reader - Transmission byte count"] pub type COUNT3_TX_R = crate::FieldReader<u16>; #[doc = "Field `COUNT3_TX` writer - Transmission byte ...
use std::collections::HashSet; use crate::{despawn_entities_system::queue_despawn_batch, prelude::*}; pub fn damage_system(world: &mut World) -> anyhow::Result<()> { let mut despawn_entities = HashSet::new(); { let player_entity = world.resource_entity::<Player>().ok(); for (_, cmd) in world...
use super::utils::wait_get_blocks; use crate::utils::build_headers; use crate::{Net, Spec, TestProtocol}; use ckb_sync::{NetworkProtocol, BLOCK_DOWNLOAD_TIMEOUT}; use ckb_types::core::HeaderView; use log::info; use std::time::Instant; pub struct GetBlocksTimeout; impl Spec for GetBlocksTimeout { crate::name!("get...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use starcoin_types::account_address::AccountAddress; use starcoin_types::transaction::{RawUserTransaction, SignedUserTransaction}; use starcoin_wallet_api::{Wallet, WalletAccount, WalletResult, WalletService}; use std::time::Duratio...
use rand::Rng; use std::ops::{Add, Div, Mul, Sub}; #[derive(Clone, Copy, Debug)] pub struct Vector { pub x: f32, pub y: f32, pub z: f32, } impl Vector { pub fn new(x: f32, y: f32, z: f32) -> Vector { Vector { x, y, z } } pub fn from_f32(v: f32) -> Vector { Vector::new(v, v, v)...
// Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use std::{collections::HashMap, sync::Arc}; use futures::{ channel::mpsc::{Receiver, Sender}, sink::SinkExt, task::{Context, Poll}, Future, Stream, }; use anyhow::*; use futures::lock::Mutex; use std::cmp::Eq; use...
struct Something(i32); #[derive(Debug)] struct SomethingWithDebug(i32); #[derive(Debug)] struct DebugCeption(SomethingWithDebug); #[derive(Debug)] struct Person<'a> { name: &'a str, age: u8, } fn main() { // Debug formatting println!("{:?}", 42); // Does not implemet Debug. Does not compile! ...
pub mod foods { use std::collections::HashMap; pub fn get(s:&str) -> String { let mut f = HashMap::new(); f.insert("小松菜".to_string(), "はい。小松菜は、あげても大丈夫です。カルシウムも豊富でおススメの食べ物です。ではまた。"); f.insert("水菜".to_string(), "はい。水菜は、あげても大丈夫です。カルシウムも豊富でおススメの食べ物です。ではまた。"); f.insert("チンゲンサイ".to_string(), "はい。チンゲンサイは、...
pub mod encryption; pub mod identity; // TODO: this trait will need to be moved elsewhere, probably to some 'persistence' crate // but since it will need to be used by all identities, it's not really appropriate if it lived in nym-client pub trait PemStorable { fn pem_type(&self) -> String; }
use serde_json::Value; /// A JSON Patch "add" operation /// /// Adds a value at the target location. /// /// [More Info](https://tools.ietf.org/html/rfc6902#section-4.1) #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub struct OpAdd { /// A string containing a JSON-Pointer value that references a locati...
use crate::data::{Primitive, Value}; use crate::prelude::*; impl From<Primitive> for Value { fn from(input: Primitive) -> Value { Value::Primitive(input) } } impl From<String> for Value { fn from(input: String) -> Value { Value::Primitive(Primitive::String(input)) } } impl<T: Into<Val...
#[allow(dead_code)] #[derive(Debug, Clone)] struct UnionFind { parent: Vec<usize>, rank: Vec<usize>, } #[allow(dead_code)] impl UnionFind { fn new(n: usize) -> Self { let mut parent = vec![0; n]; (0..n).for_each(|i| parent[i] = i); let rank = vec![0; n]; UnionFind { parent, ...
use super::*; pub fn codegen_binop( context: &mut Context, args: &[Token], op: LLVMOpcode, ) -> CodegenResult<Object> { if args.len() != 2 { return Err(CodegenError::new(&format!( "binary expression should only have two arguments. found {}", args.len() ))); }...
extern crate serde_json; use simple_timer::*; use model::*; use async_client::*; use std::time::Duration; use std::error::Error; use std::vec::Vec; use std::str; use std::mem; use std::rc::Rc; use std::sync::mpsc; use std::sync::mpsc::{Sender, Receiver}; use std::thread; use std::ops::Drop; use serde::de::Deserializ...
// Copyright 2014-2018 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or http://opensource.org/licenses/MIT>,...
fn main() { reference(); mut_ref(); last_used(); dang(); } // The issue with the tuple code is that we have to return the String to the calling function so we can still use the String after the call to calculate_length, because the String was moved into calculate_length // Instead, we reference to an o...
#[allow(non_snake_case)] #[allow(dead_code)] pub fn Question4() { let value1 = 45.87; let value2 = 98.876; println!("Adding = {}", value1 + value2); println!("Subtraction = {}", value1 - value2); println!("Multiply = {}", value1 * value2); println!("Division = {}", value1 / value2...
/// MigrateRepoForm form for migrating repository /// this is used to interact with web ui #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct MigrateRepoForm { pub auth_password: Option<String>, pub auth_token: Option<String>, pub auth_username: Option<String>, pub clone_addr: String, ...
use std::ops::{Add, Sub}; use std::f64::EPSILON as F_EPSILON; // Clone is so we have the clone() method available for out struct // Copy is so everytime we attempt to give away ownership we clone() instead #[derive(Debug, Clone, Copy)] pub struct Point{ pub x: f64, pub y: f64, pub z: f64 } impl Point { pub fn ne...
use parse_display::Display; use silkenweb::{html_element, AttributeValue, Builder}; use wasm_bindgen::{prelude::*, JsCast}; use web_sys as dom; html_element!( ui5-calendar<dom::HtmlElement> { attributes { hide-week-numbers: bool, selection-mode: SelectionMode, format-pat...
use serde::Deserialize; use super::{event::EventHandler, EVENT_TIMEOUT}; use crate::{ bson::{doc, Document}, cmap::{ establish::{ConnectionEstablisher, EstablisherOptions}, options::ConnectionPoolOptions, Command, ConnectionPool, }, event::cmap::{CmapEvent, CmapEventHand...
#![allow(dead_code)] extern crate libc; extern crate cpython; extern crate rustypy; use cpython::{Python}; #[test] fn submodules() { use test_package::rustypy_pybind::PyModules; let gil = Python::acquire_gil(); let py = gil.python(); let test_package: PyModules = PyModules::new(&py); test_package.root_module_...
use std::collections::HashMap; fn main() { let mut scores = HashMap::new(); scores.insert(String::from("Blue"), 10); scores.insert(String::from("Yellow"), 50); let teams = vec!["Blue".to_string(), "Yellow".to_string()]; let initial_scores = vec![10, 50]; let mut scores: HashMap<_, _> = teams...
use std::net::{TcpStream, ToSocketAddrs, Shutdown}; use std::time::SystemTime; use crate::core::*; pub fn help() -> String { " pwd : Print working directory ls : Print files located in the working directory cd : Change working directory up : Upload file to server down : Download file from server mkdir ...
use num::cast::NumCast; use num::Float; use num::Integer; use num::Num; use num::{FromPrimitive, ToPrimitive, Zero}; use rand::distributions::{Distribution, Uniform}; use std::ops::{Add, Div}; use std::{convert::*, ops::Neg}; use std::{fmt::Debug, ops::Index}; use std::{iter::Sum, ops::DivAssign}; pub struct RandGener...
use crate::utils::logging::debug_log_to_file; use ::std::fmt::{self, Debug, Display, Formatter}; pub const EMPTY_TERMINAL_CHARACTER: TerminalCharacter = TerminalCharacter { character: ' ', styles: CharacterStyles { foreground: Some(AnsiCode::Reset), background: Some(AnsiCode::Reset), st...
use crate::core::colour_models::*; use crate::core::traits::PixelBound; use ndarray::prelude::*; use ndarray::s; use num_traits::cast::{FromPrimitive, NumCast}; use num_traits::Num; use std::marker::PhantomData; /// Basic structure containing an image. #[derive(Clone, Eq, PartialEq, Hash, Debug)] pub struct Image<T, C...
extern crate serde; extern crate thiserror; extern crate vm_memory; use vm_memory::{ Address, GuestAddress, GuestMemory, GuestMemoryMmap, GuestMemoryRegion, GuestRegionMmap, MemoryRegionAddress, }; use thiserror::Error; /// Trait meant for triggering the DMA mapping update related to an external /// device n...
use std::io::BufReader; use std::io::BufRead; fn main() { let array = ["c=", "c-", "dz=", "d-", "lj", "nj", "s=", "z="]; let mut alphabat = String::new(); let mut rd = BufReader::new(std::io::stdin()); rd.read_line(&mut alphabat).unwrap(); for i in array.iter() { alphabat = alphabat.rep...
// All the events that will be used use bitflags::bitflags; use std::sync::mpsc::{Receiver, Sender}; use tuikit::key::Key; pub type EventReceiver = Receiver<(Key, Event)>; pub type EventSender = Sender<(Key, Event)>; #[derive(Debug, Clone, Hash, PartialEq, Eq)] pub enum Event { EvInputKey(Key), EvInputInvali...
use std::collections::{HashMap, HashSet}; pub fn anagrams_for<'a>(word: &str, possible_anagrams: &[&'a str]) -> HashSet<&'a str> { // unimplemented!( // "For the '{}' word find anagrams among the following words: {:?}", // word, // possible_anagrams // ); let lower_word = word.to_l...
pub mod asynt; pub mod lex; pub mod tab; pub mod three_a;