text
stringlengths
8
4.13M
// 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 agre...
extern crate clap; extern crate num_cpus; use clap::{App, Arg}; use std::collections::HashSet; use std::mem::swap; use std::net::{IpAddr, SocketAddr, TcpStream}; use std::process::exit; use std::time::Duration; fn main() { let matches = App::new("Ports Open") .version("1.0") ...
#![no_main] #![feature(start)] extern crate olin; use log::info; use olin::entrypoint; entrypoint!(); fn fib(n: u64) -> u64 { if n <= 1 { return 1; } fib(n - 1) + fib(n - 2) } fn main() -> Result<(), std::io::Error> { info!("starting"); fib(30); info!("done"); Ok(()) }
// 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 std::{collections::HashMap, convert::Infallible, sync::{Arc, Mutex}, thread}; use chrono::Utc; use tokio::{sync::mpsc}; use warp::{Filter, Rejection, Reply, fs::{ File, dir }, http::HeaderValue, hyper::{Body, HeaderMap, Response}, ws::{ Message, WebSocket }}; use futures::{FutureExt, StreamE...
use shrev::{EventChannel, ReaderId}; use specs::prelude::{Read, Resources, System, Write}; use crate::app::viewport::Viewport; use crate::event::WindowEvent; pub struct ViewportSystem { reader: Option<ReaderId<WindowEvent>>, } impl ViewportSystem { pub fn new() -> Self { ViewportSystem { r...
use std::convert::TryInto; use proptest::strategy::Just; use proptest::{prop_assert, prop_assert_eq}; use liblumen_alloc::erts::term::prelude::*; use crate::erlang::iolist_to_iovec_1::result; use crate::test::strategy::term::is_iolist_or_binary; use crate::test::with_process; #[test] fn with_iolist_or_binary_return...
use anyhow::Result; use qapi::qga; use log::warn; use tokio::time::{timeout, Duration}; use clap::{Parser, ValueEnum}; use super::{GlobalArgs, QgaStream}; #[derive(Parser, Debug)] /// Tells the guest to initiate a system shutdown pub(crate) struct Shutdown { #[clap(short, long, value_enum, default_value_t = Mode::Pow...
use super::*; use proptest::strategy::Strategy; #[test] fn without_big_integer_returns_false() { run!( |arc_process| { ( strategy::term::integer::big(arc_process.clone()), strategy::term(arc_process.clone()) .prop_filter("Right must not be a ...
use std::process::Command; pub static HALS: &[(&str, &str)] = &[ ("nrf51-hal", "thumbv6m-none-eabi"), ("nrf9160-hal", "thumbv8m.main-none-eabihf"), ("nrf52810-hal", "thumbv7em-none-eabi"), ("nrf52832-hal", "thumbv7em-none-eabihf"), ("nrf52833-hal", "thumbv7em-none-eabihf"), ("nrf52840-hal", "th...
use std::io; fn main() { loop { let mut items: Vec<i32> = Vec::new(); let c = get_items(&mut items); if c == 0 { break; } let max: i32 = items.iter().cloned().fold(0, i32::max); eprintln!("E: Max Val={}", max); let mut occs: Vec<u32> = vec![0; max...
use std::fs; fn main() -> Result<(), Box<dyn std::error::Error>> { let config = tonic_build::configure().out_dir("src/proto"); let mut src = Vec::<&str>::new(); src.push("proto/cosmos/auth/v1beta1/auth.proto"); ...
use super::util; use super::writer::Writer; use crate::MkvId; #[derive(Debug, Copy, Clone)] pub enum ProjectionType { kTypeNotPresent = -1, kRectangular = 0, kEquirectangular = 1, kCubeMap = 2, kMesh = 3, } pub struct Projection { type_: ProjectionType, pose_yaw_: f32, pose_pitch_: f32...
use actix_web::actix::Message; use chrono::{NaiveDateTime, Utc}; use crate::model::member::Member; use crate::model::response::MyError; use crate::model::user::User; use crate::share::schema::projects; use diesel::{Identifiable, Insertable, Queryable}; use serde_derive::{Deserialize, Serialize}; use uuid::Uuid; #[deri...
extern crate serde_json; use std::any::Any; use std::iter::Map; use std::time::SystemTime; use chrono::Local; use serde::{Deserialize, Serialize}; use serde_json::json; use serde_json::Value; use crate::utils::time_util; pub fn eval(left: &Value, right: &Value, op: &str) -> Result<Value, rba...
use nvml_wrapper::NVML; use procinfo::pid; use std::env; use std::process; use std::sync::atomic; use std::sync::Arc; use std::sync::Mutex; use std::thread; use std::time; fn get_parents(pid: u32) -> Vec<u32> { let stat = pid::stat(pid as i32); match stat { Ok(s) => match s.ppid { 0 => vec!...
#![deny(missing_docs)] //! //! Bitcoind //! //! Utility to run a regtest bitcoind process, useful in integration testing environment //! //! ```no_run //! use bitcoincore_rpc::RpcApi; //! let bitcoind = bitcoind::BitcoinD::new("/usr/local/bin/bitcoind").unwrap(); //! assert_eq!(0, bitcoind.client.get_blockchain_info()...
use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize, Debug)] pub struct MeshData { pub mesh_name: String, pub texture: String, pub vertices: Vec<Vertex>, #[serde(default)] lines: Vec<Line>, #[serde(default)] pub triangles: Vec<Triangle>, #[serde(default)] quads: ...
pub struct Solution; impl Solution { pub fn min_cut(s: String) -> i32 { let bytes = s.as_bytes(); let n = bytes.len(); let mut ends = vec![Vec::new(); n]; for i in 0..2 * n - 1 { let mut j = (i + 1) / 2; while j <= i && j < n && bytes[i - j] == bytes[j] { ...
#[doc = "Reader of register DSI_VHBPCCR"] pub type R = crate::R<u32, super::DSI_VHBPCCR>; #[doc = "Reader of field `HBP`"] pub type HBP_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:11 - Horizontal Back-Porch duration"] #[inline(always)] pub fn hbp(&self) -> HBP_R { HBP_R::new((self.bits & 0x0fff...
use std::env; use std::ffi::OsStr; use std::path::Path; use std::process::exit; use colored::*; use log::*; use pretty_env_logger; use ext::rust::PathExt; mod app; mod ext; mod localstack; mod stack; #[tokio::main] pub async fn main() { pretty_env_logger::init(); env::set_var("AWS_PAGER", ""); env::set...
use bitcoin::BitcoinHash; use bitcoin::util::hash::Sha256dHash; use c_bitcoin::CRgbOutPoint; use contract::CRgbContract; use CRgbNeededTx; use generics::WrapperOf; use rgb::contract::Contract; use rgb::proof::OutputEntry; use rgb::proof::Proof; use rgb::traits::Verify; use std::mem; use std::os::raw::c_uchar; use std::...
fn main() { spawn child("Hello"); } fn child(s: str) { }
use crate::libbb::ptr_to_globals::bb_errno; use libc; use libc::off64_t; use libc::off_t; extern "C" { #[no_mangle] fn lseek(__fd: libc::c_int, __offset: off64_t, __whence: libc::c_int) -> off64_t; } pub unsafe fn seek_by_jump(mut fd: libc::c_int, mut amount: off_t) { if amount != 0 && lseek(fd, amount, 1i32) =...
use actix_web::{self, middleware::Started, HttpMessage, HttpRequest}; use crate::share::common::Claims; use crate::share::state::AppState; use dotenv::dotenv; use jsonwebtoken::{decode, Validation}; use std::env; pub struct Authenticator; struct ClaimsBox(Box<Claims>); pub trait RequestJWTAuth { fn claims(&self)...
#[doc = "Reader of register TISEL"] pub type R = crate::R<u32, super::TISEL>; #[doc = "Writer for register TISEL"] pub type W = crate::W<u32, super::TISEL>; #[doc = "Register TISEL `reset()`'s with value 0"] impl crate::ResetValue for super::TISEL { type Type = u32; #[inline(always)] fn reset_value() -> Sel...
use app::database::create_connection_pool; use app::usecase::*; use app::web::Context; use chrono::prelude::Utc; use std::collections::HashMap; use std::time::{Instant}; #[tokio::main] async fn main() { let pool = create_connection_pool().unwrap(); let db = pool.get().await.unwrap(); let ctx = Context { s...
use std::cmp::min; use std::ffi::CString; use std::hash::Hash; use std::marker::PhantomData; use std::sync::Arc; use ash::vk; use crossbeam_channel::{ unbounded, Receiver, Sender, }; use smallvec::SmallVec; use sourcerenderer_core::graphics::{ AccelerationStructureInstance, Barrier, BarrierAcce...
#![ allow( non_snake_case ) ] use serde_derive::*; use std::collections::HashMap; use lt_blockchain::blockchain::{ digest, transaction }; // #[ test ] fn new() { println!( "check constructor" ); let got = digest::Digest::new(); assert_eq!( got.len(), 0 ); let exp : Vec<u8> = vec![]; assert_eq!( got.to_vec...
use super::*; impl<A: Array> Eq for StackVec<A> where A::Item : Eq, {} impl<A: Array> PartialEq for StackVec<A> where A::Item : PartialEq, { #[inline(always)] fn eq ( self: &Self, other: &Self, ) -> bool { self.as_slice().eq(other.as_slice()) } } impl<A: Array> has...
use std::cmp::max; /* The [vh]Rule[1-6]_Smush functions return the smushed character OR false if the two characters can't be smushed */ /// # Rule 1: EQUAL CHARACTER SMUSHING (code value 1) /// /// Two sub-characters are smushed into a single sub-character /// if they are the same. This rule does not smush /// hardb...
use regex::Regex; use std::collections::HashMap; use std::fs; use std::str; fn get_passport_hashmap(passport: &str) -> HashMap<&str, &str> { let mut passport_hashmap = HashMap::new(); let re = Regex::new("\n| ").unwrap(); let substrings: Vec<&str> = re.split(passport).collect(); for substring in substr...
use sea_schema::migration::prelude::*; pub struct Migration; impl MigrationName for Migration { fn name(&self) -> &str { "m20220421_000001_create_nodes_table" } } #[async_trait::async_trait] impl MigrationTrait for Migration { async fn up(&self, manager: &SchemaManager) -> Result<(), DbErr> { ...
#[macro_use] extern crate log; #[macro_use] extern crate enum_primitive; extern crate num; use std::sync::{Once, ONCE_INIT}; #[macro_use] mod util; pub mod constants; pub mod native; pub mod ssh_key; pub mod ssh_session; pub mod ssh_bind; static SSH_INIT: Once = ONCE_INIT; pub fn ssh_init() { //check_ssh_ok!(1)...
use crate::gl_wrapper::*; use std::collections::{HashMap, VecDeque}; use std::path::Path; use crate::containers::CONTAINER; use std::ffi::c_void; use crate::shaders::voxel::VoxelShader; #[derive(Copy)] #[derive(Clone)] pub struct Block { pub id: &'static str } impl Block { fn air() -> Self { Block { i...
#[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::INTENCLR { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w ...
use std::fs; use std::thread; use std::path::Path; use std::collections::HashMap; use std::io::{Read, Write, Error}; use std::sync::{Arc, Mutex, RwLock}; use std::os::unix::net::{UnixStream, UnixListener}; use std::net::Shutdown; use secret_integers::*; use simple::*; pub mod simple; use serde::{Serialize, Deserializ...
#[test] fn ejemplo_j1_loc() { assert_cli::Assert::main_binary() .with_args(&["-c", "test_data/ejemploJ1_base.csv", "-l", "PENINSULA"]) .stdout() .contains("C_ep [kWh/m2.an]: ren = 41.4, nren = 195.4, tot = 236.8") .stdout() .contains("RER = 0.17") .unwrap(); } #[test...
use std::io; use ash::vk; use ash::prelude::VkResult; use ash::version::DeviceV1_0; pub fn find_memorytype_index( memory_req: &vk::MemoryRequirements, memory_prop: &vk::PhysicalDeviceMemoryProperties, required_property_flags: vk::MemoryPropertyFlags, ) -> Option<u32> { for (index, ref memory_type) in...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[doc(hidden)] pub struct IXamlDirect(pub ::windows::core::IInspectable); unsafe impl ::windows::core::Interface for IXamlDirect { type Vtable = IXamlDirect_abi; ...
use proconio::{input, marker::Bytes}; fn main() { input! { s: Bytes, }; let b1 = s.iter().position(|&b| b == b'B').unwrap(); let b2 = s.iter().rposition(|&b| b == b'B').unwrap(); if b1 % 2 == b2 % 2 { println!("No"); return; } let r1 = s.iter().position(|&b| b == b...
#[macro_use] extern crate failure; use std::fmt::Debug; use failure::Fail; #[derive(Debug, Fail)] #[fail(display = "An error has occurred.")] pub struct UnboundedGenericTupleError<T: 'static + Debug + Send + Sync>(T); #[test] fn unbounded_generic_tuple_error() { let s = format!("{}", UnboundedGenericTupleError(...
use trust_dns::rr::domain::Name; use trust_dns::rr::dns_class::DNSClass; use trust_dns::rr::record_type::RecordType; use trust_dns::op::{MessageType, OpCode, Query}; use trust_dns::serialize::binary::{BinEncoder, BinDecoder, BinSerializable}; pub use trust_dns::op::Message; pub fn a_query(host: &str) -> Query { l...
//! mhpmcounter, Xuantie performance counter /// mhpmcounter3: L1 I-cache access counter pub fn l1_i_cache_access() -> usize { unsafe { get_csr_value!(0xB03) } } /// mhpmcounter4: L1 I-cache miss counter pub fn l1_i_cache_miss() -> usize { unsafe { get_csr_value!(0xB04) } } /// mhpmcounter5: I-uTLB miss counte...
use crate::Part; #[derive(Debug, Copy, Clone, PartialEq, Eq)] enum Space { Open, Filled, } struct Map { data: Vec<Vec<Space>>, width: usize, height: usize, } impl Map { fn new(map: &str) -> Self { let data: Vec<_> = map.split('\n').filter_map(|l| { if l.trim() != "" { ...
use tui::widgets::{Borders, Block, Paragraph, Table, Row}; use tui::text::Text; use tui::style::{Style, Modifier, Color}; use tui::layout::Constraint; use crate::runtime::data::launches::structures::{Launch, PadLocation, LaunchPad, LSP, RocketConfiguration, Rocket}; pub fn render_missing() -> Paragraph<'static> { ...
#[macro_use] extern crate lazy_static; mod cli; pub mod ward; use cli::WardArgs; use colored::Colorize; use encoding_rs::{Encoding, UTF_8}; use mime::Mime; use regex::Regex; use reqwest::header::{HeaderMap, HeaderName, HeaderValue, LOCATION}; use reqwest::redirect::Policy; use reqwest::{Body, header, Method, Proxy, R...
mod game; mod game_question; mod question; mod round; mod user; mod user_question; pub use self::game::*; pub use self::game_question::*; pub use self::question::*; pub use self::round::*; pub use self::user::*; pub use self::user_question::*;
//! Memory tracked parquet writer use std::{fmt::Debug, io::Write, sync::Arc}; use arrow::{datatypes::SchemaRef, record_batch::RecordBatch}; use datafusion::{ error::DataFusionError, execution::memory_pool::{MemoryConsumer, MemoryPool, MemoryReservation}, }; use observability_deps::tracing::warn; use parquet::...
// 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 ...
#[path = "integer_to_list_1/with_integer.rs"] pub mod with_integer; // `without_integer_errors_badarg` in unit tests
// 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 game_lib::rand::Rng; use std::{f32::consts::TAU, ops::RangeInclusive}; #[derive(Clone, Copy, PartialEq, Debug)] pub struct Wave { amplitude: f32, wavelength: f32, phase: f32, } #[derive(Clone, PartialEq, Debug)] pub struct Waves(Vec<Wave>); #[derive(Clone, PartialEq, Debug)] pub struct WavesConfig { ...
use serde::{de, Deserialize, Deserializer}; use std::str::FromStr; pub(crate) fn opt_bool_de_from_str<'de, D>(deserializer: D) -> Result<Option<bool>, D::Error> where D: Deserializer<'de>, { let s = String::deserialize(deserializer)?.to_ascii_lowercase(); let value = (bool::from_str(&s).map_err(de::Error::...
/* 1/8, 1/7, 1/6, 1/5, 1/4, 2/7, 1/3, 3/8, 2/5, 3/7, 1/2, 4/7, 3/5, 5/8, 2/3, 5/7, 3/4, 4/5, 5/6, 6/7, 7/8 1/8, 1/7, 1/6, 1/5, 2/8, 2/7, 2/6, 3/8, 2/5, 3/7, 4/8, 4/7, 3/5, 5/8, 4/6, 5/7, 6/8, 4/5, 5/6, 6/7, 7/8 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 1,5...
#[doc = "Reader of register HB16TIME3"] pub type R = crate::R<u32, super::HB16TIME3>; #[doc = "Writer for register HB16TIME3"] pub type W = crate::W<u32, super::HB16TIME3>; #[doc = "Register HB16TIME3 `reset()`'s with value 0"] impl crate::ResetValue for super::HB16TIME3 { type Type = u32; #[inline(always)] ...
use super::*; use proptest::strategy::Strategy; #[test] fn with_number_atom_reference_function_port_pid_tuple_map_or_list_second_returns_second() { run!( |arc_process| { ( strategy::term::binary::heap(arc_process.clone()), strategy::term(arc_process.clon...
#[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::LOCK { #[doc = r"Modifies the contents of the register"] #[inline(always)] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'w...
use datafrog; use datafrog::Iteration; use std::collections::HashMap; #[cfg(test)] mod test; type Row = usize; type Col = usize; type Label = usize; /// A board cell #[derive(Copy, Clone, Debug, Ord, PartialOrd, PartialEq, Eq)] enum Square { /// Covered cell Empty, /// Mine cell Mine, /// Mine-...
#[doc = "Reader of register MISC"] pub type R = crate::R<u32, super::MISC>; #[doc = "Writer for register MISC"] pub type W = crate::W<u32, super::MISC>; #[doc = "Register MISC `reset()`'s with value 0"] impl crate::ResetValue for super::MISC { type Type = u32; #[inline(always)] fn reset_value() -> Self::Typ...
fn trees(lines: &[Vec<bool>], hstride: usize, vstride: usize) -> usize { let width = lines[0].len(); let (mut x, mut y, mut trees) = (0, 0, 0); loop { trees += lines[y][x] as usize; x += hstride; y += vstride; if x >= width { x -= width; } if y >= ...
use std::collections::HashMap; use proconio::input; fn main() { input! { n: usize, a: [u32; n], }; let mut f = HashMap::new(); for x in a { *f.entry(x).or_insert(0) += 1; } let mut ans = 0; for (_, v) in f { ans += v / 2; } println!("{}", ans); }
pub mod payoffs; pub mod products; pub mod parameters; pub mod stats_collectors; pub mod random; #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }
use crate::prelude::*; use std::ffi::CStr; use std::fmt; use std::marker::PhantomData; use std::os::raw::{c_char, c_void}; use std::ptr; use std::slice; #[repr(C)] pub struct VkInstanceCreateInfo<'a> { lt: PhantomData<&'a ()>, pub sType: VkStructureType, pub pNext: *const c_void, pub flags: VkInstance...
use std::marker::PhantomData; use futures::{Async, Future, Poll}; use super::{NewService, Service}; /// Service for the `map_err` combinator, changing the type of a service's /// error. /// /// This is created by the `ServiceExt::map_err` method. pub struct MapErr<A, F, E> { service: A, f: F, _t: Phantom...
/* * Open Service Cloud API * * Open Service Cloud API to manage different backend cloud services. * * The version of the OpenAPI document: 0.0.3 * Contact: wanghui71leon@gmail.com * Generated by: https://openapi-generator.tech */ #[derive(Debug, PartialEq, Serialize, Deserialize)] pub struct CloudServerReques...
//! Extensions and types for the standard networking primitives. //! //! This module contains a number of extension traits for the types in //! `std::net` for Windows-specific functionality. use std::cmp; use std::io; use std::mem; use std::sync::atomic::{AtomicUsize, Ordering, ATOMIC_USIZE_INIT}; use std::net::{TcpSt...
use std::fmt::{self, Display, Formatter}; use std::default::Default; use rlua::{self, Table, Lua, UserData, ToLua, Value, AnyUserData, UserDataMethods}; use super::object::{self, Object, Objectable}; use super::signal; use super::property::Property; use super::class::{self, Class}; use rustwlc::types::KeyMod; use xcb::...
/* Project Euler Problem 15: Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. https://projecteuler.net/project/images/p015.gif How many such routes are there through a 20×20 grid? */ fn main() { let s = 20;...
use crate::{self as basic_token, Config, Error}; use frame_support::{assert_noop, assert_ok, construct_runtime, parameter_types}; use frame_system as system; use sp_core::H256; use sp_io::TestExternalities; use sp_runtime::{ testing::Header, traits::{BlakeTwo256, IdentityLookup}, }; type UncheckedExtrinsic = frame_s...
use octocrab::{self, models::Repository, Octocrab, Page}; use serde_json::Value; fn build_octocrab() -> Octocrab { let access_token = std::env::var("GITHUB_PERSONAL_ACCESS_TOKEN") .expect("GITHUB_PERSONAL_ACCESS_TOKEN env var must be set"); Octocrab::builder() .personal_token(access_token) ...
// 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, ResultExt}, fuchsia_async as fasync, futures::Future, std::io::Write, }; #[macro_use] pub mod expect; // Test harn...
#[doc = "Reader of register ITLINE10"] pub type R = crate::R<u32, super::ITLINE10>; #[doc = "Reader of field `DMA1_CH2`"] pub type DMA1_CH2_R = crate::R<bool, bool>; #[doc = "Reader of field `DMA1_CH3`"] pub type DMA1_CH3_R = crate::R<bool, bool>; impl R { #[doc = "Bit 0 - DMA1_CH1"] #[inline(always)] pub f...
fn main() { assert_eq!(2_203_160, sum_of_multiples(10_000, &[43, 47])); } fn sum_of_multiples(limit: u32, factors: &[u32]) -> u32 { let mut res = 0; for i in 1..=10 { if i % 3 == 0 || i % 5 == 0 { res += i; } else { continue; } } }
extern crate rand; extern crate rustbox; use rand::Rng; use rustbox::{Color, RustBox}; use rustbox::Event::KeyEvent; use rustbox::Key; use std::thread; use std::fs::File; use std::time::Duration; use std::time::Instant; use std::default::Default; use std::io::prelude::*; const PROC_FREQ_HZ: u64 = 500; const CYCLE_T...
use super::symbol::*; use super::script_type_description::*; use futures::*; use futures::stream; use futures::executor; /// /// Represents an edit to a script /// #[derive(Clone, PartialEq, Debug)] pub enum ScriptEdit { /// Removes all inputs and scripts from the editor Clear, /// Remove the current def...
pub use chip::arm::noop; pub use chip::arm::interrupts; #[path="../arm.rs"] mod arm; #[path="../tm4c123x/gpio.rs"] pub mod gpio; #[path="../tm4c123x/usb.rs"] pub mod usb; #[allow(non_snake_case)] #[path="../tm4c123x/rom/lib.rs"] pub mod rom; pub mod pinmap; //******************************************************...
use core::alloc::{AllocError, Layout}; use core::ptr::{self, NonNull}; use crate::alloc::realloc_fallback; use crate::sys::MIN_ALIGN; #[inline] pub fn alloc(layout: Layout) -> Result<MemoryBlock, AllocError> { let layout_size = layout.size(); let ptr = if layout.align() <= MIN_ALIGN && layout.align() <= layou...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" { #[cfg(feature = "Win32_Foundation")] pub fn ApplyLocalManagementSyncML(syncmlrequest: super::super::Foundation::PWSTR, syncmlresult: *mut super::super::F...
fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); let n: usize = rd.get(); let m: usize = rd.get(); let ab: Vec<(usize, usize)> = (0..m) .map(|_| { let a: usize = rd.get(); let b: usize = rd.get(); (a - 1, b - 1) ...
pub mod minimum_deviation; pub mod next_permutation; pub mod vertical_traversal;
use clippy_utils::diagnostics::span_lint_and_sugg; use clippy_utils::paths; use clippy_utils::source::snippet_with_macro_callsite; use clippy_utils::ty::{is_type_diagnostic_item, is_type_ref_to_diagnostic_item}; use if_chain::if_chain; use rustc_errors::Applicability; use rustc_hir as hir; use rustc_lint::{LateContext,...
use std::fmt::{self, Display, Formatter}; use crate::type_info::TypeInfo; #[cfg(feature = "postgres")] use crate::postgres::PgTypeInfo; #[cfg(feature = "mysql")] use crate::mysql::MySqlTypeInfo; #[cfg(feature = "sqlite")] use crate::sqlite::SqliteTypeInfo; #[cfg(feature = "mssql")] use crate::mssql::MssqlTypeInfo;...
use std::collections::HashMap; use std::fs::read_dir; use std::fs::File; use std::io; use std::io::prelude::*; use std::path::Path; use fluent_bundle::{FluentBundle, FluentResource, FluentValue}; use fluent_locale::negotiate_languages; pub trait Loader { fn lookup( &self, lang: &str, text_...
#[macro_use] extern crate quicli; use quicli::prelude::*; // Add cool slogan for your app here, e.g.: /// Get first n lines of a file #[derive(Debug, StructOpt)] struct Cli { // Add a CLI argument `--count`/-n` that defaults to 3, and has this help text: /// How many lines to get #[structopt(long = "git", s...
extern crate communicator; use communicator::_trait::hello_trait; use communicator::advanced_features::advanced_features; use communicator::collection; use communicator::concurrency::hello_rust_thread; use communicator::functional::hello_closures; use communicator::functional::hello_iterator; use communicator::generic...
extern crate rand; use rand::Rng; use super::Point; use super::Direction; use super::MazeGenerator; use super::super::grid::Grid; pub struct RecursiveBacktracker; impl MazeGenerator for RecursiveBacktracker { fn generate<T: Grid>(grid: &mut T) { let (width, height) = grid.get_dimensions(); ...
use projecteuler::helper; fn main() { //dbg!(solve(17, 6).len()); helper::time_it( || { solve(8, 4); }, 10_000, ); } //returns the solutions for s-gonal and d digits fn solve(s: usize, d: usize) -> Vec<Vec<(u16, u16)>> { let numbers: Vec<_> = (3..s + 1) .rev...
extern crate arrayvec; extern crate clap; extern crate hyper; extern crate screenprints; extern crate stopwatch; extern crate time; extern crate url; mod measured_response; mod summary; use measured_response::MeasuredResponse; use summary::Summary; use std::io::{stdout, Write}; use std::str::FromStr; use std::time::...
#[doc = "Reader of register ULPIVBUSCTL"] pub type R = crate::R<u8, super::ULPIVBUSCTL>; #[doc = "Writer for register ULPIVBUSCTL"] pub type W = crate::W<u8, super::ULPIVBUSCTL>; #[doc = "Register ULPIVBUSCTL `reset()`'s with value 0"] impl crate::ResetValue for super::ULPIVBUSCTL { type Type = u8; #[inline(alw...
pub fn parse_input(input: &str) -> Result<Vec<usize>, std::num::ParseIntError> { input .split(',') .map(|s| s.trim().parse::<usize>()) .collect::<Result<Vec<usize>, std::num::ParseIntError>>() } pub fn run_prog(input: &[usize]) -> Vec<usize> { let mut idx = 0; let mut output = Vec::...
use super::circular_unit::CircularUnit; use super::faction::Faction; use super::living_unit::LivingUnit; use super::message::Message; use super::skill_type::SkillType; use super::status::Status; use super::unit::Unit; #[derive(Clone, Debug, PartialEq)] pub struct Wizard { id: i64, x: f64, y: f64, speed...
pub mod p1; pub mod p215; pub mod p63;
use crate::autopilot_wrapper::*; use crate::res::*; use crate::TYPING_SPEED; use autopilot::geometry::{Point, Rect, Size}; use autopilot::key; use regex::Regex; use std::fs::{self, File}; use std::io::{BufRead, BufReader}; use std::path::Path; use std::thread::sleep; use std::time::Duration; fn find_interactive_app(iv...
use crate::{ library::{Chapter, Content}, source::Source, CACHE, }; use core::slice::SlicePattern; use futures::future::join_all; use reqwest::{ header::{HeaderMap, REFERER}, Client, Url, }; use serde::{Deserialize, Serialize}; use std::{ collections::BTreeMap, fs::File, io::BufReade...
use crate::window::{Window, Geometry}; use crate::stack::Stack; pub fn handle_layout<W>(view: &Geometry, windows: Stack<Window<W>>) -> Stack<Window<W>> { windows.into_iter() .map(|(is_current, window)| { (is_current, window.set_view(view.clone()).visible(is_current)) }) .collect...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: marker :: Copy, :: core :: clone :: Clone, :: core :: default :: Default, :: core :: fmt :: Debug)] #[repr(transparent)]...
use std::sync::Arc; use crate::{ protocol::parts::WriteLobReply, ExecutionResult, OutputParameters, ParameterDescriptors, }; #[derive(Debug)] pub enum InternalReturnValue { #[cfg(feature = "sync")] SyncResultSet(crate::sync::ResultSet), #[cfg(feature = "async")] AsyncResultSet(crate::a_sync::Resul...
use serde::{Deserialize, Serialize}; use serde_json::Result; use std::error::Error; use std::fmt; /* @4.10 获得账号关系 RequestAccountRelationsCommand 请求格式 id: u64, //(固定值): 1 command: String, //(固定值): account_lines relation_type: Option<String>, //None account: String, //需要用户传递的参数,钱包的地址 ledger_index: String //(...
use instruction; use std::io; error_chain! { errors { UnrecognizedInstruction(iw: instruction::InstructionWord) } foreign_links { Io(io::Error); } }