text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> // TODO: move to cli argument let debug = true; let mut error: Option<EvaluationError> = None; loop { if self.code_stack.is_empty() { break; } if error.is_some() { break; } let ins ...
code_fim
hard
{ "lang": "rust", "repo": "dave-nachman/bytelang", "path": "/src/vm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dave-nachman/bytelang path: /src/vm.rs use std::collections::HashMap; use std::str; use bytecode::{Heap, Instruction, SymbolTable, Value}; use pretty_print::pretty_print; #[derive(Debug, PartialEq)] pub enum EvaluationError { MissingVariable(String), InvalidOperation(String), } #[deri...
code_fim
hard
{ "lang": "rust", "repo": "dave-nachman/bytelang", "path": "/src/vm.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sugyan/atcoder path: /arc074/src/bin/c.rs use proconio::{fastout, input}; #[fastout] fn main() { input! { h: u64, w: u64, } if h * w % 3 == 0 { println!("0"); return; } <|fim_suffix|> v.push(w / 2 * h); v.push((w - w / 2) * h); } ...
code_fim
hard
{ "lang": "rust", "repo": "sugyan/atcoder", "path": "/arc074/src/bin/c.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> v.push(w / 2 * h); v.push((w - w / 2) * h); } v.sort_unstable(); v[2] - v[0] }; println!("{}", s(h, w).min(s(w, h))); }<|fim_prefix|>// repo: sugyan/atcoder path: /arc074/src/bin/c.rs use proconio::{fastout, input}; #[fastout] fn main() { input! { ...
code_fim
hard
{ "lang": "rust", "repo": "sugyan/atcoder", "path": "/arc074/src/bin/c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benruijl/cuba path: /src/lib.rs const c_int, x: *const c_double, ncomp: *const c_int, f: *mut c_double, userdata: *mut c_void, nvec: *const c_int, core: *const c_int, ) -> c_int; type DivonneIntegrandC = extern "C" fn( ndim: *const c_int, x: *const c_double, ...
code_fim
hard
{ "lang": "rust", "repo": "benruijl/cuba", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Vegas integrand evaluation function. /// /// The dimensions of random input variables `x` and output `f` /// are provided to the integration routine as dimension and components respectively. /// `T` can be any type. If you don't want to provide user data, /// simply make `T` a `usize` and provide any ...
code_fim
hard
{ "lang": "rust", "repo": "benruijl/cuba", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benruijl/cuba path: /src/lib.rs d)( &slice::from_raw_parts(x, *ndim as usize * *nvec as usize), &mut slice::from_raw_parts_mut(f, *ncomp as usize * *nvec as usize), &mut k.user_data, *nvec as usize, *core as i32, ...
code_fim
hard
{ "lang": "rust", "repo": "benruijl/cuba", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> s.trim().chars().filter(|x| x.to_ascii_lowercase() != c && x.to_ascii_uppercase() != c).collect() } fn clean(data: String) -> String { data.trim().chars().fold(String::new(), |mut s, c| { if s.ends_with(invert(c)){ s.pop(); }else{ s...
code_fim
medium
{ "lang": "rust", "repo": "yabirgb/Adventofcode", "path": "/2018/src/day5.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yabirgb/Adventofcode path: /2018/src/day5.rs fn invert(c: char) -> char { if c.to_ascii_lowercase() == c { c.to_ascii_uppercase() }else{ c.to_ascii_lowercase() } } fn destroy_component (s: &str , c:char) -> String { s.trim().chars().filter(|x| x.to_ascii_lowercas...
code_fim
medium
{ "lang": "rust", "repo": "yabirgb/Adventofcode", "path": "/2018/src/day5.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn clean(data: String) -> String { data.trim().chars().fold(String::new(), |mut s, c| { if s.ends_with(invert(c)){ s.pop(); }else{ s.push(c); } s }) } #[aoc(day5, part1)] pub fn part1 (input...
code_fim
medium
{ "lang": "rust", "repo": "yabirgb/Adventofcode", "path": "/2018/src/day5.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dpchamps/rustadventofcode2020 path: /src/bin/4.rs use RustAdventOfCode::get_resource; #[macro_use] extern crate lazy_static; extern crate regex; use regex::Regex; struct Passport { kv_pairs: Vec<(String, String)>, } const EXPECTED_KEYS: &'static [&'static str] = &["byr", "iyr", "eyr", "hgt...
code_fim
hard
{ "lang": "rust", "repo": "dpchamps/rustadventofcode2020", "path": "/src/bin/4.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn validate_val((k, v): &(String, String)) -> bool { match k.as_ref() { "byr" => Passport::validate_byr(v), "iyr" => Passport::validate_iyr(v), "eyr" => Passport::validate_eyr(v), "hgt" => Passport::validate_hgt(v), "hcl" => Passport:...
code_fim
hard
{ "lang": "rust", "repo": "dpchamps/rustadventofcode2020", "path": "/src/bin/4.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ColorMatcher.is_match(val) && val.len() == 7 } fn validate_ecl(val: &str) -> bool { EYE_COLORS.iter().any(|&x| x == val) } fn validate_pid(val: &str) -> bool { lazy_static! { static ref PidMatcher: Regex = Regex::new(r"\d{9}").unwrap(); } ...
code_fim
hard
{ "lang": "rust", "repo": "dpchamps/rustadventofcode2020", "path": "/src/bin/4.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Latias94/rust-practice path: /leetcode/src/s0704_binary_search.rs struct Solution; //leetcode submit region begin(Prohibit modification and deletion) use std::cmp::Ordering::*; impl Solution { pub fn search(nums: Vec<i32>, target: i32) -> i32 { let n = nums.len(); let mut l...
code_fim
hard
{ "lang": "rust", "repo": "Latias94/rust-practice", "path": "/leetcode/src/s0704_binary_search.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let nums2 = vec![-1, 0, 3, 5, 9, 12]; assert_eq!(Solution::search(nums2, 2), -1); assert_eq!(Solution::search(vec![5], -5), -1); assert_eq!(Solution::search(vec![2, 5], 2), 0); } }<|fim_prefix|>// repo: Latias94/rust-practice path: /leetcode/src/s0704_binary_search.r...
code_fim
hard
{ "lang": "rust", "repo": "Latias94/rust-practice", "path": "/leetcode/src/s0704_binary_search.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl From<Config> for MigrateDir { fn from(config: Config) -> Self { MigrateDir::new(config.folder, config.debug) } }<|fim_prefix|>// repo: zprobst/dot-protector path: /src/migrate_dir.rs use std::path::PathBuf; use crate::{config::Config, mount_dir::MountDir}; #[derive(Debug)] pub stru...
code_fim
medium
{ "lang": "rust", "repo": "zprobst/dot-protector", "path": "/src/migrate_dir.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zprobst/dot-protector path: /src/migrate_dir.rs use std::path::PathBuf; use crate::{config::Config, mount_dir::MountDir}; <|fim_suffix|>impl MigrateDir { pub fn new(folder: PathBuf, debug: bool) -> Self { let virtualize_command = MountDir::new(folder.clone(), debug); Self {...
code_fim
medium
{ "lang": "rust", "repo": "zprobst/dot-protector", "path": "/src/migrate_dir.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn do_migrate(self) { println!("Would Migrate the dir: {:?}", self.folder); self.virtualize_command.do_virtualize() } } impl From<Config> for MigrateDir { fn from(config: Config) -> Self { MigrateDir::new(config.folder, config.debug) } }<|fim_prefix|>// repo: z...
code_fim
hard
{ "lang": "rust", "repo": "zprobst/dot-protector", "path": "/src/migrate_dir.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: johnxnguyen/newton path: /src/physics/barneshut/virtual_body.rs use std::fmt; use crate::geometry::Point; use crate::geometry::Vector; use crate::physics::Body; // VirtualBody /////////////////////////////////////////////////////////////// // // A virtual body represents an amalgamation of rea...
code_fim
hard
{ "lang": "rust", "repo": "johnxnguyen/newton", "path": "/src/physics/barneshut/virtual_body.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn new(mass: f32, x: f32, y: f32) -> VirtualBody { VirtualBody { mass, position: Point::new(x, y), } } pub fn zero() -> VirtualBody { VirtualBody::new(0.0, 0.0, 0.0) } pub fn centered(&self) -> VirtualBody { debug_assert!(se...
code_fim
hard
{ "lang": "rust", "repo": "johnxnguyen/newton", "path": "/src/physics/barneshut/virtual_body.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AdrianDanis/uefi-example path: /fencedvar/src/fencedvar.rs use core::sync::atomic::{fence, Ordering}; // This is meant to be used to create slightly unsafe global variables where you would like // them to be updated if possible, but are not able to use a lock to control access and will<|fim_suf...
code_fim
hard
{ "lang": "rust", "repo": "AdrianDanis/uefi-example", "path": "/fencedvar/src/fencedvar.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> FencedVar<T> { pub fn get(&self) -> T { fence(Ordering::Acquire); self.construction_value } pub fn set(&mut self, v: T) { self.construction_value = v; fence(Ordering::Release); } }<|fim_prefix|>// repo: AdrianDanis/uefi-example path: /fencedvar/src/fencedv...
code_fim
hard
{ "lang": "rust", "repo": "AdrianDanis/uefi-example", "path": "/fencedvar/src/fencedvar.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn checks_if_double_dot_exists() { Playground::setup("path_exists_4", |dirs, _| { let actual = nu!( cwd: dirs.test(), "echo '..' | path exists" ); assert_eq!(actual.out, "true"); }) } #[test] fn checks_tilde_relative_path_exists() { let...
code_fim
medium
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu-command/tests/commands/path/exists.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn checks_if_dot_exists() { Playground::setup("path_exists_3", |dirs, _| { let actual = nu!( cwd: dirs.test(), "echo '.' | path exists" ); assert_eq!(actual.out, "true"); }) } #[test] fn checks_if_double_dot_exists() { Playground::setup...
code_fim
hard
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu-command/tests/commands/path/exists.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nushell/nushell path: /crates/nu-command/tests/commands/path/exists.rs use nu_test_support::fs::Stub::EmptyFile; use nu_test_support::nu; use nu_test_support::playground::Playground; #[test] fn checks_if_existing_file_exists() { Playground::setup("path_exists_1", |dirs, sandbox| { s...
code_fim
medium
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu-command/tests/commands/path/exists.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: VictorKoenders/advent_of_code_2020 path: /src/bin/day6.rs use aoc_2020::*; use itertools::Itertools; fn main() { let input = input("day6.txt"); let input = Group::parse(&input); let start = std::time::Instant::now(); println!("Part 1:"); part1(&input); println!("Done in...
code_fim
hard
{ "lang": "rust", "repo": "VictorKoenders/advent_of_code_2020", "path": "/src/bin/day6.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Group<'a> { pub fn parse(input: &'a [String]) -> Vec<Self> { let mut groups = Vec::new(); let mut group = Group::default(); for line in input { if line.is_empty() { groups.push(group); group = Default::default(); ...
code_fim
hard
{ "lang": "rust", "repo": "VictorKoenders/advent_of_code_2020", "path": "/src/bin/day6.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: michaelwoerister/dibs path: /examples/hashtable_stress_test.rs extern crate dibs; extern crate rand; use dibs::*; use rand::{thread_rng, random, Rng}; use std::collections::HashMap; fn main() { let memory = create_memory(); let mut reference = HashMap::new(); let mut table: HashT...
code_fim
hard
{ "lang": "rust", "repo": "michaelwoerister/dibs", "path": "/examples/hashtable_stress_test.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if (iteration + 1) % 50000 == 0 { println!("tested {} operations, table size = {}", iteration + 1, table.len()); } if table.len() >= next_table_size_to_report { println!("table size = {}", table.len()); next_table_size_to_report += 100; ...
code_fim
hard
{ "lang": "rust", "repo": "michaelwoerister/dibs", "path": "/examples/hashtable_stress_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(reference, data); if (iteration + 1) % 50000 == 0 { println!("tested {} operations, table size = {}", iteration + 1, table.len()); } if table.len() >= next_table_size_to_report { println!("table size = {}", table.len()); next...
code_fim
hard
{ "lang": "rust", "repo": "michaelwoerister/dibs", "path": "/examples/hashtable_stress_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: linkerd/linkerd2-proxy path: /linkerd/app/inbound/src/policy/defaults.rs use linkerd_app_core::{IpNet, Ipv4Net, Ipv6Net}; use linkerd_proxy_server_policy::{ authz::Suffix, http, Authentication, Authorization, Meta, Protocol, ServerPolicy, }; use std::{sync::Arc, time::Duration}; pub fn all_...
code_fim
hard
{ "lang": "rust", "repo": "linkerd/linkerd2-proxy", "path": "/linkerd/app/inbound/src/policy/defaults.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> vec![Ipv4Net::default().into(), Ipv6Net::default().into()].into_iter() } fn authenticated() -> Authentication { Authentication::TlsAuthenticated { identities: Default::default(), suffixes: vec![Suffix::from(vec![])], } } fn mk( name: &'static str, nets: impl IntoItera...
code_fim
hard
{ "lang": "rust", "repo": "linkerd/linkerd2-proxy", "path": "/linkerd/app/inbound/src/policy/defaults.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let bot = if trace_settings.is_empty() { Bot::from_env().erase() } else { Bot::from_env().trace(trace_settings).erase() }; bot.send_chat_action(chat_id, ChatAction::Typing).await?; tokio::time::sleep(Duration::from_secs(1)).await; bot.send_message(chat_id, "Hey hey...
code_fim
hard
{ "lang": "rust", "repo": "teloxide/teloxide", "path": "/crates/teloxide-core/examples/erased.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: teloxide/teloxide path: /crates/teloxide-core/examples/erased.rs use std::{env::VarError, time::Duration}; use teloxide_core::{adaptors::trace, prelude::*, types::ChatAction}; #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { pretty_env_logger::init(); let cha...
code_fim
hard
{ "lang": "rust", "repo": "teloxide/teloxide", "path": "/crates/teloxide-core/examples/erased.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[post("/post/<id>/publish")] pub fn publish(db: DB, id: i32) -> JSON<Value> { let post = post::publish(db.conn(), id); match post { Ok(_) => JSON(json!({ "status": "ok", "id": id })), Err(Error::RecordNotFound) => JSON(json!({ "status": "error", "description": "not found" })), ...
code_fim
hard
{ "lang": "rust", "repo": "solarsail/planetmeow-rs", "path": "/src/handlers/post.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: solarsail/planetmeow-rs path: /src/handlers/post.rs use rocket_contrib::{ JSON, Value }; use models::Post; use db::{DB, post, Error}; #[get("/post")] pub fn get_all(db: DB) -> JSON<Vec<Post>> { JSON(post::get_published(db.conn(), None)) } #[get("/post/<id>")] pub fn get(db: DB, id: i32)...
code_fim
hard
{ "lang": "rust", "repo": "solarsail/planetmeow-rs", "path": "/src/handlers/post.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saibatizoku/benita path: /benita-ezo/src/temperature/device/mod.rs //! EZO RTD submersible temperature sensor. Command-API for the EZO RTD chipset. use std::cell::RefCell; use std::fmt; use super::command::*; use super::response::*; use super::TemperatureAPI; use common_ezo::EzoChipAPI; use co...
code_fim
hard
{ "lang": "rust", "repo": "saibatizoku/benita", "path": "/benita-ezo/src/temperature/device/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let reading = MemoryRecall .run(&mut self.i2cdev.borrow_mut()) .context(ErrorKind::SensorTrouble)?; Ok(reading) } /// Recall the last memory reading on the stack. fn get_memory_recall_last(&self) -> Result<MemoryReading> { let reading = MemoryRe...
code_fim
hard
{ "lang": "rust", "repo": "saibatizoku/benita", "path": "/benita-ezo/src/temperature/device/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Set the current temperature scale to Fahrenheit. fn set_scale_to_fahrenheit(&self) -> Result<ReplyStatus> { let _set = ScaleFahrenheit .run(&mut self.i2cdev.borrow_mut()) .context(ErrorKind::SensorTrouble)?; Ok(ReplyStatus::Ok) } /// Set the cur...
code_fim
hard
{ "lang": "rust", "repo": "saibatizoku/benita", "path": "/benita-ezo/src/temperature/device/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let node_id = unit_id_to_node_id(self.id); let node = scene.nodes.get_mut(&node_id).unwrap(); node.pos = self.move_helper.step(dtime); } fn end(&mut self, _: &mut Scene, _: &GameState) {} } pub struct MoveHelper { to: WorldPos, current: WorldPos, dist: MFloat,...
code_fim
hard
{ "lang": "rust", "repo": "ozkriff/marauder", "path": "/src/visualizer/event_visualizer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn next_waypoint(&self) -> WorldPos { assert!(self.path.len() >= 2); self.path[1] } } pub struct EventEndTurnVisualizer; impl EventEndTurnVisualizer { pub fn new() -> Box<dyn EventVisualizer> { Box::new(EventEndTurnVisualizer) } } impl EventVisualizer for EventEn...
code_fim
hard
{ "lang": "rust", "repo": "ozkriff/marauder", "path": "/src/visualizer/event_visualizer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ozkriff/marauder path: /src/visualizer/event_visualizer.rs // See LICENSE file for copyright and license details. use crate::core::core::{Core, UnitTypeId}; use crate::core::game_state::GameState; use crate::core::types::{MapPos, UnitId}; use crate::visualizer::geom; use crate::visualizer::mesh...
code_fim
hard
{ "lang": "rust", "repo": "ozkriff/marauder", "path": "/src/visualizer/event_visualizer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> engine.add_system_with_name("Camera System", &fps_camera_system); engine.add_system_with_name("GUI System", &octree_gui_system); engine.add_system_with_name("Octree System", &octree_sys); engine.add_system_with_name("Render System", &render_system); // add camera let camera = Enti...
code_fim
hard
{ "lang": "rust", "repo": "ifl0w/Voxel-Fractals", "path": "/examples/fractals.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ifl0w/Voxel-Fractals path: /examples/fractals.rs use cgmath::{Deg, Euler, Quaternion, vec3}; use nse; use nse::core::Entity; use nse::NSE; use nse::rendering::{Camera, Cube, Mesh, Octree, OctreeConfig, OctreeGuiSystem, OctreeSystem, RenderSystem, Transformation}; use crate::shared::fps_camera_...
code_fim
hard
{ "lang": "rust", "repo": "ifl0w/Voxel-Fractals", "path": "/examples/fractals.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub mod shared; fn main() { let mut engine: NSE = NSE::new(); let render_system = RenderSystem::new(&engine); let fps_camera_system = FPSCameraSystem::new(); fps_camera_system.lock().unwrap().set_mouse_speed(2.0); fps_camera_system.lock().unwrap().set_movement_speed(1.0); let oc...
code_fim
medium
{ "lang": "rust", "repo": "ifl0w/Voxel-Fractals", "path": "/examples/fractals.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.remaining.extend_from_slice(&buffer[0 .. bytes_read]); self.remaining.reverse(); } } pub fn read(&mut self, stream: &mut TcpStream) -> Result<Selector, ProtocolError> { let mut selector_builder = SelectorBuilder::new(self.max_line_len); while ...
code_fim
hard
{ "lang": "rust", "repo": "FROG-TIPS/frog_gopher", "path": "/src/protocol.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.state = new_state; if token.is_some() { return Ok(token); } } let mut buffer = [0; READ_BUFFER_SIZE]; let bytes_read = try!(stream.read(&mut buffer)); // Just stop trying already ...
code_fim
hard
{ "lang": "rust", "repo": "FROG-TIPS/frog_gopher", "path": "/src/protocol.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FROG-TIPS/frog_gopher path: /src/protocol.rs use std::io; use std::io::{Read,Write}; use std::net::TcpStream; use std::string::FromUtf8Error; use std::error; use std::fmt; use hyper::Url; #[derive(Clone,Debug,Eq,PartialEq)] pub struct Path { val: String, // Additional crap extra:...
code_fim
hard
{ "lang": "rust", "repo": "FROG-TIPS/frog_gopher", "path": "/src/protocol.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let page_size = *PAGE_SIZE.get_or_init(|| unsafe { sysconf(_SC_PAGESIZE) as usize }); let buffer_size = int_div_ceil(source.len(), page_size); unsafe { libc::posix_memalign(buffer_ptr, page_size, buffer_size); libc::mprotect( *buffer_ptr, ...
code_fim
hard
{ "lang": "rust", "repo": "danthedaniel/BF-JIT", "path": "/src/runnable/jit/jit_helpers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danthedaniel/BF-JIT path: /src/runnable/jit/jit_helpers.rs use super::code_gen; use super::immutable::Immutable; use std::mem; use std::sync::OnceLock; use libc::{sysconf, _SC_PAGESIZE}; const PAGE_SIZE: OnceLock<usize> = OnceLock::new(); /// Round up an integer division. /// /// * `numerato...
code_fim
medium
{ "lang": "rust", "repo": "danthedaniel/BF-JIT", "path": "/src/runnable/jit/jit_helpers.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { libc::posix_memalign(buffer_ptr, page_size, buffer_size); libc::mprotect( *buffer_ptr, buffer_size, libc::PROT_EXEC | libc::PROT_WRITE | libc::PROT_READ, ); // for now, prepopulate with 'RET' ...
code_fim
hard
{ "lang": "rust", "repo": "danthedaniel/BF-JIT", "path": "/src/runnable/jit/jit_helpers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jkelleyrtp/yew-projects path: /packages/yew-recoil/src/hooks.rs use crate::readable::{AtomValue, Readable}; use std::rc::Rc; // Re-exports pub type UseRecoilStateOutput<T> = (Rc<T>, Rc<dyn Fn(T)>); pub fn use_recoil_state<T: AtomValue + 'static>( atom: &'static impl Readable<Output = T>, ...
code_fim
hard
{ "lang": "rust", "repo": "jkelleyrtp/yew-projects", "path": "/packages/yew-recoil/src/hooks.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> struct UseRecoilState<T: AtomValue + 'static> { recoil_scope: Scope<RecoilRoot>, callback: Option<Rc<Box<dyn Fn(UpdateAction<T>)>>>, atom: &'static Atom<T>, hook_id: uuid::Uuid, pub current_value: Rc<T>, } #[derive(Debug)] // Hooks can be updated fr...
code_fim
hard
{ "lang": "rust", "repo": "jkelleyrtp/yew-projects", "path": "/packages/yew-recoil/src/hooks.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gulbrand/learning-rust path: /src/bin/ch1_1_2.rs // Check Permutation // Given two strings, write a method to decide if one is a permutation of the other. // first crack: map // if they contain the same characters and counts of each, it is a permutation of the other. #[allow(dead_code)] fn i...
code_fim
medium
{ "lang": "rust", "repo": "gulbrand/learning-rust", "path": "/src/bin/ch1_1_2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(dead_code)] #[cfg(test)] fn test_that_empty_is_true() { let candidate1 = ""; let candidate2 = ""; assert_eq!(is_permutation(candidate1, candidate2), true); } } fn main() { println!("hello"); }<|fim_prefix|>// repo: gulbrand/learning-rust path: /src/bin...
code_fim
medium
{ "lang": "rust", "repo": "gulbrand/learning-rust", "path": "/src/bin/ch1_1_2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Asks for the user to select an item of the menu with a cancel option. pub async fn select_with_cancel( &self, term: &terminal::Handle, ) -> Result<Option<usize>> { self.select_with_cancel_and_initial(term, Some(0)).await } /// Asks for the user to select an...
code_fim
hard
{ "lang": "rust", "repo": "brunoczim/thedes", "path": "/src/ui/menu.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brunoczim/thedes path: /src/ui/menu.rs use crate::{ error::Result, graphics::{BasicColor, Color, Color2, GString, Grapheme, Style}, input::{Event, Key, KeyEvent}, math::plane::{Coord2, Nat}, terminal, }; use std::ops::Range; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub s...
code_fim
hard
{ "lang": "rust", "repo": "brunoczim/thedes", "path": "/src/ui/menu.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn range_of_screen( &self, start: usize, screen_size: Coord2<Nat>, cancel: bool, ) -> Range<usize> { start .. self.screen_end(start, screen_size, cancel) } async fn render( &self, term: &terminal::Handle, start: usize, ...
code_fim
hard
{ "lang": "rust", "repo": "brunoczim/thedes", "path": "/src/ui/menu.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// A [`Client`](../../struct.Client.html) will call this method on each registered handler /// whenever a connection is closed. fn handle_connection_closed_event(&self, _event: ConnectionClosedEvent) {} /// A [`Client`](../../struct.Client.html) will call this method on each registered h...
code_fim
hard
{ "lang": "rust", "repo": "saghm/mongo-rust-driver", "path": "/src/event/cmap.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saghm/mongo-rust-driver path: /src/event/cmap.rs //! Contains the events and functionality for monitoring behavior of the connection pooling of a //! `Client`. use serde::Deserialize; pub use crate::cmap::options::ConnectionPoolOptions; use crate::options::StreamAddress; /// We implement `Des...
code_fim
hard
{ "lang": "rust", "repo": "saghm/mongo-rust-driver", "path": "/src/event/cmap.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Applications can implement this trait to specify custom logic to run on each CMAP event sent /// by the driver. /// /// ```rust /// # use std::sync::Arc; /// # /// # use mongodb::{ /// # error::Result, /// # event::cmap::{ /// # CmapEventHandler, /// # ConnectionCheckoutFailedE...
code_fim
hard
{ "lang": "rust", "repo": "saghm/mongo-rust-driver", "path": "/src/event/cmap.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: standardgalactic/toornament-rs path: /examples/workflow.rs use chrono::offset::Utc; use toornament::*; fn workflow() -> Result<()> { let tournament_website = Some("https://toornament.com/".to_owned()); let toornament = Toornament::with_application("API_TOKEN", "CLIENT_ID", "CLI...
code_fim
hard
{ "lang": "rust", "repo": "standardgalactic/toornament-rs", "path": "/examples/workflow.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "fancy")] fn fancy_workflow() -> Result<()> { let toornament = Toornament::with_application("API_TOKEN", "CLIENT_ID", "CLIENT_SECRET")?.timeout(5); let tournament_id = TournamentId("1".to_owned()); let tournament = Tournament::with_id(tournament_id.clone(), false)?; ...
code_fim
hard
{ "lang": "rust", "repo": "standardgalactic/toornament-rs", "path": "/examples/workflow.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Get matches println!( "My matches: {:?}\n", toornament.matches(tournament.id.clone().unwrap(), None, true) ); // Deleting our tournament println!( "Deleted tournament: {:?}\n", toornament.delete_tournament(tournament.id.unwrap()) ); Ok(()) }...
code_fim
hard
{ "lang": "rust", "repo": "standardgalactic/toornament-rs", "path": "/examples/workflow.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: loalang/loalang path: /src/lib/vm/const_value.rs use crate::vm::*; use crate::*; use fraction::BigFraction; use num_bigint::{BigInt, BigUint}; #[derive(Debug, Clone)] pub enum ConstValue { Nothing, InstanceVariables(HashMap<u64, Arc<Object>>), String(String), Lazy(u64, CallStack...
code_fim
hard
{ "lang": "rust", "repo": "loalang/loalang", "path": "/src/lib/vm/const_value.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Into<i128> for ConstValue { fn into(self) -> i128 { if let ConstValue::I128(v) = self { v } else { panic!("failed to unbox") } } } impl From<BigInt> for ConstValue { fn from(v: BigInt) -> Self { ConstValue::IBig(v) } } impl Int...
code_fim
hard
{ "lang": "rust", "repo": "loalang/loalang", "path": "/src/lib/vm/const_value.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: m-labs/dslite2svd path: /crates/tm4c129x/src/usb0/ulpivbusctl.rs #[doc = "Reader of register ULPIVBUSCTL"] pub type R = crate::R<u8, super::ULPIVBUSCTL>; #[doc = "Writer for register ULPIVBUSCTL"] pub type W = crate::W<u8, super::ULPIVBUSCTL>; #[doc = "Register ULPIVBUSCTL `reset()`'s with value...
code_fim
hard
{ "lang": "rust", "repo": "m-labs/dslite2svd", "path": "/crates/tm4c129x/src/usb0/ulpivbusctl.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> w: &'a mut W, } impl<'a> USEEXTVBUSIND_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } ...
code_fim
hard
{ "lang": "rust", "repo": "m-labs/dslite2svd", "path": "/crates/tm4c129x/src/usb0/ulpivbusctl.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AcrylicShrimp/piped path: /src/runtime/builtins/variables/variable_host_arch.rs #[cfg(target_arch = "x86")] define_variable!("hostArch", Value::String("x86".to_owned())); <|fim_suffix|>#[cfg(target_arch = "arm")] define_variable!("hostArch", Value::String("arm".to_owned()));<|fim_middle|>#[cfg(...
code_fim
medium
{ "lang": "rust", "repo": "AcrylicShrimp/piped", "path": "/src/runtime/builtins/variables/variable_host_arch.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(target_arch = "arm")] define_variable!("hostArch", Value::String("arm".to_owned()));<|fim_prefix|>// repo: AcrylicShrimp/piped path: /src/runtime/builtins/variables/variable_host_arch.rs #[cfg(target_arch = "x86")] define_variable!("hostArch", Value::String("x86".to_owned())); <|fim_middle|>#[cfg(...
code_fim
medium
{ "lang": "rust", "repo": "AcrylicShrimp/piped", "path": "/src/runtime/builtins/variables/variable_host_arch.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn done() { print!("===[ DONE ]====> "); print_color( "Finished Assembling".to_string(), Some(MAGENTA), None ); println!(""); } #[allow(dead_code)] pub fn warn(s: &str) { print!("===[ WARN ]====> "); print_color( format!("{}", s), Some...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/finn-assembler", "path": "/src/stdout.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(dead_code)] pub fn warn(s: &str) { print!("===[ WARN ]====> "); print_color( format!("{}", s), Some(YELLOW), None ); println!(""); } #[allow(dead_code)] pub fn sub_warn(s: &str) { print!("\t└─> "); print_color( format!("{}", s), So...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/finn-assembler", "path": "/src/stdout.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/finn-assembler path: /src/stdout.rs extern crate term; use std::io::prelude::*; use term::stdout; use term::color::*; fn print_color(s: String, fg: Option<Color>, bg: Option<Color>) { let mut t = stdout(); match &mut t { Some(k) => { match fg { ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/finn-assembler", "path": "/src/stdout.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lukazoid/lz_quic path: /src/stream_state.rs use bytes::Bytes; use conv::{ConvUtil, ValueInto}; use errors::*; use futures::{Async, Poll}; use protocol::{FlowControl, StreamId, StreamOffset}; use std::collections::VecDeque; use std::mem; use utils::DataQueue; #[derive(Debug)] pub enum DequeueWri...
code_fim
hard
{ "lang": "rust", "repo": "Lukazoid/lz_quic", "path": "/src/stream_state.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn enqueue_write( &mut self, buf: Bytes, connection_outgoing_flow_control: &mut FlowControl, ) -> usize { let bytes_to_enqueue = if let Some(outgoing_flow_control) = &mut self.outgoing_flow_control { FlowControl::take( outgoin...
code_fim
hard
{ "lang": "rust", "repo": "Lukazoid/lz_quic", "path": "/src/stream_state.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> DequeueWriteResult::DequeuedWrite { offset, data, finished: self.pending_outgoing_data.is_empty() && self.has_all_outgoing_data, } } else { DequeueWriteResult::NotReady } } pub fn poll_read(&mut se...
code_fim
hard
{ "lang": "rust", "repo": "Lukazoid/lz_quic", "path": "/src/stream_state.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ing(), }; println!("Whole euros: {:?}", whole_euros); println!("Floating euros: {:?}", floating_euros); }<|fim_prefix|>// repo: byteshiva/rust-kickstart path: /src/libs/generics/generic_struct_01.rs // generic-struct.rs #[derive(Debug)] #[allow(dead_code)] struct Money<T> { amount: T, ...
code_fim
hard
{ "lang": "rust", "repo": "byteshiva/rust-kickstart", "path": "/src/libs/generics/generic_struct_01.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: byteshiva/rust-kickstart path: /src/libs/generics/generic_struct_01.rs // generic-struct.rs #[derive(Debug)] #[allow(dead_code)] struct Money<T> { amount: T, currency: String, } p<|fim_suffix|>string(), }; let floating_euros: Money<f32> = Money { amount: 24.312, c...
code_fim
medium
{ "lang": "rust", "repo": "byteshiva/rust-kickstart", "path": "/src/libs/generics/generic_struct_01.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs #![feature(re_rebalance_coherence)] <|fim_suffix|>extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; struct Local; impl<T> Remote2<Rc<T>, Local> for usize { } fn main() {...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>struct Local; impl<T> Remote2<Rc<T>, Local> for usize { } fn main() {}<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs #![feature(re_rebalance_coherence)] // check-pass // compile-flags:--crate-name=test // aux-build:co...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>extern crate coherence_lib as lib; use lib::*; use std::rc::Rc; struct Local; impl<T> Remote2<Rc<T>, Local> for usize { } fn main() {}<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs #![feature(re_rebalance_coherence)] ...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/coherence/impl[t]-foreign[foreign[t]_local]-for-foreign.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prisma/prisma-engines path: /schema-engine/sql-migration-tests/tests/migrations/indexes/postgres/gist.rs use sql_migration_tests::test_api::*; use sql_schema_describer::postgres::{SQLOperatorClassKind, SqlIndexAlgorithm}; #[test_connector(tags(Postgres), exclude(CockroachDb))] fn gist_change_fr...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/schema-engine/sql-migration-tests/tests/migrations/indexes/postgres/gist.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> api.schema_push_w_datasource(dm).send().assert_green(); api.assert_schema().assert_table("A", |table| { table .assert_has_column("data") .assert_index_on_columns(&["data"], |idx| { idx.assert_algorithm(SqlIndexAlgorithm::Gist) .a...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/schema-engine/sql-migration-tests/tests/migrations/indexes/postgres/gist.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>on; pub mod vision_service; pub mod zwave_commands;<|fim_prefix|>// repo: kai5263499/matrix-protos-rust path: /src/protos/mod.rs pub mod comm; pub mod driver; pub mod entity; pub mod io; pub mod maloseye; pub mod recognition_servic<|fim_middle|>e; pub mod recognition; pub mod sense; pub mod visi
code_fim
easy
{ "lang": "rust", "repo": "kai5263499/matrix-protos-rust", "path": "/src/protos/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kai5263499/matrix-protos-rust path: /src/protos/mod.rs pub mod comm; pub mod driver; pub mod entity; pub m<|fim_suffix|>e; pub mod recognition; pub mod sense; pub mod vision; pub mod vision_service; pub mod zwave_commands;<|fim_middle|>od io; pub mod maloseye; pub mod recognition_servic
code_fim
easy
{ "lang": "rust", "repo": "kai5263499/matrix-protos-rust", "path": "/src/protos/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>e; pub mod recognition; pub mod sense; pub mod vision; pub mod vision_service; pub mod zwave_commands;<|fim_prefix|>// repo: kai5263499/matrix-protos-rust path: /src/protos/mod.rs pub mod comm; pub mod driver; pub mod entity; pub m<|fim_middle|>od io; pub mod maloseye; pub mod recognition_servic
code_fim
easy
{ "lang": "rust", "repo": "kai5263499/matrix-protos-rust", "path": "/src/protos/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub enum ClubMoodState { Poor, Normal, Good, Excellent, }<|fim_prefix|>// repo: ZaoIsmael/football path: /src/club/mood.rs #[derive(Debug)] pub struct ClubMood { pub state: ClubMoodState, } <|fim_middle|>impl ClubMood { pub fn default() -> Self { ClubMood...
code_fim
medium
{ "lang": "rust", "repo": "ZaoIsmael/football", "path": "/src/club/mood.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZaoIsmael/football path: /src/club/mood.rs #[derive(Debug)] pub struct ClubMood { pub state: ClubMoodState, } <|fim_suffix|>#[derive(Debug)] pub enum ClubMoodState { Poor, Normal, Good, Excellent, }<|fim_middle|>impl ClubMood { pub fn default() -> Self { ClubMood...
code_fim
medium
{ "lang": "rust", "repo": "ZaoIsmael/football", "path": "/src/club/mood.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lichang-lab/token-core path: /tcx-primitive/src/secp256k1.rs n() != 78 { return Err(InvalidLength(data.len()).into()); } let cn_int: u32 = BigEndian::read_u32(&data[9..13]); let child_number: ChildNumber = ChildNumber::from(cn_int); let network = Net...
code_fim
hard
{ "lang": "rust", "repo": "lichang-lab/token-core", "path": "/tcx-primitive/src/secp256k1.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lichang-lab/token-core path: /tcx-primitive/src/secp256k1.rs mut ret = [0; 78]; ret[0..4].copy_from_slice(&self.network[..]); ret[4] = self.extended_priv_key.depth as u8; ret[5..9].copy_from_slice(&self.extended_priv_key.parent_fingerprint[..]); BigEndian::write_...
code_fim
hard
{ "lang": "rust", "repo": "lichang-lab/token-core", "path": "/tcx-primitive/src/secp256k1.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Public(PublicType::ExtendedPubKey( ArbitraryNetworkExtendedPubKey { network: r.network, extended_pub_key: pub_key, }, ))) } PrivateType::PrivateKey(_) => Err(C...
code_fim
hard
{ "lang": "rust", "repo": "lichang-lab/token-core", "path": "/tcx-primitive/src/secp256k1.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>[x] #[y] t); struct s (#[x] #[y] t, #[z] t2); struct s;<|fim_prefix|>// repo: ptgreen/rust-grammar path: /test/struct.rs struct s<t> { a: t } struct s { a: t, b: t2, c: t3, } <|fim_middle|>struct s { #[x] #[y] a: t, #[z] b: t2 } struct s; struct s (t); struct s<t, t2, t3> (t, t2, t3,); struct s (#
code_fim
medium
{ "lang": "rust", "repo": "ptgreen/rust-grammar", "path": "/test/struct.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ptgreen/rust-grammar path: /test/struct.rs struct s<t> { a: t } struct s { a: t, b: t2, c: t3, } struct s { #[x] #[y] a: t, #[z] b: t2 } struct s; struc<|fim_suffix|>[x] #[y] t); struct s (#[x] #[y] t, #[z] t2); struct s;<|fim_middle|>t s (t); struct s<t, t2, t3> (t, t2, t3,); struct s (#
code_fim
easy
{ "lang": "rust", "repo": "ptgreen/rust-grammar", "path": "/test/struct.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t s (t); struct s<t, t2, t3> (t, t2, t3,); struct s (#[x] #[y] t); struct s (#[x] #[y] t, #[z] t2); struct s;<|fim_prefix|>// repo: ptgreen/rust-grammar path: /test/struct.rs struct s<t> { a: t } struct s { a: t, b: t2, c: t3, } <|fim_middle|>struct s { #[x] #[y] a: t, #[z] b: t2 } struct s; struc
code_fim
easy
{ "lang": "rust", "repo": "ptgreen/rust-grammar", "path": "/test/struct.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let score_id = match reader.read_u64::<LittleEndian>()? { 0 => None, v => Some(v), }; let target_practice_total_accuracy = if mods.contains(Mods::TargetPractice) { Some(reader.read_f64::<LittleEndian>()?) } else { None ...
code_fim
hard
{ "lang": "rust", "repo": "iptq/libosu", "path": "/src/replay/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iptq/libosu path: /src/replay/mod.rs //! Data structures for reading and writing replays //! //! The main focus of this module is the [`Replay`][self::Replay] struct, which contains functions //! for opening and writing *.osr files. //! //! Read more about the *.osr data format on the [OSU wiki]...
code_fim
hard
{ "lang": "rust", "repo": "iptq/libosu", "path": "/src/replay/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Replay { mode, version, beatmap_hash, player_username, replay_hash, count_300, count_100, count_50, count_geki, count_katu, count_miss, score, ...
code_fim
hard
{ "lang": "rust", "repo": "iptq/libosu", "path": "/src/replay/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andoriyu/material-design-icons-rs path: /src/materialiconsoutlined/maps/icon_directions_boat_filled.rs pub struct IconDirectionsBoatFilled { props: crate::Props, } impl yew::Component for IconDirectionsBoatFilled { type Properties = crate::Props; type Message = (); fn create(props:...
code_fim
hard
{ "lang": "rust", "repo": "andoriyu/material-design-icons-rs", "path": "/src/materialiconsoutlined/maps/icon_directions_boat_filled.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub struct GameOverPlugin; impl GameOverPlugin { pub fn add_systems(builder: &mut StateSetBuilder<AppState>) { builder .add_on_enter(AppState::GameOver, setup_system.system()) .add_on_exit(AppState::GameOver, cleanup_system.system()); } } impl Plugin for GameOverP...
code_fim
medium
{ "lang": "rust", "repo": "TheRawMeatball/drone_attack", "path": "/src/game_over/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheRawMeatball/drone_attack path: /src/game_over/mod.rs mod components; mod resources; mod systems; use bevy::{ecs::StateSetBuilder, prelude::*}; <|fim_suffix|>impl GameOverPlugin { pub fn add_systems(builder: &mut StateSetBuilder<AppState>) { builder .add_on_enter(AppS...
code_fim
medium
{ "lang": "rust", "repo": "TheRawMeatball/drone_attack", "path": "/src/game_over/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }