text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: sebglazebrook/infinite-pipe path: /src/lib.rs #![feature(plugin, custom_derive)] #![plugin(mockers_macros)] #![cfg_attr(test, plugin(stainless))] <|fim_suffix|>mod pipe; pub use pipe::AppFactory;<|fim_middle|>#[cfg(test)] extern crate mockers; extern crate rl_sys;
code_fim
easy
{ "lang": "rust", "repo": "sebglazebrook/infinite-pipe", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub use pipe::AppFactory;<|fim_prefix|>// repo: sebglazebrook/infinite-pipe path: /src/lib.rs #![feature(plugin, custom_derive)] #![plugin(mockers_macros)] #![cfg_attr(test, plugin(stainless))] <|fim_middle|>#[cfg(test)] extern crate mockers; extern crate rl_sys; mod pipe;
code_fim
medium
{ "lang": "rust", "repo": "sebglazebrook/infinite-pipe", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(::std::mem::size_of::<sfGlslIvec3>() , 12usize , concat ! ( "Size of: " , stringify ! ( sfGlslIvec3 ) )); assert_eq! (::std::mem::align_of::<sfGlslIvec3>() , 4usize , concat ! ( "Alignment of " , stringify ! ( sfGlslIvec3 ) )); assert_eq! (unsafe { ...
code_fim
hard
{ "lang": "rust", "repo": "Forty-Bot/rust-sfml", "path": "/ffi/csfml-graphics-sys/src/lib.rs", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|>_getInverseTransform(text: *const sfText) -> sfTransform; } extern "C" { pub fn sfText_setString(text: *mut sfText, string: *const ::std::os::raw::c_char); } extern "C" { pub fn sfText_setUnicodeString(text: *mut sfText, string: *const...
code_fim
hard
{ "lang": "rust", "repo": "Forty-Bot/rust-sfml", "path": "/ffi/csfml-graphics-sys/src/lib.rs", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Forty-Bot/rust-sfml path: /ffi/csfml-graphics-sys/src/lib.rs { pub fn sfTransform_rotateWithCenter(transform: *mut sfTransform, angle: f32, centerX: f32, centerY: f32); } extern "C" { pub fn sfTransform_scal...
code_fim
hard
{ "lang": "rust", "repo": "Forty-Bot/rust-sfml", "path": "/ffi/csfml-graphics-sys/src/lib.rs", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neonmoe/fae path: /examples/sdl.rs #![windows_subsystem = "windows"] mod common; use fae::{Alignment, Context, Font, GraphicsContext}; use sdl2::event::{Event, WindowEvent}; fn main() { let sdl = sdl2::init().unwrap(); let sdl_video = sdl.video().unwrap(); let window = sdl_video ...
code_fim
hard
{ "lang": "rust", "repo": "neonmoe/fae", "path": "/examples/sdl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let fps_text = format!("FPS: {}", fps_counter.get_fps()); font.draw(&mut ctx, &fps_text, width - 110.0, 10.0, 16.0) .alignment(Alignment::Right) .max_width(100.0) .color((0.0, 0.5, 0.1, 1.0)) .clip_area((0.0, 0.0, width, height)) ...
code_fim
hard
{ "lang": "rust", "repo": "neonmoe/fae", "path": "/examples/sdl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rintln!("cargo:rerun-if-changed=codegen/master_ops_list.csv"); codegen::parse().unwrap(); }<|fim_prefix|>// repo: jblebrun/wrausmt path: /build.rs fn main() { println!("cargo:rerun-if-change<|fim_middle|>d=codegen/master_secondary_ops_list.csv"); p
code_fim
easy
{ "lang": "rust", "repo": "jblebrun/wrausmt", "path": "/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jblebrun/wrausmt path: /build.rs fn main() { println!("cargo:rerun-if-change<|fim_suffix|>rintln!("cargo:rerun-if-changed=codegen/master_ops_list.csv"); codegen::parse().unwrap(); }<|fim_middle|>d=codegen/master_secondary_ops_list.csv"); p
code_fim
easy
{ "lang": "rust", "repo": "jblebrun/wrausmt", "path": "/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ops_list.csv"); codegen::parse().unwrap(); }<|fim_prefix|>// repo: jblebrun/wrausmt path: /build.rs fn main() { println!("cargo:rerun-if-changed=codegen/master_secondary_ops_list.csv"); p<|fim_middle|>rintln!("cargo:rerun-if-changed=codegen/master_
code_fim
easy
{ "lang": "rust", "repo": "jblebrun/wrausmt", "path": "/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tschneidereit/wasmtime path: /crates/api/src/instance.rs use crate::context::Context; use crate::externals::Extern; use crate::module::Module; use crate::r#ref::HostRef; use crate::runtime::Store; use crate::{HashMap, HashSet}; use alloc::string::{String, ToString}; use alloc::{borrow::ToOwned, ...
code_fim
hard
{ "lang": "rust", "repo": "tschneidereit/wasmtime", "path": "/crates/api/src/instance.rs", "mode": "psm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|> pub fn from_handle( store: &HostRef<Store>, instance_handle: InstanceHandle, ) -> Result<(Instance, HashMap<String, usize>)> { let contexts = HashSet::new(); let mut exports = Vec::new(); let mut export_names_map = HashMap::new(); let mut mutable = ...
code_fim
hard
{ "lang": "rust", "repo": "tschneidereit/wasmtime", "path": "/crates/api/src/instance.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|>impl Instance { pub fn new( store: &HostRef<Store>, module: &HostRef<Module>, externs: &[Extern], ) -> Result<Instance> { let context = store.borrow_mut().context().clone(); let exports = store.borrow_mut().global_exports().clone(); let imports = mod...
code_fim
hard
{ "lang": "rust", "repo": "tschneidereit/wasmtime", "path": "/crates/api/src/instance.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|>table! { group_memberships (id){ id -> BigInt, user_id -> Integer, group_id -> Integer, } }<|fim_prefix|>// repo: segfo/webapiserver path: /src/database/schema.rs table! { users (id) { id -> Integer, user_name -> Text, mail_address -> Text, ...
code_fim
medium
{ "lang": "rust", "repo": "segfo/webapiserver", "path": "/src/database/schema.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: segfo/webapiserver path: /src/database/schema.rs table! { users (id) { id -> Integer, user_name -> Text, mail_address -> Text, pass_hash -> Text, } } <|fim_suffix|>table! { group_memberships (id){ id -> BigInt, user_id -> Integer, ...
code_fim
medium
{ "lang": "rust", "repo": "segfo/webapiserver", "path": "/src/database/schema.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustkas/rust-by-example-imp path: /rust-by-example/flow_control/src/for_range_inclusive.rs // cargo run -p flow_control --bin for_range_inclusive <|fim_suffix|> let range = 1..=100; //let iterator = range.iter_into(); // `n` will take the values: 1, 2, ..., 100 in each iteration ...
code_fim
easy
{ "lang": "rust", "repo": "rustkas/rust-by-example-imp", "path": "/rust-by-example/flow_control/src/for_range_inclusive.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let range = 1..=100; //let iterator = range.iter_into(); // `n` will take the values: 1, 2, ..., 100 in each iteration for n in range { if n % 15 == 0 { println!("fizzbuzz"); } else if n % 3 == 0 { println!("\tfizz"); } else if n % 5 == 0 { ...
code_fim
easy
{ "lang": "rust", "repo": "rustkas/rust-by-example-imp", "path": "/rust-by-example/flow_control/src/for_range_inclusive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// local mod imports use test::{ prop, wrap, }; // custom mod imports #[path="../tests/stlc_church.rs"] mod test; // FIXME: not a good bench; probably too allocation heavy; better than nothing #[bench] fn bench(b:&mut std_test::Bencher) -> () { let rng = rand::task_rng(); let gen = &mut ...
code_fim
medium
{ "lang": "rust", "repo": "mafm/dtlc.rs", "path": "/benches/stlc_church.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let rng = rand::task_rng(); let gen = &mut qchk::gen(rng, qchk::DEFAULT_SIZE); let wa: &wrap::Bool = &qchk::Arbitrary::arbitrary(gen); let wb: &wrap::Bool = &qchk::Arbitrary::arbitrary(gen); let wc: &wrap::Bool = &qchk::Arbitrary::arbitrary(gen); let task = || { prop::bool_...
code_fim
hard
{ "lang": "rust", "repo": "mafm/dtlc.rs", "path": "/benches/stlc_church.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mafm/dtlc.rs path: /benches/stlc_church.rs // rust feature flags #![feature(phase)] // external crates extern crate core; extern crate quickcheck; extern crate "test" as std_test; // local crates extern crate dtlc; // external mod imports use quickcheck as qchk; use std::rand; <|fim_suffix|>...
code_fim
medium
{ "lang": "rust", "repo": "mafm/dtlc.rs", "path": "/benches/stlc_church.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for marble in 1..=self.m { if marble % 23 == 0 { self.rotate_ccw(7); self.players[self.p] += self.marbles.pop_front().unwrap(); self.players[self.p] += marble; } else { self.rotate_cw(2); self.m...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/advent-of-code", "path": "/2018/day-09/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nwtnni/advent-of-code path: /2018/day-09/src/main.rs use std::collections::VecDeque; use regex::Regex; const INPUT: &'static str = include_str!("input.txt"); struct Circle { p: usize, m: usize, marbles: VecDeque<usize>, players: Vec<usize>, } impl Circle { fn new(players:...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/advent-of-code", "path": "/2018/day-09/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for _ in 0..steps { let m = self.marbles.pop_back().unwrap(); self.marbles.push_front(m); } } fn run(mut self) -> Vec<usize> { for marble in 1..=self.m { if marble % 23 == 0 { self.rotate_ccw(7); self.play...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/advent-of-code", "path": "/2018/day-09/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 123 } #[cfg(test)] mod tests { use super::input_generator; #[test] fn test_parse_image() { let input = "Tile 2311: ..##.#..#. ##..#..... #...##..#. ####.#...# ##.##.###. ##...#.### .#.#.#..## ...
code_fim
hard
{ "lang": "rust", "repo": "frjonsen/aoc2020", "path": "/src/day20.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: frjonsen/aoc2020 path: /src/day20.rs use std::convert::TryInto; const IMAGE_SIDE_LENGTH: usize = 10; type RawImage = [[char; IMAGE_SIDE_LENGTH]; IMAGE_SIDE_LENGTH]; fn calculate_sides(image: &RawImage) -> (u32, u32, u32, u32) { fn convert(image: &RawImage, x: usize, y: usize) -> u32 { ...
code_fim
hard
{ "lang": "rust", "repo": "frjonsen/aoc2020", "path": "/src/day20.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if r >= self.size() { None } else { Some(self.elems.remove(r)) } } fn remove(&mut self, lo: Rank, hi: Rank) -> usize { let hi = min(self.size(), hi); for i in (lo..hi).rev() { self.remove_one(i); } hi - lo...
code_fim
hard
{ "lang": "rust", "repo": "Nouzan/THU-DSA-RUST", "path": "/dsa/lesson-linear/src/vec_vector/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nouzan/THU-DSA-RUST path: /dsa/lesson-linear/src/vec_vector/mod.rs use std::cmp::min; use std::mem::swap; use std::fmt; use crate::{Vector, Rank}; #[derive(Debug)] pub struct VecVector<T: Ord> { elems: Vec<T> } impl<T: Ord+fmt::Display> fmt::Display for VecVector<T> { fn fmt(&self, f: ...
code_fim
hard
{ "lang": "rust", "repo": "Nouzan/THU-DSA-RUST", "path": "/dsa/lesson-linear/src/vec_vector/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn find(&self, e: &T, lo: Rank, hi: Rank) -> Option<Rank> { if lo < hi && hi <= self.size() { for i in lo..hi { if self.elems[i] == *e { return Some(i); } } } None } fn search(&self, e: &T, lo:...
code_fim
hard
{ "lang": "rust", "repo": "Nouzan/THU-DSA-RUST", "path": "/dsa/lesson-linear/src/vec_vector/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: starblue/advent_of_code path: /a2015/src/bin/a201522.rs use std::io; use std::io::Read; use std::str::FromStr; use nom::bytes::complete::tag; use nom::character::complete::digit1; use nom::character::complete::line_ending; use nom::combinator::map_res; use nom::combinator::recognize; use nom::I...
code_fim
hard
{ "lang": "rust", "repo": "starblue/advent_of_code", "path": "/a2015/src/bin/a201522.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.hard { after_effect_state.player_hit_points -= 1; if self.player_hit_points <= 0 { return std::i64::MAX; } } // apply effects let mut player_armor = 0; if self.shield_tu...
code_fim
hard
{ "lang": "rust", "repo": "starblue/advent_of_code", "path": "/a2015/src/bin/a201522.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // apply effects let mut player_armor = 0; if self.shield_turns > 0 { player_armor += 7; after_effect_state.shield_turns -= 1; } if self.poison_turns > 0 { after_effect_state.boss_hit_points -= 3; ...
code_fim
hard
{ "lang": "rust", "repo": "starblue/advent_of_code", "path": "/a2015/src/bin/a201522.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: irauta/reframe path: /src/std140.rs pub const ALIGNMENT_1: u32 = 1 * 4; pub const ALIGNMENT_2: u32 = 2 * 4; pub const ALIGNMENT_3: u32 = 4 * 4; // Three-component types are aligned like four-component types! pub const ALIGNMENT_4: u32 = 4 * 4; pub const ALIGNMENT_STRUCT: u32 = ALIGNMENT_4; pub ...
code_fim
hard
{ "lang": "rust", "repo": "irauta/reframe", "path": "/src/std140.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Array field. ( fill_array_meta($meta:ident) { $field_name:ident : [ $field_type:ty ; $array_len:expr ] } ) => ({ let prev_end = $meta.size; let base_alignment = align_up_to(<$field_type as Std140>::alignment(), ALIGNMENT_ARRAY); let start = align_up_t...
code_fim
hard
{ "lang": "rust", "repo": "irauta/reframe", "path": "/src/std140.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oberblastmeister/monkey path: /crates/monkey-lang/src/ast/expr_infix.rs use crate::ast; #[derive(Debug, Clone, PartialEq)] pub struct ExprInfix { /// The left han<|fim_suffix|>the expression pub rhs: ast::ExprId, } expr_parse!(Infix, ExprInfix, "binary expression");<|fim_middle|>d side...
code_fim
medium
{ "lang": "rust", "repo": "oberblastmeister/monkey", "path": "/crates/monkey-lang/src/ast/expr_infix.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>the expression pub rhs: ast::ExprId, } expr_parse!(Infix, ExprInfix, "binary expression");<|fim_prefix|>// repo: oberblastmeister/monkey path: /crates/monkey-lang/src/ast/expr_infix.rs use crate::ast; #[derive(Debug, Clone, PartialEq)] pub struct ExprInfix { /// The left hand side of the expres...
code_fim
medium
{ "lang": "rust", "repo": "oberblastmeister/monkey", "path": "/crates/monkey-lang/src/ast/expr_infix.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: honestold3/myrust path: /adv_proj/src/main.rs //#[macro_use] #[cfg_attr(test, macro_use)] extern crate adv_proj; use adv_proj::af::unsafes; use adv_proj::af::traits; #[macro_use] use adv_proj::af::types; use adv_proj::af::closures; #[macro_use] macro_rules! say_hello{ ()=>( println!...
code_fim
medium
{ "lang": "rust", "repo": "honestold3/myrust", "path": "/adv_proj/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //traits::kankan(); //traits::kankan1(); //traits::kankan1(); //traits::kankan2(); //traits::kankan3(); //traits::kankan4(); //traits::kankan5(); //types::kankan(); //closures::kankan(); //closures::kankan1(); //closures::kankan3(); // closures::anonymous_f...
code_fim
medium
{ "lang": "rust", "repo": "honestold3/myrust", "path": "/adv_proj/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zoosky/prisma-engine path: /migration-engine/core/tests/existing_databases_tests.rs #![allow(unused)] mod test_harness; use barrel::{types, Migration, SqlVariant}; use migration_core::api::GenericApi; use pretty_assertions::{assert_eq, assert_ne}; use sql_connection::SyncSqlConnection; use quai...
code_fim
hard
{ "lang": "rust", "repo": "zoosky/prisma-engine", "path": "/migration-engine/core/tests/existing_databases_tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let dm2 = r#" model Blog { id Int @id title Int @unique } "#; let final_result = api.infer_and_apply(&dm2).await.sql_schema; let final_column = final_result.table_bang("Blog").column_bang("title"); assert_eq!(final_column.tpe....
code_fim
hard
{ "lang": "rust", "repo": "zoosky/prisma-engine", "path": "/migration-engine/core/tests/existing_databases_tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nephele-rs/cynthia path: /cynthia/src/future/stream.rs Output = (B, B); fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> { let mut this = self.project(); loop { match ready!(this.stream.as_mut().poll_next(cx)) { Some(v) =>...
code_fim
hard
{ "lang": "rust", "repo": "nephele-rs/cynthia", "path": "/cynthia/src/future/stream.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nephele-rs/cynthia path: /cynthia/src/future/stream.rs _>) -> Poll<Option<Self::Item>> { let this = self.project(); match ready!(this.stream.poll_next(cx)) { Some(v) => { let ret = (*this.i, v); *this.i += 1; Poll::Ready...
code_fim
hard
{ "lang": "rust", "repo": "nephele-rs/cynthia", "path": "/cynthia/src/future/stream.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "std")] impl<T, S1, S2> Stream for Race<S1, S2> where S1: Stream<Item = T>, S2: Stream<Item = T>, { type Item = T; fn poll_next(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Option<Self::Item>> { use crate::utils::rander; let mut this = self.project(...
code_fim
hard
{ "lang": "rust", "repo": "nephele-rs/cynthia", "path": "/cynthia/src/future/stream.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> value: T, inputs: &[(T, T::Bits)], mut inherent_remove: impl FnMut(&mut T, T), mut inherent_set: impl FnMut(&mut T, T, bool), ) where T::Bits: std::fmt::Debug + PartialEq + Copy, { for (input, expected) in inputs { assert_eq!( *expected, { ...
code_fim
hard
{ "lang": "rust", "repo": "bitflags/bitflags", "path": "/src/tests/remove.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bitflags/bitflags path: /src/tests/remove.rs use super::*; use crate::Flags; #[test] fn cases() { case( TestFlags::empty(), &[ (TestFlags::A, 0), (TestFlags::empty(), 0), (TestFlags::from_bits_retain(1 << 3), 0), ], TestFl...
code_fim
hard
{ "lang": "rust", "repo": "bitflags/bitflags", "path": "/src/tests/remove.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> println!(" ----- {:^20} -----", "node_occur_offsets"); self.node_occur_offsets.print_diagnostics(); println!(); println!(" ----- {:^20} -----", "node_occur_next"); self.node_occur_next.print_diagnostics(); println!(); println!("\n ~~ END NodeOccu...
code_fim
hard
{ "lang": "rust", "repo": "chfi/rs-handlegraph", "path": "/src/packedgraph/occurrences.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chfi/rs-handlegraph path: /src/packedgraph/occurrences.rs use std::num::NonZeroUsize; use fnv::FnvHashMap; use crate::{packed::*, pathhandlegraph::*}; use super::{ defragment::Defragment, graph::{NARROW_PAGE_WIDTH, WIDE_PAGE_WIDTH}, list::{self, PackedList, PackedListMut}, One...
code_fim
hard
{ "lang": "rust", "repo": "chfi/rs-handlegraph", "path": "/src/packedgraph/occurrences.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: robohouse-delft/abbrws-rs path: /abbrws/src/parse/file_service.rs use serde::Deserialize; // fn deserialize_number_from_string<'de, D: Deserializer<'de>>(deserializer: D) -> Result<usize, D::Error> { // use serde::de::Error; // if let Ok(x) = usize::deserialize(deserializer) { // return Ok...
code_fim
hard
{ "lang": "rust", "repo": "robohouse-delft/abbrws-rs", "path": "/abbrws/src/parse/file_service.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(rename = "fs-size")] #[serde(deserialize_with = "deserialize_through_str")] size: usize, #[serde(rename = "fs-readonly")] #[serde(deserialize_with = "deserialize_through_str")] read_only: bool, } #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Deserialize)] #[serde(tag = "_type")] p...
code_fim
hard
{ "lang": "rust", "repo": "robohouse-delft/abbrws-rs", "path": "/abbrws/src/parse/file_service.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(rename = "fs-enabled")] #[serde(deserialize_with = "deserialize_through_str")] enabled: bool, #[serde(rename = "fs-readonly")] #[serde(deserialize_with = "deserialize_through_str")] read_only: bool, } #[derive(Clone, Debug, Eq, PartialEq, Ord, PartialOrd, Deserialize)] pub struct Directory...
code_fim
hard
{ "lang": "rust", "repo": "robohouse-delft/abbrws-rs", "path": "/abbrws/src/parse/file_service.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sigmaSd/termchat path: /src/terminal_events.rs use crossterm::event::Event; use std::sync::{ atomic::{AtomicBool, Ordering}, Arc, }; use std::thread::{self, JoinHandle}; use std::time::Duration; const EVENT_SAMPLING_TIMEOUT: u64 = 50; //ms <|fim_suffix|> TerminalEventCollector ...
code_fim
hard
{ "lang": "rust", "repo": "sigmaSd/termchat", "path": "/src/terminal_events.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl TerminalEventCollector { pub fn new<C>(event_callback: C) -> TerminalEventCollector where C: Fn(Event) + Send + 'static, { let collector_thread_running = Arc::new(AtomicBool::new(true)); let collector_thread_handle = { let running = collector_thread_run...
code_fim
hard
{ "lang": "rust", "repo": "sigmaSd/termchat", "path": "/src/terminal_events.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n int整型 * @return int整型 */ pub fn Fibonacci(&self, n: i32) -> i32 { // write code here 100 } }<|fim_prefix|>// repo: geniousli/point24 path: /src/algorithm/nc65.rs struct Solution{ } impl Solu...
code_fim
easy
{ "lang": "rust", "repo": "geniousli/point24", "path": "/src/algorithm/nc65.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: geniousli/point24 path: /src/algorithm/nc65.rs struct Solution{ } impl Solution { fn new() -> Self { <|fim_suffix|> /** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param n int整型 * @return int整型 */ pub fn Fibonacci(&self, n: i32) -> i32 { // write ...
code_fim
easy
{ "lang": "rust", "repo": "geniousli/point24", "path": "/src/algorithm/nc65.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn player_card_type_succeeds_from_valid_strings() { assert_eq!( PlayerCardType::from_str("Asset"), Ok(PlayerCardType::Asset) ); assert_eq!( PlayerCardType::from_str("Event"), Ok(PlayerCardType::Event) ); ...
code_fim
hard
{ "lang": "rust", "repo": "cwboden/.dotfiles", "path": "/games/dcg_render/src/card/types.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cwboden/.dotfiles path: /games/dcg_render/src/card/types.rs use crate::error; use serde::Deserialize; use std::str::FromStr; #[derive(Debug, Deserialize, Eq, PartialEq)] pub enum CardType { Act, Agenda, Character, Encounter, Enemy, Location, Player, } impl FromStr f...
code_fim
hard
{ "lang": "rust", "repo": "cwboden/.dotfiles", "path": "/games/dcg_render/src/card/types.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mongodb/mongo-rust-driver path: /src/test/cursor.rs use std::time::Duration; use futures::{future::Either, StreamExt, TryStreamExt}; use serde::{Deserialize, Serialize}; use crate::{ bson::doc, options::{CreateCollectionOptions, CursorType, FindOptions}, runtime, test::{log_unc...
code_fim
hard
{ "lang": "rust", "repo": "mongodb/mongo-rust-driver", "path": "/src/test/cursor.rs", "mode": "psm", "license": "OpenSSL", "source": "the-stack-v2" }
<|fim_suffix|> let mut session = client.start_session(None).await.unwrap(); let coll = client.database("db").collection("coll"); coll.drop_with_session(None, &mut session).await.unwrap(); coll.insert_many_with_session( vec![doc! { "x": 1 }, doc! { "x": 2 }, doc! { "x": 3 }], None, ...
code_fim
hard
{ "lang": "rust", "repo": "mongodb/mongo-rust-driver", "path": "/src/test/cursor.rs", "mode": "spm", "license": "OpenSSL", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dandcg/grin-dotnet path: /original/grin/core/src/core/transaction.rs Reader) -> Result<TxKernel, ser::Error> { let features = KernelFeatures::from_bits(reader.read_u8()?).ok_or( ser::Error::CorruptedData, )?; Ok(TxKernel { features: features, fee: reader.read_u64()?, lock_hei...
code_fim
hard
{ "lang": "rust", "repo": "dandcg/grin-dotnet", "path": "/original/grin/core/src/core/transaction.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dandcg/grin-dotnet path: /original/grin/core/src/core/transaction.rs r implied. // See the License for the specific language governing permissions and // limitations under the License. //! Transactions use byteorder::{BigEndian, ByteOrder}; use blake2::blake2b::blake2b; use util::secp::{self, ...
code_fim
hard
{ "lang": "rust", "repo": "dandcg/grin-dotnet", "path": "/original/grin/core/src/core/transaction.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Builds a new transaction with the provided fee. pub fn with_fee(self, fee: u64) -> Transaction { Transaction { fee: fee, ..self } } /// Builds a new transaction with the provided lock_height. pub fn with_lock_height(self, lock_height: u64) -> Transaction { Transaction { lock_height: lock_...
code_fim
hard
{ "lang": "rust", "repo": "dandcg/grin-dotnet", "path": "/original/grin/core/src/core/transaction.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: theocrowley24/Cinema-Backend path: /src/jobs/assign_tokens.rs use crate::establish_connection; use crate::schema::users::dsl::{users, subscriptions_enabled}; use diesel::{QueryDsl, ExpressionMethods}; use crate::diesel::RunQueryDsl; use crate::models::User; use crate::helpers::tokens::add_tokens...
code_fim
medium
{ "lang": "rust", "repo": "theocrowley24/Cinema-Backend", "path": "/src/jobs/assign_tokens.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Get list of all subscribers from database let db = establish_connection(); let subscribers: Vec<User> = users .filter(subscriptions_enabled.eq(true)) .load::<User>(&db) .expect("Query failed"); for subscriber in subscribers { add_tokens(subscriber.id, 5...
code_fim
medium
{ "lang": "rust", "repo": "theocrowley24/Cinema-Backend", "path": "/src/jobs/assign_tokens.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for subscriber in subscribers { add_tokens(subscriber.id, 5); } println!("CRON JOB FINISHED: {}", name); }<|fim_prefix|>// repo: theocrowley24/Cinema-Backend path: /src/jobs/assign_tokens.rs use crate::establish_connection; use crate::schema::users::dsl::{users, subscriptions_enabled...
code_fim
medium
{ "lang": "rust", "repo": "theocrowley24/Cinema-Backend", "path": "/src/jobs/assign_tokens.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grebneerg/knot-solver path: /knot-solver/src/polynomial.rs use std::cmp::Ordering; use std::fmt; use std::iter::Sum; use std::ops::{Add, AddAssign, Mul}; use rayon::prelude::*; use num::{rational::Rational, One, Zero}; #[macro_export] macro_rules! term { ($c:literal A^ $e:literal) => { ...
code_fim
hard
{ "lang": "rust", "repo": "grebneerg/knot-solver", "path": "/knot-solver/src/polynomial.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl BinomialIter { /// Creates a new `BinomialIter` with the given `n`. fn new(n: isize) -> Self { BinomialIter { n, k: 0 } } } impl Iterator for BinomialIter { type Item = (isize, isize); fn next(&mut self) -> Option<Self::Item> { if self.k <= self.n { l...
code_fim
hard
{ "lang": "rust", "repo": "grebneerg/knot-solver", "path": "/knot-solver/src/polynomial.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: featherfly/gd32-pac path: /gd32e23x-pac/src/gd32e230/fmc/wp.rs #[doc = "Reader of register WP"] pub type R = crate::R<u32, super::WP>; #[doc = "Reader of field `WP`"] pub type WP_R = crate::R<u16, u16>; impl R { #[doc = "Bits 0:15<|fim_suffix|> pub fn wp(&self) -> WP_R { WP_R::ne...
code_fim
medium
{ "lang": "rust", "repo": "featherfly/gd32-pac", "path": "/gd32e23x-pac/src/gd32e230/fmc/wp.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> - Store WP\\[15:0\\] of option bytes block after system reset"] #[inline(always)] pub fn wp(&self) -> WP_R { WP_R::new((self.bits & 0xffff) as u16) } }<|fim_prefix|>// repo: featherfly/gd32-pac path: /gd32e23x-pac/src/gd32e230/fmc/wp.rs #[doc = "Reader of register WP"] pub type R = c...
code_fim
medium
{ "lang": "rust", "repo": "featherfly/gd32-pac", "path": "/gd32e23x-pac/src/gd32e230/fmc/wp.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match api { Api::Cc => json.get("result").unwrap().get(info).unwrap().as_f64().unwrap(), Api::Hb => json.get(info).unwrap().as_str().unwrap().parse::<f64>().unwrap(), } }<|fim_prefix|>// repo: narnold113/rustArbBe path: /src/main.rs extern crate reqwest; extern crate serde; extern...
code_fim
hard
{ "lang": "rust", "repo": "narnold113/rustArbBe", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: narnold113/rustArbBe path: /src/main.rs extern crate reqwest; extern crate serde; extern crate serde_json; use serde_json::Value; const CC_URL: &str = "https://api.cryptowat.ch/markets/prices"; const HB_URL: &str = "https://api.hitbtc.com/api/2/public/ticker/xrpusdt"; enum Api { Cc, H...
code_fim
hard
{ "lang": "rust", "repo": "narnold113/rustArbBe", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let binance_btcusdt: f64 = get_number(Api::Cc, &cc_res, "binance:btcusdt"); let binance_bccusdt: f64 = get_number(Api::Cc, &cc_res, "binance:bccusdt"); let binance_ethusdt: f64 = get_number(Api::Cc, &cc_res, "binance:ethusdt"); let hitbtc_xrp: f64 = get_number(Api::Hb, &hb_res, "last"); }...
code_fim
medium
{ "lang": "rust", "repo": "narnold113/rustArbBe", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tato/lox path: /lox_proc_macros/src/lib.rs use proc_macro::TokenStream; use quote::quote; #[proc_macro_derive(U8Enum)] pub fn derive_enum_variant_count(input: TokenStream) -> TokenStream { let syn_item: syn::DeriveInput = syn::parse(input).unwrap(); <|fim_suffix|> if byte as usize ...
code_fim
hard
{ "lang": "rust", "repo": "tato/lox", "path": "/lox_proc_macros/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if byte as usize >= Self::COUNT { None } else { unsafe { std::mem::transmute(byte) } } } } }; expanded.into() }<|fim_prefix|>// repo: tato/lox path: /lox_proc_macros/src/lib.rs use proc_macro::TokenS...
code_fim
hard
{ "lang": "rust", "repo": "tato/lox", "path": "/lox_proc_macros/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Establish a connection to the server let mut stream = TcpStream::connect(addr).await.unwrap(); // Get a key, data is missing stream .write_all(b"*2\r\n$3\r\nFOO\r\n$5\r\nhello\r\n") .await .unwrap(); let mut response = [0; 28]; stream.read_exact(&mut r...
code_fim
hard
{ "lang": "rust", "repo": "wangbinyq/mini-redis", "path": "/tests/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> stream.read_exact(&mut response).await.unwrap(); assert_eq!(b"-ERR unknown command \'foo\'\r\n", &response); } // In this case we test that server Responds with an Error message if a client // sends an GET or SET command after a SUBSCRIBE #[tokio::test] async fn send_error_get_set_after_subscrib...
code_fim
hard
{ "lang": "rust", "repo": "wangbinyq/mini-redis", "path": "/tests/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wangbinyq/mini-redis path: /tests/server.rs use mini_redis::server; use std::net::SocketAddr; use tokio::io::{AsyncReadExt, AsyncWriteExt}; use tokio::net::{TcpListener, TcpStream}; use tokio::time::{self, Duration}; /// A basic "hello world" style test. A server instance is started in a /// b...
code_fim
hard
{ "lang": "rust", "repo": "wangbinyq/mini-redis", "path": "/tests/server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn lock<R>(&self, f: impl FnOnce(&mut Self::Data) -> R) -> R; } } impl<T> interface::Mutex for NullLock<T> { type Data = T; fn lock<R>(&self, f: impl FnOnce(&mut Self::Data) -> R) -> R { let data = unsafe { &mut *self.data.get() }; f(data) ...
code_fim
medium
{ "lang": "rust", "repo": "twrdyyy/rust-rp-os", "path": "/src/synchronization.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let data = unsafe { &mut *self.data.get() }; f(data) } }<|fim_prefix|>// repo: twrdyyy/rust-rp-os path: /src/synchronization.rs use core::cell::UnsafeCell; pub struct NullLock<T> where T: ?Sized, { data: UnsafeCell<T>, } /// Null Lock constructor impl<T> ...
code_fim
medium
{ "lang": "rust", "repo": "twrdyyy/rust-rp-os", "path": "/src/synchronization.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: twrdyyy/rust-rp-os path: /src/synchronization.rs use core::cell::UnsafeCell; pub struct NullLock<T> where T: ?Sized, { data: UnsafeCell<T>, } /// Null Lock constructor impl<T> NullLock<T> { pub const fn new(data: T) -> Self { Self { data: UnsafeCell::new(data)...
code_fim
hard
{ "lang": "rust", "repo": "twrdyyy/rust-rp-os", "path": "/src/synchronization.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'x> Deserialize<'x> for MPUint { fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer<'x> { struct MPUintVisitor; impl<'x: 'x> de::Visitor<'x> for MPUintVisitor { type Value = MPUint; fn expecting(&self...
code_fim
hard
{ "lang": "rust", "repo": "Arclite-io/ssh-wire", "path": "/src/mpint.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Arclite-io/ssh-wire path: /src/mpint.rs use der::*; use std::fmt; use std::convert::AsRef; use serde::de; use serde::de::{Deserialize,Deserializer}; // Non-negative multi-precision integers in the SSH wire protocol begin with a \x00 byte to // distinguish from negative. Some libraries like ...
code_fim
hard
{ "lang": "rust", "repo": "Arclite-io/ssh-wire", "path": "/src/mpint.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn read_status_line(&mut self) -> Result<String, &'static str> { let status_line: String = try!(self.stream.read_line()); if HttpLineParsers::verify_status_line(&status_line) { return Ok(status_line); } else { return Err("malformed status line"); ...
code_fim
hard
{ "lang": "rust", "repo": "grahamc/code-solving-problem-application-for-social-media-site-with-blogs", "path": "/http-proxy/src/httpresponse.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Shemnei/punktf path: /crates/punktf-lib/src/template/parse/tests.rs #![cfg(test)] use color_eyre::eyre::{eyre, Result}; use pretty_assertions::assert_eq; use super::*; use crate::template::block::{Block, BlockKind, If, IfExpr, IfOp, Var, VarEnv, VarEnvSet}; use crate::template::source::Source;...
code_fim
hard
{ "lang": "rust", "repo": "Shemnei/punktf", "path": "/crates/punktf-lib/src/template/parse/tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> crate::tests::setup_test_env(); let content = r#"{{ Hello World }} {{{ Escaped {{ }} }} }}} {{!-- Hello World {{}} {{{ asdf }}} this is a comment --}} {{@if {{}} }} }} "#; let iter = BlockIter::new(content); // Hello World // Text: SPACE // Escaped // Text: LF SPACES // Comment // Text: ...
code_fim
hard
{ "lang": "rust", "repo": "Shemnei/punktf", "path": "/crates/punktf-lib/src/template/parse/tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let op = IfOp::NotEq; let other = ByteSpan::new(17usize, 24usize); assert_eq!(&content[other], "windows"); let end_span = ByteSpan::new(27usize, 34usize); assert_eq!(&content[end_span], r#"{{@fi}}"#); assert_eq!( block.kind(), &BlockKind::If(If { head: ( if_span.span(IfExpr::Compare { ...
code_fim
hard
{ "lang": "rust", "repo": "Shemnei/punktf", "path": "/crates/punktf-lib/src/template/parse/tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> vec![ Arg::from_usage("-c --config=[file] 'A configuration file to use'"), Arg::from_usage("-d --directory=[dir] 'A directory to add to the Ohai plugin search path.'"), Arg::from_usage("-l --log-level=[level] 'Set the log level (debug, info, warn, error, fatal)'"), Arg:...
code_fim
hard
{ "lang": "rust", "repo": "afiune/ohai-rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: afiune/ohai-rust path: /src/main.rs extern crate clap; use clap::{App, Arg}; pub const VERSION: &str = include_str!("../VERSION"); fn main() { <|fim_suffix|>fn run() -> Result<(), String> { println!("{}"); Ok(()) } fn arguments<'a>() -> Vec<Arg<'a, 'a>> { vec![ Arg::from_...
code_fim
hard
{ "lang": "rust", "repo": "afiune/ohai-rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // parses the CLI options, loads the config file if present, and initializes logging let app = App::new("ohai").version(VERSION).args(&arguments()); let _matches = app.get_matches(); //configure_ohai(); if let Err(e) = run() { println!("Error: {}", e); std::process::exi...
code_fim
medium
{ "lang": "rust", "repo": "afiune/ohai-rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azriel91/autexousious path: /crate/workspace_tests/src/character_play/sequence_handler/common/input/walk_x_movement_check.rs #[cfg(test)] mod tests { use character_model::{config::CharacterSequenceName, play::RunCounter}; use game_input_model::play::ControllerInput; use kinematic_mod...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/workspace_tests/src/character_play/sequence_handler/common/input/walk_x_movement_check.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let input = ControllerInput::new(-1., -1., false, false, false, false); assert_eq!( Some(CharacterSequenceName::Run), WalkXMovementCheck::update(CharacterSequenceUpdateComponents::new( &input, HealthPoints::default(), ...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/workspace_tests/src/character_play/sequence_handler/common/input/walk_x_movement_check.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_row_max(&self) -> i32 { self.row_max } pub fn get_col_max(&self) -> i32 { self.col_max } }<|fim_prefix|>// repo: skalermo/POBR-logo-recognition path: /src/clusters.rs use crate::Segment; #[derive(Debug)] pub struct Cluster<'a> { row_min: i32, row_max: ...
code_fim
hard
{ "lang": "rust", "repo": "skalermo/POBR-logo-recognition", "path": "/src/clusters.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: skalermo/POBR-logo-recognition path: /src/clusters.rs use crate::Segment; #[derive(Debug)] pub struct Cluster<'a> { row_min: i32, row_max: i32, col_min: i32, col_max: i32, yellow_segment: &'a Segment, blue_segments: Vec<&'a Segment>, red_segments: Vec<&'a Segment>, }...
code_fim
medium
{ "lang": "rust", "repo": "skalermo/POBR-logo-recognition", "path": "/src/clusters.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { return_stack_addr: 0x56cadeace000, stack_addr: 0x7aceddead000, data_space_addr: 0x7feaddead000, pad_addr: 0x76beaded5000, heap_addr: 0x44ea5c69c000, internal_state_memory_addr: 0x5deadbeef000, anonymo...
code_fim
medium
{ "lang": "rust", "repo": "stefan-blair/ForthRust", "path": "/src/evaluate/config.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stefan-blair/ForthRust path: /src/evaluate/config.rs pub struct ForthConfig { pub return_stack_addr: usize, pub stack_addr: usize, pub data_space_addr: usize, pub pad_addr: usize, pub heap_addr: usize, pub internal_state_memory_addr: usize, pub anonymous_mappin...
code_fim
medium
{ "lang": "rust", "repo": "stefan-blair/ForthRust", "path": "/src/evaluate/config.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DaPokemonMaster/smash-minecraft-skins path: /src/color_correct.rs use image::Pixel; pub fn color_correct(skin_data: &mut image::RgbaImage) { for row in skin_data.rows_mut() { for pixel in row { let channels = pixel.channels_mut(); // 0..3 - don't apply to alp...
code_fim
hard
{ "lang": "rust", "repo": "DaPokemonMaster/smash-minecraft-skins", "path": "/src/color_correct.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let pixel = &mut channels[i]; // gamma brightening by a factor of 1.385, bounded to [0, 184] *pixel = ((((*pixel as f64) / 255.0).powf(1.0f64 / 1.200f64) * 255.0) * 191.0 / 255.0) as u8; } } } }<|fim_prefix|>// repo: DaPokem...
code_fim
hard
{ "lang": "rust", "repo": "DaPokemonMaster/smash-minecraft-skins", "path": "/src/color_correct.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn text(&self) -> &str { self.text_content() } fn set_text(&mut self, content: &str); // set html fn set_html(&mut self, content: &str); // ele index fn index(&self) -> usize; }<|fim_prefix|>// repo: fefit/mesdoc path: /src/interface/node.rs use super::{BoxDynElement, BoxDynText, BoxDynUncareNod...
code_fim
hard
{ "lang": "rust", "repo": "fefit/mesdoc", "path": "/src/interface/node.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fefit/mesdoc path: /src/interface/node.rs use super::{BoxDynElement, BoxDynText, BoxDynUncareNode, MaybeDoc, MaybeElement}; use std::any::Any; #[derive(Debug)] pub enum INodeType { Element = 1, Text = 3, XMLCDATA = 4, Comment = 8, Document = 9, HTMLDOCTYPE = 10, DocumentFragement = 11, O...
code_fim
hard
{ "lang": "rust", "repo": "fefit/mesdoc", "path": "/src/interface/node.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jiegec/rcore_plus path: /kernel/src/arch/x86_64/fp.rs // state saved by fxsave64 // 512 bytes // https://www.felixcloutier.com/x86/fxsave#tbl-3-47 #[repr(C, align(16))] #[derive(Debug, Copy, Clone, Default)] pub struct FpState { // 0 fcw: u16, fsw: u16, ftw: u16, fop: u16, ...
code_fim
hard
{ "lang": "rust", "repo": "jiegec/rcore_plus", "path": "/kernel/src/arch/x86_64/fp.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn restore(&self) { unsafe { core::arch::x86_64::_fxrstor64(self as *const FpState as *const u8); } } }<|fim_prefix|>// repo: jiegec/rcore_plus path: /kernel/src/arch/x86_64/fp.rs // state saved by fxsave64 // 512 bytes // https://www.felixcloutier.com/x86/fxsave#t...
code_fim
medium
{ "lang": "rust", "repo": "jiegec/rcore_plus", "path": "/kernel/src/arch/x86_64/fp.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lperson/spotifytops path: /src/lib/spotify/retriever.rs use std::marker::PhantomData; use serde::de::DeserializeOwned; use serde_json; pub struct RetrievableRequest { pub uri: String, } <|fim_suffix|> fn deserialize(s: &'a str) -> Result<Self::Item, serde_json::Error> where ...
code_fim
hard
{ "lang": "rust", "repo": "lperson/spotifytops", "path": "/src/lib/spotify/retriever.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }