text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: 0o-de-lally/rustSTARK path: /src/example_proof.rs ARAMETERS: &str = r#" {"stark":{"fri":{"fri_step_list":[1,2,2],"last_layer_degree_bound":1,"n_queries":30,"proof_of_work_bits":20},"log_n_cosets":2}} "#; #[allow(dead_code)] pub const PUBLIC_INPUT: &str = r#" {"chain_length":3,"output...
code_fim
hard
{ "lang": "rust", "repo": "0o-de-lally/rustSTARK", "path": "/src/example_proof.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>8df789e8a4d680eaed5df2c48cf9c0272d9be9eff9eb704aa3c63cb2653160cb11a26df3d806f0fb0ade635e6847205c80cb18d9ee9df007fded7c432cade1b7a92f87e2d2ab11e03e2ce14f8f190042b3c3fa45655a114d066b875168c89054900f176f74c2e09bb626fec6320e90cdd8c804dad74d1140d202b9e30ac01094b15533d38f4c3133cd66eb5aacb2b1027658d32154fac1c259...
code_fim
hard
{ "lang": "rust", "repo": "0o-de-lally/rustSTARK", "path": "/src/example_proof.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JP-Ellis/coding-problems path: /src/daily_coding_problem/p007.rs use crate::{Error, Problem}; use std::collections::HashMap; use std::io::prelude::*; pub struct P; const STATEMENT: &str = r#"Given the mapping `a = 1`, `b = 2`, ... `z = 26`, and an encoded message, count the number of ways it c...
code_fim
hard
{ "lang": "rust", "repo": "JP-Ellis/coding-problems", "path": "/src/daily_coding_problem/p007.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn solve(&self, out: &mut dyn Write) -> Result<(), Error> { let map = [ ("1", "a"), ("2", "b"), ("3", "c"), ("4", "d"), ("5", "e"), ("6", "f"), ("7", "g"), ("8", "h"), ("9", "i"), ...
code_fim
hard
{ "lang": "rust", "repo": "JP-Ellis/coding-problems", "path": "/src/daily_coding_problem/p007.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "Daily Coding Problem 7" } fn statement(&self) -> &str { STATEMENT } fn solve(&self, out: &mut dyn Write) -> Result<(), Error> { let map = [ ("1", "a"), ("2", "b"), ("3", "c"), ("4", "d"), ("5", "e"), ...
code_fim
hard
{ "lang": "rust", "repo": "JP-Ellis/coding-problems", "path": "/src/daily_coding_problem/p007.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: charles1303/rust_api path: /src/lib.rs #![recursion_limit="128"] #[macro_use(bson, doc)] extern crate bson; extern crate mongodb; extern crate rustc_serialize; #[macro_use] extern crate serde_derive; extern crate serde; extern crate serde_json; extern crate dotenv; <|fim_suffix|>pub mod da...
code_fim
hard
{ "lang": "rust", "repo": "charles1303/rust_api", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[macro_use] extern crate diesel; #[macro_use] extern crate diesel_infer_schema; extern crate r2d2; extern crate r2d2_diesel; #[macro_use] extern crate lazy_static; /*#[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }*/ pub mod dao; pub mod model; pub mod...
code_fim
medium
{ "lang": "rust", "repo": "charles1303/rust_api", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /*#[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } }*/ pub mod dao; pub mod model; pub mod service; pub mod controller;<|fim_prefix|>// repo: charles1303/rust_api path: /src/lib.rs #![recursion_limit="128"] #[macro_use(bson, doc)] extern crate bson; exter...
code_fim
medium
{ "lang": "rust", "repo": "charles1303/rust_api", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (y == y_len) { y -= 1; } (x, y) } } impl fmt::Debug for ThermoWorld { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { for t_x in 0..self.thermo_grid.len() { write!(f, "\n"); for t_y in 0..self.thermo...
code_fim
hard
{ "lang": "rust", "repo": "revsolid/polyminis-core", "path": "/src/thermal.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut y = if position.1 >= 0.0 { (position.1 / dims.1).floor() as usize * y_len } else { 0 }; if (y == y_len) { y -= 1; } (x, y) } } impl fmt...
code_fim
hard
{ "lang": "rust", "repo": "revsolid/polyminis-core", "path": "/src/thermal.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: revsolid/polyminis-core path: /src/thermal.rs use ::actuators::*; use ::serialization::*; use ::uuid::PUUID; use std::collections::HashMap; use std::fmt; use std::f32; // Temperature Tracker for Polyminis struct ThermoActionAccum { } pub struct Thermo { uuid: PUUID, max: f32, ...
code_fim
hard
{ "lang": "rust", "repo": "revsolid/polyminis-core", "path": "/src/thermal.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: barnex/hamstr-game path: /src/game/mod.rs pub mod gamestate; pub mod hamster; pub mod<|fim_suffix|>terface; pub mod texture; pub mod viewport;<|fim_middle|> key; pub mod leveldata; pub mod map; pub mod palette; pub mod prelude; pub mod sdl_in
code_fim
medium
{ "lang": "rust", "repo": "barnex/hamstr-game", "path": "/src/game/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>od palette; pub mod prelude; pub mod sdl_interface; pub mod texture; pub mod viewport;<|fim_prefix|>// repo: barnex/hamstr-game path: /src/game/mod.rs pub mod gamestate; pub mod hamster; pub mod<|fim_middle|> key; pub mod leveldata; pub mod map; pub m
code_fim
easy
{ "lang": "rust", "repo": "barnex/hamstr-game", "path": "/src/game/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: barnex/hamstr-game path: /src/game/mod.rs pub mod gamestate; pub mod hamster; pub mod key; pub mod leveldata; pub mod map; pub m<|fim_suffix|>terface; pub mod texture; pub mod viewport;<|fim_middle|>od palette; pub mod prelude; pub mod sdl_in
code_fim
easy
{ "lang": "rust", "repo": "barnex/hamstr-game", "path": "/src/game/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oxidecomputer/oxide.rs-old path: /oxide/src/sagas.rs use anyhow::Result; use crate::Client; pub struct Sagas { pub client: Client, } impl Sagas { #[doc(hidden)] pub fn new(client: Client) -> Self { Sagas { client } } /** * List sagas. * * This funct...
code_fim
hard
{ "lang": "rust", "repo": "oxidecomputer/oxide.rs-old", "path": "/oxide/src/sagas.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if !resp.next_page.is_empty() && resp.next_page != page { page = resp.next_page.to_string(); } else { page = "".to_string(); } } // Return our response data. Ok(items) } /** * Fetch a saga. * ...
code_fim
hard
{ "lang": "rust", "repo": "oxidecomputer/oxide.rs-old", "path": "/oxide/src/sagas.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SpecificProtagonist/connect4 path: /src/lib.rs use std::ops::{Index, IndexMut}; use rayon::iter::{IndexedParallelIterator, IntoParallelRefMutIterator, ParallelIterator}; use smallvec::{smallvec, SmallVec}; const COLUMNS: u8 = 7; const ROWS: u8 = 6; const WINNING_LENGTH: u8 = 4; #[derive(Copy,...
code_fim
hard
{ "lang": "rust", "repo": "SpecificProtagonist/connect4", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let state = State( [ [Empty, Empty, Empty, Empty, Empty, Set(X), Empty], [Empty, Empty, Empty, Empty, Empty, Set(X), Empty], [Empty, Empty, Empty, Empty, Empty, Set(O), Empty], [Set(X), Set(O), Empty, Empty, Empty, Set(X), Empty], ...
code_fim
hard
{ "lang": "rust", "repo": "SpecificProtagonist/connect4", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brunoczim/deepfungi path: /digitclass/src/mnist.rs use crate::Result; use std::{ convert::TryInto, error::Error, fmt, fs::File, io::{BufReader, Read, Seek, SeekFrom}, path::Path, }; pub const IMAGES_MAGIC: [u8; 4] = [0, 0, 8, 3]; pub const LABELS_MAGIC: [u8; 4] = [0, 0, ...
code_fim
hard
{ "lang": "rust", "repo": "brunoczim/deepfungi", "path": "/digitclass/src/mnist.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub struct BadLabel; impl fmt::Display for BadLabel { fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result { fmt.write_str("labels must be between 0 and 9") } } impl Error for BadLabel {} #[derive(Debug)] pub struct Image { pub pixels: Box<[u8]>, pub label: u8...
code_fim
hard
{ "lang": "rust", "repo": "brunoczim/deepfungi", "path": "/digitclass/src/mnist.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let in_all_uuid: HashSet<String> = w_out .tx_input_uuid .iter() .map(|tx_uuid| format!("{}", tx_uuid.split('/').next().unwrap_or("????"))) .collect(); let in_active = in_all_uuid.len() - in_cancelled_uuid.len(); let out_cancelled_uuid: HashSet<String> = w_out .tx_output_uuid .ite...
code_fim
hard
{ "lang": "rust", "repo": "mwcproject/mwc-wallet", "path": "/libwallet/src/internal/scan.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mwcproject/mwc-wallet path: /libwallet/src/internal/scan.rs ruth // Because of account transfer we might have 2 transactions with same kernel from the both sides. let mut txkernel_to_txuuid: HashMap<String, Vec<String>> = HashMap::new(); for (tx_uuid, tx) in &mut transactions { if ...
code_fim
hard
{ "lang": "rust", "repo": "mwcproject/mwc-wallet", "path": "/libwallet/src/internal/scan.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let out_cancelled_uuid: HashSet<String> = w_out .tx_output_uuid .iter() .filter(|tx_uuid| { transactions .get(*tx_uuid) .map(|tx| tx.tx_log.is_cancelled()) .unwrap_or(false) }) .map(|tx_uuid| format!("{}", tx_uuid.split('/').next().unwrap_or("????"))) .collect(); ...
code_fim
hard
{ "lang": "rust", "repo": "mwcproject/mwc-wallet", "path": "/libwallet/src/internal/scan.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dsgriffin/nfc path: /src/context.rs use ::ffi; // Internal methods <|fim_suffix|>/// Free NFC context pub fn free(context: *mut ffi::nfc_context) { unsafe { ffi::nfc_context_free(context) } }<|fim_middle|>/// New NFC context pub fn new() -> *mut ffi::nfc_context { unsafe { ffi::nfc_con...
code_fim
medium
{ "lang": "rust", "repo": "dsgriffin/nfc", "path": "/src/context.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Free NFC context pub fn free(context: *mut ffi::nfc_context) { unsafe { ffi::nfc_context_free(context) } }<|fim_prefix|>// repo: dsgriffin/nfc path: /src/context.rs use ::ffi; // Internal methods <|fim_middle|>/// New NFC context pub fn new() -> *mut ffi::nfc_context { unsafe { ffi::nfc_con...
code_fim
medium
{ "lang": "rust", "repo": "dsgriffin/nfc", "path": "/src/context.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PoorlyDefinedBehaviour/data-structures-and-algorithms path: /rust/algorithms/others/group_anagrams/main.rs //! 49. Group Anagrams //! //! Given an array of strings strs, group the anagrams together. You can return the answer in any order. //! //! An Anagram is a word or phrase formed by rearrang...
code_fim
medium
{ "lang": "rust", "repo": "PoorlyDefinedBehaviour/data-structures-and-algorithms", "path": "/rust/algorithms/others/group_anagrams/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let anagrams = groups.entry(occurrences).or_insert_with(Vec::new); anagrams.push(s); } groups.into_values().collect() }<|fim_prefix|>// repo: PoorlyDefinedBehaviour/data-structures-and-algorithms path: /rust/algorithms/others/group_anagrams/main.rs //! 49. Group Anagrams //! //!...
code_fim
hard
{ "lang": "rust", "repo": "PoorlyDefinedBehaviour/data-structures-and-algorithms", "path": "/rust/algorithms/others/group_anagrams/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for ascii_character in s_ascii { occurrences[(ascii_character - 97) as usize] += 1; } let anagrams = groups.entry(occurrences).or_insert_with(Vec::new); anagrams.push(s); } groups.into_values().collect() }<|fim_prefix|>// repo: PoorlyDefinedBehaviour/...
code_fim
medium
{ "lang": "rust", "repo": "PoorlyDefinedBehaviour/data-structures-and-algorithms", "path": "/rust/algorithms/others/group_anagrams/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub mod geometry; mod map; mod road; mod turn; pub use geometry::angles::{Radian, RAD}; pub use map::GeomMap; pub use road::GeomRoad; pub use turn::GeomTurn; pub const LANE_THICKNESS: f64 = 2.5; pub const BIG_ARROW_THICKNESS: f64 = 0.5; pub const TURN_DIST_FROM_INTERSECTION: f64 = 7.5;<|fim_prefix|>// r...
code_fim
medium
{ "lang": "rust", "repo": "zhuzhe1983/abstreet", "path": "/geom/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zhuzhe1983/abstreet path: /geom/src/lib.rs // Copyright 2018 Google LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/L...
code_fim
medium
{ "lang": "rust", "repo": "zhuzhe1983/abstreet", "path": "/geom/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thmeek1/CS_370_resources path: /krealings_code/rust_intro/basic/tuple.rs fn main() { // Tuples are fixed-size containers that can hold multiple data types let mut tuple = (1, 2.0, "three", false); <|fim_suffix|> // You have to use "debug formatting" to print a tuple println!("\nT...
code_fim
medium
{ "lang": "rust", "repo": "thmeek1/CS_370_resources", "path": "/krealings_code/rust_intro/basic/tuple.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // You can "destructure" a tuple let (first, second, third, fourth) = tuple; println!(" Destructure a tuple "); println!("\t{} --- {} --- {} --- {}\n", first, second, third, fourth); }<|fim_prefix|>// repo: thmeek1/CS_370_resources path: /krealings_code/rust_intro/basic/tuple.rs fn main...
code_fim
medium
{ "lang": "rust", "repo": "thmeek1/CS_370_resources", "path": "/krealings_code/rust_intro/basic/tuple.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaj/rsass path: /rsass/tests/spec/libsass_closed_issues/issue_550/variable/dimension.rs //! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_550/variable/dimension.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { <|fim_suffix|>#[test] fn test() { assert_eq!( ...
code_fim
hard
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/libsass_closed_issues/issue_550/variable/dimension.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( runner().ok("$i1: 10.0001px;\ \n$j1: 10.01px;\ \n$k1: -10.0001px;\ \n$l1: -10.01px;\n\ \n#foo {\ \n i: $i1;\ \n j: $j1;\ \n k: $k1;\ \n l: $l1; }\n\ \n$i2: 0.000...
code_fim
hard
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/libsass_closed_issues/issue_550/variable/dimension.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grahamschock/interview_match path: /src/main.rs use std::error::Error; use std::io; use std::process; use serde::Deserialize; #[derive(Debug, Deserialize)] struct Record { Timestamp: String, First_Name: String, Last_Name: String, Times: String, isStudent: i32, } #[derive(...
code_fim
hard
{ "lang": "rust", "repo": "grahamschock/interview_match", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if record.isStudent == 1 { students.push(student); count+=1; } else { instructors.push(student); } } students.sort_by(|a, b| a.time.len().cmp(&b.time.len())); instructors.sort_by(|a,b| a.time.len().cmp(&b.time.len())); for instr...
code_fim
hard
{ "lang": "rust", "repo": "grahamschock/interview_match", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MetallicSquid/copo path: /src/main.rs use structopt::StructOpt; use failure::ResultExt; use exitfailure::ExitFailure; <|fim_suffix|>fn main() -> Result<(), ExitFailure>{ // Parse through user inputs and flags let args = Cli::from_args(); let work = args.work.trim().parse::<i32>() ...
code_fim
medium
{ "lang": "rust", "repo": "MetallicSquid/copo", "path": "/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Parse through user inputs and flags let args = Cli::from_args(); let work = args.work.trim().parse::<i32>() .with_context(|_| format!("Could not read work duration `{}`", args.work))?; let rest = args.rest.trim().parse::<i32>() .with_context(|_| format!("Could not read r...
code_fim
hard
{ "lang": "rust", "repo": "MetallicSquid/copo", "path": "/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wickerwaka/advent2020 path: /day18/src/main.rs use advent::*; #[derive(Debug, Copy, Clone)] enum Operator { Mul, Add } #[derive(Debug, Clone)] enum Expression { Block(Vec<Expression>), Number(i64), Op(Operator), } #[derive(Debug, Copy, Clone)] enum Eval { Value(i64), ...
code_fim
hard
{ "lang": "rust", "repo": "wickerwaka/advent2020", "path": "/day18/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let input = std::fs::read_to_string("day18/input.txt")?; let mut sum = 0; for line in input.lines() { let expr = Expression::new(line)?; sum += expr.eval(); } println!( "{}", sum ); let mut sum = 0; for line in input.lines() { let expr = Expression::ne...
code_fim
hard
{ "lang": "rust", "repo": "wickerwaka/advent2020", "path": "/day18/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anp/rusl path: /src/string/strchrnul.rs use super::{has_zero, ONES}; use c_types::{c_int, c_schar, c_uchar, size_t, uintptr_t}; use core::mem; use string::strlen::strlen; #[no_mangle] pub unsafe extern "C" fn __strchrnul(s: *const c_schar, c: c_int) -> *const c_schar { strchrnul(s, c) } <|...
code_fim
hard
{ "lang": "rust", "repo": "anp/rusl", "path": "/src/string/strchrnul.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> _s = w as *const c_schar; while *_s != 0 && *(_s as *const c_uchar) != c { _s = _s.offset(1); } _s }<|fim_prefix|>// repo: anp/rusl path: /src/string/strchrnul.rs use super::{has_zero, ONES}; use c_types::{c_int, c_schar, c_uchar, size_t, uintptr_t}; use core::mem; use string::str...
code_fim
hard
{ "lang": "rust", "repo": "anp/rusl", "path": "/src/string/strchrnul.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tureus/kube-rs path: /kube-core/src/response.rs //! Generic api response types use serde::Deserialize; /// A Kubernetes status object /// /// Equivalent to Status in k8s-openapi except we have have simplified options #[derive(Deserialize, Debug)] pub struct Status { /// Suggested HTTP retur...
code_fim
hard
{ "lang": "rust", "repo": "tureus/kube-rs", "path": "/kube-core/src/response.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> /// If specified, the time in seconds before the operation should be retried. /// /// Some errors may indicate the client must take an alternate action - /// for those errors this field may indicate how long to wait before taking the alternate action. #[serde(default, skip_serializing_...
code_fim
hard
{ "lang": "rust", "repo": "tureus/kube-rs", "path": "/kube-core/src/response.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> if y_dir > 0 { self.facing = Facing::North; } if y_dir < 0 { self.facing = Facing::South; } self.pos = new_pos; } pub fn send_attack(&self) -> Attack { let atk_pos = self.facing.position(self.pos); let damag...
code_fim
hard
{ "lang": "rust", "repo": "ekirshey/rusty_rogue", "path": "/src/player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ekirshey/rusty_rogue path: /src/player.rs use std::fmt; use utils::Vec2; use entity::{StatBlock, Facing, Attack, CombatResult, AttackType}; #[derive(Debug, Copy, Clone)] pub enum Class { Warrior, Mage, Rogue } pub struct Player { name : String, pos : Vec2<usize>, base_s...
code_fim
hard
{ "lang": "rust", "repo": "ekirshey/rusty_rogue", "path": "/src/player.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn base_stats(&self) -> &StatBlock { &self.base_stats } pub fn current_stats(&self) -> &StatBlock { &self.curr_stats } pub fn name(&self) -> &str { &self.name } pub fn target(&self) -> Option<usize> { self.target } pub fn set_targ...
code_fim
hard
{ "lang": "rust", "repo": "ekirshey/rusty_rogue", "path": "/src/player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> gl_Position = ViewProj * Model * vec4(Vertex_Position, 1.0); v_color = Vertex_Color; } "#; const FRAGMENT_SHADER: &str = r#" #version 450 layout(location = 0) out vec4 o_Target; layout(location = 0) in vec3 v_color; void main() { o_Target = vec4(v_color, 1.0); // o_Target = vec4(1.0, 1.0,...
code_fim
hard
{ "lang": "rust", "repo": "jamesmcm/bevy_terrain", "path": "/src/terrain_material.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jamesmcm/bevy_terrain path: /src/terrain_material.rs use bevy::prelude::*; use bevy::{ reflect::TypeUuid, render::{ pipeline::{PipelineDescriptor}, render_graph::{base, AssetRenderResourcesNode, RenderGraph}, renderer::RenderResources, shader::{ShaderStage...
code_fim
hard
{ "lang": "rust", "repo": "jamesmcm/bevy_terrain", "path": "/src/terrain_material.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ritobanrc/aoc2015 path: /src/day16.rs use crate::load_input; use anyhow::Result; use itertools::Itertools; crate::aoc!(16); pub fn day16_main() -> Result<()> { let input = load_input(16)?; let mut sues = Vec::new(); for (i, line) in input.lines().enumerate() { sues.push([...
code_fim
hard
{ "lang": "rust", "repo": "ritobanrc/aoc2015", "path": "/src/day16.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn part2_solution(sues: &[[Option<u32>; 10]]) -> usize { /// children: 0 /// cats: 1 /// samoyeds: 2 /// pomeranians: 3 /// akitas: 4 /// vizslas: 5 /// goldfish: 6 /// trees: 7 /// cars: 8 /// perfumes: 9 const REPORTED: [u32; 10] = [3, 7, 2, 3, 0, 0, 5, 3, 2, ...
code_fim
hard
{ "lang": "rust", "repo": "ritobanrc/aoc2015", "path": "/src/day16.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// Configuration for WAGI modules. #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct WagiModuleConfig { pub entrypoint: Option<String>, pub route: String, pub allowed_hosts: Option<Vec<String>>, #[serde(skip_deserializing)] pub module: String, } impl PartialEq for Wa...
code_fim
hard
{ "lang": "rust", "repo": "baisijian/krustlet-wagi-provider", "path": "/crates/wagi-provider/src/runtime.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl PartialEq for WagiModuleConfig { fn eq(&self, other: &Self) -> bool { self.route == other.route } } impl Eq for WagiModuleConfig {} impl Hash for WagiModuleConfig { fn hash<H: Hasher>(&self, state: &mut H) { self.route.hash(state); } } /// Holds our tempfile handle....
code_fim
hard
{ "lang": "rust", "repo": "baisijian/krustlet-wagi-provider", "path": "/crates/wagi-provider/src/runtime.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: baisijian/krustlet-wagi-provider path: /crates/wagi-provider/src/runtime.rs use std::hash::{Hash, Hasher}; use std::io::Write; use std::sync::Arc; use tempfile::NamedTempFile; use tokio::sync::mpsc::Sender; use tokio::task::JoinHandle; use wasmtime::InterruptHandle; use kubelet::container::Sta...
code_fim
hard
{ "lang": "rust", "repo": "baisijian/krustlet-wagi-provider", "path": "/crates/wagi-provider/src/runtime.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn distance(&self, rhs: &Color) -> u8 { // Get YUV (luma, blue chroma, red chroma) for both sides let (ly, lu, lv) = self.luma_chroma(); let (ry, ru, rv) = rhs.luma_chroma(); let dist = (((ly - ry).powi(2) + (lu - ru).powi(2) + (lv - rv).powi(2))...
code_fim
hard
{ "lang": "rust", "repo": "ISSOtm/rsgbgfx", "path": "/src/img/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ISSOtm/rsgbgfx path: /src/img/mod.rs mod png; pub use self::png::{PngReadError, PngReader}; use std::io::Read; use std::ops::Index; pub use color::Color; mod color { use std::fmt::{self, Display, Formatter, LowerHex, UpperHex}; // Implementing `PartialEq` in this way makes identical c...
code_fim
hard
{ "lang": "rust", "repo": "ISSOtm/rsgbgfx", "path": "/src/img/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn height(&self) -> u32 { self.height } } impl Index<(u32, u32)> for Image { type Output = Color; fn index(&self, (x, y): (u32, u32)) -> &Self::Output { assert!( x < self.width, "{} is larger than the image's width ({} px)", x, ...
code_fim
hard
{ "lang": "rust", "repo": "ISSOtm/rsgbgfx", "path": "/src/img/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>int32, commandSize: SLuint32, pCommandData: *mut ::std::os::raw::c_void, replySize: *mut SLuint32, pReplyData: *mut ::std::os::raw::c_void, ) -> SLresult, >, } extern "C" { pub static mut SL_IID_ANDROIDEFFECTSEND: SLInterfaceID; } pub type SL...
code_fim
hard
{ "lang": "rust", "repo": "AmpMe/opensles-sys", "path": "/src/bindings.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AmpMe/opensles-sys path: /src/bindings.rs ::std::os::raw::c_void, enable: SLboolean, initialLevel: SLmillibel, ) -> SLresult, >, pub IsEnabled: ::std::option::Option< unsafe extern "C" fn( self_: SLEffectSendItf, pAuxEffect...
code_fim
hard
{ "lang": "rust", "repo": "AmpMe/opensles-sys", "path": "/src/bindings.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AmpMe/opensles-sys path: /src/bindings.rs pub locatorType: SLuint32, pub tpqn: SLuint32, pub numBuffers: SLuint32, } /// MIME-type-based data format definition where formatType must be SL_DATAFORMAT_MIME #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct SLDataFormat_MIME_ { pub f...
code_fim
hard
{ "lang": "rust", "repo": "AmpMe/opensles-sys", "path": "/src/bindings.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SplittyDev/spotify-rs path: /src/connector.rs use json::{self, JsonValue}; use reqwest::header::{ORIGIN, REFERER, USER_AGENT}; use reqwest::{self, Client}; use std::io::Read; use std::net::TcpListener; use std::sync::Mutex; // Headers const HEADER_UA: &str = "Mozilla/5.0 (Windows; rv:50.0) Geck...
code_fim
hard
{ "lang": "rust", "repo": "SplittyDev/spotify-rs", "path": "/src/connector.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for port in PORT_START..PORT_END { if TcpListener::bind(("127.0.0.1", port)).is_err() { self.port = port as i32; return; } } } /// Constructs the local Spotify url. fn get_local_url(&self) -> String { format!("{}:{...
code_fim
hard
{ "lang": "rust", "repo": "SplittyDev/spotify-rs", "path": "/src/connector.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let json = match self.query(URL_TOKEN, "", false, false, None) { Ok(result) => result, Err(error) => return Err(error), }; match json["t"].as_str() { Some(token) => Ok(token.to_owned()), None => Err(InternalSpotifyError::InvalidOAuthT...
code_fim
hard
{ "lang": "rust", "repo": "SplittyDev/spotify-rs", "path": "/src/connector.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saidgeek/tweet-like path: /src/main.rs extern crate egg_mode; extern crate regex; extern crate rustbreak; extern crate serde; extern crate serde_yaml; extern crate tokio; extern crate trim_margin; #[macro_use] extern crate log; mod db; mod display; mod error; mod models; #[cfg(target_os = "wind...
code_fim
hard
{ "lang": "rust", "repo": "saidgeek/tweet-like", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let token = current_user.token().await?; info!("Search tweets..."); tweet::search(&token).await?; } } if settings.is_missing() { warn!("Please edit a settings file for input the search terms and blacklist."); } else { info!("Processi...
code_fim
hard
{ "lang": "rust", "repo": "saidgeek/tweet-like", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> last_value = *value; } Ok(ret) } fn decode_lookup_table() -> HashMap<char, u16> { hashmap!{ 'I' => 1, 'V' => 5, 'X' => 10, 'L' => 50, 'C' => 100, 'D' => 500, 'M' => 1000, } } #[cfg(test)] mod test { use super::*; #...
code_fim
hard
{ "lang": "rust", "repo": "alhuelamo/rust-tinkering", "path": "/src/roman.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let actual = encode(0); let expected = Err(RomanError::EncodeZero); assert_eq!(actual, expected); } #[test] fn test_roman_decode_basics() -> Result<()> { assert_eq!(decode("I")?, 1); assert_eq!(decode("V")?, 5); assert_eq!(decode("X")?, 10); ...
code_fim
hard
{ "lang": "rust", "repo": "alhuelamo/rust-tinkering", "path": "/src/roman.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alhuelamo/rust-tinkering path: /src/roman.rs #![allow(non_snake_case)] use std::collections::HashMap; type Result<T> = std::result::Result<T, RomanError>; #[derive(Debug, Eq, PartialEq)] enum RomanError { EncodeZero, EncodeIllegalExponent(usize), EncodeIllegalLookupIndex(usize), ...
code_fim
hard
{ "lang": "rust", "repo": "alhuelamo/rust-tinkering", "path": "/src/roman.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let piyo = hoge.map(|s| s * 2); println!("{}", piyo.unwrap()) }<|fim_prefix|>// repo: simorgh3196/RustSamples path: /enum_and_matching/src/main.rs fn main() { let hoge = Some(5); <|fim_middle|> match hoge { Option::Some(v) => println!("{}", v), Option::None => println!("N...
code_fim
medium
{ "lang": "rust", "repo": "simorgh3196/RustSamples", "path": "/enum_and_matching/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: simorgh3196/RustSamples path: /enum_and_matching/src/main.rs fn main() { let hoge = Some(5); <|fim_suffix|> let piyo = hoge.map(|s| s * 2); println!("{}", piyo.unwrap()) }<|fim_middle|> match hoge { Option::Some(v) => println!("{}", v), Option::None => println!("N...
code_fim
medium
{ "lang": "rust", "repo": "simorgh3196/RustSamples", "path": "/enum_and_matching/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reitermarkus/dockworker path: /tests/integration/container.rs use dockworker::*; use std::fs::File; use std::io::Read; use std::iter::Iterator; use std::path::{Path, PathBuf}; use std::env; use support::{file, with_image}; use tar::Builder as TarBuilder; use dockworker::{Error, models::{Attac...
code_fim
hard
{ "lang": "rust", "repo": "reitermarkus/dockworker", "path": "/tests/integration/container.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let container = docker.container_create(None, &create).unwrap(); docker.container_start(&container.id).unwrap(); let res = docker .container_attach(&container.id, None, true, true, false, true, true) .unwrap(); let cont: AttachContainer = res.into(); // expected files let exp_stdout =...
code_fim
hard
{ "lang": "rust", "repo": "reitermarkus/dockworker", "path": "/tests/integration/container.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn users_router() -> Scope { Scope::new("/users").route("/{user}/events", web::get().to(fake_users_events)) }<|fim_prefix|>// repo: rust-lang-ve/gh-api-faker path: /src/routes/users.rs use crate::util::read_from_static; use actix_web::{web, HttpRequest, HttpResponse, Scope}; <|fim_middle|>/// Re...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang-ve/gh-api-faker", "path": "/src/routes/users.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang-ve/gh-api-faker path: /src/routes/users.rs use crate::util::read_from_static; use actix_web::{web, HttpRequest, HttpResponse, Scope}; /// Returns hardcoded data for a request to `https://api.github.com/users/{user}/events` fn fake_users_events(_: HttpRequest) -> HttpResponse { <|fim_s...
code_fim
medium
{ "lang": "rust", "repo": "rust-lang-ve/gh-api-faker", "path": "/src/routes/users.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mokus0/tmc path: /src/class/control/get_capabilities.rs use crate::class::*; use byteorder::{ByteOrder, LittleEndian}; use std::convert::TryFrom; #[derive(Debug, Clone, PartialEq, Eq, Hash)] pub struct USBTMCCapabilities { pub bcd_usbtmc: u16, pub pulse: bool, pub talk_only: bool, pub l...
code_fim
hard
{ "lang": "rust", "repo": "mokus0/tmc", "path": "/src/class/control/get_capabilities.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if usb488_capabilities.usb488_2 && !usb488_capabilities.sr { return Err(ClassError::InvalidCapabilities); } if usb488_capabilities.scpi && !usb488_capabilities.usb488_2 { return Err(ClassError::InvalidCapabilities); } // looks good, return the capabilities list Ok(Som...
code_fim
hard
{ "lang": "rust", "repo": "mokus0/tmc", "path": "/src/class/control/get_capabilities.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn clear(&self) { unsafe { gl::DeleteFramebuffers(1, &self.fbo); gl::DeleteRenderbuffers(1, &self.render_buffer); } } pub fn bind(&self) { unsafe { gl::BindFramebuffer(gl::FRAMEBUFFER, self.fbo); } } pub fn bind_...
code_fim
hard
{ "lang": "rust", "repo": "AndrewBregger/rem", "path": "/src/render/framebuffer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AndrewBregger/rem path: /src/render/framebuffer.rs use gl; use gl::types::*; use crate::size; #[derive(Debug, Clone)] pub enum Error { Incomplete, ToManyBuffers, } pub type FrameSize = size::Size<f32>; pub type Result<T> = ::std::result::Result<T, Error>; /// Abstraction of a frame b...
code_fim
hard
{ "lang": "rust", "repo": "AndrewBregger/rem", "path": "/src/render/framebuffer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wwylele/save3ds path: /libsave3ds/src/save_data.rs Small => 512, SaveDataBlockType::Large => 4096, }; let mut min_block = 1; let mut max_block = disa_len / block_len + 1; while max_block - min_block > 1 { let mid_block = (min_block + max_bl...
code_fim
hard
{ "lang": "rust", "repo": "wwylele/save3ds", "path": "/libsave3ds/src/save_data.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wwylele/save3ds path: /libsave3ds/src/save_data.rs file::*; use crate::sub_file::SubFile; use byte_struct::*; use log::*; use std::rc::Rc; #[derive(ByteStruct, Clone)] #[byte_struct_le] pub(crate) struct SaveFile { pub next: u32, pub padding1: u32, pub block: u32, pub size: u64,...
code_fim
hard
{ "lang": "rust", "repo": "wwylele/save3ds", "path": "/libsave3ds/src/save_data.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.meta.get_ino() } fn open_sub_dir(&self, name: [u8; 16]) -> Result<Self, Error> { Ok(Dir { center: self.center.clone(), meta: self.meta.open_sub_dir(name)?, }) } fn open_sub_file(&self, name: [u8; 16]) -> Result<Self::FileType, Error> {...
code_fim
hard
{ "lang": "rust", "repo": "wwylele/save3ds", "path": "/libsave3ds/src/save_data.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let dleq = DLEQ::from_tag(b"test"); let x = Scalar::random(&mut rand::thread_rng()); let H = Point::random(&mut rand::thread_rng()); let (proof, xG, xH) = dleq.prove_guaranteed(&x, &G, &H, Derivation::Deterministic); assert!(dleq.verify(&G, &xG, &H, &xH, &proof)); ...
code_fim
hard
{ "lang": "rust", "repo": "5l1v3r1/secp256kfun", "path": "/ecdsa_fun/src/adaptor/dleq.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 5l1v3r1/secp256kfun path: /ecdsa_fun/src/adaptor/dleq.rs use digest::{generic_array::typenum::U32, Digest}; use secp256kfun::{ derive_nonce, g, hash::{tagged_hash, Derivation, Hash, NonceHash}, marker::*, s, Point, Scalar, }; pub struct DLEQ<CH, N> { pub challenge_hash: CH, ...
code_fim
hard
{ "lang": "rust", "repo": "5l1v3r1/secp256kfun", "path": "/ecdsa_fun/src/adaptor/dleq.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mod back_of_house; use std::fmt::Result; use std::io::Result as IoResult; fn function1() -> Result { unimplemented!(); } fn function2() -> IoResult<()> { unimplemented!(); }<|fim_prefix|>// repo: hayasshi/tutorial-rust path: /restaurant/src/lib.rs mod front_of_house; pub use crate::front_of_house::ho...
code_fim
medium
{ "lang": "rust", "repo": "hayasshi/tutorial-rust", "path": "/restaurant/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hayasshi/tutorial-rust path: /restaurant/src/lib.rs mod front_of_house; pub use crate::front_of_house::hosting; // Absolute path //use self::front_of_house::hosting; // Relative path <|fim_suffix|> mod back_of_house; use std::fmt::Result; use std::io::Result as IoResult; fn function1() -> Re...
code_fim
hard
{ "lang": "rust", "repo": "hayasshi/tutorial-rust", "path": "/restaurant/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn dirsearch_install() { Command::new("pip3") .arg("install") .arg("-r") .arg("~/dirsearch/requirements.txt") .spawn() .expect("pip3 command failed to execute"); } fn impacket_install() { Command::new("pip3") .arg("install") ...
code_fim
hard
{ "lang": "rust", "repo": "bsdbandit/Rust", "path": "/BanditBox/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bsdbandit/Rust path: /BanditBox/src/main.rs //BanditBox is just a tool grabber it grabs my favorite tools from gitub and installs each tool //written by bsdbandit //Sept 11, 2021 //Crates use git2::Repository; use std::fs::{self, DirBuilder}; use figlet_rs::FIGfont; use std::process::Command;...
code_fim
hard
{ "lang": "rust", "repo": "bsdbandit/Rust", "path": "/BanditBox/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aturon/hubcaps path: /src/releases.rs //! Releases inteface extern crate serde_json; use self::super::{Github, Result}; use rep::{Asset, Release, ReleaseOptions}; pub struct Assets<'a> { github: &'a Github, owner: String, repo: String, releaseid: u64, } impl<'a> Assets<'a> { ...
code_fim
hard
{ "lang": "rust", "repo": "aturon/hubcaps", "path": "/src/releases.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> format!("/repos/{}/{}/releases{}", self.owner, self.repo, more) } pub fn create(&self, rel: &ReleaseOptions) -> Result<Release> { let data = try!(serde_json::to_string(&rel)); self.github.post::<Release>(&self.path(""), data.as_bytes()) } pub fn edit(&self, id: u6...
code_fim
hard
{ "lang": "rust", "repo": "aturon/hubcaps", "path": "/src/releases.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Releases<'a> { pub fn new<O, R>(github: &'a Github, owner: O, repo: R) -> Releases<'a> where O: Into<String>, R: Into<String> { Releases { github: github, owner: owner.into(), repo: repo.into(), } } fn path...
code_fim
hard
{ "lang": "rust", "repo": "aturon/hubcaps", "path": "/src/releases.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajscholl/mqs path: /mqs-server/src/router/mod.rs use hyper::Method; use mqs_common::{ connection::Source, router::{Router, WildcardRouter}, }; use crate::{ models::{health::HealthCheckRepository, message::MessageRepository, queue::QueueRepository}, router::{ messages::{D...
code_fim
hard
{ "lang": "rust", "repo": "ajscholl/mqs", "path": "/mqs-server/src/router/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fn run_handler<'a>( handler: Arc<dyn Handler<(TestRepo, &'a TestRepoSource)>>, source: &'a TestRepoSource, ) -> Response<Body> { run_handler_with(handler, source, Vec::new()) } fn run_handler_with<'a>( handler: Arc<dyn Handler<(TestRepo, &'a TestRepoSource)...
code_fim
hard
{ "lang": "rust", "repo": "ajscholl/mqs", "path": "/mqs-server/src/router/mod.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let clock = Clock::new(); let mut rom = ROM32K::new(); rom.load("src/base/tests/sample.txt"); assert_eq!(rom.output(&clock, [O; 15]), Word::new([O; 16])); assert_eq!( rom.output(&clock, [O, O, O, O, O, O, O, O, O, O, O, O, O, O, I]), Word::n...
code_fim
hard
{ "lang": "rust", "repo": "cola119/nand2tetris-rs", "path": "/hardware/src/base/rom.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cola119/nand2tetris-rs path: /hardware/src/base/rom.rs #![allow(dead_code)] use std::{ fs::File, io::{BufRead, BufReader}, }; use crate::base::{ dff::Clock, logic::bit::{I, O}, logic::{bit, dmux8way, mux8way16, Word}, ram::RAM4K, }; use super::arithmetic::add16; pub st...
code_fim
hard
{ "lang": "rust", "repo": "cola119/nand2tetris-rs", "path": "/hardware/src/base/rom.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stevenlr/HandmadeRust path: /gfx/src/command_buffer.rs use core::{marker::PhantomData, ops::Range}; use fnd::{containers::SmallArray8, Shared}; use vk::{builders::*, types::*}; use super::{capabilities, conv::*, *}; pub(crate) struct InnerCommandBuffer { pub(crate) device: Shared<RawDevice...
code_fim
hard
{ "lang": "rust", "repo": "stevenlr/HandmadeRust", "path": "/gfx/src/command_buffer.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> &mut self, image: Image, layout: ImageLayout, color: ClearColor, range: ImageSubresourceRange, ) { let range = hal_to_vk_image_subresource_range(&range); let layout = hal_to_vk_image_layout(layout); let color = hal_to_vk_clear_color(&...
code_fim
hard
{ "lang": "rust", "repo": "stevenlr/HandmadeRust", "path": "/gfx/src/command_buffer.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> { let src_stage_mask = hal_to_vk_pipeline_stage_flags(stage.start); let dst_stage_mask = hal_to_vk_pipeline_stage_flags(stage.end); let mut global_barriers = SmallArray8::new(); let mut image_barriers = SmallArray8::new(); for barrier in barriers { ...
code_fim
hard
{ "lang": "rust", "repo": "stevenlr/HandmadeRust", "path": "/gfx/src/command_buffer.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustwasm/wasm-bindgen path: /tests/non_wasm.rs extern crate wasm_bindgen; use wasm_bindgen::prelude::*; #[wasm_bindgen] pub struct A { x: u32, } #[wasm_bindgen] impl A { pub fn new() -> A { A { x: 3 } } pub fn foo(&self) { assert_eq!(self.x, 3); } } <|fim...
code_fim
medium
{ "lang": "rust", "repo": "rustwasm/wasm-bindgen", "path": "/tests/non_wasm.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[wasm_bindgen] extern "C" { fn some_import(); static A: JsValue; } #[wasm_bindgen] pub fn bar(_: &str) -> JsValue { some_import(); A.clone() } #[wasm_bindgen] pub fn baz(_: JsValue) {} #[test] fn test_foo() { foo(false); A::new().foo(); }<|fim_prefix|>// repo: rustwasm/wasm-bin...
code_fim
medium
{ "lang": "rust", "repo": "rustwasm/wasm-bindgen", "path": "/tests/non_wasm.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn foo(&self) { assert_eq!(self.x, 3); } } #[wasm_bindgen] pub fn foo(x: bool) { A::new().foo(); if x { bar("test"); baz(JsValue::from(3)); } } #[wasm_bindgen] extern "C" { fn some_import(); static A: JsValue; } #[wasm_bindgen] pub fn bar(_: &str...
code_fim
medium
{ "lang": "rust", "repo": "rustwasm/wasm-bindgen", "path": "/tests/non_wasm.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }