text
stringlengths
8
4.13M
pub fn solution() -> String { let sum: u32 = (1..1000).filter(|n| n % 3 == 0 || n % 5 == 0).sum(); format!("{}", sum) }
// This file is part of Deeper. // Copyright (C) 2020-2021 Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http:...
extern crate mylib; use mylib::demo; pub fn main() { demo(); }
#![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 OperationList { #[serde(rename = "systemData", default, skip_serializing_if = "Option::is_none")] pub syste...
// Our use cases use std::path; use super::allocate; use super::expander; use super::decompressor; #[derive(Default)] pub struct RiffHeader { pub riff_signature: [char; 4], pub total_length: i32, pub wave_signature: [char; 8], pub format_ex_length: i32, pub format_tag: u16, pub channels: u16, ...
#[derive(Clone, Copy)] struct Point { x: f64, y: f64, } struct Rect { bl: Point, tr: Point, } struct Node { bb: Rect, children: Vec<Node>, level: u32, // 1 is leaf, increasing upward along the tree } struct RTree { root: Node, min_children: u32, max_children: u32, height: ...
use sys; use std::marker::PhantomData; use super::Ui; // TODO: Consider using Range, even though it is half-open #[must_use] pub struct SliderInt<'ui, 'p> { label: &'p str, value: &'p mut i32, min: i32, max: i32, display_format: &'p str, _phantom: PhantomData<&'ui Ui<'ui>>, } impl<'ui, 'p> S...
use termion::event::Key; use termion::cursor; use termion::clear; use std::io::Write; use std::str::from_utf8; pub struct Editor { pub buffer: Vec<String>, pub cursor_base: Point, // 1-indexed pub cursor_buf: Point, // 0-indexed yank: Option<String>, } pub enum EditResult { JustTailAdd(char), J...
use ggez::{ Context, GameResult, graphics, graphics::{ Color, Rect }, nalgebra::{ Vector2, Point2 }, input::mouse::MouseButton }; use crate::button::Button; use std::collections::HashMap; #[derive(PartialEq, Eq, Hash)] enum ButtonType { BackToGame, GiveUp } pub struct Pause { pause_ima...
// Copyright (c) 2018 King's College London // created by the Software Development Team <http://soft-dev.org/> // // The Universal Permissive License (UPL), Version 1.0 // // Subject to the condition set forth below, permission is hereby granted to any person obtaining a // copy of this software, associated documentati...
#![allow(dead_code)] mod url_parser; #[derive(Clone, Debug, PartialEq, Eq)] struct Element { name: String, attributes: Vec<(String, String)>, children: Vec<Element>, } fn the_letter_a(input: &str) -> Result<(&str, ()), &str> { match input.chars().next() { Some('a') => Ok((&input['a'.len_utf8(...
use std::fs; use std::collections::{HashSet, HashMap}; fn main() { // Read input from file let contents = fs::read_to_string("input.txt").expect("Failed reading input file"); let mut numbers: Vec<isize> = contents .lines() .filter_map(|x| x.parse().ok()) .collect(); numbers.sor...
use serenity::framework::standard::{Args, CommandError}; use serenity::model::channel::Message; use serenity::prelude::Context; use super::alias_from_arg_or_channel_name; use crate::db::{DbConnection, DbConnectionKey}; use crate::model::{GameServer, GameServerState, StartedState}; use crate::server::ServerConnection; ...
use std::sync::Arc; use std::task::{Context, Poll, Waker}; use parking_lot::{Mutex, RwLock}; /// A variable, shared between threads/tasks. When you read from this variable, you also /// implicitly register interest in future values of the variable as well, and the current /// task will be notified when the value chan...
use std::iter::*; #[derive(Serialize, Deserialize)] pub enum Direction { North, East, South, West, } impl Clone for Direction { fn clone(&self) -> Direction { match &self { Direction::North => Direction::North, Direction::East => Direction::East, Direction::South => Direction::South, ...
use actix_web::{http::StatusCode, HttpResponse, ResponseError}; use awc::error::{JsonPayloadError, SendRequestError}; use badgeland::{Badge, Icon}; use std::convert::TryFrom; use thiserror::Error; #[derive(Debug, Error)] pub enum BadgeError { #[error("HTTP Error: URL: {url:?} | Status Code: {status:#?} | Reason: {...
use crate::api::v1::api_instance::ApiInstance; use crate::api::v1::models::api_info::ApiInfo; use crate::api::v1::models::api_response::ApiResponse; #[derive(Debug, Serialize, Deserialize, Clone)] pub struct LoginWithEmailParams<'a> { pub email: &'a str, pub password: &'a str, } #[derive(Debug, Serialize, Des...
use std::{ marker::Unpin, ops::Range, pin::Pin, task::{Context, Poll}, }; use futures_util::{ future::{BoxFuture, FutureExt}, io::{AsyncRead, AsyncWrite, AsyncWriteExt}, }; use super::{options::GridFsDownloadByNameOptions, Chunk, FilesCollectionDocument, GridFsBucket}; use crate::{ bson::{...
#[derive(Clone)] pub struct JumpCodeInfo { inst: String, opcode: String, func_code: String, } impl JumpCodeInfo { pub fn new(inst: String, opcode: String, func_code: String) -> JumpCodeInfo { JumpCodeInfo { inst: inst, opcode: opcode, func_code: func_code, } } pub fn get_func_code(&self) -> String ...
use super::types::{ASTValue, ArithmeticOp, BinaryOp, LogicalOp, UnaryOp}; use crate::common::position::Span; use crate::lexer::parser::TokenType; use crate::{ast::main::AST, common::position::Location, lexer::parser::Token}; pub fn op_arithmetic(ast: &mut AST, left: Option<ASTValue>) -> ArithmeticOp { let le...
/* Copyright 2019-2023 Didier Plaindoux 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...
extern crate dprint_core; pub mod configuration; mod parsing; mod format_text; mod swc; mod utils; pub use format_text::format_text; #[cfg(feature = "tracing")] pub use format_text::trace_file; #[cfg(feature = "wasm")] #[cfg(all(target_arch = "wasm32", target_os = "unknown"))] mod wasm_plugin; #[cfg(feature = "was...
#[doc = "Register `EXTI_HWCFGR1` reader"] pub type R = crate::R<EXTI_HWCFGR1_SPEC>; #[doc = "Field `NBEVENTS` reader - NBEVENTS"] pub type NBEVENTS_R = crate::FieldReader; #[doc = "Field `NBCPUS` reader - NBCPUS"] pub type NBCPUS_R = crate::FieldReader; #[doc = "Field `CPUEVTEN` reader - CPUEVTEN"] pub type CPUEVTEN_R ...
use super::Cpu; use crate::address_bus::CpuAddressBus; // submodules used for improved readability inside of this module. // (everything is re-exported, so these are not visible to the outside) pub use abs::*; pub use abs_indexed::*; pub use imm::*; pub use indexed_indirect::*; pub use indirect_indexed::*; pub use zer...
//! Translation from LLVM IR to Cranelift IL. use cranelift_codegen; use cranelift_codegen::binemit::{NullTrapSink, NullStackmapSink}; use cranelift_codegen::ir; use cranelift_codegen::isa::TargetIsa; use cranelift_frontend; use libc; use llvm_sys::core::*; use llvm_sys::ir_reader::*; use llvm_sys::prelude::*; use llv...
use std::{io, result}; use thiserror::Error; /// The result type for config. pub type Result<T> = result::Result<T, Error>; /// The error type for config. #[derive(Error, Debug, PartialEq, Eq)] pub enum Error { #[error("io found: {0}")] IoError(String), #[error("failed to parse args found: {0}")] ArgParseEr...
mod paddle; pub use paddle::*; mod ball; pub use ball::*; use amethyst::{ assets::{ AssetStorage, Loader, Handle }, core::{ transform::Transform, timing::Time }, ecs::{ //Component, DenseVecStorage, Entity }, prelude::*, renderer::{ Camera, ImageFormat, SpriteRender, SpriteSheet, SpriteS...
/********************************************** > File Name : temp.rs > Author : lunar > Email : lunar_ubuntu@qq.com > Created Time : Sat 09 Apr 2022 08:26:04 PM CST > Location : Shanghai > Copyright@ https://github.com/xiaoqixian **********************************************/ struct T { ...
use clap::{App, Arg}; pub const TIME_FORMAT_DEFAULT: &str = "%I:%M %p"; pub fn build_cli() -> App<'static, 'static> { App::new(crate_name!()) .about(crate_description!()) .author(crate_authors!()) .version(crate_version!()) .arg( Arg::with_name("cwd-max-depth") ...
#[doc = "Reader of register TX_RX_ON_DELAY"] pub type R = crate::R<u32, super::TX_RX_ON_DELAY>; #[doc = "Writer for register TX_RX_ON_DELAY"] pub type W = crate::W<u32, super::TX_RX_ON_DELAY>; #[doc = "Register TX_RX_ON_DELAY `reset()`'s with value 0"] impl crate::ResetValue for super::TX_RX_ON_DELAY { type Type = ...
use arduino_uno::{ hal::port::{mode, portb::PB5, Pin}, pac::TC0, prelude::*, }; use avr_device::interrupt::{self, Mutex}; use core::cell::{Cell, RefCell}; const CPU_FREQ: u32 = 16_000_000; const PRESCALERS: &[u16; 5] = &[1, 8, 64, 256, 1024]; static LED: Mutex<RefCell<Option<PB5<mode::Output>>>> = Mutex:...
//! # Google Sign-In //! //! This crate provides an API to verify Google's OAuth client id tokens //! for use with Google is an authentication provider. //! //! Typically these tokens are generated by a web application using the //! [Google Platform Library](https://developers.google.com/identity/sign-in/web/sign-in). ...
extern crate chrono; use std::fs::File; use std::io::Write; use self::chrono::{DateTime, Local}; use askama::Template; use super::scan_host_interface::ScanHostInterface; #[derive(Default)] pub struct ScanReport { endpoint_reachable: bool, endpoint_reachable_using_nat_t: bool, scan_host_ifaces: Vec<ScanH...
mod util; #[allow(unused_imports)] use crate::util::{ StatefulList, TabsState, event::{ Event, Events }, }; #[allow(unused_imports)] use std::{error::Error, io}; #[allow(unused_imports)] use termion::{event::Key, input::MouseTerminal, raw::IntoRawMode, screen::AlternateScreen}; #[allow(unused_imports)] use ...
use rodio::source::SineWave; use rodio::Sink; use std::{time::Duration, thread}; /// /// Can play and stop something /// pub trait Playable { fn play(&mut self); fn stop(&mut self); } /// /// Can have a sound (SineWave) /// pub trait Soundable { fn get_sound(&mut self) -> u32; fn get_sink(&mut s...
#![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 HealthMonitorStateChangeList { #[serde(default, skip_serializing_if = "Vec::is_empty")] pub value: Vec<Heal...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - ADC interrupt and status register"] pub isr: ISR, #[doc = "0x04 - ADC interrupt enable register"] pub ier: IER, #[doc = "0x08 - ADC control register"] pub cr: CR, #[doc = "0x0c - ADC configuration register 1"] ...
// This file was generated by gir (https://github.com/gtk-rs/gir @ fbb95f4) // from gir-files (https://github.com/gtk-rs/gir-files @ 77d1f70) // DO NOT EDIT #[cfg(any(feature = "v2_40", feature = "dox"))] use Icon; #[cfg(any(feature = "v2_42", feature = "dox"))] use NotificationPriority; use ffi; #[cfg(any(feature = "...
use std::fmt; use std::fs; use super::stage1; #[derive(Debug)] pub struct Entry { pub file_name: String, pub level: u32, pub lines_proper: u32 } impl fmt::Display for Entry { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "[Stage2 file_name={}, level={}, lines_proper={}]", ...
pub mod util;
global_asm!(include_str!("boot.S")); global_asm!(include_str!("trap.S")); global_asm!(include_str!("usercopy.S")); #[macro_use] mod cpu_local; mod apic; mod backtrace; mod boot; mod bootinfo; mod gdt; mod idle; mod idt; mod interrupt; mod ioapic; mod paging; mod pit; mod profile; mod semihosting; mod serial; mod sysc...
fn is_vowel(c: u8) -> bool { match c { b'a' | b'e' | b'i' | b'o' | b'u' => true, _ => false, } } fn is_nice_1(s: &str) -> bool { let bytes = s.as_bytes().to_vec(); let mut vc = if is_vowel(bytes[0]) { 1 } else { 0 }; let mut twice = false; for window in bytes.windows(2) { ...
#![deny(bare_trait_objects)] #![feature(plugin)] #![plugin(rocket_codegen)] extern crate regex; extern crate time; extern crate rocket; extern crate dht22_pi; use std::io; use std::path::{Path, PathBuf}; use rocket::response::NamedFile; use std::collections::BTreeMap; use std::io::BufReader; use std::io::prelude::*...
use crate::{ parser::{CompletedMarker, ParseError, Parser}, syntax::{ SyntaxKind::{self, *}, TokenSet, }, }; pub mod expressions; pub mod items; pub mod patterns; pub mod types; pub fn source_file(p: &mut Parser) { let m = p.start(); items::module_contents(p); m.complete(p, S...
use specs::{Entities, Fetch, ReadStorage, System, WriteStorage}; use engine::components::{Attack, Death, Hp, UnitTypeTag}; use engine::resources::{DeltaT, UnitTypeMap}; #[derive(SystemData)] pub struct AttackSystemData<'a> { attack: WriteStorage<'a, Attack>, hp: WriteStorage<'a, Hp>, death: WriteStorage<'a...
use super::group_by::Folder; use serde_derive::{Deserialize, Serialize}; #[allow(dead_code)] #[derive(Debug, Eq, PartialEq)] pub enum Aggregator { Mean, Min, Max } impl Aggregator { fn seed_state(&self) -> State { match self { Aggregator::Mean => State::Mean { count: 0, sum: 0.0 }, ...
use std::collections::HashMap; use std::hash::Hash; use async_trait::async_trait; use tokio::sync::Mutex; use crate::cache::Cache; use crate::result::Result; #[derive(Default)] pub struct InMemCache<K, V> { data: Mutex<HashMap<K, V>>, } impl<K, V: Clone> InMemCache<K, V> { pub fn new() -> InMemCache<K, V> ...
use std::ffi::{CStr, CString}; use std::os::raw::c_char; use serde_json::{Value, json}; pub use stardog_function::*; #[no_mangle] pub extern fn evaluate(arg: *mut c_char) -> *mut c_char { let args_str = unsafe { CStr::from_ptr(arg).to_str().unwrap() }; let values: Value = serde_json::from_str(args_str).unwr...
use std::fs::File; File::open("__rust-script-this-file-does-not-exist.txt")?;
const fn foo() {} fn main() {} /* thread 'rustc' panicked at 'attempted to read from stolen value', /rustc/8007b506ac5da629f223b755f5a5391edd5f6d01/compiler/rustc_data_structures/src/steal.rs:37:21 stack backtrace: 0: std::panicking::begin_panic 1: prusti_interface::environment::Environment::local_mir 2: pru...
use event_sauce::{prelude::*, AggregateCreate, DBEvent, Event, Persistable}; use event_sauce_storage_sqlx::{SqlxPgStore, SqlxPgStoreTransaction}; // use event_sauce::UpdateEntity; use sqlx::PgPool; use uuid::Uuid; #[derive( serde_derive::Serialize, serde_derive::Deserialize, sqlx::FromRow, event_sauce_...
use components::{entity::Entity, game::*, settings_loader::*}; use consts::{SCREEN_HEIGHT, SCREEN_WIDTH}; mod components; mod consts; mod physics; mod types; fn main() { if !check_settings() { create_settings(); } let mut game_settings = GameSettings { resolution: (SCREEN_WIDTH, SCREEN_HE...
use crate::{ ast_types::{ ast_base::AstBase, boxed_val::BoxedValue, expression::Expression, }, primitive_values::{ pointer::Pointer, primitive_base::PrimitiveValueBase, string::StringVal, }, runtime::{ downcast_val, value_to_string, ...
//! Cell representations. /// Trait that should be implemented to represent cells. /// /// This crate provides SimpleCell as a default implementation. pub trait Cell: Default + Clone { /// Returns if the Cell is alive. fn is_alive(&self) -> bool; /// Turns the Cell alive. fn spawn(&mut self); /// K...
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. //! Contains STARK proof struct and associated components. use crate::{ProofOptions, TraceInfo}; use core::cmp; use fri::FriProof; use ma...
use actix_web::{App, HttpServer, web}; use cache::storage; use std::io; //todo: is it not possible encapsulate ethe cache logic? async fn put(data: web::Data<storage::Memory>) -> String { data.data.write().unwrap().insert(String::from("foo"), String::from("bar")); String::from("OK") } async fn fetch(data: we...
use parking_lot::ReentrantMutex; use crate::{Interface, Main, Resource}; mod client; mod display; mod globals; mod resource; pub(crate) use self::client::ClientInner; pub(crate) use self::display::DisplayInner; pub(crate) use self::globals::GlobalInner; pub(crate) use self::resource::ResourceInner; lazy_static::laz...
use super::error::{ArrayIndexError, ParseErrorReport, ParserError}; use crate::debug; use crate::query::{JsonPathQuery, JsonPathQueryNode, JsonPathQueryNodeType, JsonString, NonNegativeArrayIndex}; use nom::{branch::*, bytes::complete::*, character::complete::*, combinator::*, multi::*, sequence::*, *}; use std::{ ...
use open_recipe_format::*; #[test] fn test_deserialize() { let recipe_text = r#" recipe_name: Giving an Apple to a Friend ingredients: - apple: amounts: - amount: 1 unit: each steps: - step: Give an apple to a...
pub mod directions; pub mod snake; pub mod sphere;
use currency::offers::Offer; use exonum::crypto::{PublicKey, Hash}; #[derive(Debug, Eq, PartialEq)] pub struct CloseOffer { pub wallet: PublicKey, pub price: u64, pub amount: u64, pub tx_hash: Hash, } encoding_struct! { #[derive(Eq, PartialOrd, Ord)] struct Offers { price: u64, ...
use std::collections::HashMap; use dapr::proto::{common::v1 as common_v1, runtime::v1 as dapr_v1}; use crate::dapr::*; /// InvokeRequest is the message to invoke a method with the data. pub type InvokeRequest = common_v1::InvokeRequest; /// InvokeResponse is the response message inclduing data and its content type ...
#[macro_use] extern crate log; extern crate api_models as api; pub mod commands; pub mod common; pub mod data; pub mod handler; pub mod schema; pub mod tasks; #[macro_use] mod macros;
//! Utilities for strings. #![deny(clippy::pedantic, missing_debug_implementations, missing_docs, rust_2018_idioms)] use std::{borrow::Borrow, fmt}; pub use smol_str::SmolStr; /// An immutable, somewhat cheaply clone-able, non-empty string. #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Na...
use chrono::{DateTime, Utc}; use serde::{ de::{Error, Visitor}, Deserializer, }; use std::fmt; /// Serde visitor to deserialize Timestamp struct TimestampVisitor; pub fn deserialize<'de, D>(d: D) -> Result<DateTime<Utc>, D::Error> where D: Deserializer<'de>, { d.deserialize_str(TimestampVisitor) } im...
#[cfg(feature = "secure")] extern crate ftp; extern crate openssl; use ftp::FtpStream; use openssl::ssl::{ SslContext, SslMethod, SSL_OP_NO_SSLV2, SSL_OP_NO_SSLV3, SSL_OP_NO_COMPRESSION, }; fn main() { let mut builder = SslContext::builder(SslMethod::tls()).unwrap(); builder.set_certifica...
pub const TAB_SZ: usize = 4; use unicode_segmentation::GraphemeCursor; use unicode_segmentation::UnicodeSegmentation; #[derive(Debug, PartialEq)] pub struct Line { content: String, display: String, } impl Line { pub fn new(s: &str) -> Self { assert!( !s.contains('\n'), "A ...
use super::super::std; use std::fmt; use self::term::Term; use self::operator::Operator; use self::error::{EvalError, EvalErrorKind}; #[macro_use] mod error; mod operator; mod term; mod factor; mod integer; type Result<T> = std::result::Result<T, Box<std::error::Error>>; pub struct Expr { subexpr: Option<Box<Exp...
use crate::{ObjectType, Result, Schema, SubscriptionType}; use bytes::Bytes; use futures::channel::mpsc; use futures::task::{AtomicWaker, Context, Poll}; use futures::{Stream, StreamExt}; use slab::Slab; use std::collections::VecDeque; use std::future::Future; use std::pin::Pin; /// Use to hold all subscription stream...
//! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1732/invalid" #[allow(unused)] use super::rsass; // From "sass-spec/spec/libsass-closed-issues/issue_1732/invalid/mixin-def.hrx" // Ignoring "mixin_def", error tests are not supported yet.
//! A very simple actor for single writer principle. Not meant to be the fastest but for simplicity. use crate::queue::mpsc_queue::{MpscQueueReceive, MpscQueueWrap}; use async_trait::async_trait; use futures::channel::oneshot; use std::sync::atomic::AtomicU32; use std::sync::atomic::{fence, Ordering}; use std::sync::A...
use std::io::Error; use shell::Launcher; use state::State; #[derive(Debug)] pub struct Command { pub key: KeyCommand, pub state: String, pub current: State } impl Command { pub fn new(key: KeyCommand, current: State) -> Command { Self::new_with_state(key, current, String::default()) } ...
use crate::validator::error::ValidationError; #[derive(Debug, Default)] pub struct ValidationState { errors: Vec<ValidationError>, } impl ValidationState { pub fn new() -> ValidationState { ValidationState { errors: vec![] } } pub fn new_with_error(error: ValidationError) -> ValidationState {...
#[doc = "Reader of register RTC_RW"] pub type R = crate::R<u32, super::RTC_RW>; #[doc = "Writer for register RTC_RW"] pub type W = crate::W<u32, super::RTC_RW>; #[doc = "Register RTC_RW `reset()`'s with value 0"] impl crate::ResetValue for super::RTC_RW { type Type = u32; #[inline(always)] fn reset_value() ...
#[doc = "Register `HASH_HR6` reader"] pub type R = crate::R<HASH_HR6_SPEC>; #[doc = "Field `H6` reader - H6"] pub type H6_R = crate::FieldReader<u32>; impl R { #[doc = "Bits 0:31 - H6"] #[inline(always)] pub fn h6(&self) -> H6_R { H6_R::new(self.bits) } } #[doc = "HASH digest register 6\n\nYou c...
#[doc = "Register `CRH` reader"] pub type R = crate::R<CRH_SPEC>; #[doc = "Register `CRH` writer"] pub type W = crate::W<CRH_SPEC>; #[doc = "Field `SECIE` reader - Second interrupt Enable"] pub type SECIE_R = crate::BitReader<SECIE_A>; #[doc = "Second interrupt Enable\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug,...
use num::{BigInt, FromPrimitive}; use std::fs; fn main() { let file = fs::read_to_string("13_input.txt").unwrap(); let nums: Vec<BigInt> = file.split("\n") .map(|x| x.parse::<BigInt>().unwrap()) .collect(); let sum = nums.into_iter() .fold(BigInt::from_u8(0).unwrap(), |sum, x|...
pub mod components; pub mod entity_archetypes; pub mod executor; pub mod geometry; pub mod indices; pub mod init; pub mod map_generation; pub mod noise; pub mod pathfinding; pub mod prelude; pub mod scripting_api; pub mod storage; pub mod tables; pub mod terrain; mod intents; mod systems; mod utils; pub mod world; pu...
/* * 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 */ /// LogsListResponse : Response object with all logs matching the request and pagination information. ...
use sudo_test::{Command, Env, User}; use crate::{Result, PASSWORD, USERNAME}; #[test] fn it_works() -> Result<()> { let env = Env(format!("{USERNAME} ALL=(ALL:ALL) ALL")) .user(User(USERNAME).password(PASSWORD)) .build()?; // input valid credentials // invalidate them // try to sudo w...
use crate::ChainStore; use ckb_script_data_loader::DataLoader; use ckb_types::{ bytes::Bytes, core::{cell::CellMeta, BlockExt, EpochExt, HeaderView}, packed::Byte32, prelude::*, }; pub struct DataLoaderWrapper<'a, T>(&'a T); impl<'a, T: ChainStore<'a>> DataLoaderWrapper<'a, T> { pub fn new(source: ...
extern crate docopt; extern crate ndarray; extern crate rand; extern crate rustc_serialize; #[macro_use] extern crate qmc; use std::io::Write; use ndarray::prelude::*; use rand::Rng; use rand::distributions::{IndependentSample, Range}; use qmc::utils::*; const USAGE: &'static str = " Usage: markov [options] Optio...
//! A symbolic memory model. //! //! Each cell of `SymbolicMemory` is a valid `il::Expr`. Concrete values may be stored as //! `il::Constant`, and symbolic values stored as valid expressions. //! //! `SymbolicMemory` is paged under-the-hood with reference-counted pages. When these pages //! are written to, we use the c...
use std::env; use std::ffi::OsString; use pmv::{print_error, try_main}; fn main() -> Result<(), ()> { let args: Vec<OsString> = env::args_os().into_iter().collect(); if let Err(err) = try_main(&args[..]) { print_error(err); return Err(()); } Ok(()) }
use { smu_huffman::{compress, decompress}, std::{ env, fs, io::{self, prelude::*}, process, }, }; fn main() -> io::Result<()> { let mut args = env::args(); // Usage if args.len() != 4 { print_usage(); } let _exe_name = args.next().unwrap(); match &*...
use mem::Memory; use cpu::*; use std::io::SeekFrom; use std::io::prelude::*; use std::fs::File; use std::fs::OpenOptions; const DISKETTE_PARAMETERS_IRQ: u8 = 0x1E; const HDD_PARAMETERS_IRQ: u8 = 0x41; pub struct DisketteParameters { /* See INTERRUP.E for more details */ step_rate_hi_head_unload_time_lo: u8, head_l...
use std::mem; use std::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign}; ///テストしていないのでバグが含まれているかもしれない /// 負の数は例えば-6%MOD=-6になる /// MODは適宜調整する。 const MOD: isize = 1_000_000_007; #[derive(Clone, Copy)] pub struct Mint { x: isize, } impl Mint { pub fn new(x: isize) -> Self { Mint { x:...
pub mod cli_args; mod content_parser; mod quiz; mod regex_handle; mod request; #[cfg(feature = "emacs")] mod emacs_mode; pub use quiz::*; pub use request::set_token;
// This file is part of css-purify. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/css-purify/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distribut...
// use std::default; // #[derive(Debug,Default)] struct Stack<T> { values: Vec<T>, min_value: T, // min_value: Vec<usize> } // impl <T> Default for Stack<T> { // fn default() -> Stack<T> { Default::default()} // } impl <T: Ord + Clone + Default > Stack<T> { fn new() -> Stack<T> { Stack ...
use std::fs; use std::path::Path; use std::io::{ Read, Write }; use std::collections::HashMap; use serde::{ Serialize, Deserialize }; use crate::template; #[derive(Serialize, Deserialize, Debug)] pub struct Config { pub site_name: String, pub site_theme: String, pub site_author: String, pub site_description: S...
pub mod sustenance; pub mod sustenance_type; pub mod template; pub mod setting; mod date_format;
use std::io::Write; use env_logger::Builder; use log::Level; use log; use log::LevelFilter; use std::sync::Once; static TEST_LOGGER: Once = Once::new(); pub fn setup() { TEST_LOGGER.call_once(|| { // init_logger() env_logger::init(); }); } fn log_level_to_color(level: &Level) -> &'static str...
use crate::common::*; #[derive(StructOpt)] pub(crate) enum Opt { #[structopt(name = "generate", help = "update all reports")] Generate, #[structopt(name = "save", help = "save a generated report")] Save { #[structopt(long = "language")] language: Language, #[structopt(long = "version")] version...
use bevy::app::AppBuilder; use bevy::app::Plugin; #[derive(Clone, Eq, PartialEq, Debug, Hash)] pub enum GameState{ Menu, Playing, } pub struct GameStatePlugin; impl Plugin for GameStatePlugin{ fn build(&self, _app: &mut AppBuilder){ } }
use super::prelude::{ WNDPROC , ATOM }; pub type WindowProcedure = WNDPROC; pub type Atom = ATOM;
// Problem 5 - Smallest multiple // // 2520 is the smallest number that can be divided by each of the numbers from 1 // to 10 without any remainder. // // What is the smallest positive number that is evenly divisible by all of the // numbers from 1 to 20? fn main() { println!("{}", solution()); } fn solution() ->...
use raw::{Env, Local}; use nodejs_sys as napi; /// Return true if an `napi_value` `val` has the expected value type. unsafe fn is_type(env: Env, val: Local, expect: napi::napi_valuetype) -> bool { let mut actual = napi::napi_valuetype::napi_undefined; if napi::napi_typeof(env, val, &mut actual as *mut _) == n...
use yew::prelude::*; pub struct Drawer {} impl Component for Drawer { type Message = (); type Properties = (); fn create(_: Self::Properties, _: ComponentLink<Self>) -> Self { Self {} } fn update(&mut self, _msg: Self::Message) -> ShouldRender { false } fn change(&mut se...
/* * 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 ...