text
stringlengths
8
4.13M
extern crate chrono; extern crate itertools; extern crate regex; extern crate structopt; use chrono::prelude::*; use itertools::Itertools; use regex::Regex; use std::error::Error; use std::io; use std::io::prelude::*; use structopt::StructOpt; /// Get a time slice of a log #[derive(StructOpt, Debug)] #[structopt(name...
use crate::css::{Unit, Value}; use crate::layout::entity::Dimensions; use crate::layout::layout_box::LayoutBox; impl<'a> LayoutBox<'a> { // widthは親コンポーネントから計算可能だが、高さは子要素の合計値に左右される pub fn layout_block(&mut self, containing_block: Dimensions) { // widthは親のコンポーネントから計算できる self.set_block_width(conta...
mod navbar; mod product_card; pub use navbar::nav_bar; pub use product_card::product_card;
use async_trait::async_trait; use chrono::{DateTime, Utc}; use crate::{ model::{Items, Result}, ItemId, OpenItem, }; pub mod in_memory; pub mod postgres; pub type Repository = Box<dyn IRepository + Send + Sync + 'static>; #[async_trait] pub trait IRepository { async fn get_items( &self, ...
use crate::custom_types::exceptions::{index_error, value_error}; use crate::custom_types::join_values; use crate::custom_types::list::List; use crate::custom_types::range::Range; use crate::custom_var::{downcast_var, CustomVar}; use crate::int_var::{normalize, IntVar}; use crate::looping::{self, TypicalIterator}; use c...
use std::thread; use std::time::Duration; use std::sync::mpsc; use std::sync::Mutex; pub fn main() { let handle = thread::spawn(|| { for i in 1..10 { println!("hi number {} from the spawned thread!", i); thread::sleep(Duration::from_millis(1)); } }); for i in 1..5 {...
use std::collections::HashMap; trait Product { fn use_product(&self, s: String); fn create_clone(&self) -> Box<Product>; } struct Manager { showcase: HashMap<String, Box<Product>>, } impl Manager { fn new() -> Manager { Manager { showcase: HashMap::new(), } } fn r...
use super::database::{create_kv_db, create_sql_db}; use crate::{ _utils::error::BootError, account::repository::AccountRepository, ai::service::AIService, auth::service::AuthService, config::service::ConfigService, email::service::EmailService, post::repository::PostRepository, search::service::SearchService, s...
use actix_web::http::StatusCode; use mocks; use serde_json::{json, Value}; use shakesemon::Pokemon; #[actix_rt::test] async fn success_responses() { // Arrange let _pokeapi_mocks = mocks::pokeapi::Mocks::start().await; let _translation_mocks = mocks::translation::Mocks::start().await; let address = sp...
use std::fs; use std::io::prelude::*; use std::net::{TcpListener, TcpStream}; const GET:&[u8; 16] = b"GET / HTTP/1.1\r\n"; const STATUS_OK:&str = "HTTP/1.1 200 OK"; const STATUS_ERROR:&str = "HTTP/1.1 404 NOT FOUND"; fn main() { let listener = TcpListener::bind("127.0.0.1:8080").unwrap(); for stream in liste...
use std::io::{Stdout, Write}; use termion::cursor::Goto; use termion::raw::RawTerminal; pub type Term = RawTerminal<Stdout>; pub fn clear_screen(stdout: &mut Term) { write!(stdout, "{}", termion::clear::All).unwrap(); } pub fn goto(stdout: &mut Term, x: u16, y: u16) { write!(stdout, "{}", Goto(x, y)).unwrap(...
trait HasArea { fn area(&self) -> f64; } struct Circle { x: f64, y: f64, r: f64, } impl HasArea for Circle { fn area(&self) -> f64 { 3.14 * self.r * self.r } } struct Square { x: f64, y: f64, side: f64 } impl HasArea for Square { fn area(&self) -> f64 { s...
// brain teaser: given a sorted int array with repeated numbers and a digit K, what's the most // efficient way of determining the number of times K appears in the array fn occurances_of_k(array: &[u32], k: u32) -> u32 { let m = binary_search(array, k); if array[m] != k { return 0; } let (low,...
use clap::Shell; include!("src/cli.rs"); fn main() { let mut app = cli_app(); let home_dir = match dirs::home_dir() { Some(home_dir) => home_dir, None => { println!("Couldn't resolve home directory for completions when building cli"); std::process::exit(1); } ...
use std::{borrow::Borrow, collections::BTreeSet, fmt, ops::Deref}; use crate::utils::{apply::*, joined_by::*}; /// Обобщённое выражение. Обобщённость нужна для возможности как задать положения в парсинге, так и для возмоности задания обычного выражения. Была выбрана такая обобщённость вместо копипасты данной структур...
use std::sync::Arc; use itertools::izip; use crate::prelude::*; use super::utils::*; use crate::camera::Camera; use crate::math::*; use crate::sampler::Sampler; use crate::scene::Scene; use crate::bxdf::TransportMode; use crate::spectrum::utils::*; use super::{ ParIntegratorData, SamplerIntegrator }; pub struct Norma...
use nom; use std::fs::File; use std::io::BufReader; use std::io::Read; pub fn demo() { let f : File = File::open("png_example.png").expect("Could not open example file"); let mut reader = BufReader::new(f); let mut bytes : Vec<u8> = vec![]; let _ = reader.read_to_end(&mut bytes).expect("Could not rea...
use std::cell::RefCell; use std::collections::{HashMap, HashSet}; use std::io::{BufRead, BufReader, Cursor}; use std::rc::Rc; use criterion::{criterion_group, criterion_main, Criterion}; use differential_dataflow::input::Input; use differential_dataflow::operators::{Iterate, Join, Threshold}; use hydroflow::hydroflow_...
use std::cell::RefCell; use std::collections::BTreeMap; use std::rc::Rc; struct Scope<T> { data: BTreeMap<String, T>, parent: Option<PScope<T>>, root: Option<PScope<T>>, } impl<T> Scope<T> { fn new() -> Self { Self { data: BTreeMap::new(), parent: None, root...
use super::{osgood, Local, Valuable, V8}; pub struct FunctionCallbackInfo { info_: *const V8::FunctionCallbackInfo, } impl FunctionCallbackInfo { pub fn new(info_: *const V8::FunctionCallbackInfo) -> FunctionCallbackInfo { FunctionCallbackInfo { info_ } } pub fn length(&self) -> i32 { ...
use postgres::{Client, NoTls}; pub fn get_event_store_db_connection() -> Result<Client, postgres::Error> { Client::connect( crate::SECRETS .get("event_store_connection_string") .map_or(&"", |s| &s), NoTls, ) } pub fn get_user_query_db_connection() -> Result<Client, postgres::Error> { Client::connect( c...
use hpdf_sys::{ HPDF_Doc, HPDF_Page }; use paper::{ Page }; use ffi; use std::cell::{ RefCell, RefMut }; pub struct Document { handle: HPDF_Doc, pages: RefCell<Vec<HPDF_Page>> } impl Document { pub fn new() -> Result<Document, String> { let handle = ffi::hpdf_new(); ...
use crate::prelude::*; use super::{ TextureMapping2d, Mapping2d }; use crate::interaction::SurfaceInteraction; pub struct UvMapping2d { pub su: Float, pub sv: Float, pub du: Float, pub dv: Float, } impl TextureMapping2d for UvMapping2d { fn map(&self, si: &SurfaceInteraction<'_>) -> Mapping2d { ...
//! Restart of Interrupted Transfer (REST) //! To avoid having to resend the entire file if the file is only //! partially transferred, both sides need some way to agree on where in //! the data stream to restart the data transfer. //! //! See also: <https://cr.yp.to/ftp/retr.html> //! use crate::{ auth::UserDetai...
use super::*; use arbitrary::Arbitrary; #[derive(Arbitrary, Debug)] pub struct FromVecHarnessParams { edges: Vec<Result<StringQuadruple, String>>, nodes: Option<Vec<Result<(String, Option<String>), String>>>, directed: bool, ignore_duplicated_nodes: bool, ignore_duplicated_edges: bool, numeric_...
use rand::Rng; use std::{thread, time}; use std::vec::Vec; use ansi_escapes::*; // specific characters const GRID_SIZE: (usize, usize) = (52, 52); const PROBABILITY: f32 = 0.4; const FPS: f32 = 10.0; fn print_grid(grid_size: (usize, usize), grid: &Vec<Vec<char>>){ /* print the grid in the terminal input...
use hacl_star_sys as ffi; use crate::And; pub const KEY_LENGTH : usize = 32; pub const NONCE_LENGTH: usize = 12; pub const MAC_LENGTH : usize = 16; pub type ChaCha20Poly1305<'a> = And<&'a Key, &'a Nonce>; define!{ pub struct Key/key(pub [u8; KEY_LENGTH]); pub struct Nonce/nonce(pub [u8; NONCE_LENGTH]); } ...
use crate::bot::Bot; use crate::error::ApiResult; pub mod bot; pub mod error; pub mod method; pub mod typing; pub trait TelegramApiMethod: serde::Serialize { const METHOD : &'static str; type Response: serde::de::DeserializeOwned; fn get_method(&self) -> &'static str { Self::METHOD } }
pub(crate) mod dns_seeding; pub(crate) mod dump_peer_store; pub(crate) mod outbound_peer; pub(crate) mod protocol_type_checker;
fn main() { println!("Hello, world!"); // ERROR:"cannot assign twice to immutable variable" // let message = "hello"; // message = "world"; // println!("{}",message); //--------------------- // mutable variables can be assigned twice let mut number = 34; number = 06; println!("...
/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under both the MIT license found in the * LICENSE-MIT file in the root directory of this source tree and the Apache * License, Version 2.0 found in the LICENSE-APACHE file in the root directory * of this source tree. */ //! M...
use std::collections::HashSet; use svm_types::{SectionKind, Template, TemplateAddr}; /// `Env` storage serialization types use crate::env::ExtAccount; /// Serializing an [`Template`] into its binary representation. pub trait TemplateSerializer { #[allow(missing_docs)] fn serialize(template: &Template) -> Vec...
// Copyright 2021 Red Hat, 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 i...
#![allow(clippy::inline_always)] #![allow(clippy::needless_pass_by_value)] #[cfg(test)] mod benchmark { use crate::ebr; use crate::{HashIndex, HashMap, TreeIndex}; use std::collections::hash_map::RandomState; use std::hash::{BuildHasher, Hash}; use std::sync::atomic::AtomicUsize; use std::sync...
// Copyright (C) 2015-2021 Swift Navigation Inc. // Contact: https://support.swiftnav.com // // This source is subject to the license found in the file 'LICENSE' which must // be be distributed together with this source. All other rights reserved. // // THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ...
#[derive(Serialize,Deserialize, PartialEq,Eq, Debug)] struct CrateName { name: Option<String>, done: bool, } #[derive(Serialize,Deserialize,PartialEq,Eq, Debug)] pub struct Manager { list: HashMap<u32, CrateName>, achivement: u32, obtain_file: String, number_of_crate: u32, }
//! An easy to use library for pretty print tables of Rust `struct`s and `enum`s. //! //! The library supports different approaches of table building. //! You can use [`Tabled`] trait if the data type is known. //! Or you can use [`Builder`] to construct the table from scratch. //! //! ## Usage //! //! If you want to b...
use chatbox_lib::ChatBox; use futures::executor; use tokio::stream::{Stream, StreamExt}; use tokio::stream::iter; mod reader; use stream_u8_lib::StreamReader; fn main() { let vector = vec![1,2,3]; let cb = ChatBox::<String>::new(); let stream_ft = async { let mut stream = StreamReader::<u32>::...
#[doc = r" Value read from the register"] pub struct R { bits: u32, } #[doc = r" Value to write to the register"] pub struct W { bits: u32, } impl super::ALTPADCFGC { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
#[path = "config/dynamic.rs"] mod dynamic; #[path = "config/dependent.rs"] mod dependent; #[path = "config/static_config.rs"] mod static_config; struct Cleanup; impl Cleanup { fn new() -> Self { std::fs::copy( "tests/temp/example_config.json", "tests/temp/example_config.json.back...
#[macro_use] extern crate rustlearn; fn main() { let value = fmt!(100); println!("{}", value); }
use problem::{Problem, solve}; struct Day10; impl Problem for Day10 { type Input = Vec<i32>; type Part1Output = u32; type Part2Output = u64; type Error = (); fn part_1(input: &Self::Input) -> Result<Self::Part1Output, Self::Error> { let mut sorted = input.clone(); sorted.push(0); ...
use std::net::{TcpListener}; use std::{thread}; use std::sync::mpsc::channel; use std::env; extern crate byteorder; extern crate toml; extern crate serde_derive; extern crate serde_json; extern crate crc; mod housekeeping; mod payload; mod flag; mod telemetry; mod config; use config::Config as Config; mod spacepacket...
#![feature( proc_macro_diagnostic, proc_macro_quote, proc_macro_span, proc_macro_hygiene )] extern crate proc_macro; use proc_macro::{ quote, Delimiter, Diagnostic, Ident, Level, Literal, Punct, Spacing, Span, TokenStream, TokenTree, }; use std::convert::Into; use std::iter::FromIterator; fn g...
//! Utility functions and data type definitions pub mod hasher; pub mod keys; pub mod permissions;
extern crate crossbeam; extern crate pipeline; extern crate time; use pipeline::queue::multiqueue::{MultiReader, MultiWriter, multiqueue}; use crossbeam::scope; use std::sync::atomic::{AtomicUsize, Ordering, fence}; use std::sync::Barrier; //prevent any inlining shenanigans #[inline(never)] fn precise_time_ns() -> ...
extern crate advent_of_code_2018; extern crate combine; use advent_of_code_2018::Mat; use combine::*; use combine::parser::char::{char, spaces}; use combine::parser::range::take_while1; use combine::stream::state::State; use std::io::{self, Read}; use std::collections::BTreeSet; struct Claim { id: usize, x:...
use std::sync::Arc; use lambda_http::http; use tracing::info; use tracing::instrument; use htsget_http::{post as htsget_post, Endpoint, PostRequest}; use htsget_search::htsget::HtsGet; use crate::handlers::handle_response; use crate::{Body, Response}; /// Post request reads endpoint #[instrument(skip(searcher))] pu...
use std::collections::HashMap; // bringing HashMap into scope // we can provide new names //use std::fmt::Result; //use std::io::Result as ioResult; use rand::Rng; /* this is ugly use std::cmp::Ordering; use std::io; */ //better use std::{cmp::Ordering, io}; //fn function1() -> Result {} // this returns a Res...
// Copyright (C) 2021 Subspace Labs, Inc. // 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 // // http://www.apache.org/licenses/LICENSE-2.0 // // Unle...
#[macro_use] extern crate failure; extern crate glob; #[macro_use] extern crate log; extern crate loggerv; extern crate serde_json; extern crate tera; use failure::Error; use glob::glob; use serde_json::Value; use std::{fs::File, path::Path}; use tera::Tera; pub fn parse_data_file<P: AsRef<Path>>(path: &P) -> Result<...
use ress::prelude::*; use walkdir::WalkDir; use std::{env::args, fs::read_to_string}; fn main() { let mut args = args(); let _ = args.next(); let start = args .next() .expect("No directory provided as starting location."); println!("static REGEXES: &[&str] = &["); let mut set = std...
use super::manager::{TemplateManager, TemplateManagerError}; use super::template::Template; #[cfg(feature = "provider-jolimail")] pub mod jolimail; pub mod local; const CONFIG_TEMPLATE_PROVIDER: &'static str = "TEMPLATE_PROVIDER"; #[derive(Clone, Debug)] pub enum TemplateProviderError { ConfigurationInvalid(Stri...
#![warn(unused_crate_dependencies)] #![warn(clippy::pedantic)] #![warn(clippy::cargo)] #![allow(clippy::module_name_repetitions)] use heroku_nodejs_utils::package_json::{PackageJson, PackageJsonError}; use layers::{ManagerLayer, ShimLayer}; use libcnb::build::{BuildContext, BuildResult, BuildResultBuilder}; use libcnb...
use super::*; use std::hash::{Hash, Hasher}; impl Hash for RsDict { fn hash<H: Hasher>(&self, state: &mut H) { self.iter().for_each(|x| x.hash(state)); } }
#![allow(dead_code)] /// 基本数据类型 /// bool pub fn learn_bool() { println!("------------------------"); let x = true; let y: bool = !x; // 取反 let z = x && y; // 逻辑与,短路 println!("{}", z); let z = x || y; // 逻辑或,短路 println!("{}", z); let z = x & y; // 按位与,不带短路 println!("{}", z); ...
// Copyright 2015-2018 Parity Technologies (UK) Ltd. // This file is part of Parity. // Parity is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any lat...
//! # MountainCar //! //! Currently there are two versions of MountainCar. //! One with a discrete action space and one with a continuous one. //! //! ## Discrete version //! //! The description on the OpenAI page reads: //! //! > *&ldquo;A car is on a one-dimensional track, positioned between two "mountains". The goal...
//! 7. 整数反转 //! https://leetcode-cn.com/problems/reverse-integer pub struct Solution; impl Solution { pub fn reverse(x: i32) -> i32 { let mut x = x; let mut rev = 0; while x != 0 { let pop = x % 10; x /= 10; if (rev > i32::max_value() / 10) || (rev == i3...
/* Copyright ⓒ 2016 rust-custom-derive contributors. Licensed under the MIT license (see LICENSE or <http://opensource.org /licenses/MIT>) or the Apache License, Version 2.0 (see LICENSE of <http://www.apache.org/licenses/LICENSE-2.0>), at your option. All files in the project carrying such notice may not be copied, m...
#[doc = r"Register block"] #[repr(C)] pub struct DOEP0 { #[doc = "0x00 - OTG_HS device control OUT endpoint 0 control register"] pub ctl: CTL, _reserved1: [u8; 0x04], #[doc = "0x08 - OTG_HS device endpoint-0 interrupt register"] pub int: INT, _reserved2: [u8; 0x04], #[doc = "0x10 - OTG_HS de...
mod tools; mod car; extern crate nalgebra as na; use ggez::graphics; use ggez::{Context, GameResult}; use ggez::event::{self, KeyCode, KeyMods}; use na::Point2; use car::Car; struct MainState { car: Car, } impl MainState { fn new(_ctx: &mut Context) -> GameResult<MainState> { let s = MainState { ...
#[doc = "Register `CFGR3` reader"] pub type R = crate::R<CFGR3_SPEC>; #[doc = "Register `CFGR3` writer"] pub type W = crate::W<CFGR3_SPEC>; #[doc = "Field `EN_VREFINT` reader - VREFINT enable and scaler control for COMP2 enable bit"] pub type EN_VREFINT_R = crate::BitReader<EN_VREFINT_A>; #[doc = "VREFINT enable and sc...
use hacspec_lib::prelude::*; mod test_util; use test_util::*; macro_rules! test_unsigned_public_macro { ($t:ty) => { assert_eq!(<$t>::max_val(), <$t>::max_value() as $t); assert_eq!((3 as $t).exp(5), 243); // assert_eq!((3 as $t).pow_self(5), 243); // ... }; } #[test] fn test_u...
use std::mem; use stdweb::Value; use shared::Note; use misc::{SerialNumber}; use data::{State, DragType}; use draw::{PIXELS_PER_SEMITONE, PIXELS_PER_TIME}; pub struct NoteDrawingInfo <'a> { pub drag_type: Option <DragType>, pub state: & 'a State, } pub struct EditedNote { pub note: Note, pub serial_number:...
// https://projecteuler.net/problem=22 /* Using names.txt (right click and 'Save Link/Target As...'), a 46K text file containing over five-thousand first names, begin by sorting it into alphabetical order. Then working out the alphabetical value for each name, multiply this value by its alphabetical position in the l...
// use std::fs::File; // use std::io::ErrorKind; // fn main() { // let f = File::open("hello.txt"); // let f = match f{ // Ok(file) => file, // Err(ref error) if error.kind() == ErrorKind::NotFound => { // match File::create("hello.txt"){ // Ok(fc) => fc, // ...
pub mod status { use macros::Packet; #[derive(Packet)] #[packet(0x00, crate::STATUS_STATE, false)] pub struct Response { pub json: String } #[derive(Packet)] #[packet(0x01, crate::STATUS_STATE, false)] pub struct Pong { pub payload: i64 } } pub mod login { use ...
use actix_web::{web, HttpRequest, HttpResponse, Responder}; use publishing::application::collection::{ AddPublication, Create, CreateCommand, Delete, GetAll, GetById, RemovePublication, Update, UpdateCommand, }; use crate::authorization::auth; use crate::container::Container; use crate::error::PublicError; /...
use std::fmt; /// Returns the relevant network error if a program fails. pub type NetResult<T> = std::result::Result<T, NetError>; /// An enum representing the main network errors. #[derive(Debug, Copy, Clone)] pub enum NetError { OperationFailed, ConnectFailed, ConnectTimeout, ChannelStopped, Cha...
#[doc = "Register `SECCFGR2` reader"] pub type R = crate::R<SECCFGR2_SPEC>; #[doc = "Register `SECCFGR2` writer"] pub type W = crate::W<SECCFGR2_SPEC>; #[doc = "Field `TIM8SEC` reader - TIM8SEC"] pub type TIM8SEC_R = crate::BitReader; #[doc = "Field `TIM8SEC` writer - TIM8SEC"] pub type TIM8SEC_W<'a, REG, const O: u8> ...
pub mod delete_step_page; pub mod create_step_page; pub mod update_step_page; pub mod read_step_page; pub use crate::http::delete_step_page::delete_step_page; pub use crate::http::create_step_page::create_step_page; pub use crate::http::update_step_page::update_step_page; pub use crate::http::read_step_page::read_step...
use clap::{load_yaml, App}; use edit_distance::edit_distance; use itertools::Itertools; use std::{cmp::max, fmt, fs, io, path::Path}; fn main() -> io::Result<()> { let yaml = load_yaml!("../cli.yml"); let matches = App::from_yaml(yaml).get_matches(); let eol = matches.value_of_lossy("linesep").unwrap(); ...
// All credit for this code goes to https://dev.to/rpalo/comment/ig0e use std::fs; use std::ops::Add; use std::iter::FromIterator; use std::collections::{HashMap, HashSet}; #[derive(Debug, PartialEq, Eq, Hash, Copy, Clone)] struct Coordinate { x: isize, y: isize, } impl Coordinate { pub fn new(x: isize...
use std::f32; use std::f32::consts::PI; use std::ops::Mul; use crate::vector::Vector3; use crate::camera::Camera; pub struct Matrix4 { pub cells: [[f32; 4]; 4], } macro_rules! matrix { [ $x:expr ] => (Matrix4 { cells: [[$x; 4]; 4] }); [ $a00:expr, $a01:expr, $a02:expr, $a03:expr; $a10:expr, $a11:exp...
use crate::delay::Delay; use crate::lowpass::OnePoleLPF; pub struct LPFCombFilter { delay: Delay, lowpass: OnePoleLPF, g: f64, } impl LPFCombFilter { pub fn new(delay_length: usize, g: f64, sample_rate: f64, cutoff: f64) -> LPFCombFilter { LPFCombFilter { delay: Delay::new(delay_le...
/* * 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 * file at the top-level directory of this distribution. * * Licensed u...
//! Types for the mutator to use to build data structures use std::cell::Cell; use std::mem::transmute; use std::ops::{Deref, DerefMut}; use std::ptr::{null, null_mut}; use std::raw::TraitObject; use std::sync::atomic::{AtomicPtr, Ordering}; use std::thread; use constants::{INC_BIT, JOURNAL_BUFFER_SIZE, NEW_BIT, TRA...
use std::{borrow::Cow, collections::HashMap}; use serde::Serialize; #[derive(Debug, Copy, Clone, Serialize, Eq, PartialEq, Hash)] pub(crate) struct SharedStringIndex(pub(crate) usize); pub(crate) type SharedString = Cow<'static, str>; #[derive(Default, Serialize)] pub(crate) struct SharedStrings { pub(crate) st...
#![no_main] #[macro_use] extern crate libfuzzer_sys; extern crate seq_io; #[macro_use] extern crate matches; use std::io::prelude::*; use std::io; use seq_io::fasta::{self, Record}; #[macro_use] mod common; fuzz_target!(|data: &[u8]| { // determine reader capacity (max: 65 KiB) if data.len() < 2 { r...
use std::pin::Pin; use std::task::{self, Poll}; use bytes::Bytes; use destream::en::{self, IntoStream}; use futures::ready; use futures::stream::{Fuse, FusedStream, Stream, StreamExt, TryStreamExt}; use pin_project::pin_project; use crate::constants::*; use super::{Encoder, JSONStream}; use futures::task::Context; ...
#![allow(non_snake_case)] use clear_on_drop::clear::Clear; use core::mem; use curve25519_dalek::ristretto::{CompressedRistretto, RistrettoPoint}; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::{Identity, MultiscalarMul}; use merlin::Transcript; use super::{ ConstraintSystem, LinearCombination...
#[doc = "Reader of register DDRPHYC_DCR"] pub type R = crate::R<u32, super::DDRPHYC_DCR>; #[doc = "Writer for register DDRPHYC_DCR"] pub type W = crate::W<u32, super::DDRPHYC_DCR>; #[doc = "Register DDRPHYC_DCR `reset()`'s with value 0x0b"] impl crate::ResetValue for super::DDRPHYC_DCR { type Type = u32; #[inli...
use crate::system::interface::ProcessId; use super::SignalNumber; /// Information related to the arrival of a signal. #[repr(transparent)] pub(crate) struct SignalInfo { info: libc::siginfo_t, } impl SignalInfo { pub(super) const SIZE: usize = std::mem::size_of::<Self>(); /// Returns whether the signal ...
use vendored_ripemd160::{Digest, Ripemd160}; pub use crate::Hash; pub type RIPEMD160 = Ripemd160; pub const BLOCK_SIZE: usize = 64; pub const SIZE: usize = 20; impl Hash for RIPEMD160 { fn size() -> usize { Ripemd160::output_size() } fn block_size() -> usize { BLOCK_SIZE } fn r...
// Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT // Doesn't run these unless feature specified #![cfg(feature = "serde_tests")] use address::Address; use encoding::{from_slice, to_vec}; use forest_message::UnsignedMessage; use hex::encode; use serde::Deserialize; use std::fs::File; use ...
#[doc = "Register `UR14` reader"] pub type R = crate::R<UR14_SPEC>; #[doc = "Register `UR14` writer"] pub type W = crate::W<UR14_SPEC>; #[doc = "Field `D1STPRST` reader - D1 Stop Reset"] pub type D1STPRST_R = crate::BitReader; #[doc = "Field `D1STPRST` writer - D1 Stop Reset"] pub type D1STPRST_W<'a, REG, const O: u8> ...
use core::fmt; use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; use super::TICKS_PER_SECOND; #[derive(Debug, Default, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] #[cfg_attr(feature = "defmt", derive(defmt::Format))] /// Represents the difference between two [Instant](struct.Instant.h...
/* * Copyright (c) 2017 Boucher, Antoni <bouanto@zoho.com> * * 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,...
//! Structs and methods for working with **moving** `Hittable` spheres. use crate::{ aabb::AABB, hittable::{get_sphere_uv, HitRecord, Hittable}, material::Material, ray::Ray, vec3, vec3::Vec3, }; use std::sync::Arc; /// A linearly-moving sphere. Will move from `center0` at `time0` to `center1`...
use crate::segment::{Segment, Start}; use core::{cmp::Ordering, fmt::Debug, ops::Bound}; /// Wrapper type for items the map (range should only ever be increasing) #[derive(Clone)] pub(crate) struct Key<T>(pub(crate) Segment<T>); impl<T: Clone> Key<&T> { pub(crate) fn cloned(&self) -> Key<T> { Key(self.0.c...
use super::memory::{ MemoryMap, Version }; use super::InfocomError; use super::state::FrameStack; use super::object_table::ObjectTable; use super::text::{ Decoder, Encoder }; use super::interface::{ Interface, StatusLineFormat }; use super::dictionary::Dictionary; use log::debug; use serde::{ Serialize }; use std::col...
pub struct PpuStatus { // 1: VBlank clear by reading this register pub vblank_flag: bool, // 1: sprite hit pub sprite_hit: bool, // 0: less than 8, 1: 9 or more pub sprite_overflow: bool, } impl PpuStatus { pub fn new() -> Self { PpuStatus { vblank_flag: false, ...
fn main() { let mut x; let mut y; x = y = "hello world"; // x : (), y : int println!("{:?} {:?}", x, y); y = "world"; println!("{} {}", x, y) }
mod utils; use wasm_bindgen::prelude::*; use js_sys::Array; use serde::ser::{Serialize, Serializer, SerializeStruct}; use std::cmp; extern crate web_sys; // A macro to provide `println!(..)`-style syntax for `console.log` logging. macro_rules! log { ( $( $t:tt )* ) => { web_sys::console::log_1(&format!( ...
pub mod char; pub mod scan_iter; pub use scan_iter::CmpType; pub use scan_iter::Newline; pub use scan_iter::ScanIter;
#[doc = "Register `EXTICR2` reader"] pub type R = crate::R<EXTICR2_SPEC>; #[doc = "Register `EXTICR2` writer"] pub type W = crate::W<EXTICR2_SPEC>; #[doc = "Field `EXTI0_7` reader - GPIO port selection"] pub type EXTI0_7_R = crate::FieldReader<EXTI0_7_A>; #[doc = "GPIO port selection\n\nValue on reset: 0"] #[derive(Clo...
pub enum SnakeError { OutOfBounds, EatSelf, }
//! Traits and types for decoding CBOR. //! //! This module defines the trait [`Decode`] and the actual [`Decoder`]. mod decoder; mod error; pub use decoder::{Decoder, Probe}; pub use decoder::{ArrayIter, BytesIter, MapIter, StrIter}; pub use error::Error; /// A type that can be decoded from CBOR. pub trait Decode<'...
#![doc = "generated by AutoRust 0.1.0"] #![allow(unused_mut)] #![allow(unused_variables)] #![allow(unused_imports)] use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub mod operations { use crate::models::*; use reqwest::StatusCode; use snafu::{ResultExt, Snafu}; pub async f...