text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>impl Plugin for GameOverPlugin { fn build(&self, _app: &mut AppBuilder) {} }<|fim_prefix|>// repo: TheRawMeatball/drone_attack path: /src/game_over/mod.rs mod components; mod resources; mod systems; use bevy::{ecs::StateSetBuilder, prelude::*}; use crate::{AppState, GameMaterials}; use components:...
code_fim
hard
{ "lang": "rust", "repo": "TheRawMeatball/drone_attack", "path": "/src/game_over/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> procedural::cylinder(diameter, height, nsubdivs) } }<|fim_prefix|>// repo: alexanderzone/ncollide path: /src/procedural/to_trimesh/cylinder_to_trimesh.rs use std::num::Zero; use nalgebra::na; use geom::Cylinder; use procedural::{TriMesh, ToTriMesh}; use procedural; use math::{Scalar, Vect}; ...
code_fim
hard
{ "lang": "rust", "repo": "alexanderzone/ncollide", "path": "/src/procedural/to_trimesh/cylinder_to_trimesh.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexanderzone/ncollide path: /src/procedural/to_trimesh/cylinder_to_trimesh.rs use std::num::Zero; use nalgebra::na; use geom::Cylinder; use procedural::{TriMesh, ToTriMesh}; use procedural; use math::{Scalar, Vect}; <|fim_suffix|> let diameter = self.radius() * na::cast(2.0f64); ...
code_fim
hard
{ "lang": "rust", "repo": "alexanderzone/ncollide", "path": "/src/procedural/to_trimesh/cylinder_to_trimesh.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bobbin-rs/bobbin-sdk path: /mcu/bobbin-sam/samd21/src/ext/clock.rs use bobbin_bits::*; use bobbin_mcu::clock::{Clock, ClockFor}; use bobbin_mcu::hz::Hz; use clock::*; use gclk::*; use {gclk, sysctrl, nvmctrl, pm}; macro_rules! impl_gclk { ($id:ident, $index:expr) => { fn $id(&se...
code_fim
hard
{ "lang": "rust", "repo": "bobbin-rs/bobbin-sdk", "path": "/mcu/bobbin-sam/samd21/src/ext/clock.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Write full configuration to DFLL control register sysctrl::SYSCTRL.with_dfllctrl(|r| r .set_mode(1) .set_waitlock(1) .set_qldis(1) ); // Wait for synchronization while sysctrl::SYSCTRL.pclksr().dfllrdy() == 0 {} // Enable the DFLL sysctrl::SYSCTRL...
code_fim
hard
{ "lang": "rust", "repo": "bobbin-rs/bobbin-sdk", "path": "/mcu/bobbin-sam/samd21/src/ext/clock.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mesh.get_dual(e_id.rot_inv()).borrow_mut().org = face; let edge = mesh.connect_primal(e_id, last_radial_out); mesh.get_dual(edge.rot_inv()).borrow_mut().org = face; let new_face = mesh.insert_face(quad_edge::delaunay_voro...
code_fim
hard
{ "lang": "rust", "repo": "computemachines/quad-edge", "path": "/src/gui/animate_mesh/algorithm_animate.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> InsertExteriorState::FindFanStart } else { // animate_events.send(SetMarked(Some("Found Fan Start"), e.id().into(), true)); InsertExteriorState::InsertDangling } } InsertExteriorState::InsertDangling => { /...
code_fim
hard
{ "lang": "rust", "repo": "computemachines/quad-edge", "path": "/src/gui/animate_mesh/algorithm_animate.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: computemachines/quad-edge path: /src/gui/animate_mesh/algorithm_animate.rs point_target_visibility: Query<&mut Visibility, With<PointTarget>>, mut animate_events: EventWriter<AnimateMeshEvent<'static>>, ) { // ensure that target point is visible animate_events.send(AnimateMeshEvent:...
code_fim
hard
{ "lang": "rust", "repo": "computemachines/quad-edge", "path": "/src/gui/animate_mesh/algorithm_animate.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn split(&self, n_parts: u16) -> Vec<Box<Sampler>> { let square_width = (self.area() as f64 / (n_parts as f64)).sqrt() as u32; let mut result = Vec::new(); let mx = self.width() / square_width; let my = self.height() / square_width; for rx in partition(&self.ran...
code_fim
hard
{ "lang": "rust", "repo": "matklad/rustraytracer", "path": "/src/rendering/samplers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matklad/rustraytracer path: /src/rendering/samplers.rs use std::ops::Range; use rand; use scene::ScreenPoint; use super::Pixel; use super::utils::to_uniform; use super::config::SamplerConfig; #[derive(Clone, Copy)] pub struct Sample { pub pixel: ScreenPoint, } pub trait Sampler: Send +...
code_fim
hard
{ "lang": "rust", "repo": "matklad/rustraytracer", "path": "/src/rendering/samplers.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut result = Vec::with_capacity(self.area() as usize); for x in self.range[0].clone() { for y in self.range[1].clone() { let jitter = if self.jitter { ScreenPoint::new( rand::random::<f64>() % 0.5, ...
code_fim
hard
{ "lang": "rust", "repo": "matklad/rustraytracer", "path": "/src/rendering/samplers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gears-project/gears-core-rust path: /tests/xflow_run_001.rs extern crate env_logger; extern crate gears; use gears::structure::xflow::*; use gears::runtime::xfstate::*; use gears::runtime::xfrunner::*; use gears::runtime::dispatcher::*; use gears::runtime::actiondispatch; mod common; use crat...
code_fim
hard
{ "lang": "rust", "repo": "gears-project/gears-core-rust", "path": "/tests/xflow_run_001.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match run_xflow("resource/docs/xflow/flows/arithmetic_addition.json") { Ok(output) => { match output.get("ReturnValue").unwrap().value { XFlowValue::Integer(i) => assert_eq!(i, 3), _ => assert!(false), } } Err(err) => fail...
code_fim
hard
{ "lang": "rust", "repo": "gears-project/gears-core-rust", "path": "/tests/xflow_run_001.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> result.push_str(&format!("{} : {}\n",name, value.to_string_pretty())); } return result; } }<|fim_prefix|>// repo: kuririn246/sabun_data_model path: /sabun_maker/src/imp/structs/json_file.rs use std::collections::BTreeMap; use crate::imp::structs::my_json::Value; #[derive...
code_fim
medium
{ "lang": "rust", "repo": "kuririn246/sabun_data_model", "path": "/sabun_maker/src/imp/structs/json_file.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kuririn246/sabun_data_model path: /sabun_maker/src/imp/structs/json_file.rs use std::collections::BTreeMap; use crate::imp::structs::my_json::Value; #[derive(Debug)] pub struct JsonFile{ pub file_name_without_ext : String, pub json : String, } <|fim_suffix|>impl JsonDir{ pub fn to...
code_fim
medium
{ "lang": "rust", "repo": "kuririn246/sabun_data_model", "path": "/sabun_maker/src/imp/structs/json_file.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> type Transport = Framed<T, LineCodec>; type BindTransport = Result<Self::Transport, io::Error>; fn bind_transport(&self, io: T) -> Self::BindTransport { Ok(io.framed(LineCodec)) } } pub struct EchoService; impl Service for EchoService { type Request = (u64, String); type...
code_fim
hard
{ "lang": "rust", "repo": "adonnell6/code", "path": "/old/08-futures/tokio-examples/src/bin/delayed-echo-server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adonnell6/code path: /old/08-futures/tokio-examples/src/bin/delayed-echo-server.rs extern crate bytes; extern crate futures; extern crate tokio_io; extern crate tokio_proto; extern crate tokio_service; extern crate tokio_timer; use std::io::{self, ErrorKind}; use std::str; use std::time::Durati...
code_fim
hard
{ "lang": "rust", "repo": "adonnell6/code", "path": "/old/08-futures/tokio-examples/src/bin/delayed-echo-server.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let j = line.iter().position(|&b| b == b' ') .ok_or_else(|| make_error("no space in message"))?; let delay = line.split_to(j); line.split_to(1); let n = decode_u64(&delay) .map_err(|_| make_error("invalid delay"))?; ...
code_fim
hard
{ "lang": "rust", "repo": "adonnell6/code", "path": "/old/08-futures/tokio-examples/src/bin/delayed-echo-server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: p0lunin/umlsm_old path: /src/action.rs //! Actions which called in `ITransition`. //! //! Actions - functions which will be called first when `ITransition` will be started. They can //! mutate states, do something job, and must return `Answer` which will be returning from //! `StateMachine` when...
code_fim
hard
{ "lang": "rust", "repo": "p0lunin/umlsm_old", "path": "/src/action.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>tateMachine::add_loop`. For more information //! about necessity see `ActionLoop` documentation. //! //! Full list of args for `ActionLoop`: //! - `Vertex` - a state which forms a loop. //! - `Ctx` - a global context which stored in `StateMachine`. //! - `Event` - the event which user give for `StateMachi...
code_fim
hard
{ "lang": "rust", "repo": "p0lunin/umlsm_old", "path": "/src/action.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: deltaphc/raylib-rs path: /showcase/src/example/core/core_3d_picking.rs /******************************************************************************************* * * raylib [core] example - Picking in 3d mode * * This example has been created using raylib 1.3 (www.raylib.com) * raylib is...
code_fim
hard
{ "lang": "rust", "repo": "deltaphc/raylib-rs", "path": "/showcase/src/example/core/core_3d_picking.rs", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> } } //---------------------------------------------------------------------------------- // Draw //---------------------------------------------------------------------------------- let mut d = rl.begin_drawing(thread); d.clear_background(Colo...
code_fim
hard
{ "lang": "rust", "repo": "deltaphc/raylib-rs", "path": "/showcase/src/example/core/core_3d_picking.rs", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> for sig in sig_list{ if sig.number == 0 { continue; } let mut report=format!("{} untraced issues(no reply,no label shows its status) in the {} sig\n", sig.number,sig.sig.name); report.push_str(&sig.report); println!("---------{}-----",sig.sig.name); ...
code_fim
hard
{ "lang": "rust", "repo": "AndreMouche/pingbot", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AndreMouche/pingbot path: /src/main.rs mod config; mod providers; use clap::Clap; use config::{Config,Sig}; use providers::discourse::Discourse; use providers::github::GitHub; use providers::slack::Slack; #[derive(Clap)] #[clap(version = "1.0", author = "you06")] struct Opts { #[clap(short...
code_fim
hard
{ "lang": "rust", "repo": "AndreMouche/pingbot", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: leod/ultimate-scale path: /src/machine/string_util.rs use crate::machine::grid::{Dir3, Point3}; use crate::machine::{BlipKind, Block}; pub fn blocks_from_string(s: &str) -> Vec<(Point3, Block)> { s.lines() .filter(|row| !row.trim().is_empty()) .enumerate() .flat_map(...
code_fim
hard
{ "lang": "rust", "repo": "leod/ultimate-scale", "path": "/src/machine/string_util.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> '┷' => Block::BlipSpawn { out_dir: Dir3::Y_NEG, kind: BlipKind::A, num_spawns: Some(1), }, '┯' => Block::BlipSpawn { out_dir: Dir3::Y_POS, kind: BlipKind::A, num_spawns: Some(1), }, '┨' => Block...
code_fim
hard
{ "lang": "rust", "repo": "leod/ultimate-scale", "path": "/src/machine/string_util.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dpelevin/farmanager-api-rust-bindings path: /farmanager/src/panel/wrapper.rs use std::ptr; use crate::common::ffi::AsInner; use crate::common::ffi::AsMutInner; use crate::common::string::WideString; use crate::ffi; use crate::common::ffi::Array; use crate::common::string::WideStringArray; pub(...
code_fim
hard
{ "lang": "rust", "repo": "dpelevin/farmanager-api-rust-bindings", "path": "/farmanager/src/panel/wrapper.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(dead_code)] pub(crate) struct InfoPanelLine { pub(super) inner: ffi::InfoPanelLine, pub(super) text: WideString, pub(super) data: WideString, } impl AsInner<ffi::InfoPanelLine> for InfoPanelLine { fn as_inner(&self) -> &ffi::InfoPanelLine { &self.inner } } impl From<&...
code_fim
hard
{ "lang": "rust", "repo": "dpelevin/farmanager-api-rust-bindings", "path": "/farmanager/src/panel/wrapper.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pointer::box_1(); } #[test] fn test_pointer_box_2() { use pointer::List::{Cons, Nil}; let list = Cons(1, Box::new(Cons(2, Box::new(Cons(3, Box::new(Nil))))...
code_fim
hard
{ "lang": "rust", "repo": "LyunKi/rust-study", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LyunKi/rust-study path: /src/lib.rs mod r#trait; pub use r#trait::{back_input, NewArticle, Summary}; pub mod closure; pub mod lifetime; pub use lifetime::largest; pub use lifetime::AStructure; pub fn back_two() -> i32 { 2 } pub mod pointer { use std::ops::Deref; pub fn box_1(...
code_fim
hard
{ "lang": "rust", "repo": "LyunKi/rust-study", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GrandBasis/rust-vmm path: /vmm-reference/src/devices/src/virtio/mod.rs // Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 OR BSD-3-Clause // We're only providing virtio over MMIO devices for now, but we aim to add PCI support as wel...
code_fim
hard
{ "lang": "rust", "repo": "GrandBasis/rust-vmm", "path": "/vmm-reference/src/devices/src/virtio/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> impl CommonArgsMock { pub fn new() -> Self { let mem = Arc::new(GuestMemoryMmap::from_ranges(&[(GuestAddress(0), 0x1000_0000)]).unwrap()); let kvm = kvm_ioctls::Kvm::new().unwrap(); let vm_fd = Arc::new(kvm.create_vm().unwrap()); ...
code_fim
hard
{ "lang": "rust", "repo": "GrandBasis/rust-vmm", "path": "/vmm-reference/src/devices/src/virtio/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> where B: Send, F: Fn(B, Self::Item) -> B, { self.base.partial_fold(init, fold_op, limit) } fn scheduler<'s, P: 's, R: 's>(&self) -> Box<dyn Scheduler<P, R> + 's> where P: Producer, P::Item: Send, R: Reducer<P::Item>, { self.ba...
code_fim
hard
{ "lang": "rust", "repo": "wagnerf42/kvik", "path": "/src/adaptors/by_blocks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> where P: Producer<Item = Item>, { let sizes = self .blocks_sizes .take() .expect("no sizes left in by_blocks"); // let's get a sequential iterator of producers of increasing sizes let producers = sizes.scan(Some(producer), |p, s| ...
code_fim
hard
{ "lang": "rust", "repo": "wagnerf42/kvik", "path": "/src/adaptors/by_blocks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wagnerf42/kvik path: /src/adaptors/by_blocks.rs use crate::prelude::*; pub struct ByBlocks<I, S> { pub(crate) base: I, pub(crate) blocks_sizes: Option<S>, } // producer impl<I: Iterator, S> Iterator for ByBlocks<I, S> { type Item = I::Item; fn next(&mut self) -> Option<Self::It...
code_fim
hard
{ "lang": "rust", "repo": "wagnerf42/kvik", "path": "/src/adaptors/by_blocks.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: levilxw/gitlab-sonar-scanner-with-quality-gate path: /src/domain/sonar/task.rs #[derive(Debug, Serialize, Deserialize)] pub struct Task { pub task: SonarBackgroundTask, } #[derive(Debug, Serialize, Deserialize)] pub struct SonarBackgroundTask { #[serde(rename = "comp<|fim_suffix|>ing, ...
code_fim
medium
{ "lang": "rust", "repo": "levilxw/gitlab-sonar-scanner-with-quality-gate", "path": "/src/domain/sonar/task.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ing, pub status: String, #[serde(rename = "executionTimeMs")] execution_time_ms: i64, }<|fim_prefix|>// repo: levilxw/gitlab-sonar-scanner-with-quality-gate path: /src/domain/sonar/task.rs #[derive(Debug, Serialize, Deserialize)] pub struct Task { pub task: SonarBackgroundTask, } #<|fim_...
code_fim
medium
{ "lang": "rust", "repo": "levilxw/gitlab-sonar-scanner-with-quality-gate", "path": "/src/domain/sonar/task.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> where D: Deserializer<'de>, { let mut response = Self { url: Url::parse("http://localhost").unwrap(), status: StatusCode::OK, text: String::new(), content_length: 0, headers: HeaderMap::new(), wildcard: false, ...
code_fim
hard
{ "lang": "rust", "repo": "ndbrain/feroxbuster", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ndbrain/feroxbuster path: /src/lib.rs r::Error + Send + Sync + 'static>>; /// Simple Error implementation to allow for custom error returns #[derive(Debug, Default)] pub struct FeroxError { /// fancy string that can be printed via Display pub message: String, } impl error::Error for Fe...
code_fim
hard
{ "lang": "rust", "repo": "ndbrain/feroxbuster", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>r.push_str("s"); println!("{:?}", buffer); }<|fim_prefix|>// repo: chi9rin/rust_practice path: /dangerous_mutation/src/main.rs fn main() { let mut buffer: String = format<|fim_middle|>!("Rustacean"); { let slice = &buffer[1..]; println!("{:?}", slice); } buffe
code_fim
medium
{ "lang": "rust", "repo": "chi9rin/rust_practice", "path": "/dangerous_mutation/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chi9rin/rust_practice path: /dangerous_mutation/src/main.rs fn main() { let mut buffer: String = format<|fim_suffix|>r.push_str("s"); println!("{:?}", buffer); }<|fim_middle|>!("Rustacean"); { let slice = &buffer[1..]; println!("{:?}", slice); } buffe
code_fim
medium
{ "lang": "rust", "repo": "chi9rin/rust_practice", "path": "/dangerous_mutation/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>- Receive FIFO Size"] #[inline(always)] pub fn rxfifo(&self) -> RXFIFO_R { RXFIFO_R::new(((self.bits >> 8) & 0xff) as u8) } }<|fim_prefix|>// repo: rv32m1-rust/rv32m1_ri5cy-pac path: /src/lpuart1/param.rs #[doc = "Reader of register PARAM"] pub type R = crate::R<u32, super::PARAM>; #[doc = "Rea...
code_fim
medium
{ "lang": "rust", "repo": "rv32m1-rust/rv32m1_ri5cy-pac", "path": "/src/lpuart1/param.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rv32m1-rust/rv32m1_ri5cy-pac path: /src/lpuart1/param.rs #[doc = "Reader of register PARAM"] pub type R = crate::R<u32, super::PARAM>; #[doc = "Reader of field `TXFIFO`"] pub type TXFIFO_R = <|fim_suffix|>O Size"] #[inline(always)] pub fn txfifo(&self) -> TXFIFO_R { TXFIFO_R::new((self.b...
code_fim
medium
{ "lang": "rust", "repo": "rv32m1-rust/rv32m1_ri5cy-pac", "path": "/src/lpuart1/param.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>O Size"] #[inline(always)] pub fn txfifo(&self) -> TXFIFO_R { TXFIFO_R::new((self.bits & 0xff) as u8) } #[doc = "Bits 8:15 - Receive FIFO Size"] #[inline(always)] pub fn rxfifo(&self) -> RXFIFO_R { RXFIFO_R::new(((self.bits >> 8) & 0xff) as u8) } }<|fim_prefix|>// repo: rv32m1-rust/r...
code_fim
medium
{ "lang": "rust", "repo": "rv32m1-rust/rv32m1_ri5cy-pac", "path": "/src/lpuart1/param.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Xiaohanjlll/rust-firmware path: /r-uefi-pi/src/enum_builder.rs // Copyright (c) 2021 Intel Corporation // // SPDX-License-Identifier: BSD-2-Clause-Patent /// A macro which defines an enum type. #[macro_export] macro_rules! enum_builder { ( $(#[$comment:meta])* @U8 EnumName:...
code_fim
hard
{ "lang": "rust", "repo": "Xiaohanjlll/rust-firmware", "path": "/r-uefi-pi/src/enum_builder.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match value { $($enum_val => $enum_name::$enum_var,)* x => $enum_name::Unknown(x) } } } impl<'a> ctx::TryFromCtx<'a, Endian> for $enum_name { type Error = scroll::Error; fn try_from...
code_fim
hard
{ "lang": "rust", "repo": "Xiaohanjlll/rust-firmware", "path": "/r-uefi-pi/src/enum_builder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match op_code { 1 => { let out = vec[i + 3]; vec[out] = ten + hundred; }, 2 => { let out = vec[i + 3]; vec[out] = ten * hundred; }, 3 => { let out =...
code_fim
hard
{ "lang": "rust", "repo": "HannesTuhkala/aoc", "path": "/2019/ex5.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HannesTuhkala/aoc path: /2019/ex5.rs use std::fs::File; use std::io::{BufRead, BufReader}; fn read() -> Vec<usize> { let f = File::open("input_ex5").unwrap(); let mut br = BufReader::new(f); let mut line = String::new(); br.read_line(&mut line).unwrap(); println!...
code_fim
hard
{ "lang": "rust", "repo": "HannesTuhkala/aoc", "path": "/2019/ex5.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AlexanderMattheis/filter path: /src/system/data/composed/point_operations/histogram_equalization_input.rs use crate::system::data::elementary::channels_input:<|fim_suffix|>b accumulate_roots: bool, pub per_channel: bool }<|fim_middle|>:RgbaChannelsInput; pub struct HistogramEqualizationInpu...
code_fim
medium
{ "lang": "rust", "repo": "AlexanderMattheis/filter", "path": "/src/system/data/composed/point_operations/histogram_equalization_input.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nInput { pub channels: RgbaChannelsInput, pub accumulate_roots: bool, pub per_channel: bool }<|fim_prefix|>// repo: AlexanderMattheis/filter path: /src/system/data/composed/point_operations/histogram_equalization_input.rs use crate::system::data::elementary::channels_input:<|fim_middle|>:Rgba...
code_fim
easy
{ "lang": "rust", "repo": "AlexanderMattheis/filter", "path": "/src/system/data/composed/point_operations/histogram_equalization_input.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kryo4096/RostOS path: /rost_fs/src/disk/block.rs use crate::disk::{Disk, DiskAddress}; use crate::node::node::{self, Node}; use core::fmt::Debug; use core::mem; use core::option::NoneError; use alloc::vec::Vec; pub const BLOCK_SIZE: u64 = 4096; pub const MAGIC: u64 = 0xdead_cafe_beef_feed; pub...
code_fim
hard
{ "lang": "rust", "repo": "kryo4096/RostOS", "path": "/rost_fs/src/disk/block.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) } pub fn copy_from_data_block( disk: &impl Disk, mut data_block_addr: DiskAddress, buffer: &mut Vec<u8>, size: u64, ) -> Result<(), NoneError> { 'blocks: for block_nr in 0..=size as usize / BLOCK_DATA_SIZE { let data_block = get_data_block(disk, data_block_addr)?; ...
code_fim
hard
{ "lang": "rust", "repo": "kryo4096/RostOS", "path": "/rost_fs/src/disk/block.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tdcare/eventmill path: /eventmill/src/store.rs use crate::aggregate::{AggregateIdOf, WithAggregateId}; use crate::event::{DomainEvent, EventType, Sequence}; use crate::query::ReceiveEvent; pub trait EventSink<E, A> where E: EventType, A: WithAggregateId, { type Error: std::error::Er...
code_fim
hard
{ "lang": "rust", "repo": "tdcare/eventmill", "path": "/eventmill/src/store.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self, aggregate_id: &AggregateIdOf<A>, subscriber: &mut R, ) -> Result<(), Self::Error> where R: ReceiveEvent<E, A>; fn read_from_offset<R>( &self, aggregate_id: &AggregateIdOf<A>, offset: Sequence, subscriber: &mut R, ) -> ...
code_fim
hard
{ "lang": "rust", "repo": "tdcare/eventmill", "path": "/eventmill/src/store.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/notred path: /notred-rs/notred/src/node_util.rs use crate::common::*; pub fn node_by_name<'a>(nodes: &'a Vec<Box<dyn Node>>, name: &str) -> Option<&'a Box<dyn Node>> { for n in nodes { if n.get_name() == name { return Option::Some(n); } }; return ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/notred", "path": "/notred-rs/notred/src/node_util.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn dest_node_of(connections: &Vec<Connection>, src_name: &str, output_index: usize) -> Option<String> { for c in connections { if c.source == src_name && c.source_output_index == output_index { return Option::Some(c.dest.clone()); } } return Option::None; }<|fim...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/notred", "path": "/notred-rs/notred/src/node_util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: povilasb/http-proxy path: /src/proxy.rs //! I/O free implementation of HTTP proxy parsing and serializing. use httparse::Status; use unwrap::unwrap; use async_std::net::TcpStream; /// State machine for a single HTTP proxy session. /// /// Transitions: /// /// - WaitingRequest.on_data() => [Wai...
code_fim
hard
{ "lang": "rust", "repo": "povilasb/http-proxy", "path": "/src/proxy.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl OnConnectRequest { pub fn on_connected(self, conn: TcpStream) -> ConnectTunnel { ConnectTunnel { conn } } } // TODO(povilas): make it generic over connection type #[derive(Debug)] pub struct ConnectTunnel { pub conn: TcpStream, }<|fim_prefix|>// repo: povilasb/http-proxy path: /...
code_fim
hard
{ "lang": "rust", "repo": "povilasb/http-proxy", "path": "/src/proxy.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl TouchInfo { pub fn pressure_axis(&self) -> &AxisInfo { &self.pressure_axis } }<|fim_prefix|>// repo: yoanlcq/dmc path: /src/device/touch.rs //! Touch devices (touchpads or touch-screens) //! //! This module is very incomplete. <|fim_middle|>use super::AxisInfo; /// Touch-device-specific inform...
code_fim
hard
{ "lang": "rust", "repo": "yoanlcq/dmc", "path": "/src/device/touch.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yoanlcq/dmc path: /src/device/touch.rs //! Touch devices (touchpads or touch-screens) //! //! This module is very incomplete. use super::AxisInfo; <|fim_suffix|>impl TouchInfo { pub fn pressure_axis(&self) -> &AxisInfo { &self.pressure_axis } }<|fim_middle|>/// Touch-device-specific inform...
code_fim
medium
{ "lang": "rust", "repo": "yoanlcq/dmc", "path": "/src/device/touch.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Touch-device-specific information. #[derive(Debug, Clone, PartialEq)] pub struct TouchInfo { /// The `AxisInfo` for the pressure axis. pub(crate) pressure_axis: AxisInfo, } impl TouchInfo { pub fn pressure_axis(&self) -> &AxisInfo { &self.pressure_axis } }<|fim_prefix|>// repo: yoanlcq/dm...
code_fim
easy
{ "lang": "rust", "repo": "yoanlcq/dmc", "path": "/src/device/touch.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub mod interrupts; pub mod globals;<|fim_prefix|>// repo: nshyrei/rustos path: /setup/src/lib.rs #![no_std] #![feature(abi_x86_interrupt)] <|fim_middle|>extern crate hardware; extern crate multiprocess; extern crate multiboot;
code_fim
medium
{ "lang": "rust", "repo": "nshyrei/rustos", "path": "/setup/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nshyrei/rustos path: /setup/src/lib.rs #![no_std] #![feature(abi_x86_interrupt)] <|fim_suffix|>pub mod interrupts; pub mod globals;<|fim_middle|>extern crate hardware; extern crate multiprocess; extern crate multiboot;
code_fim
medium
{ "lang": "rust", "repo": "nshyrei/rustos", "path": "/setup/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alsacoin/alsacoin path: /protocol/src/network.rs atch msg.to_owned() { ConsensusMessage::Mine { id, address, node, transactions, .. } => { if node.address != state.lock().unwrap().address { le...
code_fim
hard
{ "lang": "rust", "repo": "alsacoin/alsacoin", "path": "/protocol/src/network.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> handle(state.clone(), network.clone(), logger.clone(), &cons_msg).map_err(|e| { NetworkError::Consensus { msg: format!("{}", e), } }) }), ) .map_err(|e| e.into()) } /// `avalanche_s...
code_fim
hard
{ "lang": "rust", "repo": "alsacoin/alsacoin", "path": "/protocol/src/network.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alsacoin/alsacoin path: /protocol/src/network.rs mat!("{:?}", e), })??; } break; } else { max_retries -= 1; } } let res = res_arc.lock().unwrap().clone(); Ok(res) } /// `fetch_transactions` fetches transactions fr...
code_fim
hard
{ "lang": "rust", "repo": "alsacoin/alsacoin", "path": "/protocol/src/network.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn get_interner() -> Option<&'static Arc<ThreadedRodeo>> { INTERNER.get() } #[test] fn test_initialization() { INTERNER.get_or_init(|| Arc::new(ThreadedRodeo::new())); let key = INTERNER.get().unwrap().get_or_intern_static("hello world"); let resolved_string = INTERNER.get().unwrap()...
code_fim
hard
{ "lang": "rust", "repo": "mattwparas/steel", "path": "/crates/steel-core/src/parser/interner.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mattwparas/steel path: /crates/steel-core/src/parser/interner.rs use lasso::Key; use lasso::Spur; use serde::{Deserialize, Serialize}; use std::{fmt, sync::Arc}; // #[derive(Clone, PartialEq, Eq, Ord, PartialOrd, Hash)] // pub enum MaybeInternedString { // Interned(InternedString), // U...
code_fim
hard
{ "lang": "rust", "repo": "mattwparas/steel", "path": "/crates/steel-core/src/parser/interner.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>fn simulate(ops: &[Op]) -> (bool, i64) { let mut visited: HashSet<i64> = HashSet::new(); let mut ip: i64 = 0; let mut acc = 0; let terminated = loop { let op = &ops[usize::try_from(ip).unwrap()]; match op.variant { OpType::Acc => { acc += op.arg;...
code_fim
hard
{ "lang": "rust", "repo": "timotree3/aoc-2020", "path": "/day8-pt2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: timotree3/aoc-2020 path: /day8-pt2/src/main.rs use std::{collections::HashSet, convert::TryFrom, io::BufRead}; fn main() { let stdin = std::io::stdin(); let input = stdin.lock(); let mut ops: Vec<Op> = input.lines().map(|line| parse_op(&line.unwrap())).collect(); println!("answe...
code_fim
hard
{ "lang": "rust", "repo": "timotree3/aoc-2020", "path": "/day8-pt2/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut visited: HashSet<i64> = HashSet::new(); let mut ip: i64 = 0; let mut acc = 0; let terminated = loop { let op = &ops[usize::try_from(ip).unwrap()]; match op.variant { OpType::Acc => { acc += op.arg; ip += 1; } ...
code_fim
hard
{ "lang": "rust", "repo": "timotree3/aoc-2020", "path": "/day8-pt2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>criterion_group!(bench, send_recv_async); criterion_main!(bench);<|fim_prefix|>// repo: ssh352/FlashFunk path: /core/benches/async_channel.rs #[macro_use] extern crate criterion; use criterion::Criterion; <|fim_middle|>fn send_recv_async(c: &mut Criterion) { let (tx, rx) = flashfunk_core::util::ch...
code_fim
hard
{ "lang": "rust", "repo": "ssh352/FlashFunk", "path": "/core/benches/async_channel.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ssh352/FlashFunk path: /core/benches/async_channel.rs #[macro_use] extern crate criterion; use criterion::Criterion; <|fim_suffix|> let (tx, rx) = flashfunk_core::util::channel::channel::<u128>(1); c.bench_function("util::channel_async_send_recv_128", move |b| { b.iter(|| { ...
code_fim
medium
{ "lang": "rust", "repo": "ssh352/FlashFunk", "path": "/core/benches/async_channel.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Gin58/rust-projects path: /variables/src/main.rs fn main() { let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); <|fim_suffix|> println!("Hello, world"); another_function(5); } fn another_function(x: i32) { println!("The value of x is:...
code_fim
medium
{ "lang": "rust", "repo": "Gin58/rust-projects", "path": "/variables/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn another_function(x: i32) { println!("The value of x is: {}", x); }<|fim_prefix|>// repo: Gin58/rust-projects path: /variables/src/main.rs fn main() { let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); let y = 5; let y = y + 1; let y = y *...
code_fim
easy
{ "lang": "rust", "repo": "Gin58/rust-projects", "path": "/variables/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let list_pairwise_json = pairwise::list_pairwise(wallet_handle).unwrap(); let list_pairwise: Vec<String> = serde_json::from_str(&list_pairwise_json).unwrap(); assert_eq!(list_pairwise.len(), 1); assert!(list_pairwise.contains(&format!(r#"{{"my_did":"{}","th...
code_fim
hard
{ "lang": "rust", "repo": "nareshkatta99/indy-sdk", "path": "/libindy/tests/pairwise.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nareshkatta99/indy-sdk path: /libindy/tests/pairwise.rs #[macro_use] extern crate lazy_static; #[macro_use] extern crate named_type_derive; #[macro_use] extern crate derivative; #[macro_use] extern crate serde_derive; #[macro_use] extern crate serde_json; extern crate byteorder; extern crat...
code_fim
hard
{ "lang": "rust", "repo": "nareshkatta99/indy-sdk", "path": "/libindy/tests/pairwise.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pairwise::create_pairwise(wallet_handle, DID_TRUSTEE, &my_did, Some(METADATA)).unwrap(); let pairwise_info_json = pairwise::get_pairwise(wallet_handle, DID_TRUSTEE).unwrap(); assert_eq!(format!(r#"{{"my_did":"{}","metadata":"{}"}}"#, my_did, METADATA), pairwise_info_js...
code_fim
hard
{ "lang": "rust", "repo": "nareshkatta99/indy-sdk", "path": "/libindy/tests/pairwise.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lavifb/todo_r path: /src/bin/todor/main.rs // Binary for finding TODOs in specified files mod clap_app; mod global_config; mod logger; mod select; mod walk; use atty; use clap::ArgMatches; // use env_logger; use failure::{format_err, Error}; use ignore::overrides::OverrideBuilder; use log::*; ...
code_fim
hard
{ "lang": "rust", "repo": "lavifb/todo_r", "path": "/src/bin/todor/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let curr_dir = current_dir()?; let mut ignore_builder = OverrideBuilder::new(&curr_dir); if let Some(ignore_paths_iter) = matches.values_of("IGNORE") { for ignore_path in ignore_paths_iter { ignore_builder.add(&format!("!{}", ignore_path))?; } } let pred = ...
code_fim
hard
{ "lang": "rust", "repo": "lavifb/todo_r", "path": "/src/bin/todor/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reaandrew/ruster path: /src/app.rs use super::models; use super::executors; use super::factories; use super::finders; use super::errors::{RusterError}; use super::core::{Result}; pub trait App{ fn execute(&self) -> Result<models::ExecutionResult>; } pub struct DefaultApp<'a, TFinder:f...
code_fim
hard
{ "lang": "rust", "repo": "reaandrew/ruster", "path": "/src/app.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(test)] use super::*; #[test] fn test_default_app_returns_test_result(){ let mut mock_spec_finder = finders::MockSpecFinder::new(); &mock_spec_finder.expect_find() .times(1) .returning(| | { let expected: models::Spec = Default...
code_fim
hard
{ "lang": "rust", "repo": "reaandrew/ruster", "path": "/src/app.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/bonsaidb path: /bonsaidb/examples/server.rs //! Shows basic usage of a server. use std::{path::Path, time::Duration}; use bonsaidb::{ client::{url::Url, Client}, core::{ connection::{Connection, ServerConnection}, permissions::Permissions, schema::Collec...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/bonsaidb", "path": "/bonsaidb/examples/server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Wait for the clients to finish futures::future::join_all(tasks) .await .into_iter() .collect::<anyhow::Result<()>>()?; // Shut the server down gracefully (or forcefully after 5 seconds). server.shutdown(Some(Duration::from_secs(5))).await?; Ok(()) } async ...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/bonsaidb", "path": "/bonsaidb/examples/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bjornomy/rust-oop18 path: /src/lib/enums/table_type.rs use super::TableType; impl TableType { pub fn from_string(s: &str) -> TableType { matc<|fim_suffix|> "2PT" => TableType::TwoPointTable, _ => TableType::Unknown } } }<|fim_middle|>h s.to_uppercas...
code_fim
medium
{ "lang": "rust", "repo": "bjornomy/rust-oop18", "path": "/src/lib/enums/table_type.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "2PT" => TableType::TwoPointTable, _ => TableType::Unknown } } }<|fim_prefix|>// repo: bjornomy/rust-oop18 path: /src/lib/enums/table_type.rs use super::TableType; impl TableType { pub fn from_string(s: &str) -> TableType { matc<|fim_middle|>h s.to_uppercas...
code_fim
medium
{ "lang": "rust", "repo": "bjornomy/rust-oop18", "path": "/src/lib/enums/table_type.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: otake84/messagepack-rs path: /messagepack-rs/src/marker/into.rs use super::Marker; impl Into<u8> for Marker { fn into(self) -> u8 { match self { Self::PositiveFixInt(n) => n, Self::FixMap(n) => 0x80 | (n & 0x0f), Self::FixArray(n) => 0x90 | (n & 0...
code_fim
hard
{ "lang": "rust", "repo": "otake84/messagepack-rs", "path": "/messagepack-rs/src/marker/into.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>elf::FixExt8 => 0xd7, Self::FixExt16 => 0xd8, Self::Str8 => 0xd9, Self::Str16 => 0xda, Self::Str32 => 0xdb, Self::Array16 => 0xdc, Self::Array32 => 0xdd, Self::Map16 => 0xde, Self::Map32 => 0xdf, Se...
code_fim
hard
{ "lang": "rust", "repo": "otake84/messagepack-rs", "path": "/messagepack-rs/src/marker/into.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JoelScarfone/tarpaulin path: /src/ptrace_control.rs use std::ptr; use nix::sys::signal::Signal; use nix::sys::ptrace::{ptrace, ptrace_getevent, ptrace_setoptions}; use nix::sys::ptrace::ptrace::*; use nix::libc::{c_void, c_long}; use nix::unistd::Pid; use nix::Result; const RIP: u8 = 128; <|f...
code_fim
hard
{ "lang": "rust", "repo": "JoelScarfone/tarpaulin", "path": "/src/ptrace_control.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn read_address(pid: Pid, address:u64) -> Result<c_long> { ptrace(PTRACE_PEEKDATA, pid, address as * mut c_void, ptr::null_mut()) } pub fn write_to_address(pid: Pid, address: u64, data: i64) -> Result<c_long> { ptrace(PTRACE_POKEDATA, pid, addr...
code_fim
medium
{ "lang": "rust", "repo": "JoelScarfone/tarpaulin", "path": "/src/ptrace_control.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn request_trace() -> Result<c_long> { ptrace(PTRACE_TRACEME, Pid::from_raw(0), ptr::null_mut(), ptr::null_mut()) } pub fn get_event_data(pid: Pid) -> Result<c_long> { ptrace_getevent(pid) }<|fim_prefix|>// repo: JoelScarfone/tarpaulin path: /src/ptrace_control.rs use std::ptr; use nix::sys:...
code_fim
hard
{ "lang": "rust", "repo": "JoelScarfone/tarpaulin", "path": "/src/ptrace_control.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn verify_alphabet(&self) { self.transitions.each(|transition| { if let Some(token) = transition.input() { assert!(self.alphabet.contains(token), "transition input not contained by alphabet"); } }); } fn verify_deterministic(&self) { ...
code_fim
hard
{ "lang": "rust", "repo": "carllerche/automaton", "path": "/src/dfa.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Duplicates and returns the start state fn dup_start_state(&mut self) -> State { let dup = self.next_state_id(); // Commit the state self.states.insert(dup); // Duplicate the transitions self.transitions.dup_from(self.start, dup); // Make termin...
code_fim
hard
{ "lang": "rust", "repo": "carllerche/automaton", "path": "/src/dfa.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: carllerche/automaton path: /src/dfa.rs debug!(" transitions:"); self.transitions.each(|t| { debug!(" {:?}", t); }); debug!(""); // Prune dead states self.prune(); // Minimize the state machine self.minimize(); ...
code_fim
hard
{ "lang": "rust", "repo": "carllerche/automaton", "path": "/src/dfa.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /cargo-atcoder/contests/abc075/src/bin/b.rs use proconio::{input, marker::Chars}; fn main() { input! { h: usize, w: usize, s: [Chars; h], }; let mut count = vec![vec![0; w]; h]; for i in 0..h { for j in 0..w { ...
code_fim
hard
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc075/src/bin/b.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } } } for i in 0..h { for j in 0..w { if s[i][j] == '#' { print!("#"); } else { print!("{}", count[i][j]); } } println!(); } }<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /carg...
code_fim
hard
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc075/src/bin/b.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustkas/error-index path: /main_tests/tests/e0044.rs // #![allow(unused)] /* cargo test --test e0044 cargo test --test e0044 with_error -- --nocapture cargo test --test e0044 without_error1 -- --nocapture */ <|fim_suffix|>#[cfg(test)] mod tests { //TODO provide examples for this error ...
code_fim
easy
{ "lang": "rust", "repo": "rustkas/error-index", "path": "/main_tests/tests/e0044.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { //TODO provide examples for this error // extern { fn some_func<T>(x: T); } }<|fim_prefix|>// repo: rustkas/error-index path: /main_tests/tests/e0044.rs // #![allow(unused)] /* cargo test --test e0044 cargo test --test e0044 with_error -- --nocapture cargo test --test e...
code_fim
easy
{ "lang": "rust", "repo": "rustkas/error-index", "path": "/main_tests/tests/e0044.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match err { ClusterError::BasicError(err) => err, } } }<|fim_prefix|>// repo: magnesie/magnes-ie-orchestrateur path: /src/clusters/cluster_error.rs /// This enum represents every type of error that a cluster can throw pub enum ClusterError{ /// Basic error containing o...
code_fim
hard
{ "lang": "rust", "repo": "magnesie/magnes-ie-orchestrateur", "path": "/src/clusters/cluster_error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: magnesie/magnes-ie-orchestrateur path: /src/clusters/cluster_error.rs /// This enum represents every type of error that a cluster can throw pub enum ClusterError{ /// Basic error containing only a string BasicError(String), } impl From<&str> for ClusterError { fn from(error_message:...
code_fim
hard
{ "lang": "rust", "repo": "magnesie/magnes-ie-orchestrateur", "path": "/src/clusters/cluster_error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }