text
stringlengths
8
4.13M
use proconio::{fastout, input}; #[fastout] fn main() { input! { k: i64, }; let kk = if k % 7 == 0 { k * 9 / 7 } else { k * 9 }; let mut ans = -1; let mut temp = 1; for i in 1..=9000_000 { temp = temp * 10 % kk; if temp == 1 { ans = i; break; ...
use serde::{Deserialize, Serialize}; use planetr::wasm::Context; use planetr::wasm::PlanetrError; #[derive(Deserialize, Serialize)] pub struct InputPayload { // Define input payload JSON structure HERE name: String, } #[derive(Deserialize, Serialize)] pub struct OuputPayload { // Define output payload JSO...
// https://doc.rust-lang.org/stable/rust-by-example/error/multiple_error_types/boxing_errors.html type Er = Box<dyn std::error::Error>; #[derive(Debug)] struct CustomError; impl std::fmt::Display for CustomError { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { write!(f, "custom error...
use libc::{c_char, c_uint, c_ulong, c_void, size_t, ssize_t, time_t}; use H5Ipublic::hid_t; use H5public::{H5_ih_info_t, H5_index_t, H5_iter_order_t, haddr_t, herr_t, hsize_t, htri_t}; #[derive(Clone, Copy, Debug)] #[repr(C)] pub enum H5O_type_t { H5O_TYPE_UNKNOWN = -1, H5O_TYPE_GROUP, H5O_TYPE_DATASET, ...
#![no_std] #![no_main] use core::panic::PanicInfo; use cortex_m_rt::{entry, exception}; use stm32f7::stm32f7x6::{CorePeripherals, Peripherals}; use stm32f746g_disc::{ gpio::{GpioPort, OutputPin}, init, system_clock::{self, Hz}, }; #[entry] fn main() -> ! { let core_peripherals = CorePeripherals::take(...
pub mod cr1 { pub mod arpe { pub fn get() -> u32 { unsafe { (core::ptr::read_volatile(0x40001400u32 as *const u32) >> 7) & 0x1 } } pub fn set(val: u32) { unsafe { let mut reg = core::ptr::read_volatile(0x40001400u32 as *con...
use pairing::{Engine, Field, PrimeField, CurveAffine, CurveProjective}; use crate::srs::SRS; use crate::utils::*; /// An additional elements in our shared information pub struct SrsPerm<E: Engine> { n: usize, p_1: E::G1Affine, p_2: Vec<E::G1Affine>, p_3: E::G1Affine, p_4: Vec<E::G1Affine>, } impl<...
// FIPS-180-2 compliant SHA-256 implementation // // The SHA-256 Secure Hash Standard was published by NIST in 2002. // <http://csrc.nist.gov/publications/fips/fips180-2/fips180-2.pdf> use cfg_if::cfg_if; use core::convert::TryFrom; cfg_if! { if #[cfg(all(any(target_arch = "x86", target_arch = "x86_64"), not(featu...
use num::{One, Zero}; use alga::general::{SubsetOf, SupersetOf, ClosedDiv}; use core::{Scalar, Matrix, ColumnVector, OwnedColumnVector}; use core::dimension::{DimName, DimNameSum, DimNameAdd, U1}; use core::storage::OwnedStorage; use core::allocator::{Allocator, OwnedAllocator}; use geometry::{PointBase, OwnedPoint};...
mod debug; mod rectangle; pub mod render_gl; pub mod resources; mod triangle; use debug::{failure_to_string, FPSCounter}; use failure; use nalgebra as na; use rectangle::Rectangle; use render_gl::ColorBuffer; use render_gl::Viewport; use resources::{Reloadable, ResourceWatcher, Resources}; use std::path::Path; use tri...
{ "id": "0296d855-e9da-49b3-a0bb-cd16a1d39758", "$type": "NestingPartResource", "NestingPart": { "$type": "NestingPart", "Part": { "$type": "NestingPart", "Part": { "$type": "NestingPart", "Part": { "$type": "Nesting...
/// An enum to represent all characters in the Wancho block. #[derive(Debug, Clone, Copy, Hash, PartialEq, Eq)] pub enum Wancho { /// \u{1e2c0}: '๐ž‹€' LetterAa, /// \u{1e2c1}: '๐ž‹' LetterA, /// \u{1e2c2}: '๐ž‹‚' LetterBa, /// \u{1e2c3}: '๐ž‹ƒ' LetterCa, /// \u{1e2c4}: '๐ž‹„' LetterDa, ...
#[doc = "Register `MEMRMP` reader"] pub type R = crate::R<MEMRMP_SPEC>; #[doc = "Register `MEMRMP` writer"] pub type W = crate::W<MEMRMP_SPEC>; #[doc = "Field `MEM_MODE` reader - Memory mapping selection"] pub type MEM_MODE_R = crate::FieldReader<MEM_MODE_A>; #[doc = "Memory mapping selection\n\nValue on reset: 0"] #[d...
/// Toy example of an actix-web server that has endpoints for hashing and verifying passwords extern crate actix_web; extern crate argonautica; extern crate dotenv; extern crate env_logger; #[macro_use] extern crate failure; extern crate futures; extern crate futures_cpupool; extern crate futures_timer; #[macro_use] ex...
use na::Vector2; pub fn vec_determinant(v1: &Vector2<f32>, v2: &Vector2<f32>) -> f32 { // |v1, v2| = (v1.x * v2.y) - (v2.x * v1.y) (v1.x * v2.y) - (v2.x * v1.y) }
use utils; pub fn problem_020() -> u32 { let n = 100; let mut fact: Vec<u32> = vec![1]; for i in 1..(n + 1) { fact = utils::scalar_multiply_digit_array(&fact[..], i); } fact.iter().fold(0, |a, &b| a + b) } #[cfg(test)] mod test { use super::*; use test::Bencher; #[test] ...
//! Test vectors from: https://datatracker.ietf.org/doc/html/rfc9058 aead::new_test!(kuznyechik, "kuznyechik", mgm::Mgm<kuznyechik::Kuznyechik>); aead::new_test!(magma, "magma", mgm::Mgm<magma::Magma>);
#![cfg_attr(not(feature = "std"), no_std)] // Make the WASM binary available. #[cfg(feature = "std")] include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs")); #[cfg(feature = "std")] /// Wasm binary unwrapped. If built with `BUILD_DUMMY_WASM_BINARY`, the function panics. pub fn wasm_binary_unwrap() -> &'static [u8] { ...
use std::fmt; use std::fmt::Display; use std::sync; use failure::{Backtrace, Context, Fail}; use crate::model::*; pub type Result<T> = ::std::result::Result<T, Error>; #[derive(Fail, Debug, Clone, PartialEq, Eq)] pub enum ErrorKind { #[fail(display = "io error")] Io, #[fail(display = "poisoned error: {}...
use futures::{Poll, Async}; use futures::stream::Stream; pub trait BorrowStream<'a> { /// The type of item this stream will yield on success. type Item; /// The type of error this stream may generate. type Error; fn poll(&'a mut self) -> Poll<Option<Self::Item>, Self::Error>; }
pub use sys;
/// Application config pub mod config; /// Application export pub mod http;
use std::io::Write; use std::mem; use std::net::{Ipv4Addr, Ipv6Addr}; use byteorder::{ByteOrder, WriteBytesExt}; use nom::*; use errors::{PcapError, Result}; use pcapng::options::{opt, parse_options, Opt, Options}; use pcapng::{Block, BlockType}; use traits::WriteTo; pub const BLOCK_TYPE: u32 = 0x0000_0001; pub con...
use specs::prelude::*; use std::{fs::File, io::BufWriter, iter::once}; use png::{Encoder, HasParameters}; use crate::components::{Image, Name, Frame}; pub struct ImageWriter; impl<'a> System<'a> for ImageWriter { type SystemData = ( ReadStorage<'a, Image>, ReadStorage<'a, Name>, ReadStorag...
use crate::component::{Component, Health, Position, Size}; use super::{store::EntityStore, Entity}; use _const::HEALTH; pub struct FactoryEntities { pub es: EntityStore, } #[allow(dead_code)] impl FactoryEntities { pub fn new() -> Self { let es = EntityStore::new(); FactoryEntities { es } ...
extern crate envconfig; #[macro_use] extern crate envconfig_derive; #[macro_use] extern crate failure; // when using Rust FFI wrapper // #[macro_use] // pub extern crate indyrs as indy; #[macro_use] extern crate lazy_static; // when using libindy = { git = "https://gitlab.com/PatrikStas/vdr-tools", rev = "1473cea" } #...
//! An animated solar system. //! //! This example showcases how to use a `Canvas` widget with transforms to draw //! using different coordinate systems. //! //! Inspired by the example found in the MDN docs[1]. //! //! [1]: https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API/Tutorial/Basic_animations#An_animat...
//! Cookie-related functionality for WebDriver. use serde::{Deserialize, Serialize}; use time::OffsetDateTime; use webdriver::command::WebDriverCommand; use crate::client::Client; use crate::error; /// Type alias for a [cookie::Cookie] pub type Cookie<'a> = cookie::Cookie<'a>; /// Representation of a cookie as [defi...
//! Entities related to users. pub mod current_user; pub use self::current_user::{CurrentUserEntity, CurrentUserRepository}; use crate::{ entity::{guild::GuildEntity, Entity}, repository::{ListEntitiesFuture, ListEntityIdsFuture, Repository}, utils, Backend, }; use twilight_model::{ id::{GuildId, Use...
use termion::event::Key; use termion::input::Keys; #[derive(PartialEq, Debug)] pub enum Action { HardExit, Up, Down, Left, Right, } pub fn to_action(c: Key) -> Option<Action> { match c { Key::Esc | Key::Ctrl('c') => Some(Action::HardExit), Key::Up | Key::Char('k') => Some(Act...
use crate::cmd::Cmd; use std::fmt::{Display, Error, Formatter}; impl Display for IOTCM { fn fmt(&self, f: &mut Formatter) -> Result<(), Error> { write!( f, "IOTCM {:?} {:?} {:?} {}", self.file, self.level, self.method, self.command ) } } /// How much highlig...
#[derive(Debug, PartialEq, Clone)] pub enum Error { // Illegal redeclaration of a name IllegalRedeclaration { name: String, }, // Name used before it was declared UndeclaredIdentifier { name: String, }, // Tried to declare a zero size variable DeclaredZeroSize { ...
use crate::token; use crate::token::Token; use std::iter::Peekable; use std::str::Chars; pub struct Lexer<'a> { input: Peekable<Chars<'a>>, } impl<'a> Lexer<'a> { pub fn new(input: &'a str) -> Lexer<'_> { Lexer{ input: input.chars().peekable(), } } pub fn next_token(&mut s...
#[macro_use] extern crate yew; mod stone; use stone::{Stone, State}; use yew::prelude::*; pub struct Game { // state: State } pub enum Msg { Reverse, } impl<CTX> Component<CTX> for Game { type Message = Msg; type Properties = (); fn create(_: Self::Properties, _: &mut Env<CTX, Self>) -> Self {...
#![cfg(feature = "std")] use tabled::{ grid::util::string::string_width_multiline, settings::{ formatting::{TabSize, TrimStrategy}, object::{Columns, Object, Rows, Segment}, peaker::{PriorityMax, PriorityMin}, width::{Justify, MinWidth, SuffixLimit, Width}, Alignment, Ma...
// Copyright 2018 Parity Technologies (UK) Ltd. // // Licensed under the Apache License, Version 2.0 or MIT license, at your option. // // A copy of the Apache License, Version 2.0 is included in the software as // LICENSE-APACHE and a copy of the MIT license is included in the software // as LICENSE-MIT. You may also ...
#[cfg(test)] mod tests { use rstate::*; use std::hash::Hash; #[test] fn hierarchical_lights_machine() { #[derive(Copy, Clone, Debug)] enum Action { Timer, PedestrianTimer, } #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] enum Red { ...
#[doc = "Reader of register IC_SDA_SETUP"] pub type R = crate::R<u32, super::IC_SDA_SETUP>; #[doc = "Writer for register IC_SDA_SETUP"] pub type W = crate::W<u32, super::IC_SDA_SETUP>; #[doc = "Register IC_SDA_SETUP `reset()`'s with value 0x64"] impl crate::ResetValue for super::IC_SDA_SETUP { type Type = u32; ...
use syn::{parse_quote, ItemImpl, ItemMod, ItemStruct, ItemType}; use super::context::Context; use crate::parse::channel::Channel; use crate::parse::process::Process; use crate::partition::Partition; impl Partition { pub fn gen_type_alias(&self) -> ItemType { let hyp_name = &self.hypervisor; parse_...
#[macro_use] extern crate graphplan; use graphplan::Proposition; use episodic::{StoryGenerator, Place, NarrativeArc}; fn main() { let init_state = hashset![ Proposition::from("ship enabled"), Proposition::from("in orbit"), Proposition::from("at alien planet"), ]; let place = Place...
#![no_std] #![cfg_attr(feature = "usb", feature(align_offset, ptr_offset_from))] pub extern crate embedded_hal as hal; pub use paste; #[cfg(feature = "samd21e18a")] pub use atsamd21e18a as target_device; #[cfg(feature = "samd21g18a")] pub use atsamd21g18a as target_device; #[cfg(feature = "samd21j18a")] pub use at...
use uuid::Uuid; use serde::{Serialize, Deserialize}; use actix_web::web::{Form}; use crate::additional_service::{id_default}; #[derive(Deserialize, Serialize)] pub struct User { pub uuid: Uuid, pub id: i32, pub login: String, pub pass: String, pub email: String, pub phone: String, pub name...
extern crate libc; use std::slice; use std::ffi::CStr; use libc::c_int; use libc::c_void; use libc::c_char; use libc::c_uint; #[link(name = "varnishapi")] extern { static VSL_tags: *const c_char; pub fn VSM_New() -> *const c_void; pub fn VSM_Delete(vd: *const c_void); pub fn VSM_Error(vd: *const c_void) -> * con...
use super::layers::*; use super::types::*; use crate::layers::loss_layer::*; use crate::layers::negativ_sampling_layer::*; use crate::util::*; // extern crate ndarray; use itertools::concat; use ndarray::{Array, Array1, Axis, Dimension, Ix2, Ix3}; use ndarray_rand::rand_distr::{StandardNormal, Uniform}; use ndarray_ran...
fn gnome_sort<T: PartialOrd>(a: &mut [T]) { let len = a.len(); let mut i: usize = 1; let mut j: usize = 2; while i < len { if a[i - 1] <= a[i] { // for descending sort, use >= for comparison i = j; j += 1; } else { a.swap(i - 1, i); ...
use sdl2::event::Event; use sdl2::keyboard::Keycode; use sdl2::video::{GLContext, GLProfile, Window}; use sdl2::{EventPump, Sdl}; pub struct Display { window: Window, event_pump: EventPump, pub is_closed: bool, // both below are just hold to keep context, since their Drop calls the Delete methods on C ...
#![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 ConfluentAgreementProperties { #[serde(default, skip_serializing_if = "Option::is_none")] pub publisher: Op...
/////////////////////////////////////////////////////////////////////////////// // // Copyright 2018-2019 Airalab <research@aira.life> // // 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...
// Copyright (c) The diem-devtools Contributors // SPDX-License-Identifier: MIT OR Apache-2.0 //! Stopwatch for tracking how long it takes to run tests. //! //! Tests need to track a start time and a duration. For that we use a combination of a `SystemTime` //! (realtime clock) and an `Instant` (monotonic clock). Once...
use crate::arena::{block, BlockMut, BlockRef}; use crate::libs::js_object::Object; use crate::libs::random_id::U128Id; use crate::libs::three; use std::rc::Rc; use wasm_bindgen::JsCast; pub mod camera; pub mod raycaster; pub mod table_object; pub mod texture_table; pub use camera::Camera; pub use raycaster::Raycaster...
// Copyright 2017 PingCAP, 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...
error_chain! { types { Error, ErrorKind, ResultExt, Result; } foreign_links { CString(::std::ffi::NulError); CStr(::std::ffi::FromBytesWithNulError); } errors { Hidapi(t: ::hidapi::HidError) { description("hidapi error") display("hidapi error...
// Copyright (c) 2018 Alexander Fรฆrรธy. All rights reserved. // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. use std::fmt; use expression::{Evaluate, Generator}; pub struct EllipticCurve { a: f64, b: f64, } impl EllipticCurve { pub fn new(a: f64, b:...
use std::io; use std::io::Read; use std::ptr; use rand::Rng; pub const FONTSET: [u8; 80] = [ 0xF0, 0x90, 0x90, 0x90, 0xF0, // 0 0x20, 0x60, 0x20, 0x20, 0x70, // 1 0xF0, 0x10, 0xF0, 0x80, 0xF0, // 2 0xF0, 0x10, 0xF0, 0x10, 0xF0, // 3 0x90, 0x90, 0xF0, 0x10, 0x10, // 4 0xF0, 0x80, 0xF0, 0x10, 0x...
use actix_web::{middleware, web, App, HttpServer}; use form_data::{Field, FilenameGenerator, Form}; use log::info; use pahkat_common::{database::Database, db_path}; use std::path::{Path, PathBuf}; use crate::config::TomlConfig; use crate::handlers::{ download_package, package_stats, packages_index, packages_index_...
use std::io::prelude::*; use std::fs::File; use std::error::Error; use std::io::BufReader; use std::cmp; fn main() { let reader = read_file("input.txt"); let result = parse(reader); println!("{}", result) } fn parse(reader: BufReader<File>) -> i32 { let mut total = 0; for line in reader.lines() {...
//! If+Else pairing ambiguous grammar. use gll_pg_core::*; use gll_pg_macros::gll; use logos::Logos; #[derive(Logos, Debug, Eq, PartialEq, Clone)] pub enum Token { End, #[error] Error, #[token(" ")] _Eps, #[token("if")] If, #[token("else")] Else, } #[derive(Default)] struct Parser...
/// Determine whether a sentence is a pangram. pub fn is_pangram(sentence: &str) -> bool { (b'a'..b'z').all(|c| sentence.to_lowercase().contains(c as char)) }
use std::{ fs::File, io, io::{ErrorKind, Read}, }; fn main() { let username = read_username_from_file_with_shortcut() .expect("Nรฃo consegui ler o nome do usuรกrio pelo arquivo"); println!("Nome do usuรกrio รฉ {:?}", username); } fn read_username_from_file_with_shortcut() -> Result<String, io...
use crate::*; pub(crate) struct KeyboardState { scankeys: [bool; 300], vkeys: [bool; 300], } impl KeyboardState { pub fn modifiers(&self) -> KeyboardModifiers { KeyboardModifiers { shift: self.vkeys[VirtualKey::LeftShift as usize] || self.vkeys[VirtualKey::RightShift as usize], ctrl: self.vkeys[Virtual...
mod errors; mod msg_type; mod notification; mod subscription_confirmation; pub use self::subscription_confirmation::SubscriptionConfirmation;
pub mod abortable; use std::future::Future; pub async fn retry<F, O, E>( fetch: impl Fn() -> F, retry: impl Fn(&E) -> bool, report: impl Fn(usize, E) -> E, limit: Option<usize> ) -> F::Output where F: Future<Output = Result<O, E>>, E: std::error::Error, { let mut attempt: usize = 1; loop { let result = fe...
// Copyright 2019 The xi-editor Authors. // // 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 ag...
#[doc = "Register `APB2LPENR` reader"] pub type R = crate::R<APB2LPENR_SPEC>; #[doc = "Register `APB2LPENR` writer"] pub type W = crate::W<APB2LPENR_SPEC>; #[doc = "Field `TIM1LPEN` reader - TIM1 clock enable during sleep mode Set and reset by software."] pub type TIM1LPEN_R = crate::BitReader; #[doc = "Field `TIM1LPEN...
fn main(){ //const are not the same as immutable //consts are always mutable //cannot do shadow const FHD_WIDTH : u32 = 1920; const BAD_PI : f32 = 22.0/7.0; println!("Full HD width is {}, Bad PI is {}", FHD_WIDTH, BAD_PI); }
use aoc_utils::read_file; use day03::Claim; use day03::CLAIM_REGEX; fn overlapped(a: &((i32, i32), (i32, i32)), b: &((i32, i32), (i32, i32))) -> bool { let a_w = a.0; let a_h = a.1; let b_w = b.0; let b_h = b.1; let x_axis_diff = if a_w >= b_w { b_w.1 >= a_w.0 } else { a_w.1 >...
use crate::wasm::il::{ exp::{Exp, ExpData, ExpList}, util::WasmType, }; pub fn print_exp(exp: &Exp) -> String { match &exp.data { ExpData::BinOp(oper, lhs, rhs) => format_args!( "({}.{} {} {})", exp.ty.to_string(), oper.to_string(&exp.ty), print_exp(l...
use super::codec::{self, types::AdsCommand, AdsPacket, AmsTcpHeader}; use actix::prelude::*; use futures::oneshot; use futures::sync::{mpsc, oneshot}; use futures::Future; use rand::{self, Rng}; use std::collections::HashMap; use std::io; use tokio_io::io::WriteHalf; use tokio_tcp::TcpStream; use ws_ads::AdsToWsMultipl...
pub fn encode_utf8(src: &[char]) -> Result<Vec<u8>, EncodeUtf8Error> { let mut result = Vec::new(); for (index, ch) in src.iter().enumerate() { if let Some(error_kind) = encode_char(*ch, &mut result) { return Err(EncodeUtf8Error { src, index, k...
extern crate term; use std::net::{ TcpListener, TcpStream, Shutdown }; fn main() { let listener = TcpListener::bind("127.0.0.1:8888") .expect("not bound"); let mut t = term::stdout().unwrap(); println!("127.0.0.1:8888 running"); for stream in listener.incoming() { ...
use serde::{Serialize, Deserialize, Serializer, ser::SerializeStruct}; use mongodb::bson::{oid::ObjectId, DateTime}; #[derive(Deserialize, Debug, Clone)] pub struct Podcast { pub _id: Option<ObjectId>, pub name: Option<String>, pub banner: Option<String>, pub url: Option<String>, pub duration: Opti...
use constants::*; use graphics::*; use opengl_graphics::{GlGraphics, OpenGL, Texture}; use piston::input::*; use random::MTRng32; use std::path::Path; pub struct Game { gl: GlGraphics, // OpenGL drawing backend. rand: MTRng32, // TODO other rng generator? cursor_position: (f64, f64), background: Image...
pub fn add_two(x: i32) -> i32 { x + 2 } #[cfg(test)] mod tests { use super::*; #[test] fn it_works_2() { assert_eq!(9, add_two(7)); } }
extern crate reqwest; mod keys; use reqwest::header::{HeaderMap, HeaderName, HeaderValue}; //use std::collections::HashMap; pub fn get_headermap() -> HeaderMap { let mut headers = HeaderMap::new(); let key_id = HeaderName::from_lowercase(b"apca-api-key-id").unwrap(); let sec_key = HeaderName::from_lowerca...
// Copyright ยฉ 2017, ACM@UIUC // // This file is part of the Groot Project. // // The Groot Project is open source software, released under the // University of Illinois/NCSA Open Source License. You should have // received a copy of this license in a file with the distribution. extern crate iron; use iron::prel...
// When multiple ownership is needed, `Rc` (Reference Counting) can be used. // `Rc` keeps track of the number of the references which means the number // of owners of the value wrapped inside an `Rc`. // // Reference count of an `Rc` increases by 1 whenever an `Rc` is cloned, // and decreases by 1 whenever one cloned...
use std::{fs::read_dir, path::PathBuf}; use anyhow::{Context, Result}; use mongodb::{gridfs::GridFsBucket, Client}; use crate::{ bench::{drop_database, Benchmark, DATABASE_NAME}, fs::open_async_read_compat, }; pub struct GridFsMultiUploadBenchmark { uri: String, bucket: GridFsBucket, path: PathBu...
use super::problem::Problem; #[allow(dead_code)] pub fn eddy<'a>() -> Problem<'a> { Problem::new(5, -2, -6, b"TTCATA", b"TGCTCGTA") } #[allow(dead_code)] pub fn lec_17_slide19<'a>() -> Problem<'a> { Problem::new(3, -1, -3, b"GTAC", b"GATCA") } #[allow(dead_code)] pub fn in_class_a<'a>() -> Problem<'a> { Problem::...
#[doc = "Reader of register STAT_CNTS"] pub type R = crate::R<u32, super::STAT_CNTS>; #[doc = "Reader of field `NUM_CONV`"] pub type NUM_CONV_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:15 - Current number of conversions remaining when in Sample_* states (note that in AutoZero* states the same down counter is ...
use std::io::{stdin, stdout, File}; use std::libc::{size_t, free, c_void}; use std::os::args; use std::path::Path; use std::ptr::null; use std::vec::raw::from_buf_raw; extern { fn skr_model(inp: *u8, inlen: size_t, outp: **u8, outlen: size_t, opts: *u32) -> size_t; fn skr_compress(mod...
mod args; mod checks; mod common; mod fixes; mod flags; mod options; mod output;
use structopt::StructOpt; use hash_storage::storage::Storage; use std::error::Error; use std::fs::File; use std::io; #[derive(StructOpt, Debug)] #[structopt(version = "1.0", author = "Shogo Takata")] struct Opts { #[structopt(short = "o", long = "out_dir")] out_dir: String, #[structopt(short = "i", long =...
use actix_web::{ HttpResponse, web, }; use super::super::{ service, request, response, }; pub fn index(payload: web::Query<request::designer::Index>) -> HttpResponse { let (domain_designer, total) = &service::designer::index( payload.page, payload.page_size, ); response:...
use anyhow::{Context, Result}; use std::path::PathBuf; use std::process::Command; /// Returns default path for scan results pub fn get_default_scan_path() -> Result<PathBuf> { Ok(dirs::home_dir() .context("Failed to get home directory")? .join(".rgit")) } /// Returns current git username pub fn ge...
mod hello; mod line; use v6_generics_do_not_use::Point; fn main() { hello::hw(); let p1 = Point::new(1.,1.); let p2 = Point::new(4.,5.); println!("dist = {}",line::dist(&p1,&p2)); local::do_thing(); } mod local { pub fn do_thing() { println!("thing done"); } }
use handlegraph::handle::NodeId; use rustc_hash::FxHashSet; use crate::geometry::*; use super::Node; pub struct Selection { bounding_box: Rect, nodes: FxHashSet<NodeId>, } impl Selection { pub fn singleton(node_positions: &[Node], node: NodeId) -> Self { let ix = (node.0 - 1) as usize; ...
#[doc = "Register `AHB3ENR` reader"] pub type R = crate::R<AHB3ENR_SPEC>; #[doc = "Register `AHB3ENR` writer"] pub type W = crate::W<AHB3ENR_SPEC>; #[doc = "Field `QSPIEN` reader - QSPIEN"] pub type QSPIEN_R = crate::BitReader; #[doc = "Field `QSPIEN` writer - QSPIEN"] pub type QSPIEN_W<'a, REG, const O: u8> = crate::B...
use crate::prelude::*; #[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord)] pub struct Range { from: u32, to: u32, } impl Debug for Range { fn fmt(&self, f: &mut Formatter) -> fmt::Result { write!(f, "{}..={}", self.from, self.to) } } pub fn pt1(mut ranges: Vec<Range>) -> Result<u32> { ...
extern crate iced; use iced::{button, Button, window, text_input, TextInput, Align, Column, Settings, Element, Text, Sandbox}; extern crate libloading as lib; extern crate server; use server::router::Router; use std::env; use std::net::TcpListener; use std::path::Path; use std::sync::mpsc; use std::sync:...
// This took a very long time to run. But it worked eventually... fn main() { let corridor = [0,0,0,0,0,0,0,0,0,0,0]; let mut a_room = Room::from(1, 2, true); let mut b_room = Room::from(2, 4, true); let mut c_room = Room::from(3, 6, true); let mut d_room = Room::from(4, 8, true); //let mut ...
use crate::ast::parser; use crate::ast::rules; use crate::ast::stack; use crate::utils; use crate::interpreter::environment; use crate::interpreter::types; #[allow(dead_code)] pub fn interpret(source_code: &str) -> (types::Type, utils::Shared<environment::Environment>) { interpret_rule(source_code, rules::chunk) ...
//! Rust pg_query &emsp; [![Build Status]][actions] [![Latest Version]][crates.io] [![Docs Badge]][docs] //! =========== //! //! [Build Status]: https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fpaupino%2Fpg_query%2Fbadge&label=build&logo=none //! [actions]: https://actions-badge.atrox.dev...
use anyhow::Result; use serde::{Deserialize, Serialize}; use sqlx::mysql::{MySqlPoolOptions, MySqlQueryResult}; use sqlx::{Connection, MySql, Pool, Transaction}; use std::collections::HashMap; use std::sync::Arc; use std::time::{Duration, SystemTime}; use tokio::sync::Mutex; type UserIdType = u32; #[derive(Serialize,...
fn main() { let input = std::fs::read_to_string("../input.txt").unwrap(); let max = input .split("\n") .filter(|f| !f.is_empty()) .map(|seat| { let mut rows = 0..128; for c in seat.chars() { let len = (rows.end - rows.start) / 2; le...
use super::bonuses::{LetterBonus, WordBonus}; use super::Tile; /// Describe a place on the `Board` /// /// Its structure is public. That means you don't want players to get /// access to it. #[derive(Debug, Clone)] pub struct Spot { /// It might have a tile on it pub tile : Option<Tile>, /// Some bonus app...
#[derive(PartialEq)] struct Foo { a: [[[u32; 4]; 8]; 32], } fn main() {} /* [2021-08-12T07:59:06Z ERROR viper::verifier] The verification aborted due to the following exception: java.lang.RuntimeException: Domain name Snap$Array$4$u32 not found in program. at scala.sys.package$.error(package.scala:27) ...
// cortex-m-quickstart build.rs // Copyright ยฉ 2017 Jorge Aparicio // Licensed under the Apache license v2.0, or the MIT license. // See https://github.com/japaric/cortex-m-quickstart for details. use std::env; use std::fs::File; use std::io::Write; use std::path::PathBuf; fn main() { // Put the linker script som...
#![cfg_attr(feature="clippy", feature(plugin))] #![cfg_attr(feature="clippy", plugin(clippy))] extern crate libc; mod hw_io; pub mod elev_io;
#![feature(custom_derive, plugin)] /* The fishermon strategy is setting up 2 nets both for buying and selling. * We start by delimiting a series of prices to serve as 'steps'. * Then we set up a strategy to take a stronger position at each step. * The progression of the orders to be placed can be either linear or ex...
use query_builder::{CombinableQuery, UnionQuery}; pub trait UnionDsl<U: CombinableQuery<SqlType = Self::SqlType>>: CombinableQuery { type Output: CombinableQuery<SqlType = Self::SqlType>; fn union(self, query: U) -> Self::Output; } impl<T, U> UnionDsl<U> for T where T: CombinableQuery, U: Combi...