text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>est_dir.join(format!("{}_backup_{}.zip", system_name, now)) }<|fim_prefix|>// repo: michaelhugi/magic_q_backuper path: /src/zip_name/mod.rs use std::path::{Path, PathBuf}; pub fn get_zip_path(system_name: &str, dest_dir: &Path) -> PathBuf { let now = chro<|fim_middle|>no::offset::Local::now().format...
code_fim
medium
{ "lang": "rust", "repo": "michaelhugi/magic_q_backuper", "path": "/src/zip_name/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: michaelhugi/magic_q_backuper path: /src/zip_name/mod.rs use std::path::{Path, PathBuf}; pub fn get_zip_path(system_name: &str, dest_dir: &Path) -> PathBuf { let now = chro<|fim_suffix|>est_dir.join(format!("{}_backup_{}.zip", system_name, now)) }<|fim_middle|>no::offset::Local::now().format...
code_fim
medium
{ "lang": "rust", "repo": "michaelhugi/magic_q_backuper", "path": "/src/zip_name/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print!(", "); } else { print!("."); } } println!("") }<|fim_prefix|>// repo: ashish-r/Fizz-Buzz path: /Rust/src/main.rs // print fizz-buzz sequence in rust fn main() { for i in 1..101 { match (i % 3, i % 5)<|fim_middle|> { (0, 0) => prin...
code_fim
medium
{ "lang": "rust", "repo": "ashish-r/Fizz-Buzz", "path": "/Rust/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ashish-r/Fizz-Buzz path: /Rust/src/main.rs // print fizz-buzz sequence in rust fn main() { for i in 1..101 { match (i % 3, i % 5)<|fim_suffix|> 0) => print!("Buzz"), (_, _) => print!("{}", i), } if i != 100 { print!(", "); } else { ...
code_fim
medium
{ "lang": "rust", "repo": "ashish-r/Fizz-Buzz", "path": "/Rust/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RagePly/aoc16 path: /src/day19.rs fn get_winner(lower_bound: u32, upper_bound: u32, total: u32, index: u32) -> u32 { if total == 1 { lower_bound } else if total % 2 == 0 { get_winner(lower_bound, upper_bound - 2u32.pow(index), total/2, index + 1) } else { get_...
code_fim
medium
{ "lang": "rust", "repo": "RagePly/aoc16", "path": "/src/day19.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn part2(source: String) -> usize { let final_size: usize = source.parse().unwrap(); let mut i: usize = 0; // the solution is based on figuring out what position a player in the current round would have had in the previous round // all positions are relative to the thief, meaning a pl...
code_fim
medium
{ "lang": "rust", "repo": "RagePly/aoc16", "path": "/src/day19.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>setence = &setence[0..30]; // println!("{:?}", ref_setence[0]); }<|fim_prefix|>// repo: HongbinZhou/learn_rust path: /string.rs fn main() { let setence = "my is 今天!"; for i in setence.chars<|fim_middle|>() { print!("{:?}-", i); } println!(""); for i in setence.as_bytes() ...
code_fim
medium
{ "lang": "rust", "repo": "HongbinZhou/learn_rust", "path": "/string.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HongbinZhou/learn_rust path: /string.rs fn main() { let setence = "my is 今天!"; for i in setence.chars() { print!("{:?}-", i); } println!(""); for i in<|fim_suffix|>setence = &setence[0..30]; // println!("{:?}", ref_setence[0]); }<|fim_middle|> setence.as_bytes() ...
code_fim
medium
{ "lang": "rust", "repo": "HongbinZhou/learn_rust", "path": "/string.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: WaDelma/typed_lambda path: /src/inference.rs fn from(e: ::parser::Expr) -> Self { use parser::ExprType::*; use self::Expression as E; fn rec(e: ::parser::Expr, n: &mut u64, vars: &mut HashMap<Ident, Ident>) -> Expr { let b = Box::new; match e....
code_fim
hard
{ "lang": "rust", "repo": "WaDelma/typed_lambda", "path": "/src/inference.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Context { pub fn new() -> Self { Context { types: HashMap::new(), } } pub fn get(&self, i: &Ident) -> Option<&Poly> { self.types.get(i) } pub fn insert(&mut self, i: Ident, p: Poly) -> Option<Poly> { self.types.insert(i, p) } ...
code_fim
hard
{ "lang": "rust", "repo": "WaDelma/typed_lambda", "path": "/src/inference.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: WaDelma/typed_lambda path: /src/inference.rs mpl Expr { pub fn new(expr: Expression, id: Ident) -> Self { Expr { expr, id } } } impl From<::parser::Expr> for Expr { fn from(e: ::parser::Expr) -> Self { use parser::ExprType::*; ...
code_fim
hard
{ "lang": "rust", "repo": "WaDelma/typed_lambda", "path": "/src/inference.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(PartialEq, Eq, Debug, Clone)] enum Side { Top, Bottom, Left, Right, } #[derive(PartialEq, Eq, Debug, Clone)] struct EdgeMatch { other_id: i64, orientation: Orientation, edge: String, } #[derive(PartialEq, Eq, Debug, Clone)] struct MapPosition { id: i64, orien...
code_fim
hard
{ "lang": "rust", "repo": "troyunverdruss/advent-of-code-2020", "path": "/src/day20.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: troyunverdruss/advent-of-code-2020 path: /src/day20.rs _tile.edges.contains(edge) { count += 1; let e = tiles_to_edges.entry(*id).or_insert(Vec::new()); e.push(EdgeMatch { other_id: *other_id, ...
code_fim
hard
{ "lang": "rust", "repo": "troyunverdruss/advent-of-code-2020", "path": "/src/day20.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: troyunverdruss/advent-of-code-2020 path: /src/day20.rs ter edge } } } if count == 2 { part1_product *= id } sum += count; } println!("Part 1: {}", part1_product); println!(" sums: {}", sum); // part 2 ...
code_fim
hard
{ "lang": "rust", "repo": "troyunverdruss/advent-of-code-2020", "path": "/src/day20.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rust path: /compiler/rustc_hir_analysis/src/lib.rs /*! # typeck The type checker is responsible for: 1. Determining the type of each expression. 2. Resolving methods and traits. 3. Guaranteeing that most type rules are met. ("Most?", you say, "why most?" Well, dear reader, read o...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/compiler/rustc_hir_analysis/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tcx.sess.emit_err(errors::VariadicFunctionCompatibleConvention { span, conventions }); } fn require_same_types<'tcx>( tcx: TyCtxt<'tcx>, cause: &ObligationCause<'tcx>, param_env: ty::ParamEnv<'tcx>, expected: Ty<'tcx>, actual: Ty<'tcx>, ) { let infcx = &tcx.infer_ctxt().build(...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/compiler/rustc_hir_analysis/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // this ensures that later parts of type checking can assume that items // have valid types and not error // FIXME(matthewjasper) We shouldn't need to use `track_errors`. tcx.sess.track_errors(|| { tcx.sess.time("type_collecting", || { tcx.hir().for_each_module(|module|...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/compiler/rustc_hir_analysis/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matter-labs/franklin-crypto path: /src/plonk/circuit/bigint/field.rs } else { (params.binary_limbs_bit_widths[witness_idx], params.binary_limbs_max_values[witness_idx].clone()) }; assert!(expected_width > 0); ...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/franklin-crypto", "path": "/src/plonk/circuit/bigint/field.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matter-labs/franklin-crypto path: /src/plonk/circuit/bigint/field.rs let res = result.get_value().unwrap() % repr_to_biguint::<F>(&F::char()); assert_eq!(res, fe_to_biguint(&m)); assert_eq!(result.value.unwrap(), m); // let mut ab_in_base_field = a_base; ...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/franklin-crypto", "path": "/src/plonk/circuit/bigint/field.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0..100 { let mut cs = init(); let flag: bool = rng.gen(); use crate::plonk::circuit::boolean::AllocatedBit; let bit = AllocatedBit::alloc( &mut cs, Some(flag) ).unwrap(); let bit = ...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/franklin-crypto", "path": "/src/plonk/circuit/bigint/field.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adamShimi/armed-bandit-rust path: /src/estimators.rs use crate::helper; use enum_dispatch::enum_dispatch; #[derive(Clone)] pub enum EstimatorInit { SampleAverageInit {nb_levers : usize}, ConstantStepInit {nb_levers : usize, step : f64}, } pub(crate) fn create_estimator(...
code_fim
hard
{ "lang": "rust", "repo": "adamShimi/armed-bandit-rust", "path": "/src/estimators.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.estimates[lever] } fn update(&mut self, lever : usize, reward : f64) { self.estimates[lever] = self.estimates[lever] + (reward - self.estimates[lever])/self.counter[lever]; self.counter[lever] += 1.0; } } #[derive(Clone)] pub(crate) struct ConstantStep { step : f64, est...
code_fim
hard
{ "lang": "rust", "repo": "adamShimi/armed-bandit-rust", "path": "/src/estimators.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ray-kast/epilog path: /src/var.rs use std::collections::{HashMap, HashSet}; pub trait FreeVars<V> { fn free_vars_into<'a>(&'a self, set: &mut HashSet<&'a V>); fn free_vars(&self) -> HashSet<&V> { let mut set = HashSet::new(); self.free_vars_into(&mut set); set ...
code_fim
hard
{ "lang": "rust", "repo": "ray-kast/epilog", "path": "/src/var.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// TODO: unit test me // TODO: property test me impl<V, K, W: FreeVars<V>> FreeVars<V> for HashMap<K, W> { fn free_vars_into<'a>(&'a self, set: &mut HashSet<&'a V>) { for val in self.values() { val.free_vars_into(set); } } }<|fim_prefix|>// repo: ray-kast/epilog path: ...
code_fim
hard
{ "lang": "rust", "repo": "ray-kast/epilog", "path": "/src/var.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait FreshVars<V> { fn acquire(&self) -> V; } impl<V, T: FreshVars<V>> FreshVars<V> for &'_ T { fn acquire(&self) -> V { (*self).acquire() } } // TODO: unit test me // TODO: property test me impl<V, T: FreeVars<V>> FreeVars<V> for Option<T> { fn free_vars_into<'a>(&'a self, set: &mut Ha...
code_fim
medium
{ "lang": "rust", "repo": "ray-kast/epilog", "path": "/src/var.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>include!(concat!(env!("OUT_DIR"), "/jitprofiling.bindgen.rs")); pub const __itt_suppress_all_errors: u32 = 2147483647; pub const __itt_suppress_threading_errors: u32 = 255; pub const __itt_suppress_memory_errors: u32 = 65280; pub const __itt_attr_barrier: u32 = 1; pub const __itt_attr_mutex: u32 = 2...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/intel-seapi", "path": "/workspace/intel-seapi-sys/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Record an event occurrence. /// /// Returns `__itt_err` upon failure (invalid event id/user event feature not enabled). #[link_name = "__itt_event_start_init_3_0"] pub fn __itt_event_start(event: __itt_event) -> c_int; /// Record an event end occurrence. /// /// Calling this is optional if ev...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/intel-seapi", "path": "/workspace/intel-seapi-sys/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemonrock/intel-seapi path: /workspace/intel-seapi-sys/src/lib.rs eres to this convention. //! //! //! ### Domains //! //! Domains provide a way to separate notification for different modules or libraries in a program. //! Domains are specified by dotted character strings, eg `TBB.Internal.Contr...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/intel-seapi", "path": "/workspace/intel-seapi-sys/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn rocket() -> rocket::Rocket { rocket::ignite() .register(catchers![ global_handlers::not_found, global_handlers::internal_error, global_handlers::service_not_available, ]) .mount( "/api", routes![ ...
code_fim
hard
{ "lang": "rust", "repo": "martinloesethjensen/game-api", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn on_response(&self, _request: &Request, response: &mut Response) { response.set_header(Header::new("Access-Control-Allow-Origin", "*")); response.set_header(Header::new("Access-Control-Allow-Methods", "POST, GET, PATCH, OPTIONS")); response.set_header(Header::new("Access-Cont...
code_fim
medium
{ "lang": "rust", "repo": "martinloesethjensen/game-api", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: martinloesethjensen/game-api path: /src/main.rs #![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; #[macro_use] extern crate serde_derive; extern crate dotenv; extern crate rocket_contrib; use rocket::{Request, Response}; use rocket::fairing::{Fairing, Info, Kind}; u...
code_fim
hard
{ "lang": "rust", "repo": "martinloesethjensen/game-api", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akhilman/egui path: /eframe/examples/image.rs use eframe::{egui, epi}; #[derive(Default)] struct MyApp { texture: Option<egui::TextureId>, } impl epi::App for MyApp { fn name(&self) -> &str { "Show an image with eframe/egui" } <|fim_suffix|> egui::CentralPanel::defa...
code_fim
hard
{ "lang": "rust", "repo": "akhilman/egui", "path": "/eframe/examples/image.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Allocate a texture: let texture = frame .tex_allocator() .alloc_srgba_premultiplied(size, &pixels); self.texture = Some(texture); } egui::CentralPanel::default().show(ctx, |ui| { ui.heading("Here is an imag...
code_fim
hard
{ "lang": "rust", "repo": "akhilman/egui", "path": "/eframe/examples/image.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.texture.is_none() { // Load the image: let image_data = include_bytes!("rust-logo-512x512.png"); use image::GenericImageView; let image = image::load_from_memory(image_data).expect("Failed to load image"); let image_buffer = image...
code_fim
hard
{ "lang": "rust", "repo": "akhilman/egui", "path": "/eframe/examples/image.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>h_connect}; pub use host::Host; use response::response_handler; pub(crate) use session::Session;<|fim_prefix|>// repo: LinkTed/doh-client path: /src/remote/mod.rs mod config; mod helper; mod host; mod response; mod session; use config::Config; #[cfg(feature = "http-proxy")] use helper::try_http_proxy_co...
code_fim
medium
{ "lang": "rust", "repo": "LinkTed/doh-client", "path": "/src/remote/mod.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LinkTed/doh-client path: /src/remote/mod.rs mod config; mod helper; mod host; mod response; mod session; use config::Config; #[cfg(feature<|fim_suffix|>nnect, try_tls_connect}; #[cfg(feature = "socks5")] use helper::{try_socks5_connect, try_socks5h_connect}; pub use host::Host; use response::re...
code_fim
medium
{ "lang": "rust", "repo": "LinkTed/doh-client", "path": "/src/remote/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FyroxEngine/Fyrox path: /fyrox-ui/src/button.rs //! Defines a clickable widget with arbitrary content. See [`Button`] dos for more info and examples. #![warn(missing_docs)] use crate::{ border::BorderBuilder, core::pool::Handle, decorator::DecoratorBuilder, define_constructor, ...
code_fim
hard
{ "lang": "rust", "repo": "FyroxEngine/Fyrox", "path": "/fyrox-ui/src/button.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match self { Self::Text { text, font } => TextBuilder::new(WidgetBuilder::new()) .with_text(text) .with_horizontal_text_alignment(HorizontalAlignment::Center) .with_vertical_text_alignment(VerticalAlignment::Center) .with_...
code_fim
hard
{ "lang": "rust", "repo": "FyroxEngine/Fyrox", "path": "/fyrox-ui/src/button.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: paolorechia/pokedex path: /scraper/src/bin/get_names.rs use std::error::Error; use std::boxed::Box; use pokedex_scraper::mongo::{init_pokemon_collection}; use pokedex_scraper::find_pokemons_by_generation; <|fim_suffix|> let mongo = init_pokemon_collection().await?; let pokemons = find_po...
code_fim
medium
{ "lang": "rust", "repo": "paolorechia/pokedex", "path": "/scraper/src/bin/get_names.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mongo = init_pokemon_collection().await?; let pokemons = find_pokemons_by_generation(&mongo, 1).await?; for pokemon in pokemons { println!("{},", pokemon.name); } Ok(()) }<|fim_prefix|>// repo: paolorechia/pokedex path: /scraper/src/bin/get_names.rs use std::error::Error; ...
code_fim
medium
{ "lang": "rust", "repo": "paolorechia/pokedex", "path": "/scraper/src/bin/get_names.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tesseract-one/Tesseract.swift path: /rust/tesseract_utils/src/response.rs use super::error::CError; use super::traits::IntoC; use std::mem::ManuallyDrop; use std::result::Result; #[repr(C)] #[derive(Copy, Clone, Debug)] pub enum COptionResponseResult { Error = 0, None, Some, } pub ...
code_fim
hard
{ "lang": "rust", "repo": "tesseract-one/Tesseract.swift", "path": "/rust/tesseract_utils/src/response.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self, value: &mut ManuallyDrop<T>, error: &mut ManuallyDrop<CError>, ) -> COptionResponseResult { match self { Err(err) => { *error = ManuallyDrop::new(err.into_c()); COptionResponseResult::Error } Ok(o...
code_fim
hard
{ "lang": "rust", "repo": "tesseract-one/Tesseract.swift", "path": "/rust/tesseract_utils/src/response.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dtolnay/ref-cast path: /tests/ui/short-lifetime.rs use ref_cast::{ref_cast_custom, RefCastCustom}; <|fim_suffix|>impl Thing { #[ref_cast_custom] pub fn ref_cast<'a>(s: &String) -> &'a Self; } fn main() {}<|fim_middle|>#[derive(RefCastCustom)] #[repr(transparent)] pub struct Thing(Strin...
code_fim
medium
{ "lang": "rust", "repo": "dtolnay/ref-cast", "path": "/tests/ui/short-lifetime.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Thing { #[ref_cast_custom] pub fn ref_cast<'a>(s: &String) -> &'a Self; } fn main() {}<|fim_prefix|>// repo: dtolnay/ref-cast path: /tests/ui/short-lifetime.rs use ref_cast::{ref_cast_custom, RefCastCustom}; <|fim_middle|>#[derive(RefCastCustom)] #[repr(transparent)] pub struct Thing(Strin...
code_fim
medium
{ "lang": "rust", "repo": "dtolnay/ref-cast", "path": "/tests/ui/short-lifetime.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benbrunton/rust_minesweeper path: /src/game.rs use board::*; pub struct Game{ board: FieldView } impl Game { pub fn new() -> Game { Game{ board: FieldView::new(10, 10, 30) } } pub fn display(&self){ println!("{}", self.board); } pub fn select(...
code_fim
medium
{ "lang": "rust", "repo": "benbrunton/rust_minesweeper", "path": "/src/game.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn unfold(&mut self, col:String, row:u32){ self.board.unfold(col, row); } pub fn in_play(&self) -> bool { self.board.in_play() } }<|fim_prefix|>// repo: benbrunton/rust_minesweeper path: /src/game.rs use board::*; pub struct Game{ board: FieldView } impl Ga...
code_fim
hard
{ "lang": "rust", "repo": "benbrunton/rust_minesweeper", "path": "/src/game.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn flag(&mut self, col:String, row:u32){ self.board.flag(col, row); } pub fn unfold(&mut self, col:String, row:u32){ self.board.unfold(col, row); } pub fn in_play(&self) -> bool { self.board.in_play() } }<|fim_prefix|>// repo: benbrunton/rust_m...
code_fim
hard
{ "lang": "rust", "repo": "benbrunton/rust_minesweeper", "path": "/src/game.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[object(server)] pub struct VoiceRegion { pub id: String, pub name: String, pub vip: bool, pub optimal: bool, pub deprecated: bool, pub custom: bool, }<|fim_prefix|>// repo: mbenoukaiss/automate path: /src/gateway/models/voice.rs use crate::gateway::GuildMember; use crate::Snowfl...
code_fim
hard
{ "lang": "rust", "repo": "mbenoukaiss/automate", "path": "/src/gateway/models/voice.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mbenoukaiss/automate path: /src/gateway/models/voice.rs use crate::gateway::GuildMember; use crate::Snowflake; #[object(server)] pub struct VoiceState { pub guild_id: Option<Snowflake>, #[nullable] pub channel_id: Option<Snowflake>, pub user_id: Snowflake, pub member: Option...
code_fim
hard
{ "lang": "rust", "repo": "mbenoukaiss/automate", "path": "/src/gateway/models/voice.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[object(server)] pub struct VoiceRegion { pub id: String, pub name: String, pub vip: bool, pub optimal: bool, pub deprecated: bool, pub custom: bool, }<|fim_prefix|>// repo: mbenoukaiss/automate path: /src/gateway/models/voice.rs use crate::gateway::GuildMember; use crate::Snowf...
code_fim
hard
{ "lang": "rust", "repo": "mbenoukaiss/automate", "path": "/src/gateway/models/voice.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn lock(&self) -> spin::MutexGuard<T> { self.mutex.lock() } }<|fim_prefix|>// repo: Mandragorian/rustos path: /src/sync.rs use spin::Mutex; pub struct Locked<T> { mutex: Mutex<T>, } <|fim_middle|>impl<T> Locked<T> { pub const fn new(to_lock: T) -> Locked<T> { let mut...
code_fim
medium
{ "lang": "rust", "repo": "Mandragorian/rustos", "path": "/src/sync.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mandragorian/rustos path: /src/sync.rs use spin::Mutex; pub struct Locked<T> { mutex: Mutex<T>, } <|fim_suffix|> pub fn lock(&self) -> spin::MutexGuard<T> { self.mutex.lock() } }<|fim_middle|>impl<T> Locked<T> { pub const fn new(to_lock: T) -> Locked<T> { let mut...
code_fim
medium
{ "lang": "rust", "repo": "Mandragorian/rustos", "path": "/src/sync.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Orchaldir/rusted-arena path: /rusted_tiles/src/rendering/textured.rs use crate::math::color::*; use crate::math::get_corners; #[derive(Copy, Clone)] pub struct TexturedVertex { pub position: [f32; 2], pub tc: [f32; 2], // texture coordinates pub color: [f32; 3], } #[derive(Default)...
code_fim
hard
{ "lang": "rust", "repo": "Orchaldir/rusted-arena", "path": "/rusted_tiles/src/rendering/textured.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_add_clear() { let mut builder = TexturedTriangleBuilder::default(); builder.add_tile(P11, SIZE, TC11, TC_SIZE, COLOR); builder.clear(); assert!(builder.get().is_empty()); } }<|fim_prefix|>// repo: Orchaldir/rusted-arena path: /rusted_tiles/src...
code_fim
hard
{ "lang": "rust", "repo": "Orchaldir/rusted-arena", "path": "/rusted_tiles/src/rendering/textured.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let platforms = opts.platforms.unwrap_or(DEFAULT_PLATFORM.to_string()); // if the user supplies flavors either via the flavor or flavour flag, go ahead and // use them. Otherwise, pull them from the gpi let flavors = if opts.flavors.is_some() { opts.flavors.unw...
code_fim
hard
{ "lang": "rust", "repo": "jlgerber/runonjenkins", "path": "/src/from_gpi/request.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jlgerber/runonjenkins path: /src/from_gpi/request.rs use log::{debug,info}; use crate::{ BuildServer, RemoteBuildError, packalaka_tags::PackageTagList, utils::request_build_for, utils::request_package_build_for, cli::Opt, constants::DEFAULT_PLATFORM }; <|fim_suffi...
code_fim
medium
{ "lang": "rust", "repo": "jlgerber/runonjenkins", "path": "/src/from_gpi/request.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let adapter = instance .request_adapter( &wgpu::RequestAdapterOptions { power_preference: wgpu::PowerPreference::Default, compatible_surface: None, }, ) .awai...
code_fim
hard
{ "lang": "rust", "repo": "Nehliin/wgpu-render-node", "path": "/src/uniforms.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nehliin/wgpu-render-node path: /src/uniforms.rs use crate::{GpuData, RenderError}; use smallvec::SmallVec; use std::{any::TypeId, fmt::Display}; const UNIFORM_STACK_LIMIT: usize = 5; struct BindingInfo { size: usize, visibility: wgpu::ShaderStage, } pub struct UniformBindGroup { buf...
code_fim
hard
{ "lang": "rust", "repo": "Nehliin/wgpu-render-node", "path": "/src/uniforms.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { std::slice::from_raw_parts( self as *const Data3 as *const u8, std::mem::size_of::<Self>(), ) } } } #[test] fn construction() -> Result<(), RenderError> { let (device, _) =...
code_fim
hard
{ "lang": "rust", "repo": "Nehliin/wgpu-render-node", "path": "/src/uniforms.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(not(feature = "server"))] compile_error!("This version requires the `server` feature on"); mod boundary; pub mod headers; #[cfg(feature = "server")] #[cfg_attr(docsrs, doc(cfg(feature = "server")))] pub mod server; mod utils;<|fim_prefix|>// repo: pinkforest/multiparty path: /src/lib.rs //! # mult...
code_fim
medium
{ "lang": "rust", "repo": "pinkforest/multiparty", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pinkforest/multiparty path: /src/lib.rs //! # multiparty //! //! Simple zero copy* streaming multipart decoder implementation. //! //! \* Except for streams yielding `Bytes` smaller than half the boundary length. //! //! ## Examples //! //! ```toml //! multiparty = { version = "0.1", features = ...
code_fim
medium
{ "lang": "rust", "repo": "pinkforest/multiparty", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gharib85/toys path: /leetcode/242-valid-anagram.rs // 242. Valid Anagram // https://leetcode.com/problems/valid-anagram/ struct Solution { } <|fim_suffix|>fn main() { for i in &[ ("", ""), ("aa", "aa"), ("anagram", "nagaram"), ("rat", "car"), ( ...
code_fim
hard
{ "lang": "rust", "repo": "gharib85/toys", "path": "/leetcode/242-valid-anagram.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in &[ ("", ""), ("aa", "aa"), ("anagram", "nagaram"), ("rat", "car"), ( "印地语(天城文:हिन्दी或हिंदी,拉丁字母转写:Hindī)又称印度语、印度文,是印欧语系印度-伊朗语族中印度-雅利安语支下的一种语言", "城写ी,n拉度्或伊言)字-种又文印地系转利ं-i、H丁度雅印中度印语称ह,द下印语द安度印天ह语ि支一是母文ī的(ीि语族欧न印:语朗:语d" ), ...
code_fim
hard
{ "lang": "rust", "repo": "gharib85/toys", "path": "/leetcode/242-valid-anagram.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Shock-1/teensy4-rs path: /imxrt1062-fcb-gen/src/lookup.rs //! Lookup table //! //! The lookup table is a 256 byte array of commands that's part of the general //! FCB. We provide accessors that let you interact with the lookup table as either //! a byte slice or slice of `u32`s. use std::mem; u...
code_fim
hard
{ "lang": "rust", "repo": "Shock-1/teensy4-rs", "path": "/imxrt1062-fcb-gen/src/lookup.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl DerefMut for LookupTable { fn deref_mut(&mut self) -> &mut Self::Target { &mut self.0 } } impl AsRef<[u8]> for LookupTable { fn as_ref(&self) -> &[u8] { &self.0 } } impl AsMut<[u8]> for LookupTable { fn as_mut(&mut self) -> &mut [u8] { &mut self.0 } }...
code_fim
hard
{ "lang": "rust", "repo": "Shock-1/teensy4-rs", "path": "/imxrt1062-fcb-gen/src/lookup.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(super) fn def_struct<I>(indent_lvl: i64) -> impl Parser<Input = I, Output = ExtStatement> where I: Stream<Item = lexer::Token, Position = usize>, I::Error: ParseError<I::Item, I::Range, I::Position>, { token(lexer::Token::Ident("struct".into())).skip(lfs()) .with(expr(indent_...
code_fim
hard
{ "lang": "rust", "repo": "sabikin/Fourier", "path": "/src/syntax/ext.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match self { Lit::Nat(n) => write!(f, "{}", n), Lit::Int(i) => write!(f, "{:+}", i), Lit::Str(s) => write!(f, "{}", s), Lit::Tuple(es) => { write!(f, "[")?; for i in 0..es.len() { write!(f, "{:}", e...
code_fim
hard
{ "lang": "rust", "repo": "sabikin/Fourier", "path": "/src/syntax/ext.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sabikin/Fourier path: /src/syntax/ext.rs use syntax::Loc; use syntax::loc_range; use super::ast; use super::lexer; use super::parser::*; use core::{HoledTerm}; use core::typechk::{Value}; use core::translator::{self, RegisterCtx, TranslateErr, translate_term}; use combine::*; use std::fmt; use ...
code_fim
hard
{ "lang": "rust", "repo": "sabikin/Fourier", "path": "/src/syntax/ext.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>, make_arc(0, 180, 380.0, 270.0, 60.0), make_arc(0, -180, 380.0, 30.0, 60.0), make_line(-270, 100, -180, 100), make_line(-270, -100, -180, -100), make_line(330, 0, 400, 0), ], size: SizeCode::SC70, ...
code_fim
hard
{ "lang": "rust", "repo": "edgex004/rust-hdl", "path": "/rust-hdl-pcb/src/lvc_one_gate.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> description: "Single 2-input XOR Gate".to_string(), comment: "".to_string(), hide_pin_designators: false, hide_part_outline: false, pins: pin_list(vec![ pin!("A", Input, 100, West), pin!("B", Input, -100, West), ...
code_fim
hard
{ "lang": "rust", "repo": "edgex004/rust-hdl", "path": "/rust-hdl-pcb/src/lvc_one_gate.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: edgex004/rust-hdl path: /rust-hdl-pcb/src/lvc_one_gate.rs use rust_hdl_pcb_core::prelude::*; pub fn make_sn74lvc1g125se7(part_number: &str) -> CircuitNode { assert_eq!(part_number, "74LVC1G125SE-7"); CircuitNode::Logic(Logic { details: PartDetails { label: part_numbe...
code_fim
hard
{ "lang": "rust", "repo": "edgex004/rust-hdl", "path": "/rust-hdl-pcb/src/lvc_one_gate.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> entries.truncate(depth); if entry.contains('.') { max_len = max( max_len, entries.len() + entries.iter().sum::<usize>() + entry.len() - depth, ); } else { entries.push(entry.len() - depth) } } max_...
code_fim
medium
{ "lang": "rust", "repo": "pborzenkov/daily-coding-problem", "path": "/p0017/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pborzenkov/daily-coding-problem path: /p0017/src/lib.rs use std::cmp::max; pub fn p0017(dirs: &str) -> usize { let mut entries = Vec::new(); let mut max_len: usize = 0; for entry in dirs.split('\n') { let depth = entry.rfind('\t').map_or(0, |x| x + 1); entries.trun...
code_fim
hard
{ "lang": "rust", "repo": "pborzenkov/daily-coding-problem", "path": "/p0017/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( 0, p0017("dir\n\tsubdir1\n\t\tsubsubdir1\n\tsubdir2\n\t\tsubsubdir2") ); } }<|fim_prefix|>// repo: pborzenkov/daily-coding-problem path: /p0017/src/lib.rs use std::cmp::max; pub fn p0017(dirs: &str) -> usize { let mut entries = Vec::new(); ...
code_fim
hard
{ "lang": "rust", "repo": "pborzenkov/daily-coding-problem", "path": "/p0017/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jfedgar/rust_hello path: /src/strings.rs // Primitive str = Immutable fixed-length string somewhere in memory (what we have been using in println) // String = Growable, heap-allocated data structure - Use when you need to modify or own string data pub fn run() { // primitive: let hello =...
code_fim
hard
{ "lang": "rust", "repo": "jfedgar/rust_hello", "path": "/src/strings.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{}", hello1); // empty println!("{}", hello1.is_empty()); // contains println!("{}", hello1.contains("world")); // replace println!("{}", hello1.replace("world", "there")); for word in hello1.split_whitespace() { println!("{}", word); } // create...
code_fim
medium
{ "lang": "rust", "repo": "jfedgar/rust_hello", "path": "/src/strings.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn get_file_from_req_body(entries: &Entries) -> Result<(String, PathBuf), &'static str> { let file = match entries.fields.get("file") { Some(file) => file, None => return Err("File is missing"), }; let file_name = match &file[0].headers.filename { Some(file_na...
code_fim
hard
{ "lang": "rust", "repo": "Cempten/docx-template-generation", "path": "/backend/src/modules/request_utils.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Cempten/docx-template-generation path: /backend/src/modules/request_utils.rs use std::path::PathBuf; use multipart::server::{save::SavedData, Entries}; use rocket::http::ContentType; <|fim_suffix|>pub fn get_file_from_req_body(entries: &Entries) -> Result<(String, PathBuf), &'static str> ...
code_fim
hard
{ "lang": "rust", "repo": "Cempten/docx-template-generation", "path": "/backend/src/modules/request_utils.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> JsValue::from(serde_json::to_string(&item)?) } } #[fehler::throws] #[wasm_bindgen] pub fn parse_auto(s: &str) -> JsValue { Response::from(cbor_diag::parse_hex(s).or_else(|_| cbor_diag::parse_diag(s))?).try_into()? } #[fehler::throws] #[wasm_bindgen] pub fn parse_hex(hex: &str) -> JsValue...
code_fim
hard
{ "lang": "rust", "repo": "Nemo157/cbor.nemo157.com", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nemo157/cbor.nemo157.com path: /src/lib.rs use wasm_bindgen::{prelude::wasm_bindgen, JsError as Error, JsValue}; #[derive(serde::Serialize)] struct Response { annotated_hex: String, hex: String, diag: String, bytes_length: usize, } impl From<cbor_diag::DataItem> for Response { ...
code_fim
hard
{ "lang": "rust", "repo": "Nemo157/cbor.nemo157.com", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wlcsm/nPoly path: /src/ideals/groebner_basis.rs use crate::ideals::*; // use crate::algebras::EuclideanDomain; /// An iterator which returns an iterator of /// all unordered pairs of the original iterator // struct Unord<I: Iterator>{ // first: I, // second: I, // curr_el: Option<I...
code_fim
hard
{ "lang": "rust", "repo": "wlcsm/nPoly", "path": "/src/ideals/groebner_basis.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ideal = Ideal::new(f_vec); println!( "BB Alg time = {:?}", Duration::span(|| { ideal.bb_algorithm(); }) ); } // #[test] // fn bench_bb_alg_impr() { // let ring = PRDomain::<RR, MultiIndex<U2>, GLex>::new(...
code_fim
hard
{ "lang": "rust", "repo": "wlcsm/nPoly", "path": "/src/ideals/groebner_basis.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.divpolys(&g.gens).1 } fn s_poly(&self, rhs: &Poly<'a, P>) -> Option<Poly<'a, P>> { if self.is_zero() || rhs.is_zero() { None } else { let lcm = self.lt().lcm(&rhs.lt()); let a_newlead = lcm.euclid_div(&self.lt()).unwrap().0; ...
code_fim
hard
{ "lang": "rust", "repo": "wlcsm/nPoly", "path": "/src/ideals/groebner_basis.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shadow/shadow path: /src/main/core/scheduler/runahead.rs use std::sync::RwLock; use shadow_shim_helper_rs::simulation_time::SimulationTime; /// Decides on the runahead for the next simulation round (the duration of the round). Having a /// larger runahead improves performance since more hosts ...
code_fim
hard
{ "lang": "rust", "repo": "shadow/shadow", "path": "/src/main/core/scheduler/runahead.rs", "mode": "psm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> // check the same condition again, but with a write lock { let mut min_used_latency = self.min_used_latency.write().unwrap(); if !should_update(&min_used_latency) { return; } // cache the values for logging old_r...
code_fim
hard
{ "lang": "rust", "repo": "shadow/shadow", "path": "/src/main/core/scheduler/runahead.rs", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn question_mark(&mut self, f: Fragment) -> Fragment { let start = self.add_state(State::make_split(f.start, None)); let mut endstates = vec![start]; endstates.extend(f.endstates); Fragment { start, endstates } } pub(crate) fn plus(&mut self, f: Frag...
code_fim
hard
{ "lang": "rust", "repo": "RRethy/rejects", "path": "/src/nfa.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RRethy/rejects path: /src/nfa.rs use quote::quote; use quote::{ToTokens, TokenStreamExt}; use std::collections::HashSet; use std::ops::Index; #[allow(dead_code)] #[derive(Debug)] pub(crate) struct Fragment { pub(crate) start: usize, pub(crate) endstates: Vec<usize>, } #[allow(dead_code...
code_fim
hard
{ "lang": "rust", "repo": "RRethy/rejects", "path": "/src/nfa.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(unused_macros)] macro_rules! check_bit_fn { ($doc:meta, $fun:ident, $field:ident, $bit:expr) => ( #[$doc] pub fn $fun(&self) -> bool { is_bit_set!(self.$field, $bit) } ) }<|fim_prefix|>// repo: zhangpf/rux path: /kernel/src/arch/x86_64/paging/macros.rs ...
code_fim
hard
{ "lang": "rust", "repo": "zhangpf/rux", "path": "/kernel/src/arch/x86_64/paging/macros.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zhangpf/rux path: /kernel/src/arch/x86_64/paging/macros.rs macro_rules! bit { ( $x:expr ) => { 1 << $x }; } macro_rules! check_flag { ($doc:meta, $fun:ident, $flag:ident) => ( #[$doc] pub fn $fun(&self) -> bool { self.contains($flag) } ...
code_fim
medium
{ "lang": "rust", "repo": "zhangpf/rux", "path": "/kernel/src/arch/x86_64/paging/macros.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tinnguyenhuuletrong/Learning path: /nx-ts-rust-play/packages/app/rs-physic-play/src/main.rs use anyhow::Result; use draw::*; use rapier2d::prelude::*; use serde::{Deserialize, Serialize}; use std::fs::File; use std::io::Write; #[derive(Serialize, Deserialize)] struct PhysicsState { ...
code_fim
hard
{ "lang": "rust", "repo": "tinnguyenhuuletrong/Learning", "path": "/nx-ts-rust-play/packages/app/rs-physic-play/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ball_body = scene.get_bodies().get(ball_body_handle).unwrap(); let trans = ball_body.translation(); println!("It {} : Ball pos: {} - {}", it, trans.x, trans.y); let mut canvas = Canvas::new(100, 10); do_render(&scene, &mut canvas); render::save( ...
code_fim
hard
{ "lang": "rust", "repo": "tinnguyenhuuletrong/Learning", "path": "/nx-ts-rust-play/packages/app/rs-physic-play/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.bodies } fn get_colliders(self: &Self) -> &ColliderSet { &self.colliders } } struct EventLog {} impl EventHandler for EventLog { fn handle_collision_event( &self, _bodies: &RigidBodySet, _colliders: &ColliderSet, _event:...
code_fim
hard
{ "lang": "rust", "repo": "tinnguyenhuuletrong/Learning", "path": "/nx-ts-rust-play/packages/app/rs-physic-play/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RNCryptor/rncryptor-rs path: /tests/iv.rs extern crate rncryptor; use rncryptor::v3::types::*; #[test] fn can_generate_iv() { assert!(IV::new().is_ok()) } <|fim_suffix|> match IV::new() { Err(e) => panic!(e), Ok(iv) => assert_eq!(iv.as_slice().len(), 16), } }<|fim_...
code_fim
easy
{ "lang": "rust", "repo": "RNCryptor/rncryptor-rs", "path": "/tests/iv.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match IV::new() { Err(e) => panic!(e), Ok(iv) => assert_eq!(iv.as_slice().len(), 16), } }<|fim_prefix|>// repo: RNCryptor/rncryptor-rs path: /tests/iv.rs extern crate rncryptor; use rncryptor::v3::types::*; <|fim_middle|>#[test] fn can_generate_iv() { assert!(IV::new().is_o...
code_fim
medium
{ "lang": "rust", "repo": "RNCryptor/rncryptor-rs", "path": "/tests/iv.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gemarcano/libtock-rs path: /examples/sensors.rs #![no_std] use libtock::println; use libtock::result::TockResult; use libtock::sensors::Sensor; use libtock::timer::Duration; <|fim_suffix|> loop { println!("Humidity: {}\n", drivers.humidity_sensor.read()?); println!("Tempe...
code_fim
hard
{ "lang": "rust", "repo": "gemarcano/libtock-rs", "path": "/examples/sensors.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>#[libtock::main] async fn main() -> TockResult<()> { let mut drivers = libtock::retrieve_drivers()?; let mut timer_driver = drivers.timer.create_timer_driver(); let timer_driver = timer_driver.activate()?; drivers.console.create_console(); loop { println!("Humidity: {}\n",...
code_fim
medium
{ "lang": "rust", "repo": "gemarcano/libtock-rs", "path": "/examples/sensors.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>fn main() -> amethyst::Result<()> { amethyst::start_logger(Default::default()); let app_root = amethyst::utils::application_root_dir()?; let assets_dir = app_root.join("assets"); let config_dir = app_root.join("config"); let display_config_path = config_dir.join("display.ron"); ...
code_fim
hard
{ "lang": "rust", "repo": "IAmMadfly/SilentShooter", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let game_data = GameDataBuilder::default() .with( amethyst::utils::ortho_camera::CameraOrthoSystem::default(), "ortho_camera_system", &[] ) .with_system_desc( systems::game_time::GameTimeSystemDesc::default(), "game_t...
code_fim
hard
{ "lang": "rust", "repo": "IAmMadfly/SilentShooter", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IAmMadfly/SilentShooter path: /src/main.rs use amethyst::{ self, Application, GameDataBuilder, core::transform::TransformBundle, input::{ StringBindings, InputBundle }, renderer::{ RenderingBundle, plugins::{RenderFlat2D, RenderToWindo...
code_fim
hard
{ "lang": "rust", "repo": "IAmMadfly/SilentShooter", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>{Broker, Client, Controller}; pub use crate::storage::{Cluster, Partition};<|fim_prefix|>// repo: tiagodeliberali/logstreamer path: /src/lib.rs mod communication; mod core; mod endpoint; mod storage; pub use crate::communication::{Action, ActionMessage, Response, ResponseMessage}; pub use cr<|fim_middle...
code_fim
medium
{ "lang": "rust", "repo": "tiagodeliberali/logstreamer", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }