text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>use std::io::{BufRead, BufReader}; /// Reads a list of strings separated by an empty line. pub fn read_string_lists(path: &str) -> Vec<Vec<String>> { let file = File::open(path).expect("failed to open input file"); let mut ret = vec![]; let mut cur = vec![]; for line in BufReader::new(fi...
code_fim
medium
{ "lang": "rust", "repo": "keiichiw/advent-of-code-2020", "path": "/utils/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: keiichiw/advent-of-code-2020 path: /utils/src/lib.rs use std::fs; use std::fs::File; use std::str::FromStr; pub fn read_strings(path: &str) -> Vec<String> { let inp = fs::read_to_string(path).expect("failed to read input file"); inp.trim().split('\n').map(|x| x.to_string()).collect() } ...
code_fim
hard
{ "lang": "rust", "repo": "keiichiw/advent-of-code-2020", "path": "/utils/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl std::ops::Add for Pos { type Output = Self; fn add(self, other: Self) -> Self { Self { x: self.x + other.x, y: self.y + other.y, } } }<|fim_prefix|>// repo: keiichiw/advent-of-code-2020 path: /utils/src/lib.rs use std::fs; use std::fs::File; use s...
code_fim
medium
{ "lang": "rust", "repo": "keiichiw/advent-of-code-2020", "path": "/utils/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aplugeek/hoas path: /hoas-route/src/route.rs use hoas_conf::conf::Route; use std::collections::HashMap; <|fim_suffix|>impl RouteMap { pub fn from_conf(route: &Vec<Route>) -> Self { let mut route_map = HashMap::new(); route.iter().for_each(|r| { route_map.insert(r...
code_fim
easy
{ "lang": "rust", "repo": "aplugeek/hoas", "path": "/hoas-route/src/route.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl RouteMap { pub fn from_conf(route: &Vec<Route>) -> Self { let mut route_map = HashMap::new(); route.iter().for_each(|r| { route_map.insert(r.path.clone(), r.clone()); }); RouteMap(route_map) } }<|fim_prefix|>// repo: aplugeek/hoas path: /hoas-route...
code_fim
easy
{ "lang": "rust", "repo": "aplugeek/hoas", "path": "/hoas-route/src/route.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let min_binding_size = if buffer { quote! {None} } else { quote! {Some(<#field_ty as #render_path::render_resource::ShaderType>::min_size())} }; if buffer { ...
code_fim
hard
{ "lang": "rust", "repo": "bevyengine/bevy", "path": "/crates/bevy_render/macros/src/as_bind_group.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bevyengine/bevy path: /crates/bevy_render/macros/src/as_bind_group.rs uct_name #ty_generics #where_clause { type Data = #prepared_data; fn as_bind_group( &self, layout: &#render_path::render_resource::BindGroupLayout, render...
code_fim
hard
{ "lang": "rust", "repo": "bevyengine/bevy", "path": "/crates/bevy_render/macros/src/as_bind_group.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bevyengine/bevy path: /crates/bevy_render/macros/src/as_bind_group.rs rStages::all(), ty: #render_path::render_resource::BindingType::Buffer { ty: #render_path::render_resource::BufferBindingType::Uniform, has_dynami...
code_fim
hard
{ "lang": "rust", "repo": "bevyengine/bevy", "path": "/crates/bevy_render/macros/src/as_bind_group.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let ba = BitArray::new(1); ba.get(1); } #[test] fn test_set_and_get() { let mut ba = BitArray::new(1); assert!(!ba.get(0)); ba.set(0); assert!(ba.get(0)); ba.clear(0); assert!(!ba.get(0)); } }<|fim_prefix|>// repo: sw17ch/ba...
code_fim
hard
{ "lang": "rust", "repo": "sw17ch/baffles", "path": "/src/bit_array.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if state { self.backing[word_ix] |= set_mask; } else { self.backing[word_ix] &= !set_mask; } } #[allow(dead_code)] pub fn set(&mut self, bit: usize) { self.set_to(bit, true) } #[allow(dead_code)] pub fn clear(&mut self, bit:...
code_fim
hard
{ "lang": "rust", "repo": "sw17ch/baffles", "path": "/src/bit_array.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sw17ch/baffles path: /src/bit_array.rs use std; use std::fmt; type Word = u64; pub struct BitArray { bits: usize, backing: Vec<Word>, } impl fmt::Debug for BitArray { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "BitArray {{ bits: ")?; for w in ...
code_fim
hard
{ "lang": "rust", "repo": "sw17ch/baffles", "path": "/src/bit_array.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> schedule!(scheduler, context, { status_job, heart_beat_job, registration_job, node_watcher_job, processor_job, slot_count_adjuster_job, slot_reclaim_job, slot_recycle_job, discovery_job }); let death_reason = heart.death(...
code_fim
hard
{ "lang": "rust", "repo": "jpJuni0r/WebGrid", "path": "/core/src/services/orchestrator/core/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Number of concurrent sessions #[structopt(long, env)] pub slot_count: usize, /// Maximum duration to wait for a session start up; in seconds #[structopt(long, env, default_value = "300", parse(try_from_str = parse_seconds))] timeout_startup: Duration, } pub async fn start<P: ...
code_fim
hard
{ "lang": "rust", "repo": "jpJuni0r/WebGrid", "path": "/core/src/services/orchestrator/core/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jpJuni0r/WebGrid path: /core/src/services/orchestrator/core/mod.rs use std::time::Duration; use super::super::SharedOptions; use crate::libraries::{ helpers::parse_seconds, lifecycle::Heart, net::discovery::ServiceDiscovery, tracing::{self, constants::service}, }; use anyhow::Re...
code_fim
hard
{ "lang": "rust", "repo": "jpJuni0r/WebGrid", "path": "/core/src/services/orchestrator/core/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl FloatOrNothing { pub fn print(self) { match self { Nothing => println!("The number is: <nothing>"), Something(n) => println!("The number is: {}", n), }; } } pub trait Minimum : Copy { fn min(self, b: Self) -> Self; } impl Minimum for i32 { fn ...
code_fim
hard
{ "lang": "rust", "repo": "lasagnaphil/RustTutorial", "path": "/tut2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lasagnaphil/RustTutorial path: /tut2/src/main.rs pub enum SomethingOrNothing<T> { Something(T), Nothing, } pub use self::SomethingOrNothing::*; type NumberOrNothing = SomethingOrNothing<i32>; type FloatOrNothing = SomethingOrNothing<f32>; impl<T> SomethingOrNothing<T> { fn new(o:...
code_fim
hard
{ "lang": "rust", "repo": "lasagnaphil/RustTutorial", "path": "/tut2/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (start, end) = r.into_inner(); let s = self as $signed; if s < 0 || s > end { end } else if s < start { start } else { s ...
code_fim
hard
{ "lang": "rust", "repo": "s3bk/math_traits", "path": "/src/cast.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: s3bk/math_traits path: /src/cast.rs use std::ops::RangeInclusive; pub trait Cast<O>: Sized { /// Try to represent self as O. /// If possibe, return Some(Self as O) otherwhise None. fn cast(self) -> Option<O>; /// Try to represent self within the range r of O. /// If pos...
code_fim
hard
{ "lang": "rust", "repo": "s3bk/math_traits", "path": "/src/cast.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn read_addrs( &mut self, start_addr: <Self::Arch as Arch>::Usize, data: &mut [u8], ) -> Result<bool, Self::Error> { (**self).read_addrs(start_addr, data) } fn write_addrs( &mut...
code_fim
hard
{ "lang": "rust", "repo": "jamcleod/gdbstub", "path": "/src/target.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut found = false; self.list_active_threads(&mut |active_tid| { if tid == active_tid { found = true; } })?; Ok(found) } } /// The kind of watchpoint that should be set/removed. #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub...
code_fim
hard
{ "lang": "rust", "repo": "jamcleod/gdbstub", "path": "/src/target.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jamcleod/gdbstub path: /src/target.rs l Hardware /// /// On bare-metal targets (such as microcontrollers or emulators), it's common /// to treat individual _CPU cores_ as a separate "threads". e.g: in a dual-core /// system, [CPU0, CPU1] might be mapped to [TID1, TID2] (note that TIDs cannot ///...
code_fim
hard
{ "lang": "rust", "repo": "jamcleod/gdbstub", "path": "/src/target.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: justinsacbibit/dmg path: /src/mmu.rs // TODO: Remove allows #[allow(dead_code)] #[allow(unused_variables)] pub struct Mmu { in_bios: bool, bios: [u8; 256], rom: Vec<u8>, wram: [u8; 8192], eram: [u8; 8192], zram: [u8; 127], ie_: u8, if_: u8, } // TODO: Remove allows #...
code_fim
hard
{ "lang": "rust", "repo": "justinsacbibit/dmg", "path": "/src/mmu.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Zero page 0xF00 => if addr >= 0xFF80 { self.zram[(addr & 0x7F) as usize] } else { // TODO: I/O control handling 0x00 ...
code_fim
hard
{ "lang": "rust", "repo": "justinsacbibit/dmg", "path": "/src/mmu.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>use std::sync::{ Arc, RwLock }; pub trait Draw { type Context; fn draw<'c>(&self, context: &'c Self::Context); } pub struct DrawContext { pub canvas: CanvasElement, pub context: CanvasRenderingContext2d, pub game: Arc<RwLock<Game>> } impl Draw for DrawContext { type Context = (...
code_fim
medium
{ "lang": "rust", "repo": "lightdiscord/snake-wasm", "path": "/web/src/draw/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lightdiscord/snake-wasm path: /web/src/draw/mod.rs macro_rules! mod_use { ( $mod:ident::$use:ident ) => { mod $mod; use self::$mod::$use; } } use ::snake::Game; mod_use!(background::Background); mod_use!(clear::Clear); mod_use!(grid::Grid); mod_use!(snake::S...
code_fim
hard
{ "lang": "rust", "repo": "lightdiscord/snake-wasm", "path": "/web/src/draw/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zellij-org/zellij path: /zellij-utils/assets/prost/generated_plugin_api.rs pub mod api { pub mod action { include!("api.action.rs"); } pub mod command { include!("api.command.rs"); } pub mod event { include!("api.event.rs"); } pub mod file { ...
code_fim
hard
{ "lang": "rust", "repo": "zellij-org/zellij", "path": "/zellij-utils/assets/prost/generated_plugin_api.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>b mod plugin_permission { include!("api.plugin_permission.rs"); } pub mod resize { include!("api.resize.rs"); } pub mod style { include!("api.style.rs"); } }<|fim_prefix|>// repo: zellij-org/zellij path: /zellij-utils/assets/prost/generated_plugin_api.rs pub mo...
code_fim
hard
{ "lang": "rust", "repo": "zellij-org/zellij", "path": "/zellij-utils/assets/prost/generated_plugin_api.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: microsoft/Spartan path: /src/random.rs use super::scalar::Scalar; use super::transcript::ProofTranscript; use merlin::Transcript; use rand::rngs::OsRng; <|fim_suffix|>impl RandomTape { pub fn new(name: &'static [u8]) -> Self { let tape = { let mut csprng: OsRng = OsRng; let mu...
code_fim
medium
{ "lang": "rust", "repo": "microsoft/Spartan", "path": "/src/random.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn random_vector(&mut self, label: &'static [u8], len: usize) -> Vec<Scalar> { self.tape.challenge_vector(label, len) } }<|fim_prefix|>// repo: microsoft/Spartan path: /src/random.rs use super::scalar::Scalar; use super::transcript::ProofTranscript; use merlin::Transcript; use rand::rngs::OsR...
code_fim
medium
{ "lang": "rust", "repo": "microsoft/Spartan", "path": "/src/random.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn random_scalar(&mut self, label: &'static [u8]) -> Scalar { self.tape.challenge_scalar(label) } pub fn random_vector(&mut self, label: &'static [u8], len: usize) -> Vec<Scalar> { self.tape.challenge_vector(label, len) } }<|fim_prefix|>// repo: microsoft/Spartan path: /src/random.rs...
code_fim
hard
{ "lang": "rust", "repo": "microsoft/Spartan", "path": "/src/random.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Joe-Degs/rust path: /chapter2/control_flow/src/main.rs use std::time::{Instant, Duration}; fn main() { let mut count = 0; let time_limit = Duration::new(1,0); let start = Instant::now(); while (Instant::now() - start) < time_limit { count += 1; } println!("{}",...
code_fim
hard
{ "lang": "rust", "repo": "Joe-Degs/rust", "path": "/chapter2/control_flow/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let needle = 42; let haystack = [1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862]; for item in &haystack { let result = match item { 42 | 132 => "hit!", _ => "miss", }; if result == "hit!" { println!("{}, {}", item, result) } }...
code_fim
medium
{ "lang": "rust", "repo": "Joe-Degs/rust", "path": "/chapter2/control_flow/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hgzimmerman/BucketQuestions path: /yew_frontend/src/requests/mod.rs use yewtil::fetch::{FetchRequest, MethodBody}; use serde::{Serialize, Deserialize}; use wire::user::BEARER; use wire::bucket::{Bucket, NewBucketRequest}; <|fim_suffix|>pub fn plain_jwt_header() -> Vec<(String, String)> { ...
code_fim
medium
{ "lang": "rust", "repo": "hgzimmerman/BucketQuestions", "path": "/yew_frontend/src/requests/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>const URL_BASE: &str = "http://0.0.0.0:8080/api/"; fn create_url(path: &str) -> String { [URL_BASE, path].into_iter().cloned().collect() } // TODO this should be compiled later. pub fn cors() -> bool { true } pub mod auth_and_user; pub mod bucket; pub mod question; pub mod answer;<|fim_prefi...
code_fim
hard
{ "lang": "rust", "repo": "hgzimmerman/BucketQuestions", "path": "/yew_frontend/src/requests/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> //Emulate one cycle self.cpu.step(); self.cpu.decrease_timers(); } } pub fn step(&mut self) -> CpuState { self.cpu.step() //TODO: //draw flag //input keys } pub fn decrease_...
code_fim
hard
{ "lang": "rust", "repo": "JorinTielen/maki8", "path": "/src/chip8.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JorinTielen/maki8 path: /src/chip8.rs use std; use std::fs::File; use std::io::prelude::*; use cpu::Cpu; use cpu::CpuState; pub struct Chip8 { cpu: Cpu } impl Chip8 { pub fn new() -> Chip8 { //Constructor of Chip8 Chip8 { cpu: Cpu::new(), ...
code_fim
medium
{ "lang": "rust", "repo": "JorinTielen/maki8", "path": "/src/chip8.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //TODO: //draw flag //input keys } pub fn decrease_timers(&mut self) { self.cpu.decrease_timers(); } pub fn reset_keys(&mut self) { self.cpu.reset_keys(); } }<|fim_prefix|>// repo: JorinTielen/maki8 path: /src/chip8.rs use std; us...
code_fim
hard
{ "lang": "rust", "repo": "JorinTielen/maki8", "path": "/src/chip8.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: korken89/all_variants path: /src/lib.rs pub use every_variant::*; /// Trait that supplies a function to generate a vector containing all possible variants in a tree pub trait EveryVariant: Sized { /// A vector of variants that should contain every possible variant of the struct or enum ...
code_fim
hard
{ "lang": "rust", "repo": "korken89/all_variants", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[derive(EveryVariant, Debug, Clone)] pub struct TestUnnamed3(pub u16); #[test] fn messages_number() { let msgs = Message::every_variant().len(); assert_eq!(40, msgs); } #[test] fn opts_number() { let msgs = Option::<u64>::every_variant().len(); ...
code_fim
hard
{ "lang": "rust", "repo": "korken89/all_variants", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>let spaces = ""; let spaces = spaces.len(); 이와 같은 구조가 허용되는 이유는 척 spaces 변수가 문자열 유형이고 두 번째 spaces 변수는 첫 번째 것과 동일한 이름을 가진 새롭게 정의된 숫자 유형의 변수이기 때문입니다. Shadowing은 spaces_str이나 space_num 과 같이 대체된 이름을 사용하는 대신 간단히 spaces 이름을 사용할 수 있게 해줍니다. 그러나 우리가 mut을 사용하려고 했다면 let mut spaces = " "; spaces = spaces.len(); 우리는...
code_fim
hard
{ "lang": "rust", "repo": "nebula201030/study_rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>이와 같은 구조가 허용되는 이유는 척 spaces 변수가 문자열 유형이고 두 번째 spaces 변수는 첫 번째 것과 동일한 이름을 가진 새롭게 정의된 숫자 유형의 변수이기 때문입니다. Shadowing은 spaces_str이나 space_num 과 같이 대체된 이름을 사용하는 대신 간단히 spaces 이름을 사용할 수 있게 해줍니다. 그러나 우리가 mut을 사용하려고 했다면 let mut spaces = " "; spaces = spaces.len(); 우리는 다음처럼 변수의 유형을 변경할 수 없다는 컴파일 시의 에러를 얻게 되겁니다. e...
code_fim
hard
{ "lang": "rust", "repo": "nebula201030/study_rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nebula201030/study_rust path: /src/main.rs /* 변수와 가변성 Rust의 기본 변수는 불변성 입니다. 이것은 Rust가 제공하는 안전성과 손시운 동시성이라는 장점을 취할 수 있도록 코드를 작성하게끔 강제하는 요소중 하나입니다. 하지만 우리는 아직도 가변 변수를 사용하고 싶어합니다. 하지만 어떻게 그리고 왜 Rust에서 불변성을 애호해주길 권장하는지 알아버면 그런 생각을 포기할 수 있을지도 모르겠습니다. 변수가 불변성인 경우, 일단 값이 이름에 bound 되면 해당 값을 변경 할 수 ...
code_fim
hard
{ "lang": "rust", "repo": "nebula201030/study_rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/lib/mapped-vmo/src/lib.rs // Copyright 2018 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. //! A convenience crate for Zircon VMO objects mapped into memory. #![deny(m...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/mapped-vmo/src/lib.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_mapping_read_write() { let size = PAGE_SIZE; let (mapping, vmo) = Mapping::allocate(size).unwrap(); let mut buf = [0; 128]; // We can write to the Vmo, and see the results in the mapping. let s = b"Hello world"; vmo.write(s, 0).unwr...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/mapped-vmo/src/lib.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let size = PAGE_SIZE; let (mapping, vmo) = Mapping::allocate(size).unwrap(); let mut buf = [0; 128]; // We can write to the Vmo, and see the results in the mapping. let s = b"Hello world"; vmo.write(s, 0).unwrap(); let slice = &mut buf[0..s.len()];...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/mapped-vmo/src/lib.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let fs = 44100; let bits = 16; let length = fs * 2; let sound_data = Vec::with_capacity(length as usize * 1); let mut pcm: MonoPcm = MonoPcm { fs, bits, length, sound_data, ..Default::default() }; // sine wave let a = 0.1; // amplit...
code_fim
medium
{ "lang": "rust", "repo": "emergent/rust-sound-programming", "path": "/src/bin/ex2_2_fade.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emergent/rust-sound-programming path: /src/bin/ex2_2_fade.rs extern crate gnuplot; extern crate sound_lib; use gnuplot::{Caption, Color, Figure}; use sound_lib::MonoPcm; use std::f64::consts::PI; fn plot(data: &Vec<f64>, filename: &str, caption: &str) { let x = (0..data.len() as u32).collec...
code_fim
medium
{ "lang": "rust", "repo": "emergent/rust-sound-programming", "path": "/src/bin/ex2_2_fade.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: echallenge/tendermint-rs path: /testgen/src/light_block.rs use simple_error::*; use tendermint_light_client::types::{LightBlock, PeerId, SignedHeader, ValidatorSet}; use crate::validator::generate_validator_set; use crate::{Commit, Generator, Header}; use tendermint::validator::Info; pub fn ge...
code_fim
hard
{ "lang": "rust", "repo": "echallenge/tendermint-rs", "path": "/testgen/src/light_block.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>pub fn generate_signed_header( raw_header: Header, raw_commit: Commit, ) -> Result<SignedHeader, SimpleError> { let header = match raw_header.generate() { Err(e) => bail!("Failed to generate header with error: {}", e), Ok(h) => h, }; let commit = match raw_commit.gener...
code_fim
medium
{ "lang": "rust", "repo": "echallenge/tendermint-rs", "path": "/testgen/src/light_block.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /cargo-atcoder/contests/abc277/src/bin/c.rs use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque}; use proconio::{input, marker::Usize1}; fn main() { input! { n: usize, ab: [(Usize1, Usize1); n], }; let map = ab .i...
code_fim
medium
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc277/src/bin/c.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut max = 0_usize; let mut used = HashSet::new(); let mut deque = VecDeque::new(); used.insert(0); deque.push_back(0); while let Some(u) = deque.pop_front() { for v in edges[u].iter().copied() { if !used.insert(v) { continue; } ...
code_fim
medium
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc277/src/bin/c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jeschkies/azure-sdk-for-rust path: /sdk/core/src/prelude.rs pub use crate::ba512_range::BA512Range; pub use crate::modify_conditions::{IfMatchCondition, IfSinceCondition, SequenceNumberCondition}; pub use crate::range::Range; pub use crate::{ AccessTier, AccessTierOption, AccessTierSupport, ...
code_fim
hard
{ "lang": "rust", "repo": "jeschkies/azure-sdk-for-rust", "path": "/sdk/core/src/prelude.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Support, NextMarkerOption, NextMarkerSupport, PageBlobLengthRequired, PageBlobLengthSupport, PrefixOption, PrefixSupport, ProposedLeaseIdOption, ProposedLeaseIdRequired, ProposedLeaseIdSupport, RangeOption, RangeRequired, RangeSupport, SequenceNumberConditionOption, SequenceNumberConditionSupp...
code_fim
hard
{ "lang": "rust", "repo": "jeschkies/azure-sdk-for-rust", "path": "/sdk/core/src/prelude.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>("cargo:rustc-env=WOLFFIA_INIT_PATH={}", path); }<|fim_prefix|>// repo: Restioson/wolffia path: /kernel/build.rs use std::env; fn main() { let profile = env::var("PROFILE").unwrap(); let path = format!(<|fim_middle|>"../../build/{}/init.elf", profile); println!
code_fim
easy
{ "lang": "rust", "repo": "Restioson/wolffia", "path": "/kernel/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Restioson/wolffia path: /kernel/build.rs use std::env; fn main() { let profile = env:<|fim_suffix|>("cargo:rustc-env=WOLFFIA_INIT_PATH={}", path); }<|fim_middle|>:var("PROFILE").unwrap(); let path = format!("../../build/{}/init.elf", profile); println!
code_fim
medium
{ "lang": "rust", "repo": "Restioson/wolffia", "path": "/kernel/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bheisler/criterion.rs path: /src/analysis/compare.rs use crate::stats::univariate::Sample; use crate::stats::univariate::{self, mixed}; use crate::stats::Distribution; use crate::benchmark::BenchmarkConfig; use crate::error::Result; use crate::estimate::{ build_change_estimates, ChangeDistr...
code_fim
hard
{ "lang": "rust", "repo": "bheisler/criterion.rs", "path": "/src/analysis/compare.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (mean, median) = stats(avg_times, base_avg_times); let points = ChangePointEstimates { mean, median }; let estimates = build_change_estimates(&distributions, &points, cl); { log_if_err!({ let mut estimates_path = criterion.output_directory.clone(); est...
code_fim
hard
{ "lang": "rust", "repo": "bheisler/criterion.rs", "path": "/src/analysis/compare.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> avg_times: &Sample<f64>, base_avg_times: &Sample<f64>, config: &BenchmarkConfig, ) -> (f64, Distribution<f64>) { let nresamples = config.nresamples; let t_statistic = avg_times.t(base_avg_times); let t_distribution = elapsed!( "Bootstrapping the T distribution", mi...
code_fim
hard
{ "lang": "rust", "repo": "bheisler/criterion.rs", "path": "/src/analysis/compare.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bytecodealliance/wasmtime path: /crates/wasmtime/src/coredump.rs use std::fmt; use crate::{store::StoreOpaque, FrameInfo, Global, Instance, Memory, Module, WasmBacktrace}; /// Representation of a core dump of a WebAssembly module /// /// When the Config::coredump_on_trap option is enabled this...
code_fim
hard
{ "lang": "rust", "repo": "bytecodealliance/wasmtime", "path": "/crates/wasmtime/src/coredump.rs", "mode": "psm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|> writeln!(f, "globals:")?; for global in self.store_globals.iter() { writeln!(f, " {:?}", global)?; } writeln!(f, "backtrace:")?; write!(f, "{}", self.backtrace)?; Ok(()) } } impl fmt::Debug for WasmCoreDump { fn fmt(&self, f: &mut fmt...
code_fim
hard
{ "lang": "rust", "repo": "bytecodealliance/wasmtime", "path": "/crates/wasmtime/src/coredump.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|> writeln!(f, "memories:")?; for memory in self.store_memories.iter() { writeln!(f, " {:?}", memory)?; } writeln!(f, "globals:")?; for global in self.store_globals.iter() { writeln!(f, " {:?}", global)?; } writeln!(f, "backt...
code_fim
hard
{ "lang": "rust", "repo": "bytecodealliance/wasmtime", "path": "/crates/wasmtime/src/coredump.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hisham24/image_labeler path: /src/routes/upload.rs use actix_web::{web, error, Error, HttpResponse}; use sqlx::PgPool; use chrono::Utc; use uuid::Uuid; use std::io::Write; use actix_multipart::Multipart; use futures::{TryStreamExt, StreamExt}; use std::path::Path; use crate::data::Metadata; pub...
code_fim
hard
{ "lang": "rust", "repo": "hisham24/image_labeler", "path": "/src/routes/upload.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let value = match value { Some(value) => value, None => return Err(error::ErrorBadRequest(String::from("Metadata not received"))), }; sqlx::query!( r#" INSERT INTO images (id, username, image_folder, image, upload_at) VALUES ($1, $2, $3, $4, $5) ...
code_fim
hard
{ "lang": "rust", "repo": "hisham24/image_labeler", "path": "/src/routes/upload.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shenshing/KoompiPlay path: /duration/src/main.rs use std::time::{SystemTime}; use std::time::UNIX_EPOCH; extern crate chrono; use chrono::{DateTime, Utc}; use chrono::Duration; fn main() { /* let time = std::time::SystemTime::now().duration_since(UNIX_EPOCH).expect("error"); // let time...
code_fim
hard
{ "lang": "rust", "repo": "shenshing/KoompiPlay", "path": "/duration/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let date: DateTime<Utc> = Utc::now(); println!("{:?}", date); let old_time = date; let duration = Duration::days(1i64); // let new_time = date.checked_add_signed(old_time); let new_time = date.checked_add_signed(duration); println!("{:?}", new_time.unwrap()); }<|fim_prefix|>/...
code_fim
hard
{ "lang": "rust", "repo": "shenshing/KoompiPlay", "path": "/duration/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // let time = Utc.timestamp_millis(1431648000).timestamp(); // println!("{:?}", time); //work withd DateTime<Utc> //oldDuration is the time that we issue and duration can be 1day, 1h, or whatever let date: DateTime<Utc> = Utc::now(); println!("{:?}", date); let old_time = date; ...
code_fim
hard
{ "lang": "rust", "repo": "shenshing/KoompiPlay", "path": "/duration/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: drodil/op-api-rust-sdk path: /src/model/accounts.rs //! Models required for //! [AccountsV3](https://op-developer.fi/docs/api/3Oo5zCujXGw2SGEi00skug/OP%20Accounts%20V3.0%20API) //! API use chrono::{DateTime, Utc}; use serde::{Deserialize, Serialize}; /// Link inside the results of Accounts API...
code_fim
hard
{ "lang": "rust", "repo": "drodil/op-api-rust-sdk", "path": "/src/model/accounts.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Sets pageSize parameter. pub fn with_page_size(mut self, page_size: u32) -> Self { self.page_size = Some(page_size); self } /// Sets forwardPagingToken parameter. pub fn with_forward_paging_token(mut self, token: String) -> Self { self.forward_paging_token ...
code_fim
hard
{ "lang": "rust", "repo": "drodil/op-api-rust-sdk", "path": "/src/model/accounts.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(mut next) = self.index.clone() { for i in 0..next.len() { next[i] += 1; if next[i] == self.field[i].1.len() { next[i] = 0; } else { return Some(next); } } ...
code_fim
hard
{ "lang": "rust", "repo": "xurtis/yumclone", "path": "/src/urlmux.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(ref val) = self.map.get(&caps["tag"]) { dst.push_str(val); } else { // Push the string if not found. dst.push_str(&caps[0]); } } } /// Create a regex that finds the tags in a given URL. fn tag_finder() -> Regex { Regex::new(r...
code_fim
hard
{ "lang": "rust", "repo": "xurtis/yumclone", "path": "/src/urlmux.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xurtis/yumclone path: /src/urlmux.rs //! Creates URLs based on a combination of patterns from a set of inputs. use regex::{Captures, Regex, Replacer}; use std::collections::HashMap; use std::convert::{From, Into}; /// A Generator of URL pairs for a given set of tags. pub struct UrlMux<'a, 'b, ...
code_fim
hard
{ "lang": "rust", "repo": "xurtis/yumclone", "path": "/src/urlmux.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let input = r#"title = 'Test Post Please Ignore' subtitle = 'for real, ignore it this time' tags = ['what', 'are', 'you', 'doing'] date = 2020-05-16 21:38:05+00:00 ::===:: This is a post!"#; let post = Post::read_from(input.as_bytes())?; assert_eq!( post.frontmatter().t...
code_fim
hard
{ "lang": "rust", "repo": "c-x-berger/blagger", "path": "/src/post.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: c-x-berger/blagger path: /src/post.rs use std::{io, io::Read}; use serde::{Deserialize, Serialize}; use toml::value::Datetime; const MATTER_SPLITTER: &'static str = "::===::\n"; #[derive(Serialize, Deserialize, Debug)] pub struct FrontMatter { title: String, tags: Vec<String>, sub...
code_fim
hard
{ "lang": "rust", "repo": "c-x-berger/blagger", "path": "/src/post.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn from_valid_content() -> io::Result<()> { let input = r#"title = 'Test Post Please Ignore' subtitle = 'for real, ignore it this time' tags = ['what', 'are', 'you', 'doing'] date = 2020-05-16 21:38:05+00:00 ::===:: This is a post!"#; ...
code_fim
hard
{ "lang": "rust", "repo": "c-x-berger/blagger", "path": "/src/post.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns the stroke region on the left side. /// /// If the scanline contains no fill region the entire scanline will be returned. pub const fn stroke_left(&self) -> Scanline { Scanline::new(self.y, self.stroke_range.start..self.fill_range.start) } /// Returns the strok...
code_fim
medium
{ "lang": "rust", "repo": "embedded-graphics/embedded-graphics", "path": "/src/primitives/common/styled_scanline.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: embedded-graphics/embedded-graphics path: /src/primitives/common/styled_scanline.rs use core::ops::Range; use crate::{draw_target::DrawTarget, primitives::common::Scanline}; /// Scanline with stroke and fill regions. #[derive(Clone, Eq, PartialEq, Hash, Debug)] #[cfg_attr(feature = "defmt", de...
code_fim
hard
{ "lang": "rust", "repo": "embedded-graphics/embedded-graphics", "path": "/src/primitives/common/styled_scanline.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut dest = current - 1; loop { if dest < min { dest = max; } if !(dest == a || dest == b || dest == c || dest == current) { return dest; } dest -= 1; } } #[cfg(test)] mod tests { use super::*; #[test] fn test_exa...
code_fim
hard
{ "lang": "rust", "repo": "robinst/advent-of-code-2020", "path": "/src/bin/day23.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: robinst/advent-of-code-2020 path: /src/bin/day23.rs //! https://adventofcode.com/2020/day/23 use intrusive_collections::{intrusive_adapter, LinkedList, LinkedListLink}; use itertools::Itertools; fn main() { println!("One: {}", solve("368195742")); println!("Two: {}", solve2("368195742"...
code_fim
hard
{ "lang": "rust", "repo": "robinst/advent-of-code-2020", "path": "/src/bin/day23.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> { let mut file = BufWriter::new(File::create(&path)?); // Write PRG load address (hard coded) if i % 2 == 0 { file.write_all(&[0x00, 0x10])?; } else { file.write_all(&[0x00, 0x50])?; } for com...
code_fim
hard
{ "lang": "rust", "repo": "chiptunecafe/deflestream64", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chiptunecafe/deflestream64 path: /src/main.rs use std::{ ffi::CString, fs::File, io::{BufWriter, Read, Write}, path::PathBuf, }; use anyhow::Result; use argh::FromArgs; use byteorder::{ByteOrder, LittleEndian}; extern "C" { fn lz_main(argc: i32, argv: *const *const i8) -> i...
code_fim
hard
{ "lang": "rust", "repo": "chiptunecafe/deflestream64", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn asset_filter(asset: &Asset) -> bool { let name = format!("gitleaks-{}-{}{}", os(), arch(), EXE_SUFFIX); asset.name == name } fn sync() -> task::Result { GHR_TASK.sync() } fn trim_version(stdout: String) -> String { String::from(stdout.trim()) } fn update(sync: Status) -> task::Result...
code_fim
hard
{ "lang": "rust", "repo": "jokeyrhyme/dotfiles-rs", "path": "/src/tasks/gitleaks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jokeyrhyme/dotfiles-rs path: /src/tasks/gitleaks.rs use std::env::consts::EXE_SUFFIX; use crate::{ lib::{ ghrtask::GHRTask, task::{self, Status, Task}, }, utils::{ github::Asset, golang::{arch, os}, }, }; <|fim_suffix|> GHR_TASK.sync() } fn t...
code_fim
hard
{ "lang": "rust", "repo": "jokeyrhyme/dotfiles-rs", "path": "/src/tasks/gitleaks.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>const GHR_TASK: GHRTask = GHRTask { asset_filter, command: "gitleaks", repo: ("zricethezav", "gitleaks"), trim_version, version_arg: "--version", }; fn asset_filter(asset: &Asset) -> bool { let name = format!("gitleaks-{}-{}{}", os(), arch(), EXE_SUFFIX); asset.name == name } ...
code_fim
medium
{ "lang": "rust", "repo": "jokeyrhyme/dotfiles-rs", "path": "/src/tasks/gitleaks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rhavill/rust-programming-language path: /18_patterns_and_matching/places_to_use_patterns/src/main.rs fn main() { if_let_expressions(); while_loop(); for_loop(); let_statement(); function_parameters(); } /* The line if let Ok(age) = age introduces a new shadowed age variable ...
code_fim
hard
{ "lang": "rust", "repo": "rhavill/rust-programming-language", "path": "/18_patterns_and_matching/places_to_use_patterns/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn let_statement() { let (x, y, z) = (1, 2, 3); println!("let_statemnt: x={}, y={}, z={}.", x, y, z); } fn print_coordinates(&(x, y): &(i32, i32)) { println!("Current location from function_parameters/print_coordinates: ({}, {})", x, y); } fn function_parameters() { let point = (3, 5); ...
code_fim
hard
{ "lang": "rust", "repo": "rhavill/rust-programming-language", "path": "/18_patterns_and_matching/places_to_use_patterns/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while let Some(top) = stack.pop() { println!("while_loop: {}", top); } } fn for_loop() { let v = vec!['a', 'b', 'c']; for (index, value) in v.iter().enumerate() { println!("for_looop: {} is at index {}", value, index); } } fn let_statement() { let (x, y, ...
code_fim
medium
{ "lang": "rust", "repo": "rhavill/rust-programming-language", "path": "/18_patterns_and_matching/places_to_use_patterns/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> loop { match decoder.next_frame() { Ok(Frame { data, sample_rate, channels, .. }) => println!("Decoded {} samples", data.len() / channels), Err(Error::Eof) => break, Err(e) => panic!...
code_fim
hard
{ "lang": "rust", "repo": "germangb/minimp3-rs", "path": "/examples/example.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: germangb/minimp3-rs path: /examples/example.rs use minimp3::{Decoder, Error, Frame}; use std::fs::File; <|fim_suffix|> loop { match decoder.next_frame() { Ok(Frame { data, sample_rate, channels, .. ...
code_fim
hard
{ "lang": "rust", "repo": "germangb/minimp3-rs", "path": "/examples/example.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gmlove/experiments path: /rust/threaded_webserver/web_server/src/bin/main.rs use web_server; use std::thread; <|fim_suffix|> println!("thread id: {:?}", thread::current().id()); let mut server = web_server::WebServer::new(28080); server.start(); server.join().unwrap(); }<|fim_mid...
code_fim
easy
{ "lang": "rust", "repo": "gmlove/experiments", "path": "/rust/threaded_webserver/web_server/src/bin/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("thread id: {:?}", thread::current().id()); let mut server = web_server::WebServer::new(28080); server.start(); server.join().unwrap(); }<|fim_prefix|>// repo: gmlove/experiments path: /rust/threaded_webserver/web_server/src/bin/main.rs use web_server; use std::thread; <|fim_mid...
code_fim
easy
{ "lang": "rust", "repo": "gmlove/experiments", "path": "/rust/threaded_webserver/web_server/src/bin/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // So we have registered our interest in readable events for stdin, now // we need to get them. We want to poll for these events: let poll_result = poll.poll(&mut events, None); for event in &events { println!("event.token: {:?}", event.token()); } }<|fim_prefix|>// repo: danbe...
code_fim
medium
{ "lang": "rust", "repo": "danbev/learning-rust", "path": "/mio-example/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danbev/learning-rust path: /mio-example/src/main.rs //! MIO Example crate use mio::{Poll, Token, Interest, event::Source, Events}; use mio::unix::SourceFd; use std::os::unix::io::{AsRawFd, RawFd}; use std::io::{Read, BufRead}; <|fim_suffix|> let mut poll = match Poll::new() { Ok(pol...
code_fim
medium
{ "lang": "rust", "repo": "danbev/learning-rust", "path": "/mio-example/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[pin_project] #[repr(packed)] //~ ERROR E0517 enum E2 { V(()), } #[repr(packed)] //~ ERROR E0517 #[pin_project] enum E3 { V(()), } fn main() {}<|fim_prefix|>// repo: oshunter/fuchsia path: /third_party/rust_crates/vendor/pin-project/tests/ui/pin_project/packed-enum.rs use pin_project::pin_proj...
code_fim
easy
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/third_party/rust_crates/vendor/pin-project/tests/ui/pin_project/packed-enum.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(packed)] //~ ERROR E0517 #[pin_project] enum E3 { V(()), } fn main() {}<|fim_prefix|>// repo: oshunter/fuchsia path: /third_party/rust_crates/vendor/pin-project/tests/ui/pin_project/packed-enum.rs use pin_project::pin_project; #[repr(packed)] //~ ERROR E0517 enum E1 { V(()), } <|fim_mid...
code_fim
medium
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/third_party/rust_crates/vendor/pin-project/tests/ui/pin_project/packed-enum.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oshunter/fuchsia path: /third_party/rust_crates/vendor/pin-project/tests/ui/pin_project/packed-enum.rs use pin_project::pin_project; #[repr(packed)] //~ ERROR E0517 enum E1 { V(()), } <|fim_suffix|>#[repr(packed)] //~ ERROR E0517 #[pin_project] enum E3 { V(()), } fn main() {}<|fim_mid...
code_fim
medium
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/third_party/rust_crates/vendor/pin-project/tests/ui/pin_project/packed-enum.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod app; mod entry; mod filter; mod input_mapper; mod kafka_input_mapper; mod output_mapper; mod writer; mod buffer_gen { include!(concat!(env!("OUT_DIR"), "/buffer_gen/mod.rs")); } fn main() { // rlink::core::env::execute(app::KafkaGenAppStream::new()); // rlink::core::env::execute(app::Kaf...
code_fim
medium
{ "lang": "rust", "repo": "curtiseng/rlink-rs", "path": "/example/example-kafka/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // rlink::core::env::execute(app::KafkaGenAppStream::new()); // rlink::core::env::execute(app::KafkaOffsetRangeAppStream::new()); rlink::core::env::execute(app::KafkaReplayAppStream::new()); }<|fim_prefix|>// repo: curtiseng/rlink-rs path: /example/example-kafka/src/main.rs #[macro_use] exter...
code_fim
medium
{ "lang": "rust", "repo": "curtiseng/rlink-rs", "path": "/example/example-kafka/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: curtiseng/rlink-rs path: /example/example-kafka/src/main.rs #[macro_use] extern crate rlink_derive; #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; extern crate anyhow; mod app; mod entry; mod filter; mod input_mapper; mod kafka_input_mapper; mod output_mapper; mod write...
code_fim
medium
{ "lang": "rust", "repo": "curtiseng/rlink-rs", "path": "/example/example-kafka/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: moonheart08/emutk path: /emutk-z80/src/cpu/regfile.rs use emutk_core::{ ByteRepr, split::*, }; pub struct Z80Registers { pc: u16, af: u16, bc: u16, de: u16, hl: u16, sp: u16, ix: u16, iy: u16, i: u8, r: u8, af_bk: u16, bc_bk: u16, d...
code_fim
hard
{ "lang": "rust", "repo": "moonheart08/emutk", "path": "/emutk-z80/src/cpu/regfile.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] pub fn set_pc(&mut self, val: u16) { self.pc = val; } flag_funcs!(get_f, set_f ; flag_c, set_flag_c, 0x01 ; flag_n, set_flag_n, 0x02 ; flag_v, set_flag_v, 0x04 ; flag_f3, set_flag_f3, 0x08 ; flag_h, set_flag_h, 0x10 ; flag_...
code_fim
hard
{ "lang": "rust", "repo": "moonheart08/emutk", "path": "/emutk-z80/src/cpu/regfile.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }