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 ...
use { super::ChunkVec, amethyst::{core::Transform, ecs::prelude::*}, std::{ collections::{HashMap, HashSet}, ops::Deref, sync::{Arc, RwLock}, }, }; /// Component trait to allow tracking of disparate types of chunk-based loaders. pub trait LoadRadius: Clone + Component { fn v...
use std::fs::read_to_string; use std::num::NonZeroU32; use rand::prelude::thread_rng; use rand::seq::SliceRandom; use data_encoding::BASE64; use ring::rand::{SecureRandom, SystemRandom}; use ring::pbkdf2; const KEY_LEN: usize = 64; const SALT_LEN: usize = 12; const PASS_LEN: usize = 16; pub type Credential = [u8; KE...
//! Parse configuration or use default values //! //! This module parses the configuration in TOML style and replaces any missing value with //! defaults. The configuration can later be used in the webserver, sync server and websocket //! server to behave in the expected way. #[macro_use] extern crate serde; extern c...
use std::cmp::Reverse; use std::cmp::{max, min}; use std::collections::{HashMap, HashSet}; use itertools::Itertools; use whiteread::parse_line; const ten97: usize = 1000_000_007; // いもす法 // (1, 2), (3, 4)の長方形の場合以下のようにしていもすする // 0 1 2 3 4 5 y // 1 1 -1 // 2 // 3 // 4 -1 1 // 5 // x fn main() { ...
use super::{log, log1p, sqrt}; const LN2: f64 = 0.693147180559945309417232121458176568; /* 0x3fe62e42, 0xfefa39ef*/ /* asinh(x) = sign(x)*log(|x|+sqrt(x*x+1)) ~= x - x^3/6 + o(x^5) */ /// Inverse hyperbolic sine (f64) /// /// Calculates the inverse hyperbolic sine of `x`. /// Is defined as `sgn(x)*log(|x|+sqrt(x*x+1...
//! ```elixir //! case Lumen.Web.Document.get_element_by_id(document, "element-id") do //! {:ok, element} -> ... //! :error -> ... //! end //! ``` use liblumen_alloc::erts::exception; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; use crate::runtime::binary_to_string::bina...
use crate::parse::{Instruction, NoteLength, ParseError, ParseResult, RollbackableTokenStream}; use crate::tokenize::TokenKind; use crate::try_or_ok_none; pub fn parse_length(stream: &mut RollbackableTokenStream) -> Vec<NoteLength> { let mut length = vec![]; loop { if let Some(&(_, TokenKind::Number(num...
use crate::app; use crate::error; use std::fmt; use termion::event::Key; #[derive(Debug, Copy, Clone)] pub enum Mode { Normal, Search, } impl fmt::Display for Mode { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) } } pub struct State { pub mode: Mode, p...
use crate::util::*; pub struct Game { pub arrows: u8, pub current_room: u8, pub messages: Vec<String>, pub wumpus: u8, bats: [u8; 2], pits: [u8; 2], } impl Game { fn configure_cave(&mut self) { self.messages.push( "voce entrou em uma caverna escura, armado com cinco fle...
use super::ops::*; #[cfg(target_arch = "x86")] use std::arch::x86::{ _xabort, _xabort_code, _xbegin, _xend, _xtest, _XABORT_CAPACITY, _XABORT_CONFLICT, _XABORT_DEBUG, _XABORT_EXPLICIT, _XABORT_RETRY, _XBEGIN_STARTED, }; #[cfg(target_arch = "x86_64")] use std::arch::x86_64::{ _xabort, _xabort_code, _xbegin,...
// SPDX-License-Identifier: Apache-2.0 AND MIT //! `Error` enum type /// An error enum. pub enum Error { /// [lapin::Error] variant. /// /// [lapin::Error]: https://docs.rs/lapin/latest/lapin/enum.Error.html Internal(lapin::Error), /// Other error variant. Other, } impl std::error::Error for E...
use input::ScanCode; use platform; /// Represents an open window on the host machine. #[derive(Debug)] pub struct Window(platform::window::Window); impl Window { /// Creates a new window named `name`. pub fn new(name: &str) -> Result<Window, CreateWindowError> { Ok(Window(platform::window::Window::new...
pub use executor::RuleExecutor; pub use rule_error::RuleErrorMsg; pub mod executor; pub mod package_matcher; pub mod rule_error;
// 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 ...
//! See <https://github.com/discord/discord-rpc/blob/master/documentation/hard-mode.md> //! for details on the protocol // BEGIN - Embark standard lints v0.3 // do not change or add/remove here, but one can add exceptions after this section // for more info see: <https://github.com/EmbarkStudios/rust-ecosystem/issues/...
extern crate inflector; extern crate toml; use std::cmp::Ordering; use std::collections::{BTreeSet, HashSet}; use std::fs::{self, File}; use std::io::prelude::*; use inflector::Inflector; use toml::{value::Table, Value}; #[derive(Debug, Default, Clone)] struct Symbol { key: String, id: Option<i64>, value...
use crate::hal::afio::MAPR; use crate::hal::gpio::gpioa; use crate::hal::gpio::gpiob; use crate::hal::gpio::gpioc; use crate::hal::gpio::gpiod; use crate::hal::gpio::{Alternate, Floating, Input, PushPull}; use crate::hal::pac::interrupt; use crate::hal::pac::{USART1, USART2, USART3}; use crate::hal::rcc::{Clocks, APB1,...
/* * hurl (https://hurl.dev) * Copyright (C) 2020 Orange * * 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 ...
pub mod cmd_buttons; pub mod cmd_dropdowns; pub mod cmd_example; pub mod cmd_help; pub mod cmd_ping; pub mod groups; // these glob imports let you use `use bot_commands::*;` if you so desire to import every command pub use cmd_buttons::*; pub use cmd_dropdowns::*; pub use cmd_example::*; pub use cmd_help::*; pub use c...
use std::sync::Arc; use super::HEq; use super::KV; pub struct Bucket<K, V> { elements: Vec<KV<K, V>>, } impl<K, V> Bucket<K, V> { pub fn new() -> Self { let elements = Vec::with_capacity(0); Self { elements } } pub fn find<'a>(&'a self, heq: &dyn HEq<K>, key: &K) -> Option<&'a V> { ...
mod functors; mod monoids; mod applicatives; mod monads;
use self::rust_analyzer::RustAnalyzer; use super::{ highlight::{highlight, theme::Theme}, Result, }; use crate::utils::{StringTools, _read_until_bytes}; use crossterm::{style::Color, terminal::ClearType}; use irust_repl::Repl; use printer::printer::{PrintQueue, Printer, PrinterItem}; use std::io::Write; use st...
#![macro_use] use crate::{app::AppContextPointer, errors::SondeError}; use gtk::{prelude::*, Notebook}; macro_rules! build_config_color_and_check { ($v_box:ident, $label:expr, $acp_in:expr, $show_var:ident, $color_var:ident) => { let hbox = gtk::Box::new(gtk::Orientation::Horizontal, BOX_SPACING); ...
#[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::PINASSIGN3 { #[doc = r" Modifies the contents of the register"] #[inline] pub fn modify<F>(&self, f: F) where for<'w> F: FnOnce(&R, &'...
use iai::black_box; use benchmarks::benchmarks::*; fn i32_cell_new() -> I32Cell { benchmarks::benchmarks::i32_cell_new(black_box(66)) } fn i32_cell_try_new_ok() -> Result<I32Cell, Box<u32>> { benchmarks::benchmarks::i32_cell_try_new_ok(black_box(66)) } fn i32_list_1k() -> i32 { i32_list(black_box(1_000)...
fn main() { for filename in std::env::args().skip(1) { println!("{}", filename); let scenario = parse_scenario(&std::fs::read_to_string(filename).unwrap()); println!("\tpart 1: ID of earliest bus * number of minutes you'll need to wait"); println!("\t{}", part1(&scenario)); ...
// Copyright 2020 IOTA Stiftung // // 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 w...
use crate::{BrokerEvent, BrokerId, NodeId, NodeRequest, NodeResponse, Query, RequestId}; use std::rc::Rc; use std::time::Duration; use serde::{Deserialize, Serialize}; use simrs::{Component, ComponentId, Fifo, Key, Queue, QueueId, Scheduler, State}; const BROKER_NOTIFY_DELAY: Duration = Duration::from_millis(10); /...
#![allow(dead_code)] #![allow(unused_imports)] use std::fs; use std::process::Command; use std::str; use crossbeam_utils::thread; use impls::impls; use self_cell::self_cell; #[allow(dead_code)] struct NotSend<'a> { ptr: *mut i32, derived: &'a String, } impl<'a> From<&'a String> for NotSend<'a> { fn fr...
#[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - Cache Level ID register"] pub clidr: CLIDR, #[doc = "0x04 - Cache Type register"] pub ctr: CTR, #[doc = "0x08 - Cache Size ID register"] pub ccsidr: CCSIDR, } #[doc = "Cache Level ID register\n\nThis register you ca...
// revisions: base nll // ignore-compare-mode-nll //[nll] compile-flags: -Z borrowck=mir // We didn't have a single test mentioning // `ReEmpty` and this test changes that. fn foo<'a>(_a: &'a u32) where for<'b> &'b (): 'a { //[base]~^ NOTE type must outlive the empty lifetime as required by this binding } fn main...
use std::clone::Clone; // Sedgewick, p.271, 273 // Cormen, p.31 /// Merge sort (Top down). /// /// Time complexity: /// /// * best: Ω(n log(n)) /// * avg: Θ(n log(n)) /// * worst: O(n log(n)) /// /// Space complexity: /// /// * O(1) pub fn sort<T: Ord + Clone>(input: &mut Vec<T>) { if...
pub fn is_prime(n: u32) -> bool { !(2..=(n as f64).sqrt() as u32).any(|m| n % m == 0) } pub fn nth(n: u32) -> u32 { match n { n if n < 0 => 2, n => (1..).filter(|num| is_prime(*num)).nth((n + 1u32) as usize).unwrap(), } // note: nth here is a method on type Vec from the filter, not a r...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type HttpDiagnosticProvider = *mut ::core::ffi::c_void; pub type HttpDiagnosticProviderRequestResponseCompletedEventArgs = *mut ::core::ffi::c_void; pub typ...
mod create; pub use create::Create; mod list; pub use list::List; mod interactive; pub use interactive::Interactive; mod tabular; pub use tabular::Tabular;
use crate::lexer::*; use crate::parsers::token::identifier::identifier; use crate::parsers::token::keyword::keyword; use crate::parsers::token::literal::string::double::double_quoted_string; use crate::parsers::token::literal::string::quoted::non_expanded_delimited_string; use crate::parsers::token::literal::string::si...
#![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type SecondaryAuthenticationFactorAuthentication = *mut ::core::ffi::c_void; #[repr(transparent)] pub struct SecondaryAuthenticationFactorAuthenticationMess...
use std::io; use std::io::Write; use crossterm::{ terminal,terminal::{ EnterAlternateScreen, LeaveAlternateScreen }, execute, event::{ read, poll, Event, KeyEvent, KeyCode, KeyModifiers } }; use std::time::Duration; extern crate rorg_agenda; mod event_list; use tui::Terminal; use tui::backend::...
/// Statically checked SQL query with `println!()` style syntax. /// /// This expands to an instance of [QueryAs] that outputs an ad-hoc anonymous struct type, /// if the query has output columns, or `()` (unit) otherwise: /// /// ```rust /// # use sqlx::Connect; /// # #[cfg(all(feature = "mysql", feature = "runtime-as...
use crate::lexer::{ErrorKind, LexicalError, Position, Span, Spanned, Token}; use failure::Fail; use lalrpop_util::ParseError; use std::fmt; use std::path::PathBuf; #[derive(Debug, Fail)] pub struct Error { /// Display of filename. pub path: PathBuf, /// Position of lexeme. pub span: Option<Span>, c...
use crate::backend::c; use bitflags::bitflags; use core::marker::PhantomData; bitflags! { /// `O_*` constants for use with [`pipe_with`]. /// /// [`pipe_with`]: crate::io::pipe_with #[repr(transparent)] #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct PipeFlags: c::c_uint { ...
use self::SmtpInput::*; use bytes::Bytes; use std::fmt; use std::net::{Ipv4Addr, Ipv6Addr, SocketAddr}; #[derive(Eq, PartialEq, Debug, Clone)] pub enum SmtpInput { Command(usize, usize, SmtpCommand), Invalid(usize, usize, Bytes), Incomplete(usize, usize, Bytes), None(usize, usize, String), Connect...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn BindIoCompletionCallback<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::HANDLE>>(filehandle: Param0, functio...
use std::io; fn main() { // 一行目を取得、分割 let mut one_line_buffer = String::new(); io::stdin().read_line(&mut one_line_buffer).unwrap(); let one_line_vec: Vec<i64> = one_line_buffer .trim() .split_whitespace() .map(|c| c.parse().unwrap()) .collect(); let lake_circumfer...
/// An RGB color with an alpha channel. Supports 16-bits per channel to allow for HDR /// content or colors on devices like RGB LEDs that may have color accuracy beyond that /// of most monitors. pub type NodeColor = (u16, u16, u16, u16); /// Type alias for Trigger booleans pub type TriggerSignal = bool; /// Type ali...
use std::str; use bytes::Bytes; #[derive(Debug, Clone, PartialEq, Eq)] pub struct ByteStr(Bytes); impl ByteStr { pub unsafe fn from_utf8_unchecked(slice: Bytes) -> ByteStr { ByteStr(slice) } pub fn as_str(&self) -> &str { unsafe { str::from_utf8_unchecked(self.0.as_ref()) } } }
//! Spherical objects. use coord::Coord; #[allow(dead_code)] /// A spherical volume. pub struct Sphere { pub origin: Coord, pub radius: f64, pub coords: Vec<Coord>, }
use crow_ecs::{Joinable, SparseStorage, Storage}; use crate::{ config::CameraConfig, data::{Camera, PlayerState, Position, Velocity}, time::Time, }; #[derive(Debug)] pub struct CameraSystem; impl CameraSystem { pub fn run( &mut self, player_states: &SparseStorage<PlayerState>, ...
//https://leetcode.com/problems/number-of-students-doing-homework-at-a-given-time/submissions/ impl Solution { pub fn busy_student(start_time: Vec<i32>, end_time: Vec<i32>, query_time: i32) -> i32 { let mut students_count = 0; for i in 0..start_time.len() { if start_time[i] <= ...
use crate::api_helpers::ApiError; use crate::isolate::{ Isolate, IsolateMetadataBuilder, IsolatedBox, IsolatedBoxOptions, IsolatedBoxOptionsBuilder, IsolatedExecutedCommandResult, }; use serde::Serialize; use std::io; use std::os::unix::prelude::ExitStatusExt; use std::process::ExitStatus; use super::phase_set...
#![allow(clippy::cognitive_complexity)] #![allow(clippy::vec_init_then_push)] #![forbid(unsafe_code)] extern crate proc_macro; mod args; mod complex_object; mod description; mod directive; mod r#enum; mod input_object; mod interface; mod merged_object; mod merged_subscription; mod newtype; mod object; mod oneof_objec...
use std::io; pub fn run() -> io::Result<()> { // only generate numbers within range, so need to check that in // validate() let mut ctr = 0; let mut ctr2 = 0; for i in 153517..=630395 { if validate(i) { ctr += 1; } if validate2(i) { ctr2 += 1; ...
use fileutil; use std::collections::HashMap; pub fn run() -> () { match fileutil::read_lines("./data/2018/02.txt") { Ok(lines) => { // pt1. let mut twice: u32 = 0; let mut thrice: u32 = 0; for line in &lines { let mut char_count: HashMap<char...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[repr(transparent)] #[derive(:: core :: cmp :: PartialEq, :: core :: cmp :: Eq, :: core :: clone :: Clone, :: core :: fmt :: Debug)] pub struct IDummyHICONIncluder(pub ::windows::core::IUnkn...
/// Macros for newtypes stored with an sqlite INTEGER column. pub(super) mod i64_backed_u64 { /// Generates `new`, `new_or_panic` and `get` methods, `PartialEq` against `i64` and `u64`, and `fake::Dummy`. macro_rules! new_get_partialeq { ($target:ty) => { impl $target { pub ...
use std::collections::BTreeMap; use chrono::{NaiveDate, Datelike}; use crate::CT_DUMMY_VALUE; use util_rust::group::Grouper; use util_rust::{log, parse}; #[derive(Debug)] pub struct Wiki { pub topics: BTreeMap<String, Topic>, pub attribute_types: BTreeMap<String, AttributeType>, } #[derive(Debug)] pub struct ...
#![allow(unused_variables, non_upper_case_globals, non_snake_case, unused_unsafe, non_camel_case_types, dead_code, clippy::all)] #[cfg(feature = "Win32_Foundation")] #[inline] pub unsafe fn AddERExcludedApplicationA<'a, Param0: ::windows::core::IntoParam<'a, super::super::Foundation::PSTR>>(szapplication: Param0) -> su...
pub use crate::account::*; pub use crate::player::*; pub use crate::score::*; pub use crate::song::*; pub use crate::table::*; pub(crate) use serde::{Deserialize, Serialize};
fn main() { let s = "Hello World!."; for i in s.chars() { println!("{}", i); } }
//! Control structures for the BAPS3 server. use std::io::IoError; use std::io::net::ip::SocketAddr; use proto::Message; /// A response to the BAPS3 server. pub enum Response { /// Send a message to all connections on the server. Broadcast(Message), /// Send a message to precisely one connection, identi...
#[allow(unused_variables)] pub fn hello_generics() { struct Point<T, U> { x: T, y: U, } impl<T, U> Point<T, U> { fn mixup<V, W>(self, other: Point<V, W>) -> Point<T, W> { Point { x: self.x, y: other.y, } } } le...
fn main() { prost_build::compile_protos(&["src/bitswap_pb.proto"], &["src"]).unwrap(); }
/* Copyright 2020 <盏一 w@hidva.com> 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 dis...
pub mod ptype; use std::collections::BTreeMap; use ptype::PType; use std::sync::Arc; use super::utils::typedefs::Key; pub struct Context { } impl Context { pub fn new() -> Self { Context {} } }
use num_bigint::BigInt; use liblumen_alloc::erts::process::Process; use liblumen_alloc::erts::term::prelude::*; pub enum NumberToInteger { NotANumber, Integer(Term), F64(f64), } impl From<Term> for NumberToInteger { fn from(number: Term) -> Self { match number.decode().unwrap() { ...
use std::collections::HashMap; struct Solution {} impl Solution { pub fn find_min_height_trees(n: i32, edges: Vec<Vec<i32>>) -> Vec<i32> { let mut tree = HashMap::<i32, Vec<i32>>::new(); for edge in edges { tree.entry(edge[0]).or_insert(vec![]).push(edge[1]); tree.entry(ed...
fn main(){ let elem = 5u8; let mut vec = Vec::new(); // type of vector is infered from here. vec.push(elem); println!("{:?}", vec); println!("{}", type_of(vec)); } fn type_of<T>(_: T) -> &'static str { std::any::type_name::<T>() }
use std::collections::BTreeMap; use crate::ast; #[derive(Clone, Debug)] pub struct Table { pub id: u64, pub variables: Variables, } pub trait ToValues { fn to_values(&self) -> Values; } impl PartialEq for Table { fn eq(&self, other: &Self) -> bool { self.variables.eq(&other.variables) } ...
extern crate chrono; use symbol::SymbolId; use direction::Direction; use self::chrono::prelude::{DateTime, Utc}; pub mod detector; #[derive(Serialize, Deserialize, Clone, PartialEq, Debug)] pub struct Signal { symbol_id: SymbolId, direction: Direction, datetime: DateTime<Utc>, label: String } impl S...
::windows_sys::core::link ! ( "ole32.dll""system" #[doc = "*Required features: `\"Win32_System_Com_CallObj\"`*"] fn CoGetInterceptor ( iidintercepted : *const :: windows_sys::core::GUID , punkouter : :: windows_sys::core::IUnknown , iid : *const :: windows_sys::core::GUID , ppv : *mut *mut ::core::ffi::c_void ) -> :: w...
use std::sync::Arc; use assert_matches::assert_matches; use compactor_scheduler::{create_test_scheduler, CompactionJob}; use data_types::PartitionId; use iox_tests::TestCatalog; use super::{super::helpers, TestLocalScheduler}; #[tokio::test] async fn test_mocked_partition_ids() { let catalog = TestCatalog::new()...
#[macro_use] extern crate failure; #[macro_use] extern crate serde_derive; extern crate base64; extern crate dirs; extern crate openssl; extern crate reqwest; extern crate serde; extern crate serde_yaml; extern crate serde_json; extern crate http; pub mod client; pub mod config;
// 指针 pointer 是一个包含内存地址的变量的通用概念,这个地址引用指向一些其他数据 // Rust 中最常见的指针是第四章介绍的 引用(reference),使用 & 符号并解压了所指向的值 // 智能指针(smart pointers)是一类数据结构,它们的表现类似指针,但是也拥有额外的元数据和功能 // 智能指针起源于 C++,Rust 标准库中不同的智能指针提供了多于引用的额外功能,如 引用计数(reference counting) 智能指针 // 在 Rust 中,普通引用 和 智能指针 的一个额外区别是 引用是一类只借用数据的指针, // 而 智能指针 在大部分情况下都 拥有 它们指向的数据 // 比如 S...
use rand::distributions::{Distribution, Standard}; use rand::Rng; use super::util::{Point, Polygon, linecross}; fn newpoint(mut rng: rand::prelude::ThreadRng) -> Point { let mut point: Point = rng.gen(); point.x = (0.5-point.x)*200.0; point.y = (0.5-point.y)*200.0; return point } fn newpolygon() -> ...
use otspec::types::*; use otspec::{deserialize_visitor, read_field, read_field_counted}; use otspec_macros::tables; use serde::de::SeqAccess; use serde::de::Visitor; use serde::ser::SerializeSeq; use serde::{Deserialize, Serialize}; use serde::{Deserializer, Serializer}; /// The list of 258 standard Macintosh glyph na...
// 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 fidl_fuchsia_net as fidl_net; use fidl_fuchsia_net_stack as fidl_net_stack; use net_types::ip::{AddrSubnetEither, IpAddr, SubnetEither}; use net_types:...
macro_rules! UiElement { () => { iced::Element<<$crate::MainWindow as iced::Application>::Message> }; (for<$lf:lifetime>) => { iced::Element<$lf, <$crate::MainWindow as iced::Application>::Message> }; } macro_rules! UiMessage { () => { <$crate::MainWindow as iced::Application>::Message }; } // taken from ...
use std::{ collections::*, fs::File, io::{prelude::*, LineWriter}, }; use crate::main::{ collection::{single_file_index::*, string_utils::*}, file_processor::*, }; pub struct OndiskIndex { map: BTreeMap<String, HashSet<usize>>, size: usize, name: String, aliases: HashMap<String, us...
pub mod futu;
pub mod event; pub mod lexer; pub mod parse; pub mod parser; pub mod sink; pub mod source; pub mod span; pub mod syntax;
#[doc = "Reader of register _2_FLTSRC1"] pub type R = crate::R<u32, super::_2_FLTSRC1>; #[doc = "Writer for register _2_FLTSRC1"] pub type W = crate::W<u32, super::_2_FLTSRC1>; #[doc = "Register _2_FLTSRC1 `reset()`'s with value 0"] impl crate::ResetValue for super::_2_FLTSRC1 { type Type = u32; #[inline(always...
use crate::airsim::{CarControls, Client}; use crate::controller; use async_std::task; use async_trait::async_trait; use glutin::event::VirtualKeyCode; use glutin::event_loop::{ControlFlow, EventLoop}; use std::io::Result; use std::time::{Duration, Instant}; const REFRESH_INTERVAL: Duration = Duration::from_millis(16);...
// https://github.com/freebsd/freebsd/blob/master/sys/dev/acpica/acpiio.h // https://github.com/freebsd/freebsd/blob/master/sys/dev/acpica/acpi_battery.c use std::default::Default; use std::ffi::CStr; use std::fs; use std::mem; use std::os::unix::io::{AsRawFd, FromRawFd, IntoRawFd, RawFd}; use std::str::FromStr; use ...
// 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. //! GoogleAuthProvider is an implementation of the `AuthProvider` FIDL protocol //! that communicates with the Google identity system to perform authentica...
use derivative::Derivative; use k8s_openapi::{apimachinery::pkg::apis::meta::v1::OwnerReference, Resource}; use kube::api::Meta; use std::{fmt::Debug, hash::Hash}; #[derive(Derivative)] #[derivative(Debug, PartialEq, Eq, Hash, Clone)] pub struct ObjectRef<K: RuntimeResource> { kind: K::State, pub name: String,...
use aoc; use std::collections::HashMap; use std::collections::HashSet; use std::collections::BTreeMap; fn main() { let lines = aoc::lines_from_file("input.txt"); let mut a_to_i: HashMap<String, HashSet<String>> = HashMap::new(); let mut ing_hist: HashMap<String, u64> = HashMap::new(); for mut line ...
use crate::domain::{RedeemStakeBatch, StakeBatch, YoctoNear, YoctoStake}; use crate::interface; use near_sdk::borsh::{self, BorshDeserialize, BorshSerialize}; use std::ops::{Deref, DerefMut}; #[derive( BorshSerialize, BorshDeserialize, Debug, Clone, Copy, Eq, PartialEq, Ord, Partial...
extern crate framed; extern crate framed_test_type as lib; use lib::Test; use std::io::stdout; fn main() { let t = Test { a: 1, b: 2, }; eprintln!("test_type/main.rs: Sending sample value: {:#?}", t); let mut s = framed::bytes::Config::default() ....
use rustpython::vm::{ pyclass, pymodule, PyObject, PyPayload, PyResult, TryFromBorrowedObject, VirtualMachine, }; pub fn main() { let interp = rustpython::InterpreterConfig::new() .init_stdlib() .init_hook(Box::new(|vm| { vm.add_native_module( "rust_py_module".to_own...
use super::*; use ext::ToHex; #[cfg(unix)] use nix::{errno, fcntl, sys::stat, unistd}; use proc_self::fd_path; #[cfg(unix)] use std::{ ffi::{CStr, CString}, os::unix::io::AsRawFd }; use std::{ fs, io::{self, Read, Write}, mem, path }; /// Maps file descriptors [(from,to)] pub fn move_fds(fds: &mut [(Fd, Fd)]) { loo...
use bincode::deserialize; use ckb_jsonrpc_types as json_types; use ckb_types::{ bytes::Bytes, core::{EpochNumberWithFraction, ScriptHashType}, packed, prelude::*, H256, U256, }; use rocksdb::DB; use std::collections::HashSet; use std::convert::TryFrom; use std::sync::Arc; use super::{db_get, value,...
use crate::{OpenOptions, VFile, VMetadata, VPath, VFS}; use async_trait::async_trait; use futures_core::{ready, Stream}; use futures_io::{AsyncRead, AsyncSeek, AsyncWrite, SeekFrom}; use pin_project_lite::pin_project; use std::{ io::Result, pin::Pin, task::{Context, Poll}, }; pub trait BVFS: Sync + Send { ...
use crate::error; use crate::plan::field::field_by_name; use crate::plan::field_mapper::map_type; use crate::plan::ir::DataSource; use crate::plan::var_ref::influx_type_to_var_ref_data_type; use crate::plan::SchemaProvider; use datafusion::common::Result; use influxdb_influxql_parser::expression::{ Binary, BinaryOp...
#![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 EapHostPeerBeginSession(dwflags: u32, eaptype: EAP_METHOD_TYPE, pattributearray: *const EAP_ATTRIBUTES, htoke...
use crate::utils::SynErrorExt; use syn::parse::{Parse, ParseBuffer, Peek}; #[doc(hidden)] #[macro_export] macro_rules! ret_err_on_peek { ($input:ident, $peeked:expr, $expected:expr, $found_msg:expr $(,)*) => { if $input.peek($peeked) { return Err($input.error(concat!("expected ", $expected, ",...
use std::collections::HashSet; use std::fs::File; use std::io::Read; fn gcd(a: i64, b: i64) -> i64 { let (mut tmp_a, mut tmp_b) = (a, b); while tmp_b != 0 { let t = tmp_b; tmp_b = tmp_a % tmp_b; tmp_a = t; } if tmp_a < 0 { -tmp_a } else { tmp_a } } pub ...
mod lib; use lib::game::game; struct SDLContext { _context: sdl2::Sdl, _video_subsystem: sdl2::VideoSubsystem, _gl_context: sdl2::video::GLContext, window: sdl2::video::Window, event_pump: sdl2::EventPump, } fn create_window(name:&str, width:u32, height:u32) ->SDLContext { let sdl_context = sdl...
use std::io; use rand::Rng; fn main() { //call the guessing game guess_game(); } fn guess_game(){ //Print welcome message println!("Welcome to the guessing game!"); //Generate the random number let secret = rand::thread_rng().gen_range(1, 101); println!("Secre...
fn f(i: &i32) { println!("{}", i); } fn main() { let b = Box::new(1i32); f(&*b); }