text
stringlengths
8
4.13M
// Copyright 2022 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 ...
fn mk_int<'a>() -> Box<i32> { Box::new(0) } fn sum<'a>(lo : i32, hi : i32) -> Box<i32> { let mut acc = mk_int(); for i in 0..(hi+1) { *acc += i }; acc }
use std::io::ErrorKind::WouldBlock; use std::io::BufWriter; use std::io::prelude::*; use std::fs::File; use std::thread; use std::time::Duration; use image; use scrap::{self, Display, Capturer}; fn main() { list_displays(); take_screenshot(); } fn list_displays() { println!("Listing displays:"); let d...
// 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 ...
use core::cmp::Ordering::{self, Equal, Greater, Less}; use num_bigint::algorithms; use num_bigint::{BigUint, RandPrime}; use num_traits::{FromPrimitive, One}; use rand::prelude::*; use rand::Rng; use crate::errors::{Error, Result}; use num_bigint::algorithms::{__add2, __sub2rev, add2, sub2, sub2rev}; use num_bigint::a...
extern crate libc; use libc::{pthread_self, pthread_getname_np, pthread_setname_np}; use std::ffi::{CString, CStr, OsStr}; use std::io::{self, Error}; fn main() { #[cfg(target_os = "macos")] let lalala = "la la la la la la la123456789012345678901234567890 la la la l63"; #[cfg(not(any(target_os = "windows"...
use super::input_to_string; use super::strings::{sass_string, sass_string_dq, sass_string_sq}; use super::util::{opt_spacelike, spacelike2}; use nom::types::CompleteByteSlice as Input; use selectors::{Selector, SelectorPart, Selectors}; named!(pub selectors<Input, Selectors>, map!(separated_nonempty_list!( ...
#![warn(clippy::all)] #![warn(clippy::pedantic)] fn main() { run(); } fn run() { let start = std::time::Instant::now(); // code goes here let mut res = 0; for a in 100..1000 { for b in 100..1000 { let c = a * b; if is_palindrome(c) && c > res { res = c; } } } let spa...
// -*- coding: utf-8; mode: rust; -*- // // To the extent possible under law, the authors have waived all // copyright and related or neighboring rights to zkp, // using the Creative Commons "CC0" public domain dedication. See // <http://creativecommons.org/publicdomain/zero/1.0/> for full // details. // // Authors: /...
use glam::{Mat3, Mat4, Quat, Vec2}; use log::debug; use serde_derive::{Deserialize, Serialize}; use std::collections::VecDeque; /// Transform of an element to place it on the screen #[derive(Debug, Clone, Copy, Serialize, Deserialize, Default)] pub struct Transform { /// Translation along x-y pub translation: ...
use crate::common::get_rng; use rand::prelude::*; #[derive(Debug, Clone, PartialEq)] pub struct Matrix { cells: Vec<Cell>, width: usize, height: usize, score: f64, } #[derive(Debug, Clone, PartialEq)] pub enum Cell { Empty, Filled, TopRight, BottomRight, BottomLeft, TopLeft, } ...
use std; use std::os::raw::c_void; use core::structs::MLP; use core::points::array_to_point; use core::mlp::*; #[no_mangle] pub extern fn create_model(entries: *mut c_void, length: i32, class: bool) -> *mut MLP { let mlp: &[i32]; unsafe{ mlp = std::slice::from_raw_parts(entries as *mut i32, length as u...
use std::{collections::HashSet, fmt}; use crossterm::style::Color; use lazy_static::lazy_static; use strum::IntoEnumIterator; use strum_macros::EnumIter; lazy_static! { pub static ref ALL_VALUES: HashSet<Value> = Value::iter().collect(); } #[derive(Copy, Clone, PartialEq, Eq, Hash, PartialOrd, Ord, Debug, EnumIt...
// Copyright 2014 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 ...
use async_graphql::*; use futures_util::Stream; use serde::Deserialize; #[tokio::test] pub async fn test_type_visible() { #[derive(SimpleObject)] #[graphql(visible = false)] struct MyObj { a: i32, } struct Query; #[Object] #[allow(unreachable_code)] impl Query { async ...
pub mod mutations; pub mod pending; pub mod queries; pub mod service; use crate::auth::pwd::create_pwd_hash; use crate::datastore::prelude::*; use chrono::prelude::*; use juniper::ID; #[derive(juniper::GraphQLObject, Debug, Clone)] #[graphql(description = "A user in a taskach system")] pub struct User { pub id: I...
use bit_set::BitSet; use std::vec::IntoIter; pub trait Join { type Item; fn open(&self) -> BitSet; fn join(self) -> JoinIterator<Self> where Self: Sized, { JoinIterator::new(self) } fn get(&self, index: usize) -> Self::Item; } pub struct JoinIterator<T: Join> { keys:...
#![feature(test)] #![feature(box_syntax)] #![cfg_attr(feature = "unstable", feature(try_trait))] #![warn(unsafe_code)] #![warn(rust_2018_idioms)] extern crate test; use auto_enums::auto_enum; use rand::Rng; use test::Bencher; fn iter_no_branch(_x: u32) -> impl Iterator<Item = i64> { (0..).map(|x| x + 2 - 1) } f...
/* * Copyright (C) 2020-2022 Zixiao Han */ pub static ENGINE_NAME: &str = "FoxSEE"; pub static VERSION: &str = "v8.5"; pub static AUTHOR: &str = "Zixiao Han"; pub const DEFAULT_HASH_SIZE_MB: usize = 128; pub const DEFAULT_HASH_SIZE_UNIT: usize = 4194304; pub const MIN_HASH_SIZE_MB: usize = 1; pub const MIN_HASH_SIZ...
use super::Number; use std::ops::{Add, Sub, AddAssign, SubAssign}; #[derive(Debug, Copy, Clone, PartialEq)] pub struct Vector<N: Number = f32> { pub x: N, pub y: N, } pub type Position<N = f32> = Vector<N>; pub type Point<N = f32> = Vector<N>; pub type Scale<N = f32> = Vector<N>; pub type Delta<N = f32> = Vec...
use std::default::Default; use std::string::ToString; use yew::prelude::*; use yew::services::ConsoleService; use super::editor_row::PrefabEditorRow; use crate::components::prefab::scene::form::Form as SceneForm; use crate::components::prefab::ui::form::Form as UIForm; #[derive(Debug, Clone, PartialEq)] pub enum Win...
macro_rules! pow { ($intrinsic:ident: $fty:ty, $ity:ident) => { /// Returns `a` raised to the power `b` #[cfg_attr(not(test), no_mangle)] pub extern "C" fn $intrinsic(a: $fty, b: $ity) -> $fty { let (mut a, mut b) = (a, b); let recip = b < 0; let mut r: $f...
// Copyright 2019. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following // disclai...
// Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn parse_http_generic_error( response: &http::Response<bytes::Bytes>, ) -> Result<smithy_types::Error, smithy_json::deserialize::Error> { crate::json_errors::parse_generic_error(response.body(), response.headers()) } pub fn de...
use crate::{std_types::RStr, type_layout::MonoTypeLayout}; /// Represents the layout of a prefix-type,for use in error messages. #[repr(C)] #[derive(Debug, Copy, Clone, StableAbi)] // #[derive(Debug, Copy, Clone, PartialEq, StableAbi)] pub struct PTStructLayout { /// The stringified generic parameters. pub gen...
use std::collections::{HashMap}; use rlua::{Lua, Table}; use {Error}; /// Tracks values to be converted to a model for use by the scripting language. pub struct ScriptTable { values: HashMap<String, ScriptValue>, } impl ScriptTable { /// Creates a new empty model. pub fn new() -> Self { ScriptTabl...
#[doc = "Reader of register CFGR"] pub type R = crate::R<u32, super::CFGR>; #[doc = "Writer for register CFGR"] pub type W = crate::W<u32, super::CFGR>; #[doc = "Register CFGR `reset()`'s with value 0"] impl crate::ResetValue for super::CFGR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
use crate::{SMResult, AST}; use sm_algorithm::prime_sum_i; pub fn floor(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn ceiling(expr: &AST) -> SMResult<AST> { match expr { _ => unimplemented!(), } } pub fn round(expr: &AST) -> SMResult<AST> { match ex...
mod player; use rendering::{Color, Renderer}; pub struct Game { glow: f64, } impl Game { pub fn new() -> Self { Game { glow: 0.0, } } pub fn update(&mut self, dt: f64) { self.glow += dt / 1000.0; self.glow %= 1.0; } pub fn render(&self, renderer...
use argh::FromArgs; #[macro_use] extern crate lalrpop_util; #[macro_use] extern crate lazy_static; pub mod errors; pub mod flat; pub mod flatten; pub mod ir; lalrpop_mod!(pub grammar); pub mod lexer; pub mod parser; pub mod raw; pub mod source_file; pub mod span; pub mod token; pub mod typeshape; use flat::{add_libr...
csci114_20171030code1.Savings csci114_20171030code1.BankAccount csci114_20171030code1.Csci114_20171030code1 csci114_20171030code1.StudentSavings
// Copyright 2022 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 ...
use std::io::Read; fn main() { let mut input = String::new(); std::io::stdin().read_to_string(&mut input).unwrap(); let mut black = std::collections::HashSet::new(); for line in input.lines() { let (x, y, _) = line.chars().fold((0, 0, None), |(x, y, previous), character| { match ch...
// 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 ...
// Eqを実装する。 #[derive(Eq, PartialEq)] struct A(i32); // PartialOrdを実装するためにPartialEqが必要 #[derive(PartialEq, PartialOrd)] struct B(f32); // Copyを実装するためにCloneを実装する。 #[derive(Copy, Clone)] struct C; #[derive(Clone)] struct D; #[derive(Debug)] struct E; #[derive(Default)] struct F; // スレッドライブラリをインポートする。 use std::thread; // R...
use super::{ PrimaryTableIndex, ScopeName, SecondaryTableName, Table, TableName, }; use crate::AccountName; use core::marker::PhantomData; /// TODO docs #[derive(Copy, Clone, Debug)] pub struct SecondaryTableIndex<K, T> where T: Table, { /// TODO docs pub code: AccountName, /// TODO docs pub sc...
pub fn find_center(edges: Vec<Vec<i32>>) -> i32 { use std::collections::HashMap; let mut count: HashMap<i32, i32> = HashMap::new(); for edge in edges { for val in edge { *count.entry(val).or_insert(0) += 1; } } if let Some(kvp) = count.iter().max_by(|a, b| a.1.cmp(b.1)...
extern crate ncurses; extern crate rand; use ncurses::*; use std::*; pub const COLOR_GRAY: i16 = 8; fn main() { let ans: [i16; 4] = [ (rand::random::<u16>() % 6 + 1) as i16, (rand::random::<u16>() % 6 + 1) as i16, (rand::random::<u16>() % 6 + 1) as i16, (rand::random::<u16>() % 6 ...
use core::fmt; pub enum OffchainError { NoAccountAvailable, Other(&'static str), TooEarlyToSendUnsignedTransaction, } impl fmt::Debug for OffchainError { #[inline] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match *self { Self::NoAccountAvailable => write!(f, "No...
pub(crate) use _operator::make_module; #[pymodule] mod _operator { use crate::common::cmp; use crate::{ builtins::{PyInt, PyIntRef, PyStr, PyStrRef, PyTupleRef, PyTypeRef}, function::Either, function::{ArgBytesLike, FuncArgs, KwArgs, OptionalArg}, identifier, protocol::P...
// build.rs extern crate vergen; use vergen::*; fn main() { let mut flags = Flags::all(); flags.toggle(NOW); vergen(flags); }
// auto generated, do not modify. // created: Wed Jan 20 00:44:03 2016 // src-file: /QtQml/qqmlfileselector.h // dst-file: /src/qml/qqmlfileselector.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // main block ...
// use human_panic::setup_panic; use anyhow::Result; use cli::Action::*; use structopt::StructOpt; mod actions; mod cli; mod file_handler; mod template; fn main() -> Result<()> { // setup_panic!(); let args = cli::Cli::from_args(); match args.action { New => actions::when_new(args.name.unwrap())...
#![allow(non_snake_case)] #![cfg(test)] use std::ops::Add; #[test] fn Empty_struct_requirec_braces_wjen_creating_instance() { struct Empty {}; let x = Empty {}; } //TODO: How to instatntiate this? #[test] fn Struct_can_have_str_field_but_then_cannot_be_instantiated() { struct MyBox { name: str...
#[doc = "Writer for register C7IFCR"] pub type W = crate::W<u32, super::C7IFCR>; #[doc = "Register C7IFCR `reset()`'s with value 0"] impl crate::ResetValue for super::C7IFCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Write proxy for field `CTEIF7`"] pub ...
use nom::character::complete::{multispace0, space1}; use nom::combinator::opt; use nom::sequence::{terminated, tuple}; use crate::assembler::label_parsers::label_declaration_parser; use crate::assembler::opcode_parsers::opcode_parser; use crate::assembler::operand_parsers::{integer_operand_parser, register_parser}; us...
pub mod texture_register; pub mod graphics;
use ::regex::{escape, Regex}; lazy_static!{ static ref INVALID_MULTILEVEL: Regex = Regex::new("(?:[^/]#|#(?:.+))").unwrap(); static ref INVALID_SINGLELEVEL: Regex = Regex::new(r"(?:[^/]\x2B|\x2B[^/])").unwrap(); } pub struct TopicFilter { matcher: Regex, original: String } impl TopicFilter { pub ...
// Copyright 2018 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 ...
// 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 ...
use crate::weierstrass::*; use crate::weierstrass::curve::{CurvePoint, WeierstrassCurve}; use crate::representation::{ElementRepr}; use crate::field::*; use crate::public_interface; use crate::public_interface::{ApiError}; use crate::traits::{FieldElement}; use crate::traits::ZeroAndOne; use crate::square_root::*; mac...
use std::collections::HashMap; use std::fs; use std::path::Path; use std::sync::Arc; use clap::ArgMatches; use log::*; use serde_json; use tantivy::schema::Schema; use tantivy::Index; use crate::client::client::create_client; use crate::server::server::IndexServer; use crate::util::log::set_logger; pub fn run_serve_...
// The MIT License (MIT) // // Copyright (c) 2015 FaultyRAM // // Permission is hereby granted, free of charge, to any person obtaining a copy // of this software and associated documentation files (the "Software"), to // deal in the Software without restriction, including without limitation the // rights to use, copy,...
use proconio::input; use proconio::marker::Usize1; use std::collections::VecDeque; fn main() { input! { n: usize, m: usize, a: [u64; n], edges: [(Usize1, Usize1); m], }; let mut g = vec![vec![]; n]; for (u, v) in edges { g[u].push(v); g[v].push(u); }...
// Copyright 2014 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 ...
extern crate glfw; use glfw::{Key, Action}; use cgmath::{Vector3, vec3}; pub struct Camera { position: Vector3<f32>, pitch: f32, yaw: f32, roll: f32, } impl Camera { pub fn new() -> Camera { Camera { position: vec3(0.0, 0.0, 0.0), pitch: 0.0, yaw: 0.0, ...
use rand; use rand::RngCore; use std::ffi::OsString; use std::path::{Path, PathBuf}; use std::{io, iter}; use error::IoResultExt; fn tmpname(prefix: &str, suffix: &str, rand_len: usize) -> OsString { let mut buf = String::with_capacity(prefix.len() + suffix.len() + rand_len); buf.push_str(prefix); buf.ext...
use std::sync::mpsc::{Receiver, Sender}; use serial::core::BaudRate::Baud115200; use serial::unix::TTYPort; mod port_handle; use crate::probe::port_handle::Handle; #[cfg(test)] mod tests; #[allow(unused)] pub enum Pin { D0 = 0, D1 = 1, D2 = 2, D3 = 3, D4 = 4, D5 = 5, D6 = 6, D7 = 7, ...
use eosio::AccountName; use structopt::StructOpt; /// Create various items, on and off the blockchain #[derive(StructOpt, Debug)] pub enum Create { /// Create a new keypair and print the public and private keys Key(CreateKey), /// Create a new account on the blockchain (assumes system contract does not ...
#![warn(clippy::all)] // #![deny(missing_docs)] <-- Useful if you wanna make sure to document everything // Note, external crates are found by Cargo, not by "extern crate" // And the graphics the OpenGL version to use as backend use opengl_graphics::OpenGL; // Change this to OpenGL::V2_1 if not working. const OPENGL...
fn main() { let mut v1 = vec![1,2,3]; let x = v1.pop() + 10; println!("{}", x); }
use std::str::FromStr; use std::io::{stdout, stderr}; extern crate argparse; use argparse::{ArgumentParser, StoreTrue, Store, List}; #[allow(non_camel_case_types)] #[derive(Debug)] enum Command { play, record, } impl FromStr for Command { type Err = (); fn from_str(src: &str) -> Result<Command, ()> {...
use crate::descriptor::{Database, EnumDescriptor, FileDescriptor, MessageDescriptor}; use crate::pecan_descriptor::google::protobuf::compiler::plugin_pb; use id_arena::Id; use pecan::Message; use pecan_utils::naming; use std::collections::HashMap; use std::fmt::{self, Write}; pub struct Printer<'a> { output: &'a m...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Timerx Control Register"] pub timbcr: TIMBCR, #[doc = "0x04 - Timerx Interrupt Status Register"] pub timbisr: TIMBISR, #[doc = "0x08 - Timerx Interrupt Clear Register"] pub timbicr: TIMBICR, #[doc = "0x0c - TIMx...
use crate::alsa::{ControlElementInterface, Result}; use crate::libc as c; use alsa_sys as alsa; use std::ffi::CStr; use std::mem; use std::ptr; /// A control associated with a device. /// /// See [Control::open]. pub struct Control { tag: ste::Tag, pub(super) handle: ptr::NonNull<alsa::snd_ctl_t>, } impl Cont...
pub mod register; pub mod cpu; pub mod ppu; pub mod apu; pub mod rom; pub mod memory; pub mod mapper; pub mod button; pub mod joypad; pub mod input; pub mod audio; pub mod display; pub mod default_input; pub mod default_audio; pub mod default_display; use cpu::Cpu; use rom::Rom; use button::Button; use input::Input; u...
use ipfs::{Ipfs, IpfsTypes}; use serde::Serialize; use std::borrow::Cow; use std::error::Error as StdError; use std::fmt; pub mod option_parsing; mod stream; pub use stream::StreamResponse; mod body; pub use body::{try_only_named_multipart, OnlyMultipartFailure}; mod timeout; pub use timeout::MaybeTimeoutExt; mod ...
// 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 ...
/* * @lc app=leetcode.cn id=811 lang=rust * * [811] 子域名访问计数 */ // @lc code=start impl Solution { pub fn subdomain_visits(cpdomains: Vec<String>) -> Vec<String> { fn split<'a>(content: &'a str, spliter: &str) -> Vec<&'a str> { content.split(spliter).collect() } fn string_to_...
// 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 ...
use self::io::*; use self::game::*; use self::player::*; mod game; mod game_test; mod io; mod io_test; mod player; mod player_test; mod board; mod board_test; mod rules; mod rules_test; mod minimax; mod minimax_test; fn main() { let io = ConsoleIo::new(); io.print("Hello! Welcome to Tic Tac Toe.\n".to_string(...
// auto generated, do not modify. // created: Mon Feb 22 23:57:02 2016 // src-file: /QtCore/qabstractproxymodel.h // dst-file: /src/core/qabstractproxymodel.rs // // header block begin => #![feature(libc)] #![feature(core)] #![feature(collections)] extern crate libc; use self::libc::*; // <= header block end // mai...
#![forbid(unsafe_code)] pub mod borsh_state; pub mod borsh_utils; pub mod error; pub mod instruction; pub mod processor; pub mod state; use crate::error::Error; use borsh_state::InitBorshState; use solana_program::{ account_info::AccountInfo, program_error::ProgramError, program_pack::IsInitialized }; // expecte...
use std::collections::HashMap; fn dfs<'a>( mut visited: std::collections::HashMap<&'a str, u8>, tree: &'a HashMap<&str, Vec<&str>>, node: &'a str, ) { if !visited.contains_key(&node) { println!("{}", node); visited.insert(node, 1); for brother in &tree[node] { dfs(vi...
struct Greeter; impl Greeter { fn call(&self) { println!("Hello rust"); } fn call_mut(&mut self) { self.call(); } fn call_once(self) { self.call(); } } fn main() { let mut greeter = Greeter {}; greeter.call(); // greeter.call_once(); greeter.call_mut()...
extern crate futures; extern crate futures_test; extern crate futures_watch; use futures::{Stream}; use futures_test::Harness; use futures_watch::*; #[test] fn smoke() { let (mut watch, mut store) = Watch::new("one"); // Check the value assert_eq!(*watch.borrow(), "one"); assert!(!watch.is_final()); ...
extern crate git2; mod lib; use lib::merge_all_hooks; use futures::executor::block_on; fn main() { block_on(merge_all_hooks()) }
use std::{collections::HashSet, fs}; const FILENAME: &str = "inputs/inputday5"; pub fn solve() { let input = fs::read_to_string(FILENAME).expect("Failed to read file"); let mut seats: Vec<i32> = Vec::new(); for line in input.lines() { let mut row = 0; let mut row_off = 64; let mut...
use input_i_scanner::InputIScanner; use join::Join; fn main() { let stdin = std::io::stdin(); let mut _i_i = InputIScanner::from(stdin.lock()); macro_rules! scan { (($($t: ty),+)) => { ($(scan!($t)),+) }; ($t: ty) => { _i_i.scan::<$t>() as $t }; ...
// Copyright 2014 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 ...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[cfg(feature = "Devices_Lights_Effects")] pub mod Effects; #[link(name = "windows")] extern "system" {} pub type Lamp = *mut ::core::ffi::c_void; pub type LampArray = *mut ::core::ffi::c_void; #[repr(tran...
use crate::style::Style; use crate::test_util::expect_debug; use crate::{AsciiCanvas, AsciiView}; #[test] fn draw_box() { let mut canvas = AsciiCanvas::new(5, 10); { let view: &mut dyn AsciiView = &mut canvas; view.draw_vertical_line(2..5, 2); view.draw_vertical_line(2..5, 7); v...
use proconio::{input, marker::Chars}; fn similar(x: char, y: char) -> bool { x == y || (x == '1' && y == 'l') || (x == 'l' && y == '1') || (x == '0' && y == 'o') || (x == 'o' && y == '0') } fn main() { input! { n: usize, s: Chars, t: Chars, }; l...
use crate::auth; use crate::handlers::types::*; use crate::Pool; use actix_web::{web, Error, HttpResponse}; use actix_web_httpauth::extractors::bearer::BearerAuth; use crate::controllers::user_chat_controller::*; use crate::diesel::QueryDsl; use crate::diesel::RunQueryDsl; use crate::helpers::socket::push_user_messag...
#[doc = "Reader of register FDCAN_TTCTC"] pub type R = crate::R<u32, super::FDCAN_TTCTC>; #[doc = "Reader of field `CT`"] pub type CT_R = crate::R<u16, u16>; #[doc = "Reader of field `CC`"] pub type CC_R = crate::R<u8, u8>; impl R { #[doc = "Bits 0:15 - Cycle Time"] #[inline(always)] pub fn ct(&self) -> CT_...
/* Copyright (c) 2015, 2016 Saurav Sachidanand Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, di...
//! Time Filter //! //! The time filter can be used to restrict log events to only a certain portion of the day. //! //! # Example //! //! ```toml //! # Restrict log events between 22:00:00 UTC and 23:59:59 UTC to only Error. //! [filter.time] //! start = 22:00:00 //! # Optional (Defaults shown) //! end = 23:59:59 //! ...
#[doc = "Reader of register FMPRE0"] pub type R = crate::R<u32, super::FMPRE0>; #[doc = "Writer for register FMPRE0"] pub type W = crate::W<u32, super::FMPRE0>; #[doc = "Register FMPRE0 `reset()`'s with value 0"] impl crate::ResetValue for super::FMPRE0 { type Type = u32; #[inline(always)] fn reset_value() ...
use regex::{Captures, Match, Regex}; #[derive(Debug, PartialEq)] pub enum MatchType { Normal(String), Group(String), } #[derive(Debug, PartialEq)] pub struct MatchItem<'a> { pub text: &'a str, pub mtype: MatchType, } #[derive(Debug)] pub struct MatchSet<'a> { pub full_text: &'a str, pub re: &...
use peg; fn main() { peg::cargo_build("src/sparql/sparql_grammar.rustpeg"); }
use std::collections::HashMap; use std::fmt; use std::io; use std::io::Read; use std::ops::Index; use std::string::{self, ToString}; use byteorder::{BigEndian, ReadBytesExt}; use flate2::read::{GzDecoder, ZlibDecoder}; use rustc_serialize; use rustc_serialize::hex::ToHex; use self::DecoderError::*; /// Represents a ...
pub mod aftermath; pub mod tree;
fn merge (list: Vec<i32>, start_idx: usize, start_second_idx: usize, stop_idx: usize) -> Vec<i32> { let mut new: Vec<i32> = Vec::new(); let mut current = start_idx; let mut second = start_second_idx; while current <= stop_idx { if current >= start_second_idx { //push all elements fr...
pub struct Solution; impl Solution { pub fn combination_sum(candidates: Vec<i32>, target: i32) -> Vec<Vec<i32>> { fn rec(candidates: &[i32], target: i32) -> Vec<Vec<i32>> { let n = candidates.len(); if n == 0 { if target == 0 { vec![vec![]] ...
#![warn(clippy::all, clippy::pedantic, clippy::cargo)] #![allow(clippy::multiple_crate_versions)] #![forbid(unsafe_code)] use clap::{crate_authors, crate_description, crate_version, App, Arg}; use color_eyre::eyre::{ContextCompat, Result, WrapErr}; use crate::config::Config; use crate::state::State; use prompt::selec...
//! Re-exports commonly-used APIs that can be imported at once. pub use crate::interrupt::without_interrupts;
use core::fmt; use core::hash::{Hash, Hasher}; use firefly_diagnostics::{SourceSpan, Span, Spanned}; use firefly_intern::Ident; use crate::FunctionName; /// Represents a deprecated function or module #[derive(Debug, Copy, Clone, Spanned)] pub enum Deprecation { Module { #[span] span: SourceSpan, ...
//! Server logic for driving the library via commands. use std::cell::RefCell; use std::collections::{HashMap, HashSet}; use std::hash::Hash; use std::rc::Rc; use std::time::{Duration, Instant}; use timely::communication::Allocate; use timely::dataflow::operators::capture::event::link::EventLink; use timely::dataflow...
use crate::raw::Table; use crossbeam_epoch::Atomic; use parking_lot::Mutex; /// Entry in a bin. /// /// Will _generally_ be `Node`. Any entry that is not first in the bin, will be a `Node`. #[derive(Debug)] pub(crate) enum BinEntry<K, V> { Node(Node<K, V>), Moved, } unsafe impl<K, V> Send for BinEntry<K, V> w...
// 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 { wlan_common::mac::{AuthAlgorithmNumber, Bssid}, wlan_mlme::{ap::Ap, buffer::BufferProvider, common::mac, device::Device, error::ResultExt}, }...