text
stringlengths
8
4.13M
// Copyright 2018 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 {crate::directory::entry::DirectoryEntry, fuchsia_zircon::Status}; /// A trait the represents the add_entry/remove_entry part of a directory interface...
// Copyright 2017 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or ...
//! Levels of the latency graph. //! //! A level is akin to a loop, with a body and an iteration count, but it can represent the //! intersection of the body of multiple iteration dimensions. This is necessary when the //! nesting order of two loops of sizes N and M is left unspecified. Indeed, when //! considering the...
use crate::challenges::Challenge; use crate::ResultHashMap; use crate::file_lines_to_string_vec; pub fn challenge() -> Challenge { return Challenge::new( sum_of_any_group_answered_questions, sum_of_all_group_answered_questions, String::from("resources/customs_answers.txt"), ); } fn sum...
//! A value used in the paged memory model. use crate::executor::eval; use crate::il; use crate::Error; use std::fmt::Debug; /// In order for a value to be used in the paged memory model, it must implement /// this trait. pub trait Value: Clone + Debug + Eq + PartialEq { /// Turn an il::Constant into a representa...
use proconio::input; fn pow(a: u64, x: u64, m: u64) -> u64 { if x == 0 { 1 } else if x % 2 == 0 { pow(a * a % m, x / 2, m) } else { a * pow(a, x - 1, m) % m } } // fn solve(c: u64, d: u64, m: u64) -> u64 { // if d == 1 { // return c % m; // } // // c = 7, d...
use super::{Modulo, ModInt}; use num::integer::Integer; impl<T> Modulo<T> where T: Integer + Into<i128> + Copy { pub fn set_modulo(modulo: T) -> Modulo<T> { if modulo <= T::zero() { panic!("cannot use 0 or less number as modulo") } let mod_u128: i128 = modulo.into(); let inv = if mod_u1...
use petgraph::Graph; use std::collections::HashMap; use std::path::PathBuf; use termcolor::Buffer; pub type Name = String; pub type Src = String; #[derive(Debug, PartialEq)] pub struct Input { pub path: PathBuf, pub src: String, pub origin: ModuleOrigin, } #[derive(Debug, PartialEq)] pub struct Compiled ...
#[doc = "Reader of register BOOT_PRGR"] pub type R = crate::R<u32, super::BOOT_PRGR>; #[doc = "Reader of field `BOOT_ADD0`"] pub type BOOT_ADD0_R = crate::R<u16, u16>; #[doc = "Reader of field `BOOT_ADD1`"] pub type BOOT_ADD1_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:15 - Boot address 0"] #[inline(always...
// 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 { component_manager_lib::{ framework::RealmCapabilityHost, model::{ hooks::*, moniker::AbsoluteMoniker, ...
// Copyright (c) 2021 Quark Container Authors / 2018 The gVisor 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 ...
test_stdout!(returns_true, "true\ntrue\ntrue\n"); test_stdout!(prevents_future_messages, "true\ntrue\ntrue\n"); test_stdout!(does_not_flush_existing_message, "false\ntrue\ntrue\ntrue\n");
//! //! time_calc.rs //! //! Created by Mitchell Nordine at 05:04AM on November 01, 2014. //! //! use super::{ Measure, TimeSig, }; use super::division::{ NumDiv, Division, DivType, }; pub type Bpm = f64; pub type Ppqn = u32; pub type Ms = f64; pub type SampleHz = f64; pub type Samples = i64; pu...
use std::io; use std::net::{Ipv4Addr, SocketAddr}; use std::path::PathBuf; use std::sync::Arc; use crate::tftp::pathutils; use futures_util::task::{Context, Poll}; use futures_util::{future, FutureExt, StreamExt}; use hyper::service::{make_service_fn, service_fn, Service}; use hyper::{header, Body, Method, Request, Re...
use serde::{Deserialize, Serialize}; use crate::budget::*; use crate::budget_period::*; use crate::transaction::*; #[derive(Debug, Serialize, Deserialize)] pub enum ResultStatus { Success, InvalidCredentials, InvalidAccessToken, EntryDoesNotExist, Error(String) } // --- FORMS --- #[derive(Debug,...
use std::mem::transmute; type GetScreenSizeFn = unsafe extern "thiscall" fn(thisptr: *const usize, width: &mut i32, height: &mut i32); type GetLocalPlayerFn = unsafe extern "thiscall" fn(thisptr: *const usize) -> i32; pub struct Interface { interface_pointer: *const usize, } impl Interface { fn get_method(&s...
// // Copyright 2018-2019 Tamas Blummer // // 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 ...
use crate::bot::utils::Utils; use crate::extensions::context::ClientContextExt; use crate::extensions::user::UserExt; use crate::services::database::reminders::Reminder; use serenity::prelude::Context; use std::error::Error; use std::sync::Arc; pub async fn reminder_check(ctx: Arc<Context>) -> Result<(), Box<dyn Erro...
use dlal_component_base::{component, err, json, serde_json, Body, CmdResult, Error}; use std::f32; use std::time; fn wave_sin(phase: f32) -> f32 { (phase * 2.0 * f32::consts::PI).sin() } fn wave_tri(phase: f32) -> f32 { if phase < 0.5 { phase * 4.0 - 1.0 } else { -phase * 4.0 + 3.0 } ...
// pp-exact:example2.pp fn main () { }
use crate::prelude::*; pub fn create_systems() -> Vec<Box<dyn Schedulable>> { vec![ create_test_system(), ] } pub(crate) fn create_test_system() -> Box<dyn Schedulable> { SystemBuilder::<()>::new("TestSystem") .with_query(<Write<Position>>::query()) .build(move |commands, world, _r...
extern crate openssl; extern crate rand; mod aes; use self::openssl::symm::{encrypt, Cipher, Crypter, decrypt, Mode}; use rand::Rng; fn main() { let key = b"dddddddddddddddd"; let mut crafted = "1234567812admin\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11\x11"; let mut ciphertext = encrypt_aes_ecb(&profile_fo...
use std::fs; use crate::capabilities::attempt_server_capability; use crate::capabilities::CAPABILITY_HOVER; use crate::context::*; use crate::diagnostics::format_related_information; use crate::markup::*; use crate::position::*; use crate::types::*; use indoc::formatdoc; use itertools::Itertools; use lsp_types::reques...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct GazeDeviceConfigurationStatePreview(pub i32); impl GazeDeviceConfigurationStatePreview { pub const Unknown: Self = Self(0i32...
use crate::models::common::ChannelId; use dotenv::dotenv; use serde::{Deserialize, Serialize}; use serenity::prelude::TypeMapKey; use std::env; use std::sync::Arc; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Config { pub token: String, pub application_id: u64, pub prefix: String, pub db_...
use crate::column::Column; use crate::ext::ustr::UStr; use crate::postgres::{PgTypeInfo, Postgres}; #[derive(Debug, Clone)] #[cfg_attr(feature = "offline", derive(serde::Serialize, serde::Deserialize))] pub struct PgColumn { pub(crate) ordinal: usize, pub(crate) name: UStr, pub(crate) type_info: PgTypeInfo...
use serde::{Deserialize, Serialize}; #[derive(Debug, Deserialize, Serialize)] pub enum ImageExtension { #[serde(rename = "png")] PNG, #[serde(rename = "jpg")] JPG, } impl ToString for ImageExtension { fn to_string(&self) -> String { match self { ImageExtension::JPG => "jpg".to_owned(), Image...
pub struct Solution; impl Solution { pub fn unique_paths_with_obstacles(obstacle_grid: Vec<Vec<i32>>) -> i32 { let mut count = obstacle_grid; let m = count.len(); let n = count[0].len(); count[0][0] = if count[0][0] == 0 { 1 } else { 0 }; for j in 1..n { count[0]...
use std::fs::File; use std::io::{BufRead, BufReader, Error}; fn get_row(xs: &str) -> usize { let mut rows: Vec<usize> = (0..128).collect(); for x in xs.chars().into_iter() { let half = rows.len() / 2; let (front, back) = rows.split_at(half); rows = match x { 'F' => front.ite...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_Security_Authentication_Identity_Provider")] pub mod Provider; #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :...
use super::{GamepadButton, GamepadAxis, GamepadState, PowerInfo}; use gilrs::Gilrs; use std::rc::Rc; use std::cell::RefCell; pub type GamepadId = gilrs::GamepadId; pub struct GamepadDevice { gilrs: Rc<RefCell<Gilrs>>, id: GamepadId, name: String, state: Rc<RefCell<GamepadState>>, } impl GamepadDevice...
pub extern crate handlebars; extern crate gotham; #[macro_use] extern crate gotham_derive; extern crate serde; extern crate serde_json; extern crate hyper; extern crate futures; extern crate mime; extern crate walkdir; #[macro_use] extern crate log; pub use self::middleware::Template; pub use self::middleware::Handleb...
// revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir fn foo(x: &mut Vec<&u8>, y: &u8) { x.push(y); //[base]~^ ERROR lifetime mismatch //[nll]~^^ ERROR lifetime may not live long enough } fn main() { }
use super::Command; use log::info; pub fn run(commands: &[Command]) { info!("Running LIST subcommand"); if commands.is_empty() { println!("No commands are stored"); return; } println!("{} commands stored:\n", commands.len()); let last_id = commands.last().unwrap().id; for i in c...
use std::i32; use std::sync::atomic::{AtomicU32, Ordering}; use sys::{futex_wait_bitset, futex_wake_bitset}; pub struct RwFutex2 { futex: AtomicU32, } //const WRITER_LOCKED: i32 = i32::MIN; //const WRITER_LOCKED_READERS_QUEUED: i32 = i32::MIN + 1; //const F_WRITER_LOCK: u32 = 0b1000000000000000000000000000000...
#[path = "apply_2/with_function.rs"] pub mod with_function; test_stdout!(without_function_errors_badarg, "{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, error, badarg}\n{caught, erro...
use crate::error::Error; use std::{ convert::TryInto, io::{self, BufRead, Write}, }; enum Parameter { Position(usize), Immediate(i64), } impl Parameter { fn from_code( code: &[i64], i: &mut usize, mode: i64, n: u8, opcode: i64, ) -> Result<Self, Error> {...
#[doc = "Reader of register HWCFGR"] pub type R = crate::R<u32, super::HWCFGR>; #[doc = "Writer for register HWCFGR"] pub type W = crate::W<u32, super::HWCFGR>; #[doc = "Register HWCFGR `reset()`'s with value 0x71"] impl crate::ResetValue for super::HWCFGR { type Type = u32; #[inline(always)] fn reset_value...
use bb::BB; use castle::Castle; use square::Square; mod mv_counter; mod mv_vec; mod scored_mv_vec; pub use self::mv_counter::MoveCounter; pub use self::mv_vec::MoveVec; pub use self::scored_mv_vec::ScoredMoveVec; /// MoveList represents a way to collect moves from move generation functions. Use this if you want to c...
use P80::graph_converters::unlabeled; use P85::*; pub fn main() { let g1 = unlabeled::from_string("[a-b b-c]"); let g2 = unlabeled::from_string("[5-7 9-7]"); println!( "{:?} is isomorphic to {:?}: {}", unlabeled::to_term_form(&g1), unlabeled::to_term_form(&g2), is_isomorphic...
// 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 std::ops::{Add, Mul}; use crate::{PIXEL_MASK, PIXEL_WIDTH}; /// A point in 2D space. #[derive(Clone, Copy, Debug, Default, Eq, PartialEq)] pub struct...
#![deny(missing_docs)] //! A map that helps counting elements. extern crate num_traits; use num_traits::identities::{One, Zero}; use std::borrow::Borrow; use std::collections::HashMap; use std::collections::hash_map::{Drain, IntoIter, Iter, IterMut, Keys, RandomState, Values}; use std::hash::{BuildHasher, Hash}; use...
use actix_web::{web, App, http,HttpRequest,HttpServer, Responder,HttpResponse}; use std::fs::File; use std::io::{Write, Error,Read,ErrorKind}; use clap::{Arg,ArgMatches}; async fn create_request(m:Configuration,req:HttpRequest,bytes:web::Bytes) -> impl Responder { let path = req.match_info().get("path").unwrap();...
#[doc = "Reader of register CPT1BCR"] pub type R = crate::R<u32, super::CPT1BCR>; #[doc = "Writer for register CPT1BCR"] pub type W = crate::W<u32, super::CPT1BCR>; #[doc = "Register CPT1BCR `reset()`'s with value 0"] impl crate::ResetValue for super::CPT1BCR { type Type = u32; #[inline(always)] fn reset_va...
#![feature(async_await, await_macro, futures_api, pin, try_blocks)] extern crate futures; extern crate proxylab; extern crate tokio; use futures::{compat::*, future::ready, prelude::*, stream::iter, task::SpawnExt}; use proxylab::*; use std::{env::args, io::BufReader, iter::once, net::ToSocketAddrs}; use tokio::{ ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_UI_Shell_PropertiesSystem")] pub const DEVPKEY_DevQuery_ObjectType: super::super::UI::Shell::PropertiesSystem::PROPERTYKEY = super::super::UI::Shell::PropertiesSystem::...
//! This crate supports exception handling in Erlang via panics/stack unwinding. //! //! The implementation makes use of whatever the native stack unwinding mechanism of //! the target platform is. //! //! 1. MSVC targets use SEH in the `seh.rs` file. //! 2. Emscripten uses C++ exceptions in the `emcc.rs` file. //! 3. ...
/* A struct containing semantic errors */ pub enum semantic_errors { undeclaredVariable = "error: variable is not declared", multipleDeclaration = "error: variable had been declared before", typeMismatched = "error: types mismatched \n variable doesn't have a value matched with the identifier", ...
use std::mem; use std::alloc; #[allow(dead_code)] struct Data { v1: i32, v2: u8, } fn main() { println!("usize align = {}", mem::align_of::<usize>()); println!("u8 align = {}", mem::align_of::<u8>()); println!("-----"); println!("{:?}", alloc::Layout::new::<i32>()); println!("-----"); ...
// Copyright 2023 Datafuse Labs. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to ...
extern crate ev3dev_lang_rust; use ev3dev_lang_rust::{Button, Ev3Result}; fn main() -> Ev3Result<()> { let button = Button::new()?; loop { button.process(); println!( "{}, {}, {}, {}, {}, {}", button.is_up(), button.is_down(), button.is_left(),...
use liblumen_alloc::erts::process::{Frame, Native}; use liblumen_alloc::erts::term::prelude::*; use liblumen_alloc::{Arity, ModuleFunctionArity}; use lumen_rt_core::process::current_process; pub fn frame() -> Frame { Frame::new(module_function_arity(), Native::Zero(native)) } // Private const ARITY: Arity = 0; ...
use log::*; use crate::common::{ convert_err, resize, resize_factor }; use crate::message::*; use glib::{Sender as GlibSender}; use image::{open}; use nanocv::{ImgBuf, ImgSize, Img, Vec2d, Range2d, filter::map_range}; use std::cmp::{min, max}; pub struct LogicState { gui: Option<GlibSender<GuiMessage>>, im...
use gooey::{ core::{ assets::{Asset, Image}, figures::{Point, Rectlike, Vector}, styles::Color, Callback, Context, Scaled, }, frontends::rasterizer::ContentArea, renderer::Renderer, widgets::component::{Behavior, Component, ComponentCommand}, App, }; use gooey_can...
use datafusion::{ common::{tree_node::TreeNodeRewriter, DFSchema}, error::DataFusionError, logical_expr::{ expr::ScalarUDF, expr_rewriter::rewrite_preserving_name, utils::from_plan, LogicalPlan, Operator, }, optimizer::{OptimizerConfig, OptimizerRule}, prelude::{binary_expr, lit,...
use std::collections::HashSet; use std::iter::FromIterator; use common; fn is_valid_1(s: &str) -> bool { let all_words: Vec<&str> = s.split(' ').collect(); let unique_words: HashSet<&str> = HashSet::from_iter(s.split(' ')); unique_words.len() == all_words.len() } fn sorted_chars_of(s: &str) -> String { ...
use crate::model::Article; use serde::{Deserialize, Serialize}; use std::{fs, fs::DirEntry}; #[derive(Debug, Clone, Deserialize, Serialize)] pub struct Section { pub name: String, pub articles: Vec<Article>, } impl Section { pub fn load(dir: DirEntry) -> Self { let name = dir .path() ...
// This file is part of linux-epoll. 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/linux-epoll/master/COPYRIGHT. No part of linux-epoll, including this file, may be copied, modified, propagated, or distri...
#[doc = "Reader of register CSR"] pub type R = crate::R<u32, super::CSR>; #[doc = "Writer for register CSR"] pub type W = crate::W<u32, super::CSR>; #[doc = "Register CSR `reset()`'s with value 0"] impl crate::ResetValue for super::CSR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
#[doc = "Reader of register APBENR1"] pub type R = crate::R<u32, super::APBENR1>; #[doc = "Writer for register APBENR1"] pub type W = crate::W<u32, super::APBENR1>; #[doc = "Register APBENR1 `reset()`'s with value 0"] impl crate::ResetValue for super::APBENR1 { type Type = u32; #[inline(always)] fn reset_va...
use std::io::{self}; use aoc_2019_9::{self, error::Error, Prog, StdInProgInput, StdOutProgOutput}; fn main() -> Result<(), Error> { let mut input = String::new(); let _ = io::stdin().read_line(&mut input)?; let mem_state = aoc_2019_9::parse_mem_state(&input)?; let mut prog = Prog::new(&mem_state); ...
mod subscribe_ack; mod unsubscribe_ack; mod ping_response; mod publish; mod publish_ack; mod publish_recieve; mod publish_release; mod publish_complete; use ::futures::{Poll, Future}; use ::futures::unsync::mpsc::UnboundedSender; use ::futures_mutex::FutMutex; use ::errors::Error; use ::proto::MqttPacket; use ::tokio:...
use ggez::graphics::*; use specs::{Component, VecStorage}; use std::sync::{Arc, RwLock}; use components::*; use input::{Axis, InputState}; use map::Map; use sop::TweenState; use state::*; use tween::*; #[derive(Debug)] pub struct Character { pub id: Option<EntityID>, pub anim: Option<Animation>, pub pos:...
// A pass that annotates for each loops and functions with the free // variables that they contain. import std::map; import std::map::*; import std::ivec; import std::option; import std::int; import std::option::*; import syntax::ast; import syntax::visit; import driver::session; import middle::resolve; import syntax:...
use std::io; use std::path::Path; use std::fs; use mime_guess::{guess_mime_type, get_mime_type}; use iron::mime::Mime; use errors::*; pub trait Storage: Clone + Send + Sync + 'static { type Output: io::Read + Send + Sync + 'static; fn get(&self, token: &str, filename: &str) -> Result<(Self::Output, Mime, u64...
mod functional; mod oo; fn main() { functional::f_run(); oo::oo_run(); }
#[doc = "Reader of register SYNC"] pub type R = crate::R<u32, super::SYNC>; #[doc = "Writer for register SYNC"] pub type W = crate::W<u32, super::SYNC>; #[doc = "Register SYNC `reset()`'s with value 0"] impl crate::ResetValue for super::SYNC { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
use *; use {Vertex, Error}; /// A Glyph Cache for caching the textures of fonts. pub struct GlyphCache { cache: Cache<'static>, cache_tex: Texture2d, } impl GlyphCache { /// Create a new glyph cache. /// /// Will fail if the texture fails to be created for whatever reason. pub fn new<D: Displa...
#![allow(clippy::comparison_chain)] #![allow(clippy::collapsible_if)] use std::cmp::Reverse; use std::cmp::{max, min}; use std::collections::{BTreeSet, HashMap, HashSet}; use std::fmt::Debug; use itertools::Itertools; use whiteread::parse_line; const ten97: usize = 1000_000_007; /// 2の逆元 mod ten97.割りたいときに使う const in...
use nutype::nutype; use crate::{format_string, Error}; const SECONDS_PER_HOUR: f64 = 3600.; const METERS_PER_MILE: f64 = 1609.344; /// Speed in meters per second #[nutype(validate(min=0.0))] #[derive(*, Serialize, Deserialize)] pub struct Speed(f64); impl Default for Speed { fn default() -> Self { Self:...
#![allow(clippy::many_single_char_names)] /// /// Get cepstral coefficients corresponding to the given prediction vector. /// Ref: Papamichalis (1987), p. 129. /// /// ## Arguments: /// /// * `gain` - Gain of the system (i.e., `sqrt(prediction_error)`). /// * `p` - Prediction order. /// * `a` - Predi...
use std::collections::{BTreeMap, HashMap}; use slkparser::record::cell::Cell; use crate::slk_datas::adapter::{DocumentAdapter, ScannerAdapter}; type MetaID = String; type FieldColumn = u32; const HEADER_ROW: u32 = 1; mod adapter{ use slkparser::document::Document; use slkparser::record::cell::Cell; use ...
#[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::CALLD1 { #[doc = r"Writes to the register"] #[inline(always)] pub fn write<F>(&self, f: F) where F: FnOnce(&mut W) -> &mut W, { self.register.set( f(&mut W { bits: Self:...
//! Implements a command for sending events to Sentry. use std::env; use clap::{App, Arg, ArgMatches}; use failure::{err_msg, Error}; use itertools::Itertools; use sentry::protocol::{Event, Level, LogEntry, User}; use serde_json::Value; use username::get_user_name; use crate::config::Config; use crate::utils::event::...
//! Builds up a tree of callers or callees. //! /* Suppose we have the following samples: - A - B1 - C - A - B2 - C - A - B1 - D We want to arrange into a tree: - A (3/3, 0/3 self) - B1 (2/3, 0/3 self) - C (1/3, 1/3 self) - D (1/3, 1/3 self) - B2 - D (1/3, 1/3 self) */ use uti...
#[feature(globs, macro_rules)]; mod ast; mod driver; mod env; mod eval; mod parse; mod reader; mod tokenize; mod transform; mod util; fn main() { }
// adds a "capability", which is a super naive implementation // to add things to the kube cluster. use anyhow::Result; use std::process::Command; pub fn cert_manager() -> Result<()> { Command::new("kubectl") .arg("apply") .arg("--validate=false") .arg("-f") .arg("https://github.com...
use proconio::input; fn main() { let array = [0, 10, 20, 30, 40, 50]; input! { index: usize, } let ans = array[index]; println!("{:^6}", ans); }
use crate::sqm::array::Array; use crate::sqm::class::Class; use serde::{Serialize, Deserialize}; use std::collections::HashMap; use std::io::Write; #[derive(Debug, Serialize, Deserialize)] pub struct File{ pub items: HashMap<String, String>, pub arrays: HashMap<String, Array>, pub classes: HashMap<String, ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct FindAllAccountsResult(pub ::windows::core::IIn...
#![feature(raw)] #[macro_use] extern crate log; extern crate pretty_env_logger; extern crate executable_memory; extern crate rustyline; extern crate termcolor; use rustyline::error::ReadlineError; use rustyline::Editor; use std::collections::VecDeque; #[derive(Debug)] struct Machine { pub regs: [u32; 8], p...
pub mod _learning_i32; pub mod _learning_tests_2; pub mod _learning_tests_3; pub mod _learning_string; pub mod _learning_structs; pub mod _learning_vector; //pub mod linq; // pub mod problem1; // pub mod _problem1_tests; // pub mod problem2; // pub mod _problem2_tests;
//use termion::raw::RawTerminal; use termion::raw::IntoRawMode; use termion::cursor::Goto; use termion::color::Fg; //use termion::color::Bg; use termion::color::Rgb; use termion::clear; use std::io::Write; //use std::ops::Add; use std::io::{ self, stdout }; use rand::Rng; const W : usize = 96; const H : usize = 32...
#[macro_use] extern crate log; // #[macro_use] // extern crate emoji_converter; #[macro_use] extern crate serde_derive; extern crate dotenv; extern crate env_logger; extern crate failure; extern crate serde_json; extern crate serenity; extern crate timeago; extern crate typemap; use dotenv::dotenv; use serenity::clien...
pub mod calculater { // sub module for probablity calculation pub mod probabilty { pub fn factorial (mut input: u32) -> u32 { let mut result: u32 = 1; while input > 1 { result = result * input; input = input - 1; } result } } } pub use calculater::probabilty::factorial;
use intcode::*; fn main() { let prog = parse_program(include_str!("../input/day_5.txt")); println!( "Part 1 => {}", IntcodeComputer::new(&prog) .run(vec!(1)) .last() .unwrap() ); println!( "Part 2 => {}", IntcodeComputer::new(&prog) ...
//! This module holds the definitions of //! wrappers which do not belong to any //! data structures. use std::ffi::CString; use std::mem; use jalali_bindings::*; /// This function calculates whether a given year is leap. /// /// # Arguments /// /// * `year` - A 32 bit integer representing the year. /// /// # Example...
use crate::{vec3::Vec3, Point}; pub struct Ray { origin: Point, direction: Vec3, } impl Ray { pub fn new(origin: Point, direction: Vec3) -> Self { Self { origin, direction } } pub fn origin(&self) -> Vec3 { self.origin } pub fn direction(&self) -> Vec3 { self.dire...
use sm_parser::{Assoc, PrecClimber, Rule}; mod ops; mod parse; mod traits; pub use ops::{infix_map, prefix_map, suffix_map}; #[derive(Debug, Clone)] pub struct ParserSettings { pub file: String, pub refine: bool, } /// Determines the associativity and priority of operators /// use Precedence in Mathematica pu...
//use std::fmt::Display; //use std::str::FromStr; //use std::num::ParseIntError; //use serde::{de, Deserialize, Deserializer, Serializer}; use serde::{Deserialize, Deserializer, Serializer}; pub fn serialize<S>(value: &Option<f32>, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer, { if let Some(r...
#[cfg_attr(target_env = "wasi", path = "wasi/mod.rs")] #[cfg_attr(not(target_env = "wasi"), path = "unknown/mod.rs")] mod os; pub use self::os::*;
extern crate day10; use std::io; use std::io::BufRead; use day10::*; fn main() { let stdin = io::stdin(); let handle = stdin.lock(); for line_result in handle.lines() { match line_result { Ok(line) => { println!("{}", hash_str(&line)); }, Err(e...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from ../gir-files // DO NOT EDIT use crate::Date; use crate::Message; use glib::object::IsA; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct HSTSPolicy(Boxed<ffi::SoupHSTSPolicy>); ...
extern crate bean; use bean::parser::Parser; use std::io::{self, Read}; fn main() { let mut buffer = String::new(); io::stdin().read_to_string(&mut buffer).unwrap(); println!("{:#?}", Parser::parse_script(&buffer)); }
use derive_getters::Getters; pub use chrono::{DateTime, Duration, TimeZone, Utc}; /// A `TestSuite` groups together several [`TestCase`s](../struct.TestCase.html). #[derive(Debug, Clone, Getters)] pub struct TestSuite { pub name: String, pub package: String, pub timestamp: DateTime<Utc>, pub hostname:...
use crate::error::{Error, Result}; use std::env; use std::fs; use std::path::{Path, PathBuf}; pub(crate) enum RelativeToDir { Workspace, Manifest, } impl RelativeToDir { fn dir(self) -> Result<PathBuf> { match self { Self::Workspace => workspace_dir(), Self::Manifest => man...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} #[repr(transparent)] pub struct WalletItemAppAssociation(pub i32); impl WalletItemAppAssociation { pub const None: Self = Self(0i32); pub const AppInsta...
pub mod constants; mod file_type; pub use self::file_type::FileTypeTrait; pub use self::file_type::StandaloneFileType;
use std::sync::Arc; use async_graphql::*; #[tokio::test] pub async fn test_input_value_custom_error() { struct Query; #[Object] impl Query { async fn parse_int(&self, _n: i8) -> bool { true } } let schema = Schema::new(Query, EmptyMutation, EmptySubscription); let...
use std::cmp::{max, min}; use crate::bit_page_vec_iter::BitPageVecIter; use crate::BitPageVec; // @author shailendra.sharma #[derive(Clone, Debug)] pub enum BooleanOp<'a> { And(Vec<BooleanOp<'a>>), Or(Vec<BooleanOp<'a>>), Not(Box<BooleanOp<'a>>), BorrowedLeaf(&'a BitPageVec), OwnedLeaf(BitPageVec...