text
stringlengths
8
4.13M
fn main() { let mut a = 1; for i in 0..=5 { a += i; } println!("{}", a); }
#![cfg_attr(feature="clippy", feature(plugin))] #![cfg_attr(feature="clippy", plugin(clippy))] #![feature(mpsc_select)] extern crate chrono; extern crate timer; extern crate elevator; use std::{thread, time}; use elevator::elevator_driver::elev_io::*; use elevator::elevator_fsm::elevator_fsm::*; use std::sync::mpsc...
use ash::version::EntryV1_0; use ash::{vk, Entry, Instance}; use std::{ ffi::{CStr, CString}, os::raw::{c_char, c_void}, }; use ash::extensions::ext::DebugUtils; #[allow(unused_imports)] use log::{debug, error, info, trace, warn}; #[cfg(debug_assertions)] pub const ENABLE_VALIDATION_LAYERS: bool = true; #[cf...
use std::fmt; /// `ResultInspector` makes it easier to examine the content of the `Result` object. #[allow(clippy::module_name_repetitions)] pub trait ResultInspector<T, E> { /// Do something with `Result`'s item, passing the value on. /// /// When using `Result`, you'll often chain several combinators tog...
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // # Nombre: Daniela Guadalupe Ramirez Castillo # // # Matricula: 170659 # // # Carrera: ITI ...
//! Sarkara is a Post-Quantum cryptography library. #[macro_use] extern crate arrayref; #[macro_use] extern crate failure; extern crate rand; extern crate seckey; extern crate dilithium; extern crate kyber; extern crate sparx_cipher; extern crate colm; extern crate norx; pub mod sign; pub mod kex; pub mod aead; pub m...
pub use self::mat2x2::*; pub use self::mat3x3::*; pub use self::mat4x4::*; pub mod mat2x2; pub mod mat3x3; pub mod mat4x4;
extern crate harust as haru; // use haru::paper::{ // Page, // Orientation // }; fn main() { let doc = haru::Document::new().ok().unwrap(); let has_doc = doc.has_handle(); println!("handle has a document: {}", has_doc); doc.add_page(); let name = "Prova.pdf"; doc.save_to_file(&name).o...
// pub mod ahci; // pub mod ata; pub mod pci;
use std::collections::HashMap; use errors::*; use ops::Op; use Model; use Node; use Plan; mod constants; mod types; pub mod prelude { pub use super::types::*; pub use super::Analyser; use Result; /// Attempts to unify two tensor facts into a more specialized one. pub fn unify(x: &TensorFact, y: ...
#![allow(non_snake_case)] #[macro_use] extern crate lazy_static; extern crate serde_json; extern crate vmtests; use serde_json::Value; use std::collections::HashMap; use vmtests::{load_tests, run_test}; lazy_static! { static ref TESTS: HashMap<String, Value> = load_tests("tests/vmBitwiseLogicOperation/"); } #[t...
// El discurso de Zoe // // Copyright (C) 2016 GUL UC3M // // 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 Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // // Th...
/// The representation of data, rows and columns of a [`Grid`]. /// /// [`Grid`]: crate::grid::iterable::Grid pub trait IntoRecords { /// A string representation of a [`Grid`] cell. /// /// [`Grid`]: crate::grid::iterable::Grid type Cell: AsRef<str>; /// Cell iterator inside a row. type IterCol...
use proconio::{fastout, input}; struct UnionFind { set: Vec<i64>, } impl UnionFind { fn new(n: usize) -> Self { let set: Vec<i64> = vec![-1; n]; Self { set } } fn root(&mut self, i: usize) -> usize { if self.set[i] < 0 { i } else { self.set[i] =...
extern crate bear_vm; mod cli; use bear_ass::Error; const USAGE: &str = "bear-ass v1.0\n\ \n\ USAGE: bear-ass in out\n"; fn main() { match cli::go() { Ok(()) => { std::process::exit(0); } Err(Error::Usage) => eprintln!("{}", USAGE), Err(error) => eprintln!("{:?}", err...
use crate::events::{queue_event, Event}; use crate::timer::ToTimerID; use crate::{ gpio::{GpioID, ToGpio}, timer::{Hertz, Timer}, }; use embedded_hal::timer::{Cancel, CountDown}; use stm32f1xx_hal::pac::{TIM1, TIM2, TIM3}; use stm32f1xx_hal::timer::CountDownTimer; use stm32f1xx_hal::{device::interrupt, gpio}; ...
use std::fs::File; use std::io::{Read, Write}; pub struct Form<'a> { pub boundary: &'a str, data: Vec<u8>, } impl<'a> Form<'a> { pub fn new() -> Self { Form { boundary: "-------------573cf973d5228", data: vec![], } } pub fn add_text(&mut self, name: &str, text: &str) { write!(&mut s...
#![allow(unused_variables)] #![allow(dead_code)] fn main() { match_intro(); match_nested_func_call(); match_with_option(); match_with_option_omit(); match_udline_placeholder(); } fn match_intro() { enum ZhCurrency { YiYuan, ShiYuan, WuShiYuan, YiBaiYuan, }...
use crate::error::{InternalError, ValueError}; use crate::parse::BinOpKind; use crate::scope::*; use crate::value::*; use crate::EvalError; use gc::{Finalize, Gc, GcCell, Trace}; use rnix::TextRange; use std::borrow::Borrow; use std::collections::HashMap; // Expressions like BinOp have the only copy of their Expr chil...
use core::position::{Size, HasSize}; use core::cellbuffer::CellAccessor; use ui::core::attributes::{HorizontalAlign, VerticalAlign}; use ui::core::frame::Frame; /// Widgets are the foundation of UI, all frontend objects inherit the widget /// type and are generalized through either the widget itself or a specialized /...
use std::fs::File; use std::io::prelude::*; use openssl::symm::{encrypt, decrypt, Cipher}; use rand::prelude::*; use base64::{encode, decode}; pub fn criptografar(s: &str, chave: &[u8; 32]) -> String { let cifra = Cipher::aes_256_ecb(); String::from_utf8_lossy(encode(&encrypt( cifra, chave,...
fn main() { println!("bkpr"); }
use clap::{App, Arg}; use temperature_converter::temperature_conversion::{ print_common_table, print_temperature_conversion, Temperature, }; fn main() -> Result<(), Box<dyn std::error::Error>> { let cli = App::new("Temperature Converter") .version("0.1.9") .author("Michael Berry <trismegustis@...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - SPI/I2S control register 1"] pub spi2s_cr1: SPI2S_CR1, #[doc = "0x04 - SPI control register 2"] pub spi_cr2: SPI_CR2, #[doc = "0x08 - Content of this register is write protected when SPI is enabled"] pub spi_cfg1: S...
// 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...
#![warn(future_incompatible, rust_2018_compatibility, rust_2018_idioms, unused)] #![warn(clippy::pedantic)] // #![warn(clippy::cargo)] #![allow(clippy::missing_errors_doc)] #![cfg_attr(feature = "strict", deny(warnings))] use crate::reactive::{react, Atom}; use std::{convert::TryInto, panic}; use wasm_bindgen::{prelud...
extern crate advent_support; extern crate regex; #[derive(Debug)] struct PasswordPolicy { min: i32, max: i32, letter: char, } #[derive(Debug)] struct PasswordAttempt { policy: PasswordPolicy, password: String, } #[derive(Debug)] struct PasswordAttempt2 { positions: Vec<i32>, letter: char,...
use nix::sys::epoll::*; use std::os::unix::io::RawFd; use std::time::Duration; type Result<T> = std::result::Result<T, nix::Error>; pub struct Muxer { epfd: RawFd, } pub struct MuxerEvents { buffer: [EpollEvent; 16], len: usize, index: usize, } pub struct MuxerEvent(EpollEvent); impl Muxer { p...
use super::{ExtractedLexicalGrammar, ExtractedSyntaxGrammar, InternedGrammar}; use crate::generate::grammars::{ExternalToken, Variable, VariableType}; use crate::generate::rules::{MetadataParams, Rule, Symbol, SymbolType}; use anyhow::{anyhow, Result}; use std::collections::HashMap; use std::mem; pub(super) fn extract...
use std::io::{Stdout, Write}; use termion::cursor::Goto; use termion::raw::RawTerminal; use termion::{color, style}; use crate::models::{Board, Coordinates}; pub struct BoardView { pub origin: Coordinates, model: Board, } impl BoardView { pub fn new(origin: Coordinates, model: Board) -> BoardView { ...
use super::ziggurat_tables; use rand::distributions::Open01; use rand::Rng; pub fn sample_std_normal<R: Rng + ?Sized>(rng: &mut R) -> f64 { #[inline] fn pdf(x: f64) -> f64 { (-x * x / 2.0).exp() } #[inline] fn zero_case<R: Rng + ?Sized>(rng: &mut R, u: f64) -> f64 { let mut x = 1.0...
//! options for aurora kernel syscalls use bitflags::bitflags; bitflags! { pub struct FutexOptions: u32 { const SHARE = 1; // only used for futex_block const TIMEOUT = 1 << 1; } } bitflags! { pub struct ReallocOptions: u32 { const READ = 1; const WRITE = 1 << 1; const EXEC = 1 << 2; const EXACT = 1...
/// An enum to represent all characters in the SupplementalMathematicalOperators block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum SupplementalMathematicalOperators { /// \u{2a00}: '⨀' NDashAryCircledDotOperator, /// \u{2a01}: '⨁' NDashAryCircledPlusOperator, /// \u{2a02}: '⨂' ...
use itertools::Itertools; use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::ops::*; pub struct Grid { size: u32, grid: Vec<bool>, } #[derive(Debug, Copy, Clone)] struct OrderedFloat(ordered_float::OrderedFloat<f64>); impl Hash for OrderedFloat { fn hash<H>(&self, state: &mut H) ...
// Find the two entries that sum to 2020; what do you get if you multiply them together? use std::fs; // read in the file // loop through each value // check if two entries give 2020 // if they do multiply them // else continue fn main() -> std::io::Result<()> { let file = fs::read_to_string("data.txt")?; le...
use std::mem; struct Point { x: f64, y: f64, } impl Point { fn display(&self) -> () { println!("Point x:{}; y:{};", self.x, self.y) } } fn origin() -> Point { Point {x: 0.0, y: 0.0} } pub fn run() { println!("\n====2.12 STUCK AND HEAP===="); let p1: Point = origin(); let mut...
use super::{chunk_header::*, chunk_type::*, *}; use crate::error_cause::*; use bytes::{Bytes, BytesMut}; use std::fmt; ///Operation Error (ERROR) (9) /// ///An endpoint sends this chunk to its peer endpoint to notify it of ///certain error conditions. It contains one or more error causes. An ///Operation Error is n...
extern crate meteor_virtualize; extern crate syn; extern crate synom; #[macro_use] extern crate quote; extern crate rustfmt_nightly as rustfmt; use meteor_virtualize::Virtualize; use quote::Tokens; fn formatting(input: &str) -> String { let string = input.to_string(); let config = rustfmt::config::Config::def...
extern crate structopt; #[macro_use] extern crate structopt_derive; extern crate nuc; use nuc::Number; use structopt::StructOpt; #[derive(StructOpt, Debug)] #[structopt(name = "nuc", about = "Converts numbers form one for to another")] struct Opt { /// Number to convert #[structopt(help = "Input numbers")] ...
mod arrays_slices; mod enums; mod pointers_ref; mod structs; mod tuples; pub fn main() { println!("------{} BEGIN------", file!()); tuples::main(); arrays_slices::main(); enums::main(); pointers_ref::main(); structs::main(); println!("------{} END------", file!()); }
use crate::chain::{ChainService, ForkChanges}; use crate::tests::util::gen_block; use ckb_chain_spec::consensus::Consensus; use ckb_core::block::Block; use ckb_core::extras::{BlockExt, DaoStats, DEFAULT_ACCUMULATED_RATE}; use ckb_db::memorydb::MemoryKeyValueDB; use ckb_notify::NotifyService; use ckb_shared::shared::Sha...
/* * Licensed to the Apache Software Foundation (ASF) under one * or more contributor license agreements. See the NOTICE file * distributed with this work for additional information * regarding copyright ownership. The ASF licenses this file * to you under the Apache License, Version 2.0 (the * "License"); you ...
//! `interactive_process` is a lightweight wrapper on [std::process] that provides //! an interface for running a process and relaying messages to/from it as //! newline-delimited strings over `stdin`/`stdout`. //! //! This behavior is provided through the [InteractiveProcess] struct, which //! is constructed with a [s...
//! Time abstractions //! To use these abstractions, first call `set_clock` with an instance of an [Clock](trait.Clock.html). //! mod duration; mod instant; mod traits; pub use crate::executor::timer::{with_timeout, Delay, Ticker, TimeoutError, Timer}; pub use duration::Duration; pub use instant::Instant; pub use trai...
/* * Datadog API V1 Collection * * Collection of all Datadog Public endpoints. * * The version of the OpenAPI document: 1.0 * Contact: support@datadoghq.com * Generated by: https://openapi-generator.tech */ /// AuthenticationValidationResponse : Represent validation endpoint responses. #[derive(Clone, Debug...
use modinverse::egcd; use std::env; use std::fs; fn one(time: &i128, buses: &Vec<&str>) { let buses: Vec<i128> = buses .into_iter() .filter_map(|bus| bus.parse::<i128>().ok()) .collect(); let res = buses .iter() .map(|bus_num| (bus_num, bus_num - (time % bus_num))) ...
use std::path::PathBuf; #[derive(Debug, Clone)] pub(super) struct Storage { root: PathBuf, }
use crate::libs::color::color_system; use isaribi::{ style, styled::{Style, Styled}, }; use kagura::prelude::*; use nusa::prelude::*; pub struct Props { pub variant: Variant, } pub enum Variant { Dark, Light, } impl std::fmt::Display for Variant { fn fmt(&self, f: &mut std::fmt::Formatter<'_>...
// Taken from https://github.com/superdump/bevy-hud-pass use bevy::{ prelude::*, render::{ camera::{ActiveCameras, Camera, PerspectiveProjection, VisibleEntities}, pass::{ LoadOp, Operations, PassDescriptor, RenderPassDepthStencilAttachmentDescriptor, TextureAttachment, ...
fn main(){ //tuples, can have many different types, fixed length, can be used to return more than one var from a function let tup : (i32, f64, u8, f32) = (500, 6.4, 1, 29.29); let tup2 = (1500, 4.3); println!("tup and tup2: {:?} {:?}", tup, tup2); //get individuals vars from tuples let(w, x, y,...
use anyhow::{anyhow, Result}; use async_std::fs::OpenOptions; use async_std::prelude::*; use async_std::net::{UdpSocket, TcpStream}; use async_std::task::block_on; use std::path::PathBuf; use std::net::SocketAddr; use std::sync::{mpsc, Mutex}; use std::time::{Duration, Instant}; use super::arg::SendArg; use super::curr...
use crate::data_order::DataOrder; use std::any::type_name; use std::fmt; use thiserror::Error; pub type Result<T> = std::result::Result<T, ConnectorXError>; pub type OutResult<T> = std::result::Result<T, ConnectorXOutError>; #[derive(Error, Debug)] pub enum ConnectorXOutError { #[error("File {0} not found.")] ...
use crate::nes::cpu::bus::CpuBus; use crate::nes::cpu::registers::Registers; use crate::nes::cpu::controller::Controller; use crate::nes::cpu::opecode::{Command, OPECODE_MAP, AddressingMode}; pub struct Calculator; impl Calculator { pub fn execute<T: CpuBus>(registers: &mut Registers, bus: &mut T) -> usize { ...
use crate::utils::hash; const BITS_PER_KEY: u8 = 10; const K: u8 = 6; // BITS_PER_KEY * ln(2) pub struct BloomFilter { array: Vec<u8>, } impl BloomFilter { pub fn new(n_keys: usize) -> Self { let bits = 64.max(BITS_PER_KEY as usize * n_keys); let bytes = (bits + 7) / 8; Self { ...
use std::fmt; #[derive(Clone, Copy)] pub(crate) enum Color { Black, White, } impl Color { pub(crate) fn rev(&self) -> Color { match self { Color::Black => Color::White, Color::White => Color::Black, } } pub(crate) fn sym(&self) -> &str { match self ...
// https://github.com/elliptic-email/rust-grpc-web/blob/master/examples/yew-wasm-client/src/main.rs mod components; mod state; pub mod quotes { include!(concat!(env!("OUT_DIR"), concat!("/chat.rs"))); } use components::app::App; use log::Level; use sycamore::template; fn main() { console_log::init_with_level(Level:...
use crate::blob::blob::Blob; use crate::xml::read_xml; use azure_core::headers::{date_from_headers, request_id_from_headers}; use azure_core::prelude::NextMarker; use azure_core::RequestId; use bytes::Bytes; use chrono::{DateTime, Utc}; use std::convert::TryFrom; #[derive(Debug, Clone, PartialEq)] pub struct ListBlobs...
// Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { failure::{Error, ResultExt}, fidl_fuchsia_bluetooth_le::{PeripheralMarker, PeripheralProxy}, fidl_fuchsia_bluetooth_test::HciEmulatorProx...
extern crate num; use num::*; fn main() { let mut x = 0.0; let e = eventListener{parameter: &x,event: event,callback: callback }; while true { x += 1.0; e.check(); } } fn callback(){ println!("Event happened"); } fn event<A: Float + >(val: &A) -> bool { match val { f6...
use std::{ fs::File, io::{self, Cursor, Read}, path::PathBuf, sync::Arc, }; use super::{ cert_resolver::CertResolver, rustls, untrusted, webpki, }; /// Not-yet-validated settings that are used for both TLS clients and TLS /// servers. /// /// The trust anchors are stored in PEM format...
use std::collections::HashMap; use regex::Regex; pub fn run() { let valid_passports = count_valid_passports(include_str!("input.txt")); println!("Day04 - Part 1: {}", valid_passports.0); println!("Day04 - Part 2: {}", valid_passports.1); } fn count_valid_passports(pp_str: &str) -> (i32, i32) { let pp...
#![allow(dead_code)] extern crate getopts; extern crate time; extern crate zip; mod appimage; mod bootstrap; mod util; use getopts::Options; use std::env; use std::io::stdout; fn print_help(options: &Options) { println!("{}", options.usage("Usage: appimagezip [OPTIONS] SOURCE")); } fn main() { let mut opti...
// Copyright 2017 Google Inc. All rights reserved. // // 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...
use std::sync::{Arc, Mutex}; use rustful::{Context}; use serde_json as json; use files::{LoadedFiles, LoadedFile}; use serve::api; use serve::api::ToAPIResult; #[derive(Serialize)] struct FileInfo { pub id: usize, pub filename: String, pub language: json::Value, } impl FileInfo { fn new(id: usize, ...
/* * 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. */ use bytes::BytesMut; use crate::gdbstub::commands::*; use crate::gdbstub::hex::*; #[derive(Partia...
use sdl2::keyboard::Keycode; pub const fn scan_key(keycode: Keycode) -> Option<usize> { match keycode { // numbers Keycode::Num1 => Some(0), Keycode::Num2 => Some(1), Keycode::Num3 => Some(2), Keycode::Num4 => Some(3), // letters Keycode::Q => Some(4), ...
use crate::{Bin, Boo, SBin, SStr, Str}; /// Borrowed-or-owned `Bin`. pub type BooBin<'a> = Boo<'a, [u8], Bin>; /// Borrowed-or-owned `SBin`. pub type BooSBin<'a> = Boo<'a, [u8], SBin>; /// Borrowed-or-owned `Str`. pub type BooStr<'a> = Boo<'a, str, Str>; /// Borrowed-or-owned `SStr`. pub type BooSStr<'a> = Boo<'a, str...
#[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub(super) mod mask_32; #[cfg(target_arch = "x86_64")] pub(super) mod mask_64; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub(super) mod vector_128; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub(super) mod vector_256; #[allow(unused_...
pub fn find_median_sorted_arrays(nums1: Vec<i32>, nums2: Vec<i32>) -> f64 { let (mut m, mut n) = (nums1.len(), nums2.len()); let (mut a, mut b) = (nums1, nums2); if m >= n { let tmp = a; a = b; b = tmp; m = a.len(); n = b.len(); } let mut min = 0; let mut ...
mod buckets; mod cache; pub mod commands; mod config; mod context; pub mod logging; mod redis_cache; mod stats; pub use cache::{Cache, CacheMiss}; pub use commands::{Command, CommandGroup, CommandGroups, CMD_GROUPS}; pub use config::{BotConfig, CONFIG}; pub use context::{ AssignRoles, Clients, Context, ContextData...
#[no_mangle] pub extern fn physics_single_chain_efjc_thermodynamics_isotensional_legendre_helmholtz_free_energy(number_of_links: u8, link_length: f64, hinge_mass: f64, link_stiffness: f64, force: f64, temperature: f64) -> f64 { super::helmholtz_free_energy(&number_of_links, &link_length, &hinge_mass, &link_stiff...
extern crate document; extern crate xpath; use std::collections::hashmap::HashMap; use document::{Document,ToAny}; use xpath::{XPathEvaluationContext,XPathFactory}; use xpath::expression::XPathExpression; fn main() { let mut args = std::os::args(); let arg = match args.remove(1) { Some(x) => x, ...
use crate::{ArgMatchesExt, Result}; use clap::{App, Arg, ArgGroup, ArgMatches}; use ronor::Sonos; pub const NAME: &str = "skip"; pub fn build() -> App<'static, 'static> { App::new(NAME) .about("Go to next or previous track in the given group") .arg(crate::household_arg()) .arg( Arg::with_name("NEX...
use super::prelude::*; use super::schema::executor_processor_bind; #[derive(Queryable, AsChangeset, Identifiable, Debug, Clone, Serialize, Deserialize)] #[table_name = "executor_processor_bind"] pub struct ExecutorProcessorBind { id: i64, name: String, group_id: i64, executor_id: i64, weight: i16,...
use super::{Open, Sink, SinkAsBytes, SinkError, SinkResult}; use crate::config::AudioFormat; use crate::convert::Converter; use crate::decoder::AudioPacket; use crate::{NUM_CHANNELS, SAMPLE_RATE}; use alsa::device_name::HintIter; use alsa::pcm::{Access, Format, Frames, HwParams, PCM}; use alsa::{Direction, ValueOr}; us...
use super::atom::slider; use super::molecule::color_pallet::{self, ColorPallet}; use crate::libs::color::Pallet; use isaribi::{ style, styled::{Style, Styled}, }; use kagura::prelude::*; use nusa::prelude::*; pub struct Props { pub default_selected: Pallet, pub direction: Direction, } #[derive(Clone, ...
// This file was generated by `cargo dev update_lints`. // Use that command to update this file and do not edit by hand. // Manual edits will be overwritten. pub(crate) static LINTS: &[&crate::LintInfo] = &[ #[cfg(feature = "internal")] crate::utils::internal_lints::almost_standard_lint_formulation::ALMOST_STA...
use super::board; const MAX_PLY: usize = 64; const MATE_SCORE: i32 = 10000; const MATE_IN_MAX_PLY: i32 = MATE_SCORE - MAX_PLY as i32; pub struct PrincipalVariation { moves: [Option<board::Move>; MAX_PLY], num_moves: usize, } impl PrincipalVariation { pub fn cleared() -> PrincipalVariation { Princ...
// Generated from vec.rs.tera template. Edit the template, not the generated file. use crate::{f64::math, BVec2, DVec3, IVec2, UVec2, Vec2}; #[cfg(not(target_arch = "spirv"))] use core::fmt; use core::iter::{Product, Sum}; use core::{f32, ops::*}; /// Creates a 2-dimensional vector. #[inline(always)] pub const fn dv...
//! BMP180 Digital pressure sensor. //! use embedded_hal::blocking::delay::DelayMs; use embedded_hal::blocking::i2c::{Read, Write, WriteRead}; use num_traits::Pow; // BMP180, BMP085 address. const BMP180_I2CADDR: u8 = 0x77; const BMP180_CAL_AC1: u8 = 0xAA; // R Calibration data (16 bits) const BMP180_CAL_AC2: u8 =...
use crate::utils::lines_from_file; use std::{time::Instant, vec}; pub fn main() { let start = Instant::now(); assert_eq!(part_1_test(), 820); // println!("part_1 {:?}", part_1()); println!("part_2 {:?}", part_2()); let duration = start.elapsed(); println!("Finished after {:?}", duration); } ...
use crate::crypto::hash; use crate::math::bytes_to_int; use crate::math::int_to_bytes; use std::convert::TryFrom; use std::convert::TryInto; use typenum::marker_traits::Unsigned; use types::beacon_state::BeaconState; use types::config::Config; use types::helper_functions_types::Error; use types::primitives::{Domain, D...
use super::super::atom::{ btn::{self, Btn}, common::Common, dropdown::{self, Dropdown}, fa, heading::{self, Heading}, slider::{self, Slider}, text::Text, }; use super::super::organism::{ popup_color_pallet::{self, PopupColorPallet}, room_modeless::RoomModeless, }; use super::ShowingM...
use reqwest::Client; use std::{ error::Error, io::{stdout, BufRead, BufWriter, Lines, Write}, sync::{mpsc::channel, Arc}, thread::{sleep, spawn}, time::Duration, }; pub struct Response { pub name: String, pub status: u16, } pub fn request_n<T, U>( lines: &mut Lines<T>, n: usize, ...
// HIGHLY INCOMPLETE!!! use super::animation::Curve; use util::cur::Cur; use util::view::Viewable; use util::fixed::fix16; use cgmath::{Matrix4, vec3}; use nitro::Name; use errors::Result; use super::info_block; /// Material animation. Does things like UV matrix animation. pub struct MaterialAnimation { pub name:...
//! The main Crochet interface. use std::collections::HashMap; use std::panic::Location; // The unused annotations are mostly for optional async. #[allow(unused)] use druid::{ExtEventSink, SingleUse, Target}; #[cfg(feature = "async-std")] use async_std::future::Future; use crate::any_widget::DruidAppData; #[cfg(fea...
use std::{collections::HashMap, fmt}; use serde::Serialize; use crate::{ bson::oid::ObjectId, client::options::ServerAddress, sdam::{ServerInfo, TopologyType}, selection_criteria::{ReadPreference, SelectionCriteria}, }; /// A description of the most up-to-date information known about a topology. Furt...
#[doc = "Register `CRCSADDR` reader"] pub type R = crate::R<CRCSADDR_SPEC>; #[doc = "Register `CRCSADDR` writer"] pub type W = crate::W<CRCSADDR_SPEC>; #[doc = "Field `CRC_START_ADDR` reader - CRC start address on bank 1"] pub type CRC_START_ADDR_R = crate::FieldReader<u32>; #[doc = "Field `CRC_START_ADDR` writer - CRC...
fn main() { let v: Vec<f64> = vec![0.0, 0.707, 1.0, 0.707]; let a: [f64; 4] = [0.0, -0.707, -1.0, -0.707]; let sv: &[f64] = &v; let _sa: &[f64] = &a; fn print(n: &[f64]) { for elt in n { print!("{} ", elt); } println!(""); } print(&v); // works on vector...
#[doc = "Register `CCR%s` reader"] pub type R = crate::R<CCR_SPEC>; #[doc = "Register `CCR%s` writer"] pub type W = crate::W<CCR_SPEC>; #[doc = "Field `DMAREQ_ID` reader - Input DMA request line selected"] pub type DMAREQ_ID_R = crate::FieldReader<DMAREQ_ID_A>; #[doc = "Input DMA request line selected\n\nValue on reset...
mod utils; extern crate rand; extern crate js_sys; use std; use rand::Rng; use js_sys::{Float32Array}; use wasm_bindgen::prelude::*; // #![feature(stdsimd)] // #![cfg(target_feature = "simd128")] // #![cfg(target_arch = "wasm32")] // When the `wee_alloc` feature is enabled, use `wee_alloc` as the global // allocator....
use quote::quote_spanned; use super::{ DelayType, FlowProperties, FlowPropertyVal, OperatorCategory, OperatorConstraints, OperatorWriteOutput, WriteContextArgs, RANGE_0, RANGE_1, }; /// Takes a stream as input and produces a sorted version of the stream as output. /// /// ```hydroflow /// source_iter(vec![2, ...
//! The module for the award struct. use crate::{ auth::Auth, client::{route::Route, Client}, error::Error, model::{misc::AwardSubtype, misc::AwardType, misc::Params}, }; use serde::{Deserialize, Serialize}; /// The struct representing an award. #[derive(Debug, Deserialize, Serialize, Clone)] pub stru...
use std::cmp::min; use std::fmt; use std::ops; type NumType = u32; type InputNumType = i32; #[derive(Clone, Copy, PartialEq, Eq)] struct Fraction { sign: bool, numerator: NumType, denominator: NumType, } fn xor(a: bool, b: bool) -> bool { !(a && b) && (a || b) } fn sgn(a: InputNumType) -> InputNumTyp...
/// SubmitPullReviewOptions are options to submit a pending pull review #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct SubmitPullReviewOptions { pub body: Option<String>, pub event: Option<String>, } impl SubmitPullReviewOptions { /// Create a builder for this object. #[inline] ...
use std::borrow::Cow; use std::error::Error; use std::future::Future; use std::io; /// Special LogWriter that writes commands in batches. /// Batching is both record count and timeout-based. use std::sync::Arc; use std::time::Duration; use crate::storage::{self, SimpleFileWALError}; use async_trait::async_trait; use f...
use std::sync::Arc; use axum::{extract::Path, Extension, Json}; use http::Response; use hyper::Body; use serde::Deserialize; use svc_utils::extractors::AccountIdExtractor; use uuid::Uuid; use crate::{ app::{ api::v1::AppResult, error::{Error as AppError, ErrorExt, ErrorKind}, metrics::Auth...
extern crate proc_macro; extern crate quote; use proc_macro::TokenStream; use proc_macro2::Span; use quote::quote; use syn::{parse_macro_input, DeriveInput}; macro_rules! span { () => {{ Span::call_site() }}; } #[derive(Debug, Clone)] struct GraphElt { ident: syn::Ident, node: syn::Ident, ...
// single tasking k-nucleotide import io::reader_util; use std; import std::map; import std::map::hashmap; import std::sort; // given a map, print a sorted version of it fn sort_and_fmt(mm: hashmap<[u8], uint>, total: uint) -> str { fn pct(xx: uint, yy: uint) -> float { ret (xx as float) * 100f / (yy as fl...
use serde::{Deserialize, Serialize}; pub use swc::config::Options; use swc::ecmascript::ast::Program; #[derive(Deserialize)] pub struct ParseArguments { pub src: String, pub opt: Option<ParseOptions>, } #[derive(Deserialize)] pub struct PrintArguments { pub program: Program, pub options: Options, } #...