text
stringlengths
8
4.13M
use std::cell::RefCell; use std::collections::vec_deque::Iter; use std::collections::VecDeque; use std::fs::{File, OpenOptions}; use std::io; use std::io::Write; use std::iter::Skip; use std::rc::Rc; use futures::task::{self, Task}; use futures::{Async, AsyncSink, Poll, Sink, StartSend, Stream}; use options::Options;...
use std::collections::HashMap; use std::any::Any; use crate::tracked_call::TrackedCallId; pub(crate) struct ElVarMap { pub(crate) el_vars: HashMap<TrackedCallId, ElVarMapValue>, } pub(crate) struct ElVarMapValue { data: Box<dyn Any>, } impl ElVarMap { pub(crate) fn new() -> Self { Self { ...
// Copyright 2020 WHTCORPS INC. Licensed under Apache-2.0. #[macro_use] extern crate clap; #[macro_use] extern crate vlog; use std::borrow::ToOwned; use std::cmp::Ordering; use std::error::Error; use std::fs::{self, File, OpenOptions}; use std::io::{self, BufRead, BufReader}; use std::iter::FromIterator; use std::pat...
mod field; mod field_visitor; mod folder_visitor; use self::folder_visitor::FolderVisitor; use crate::entities::models::Folder; use crate::entities::presentation::FromJson; use serde::de::{Deserialize, Deserializer}; const FIELDS: &[&str] = &["folder_id", "name", "parent_id", "user_id"]; impl<'de> Deserialize<'de> f...
fn main() { let a = [10,20,30,40,50]; for number in a.iter() { println!("{}",number); } }
use graphics::*; use graphics::backgrounds; use graphics::geom_visuals; pub fn new_background(name: &str) -> Box<Background> { let bg = name.to_lowercase(); match bg.as_str() { "fill" => Box::new(backgrounds::SolidColor::new()), "solid" => Box::new(backgrounds::SolidColor::new()), x => ...
use std::collections::HashMap; #[allow(dead_code)] pub fn run() { let mut scores = HashMap::new(); scores.insert(String::from("blue"), 10); println!("Hash map: {:?}", scores); // println!("Create hash map from vectors"); let teams = vec![String::from("green"), String::from("yellow")]; let i...
// Copyright 2020-2022 The NATS 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 required by applicable law or agreed to ...
use crate::*; pub struct Widget { pub pos: Vec2f, pub size: Vec2f, pub draw_type: DrawType, pub on_click: Vec<MenuCommand>, pub hotkey: Option<Key>, } pub enum DrawType { Color(Color), Texture(TextureId), Text(String), } impl App { pub fn draw_widget(&mut self, w: Widget) { match w.draw_type { DrawType...
use super::{Code, Remote}; use irp::{InfraredData, Irp, NFADecoder, NFA}; use log::debug; pub struct LircDecoder<'a> { pub remote: &'a Remote, pub nfa: NFA, pub decoder: NFADecoder<'a>, } impl Remote { /// Create a decoder for this remote pub fn decoder(&self, abs_tolerance: u32, rel_tolerance: u3...
use std::collections::HashMap; use std::rc::Rc; use std::cell::RefCell; use std::collections::hash_map::DefaultHasher as DHasher; use std::hash::Hasher; use std::io::prelude::*; const BLOCK_SIZE: usize = 64; const BLOCK_OFFSET: usize = 2; const ROOT_BLOCK_OFFSET: usize = 3; #[derive(Clone)] struct Builder { valu...
extern crate libc; use anonymous_decls::rust_k; use self::libc::{c_int, c_uint}; pub fn test_anonymous_decl() { unsafe { assert_eq!(rust_k.j.l, 0); } }
mod error; mod passphrase; pub(crate) mod signer; mod util; use std::collections::hash_map::Entry; use std::collections::HashMap; use std::ffi::OsStr; use std::fmt; use std::fs; #[cfg(unix)] use std::os::unix::fs::OpenOptionsExt; use std::path::{Path, PathBuf}; use std::str::FromStr; use std::time::{Duration, Instant}...
#![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(dead_code)] use std::os::raw::{c_char, c_int, c_uint, c_void}; #[repr(C)] #[derive(Copy, Clone)] pub struct napi_env__ { _unused: [u8; 0], } /// Env ptr pub type napi_env = *mut napi_env__; #[repr(C)] #[derive(Copy...
use crate::*; const C: usize = (MAP_SIZE_X as usize) * (MAP_SIZE_Y as usize); #[derive(Clone, Serialize, Deserialize)] pub struct TileMap<T: Clone>(Vec<T>); impl<T: Clone> TileMap<T> { pub fn new(t: T) -> TileMap<T> { let tilemap: Vec<T> = iter::repeat(t).take(C).collect(); TileMap(tilemap) } pub fn ge...
use rand::SeedableRng; use rand_core::{impls, Error as RngError, RngCore}; // Set up a PRNG - we want a PRNG because we want the same sequence of 'random' numbers in our tests. const SEED_SIZE: usize = 4; pub struct HeapRngSeed { pub data: [u32; SEED_SIZE], } pub struct HeapRng(HeapRngSeed); impl Default for Hea...
extern crate flat_collections; use flat_collections::FlatList; #[test] fn create() { let _x = FlatList::<usize>::new(); } #[test] fn append() { let mut x = FlatList::<usize>::new(); x.append(55); x.append(66); x.append(77); println!("{:?}", x); }
pub trait GameSituation: Sized { type Move; type MoveIterator: Iterator<Item = Self::Move>; type Role: PartialEq + Sized; fn copy_apply( &self, the_move: Self::Move ) -> Option<Self>; fn get_moves( &self ) -> Self::MoveIterator; fn get_turn( &self ) -> Self::Role; fn is_finished( &self ) ...
use std::io::{Read, Seek, SeekFrom}; use armv4t_emu::{reg, Mode as ArmMode}; use std::io; use thiserror::Error; use crate::memory::Memory; use super::Ipod4g; mod firmware; mod sysinfo; use sysinfo::sysinfo_t; #[derive(Error, Debug)] pub enum HleBootloaderError { #[error("error while reading firmware file: {0}...
// Copyright 2020 EinsteinDB Project Authors & WHTCORPS INC. Licensed under Apache-2.0. pub trait CausetNamesExt { fn causet_names(&self) -> Vec<&str>; }
use std::borrow::Cow; use crate::type_ref::{TemplateArg, TypeRef, TypeRefDesc, TypeRefKind}; use crate::{CppNameStyle, Element, IteratorExt, StringExt}; pub trait TypeRefRenderer<'a> { type Recursed: TypeRefRenderer<'a> + Sized; fn render<'t>(self, type_ref: &'t TypeRef) -> Cow<'t, str>; fn recurse(&self) -> Self...
use crate::{ enclave_key::EnclaveKey, error::Result, group_key::GroupKey, kvs::{UserCounterDB, UserStateDB}, notify::Notifier, }; use anonify_ecall_types::*; use anyhow::{anyhow, bail}; use frame_common::{ crypto::{ AccountId, BackupPathSecret, KeyVaultCmd, KeyVaultRequest, RecoverAllReq...
use crate::schema::props_malls; use chrono::NaiveDateTime; use serde::{Deserialize, Serialize}; #[derive(Queryable, Identifiable, Serialize, Deserialize, Debug, Clone)] #[primary_key(item_id)] pub struct PropsMall { pub item_id: i64, pub next_item_id: i64, pub level: i64, pub item_category: i32, pu...
use super::TestContext; use chrono::Utc; use rand::Rng; use std::collections::HashMap; use std::env; use std::process::Command; /// Create a bucket and dynamodb lock table for s3 backend tests /// Requires local stack running in the background pub async fn setup_s3_context() -> TestContext { // Create a new prefix...
struct Solution; use std::i32; impl Solution { fn my_atoi(s: String) -> i32 { let mut start = s.trim_start(); let mut res: i32 = 0; let mut positive = true; if start.len() > 1 { let c = &start[0..1]; match c { "+" => { star...
// Copyright 2022 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 //! IOTA node public participation routes. //! <https://github.com/iota-community/treasury/blob/main/specifications/hornet-participation-plugin.md#public-node-endpoints> //! <https://github.com/iotaledger/inx-participation/blob/develop/core/partici...
fn main() { println!("Hello, world!"); } // Machine Types // Rust's type system is a collection of fixed-width numeric types, chosen to match the types that almost all modern processors implement directly in hardware, and the Boolean and character types. // Size (bits) Unsigned integer Signed integer Floating-po...
/* * Copyright 2018 Fluence Labs Limited * * 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 a...
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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.a...
//! //! # Create Mange SPU Groups //! //! CLI tree to generate Create Managed SPU Groups //! use std::io::Error as IoError; use std::io::ErrorKind; use log::debug; use structopt::StructOpt; use sc_api::spu::FlvCreateSpuGroupRequest; use crate::error::CliError; use crate::profile::{ProfileConfig, TargetServer}; use ...
mod_def_reexport!{ pop, pushgoi, pushgo, pushjb, pushj, save, unsave, }
//@ignore-target-windows: No libc on Windows fn main() { let rw = std::cell::UnsafeCell::new(libc::PTHREAD_RWLOCK_INITIALIZER); unsafe { assert_eq!(libc::pthread_rwlock_wrlock(rw.get()), 0); libc::pthread_rwlock_wrlock(rw.get()); //~ ERROR: deadlock } }
use crate::database::models::FactoidEnum; use crate::database::Db; use nestor::command; use nestor::handler::Command; use nestor::request::State; use nestor::response::{Outcome, Response}; #[command] pub fn user_defined(command: &Command, db: State<Db>) -> Outcome { let num_args = command.arguments.len(); le...
#[allow(unused_imports)] use serde_json::Value; #[derive(Debug, Serialize, Deserialize)] pub struct AntivirusPolicies { #[serde(rename = "policies")] pub policies: Option<Vec <crate::models::AntivirusPolicyExtended>>, }
// Copyright 2020 WHTCORPS INC Project Authors. Licensed Under Apache-2.0 use std::borrow::Cow; use std::cell::RefCell; use std::{f64, i64}; use num::promises::Pow; use violetabftstore::interlock::::file::calc_crc32_bytes; use crate::ScalarFunc; use milevadb_query_datatype::codec::mysql::{Decimal, RoundMode, DEFAULT...
extern crate bindgen; extern crate cc; use std::env; use std::path::PathBuf; fn main() { // Rebuild if C code changes println!("cargo:rerun-if-changed=quirc/lib/"); let bindings = bindgen::Builder::default() .header("quirc/lib/quirc.h") .header("quirc/lib/quirc_internal.h") .gener...
use crate::common::*; /// A collection that takes unique values into a [HashSet](HashSet). /// /// It maintains a [`HashSet`](HashSet) internally. When it is /// built from iterator or extended, it expects unique input values. /// Otherwise, it empties out the internal and ignore future values. #[derive(Debug, Clone)]...
use futures::future::*; use native_tls; use scraper::{Html, Selector}; use std::collections::HashMap; use std::error::Error; use std::net::{IpAddr, Ipv4Addr, ToSocketAddrs}; use std::sync::{Arc, RwLock}; use clap::{App, Arg}; use std::process::Command; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::Tcp...
//! Platform-agnostic ADXL343 accelerometer driver which uses I2C via //! [embedded-hal] and implements the [`Accelerometer` trait][trait] //! from the `accelerometer` crate. //! //! <https://www.bosch-sensortec.com/bst/products/all_products/bmi160> //! //! > The BMI160 is a small, low power, low noise 16-bit inertial ...
/// PrependList is a low-level primitive supporting two safe operations: /// `push`, which prepends a node to the list, and `swap` which replaces the list with another use std::sync::atomic::{AtomicPtr, Ordering}; use std::{ptr, mem}; pub type NodePtr<T> = Option<Box<Node<T>>>; #[derive(Debug)] pub struct Node<T> { ...
use std::collections::BTreeMap; extern crate rustc_serialize; use rustc_serialize::json::{Json, ToJson, encode}; use rustc_serialize::{base64, json}; use rustc_serialize::base64::{ToBase64, FromBase64}; extern crate crypto; use self::crypto::mac::{Mac, MacResult}; use self::crypto::hmac::Hmac; use self::crypto::sha2:...
use std::convert::Infallible; use reqwest::{StatusCode, Url}; use serde_json::Value; use thiserror::Error; pub type PrimaBridgeResult<T> = Result<T, PrimaBridgeError>; #[derive(Debug, Error)] pub enum PrimaBridgeError { #[error("http error while calling {url}, error: {source}")] HttpError { url: Url, source:...
use super::{Game, GameState, Action, Path}; struct SimpleGameState { acc: i32, } impl GameState for SimpleGameState { fn new() -> SimpleGameState { SimpleGameState { acc: 0 } } } enum SimpleAction { Inc, Dec, } impl Action for SimpleAction { type GameState = SimpleGameState; fn ...
// This should fail even without validation or Stacked Borrows. //@compile-flags: -Zmiri-disable-validation -Zmiri-disable-stacked-borrows -Cdebug-assertions=no use std::ptr; fn main() { // Try many times as this might work by chance. for _ in 0..20 { let x = [2u16, 3, 4]; // Make it big enough so we d...
mod cli; mod fs; mod git; mod pattern; use std::cmp; use std::fs::remove_file; use std::io::{self, Write}; use std::path::Path; use anyhow::Result; use chrono::{DateTime, Datelike, Duration, NaiveDate, NaiveTime, TimeZone, Utc, Weekday}; use clap::Clap; use human_id::id; use cli::Args; use fs::write_str_to_file; use...
fn main() { cc::Build::new() .cpp(true) // Switch to C++ library compilation. .file("src/test.cpp") .compile("libtest.a"); }
use serde::{Deserialize, Serialize}; use serde_yaml; use std::collections::HashSet; use std::time; use super::error; use super::reddit; use super::mastodon; pub type AllSync = Vec<Sync>; pub type AllMirror = Vec<Mirror>; #[derive(Serialize, Deserialize, Debug)] pub struct Sync { #[serde(rename = "reddit")] ...
//! Miscellaneous example cases. use crate::{file_to_aligned_bytes, file_to_aligned_mut_bytes, MaybeAlignedBytes}; use ndarray::prelude::*; use ndarray::Slice; use ndarray_npy::{ write_zeroed_npy, ReadNpyError, ReadNpyExt, ViewMutNpyExt, ViewNpyError, ViewNpyExt, WriteNpyExt, }; use num_complex_0_4::Complex; u...
/// low level wrapper for the state machine, encoding and decoding from lapin-async use lapin_async::connection::*; use amq_protocol::frame::{AMQPFrame, gen_frame, parse_frame}; use nom::Offset; use cookie_factory::GenError; use bytes::{BufMut, BytesMut}; use std::cmp; use std::iter::repeat; use std::io::{self,Error,E...
use std::{ env }; use env_logger; pub fn init_env_logger() { let env_log_level = "RUST_LOG"; match env::var(env_log_level) { Ok(_val) => {}, Err(_e) => env::set_var("RUST_LOG", "info"), } env_logger::init().unwrap(); }
use crate::stdweb::unstable::TryInto; use stdweb::web::document; use stdweb::web::HtmlElement; use crate::stdweb::web::{INode, INonElementParentNode}; use crate::canvas::Canvas; use crate::cell::Cell; use crate::direction::Direction; use crate::message::Message; #[derive(Clone)] enum Color { GREEN, BLUE, RED, ...
#![allow( dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals )] extern "C" { pub static mut a: *mut ::std::os::raw::c_char; } extern "C" { pub static mut b: *const ::std::os::raw::c_char; } extern "C" { pub static c: *mut ::std::os::raw::c_char; } extern "C" { pub s...
//! A library providing direct casting among trait objects implemented by a type. //! //! In Rust, an object of a sub-trait of [`Any`] can be downcast to a concrete type //! at runtime if the type is known. But no direct casting between two trait objects //! (i.e. without involving the concrete type of the backing valu...
use crate::ast::Pattern; use crate::runtime::{Match, RuntimeError, Scope, Type, Value}; use std::rc::Rc; pub fn r#type(start: Scope, t: &Type) -> Result<Match, RuntimeError> { let n = start.next(); match n.clone() { Some(end) => { let value = &end.value; match value { Value::None => { ...
#![cfg(feature = "integration_test")] #[allow(dead_code)] mod fs_common; use deltalake::test_utils::{IntegrationContext, StorageIntegration, TestResult, TestTables}; use deltalake::{action, DeltaTableBuilder, DeltaTableError}; use serial_test::serial; use std::collections::HashMap; #[tokio::test] #[serial] async fn ...
use chrono::Utc; use diesel::prelude::*; use diesel::{self, PgConnection}; use crate::models::ArtistName; use crate::models::{Artist, ArtistId, NewArtist}; use crate::PartialDate; pub struct ArtistRepository<'a> { connection: &'a PgConnection, } impl<'a> ArtistRepository<'a> { pub fn new(connection: &PgConne...
//! Tests for [`rustix::path`]. #![cfg(any(feature = "fs", feature = "net"))] #![cfg(not(windows))] #![cfg_attr(core_c_str, feature(core_c_str))] #![cfg_attr(alloc_c_string, feature(alloc_c_string))] #[cfg(not(feature = "rustc-dep-of-std"))] mod arg; #[cfg(feature = "itoa")] mod dec_int;
// This file contains the public facing editing API for skip lists. use std::iter; use {ListItem, ListItemIter, NotifyTarget, SkipList, Cursor, ItemMarker}; pub struct Edit<'a, Item: ListItem, N: NotifyTarget<Item> = ()> { list: &'a mut SkipList<Item, N>, cursor: Cursor<Item>, // item_offset: usize, // Of...
#![allow(unused_imports)] use tracing::{info, warn, debug, error, trace, instrument, span, Level}; use error_chain::bail; use ate::prelude::*; use std::sync::Arc; use url::Url; use std::io::stdout; use std::io::Write; use crate::prelude::*; use crate::model::Advert; use crate::helper::*; use crate::error::*; use crate...
//! Describes how mobs move each tick. Very uniform for now; lots of constants will eventually //! be moved out to configurable components as we have different kinds of mobs and so on. use legion::{systems::CommandBuffer, world::SubWorld, *}; use crate::components::*; #[system] #[read_component(Died)] pub(super) fn ...
/// Information about how sprites are laid out on the sprite sheet. /// /// These are used to calculate the texture coordinates of each sprite. #[derive(Debug, Deserialize)] pub struct SpriteSheetDefinition { /// Width of each individual sprite on the sprite sheet. pub sprite_w: f32, /// Height of each indi...
extern crate proc_macro; use proc_macro::TokenStream; #[proc_macro_attribute] pub fn yolo(args: TokenStream, _input: TokenStream) -> TokenStream { args }
use std::net::UdpSocket; use rand::random; pub fn max(dst: &str, length: u16){ loop { let socket = UdpSocket::bind("127.0.0.1:34254").expect("couldn't bind to address"); socket.connect(dst).expect("connect function failed"); socket.send(&vec![255; length.into()]).expect("couldn't send message"); } } pub f...
extern crate bincode; extern crate docopt; extern crate env_logger; extern crate raft; extern crate rustc_serialize; extern crate serde; #[macro_use] extern crate serde_derive; use std::collections::HashMap; use std::net::{SocketAddr, ToSocketAddrs}; use std::path::Path; use std::process; use docopt::Docopt; use raf...
#![deny(warnings)] #[cfg(all(feature = "arrow", feature = "parquet"))] mod fs_common; // NOTE: The below is a useful external command for inspecting the written checkpoint schema visually: // parquet-tools inspect tests/data/checkpoints/_delta_log/00000000000000000005.checkpoint.parquet #[cfg(all(feature = "arrow", ...
use std::error; use std::fmt; use std::io; use std::num; use std::str; use std::string; /// Stands for errors raised from rust-memcache #[derive(Debug)] pub enum MemcacheError { /// `std::io` related errors. Io(io::Error), /// Error raised when unserialize value data which from memcached to String From...
pub mod parameters; pub mod random_ift; pub mod random_strees;
use std::collections::HashMap; pub fn roman_to_int(s: String) -> i32 { let mut symbol_map = HashMap::with_capacity(7); symbol_map.insert('I', 1); symbol_map.insert('V', 5); symbol_map.insert('X', 10); symbol_map.insert('L', 50); symbol_map.insert('C', 100); symbol_map.insert('D', 500); ...
// tests that no weird errors are raised if continue is called outside of a // block #[test] fn test_break_with_no_block() { let assigns = o!({}); let markup = "{% continue %}"; let expected = ""; assert_template_result!(expected, markup, assigns); }
#[macro_use] extern crate wayland_client; extern crate tempfile; extern crate byteorder; extern crate image; extern crate dbus; extern crate clap; use std::mem::transmute; use std::os::unix::io::AsRawFd; use std::io::Write; use std::str::FromStr; use std::cmp::{min, max}; use wayland_client::wayland::get_display; u...
use std::iter::FromIterator; use structopt::StructOpt; #[derive(Debug, StructOpt)] #[structopt(rename_all = "kebab-case")] struct Args { #[structopt(long)] no_marks: bool, #[structopt(short, long, default_value = "32")] length: usize, } /// 候補文字は素数(89)個 const CS: &str = r##"abcdefghijklmnopqlstuvwxyzA...
fn main() { env_logger::init(); let matches = clap::App::new("idolmap") .version("0.1.0") .setting(clap::AppSettings::SubcommandRequired) .subcommand( clap::SubCommand::with_name("aikatsu") .setting(clap::AppSettings::SubcommandRequired) .subc...
use anyhow::{Context, Result}; use itertools::Itertools; use std::{fmt, fs}; #[derive(Clone, Debug, Eq, PartialEq)] enum Rule { Or((u8, u8), (u8, u8)), Or2(u8, u8), Concat(u8, u8), Alias(u8), A, B, // 8: x | x 8 // (x .. x) .. Or8(u8), // 11: x y | x 11 y // (x .. x y .. y) ...
use rustdds::{ dds::data_types::{DDSDuration, TopicKind}, dds::qos::{ QosPolicies, policy::Deadline, policy::DestinationOrder, policy::Durability, policy::History, policy::LatencyBudget, policy::Lifespan, policy::Liveliness, policy::Ownership, QosPolicyBuilder, policy::Reliability, }, }; use serde::{...
use vulkano::instance::{Instance, PhysicalDevice}; use std::sync::Arc; use vulkano::swapchain::{Surface, Swapchain, PresentMode, SurfaceTransform, SwapchainCreationError, AcquireError}; use vulkano::pipeline::{GraphicsPipeline, GraphicsPipelineAbstract}; use winit::{Window, WindowBuilder, EventsLoop}; use vulkano::devi...
use dces::prelude::Entity; use crate::prelude::*; use super::BuildContext; /// The `Template` trait provides the method for the widget template creation. pub trait Template: Sized { /// Creates the template of the widget and returns it. fn template(self, _id: Entity, _context: &mut BuildContext) -> Self { ...
#![forbid(rust_2018_idioms, unsafe_code)] #![warn(clippy::all, clippy::pedantic)] #![deny(missing_docs)] #![allow(clippy::missing_errors_doc, clippy::module_name_repetitions)] // Disable this clippy lint, otherwise clippy will complain when compiled in a test environment // (for example, with rust-analyzer) #![cfg_attr...
use cfgen::prelude::*; use serde::de::{Deserialize, Deserializer, Visitor}; use serde_derive::Deserialize; #[derive(Debug, Copy, Clone)] pub struct Opacity(f64); impl Opacity { pub fn new(opacity: f64) -> Option<Self> { if opacity >= 0.0 && opacity <= 1.0 { Some(Self(opacity)) } else {...
pub mod get;
use crate::lex::errors::Location; use crate::lex::iterator_util::SourceChar; use std::iter::Enumerate; pub(crate) mod constants; pub mod errors; #[cfg(test)] mod tests; pub mod types; pub struct Lexer<It: Iterator<Item = char>> { source: Enumerate<It>, lookahead: Vec<SourceChar>, character: Location, ...
use super::*; use super::vm_area::*; use super::vm_perms::VMPerms; use crate::fs::FileMode; use intrusive_collections::rbtree::{Link, RBTree}; use intrusive_collections::Bound; use intrusive_collections::RBTreeLink; use intrusive_collections::{intrusive_adapter, KeyAdapter}; use rcore_fs::vfs::Metadata; #[derive(Clo...
pub mod api; pub mod query; pub mod stream;
// This file is part of Substrate. // Copyright (C) Parity Technologies (UK) Ltd. // SPDX-License-Identifier: Apache-2.0 // 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.a...
/** * [1926] Nearest Exit from Entrance in Maze * * You are given an m x n matrix maze (0-indexed) with empty cells (represented as '.') and walls (represented as '+'). You are also given the entrance of the maze, where entrance = [entrancerow, entrancecol] denotes the row and column of the cell you are initially st...
use anchor_lang::prelude::*; declare_id!("2amnYyb9jAe933VEBSE7YDGZRQgFpYJCeep57oSNSCNt"); #[program] mod solana_nextjs_counter { use super::*; pub fn create(ctx: Context<Create>, bump: u8) -> ProgramResult { let base_account = &mut ctx.accounts.base_account; base_account.count = 0; ba...
struct Solution {} impl Solution { pub fn is_monotonic(a: Vec<i32>) -> bool { let mut inc = true; let mut dec = true; for i in 1..a.len() { if a[i - 1] == a[i] { continue; } if a[i - 1] < a[i] { dec = false; } ...
use proconio::{fastout, input}; #[fastout] fn main() { input! { a : usize, b : usize, } if (a * b) % 2 == 0 { println!("Even"); } else { println!("Odd"); } }
//! Items related to wgpu and its integration in nannou! //! //! **WebGPU** is the portable graphics specification that nannou targets allowing us to write code //! that is both fast and allows us to target a wide range of platforms. **wgpu** is the name of //! the crate we use that implements this specification. //! /...
/// HTTPRequestError representing possible HTTP request validation errors. /// /// Used by [`HTTPRequest`] to indicate failed parsing attempts. /// /// [`HTTPRequest`]: crate::http::HTTPRequest #[derive(Debug)] pub enum HTTPRequestError { NoMethod, NoPath, Utf8Error, } impl std::error::Error for HTTPReques...
use crate::agaritilesets::AgariTilesets; use crate::form::{Form, Point}; use crate::tilesets::Tilesets; use log::debug; use std::fmt; use std::iter::once; #[derive(Debug, Clone)] enum JudgeTilesets { Tilesets(Tilesets), AgariTilesets(AgariTilesets), } #[derive(Debug, Clone)] pub struct Judge { forms: Vec<...
use std::ops::Deref; use libc::{c_void}; use std::marker::{Send, Sync}; use to_do::to_do::{ToDoQuery}; #[repr(C)] pub struct IPJToDoSearchDelegate { pub user: *mut c_void, //当前持有IPJToDoSearchDelegate对象的所有权者 //释放内存回调,告诉当前持有IPJToDoSearchDelegate对象的所有权者做相应的处理 pub destroy: extern "C" fn(user: *mut c_void), ...
use std::vec; use std::slice; use std::mem; use std::collections::HashMap; use std::collections::hash_map::Entry; use glutin::{VirtualKeyCode, ElementState, WindowEvent}; use winit; use chrono; use game_time::GameTime; use float_duration::{TimePoint, FloatDuration}; pub mod command; #[derive(Debug, Clone, PartialEq)...
use ::helper::*; use ::Fake; use ::faker::{Name, Number, Lorem}; use ::locales::en; pub trait Internet { fn free_email_provider() -> &'static str; fn domain_suffix() -> &'static str; fn user_name() -> String; fn free_email() -> String; fn safe_email() -> String; fn password(min_count: usize, ma...
// Systray Lib #[macro_use] extern crate log; #[cfg(target_os = "linux")] extern crate glib; #[cfg(target_os = "linux")] extern crate gtk; #[cfg(target_os = "linux")] extern crate libappindicator; #[cfg(target_os = "windows")] extern crate libc; #[cfg(target_os = "windows")] extern crate winapi; pub mod api; use std...
use serde::{Deserialize, Serialize}; use crate::index::Index; #[derive(Deserialize, Serialize, Debug, Clone)] pub struct IndexExpr { pub val: Index }
#[doc = "Reader of register C2"] pub type R = crate::R<u8, super::C2>; #[doc = "Writer for register C2"] pub type W = crate::W<u8, super::C2>; #[doc = "Register C2 `reset()`'s with value 0x80"] impl crate::ResetValue for super::C2 { type Type = u8; #[inline(always)] fn reset_value() -> Self::Type { ...
use std::collections::BTreeMap; use std::collections::btree_map::Entry; use std::error::Error; use std::fmt; use std::fs::File; use std::io::{self, Read}; use std::cmp::{Eq, Ord, Ordering}; use util::{GetAssetsFolderError, get_assets_folder}; use wavefront_obj::{ParseError, obj}; use Vertex; pub type Index = u16; imp...
use geometry::{Pose, Vector}; use math::Scalar; use sensor::laserscanner::Scan; pub const SIZE: usize = 111; pub const CELL_LENGTH: Scalar = 0.25; #[derive(Debug, Copy, Clone)] pub enum CellState { Occupied(u32), Freespace, Void, } impl Default for CellState { fn default() -> CellState { Cell...
use starter::get_file_string; mod lib; use lib::get_ore_and_fuel; fn main() { let fs = get_file_string(); let result = get_ore_and_fuel(&fs[..]); println!( "Need {} ore for one fuel, 1 trillon ore produces {} fuel", result.0, result.1 ); }
use super::{ foreign_keys::{fk_columns_from_where_ast, ForeignKeyReference}, postgres_types::TypedColumnValue, select_table_stats::{select_column_stats, select_column_stats_statement, TableColumnStat}, utils::{ conditions_params_to_ast, generate_query_result_from_db, get_columns_str, get...