text
stringlengths
8
4.13M
//search-route.rs use std::collections::BinaryHeap; use std::collections::HashMap; use std::hash::{Hash, Hasher}; use std::cell::RefCell; use std::rc::{Rc, Weak}; use std::fmt; use std::cmp::Ordering; #[derive(Debug, Clone, Copy)] struct Pos { x: usize, y: usize, } impl PartialEq for Pos { fn eq(&self, ot...
#![windows_subsystem = "windows"] extern crate sa2_set; extern crate getopts; extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; #[cfg(feature="gui")] extern crate gtk; mod obj_table; #[cfg(windows)] mod windows_pretty_formatter; #[cfg(feature="gui")] mod gui; use std::env; use std::...
// Since this is a crate, what in the crate with an individual file // must be recorded here, even for the inner depenedencies. // // For example, if the 'mod states' is not in this file, // the 'mod list' will have trouble to 'use states::State' pub mod node; pub mod list; pub mod number; mod states;
struct ThingHolder<T> { thing: T } impl ThingHolder<u32> { fn print_thing(&self) { println!("I'm specialized! {}", self.thing); } } impl ThingHolder<i32> { fn print_thing(&self) { println!("I'm also specialized! {}", self.thing); } } fn main() { let th = ThingHolder { thing: 5...
pub struct Solution; #[derive(Debug, PartialEq, Eq)] pub struct TreeNode { pub val: i32, pub left: Tree, pub right: Tree, } use std::cell::RefCell; use std::rc::Rc; type Tree = Option<Rc<RefCell<TreeNode>>>; impl Solution { pub fn is_symmetric(root: Tree) -> bool { match root { N...
use crate::utils::*; pub(crate) const NAME: &[&str] = &["Fn"]; pub(crate) fn derive(data: &Data, items: &mut Vec<ItemImpl>) -> Result<()> { let trait_path = quote!(::core::ops::Fn); let trait_ = quote!(#trait_path(__T) -> __U); let fst = data.fields().iter().next(); let mut impl_ = data.impl_with_cap...
#![allow(dead_code)] use bitcoin::consensus::encode::Error; use bitcoin::Transaction; use bitcoin_hashes::hex::ToHex; use bitcoin_hashes::Hash; use std::fmt::Write; pub fn hash160(str: &str) -> String { let decode: Vec<u8> = bitcoin_hashes::hex::FromHex::from_hex(str).expect("Invalid public key"); let hash = b...
/* * Firecracker API * * RESTful public-facing API. The API is accessible through HTTP calls on specific URLs carrying JSON modeled data. The transport medium is a Unix Domain Socket. * * The version of the OpenAPI document: 0.25.0 * Contact: compute-capsule@amazon.com * Generated by: https://openapi-generator.t...
use alloc::String; #[derive(Debug)] pub enum Agent { Unknown, Apple(String), Company(String), Owner(String), }
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: clone :: Clone, :: core :: marker :: Copy)] #[repr(C)] #[cfg(feature = "Win32_Foundation")] pub struct CONNECTDLGSTRUCTA { pub cbStructure: u32, pub hwndOwner: sup...
use std::sync::Arc; use compactor_scheduler::{ CommitUpdate, CompactionJob, CompactionJobStatus, CompactionJobStatusResponse, CompactionJobStatusVariant, Scheduler, }; use data_types::{CompactionLevel, ParquetFile, ParquetFileId, ParquetFileParams}; #[derive(Debug)] pub struct CommitToScheduler { schedule...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use liblumen_alloc::atom; use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; #[native_implemented::function(maps:take/2)] pub fn result(process: &Process, key: Term, map: Term) -> excepti...
//! Common functions, definitions and extensions for parsing and code generation //! of [GraphQL fields][1] //! //! [1]: https://spec.graphql.org/October2021#sec-Language.Fields pub(crate) mod arg; use proc_macro2::TokenStream; use quote::{quote, quote_spanned}; use syn::{ parse::{Parse, ParseStream}, parse_q...
#![no_std] #![no_main] #![feature(custom_test_frameworks)] #![test_runner(mini_os::test_runner)] #![reexport_test_harness_main = "test_main"] use bootloader::{entry_point, BootInfo}; use core::panic::PanicInfo; use mini_os::println; extern crate alloc; // this function is called on panic #[cfg(not(test))] #[panic_ha...
use crate::Result; use serde::{Deserialize, Serialize}; #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] pub(crate) struct Response { pub comment: Comment, } #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] pub(crate) struct ResponseList { pub comments: Vec<Comment>, } /...
use winapi::ctypes::{c_char, c_int, c_void}; pub type CreateInterfaceFn = unsafe extern fn(name: *const c_char, return_code: *const c_int) -> *const c_void;
use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::usize::MAX / 4; #[allow(unused)] const M: usize = 1000000007; fn...
#![feature(use_extern_macros)] extern crate protobuf; extern crate ekiden_core_common; extern crate ekiden_core_trusted; #[macro_use] extern crate token_api; mod token_contract; use token_api::{with_api, CreateRequest, CreateResponse, GetBalanceRequest, GetBalanceResponse, TransferRequest, Transfer...
mod http; mod ws; use smol::{ channel::{self, Receiver, Sender}, future, net::TcpListener, }; use std::collections::HashMap; use std::net::SocketAddr; use std::path::PathBuf; use tdn_types::{ message::{ReceiveMessage, RpcSendMessage}, primitive::Result, rpc::RpcParam, }; pub struct RpcConfig ...
/// Write a program that given a number (with arbitrary number of digits), converts it into LCD /// style numbers using the following format: /// _ _ _ _ _ _ _ /// | _| _||_||_ |_ ||_||_| /// | |_ _| | _||_| ||_| _| /// (each digit is 3 lines high) use std::error::Error; #[derive(Debug)] struct N...
mod hash; use std::env; use std::iter::Iterator; use std::process; pub fn main() { let args: Vec<_> = env::args().collect(); if args.len() != 3 { println!("Usage: {} <source> <target>", args[0]); process::exit(1); } }
#![cfg_attr(not(feature = "std"), no_std)] use codec::{Decode, Encode}; use serde::{Deserialize, Deserializer, Serialize}; use sp_std::vec::Vec; pub use pallet::*; #[cfg(test)] mod mock; #[cfg(test)] mod tests; #[cfg(feature = "runtime-benchmarks")] mod benchmarking; #[derive(Debug, Serialize, Deserialize, Encod...
use std::ops::RangeInclusive; #[derive(PartialEq, Debug)] struct PasswordPolicy { byte: u8, range: RangeInclusive<usize>, } fn parse_line(s: &str) -> anyhow::Result<(PasswordPolicy, &str)> { peg::parser! { grammar parser() for str { rule number() -> usize = n:$(['0'..='9']+) { n.pa...
use ::{TypeVariant, TypeData, Type, WeakTypeContainer, Result, TypeContainer}; use ::ir::TargetType; use ::FieldReference; use super::{Variant, VariantType}; use std::rc::Rc; use std::cell::RefCell; // Array #[derive(Debug)] pub struct ArrayVariant { pub count_path: FieldReference, pub count: Option<WeakTypeC...
use winapi::shared::{minwindef::DWORD, windef::COLORREF}; use winapi::um::commdlg::{CHOOSECOLORW, CC_RGBINIT, ChooseColorW}; use winapi::um::wingdi::{GetBValue, GetRValue, GetGValue, RGB}; use crate::controls::ControlHandle; use crate::NwgError; use std::cell::{RefCell}; use std::{ptr, mem}; use std::pin::Pin; struct...
pub mod header; pub mod helper_functions; pub mod logoff; pub mod requests; pub mod responses;
// SYNTAX TEST "Packages/Rust Enhanced/RustEnhanced.sublime-syntax" // Line comments // <- comment.line.double-slash // ^^^^^^^^^^^^^^ comment.line.double-slash /// Line doc comments // <- comment.line.documentation // ^^^^^^^^^^^^^ comment.line.documentation /*! // <- comment.block.documentation // <- comment.block...
use crate::prelude::*; use utilities::prelude::*; use std::mem::size_of; use std::os::raw::c_void; use std::slice; #[derive(Clone, PartialEq, Debug)] pub struct Block { memory: VkDeviceMemory, pub(crate) offset: VkDeviceSize, pub(crate) size: VkDeviceSize, pub(crate) used: bool, mapping: Option...
#[derive(Debug)] #[doc = "Represents a result of the interaction between the user and the GUI."] pub enum GuiResult<T> { #[doc = "The user cancelled the GUI without selecting an option"] Cancel, #[doc = "The user selected an option from the GUI"] Option(T), #[doc = "The user entered a custom option"...
pub struct Solution; impl Solution { pub fn find_ladders( begin_word: String, end_word: String, word_list: Vec<String>, ) -> Vec<Vec<String>> { use std::collections::HashMap; let mut words = word_list; words.push(begin_word.clone()); let n = words.len(); ...
// SPDX-License-Identifier: MIT OR BlueOak-1.0.0 use std::collections::HashMap; use std::fmt; use std::vec::Vec; #[derive(Clone, Debug)] pub enum Value { Null, Bool(bool), Number(f64), String(String), Object(HashMap<String, Value>), Array(Vec<Value>), } impl Default for Value { fn default...
/* Copyright 2020 Timo Saarinen 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 in writing, software d...
use crate::prelude::*; use std::os::raw::c_void; #[repr(C)] #[derive(Debug)] pub struct VkMemoryRequirements2 { pub sType: VkStructureType, pub pNext: *const c_void, pub memoryRequirements: VkMemoryRequirements, } pub type VkMemoryRequirements2KHR = VkMemoryRequirements2;
mod builder; mod serialize; mod deserialize; mod size_of; pub mod ib_to_js; #[cfg(all(test, feature = "js_tests"))] mod tests;
#[doc = "Reader of register ISR"] pub type R = crate::R<u32, super::ISR>; #[doc = "Reader of field `BMPER`"] pub type BMPER_R = crate::R<bool, bool>; #[doc = "Reader of field `DLLRDY`"] pub type DLLRDY_R = crate::R<bool, bool>; #[doc = "Reader of field `FLT6`"] pub type FLT6_R = crate::R<bool, bool>; #[doc = "Reader of...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type AppCapability = *mut ::core::ffi::c_void; pub type AppCapabilityAccessChangedEventArgs = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct AppC...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type Radio = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct RadioAccessStatus(pub i32); impl RadioAccessStatus { pub const Unspecified: Self ...
use program::*; use webapi::*; use std::cell::Cell; use std::comm; use std::comm::{Port, Chan}; use std::rand::{Rng, RngUtil, IsaacRng}; use std::vec; pub trait Generator { pub fn gen_sym(&mut self) -> Id; pub fn gen_expr(&mut self) -> Expr; pub fn gen_prog(&mut self) -> Program; pub fn get_sym(&mut ...
use crate::datastructure::DataStructure; use crate::util::ray::Ray; use crate::util::vector::Vector; use serde::export::fmt::Debug; pub mod mcshader; pub mod mtlshader; pub mod shaders; pub mod vmcshader; /// A shader in the rusttracer codebase means a piece of code that takes a ray, /// and asks the `datastructure` ...
use monitor::{Process}; use std::io; use dirs::home_dir; use std::fs; use std::io::prelude::*; use serde_json; pub fn save(path: String, process: &Process) -> io::Result<()> { let serialized_data = serde_json::to_string(&process.data)?; fs::create_dir_all(procs_path())?; println!("saving file {:?}", path); ...
use super::*; mod with_small_integer_time; // BigInt is not tested because it would take too long and would always count as `long_term` for the // super short soon and later wheel sizes used for `cfg(test)` #[test] fn without_non_negative_integer_time_error_badarg() { run!( |arc_process| { ( ...
// 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 carnelian::{ make_message, AnimationMode, App, AppAssistant, Canvas, Color, Coord, MappingPixelSink, Point, Rect, Size, ViewAssistant, ViewAssi...
use super::interconnect::Interconnect; use super::opcode::{OPCODE_NAME_LUT, CB_OPCODE_NAME_LUT, OPCODE_LENGTHS}; use std::string::String; #[allow(dead_code)] fn disassemble_opcode(opcode: u8, program_counter: u16, interconnect: &mut Interconnect) -> String { let opcode_length = OPCODE_LENGTHS[opcode as usize]; ...
use syntax::{ast, codemap}; use syntax::ext::base; use syntax::util::small_vector; use syntax::ext::build::AstBuilder; use syntax::print::pprust; use super::super::helpers; impl super::super::Generator<()> for super::ModelState { fn generate<'a>(self, sp: codemap::Span, cx: &mut base::ExtCtxt, _: ()) -> Box<base:...
use itertools::{FoldWhile, Itertools as _}; use std::{cmp::Ordering, io}; fn is_visible_from_edge(x: usize, y: usize, grid: &[Vec<u32>]) -> bool { let row = &grid[y]; let min_height = row[x]; // Left if !row.iter().take(x).any(|h| *h >= min_height) { return false; } // Right if !ro...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Devices_Adc")] pub mod Adc; #[cfg(feature = "Devices_AllJoyn")] pub mod AllJoyn; #[cfg(feature = "Devices_Background")] pub mod Background; #[cfg(feature = "Devices_Bluetooth...
extern crate cc; extern crate lalrpop; /// Adds a dependency to the build script. fn add_dependency(dep: &str) { println!("cargo:rerun-if-changed={}", dep); } fn main() { // Regenerate the lexer.(`LEX="flex" cargo build --features "lex"`) #[cfg(feature = "lex")] { use std::{env, process::Comma...
extern crate cql; extern crate eventual; extern crate mio; extern crate uuid; use std::borrow::Cow; use self::uuid::Uuid; use cql::*; use self::eventual::{Future,Async}; use std::collections::VecDeque; use std::thread; pub fn to_hex_string(bytes: &Vec<u8>) -> String { let strs: Vec<String> = bytes.iter() ...
test_stdout!(returns_true, "true\n"); test_stdout!( flushes_existing_message_and_returns_true, "true\nfalse\nfalse\n" ); test_stdout!(prevents_future_messages, "false\ntrue\nfalse\n");
pub mod biclustering; pub mod ranking; use egraph::algorithm::connected_components; use egraph_wasm_adapter::{JsGraph, JsGraphAdapter}; use wasm_bindgen::prelude::*; #[wasm_bindgen(js_name = connected_components)] pub fn js_connected_components(graph: JsGraph) -> JsValue { let graph = JsGraphAdapter::new(graph); ...
//! Benchmarks how fast it is to decend in the search tree. use criterion::{criterion_group, criterion_main, Criterion}; mod common; /// Configure the bencher. fn config_criterion() -> Criterion { Criterion::default().sample_size(50).configure_from_args() } /// Benchmarks full descents in the search tree. fn mm_...
//! Alacritty - The GPU Enhanced Terminal. #![warn(rust_2018_idioms, future_incompatible)] #![deny(clippy::all, clippy::if_not_else, clippy::enum_glob_use)] #![cfg_attr(feature = "cargo-clippy", deny(warnings))] // With the default subsystem, 'console', windows creates an additional console // window for the program. ...
use projecteuler::digits; use projecteuler::helper; static KEYLOG: &[u32] = &[ 319, 680, 180, 690, 129, 620, 762, 689, 762, 318, 368, 710, 720, 710, 629, 168, 160, 689, 716, 731, 736, 729, 316, 729, 729, 710, 769, 290, 719, 680, 318, 389, 162, 289, 162, 718, 729, 319, 790, 680, 890, 362, 319, 760, 316, 729...
use crate::common::StatementCache; use crate::error::Error; use crate::io::Decode; use crate::mssql::connection::stream::MssqlStream; use crate::mssql::protocol::login::Login7; use crate::mssql::protocol::message::Message; use crate::mssql::protocol::packet::PacketType; use crate::mssql::protocol::pre_login::{Encrypt, ...
extern crate imap; extern crate native_tls; use telegram_bot::{Api, Error}; use crate::tele::TStruct; use std::result::Result; use imap::types::{Fetch, Seq}; use imap::Session; //fn delete(seq: imap::types::Seq, s: &mut Session<TcpStream>) -> imap::error::Result<()> { // s.store(format!("{}", seq), "+FLAGS (\\Dele...
extern crate regex; use regex::Regex; #[derive(Debug)] struct LightPoint { point : (i64, i64), velocity : (i64, i64) } impl LightPoint { fn new(line: &str) -> LightPoint { let re = Regex::new(r"position=<([\s\S\d]*?),([\s\S\d]*?)> velocity=<([\s\S\d]*?),([\s\S\d]*?)>").unwrap(); let caps ...
#![deny(rustdoc::broken_intra_doc_links, rust_2018_idioms)] #![warn( clippy::clone_on_ref_ptr, clippy::dbg_macro, clippy::explicit_iter_loop, // See https://github.com/influxdata/influxdb_iox/pull/1671 clippy::future_not_send, clippy::todo, clippy::use_self, missing_debug_implementations...
use devx_cmd::run; use fs_extra::dir::CopyOptions; use khonsu_tools::{anyhow, code_coverage::CodeCoverage}; use structopt::StructOpt; #[derive(Debug, StructOpt)] enum Args { BuildBrowserExample { name: Option<String>, }, GenerateCodeCoverageReport { #[structopt(long = "install-dependencies"...
//! Day 9 use std::iter::FromIterator; use itertools::Itertools; use num_traits::{CheckedSub, NumAssignOps, Unsigned, Zero}; use crate::report_repair::find_sum; trait Solution { fn part_1(&self) -> u64; fn part_2(&self) -> u64; } impl Solution for str { fn part_1(&self) -> u64 { let input = pars...
extern crate byteorder; extern crate crc; #[macro_use] extern crate failure; extern crate rand; mod cpu; pub use cpu::Cpu; mod flags; pub use flags::Flags; mod instruction; pub use instruction::{Condition, Instruction}; mod memory; pub use memory::{Load, Memory, Store, VideoMemory}; mod registers; pub use regis...
use crate::helpers::{ColorScheme, ID}; use crate::render::{DrawCtx, DrawOptions, Renderable, BIG_ARROW_THICKNESS, OUTLINE_THICKNESS}; use ezgui::{Color, Drawable, GeomBatch, GfxCtx, Line, Prerender, Text}; use geom::{Polygon, Pt2D}; use map_model::{Map, Road, RoadID}; pub struct DrawRoad { pub id: RoadID, zord...
use std::collections::HashMap; use std::collections::HashSet; use unicode_segmentation::UnicodeSegmentation; /// Given a word and a list of possible anagrams of the word, returns the list /// of the words which are actually anagrams pub fn anagrams_for<'a>(word: &str, possible_anagrams: &'a [&str]) -> HashSet<&'a str>...
//! Implementation for setting up, signing, estimating gas and sending //! transactions on the Ethereum network. pub mod build; pub mod confirm; pub mod estimate_gas; pub mod gas_price; pub mod send; use crate::secret::{Password, PrivateKey}; use crate::transaction::build::BuildFuture; use crate::transaction::confirm...
#[doc = "Reader of register CCR"] pub type R = crate::R<u32, super::CCR>; #[doc = "Writer for register CCR"] pub type W = crate::W<u32, super::CCR>; #[doc = "Register CCR `reset()`'s with value 0"] impl crate::ResetValue for super::CCR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { ...
use super::config::*; /// 向上对齐页大小 pub const fn align_up_page(size: usize) -> usize { (size + PAGE_SIZE) & !(PAGE_SIZE - 1) } /// todo pub const fn pages(size: usize) -> usize { (size + PAGE_SIZE - 1) / PAGE_SIZE } /// 将一个结构体转换成缓冲区 /// 不安全 pub unsafe trait AsBuf: Sized { fn as_buf(&self) ->...
use std::io; use std::io::prelude::*; const WIDTH: usize = 25; const HEIGHT: usize = 6; const LAYER_SIZE: usize = WIDTH * HEIGHT; fn main() { let stdin = io::stdin(); let input = stdin.lock().lines().next().unwrap().unwrap().chars().map(|c| c.to_digit(10).unwrap() as u8).collect::<Vec<u8>>(); let layers ...
use std::{f64, iter}; use rand::prelude::SliceRandom; use rand::{Rng, RngCore}; use rand_distr::{Distribution, UnitDisc}; use rayon::iter::{IndexedParallelIterator, IntoParallelRefMutIterator, ParallelIterator}; use crate::light::Light; use crate::math::{OrthoNormalBasis, Ray, Unit3, Vec3, EPSILON}; use crate::scene:...
// 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::fmt::{self, Display, Formatter}; use url::Url; #[derive(Debug, PartialEq, Eq, Clone, Hash)] pub enum Rcst { Whitespace(String), Newline, TrailingWhitespace { child: Box<Rcst>, whitespace: Vec<Rcst>, }, // Inline Elements TextPart(String), EscapedChar(Option<char>),...
use divisors::Divisors; use proconio::input; fn main() { input! { n: u64, m: u64, }; for d in m.divisors() { if d <= n && m / d <= n { println!("{}", m); return; } } let mut ans = std::u64::MAX; for k in 1..=n.min(1000000) { let ...
/* * Copyright (C) 2020-2022 Zixiao Han */ use crate::def; const MOV_ENCODE_BIT_MASK: u32 = 0b11111111; #[inline] pub fn map_piece_char_to_code(piece_char: char) -> u8 { match piece_char { 'K' => def::WK, 'Q' => def::WQ, 'R' => def::WR, 'B' => def::WB, 'N' => def::WN, ...
use { super::{VoxType, WorldVec}, na::{Isometry3, Translation3, UnitQuaternion, Vector3}, std::{fmt, ops::Deref}, vek::{Aabb, Vec3}, }; #[derive(Clone, Copy, PartialEq, Eq)] pub struct Vox(pub VoxType); impl Vox { pub const DEFAULT_HEIGHT: f32 = 1.0; pub const DEFAULT_RESTITUTION: f32 = 0.0; ...
#![allow(clippy::unit_cmp)] use crate::sealed::Sealed; /// Flips tuple, so first element becomes last, last becomes first, 2-nd becomes /// 2-nd from the end and so on. /// /// ## Examples /// ``` /// use fntools::tuple::flip::FlipTuple; /// /// assert_eq!((1, "hello").flip(), ("hello", 1)); /// assert_eq!((true, 42,...
use std::ops; use proconio::{input, marker::Usize1}; use rustc_hash::FxHashMap; #[derive(Debug)] enum BucketRangeType { Whole(usize), Part((usize, ops::Range<usize>)), } #[derive(Debug)] struct BucketRangeIter { bucket_size: usize, value_range: ops::Range<usize>, } impl Iterator for BucketRangeIter ...
const YEJIN_ANNUAL_INCOME: u32 = 1200000000; fn main() { let mut x = 5; println!("x의 값: {}", x); x = 7; println!("x의 값: {}", x); println!("미래 예진이 연봉: {}", YEJIN_ANNUAL_INCOME); // Shadowed let y = 10; println!("y의 값: {}", y); // Shadowd 하다. let y = 12; println!("새로운 y의 값...
pub use image::ImageError; #[derive(Debug)] pub enum EngineError { Image(image::ImageError), File(FileError), #[cfg(all(not(target_arch = "wasm32"), feature = "gamepad"))] Gamepad(gilrs::Error), } #[derive(Debug)] pub enum FileError { Engine(macroquad::prelude::FileError), String(std::string::...
// // Sysinfo // // Copyright (c) 2017 Guillaume Gomez // /// Allows to cast only when needed. #[macro_export] macro_rules! auto_cast { ($t:expr, $cast:ty) => {{ #[cfg(target_pointer_width = "32")] { $t as $cast } #[cfg(not(target_pointer_width = "32"))] { ...
pub struct Solution; #[derive(Clone)] enum State { Unchecked, Checking, Checked, } struct OrderFinder { n: usize, priors: Vec<Vec<usize>>, state: Vec<State>, order: Vec<usize>, } impl OrderFinder { fn new(n: usize) -> Self { OrderFinder { n: n, priors: ...
// Copyright 2020-2021, The Tremor Team // // 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 agr...
#[doc = "Reader of register LOCK"] pub type R = crate::R<u32, super::LOCK>; #[doc = "Writer for register LOCK"] pub type W = crate::W<u32, super::LOCK>; #[doc = "Register LOCK `reset()`'s with value 0"] impl crate::ResetValue for super::LOCK { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
#[doc = "Reader of register STAT"] pub type R = crate::R<u32, super::STAT>; #[doc = "Reader of field `ACTIVE`"] pub type ACTIVE_R = crate::R<bool, bool>; #[doc = "Reader of field `NBRBUSY`"] pub type NBRBUSY_R = crate::R<bool, bool>; #[doc = "Reader of field `WBUSY`"] pub type WBUSY_R = crate::R<bool, bool>; #[doc = "R...
//! The sandbox is an unprivileged task runner //! //! Responsibilities include: //! * Drop privileges //! * Execute code //! * Delegate actions to the broker through an IPC client use ipc; use libc; use unix; use util; use futures::*; use std::fs; use std::io::prelude::*; use std::mem; use std::time::*; use tokio_time...
// 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 { fidl_fuchsia_hardware_vsock::Addr as Raw, std::{ hash::{Hash, Hasher}, ops::{Deref, DerefMut}, }, }; #[derive(Debug)] pu...
use actix_web::*; use actix_web::http::StatusCode; use futures::{future, Future, Stream}; use serde_json; use std::str; use api::State; use api::error::APIError; use flag::FlagPath; use user::User; const PATH_KEY: &'static str = "paths"; #[derive(Serialize, Deserialize)] struct FlagPathReq { pub app: String, ...
use aws_lambda_events::event::cloudwatch_logs::{ CloudwatchLogsData, CloudwatchLogsEvent, }; use crate::error::{ MetricForwarderError, MetricForwarderError::{ DecodeBase64Error, GunzipToStringError, ParseStringToLogsdataError, PoorlyFormattedEventError, }, }; fn par...
#![allow(unused_macros)] /// Check that the size and alignment of a type match the `sys` bindings. macro_rules! check_type { ($struct:ident) => { assert_eq_size!($struct, c::$struct); assert_eq_align!($struct, c::$struct); }; } /// The same as `check_type`, but for unions and anonymous structs...
use winit::{ event::*, event_loop::{EventLoop, ControlFlow}, window::{Window, WindowBuilder}, dpi::*, }; use std::path::Path; use futures::executor::block_on; use rand::Rng; use std::time::Instant; const TAU:f32 = 6.283185307179586; #[repr(C)] #[derive(Copy, Clone, Debug)] struct Vertex { position...
use super::point::Point; use super::random::Random; pub const SEWAGE_PURITY: u8 = 0; pub const MAX_PURITY: u8 = 100; const SEWAGE_SPREAD_RATE: u8 = 5; const MAX_PURITY_TO_SPREAD_SEWAGE: u8 = 25; const MIN_PURITY_TO_SLIDE: u8 = 75; #[derive(PartialEq, Clone, Copy)] pub enum Cell { Empty, Static, Sand, ...
mod counter; mod enumeration; mod integer; pub use self::counter::CounterDef; pub use self::enumeration::EnumDef; pub use self::integer::IntegerDef; use crate::ast::context::CheckerContext; use crate::ast::error::{Hint, TypeError}; use crate::ast::{Constraint, Statement}; use crate::ir; #[derive(Debug, PartialEq, C...
/* A collection of helper functions, types and traits for serializing automata. This crate defines its own bespoke serialization mechanism for some structures provided in the public API, namely, DFAs. A bespoke mechanism was developed primarily because structures like automata demand a specific binary format. Attempti...
use actix_web::{error, error::Error, FromRequest, HttpRequest, Result}; use auth::claims; use bigneon_db::models::User as DbUser; use bigneon_db::models::{Organization, Scopes}; use crypto::sha2::Sha256; use diesel::PgConnection; use errors::*; use jwt::Header; use jwt::Token; use middleware::RequestConnection; use ser...
use super::super::grouped::{GroupedOperation, GroupedOperator}; use nom_sql::SqlType; use serde::Deserialize; use std::collections::HashMap; use std::convert::{TryFrom, TryInto}; use prelude::*; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct OhuaTestOp { /// Assume we only have one ancestor for now ...
extern crate gocar; fn main() { let files = gocar::scan_c_files("example_c_project/src/main.c").unwrap(); //println!("{:?}", files); let need_recompile = gocar::ModifiedSources::scan("example_c_project/main", &files).unwrap(); let mut empty = true; for path in need_recompile { let path = p...
#![feature(const_fn)] #![feature(slice_patterns)] #![cfg_attr(test, feature(test))] pub mod color; pub mod matrix; pub mod orientation; pub mod point; pub mod quaternion; pub mod vector; #[cfg(test)] mod test; pub use color::Color; pub use matrix::{Matrix3, Matrix4}; pub use orientation::Orientation; pub use point::...
/// Logic for checking if a file in object storage should be deleted or not. pub(crate) mod checker; /// Logic for deleting a file from object storage. pub(crate) mod deleter; /// Logic for listing all files in object storage. pub(crate) mod lister;
use crate::common::ws0; use crate::identifier::unquoted_identifier; use crate::internal::{expect, Error, ParseError, ParseResult}; use crate::keywords::keyword; use crate::literal::{literal_regex, Duration}; use crate::timestamp::Timestamp; use crate::{ identifier::{identifier, Identifier}, literal::Literal, ...
//! Initialization code #![feature(panic_implementation)] #![no_std] #[macro_use] extern crate cortex_m; #[macro_use] extern crate cortex_m_rt; extern crate f3; use core::panic::PanicInfo; use core::sync::atomic::{self, Ordering}; use cortex_m::asm; pub use cortex_m::asm::{bkpt, nop}; use cortex_m::peripheral::ITM;...
#![allow(unused)] use std::{ env::var_os, fs::File, io::{BufRead, BufReader}, }; /// Attempt to parse the file as a `.rox` file whose /// specification matches the test.rox file pub struct Rox { /// A vector of identifier-value pairs pub switches: Vec<(String, String)>, pub comments: Vec<String...
use std::{ future::Future, io::Stdout, pin::Pin, task::{ Context, Poll, }, time::Instant, }; use pin_project::pin_project; use crate::metric_reporter::{ MetricReporter, TagPair, }; pub fn time_it<F, R>(f: F) -> (R, std::time::Duration) where F: FnOnce() -> R, { ...
use crate::persistent_database::metadata::Metadata; use crate::SOLANA_EXPORTER_VERSION; use anyhow::Context; use log::warn; use std::path::Path; use std::str::FromStr; pub mod metadata; /// Name of database name pub const DATABASE_FILE_NAME: &str = "persistent.db"; /// A persistent database used for storing data acr...