text
stringlengths
8
4.13M
//! A metadata summary of a Parquet file in object storage, with the ability to //! download & execute a scan. use crate::{ storage::{ParquetExecInput, ParquetStorage}, ParquetFilePath, }; use data_types::{ParquetFile, TimestampMinMax}; use schema::Schema; use std::{mem, sync::Arc}; use uuid::Uuid; /// A abst...
fn main(){ let triple = (2,55,"string"); match triple{ (1, y, z) => println!("matching tupple with first value 1. second:{y:?}, third:{z:?}."), // can't match on the middle value only. // (..,55, ..) => println!("only caring about second value."), (.., "string") => println!("matching tupple with \...
use self::token::ValidToken; use super::config::Config; use super::status; use super::worker::{Job, JobTrigger}; use crate::fs::next_job_id; use crate::worker::WorkerSender; use rocket::{self, State}; use rocket::config::{ConfigBuilder, Environment}; use rocket::fairing::AdHoc; use rocket::http::Status; use rocket::res...
#[derive(Debug, PartialEq)] enum Units { Miles(f64, String), Feet(f64, String), Inches(f64, String), Kilometers(f64, String), Meters(f64, String), Centimeters(f64, String), Pounds(f64, String), Ounces(f64, String), Kilograms(f64, String), Grams(f64, String), DegreesCelsius(f64, String), DegreesFahrenheit(f6...
#[doc = "Reader of register CICR"] pub type R = crate::R<u32, super::CICR>; #[doc = "Writer for register CICR"] pub type W = crate::W<u32, super::CICR>; #[doc = "Register CICR `reset()`'s with value 0"] impl crate::ResetValue for super::CICR { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
//! To run this code, clone the rusty_engine repository and run the command: //! //! cargo run --release --example text use rusty_engine::prelude::*; struct GameState { timer: Timer, } fn main() { let mut game = Game::new(); let fps = game.add_text("fps", "FPS: "); fps.translation = Vec2::new(0.0...
// Copyright 2021 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 ...
//! An entropy encoder. mod lazy_stream; use self::lazy_stream::*; use super::dictionary::Fetch; use super::probabilities::IntoStatistics; use super::rw::*; use bytes::lengthwriter::LengthWriter; use bytes::varnum::WriteVarNum; use io::statistics::{Bytes, ContentInfo, Instances}; use io::{Path, TokenWriter}; use Toke...
// 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 crate::architecture; use crate::architecture::Endian; use crate::executor::*; use crate::il; use crate::memory; use crate::translator::x86::Amd64; use crate::translator::{Options, Translator}; use crate::RC; fn init_amd64_driver<'d>( instruction_bytes: Vec<u8>, scalars: Vec<(&str, il::Constant)>, memor...
mod create_post_command; pub use create_post_command::*;
#![allow(non_camel_case_types, non_snake_case)] use otspec::types::*; use otspec::{deserialize_visitor, read_field}; use otspec_macros::tables; use serde::de::{SeqAccess, Visitor}; use serde::ser::SerializeSeq; use serde::Serializer; use serde::{Deserialize, Deserializer, Serialize}; tables!( Panose { u8 ...
#[cfg(feature = "serde")] mod submodule { use super::*; use serde_bytes::Bytes; #[cfg(test)] mod tests { extern crate serde_ as serde; use serde::{Deserialize, Serialize}; #[test] fn foo() { // error[E0463]: can't find crate for `serde` // --...
use std::path::Path; use image::{ImageBuffer, Rgba}; use tiny_fail::{ErrorMessageExt, Fail}; use crate::bucket::Bucket; use crate::color::alpha_brend; use crate::grid::Grid; use crate::scale::ColorScale; pub fn gen_and_save_image( path: impl AsRef<Path>, bucket: &Bucket, grid: &Grid, colorscale: &dyn...
use std::process::Command; pub fn git_check() { Command::new("git") .args(&["status", "--porcelain"]) .output() .expect("This tool requires git. Please install git and try again."); } pub fn git_commit(message: &str) { Command::new("git") .args(&["commit", "-m", message]) ...
#[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 { ...
use serde::{Serialize, Serializer}; use std::convert::TryFrom; use std::fs::File; use std::io::Result; use std::{collections::HashSet, path::Path}; use bam::Record; use noodles_bam::{self as bam, bai}; use noodles_bgzf::VirtualPosition; use noodles_sam::{self as sam}; #[derive(Debug, Serialize)] pub struct RefSeq { ...
use super::Request; use crate::error::NotpResult; use crate::store::DataStore; /// Lists all existing identifiers. /// /// It will only print the existing identifiers. Such as /// ``` /// 1. Google /// 2. Slack /// 3. Jira /// ``` pub(crate) fn list<T: DataStore>(request: Request<'_, T>) -> NotpResult<()> { reques...
// Copyright 2016 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 ...
/// ```rust,ignore /// 172. 阶乘后的零 /// /// 给定一个整数 n,返回 n! 结果尾数中零的数量。 /// /// 示例 1: /// /// 输入: 3 /// 输出: 0 /// 解释: 3! = 6, 尾数中没有零。 /// /// 示例 2: /// /// 输入: 5 /// 输出: 1 /// 解释: 5! = 120, 尾数中有 1 个零. /// /// 说明: 你算法的时间复杂度应为 O(log n) 。 /// ``` pub fn trailing_zeroes(n: i32) -> i32 { let mut n = n; let mut count = ...
#[macro_use] extern crate rocket; use parking_lot::RwLock; //use rocket::config::{Config, Environment}; use rocket::response::status::{Created, NoContent}; //use rocket::fairing::AdHoc; use rocket::State; use rocket_contrib::json::Json; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::sync:...
/// Multiway Tree #[derive(Debug, Clone, PartialEq)] pub struct MTree { value: char, children: Vec<MTree>, } impl MTree { /// Creates a leaf node pub fn leaf(value: char) -> Self { MTree::node(value, vec![]) } /// Creates a node with children pub fn node(value: char, children: Vec<M...
use super::bus::Busable; pub struct Ram { bank0: [u8; 0x1000], banks: Vec<[u8; 0x1000]>, high_ram: [u8; 0x7f], current_bank: usize, } impl Ram { pub fn new() -> Self { Ram { bank0: [0; 0x1000], banks: vec![[0; 0x1000]; 6], high_ram: [0; 0x7f], ...
// Copyright 2016 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 std::io::prelude::*; use std::net::{TcpListener, TcpStream}; use std::time::{Duration, Instant}; fn handle_client(mut stream: TcpStream, tcp_start: Instant) -> std::io::Result<()> { println!("Connection from {}", stream.peer_addr()?); loop { let mut buffer = [0; 2048]; let read_len = stre...
use scanner_proc_macro::insert_scanner; #[insert_scanner] fn main() { let (a , b) = scan!((f64, f64)); let x = a / a.hypot(b); let y = b / a.hypot(b); println!("{} {}", x, y); }
pub trait Sampler { fn get_samples_per_pixel(&self) -> u32; // TODO: }
use std::fmt; use juniper::ScalarValue; use serde::{de, Deserialize, Deserializer, Serialize}; /// Common utilities used across tests. pub mod util { use futures::StreamExt as _; use juniper::{ graphql_value, DefaultScalarValue, EmptyMutation, EmptySubscription, ExecutionError, GraphQLError, G...
//! An example of how to use lists in PickleDB. It includes: //! * Creating a new DB //! * Loading an existing DB from a file //! * Creating and removing lists //! * Adding and removing items of different type to lists //! * Retrieving list items use pickledb::{PickleDb, PickleDbDumpPolicy, SerializationMethod}; use s...
use actix_web::{web, App, Error as AWError, HttpResponse, HttpServer, Result}; use survey_manager_api::commands::{handle_command_async}; use survey_manager_api::inputs::{CreateSurveyDTO, UpdateSurveyDTO}; use survey_manager_core::app_services::commands::{CreateSurveyCommand, UpdateSurveyCommand, RemoveSurveyCommand}; u...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] pub const CLSID_AudioFrameNativeFactory: ::windows::core::GUID = ::windows::core::GUID::from_u128(0x16a0a3b9_9f65_4102_9367_2cda3a4f372a); pub const CLSID_VideoFrameNativeFactory: ::windows::...
use raster::{editor, BlendMode, PositionMode, *}; fn main() { let mut image1 = raster::open("X:/Rust Projects/dark_sky_editor/assets/test_ships/starling.png").unwrap(); let mut image2 = raster::open("X:/Rust Projects/dark_sky_editor/assets/test_ships/scout.png").unwrap(); let h = image2.he...
//! Process lifetime management use types::{int_t}; use syscalls::*; use rust::prelude::*; use posix::signal::{raise, SIGABRT}; static mut ATEXIT_FNS: [Option<extern "C" fn()>; 32] = [ None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, None, N...
use serde::{Deserialize, Serialize}; use n3_machine_ffi::{MachineId, WorkStatus}; #[derive(Debug, Serialize, Deserialize)] pub enum Response { Error { message: String }, Load { num_machines: MachineId }, Status { status: WorkStatus }, } impl Response { pub fn load(self) -> Result<MachineId, String> {...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use glib::object::Cast; use glib::object::IsA; use glib::signal::connect_raw; use glib::signal::SignalHandlerId; use glib::translate::*; use glib::GString; use glib::StaticType; use ...
#[doc = r"Value read from the register"] pub struct R { bits: u32, } #[doc = r"Value to write to the register"] pub struct W { bits: u32, } impl super::ALTCLKCFG { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R...
// Copyright (c) 2016 <daggerbot@gmail.com> // This software is available under the terms of the zlib license. // See README.md for more information. use std::fs::File; use std::io::{self, Read}; use std::str::FromStr; use core::{AppContext, ModuleQuery}; use serde::Deserialize; use toml; /// Info used when detectin...
mod body; use self::body::body; use crate::http::{bad_request, ok, Request, Result}; use itertools::Itertools; pub async fn get(req: Request) -> Result { let body = { req.query::<Vec<(String, String)>>() .map_err(|_| bad_request())? .into_iter() .format_with("\n", |(key,...
fn main() { // neg + pos let a = 160; let b = -20; println!("{:?}", a + b); // 140 let c = -10; if c > 0 { println!("Positif"); } else { println!("Negatif"); } let d = -10 / 2; println!("{:?}", d); let a = -3000; let b = 30; println!("{:?}", b + a);...
// This file was generated by gir (https://github.com/gtk-rs/gir) // from ../gir-files // DO NOT EDIT use crate::DateFormat; use glib::translate::*; glib::wrapper! { #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] pub struct Date(Boxed<ffi::SoupDate>); match fn { copy => |ptr| ffi::soup_da...
use proconio::{input, marker::Bytes}; fn main() { input! { _n: usize, s: Bytes, }; let l = s.iter().position(|&b| b == b'|').unwrap(); let r = s.iter().rposition(|&b| b == b'|').unwrap(); let m = s.iter().rposition(|&b| b == b'*').unwrap(); if l < m && m < r { println!...
use std::fs; /* * Challenge Specs #1 * * [1721, 979, 366, 299, 675, 1456] * [299, 366, 675, 979, 1456, 1721] * * 299 + 1721 = 2020 * * In this list, the two entries that sum to 2020 are 1721 and 299. * Multiplying them together produces 1721 * 299 = 514579, so the correct answer is 514579. * */ fn solution1...
// Copyright © 2016-2017 VMware, Inc. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //! This module contains the backend code that executes commited consensus operations. //! It represents the "state machine" in a "replicated state machine". //! //! Specifically, this backend wraps vertree and provides a...
static TOKEN_E : &'static str = "e"; static TOKEN_ZERO : &'static str = "0"; static TOKEN_POINT : &'static str = "."; pub fn to_expo(s: &str) -> Result<String, &'static str> { let len = s.len(); if len == 1 && s == "." { return Err("invalid input!"); } for c in s.chars() { ...
// 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 ...
mod guilds; mod leave; mod ping; mod prefix; use serenity::framework::standard::macros::group; use self::guilds::GUILDS_COMMAND; use self::leave::LEAVE_COMMAND; use self::ping::PING_COMMAND; use self::prefix::PREFIX_COMMAND; #[group()] #[commands(ping, prefix, guilds, leave)] pub struct Commands;
extern crate fall_test; extern crate fall_tree; use fall_test::{rust, match_ast}; use fall_tree::dump_file; fn ast(code: &str) -> String { dump_file(&rust::LANG.parse(code.to_owned())) } #[test] fn opt_pub() { match_ast(&ast("\ struct Foo {} fn bar() {} pub struct Baz {} pub fn quux() {} "), r#" FILE STRU...
// 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 agre...
use anyhow::Context; use rusqlite::OptionalExtension; use stark_hash::Felt; /// This migration renames the starknet_blocks to block_headers and adds the state_commitment, /// transaction_count and event_count columns, and also renames the root column to storage_commitment. pub(crate) fn migrate(tx: &rusqlite::Transact...
pub mod number_theory; pub mod search; pub mod sorting;
use std::fmt; use std::ops::Range; use std::rc::Rc; use super::{IoCtlDevice, IoCtlManager}; use crate::platform::traits::BatteryIterator; use crate::Result; pub struct IoCtlIterator { manager: Rc<IoCtlManager>, range: Range<libc::c_int>, } impl Iterator for IoCtlIterator { type Item = Result<IoCtlDevice>...
use std::cmp::Ordering; use std::collections::BTreeMap; use std::collections::VecDeque; use std::fmt; use std::io::{self, BufRead}; #[derive(Debug, Copy, Clone, PartialEq, Eq, PartialOrd, Ord)] struct Vector { x: i32, y: i32, } impl fmt::Display for Vector { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fm...
// 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 piston_window::*; use piston_window::text::Text; use crate::widget::Widget; use crate::widget::WidgetImpl; use crate::widget::Rect; use crate::h_scroll::HScroll; pub struct ScrollPanel { widget: WidgetImpl } impl ScrollPanel { pub fn new() -> Self { let mut widget = WidgetImpl::new(); let...
use super::track::Track; use super::util; use super::writer::Writer; use crate::MkvId; use std::ops::Deref; pub struct AudioTrack { track_: Track, // Audio track element names. bit_depth_: u64, channels_: u64, sample_rate_: f64, } impl Deref for AudioTrack { type Target = Track; fn dere...
#![feature(test)] #![deny(warnings)] extern crate futures; extern crate hyper; extern crate pretty_env_logger; extern crate test; extern crate tokio_core; use std::net::SocketAddr; use futures::{Future, Stream}; use tokio_core::reactor::{Core, Handle}; use tokio_core::net::TcpListener; use hyper::client; use hyper:...
use std::collections::VecDeque; use std::convert::TryFrom; use std::io; use error::Error; pub mod error; /// Used to read input for the program. /// /// Mainly used to allow easier testing. pub trait ProgInput { fn read(&mut self) -> Result<String, Error>; } /// Used to write output from the program. /// /// Ma...
use futures::{Future, Stream}; use hyper_tls::HttpsConnector; use hyper::Client; use tokio_core::reactor::Core; use serde_json; use std::string::String; use std::str; use std; #[derive(Debug, Serialize, Deserialize)] #[allow(non_snake_case)] pub struct CurrencyPrice { pub results: Vec<Res>, } #[derive(Serialize,...
#![allow(dead_code)] pub mod algebra; pub mod collection; pub mod planning; pub mod sat; pub mod stn; pub mod two_sat;
extern crate sysfs_gpio; use rand::prelude::*; use std::thread::sleep; use std::time::Duration; use sysfs_gpio::{Direction, Pin, Edge}; fn main() { rgb_touch(); } fn flash_led() { println!("Hello, world!"); let r_led = Pin::new(17); // number depends on chip, etc.s r_led.with_exported(|| { /...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use liblumen_alloc::erts::term::prelude::*; #[native_implemented::function(erlang:is_bitstring/1)] pub fn result(term: Term) -> Term { term.is_bitstring().into() }
//! The primary module containing microcontroller-specific core definitions /// The ATmega88. #[cfg(any(avr_mcu_atmega88, feature = "all-mcus"))] pub mod atmega88; #[cfg(avr_mcu_atmega88)] pub use self::atmega88 as current; /// The ATmega48A. #[cfg(any(avr_mcu_atmega48a, feature = "all-mcus"))] pub mod atmega48a; #[c...
extern crate reqwest; use std::collections::HashMap; use serde::{Deserialize, Serialize}; use serde_json::json; use crate::settings::{load_settings, Settings}; #[derive(Debug)] #[derive(Serialize, Deserialize)] pub struct WebAddon { pub(crate) addon_name: String, addon_foldername: String, pub(crate) add...
use crate::spec::{RelroLevel, TargetOptions}; pub fn opts() -> TargetOptions { TargetOptions { os: "netbsd".into(), dynamic_linking: true, families: vec!["unix".into()], no_default_libraries: false, has_rpath: true, position_independent_executables: true, rel...
use errors::*; use hex; use libsodacrypt; use net::endpoint::Endpoint; use net::event::{Event, ServerEvent}; use net::http; use net::message; use rmp_serde; use std; use std::io::{Read, Write}; #[derive(Debug, Clone, PartialEq)] pub enum SessionState { New, WaitPing, Ready, } pub struct SessionServer { ...
pub mod report_repair_part_1; pub mod report_repair_part_2;
use domain::Unit; use std::sync::mpsc::Receiver; pub trait UnitGateway { fn get_units_stream(&self) -> Receiver<Unit>; }
use std::env; use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; fn read_lines<P>(filename: P) -> io::Result<io::Lines<io::BufReader<File>>> where P: AsRef<Path>, { let file = File::open(filename)?; Ok(io::BufReader::new(file).lines()) } fn check_slope(left: usize, down: usize, input: &...
use std::{ future::Future, pin::Pin, task::{Context, Poll}, time::{Duration, Instant}, }; use async_io::Timer; use futures_core::Stream; /// Simple stream of `std::time::Instant` at a target rate. /// /// If the stream is polled late, the next instant will target the duration after the call to /// `po...
//! Common utility functions for sensors. use crate::{Device, Ev3Result}; /// Common utility functions for sensors. pub trait Sensor: Device { /// Reading the file will give the unscaled raw values in the `value<N>` attributes. /// Use `bin_data_format`, `num_values` and the individual sensor documentation to...
use s3::bucket::Bucket; use s3::creds::Credentials as aws_cred; use s3::region::Region; use s3::S3Error; struct Storage { name: String, region: Region, credentials: aws_cred, bucket: String, } pub fn aws_func(filename: String, data: Vec<u8>) -> Result<String, S3Error> { let aws = Storage { ...
#![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 PlatformDiagnosticActionState(pub i32); impl PlatformDiagnosticActionState { pub const Success: Self = Self(0i32); pub c...
use dlal_component_base::{component, err, json, serde_json, Arg, Body, CmdResult}; use lazy_static::lazy_static; use regex::Regex; use serde::{Deserialize, Serialize}; lazy_static! { static ref RE: Regex = Regex::new(concat!( r#"""#, r"%(\d+)", r"(?:\*([\d.e-]+))?", r"(?:\+([\d.e-]...
// 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...
use std::iter; use std::str; use lexical::tokens::Tokens; use lexical::tokens::Tokens::*; use lexical::types::Types; use lexical::keywords::Keywords; use lexical::symbols::Symbols; // A Lexer that keeps track of the current line and column position // as well as the position in the char input stream. pub struct Lexer...
use crate::name::{Name, COMPRESS_POINTER_MARK16, COMPRESS_POINTER_MARK8, MAX_LABEL_COUNT}; use crate::util::{InputBuffer, OutputBuffer}; use anyhow::Result; const MAX_COMPRESS_POINTER: usize = 0x3fff; const HASH_SEED: u32 = 0x9e37_79b9; #[derive(Clone, Copy, Default)] struct OffSetItem(u64); impl OffSetItem { p...
use input::Input; use input::evaluator::InputEvaluatorRef; use parser::{ Evaluator, Node }; use util; // Panic // // Ramps up a fan to full speed once a certain // condition is met. Otherwise, returns zero so // that this can be used with the accumulators. pub struct Panic { input : Box<Input>, temp_targ...
// 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 failure::Error; use futures::channel::mpsc; use rouille::{self, router, Request, Response}; use std::thread; const SERVER_IP: &str = "::"; const SERVE...
use crate::{ field::{BillingMethod, Currency}, structures::Structure, }; use retriever::traits::record::Record; use serde::{Deserialize, Serialize}; use std::borrow::Cow; #[derive(Debug, Deserialize, Serialize, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] pub struct Client { pub name: String, pub addr...
// 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. /// This module tests the property that pkg_resolver does not enter a bad /// state (successfully handles retries) when the TUF server errors while /// ser...
trait Inputable { fn input(arg: impl Into<String>) -> Self; } impl Inputable for i32 { fn input(arg: impl Into<String>) -> Self { arg.into().trim().parse().unwrap() } } macro_rules! leer_teclado { ($arg: tt: $type: ty) => { let mut input = String::new(); let _ = std::io::stdin(...
use std::env; use std::fs; use std::path::Path; fn main() { let src = env::args() .nth(1) .expect("src harus diisi!."); let dst = env::args() .nth(2) .expect("dst harus diisi!."); let res = get_files(src).unwrap(); // let dst_res = get_files(dst).unwrap(); for name in res { let fname = P...
//! Code related to the sending of HMS push notifications. //! //! ## Authentication //! //! We are using OAuth 2.0-based authentication with the "Client Credentials" mode. //! //! Docs: https://developer.huawei.com/consumer/en/doc/development/HMSCore-Guides/open-platform-oauth-0000001053629189 //! //! ## Message Sendi...
// 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 { crate::{ constants::{EMPTY_STORY_TITLE, GRAPH_KEY, STATE_KEY, TIME_KEY, TITLE_KEY}, models::{AddModInfo, OutputConsumer, StoryMet...
#[cfg(all(not(target_arch = "wasm32"), test))] mod test; use anyhow::*; use liblumen_alloc::erts::exception::{self, error}; use liblumen_alloc::erts::process::trace::Trace; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use crate::runtime::registry::pid_to_process; #[native_...
::windows_targets::link ! ( "vssapi.dll""system" #[doc = "*Required features: `\"Win32_Storage_Vss\"`*"] fn CreateVssExpressWriterInternal ( ppwriter : *mut IVssExpressWriter ) -> ::windows_sys::core::HRESULT ); pub type IVssAdmin = *mut ::core::ffi::c_void; pub type IVssAdminEx = *mut ::core::ffi::c_void; pub type IVs...
// 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 agre...
//! Tests the fields related to reflection generated in the StableAbi derive macro. use crate::{ abi_stability::{PrefixStableAbi, StableAbi}, reflection::ModReflMode, std_types::*, type_layout::{FieldAccessor, TLData, TLField}, }; #[repr(u8)] #[derive(StableAbi)] pub enum PubEnum { Variant0, V...
use petgraph::visit::{IntoNeighbors, IntoNodeIdentifiers}; use petgraph_drawing::{Drawing, DrawingIndex, DrawingValue}; use std::collections::HashMap; pub struct ForceAtlas2<S> where S: DrawingValue, { degree: Vec<usize>, links: Vec<Vec<usize>>, k: S, min_distance: S, } impl<S> ForceAtlas2<S> wher...
//! This module represents a tree connect request. //! The SMB2 TREE_CONNECT Request packet is sent by a client to request access to a particular share on the server. //! This request is composed of an SMB2 Packet Header that is followed by this request structure. use rand::{ distributions::{Distribution, Standard...
// Copyright 2019-2020 PolkaX. Licensed under MIT or Apache-2.0. use std::cmp::Ordering; use std::fmt; use super::Entry; use std::ops::DerefMut; pub trait Order: fmt::Debug + Sync + Send { fn cmp(&self, a: &Entry, b: &Entry) -> Ordering; } impl<F> Order for F where F: Fn(&Entry, &Entry) -> Ordering + fmt::D...
// 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 std::{thread, time::Duration}; use backend_embedded_graphics::{ themes::Theme, widgets::{background::BackgroundStyle, border::BorderStyle, label::ascii::LabelConstructor}, EgCanvas, }; use embedded_graphics::{ draw_target::DrawTarget, pixelcolor::BinaryColor, prelude::Size as EgSize, }; use embedde...
//! Runtime lifecycle related functionality. #[cfg(not(feature = "std"))] use alloc::vec::Vec; #[cfg(not(feature = "std"))] use alloc::rc::Rc; #[cfg(feature = "std")] use std::rc::Rc; use super::cost::code_deposit_gas; use super::util::copy_into_memory_apply; use super::{GasUsage, Machine, MachineStatus}; use crate:...
use std::time; fn main() { print_time_in_millis(); } fn print_time_in_millis() { let now = time::SystemTime::now(); let now_in_ms = now.duration_since(time::UNIX_EPOCH).expect("WTF").as_millis(); println!("{}", now_in_ms); }
//! The module contains widely used functions for more //! comfortable work with Scheme's object from Rust. use crate::errors::EvalErr; use crate::object::Object; use std::rc::Rc; /// Converts lists to Vec of references to its elements. pub fn list_to_vec(obj: &Object) -> Result<Vec<Rc<Object>>, EvalErr> { let mu...
// Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 use serde_json::Value; use super::super::VmmAction; use logger::{Metric, METRICS}; use request::{Body, Error, ParsedRequest, StatusCode}; // The names of the members from this enum must precisely corresp...
use engine::{self, EngineMessage}; use scheduler::{self, Async}; use polygon::geometry::mesh::{BuildMeshError, MeshBuilder}; use polygon::math::Vector2; use obj::{self, Obj}; use std::fs::File; use std::io; use std::io::prelude::*; use std::path::Path; use std::string::FromUtf8Error; use std::sync::atomic::{AtomicUsize...
#![allow(unused)] use ert::current; use std::collections::HashMap; use std::sync::{Arc, Mutex}; #[derive(Clone)] pub struct Checker { map: Arc<Mutex<HashMap<u64, u64>>>, } impl Checker { pub fn new() -> Self { Self { map: Arc::new(Mutex::new(HashMap::new())), } } pub fn a...
#[doc = "Reader of register FTSR2"] pub type R = crate::R<u32, super::FTSR2>; #[doc = "Writer for register FTSR2"] pub type W = crate::W<u32, super::FTSR2>; #[doc = "Register FTSR2 `reset()`'s with value 0"] impl crate::ResetValue for super::FTSR2 { type Type = u32; #[inline(always)] fn reset_value() -> Sel...