text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> while let Some(sequence) = permutator.next() { //println!("trying {:?}", sequence); if sequence.contains(&&0) && sequence.contains(&&1) && sequence.contains(&&2) && sequence.contains(&&3) && sequence.contains(&&4) { pr...
code_fim
hard
{ "lang": "rust", "repo": "jiachen247/aoc2019", "path": "/src/challenges/day7.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while eip < mem_len { match decode(memory[eip]) { Instruction { op_code: EXIT_CODE, .. } => break, Instruction { op_code, mode1, mode2, .. } if op_code == ADD_CODE ||...
code_fim
hard
{ "lang": "rust", "repo": "jiachen247/aoc2019", "path": "/src/challenges/day7.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jiachen247/aoc2019 path: /src/challenges/day7.rs use permutate::Permutator; use std::io; const DAY: i32 = 7; const TITLE: &str = "Amplification Circuit"; const EXIT_CODE: i32 = 99; const ADD_CODE: i32 = 1; const MULTIPLY_CODE: i32 = 2; const READ_CODE: i32 = 3; const WRITE_CODE: i32 = 4; const...
code_fim
hard
{ "lang": "rust", "repo": "jiachen247/aoc2019", "path": "/src/challenges/day7.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lcdr/lu_packets path: /src/world/gm/server/tests/StartSkill.rs GameMessage::StartSkill( StartSkill { used_mouse: false, consumable_item_id: 0, caster_latency: 0.0, cast_type: 0, last_clicked_posit: Vector3::ZERO, optional_originator_id: 0, optional_targe<|fim_suffix|>, 0, 0, 50, 1...
code_fim
medium
{ "lang": "rust", "repo": "lcdr/lu_packets", "path": "/src/world/gm/server/tests/StartSkill.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>t_id: 0, originator_rot: Quaternion::IDENTITY, bitstream: vec![ 1, 0, 0, 0, 1, 0, 0, 0, 128, 128, 0, 0, 50, 138, 129, 0, 0, 32, 0, 2, 61, 0, 0, 0, 0, ], skill_id: 1140, skill_handle: 121, }, )<|fim_prefix|>// repo: lcdr/lu_packets path: /src/world/gm/server/tests/StartSkill.rs GameMessage::...
code_fim
medium
{ "lang": "rust", "repo": "lcdr/lu_packets", "path": "/src/world/gm/server/tests/StartSkill.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "ReLu Layer".to_string() } fn get_output_shape(&self, input_dim: Vec<usize>) -> Vec<usize> { input_dim } fn predict(&mut self, x: ArrayD<f32>) -> ArrayD<f32> { self.forward(x) } fn forward(&mut self, mut x: ArrayD<f32>) -> ArrayD<f32> { x.mapv_inplace(|x| if x>0. {x} else...
code_fim
medium
{ "lang": "rust", "repo": "quietlychris/Rust_RL", "path": "/src/network/concrete_layer/activation_layer/relu.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> x.mapv_inplace(|x| if x>0. {x} else {0.}); x } fn backward(&mut self, mut feedback: ArrayD<f32>) -> ArrayD<f32>{ feedback.mapv_inplace(|x| if x>=0. {1.} else {0.}); feedback } }<|fim_prefix|>// repo: quietlychris/Rust_RL path: /src/network/concrete_layer/activation_layer/relu.rs u...
code_fim
medium
{ "lang": "rust", "repo": "quietlychris/Rust_RL", "path": "/src/network/concrete_layer/activation_layer/relu.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: quietlychris/Rust_RL path: /src/network/concrete_layer/activation_layer/relu.rs use crate::network::layer_trait::Layer; use ndarray::ArrayD; pub struct ReLuLayer { } impl ReLuLayer { pub fn new() -> Self { ReLuLayer{ } } } impl Layer for ReLuLayer { fn get_type(&self) -> String ...
code_fim
medium
{ "lang": "rust", "repo": "quietlychris/Rust_RL", "path": "/src/network/concrete_layer/activation_layer/relu.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AuroransSolis/refunct-tas path: /rtil/src/native/linux/slateapp.rs use native::slateapp::{SLATEAPP, FSlateApplication}; use libc::{uintptr_t, int32_t, uint32_t}; use native::{ FSLATEAPPLICATION_ONKEYDOWN, FSLATEAPPLICATION_ONKEYUP, FSLATEAPPLICATION_ONRAWMOUSEMOVE, }; <|fim_suffix...
code_fim
hard
{ "lang": "rust", "repo": "AuroransSolis/refunct-tas", "path": "/rtil/src/native/linux/slateapp.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub(in native) fn on_raw_mouse_move(x: i32, y: i32) { let fun: extern "C" fn(this: uintptr_t, x: int32_t, y: int32_t) = unsafe { ::std::mem::transmute(FSLATEAPPLICATION_ONRAWMOUSEMOVE) }; fun(*SLATEAPP.get() as uintptr_t, x, y) } } #[inline(never)] pub(in native) exter...
code_fim
hard
{ "lang": "rust", "repo": "AuroransSolis/refunct-tas", "path": "/rtil/src/native/linux/slateapp.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // func can be Exp::Primitive or Exp::Closure match func { Exp::Primitive(prim) => prim(args), Exp::Closure(clos) => match *clos.body { Exp::List(body) => match body.first() { Some(Exp::List(vars)) => { let local_env = make_env_ptr(c...
code_fim
hard
{ "lang": "rust", "repo": "rami3l/rusk", "path": "/src/eval_apply.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rami3l/rusk path: /src/eval_apply.rs use crate::prelude::make_env_ptr; use crate::types::*; use std::rc::Rc; pub fn eval(exp: Exp, env: RcRefCell<Env>) -> Result<Exp, ScmErr> { match exp { n @ Exp::Number(_) => Ok(n), ref s @ Exp::Symbol(_) => env .borrow() ...
code_fim
hard
{ "lang": "rust", "repo": "rami3l/rusk", "path": "/src/eval_apply.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>fn apply(func: Exp, args: &[Exp]) -> Result<Exp, ScmErr> { // func can be Exp::Primitive or Exp::Closure match func { Exp::Primitive(prim) => prim(args), Exp::Closure(clos) => match *clos.body { Exp::List(body) => match body.first() { Some(Exp::List(var...
code_fim
hard
{ "lang": "rust", "repo": "rami3l/rusk", "path": "/src/eval_apply.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ot0/ircmesi path: /src/sqlib/models.rs use super::schema::{party, member}; //use diesel::sql_types::{Nullable, Timestamp}; use chrono::NaiveDateTime; <|fim_suffix|>#[derive(Insertable)] #[table_name = "party"] pub struct NewParty<'a> { pub title: &'a str, } #[derive(Insertable)] #[table_n...
code_fim
hard
{ "lang": "rust", "repo": "ot0/ircmesi", "path": "/src/sqlib/models.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Insertable)] #[table_name = "member"] pub struct NewMember<'a> { pub name: &'a str, pub pid: i32, }<|fim_prefix|>// repo: ot0/ircmesi path: /src/sqlib/models.rs use super::schema::{party, member}; //use diesel::sql_types::{Nullable, Timestamp}; use chrono::NaiveDateTime; #[derive(Query...
code_fim
medium
{ "lang": "rust", "repo": "ot0/ircmesi", "path": "/src/sqlib/models.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Insertable)] #[table_name = "party"] pub struct NewParty<'a> { pub title: &'a str, } #[derive(Insertable)] #[table_name = "member"] pub struct NewMember<'a> { pub name: &'a str, pub pid: i32, }<|fim_prefix|>// repo: ot0/ircmesi path: /src/sqlib/models.rs use super::schema::{party, ...
code_fim
hard
{ "lang": "rust", "repo": "ot0/ircmesi", "path": "/src/sqlib/models.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zackmdavis/Exercises_A path: /Programming_Challenges/1-6-1.rs fn collatz_procedure(n: uint) -> uint { if n % 2 == 1 { (3 * n) + 1 } else { n / 2 } } fn collatz_sequence(n: uint) -> Vec<uint> { let mut our_sequence = Vec::new(); let mut i = n; loop { ...
code_fim
medium
{ "lang": "rust", "repo": "zackmdavis/Exercises_A", "path": "/Programming_Challenges/1-6-1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert!(20 == max_lifetime(1, 11)); assert!(125 == max_lifetime(100, 201)); assert!(89 == max_lifetime(201, 211)); assert!(174 == max_lifetime(900, 1001)); }<|fim_prefix|>// repo: zackmdavis/Exercises_A path: /Programming_Challenges/1-6-1.rs fn collatz_procedure(n: uint) -> uint { if ...
code_fim
medium
{ "lang": "rust", "repo": "zackmdavis/Exercises_A", "path": "/Programming_Challenges/1-6-1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub use crate::orchestrator::Command; pub use model::Inference;<|fim_prefix|>// repo: t0037799/AgileInfer path: /src/orchestrator/src/lib.rs #![deny(warnings)] #![deny(missing_docs)] #![warn(clippy::all)] <|fim_middle|>//! Orchestrator orchestrates inference requests for all loaded models. pub(crate) m...
code_fim
medium
{ "lang": "rust", "repo": "t0037799/AgileInfer", "path": "/src/orchestrator/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: t0037799/AgileInfer path: /src/orchestrator/src/lib.rs #![deny(warnings)] #![deny(missing_docs)] #![warn(clippy::all)] //! Orchestrator orchestrates inference requests for all loaded models. <|fim_suffix|>pub use crate::orchestrator::Command; pub use model::Inference;<|fim_middle|>pub(crate) m...
code_fim
medium
{ "lang": "rust", "repo": "t0037799/AgileInfer", "path": "/src/orchestrator/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> impl<T> Rem<$ty> for Complex<T> where Complex<T>: Rounding + Sub<Output = Complex<T>> + Div<$ty, Output = Complex<T>> + Copy, $ty: Mul<Complex<T>, Output = Complex<T>> + Copy { type ...
code_fim
hard
{ "lang": "rust", "repo": "mhazoglou/complex", "path": "/src/ops.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> forward_ref_bin_op!(Mul, mul, $ty, Complex<T>, T); impl<T> Mul<Complex<T>> for $ty where T: Mul<$ty, Output = T>, { type Output = Complex<T>; fn mul(self, other: Complex<T>) -> Self::Output { ...
code_fim
hard
{ "lang": "rust", "repo": "mhazoglou/complex", "path": "/src/ops.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mhazoglou/complex path: /src/ops.rs //! All basic algebraic operations are implemented for complex and hypercomplex //! types using Cayley-Dickson construction and recursive calls use crate::*; macro_rules! forward_ref_un_op { ($imp:ident, $method:ident, $t:ty, $T:tt) => { impl<$T> ...
code_fim
hard
{ "lang": "rust", "repo": "mhazoglou/complex", "path": "/src/ops.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.on_floor && self.wx.is_some() { self.vx.update(self.wx.unwrap(), dt as f64); } self.jump_time += dt; let jump_t = if self.trying_to_jump { self.jump_time } else { -1.0 }; self.x += dt * self.vx.value(); ...
code_fim
hard
{ "lang": "rust", "repo": "tuomas56/platformer", "path": "/src/player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tuomas56/platformer path: /src/player.rs use super::{geometry::CollisionGeometry, vfx::{ParticleSystem, CameraShaker, ExpFilter}}; #[derive(Debug)] pub struct Player { pub x: f32, pub y: f32, pub vx: ExpFilter<f32>, pub vy: f32, pub wx: Option<f32>, pub on_floor: bool, ...
code_fim
hard
{ "lang": "rust", "repo": "tuomas56/platformer", "path": "/src/player.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if collision.normal.0 != 0.0 && self.vy.abs() < 150.0 && self.wx.is_some() { let wx = self.wx.unwrap(); if wx != 0.0 && wx/wx.abs() == collision.normal.0 { self.can_walljump = true; } else { self.can_wallju...
code_fim
hard
{ "lang": "rust", "repo": "tuomas56/platformer", "path": "/src/player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: erismart/ErlangRT path: /src/emulator/runtime_ctx.rs //! Module defines Runtime Context which represents the low-level VM state of //! a running process, such as registers, code pointer, etc. use defs::Word; use defs; use emulator::code::{CodePtr}; use emulator::heap; use term::lterm::LTerm; use...
code_fim
hard
{ "lang": "rust", "repo": "erismart/ErlangRT", "path": "/src/emulator/runtime_ctx.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Read a word from `self.ip` and advance `ip` by 1 word. /// NOTE: The compiler seems to be smart enough to optimize multiple fetches /// as multiple reads and a single increment. pub fn fetch(&mut self) -> Word { let CodePtr::Ptr(ip0) = self.ip; unsafe { let w = *ip0; self....
code_fim
hard
{ "lang": "rust", "repo": "erismart/ErlangRT", "path": "/src/emulator/runtime_ctx.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> updated.push(character.entity_id); Ok(()) }) .unwrap_or_else(|e| err!("{:?}", e)); Ok(()) })?; Ok(updated) }<|fim_prefix|>// repo: pbl2019/aworld-datagen path: /src/transactions/turn_right.rs use crate::actions::char...
code_fim
medium
{ "lang": "rust", "repo": "pbl2019/aworld-datagen", "path": "/src/transactions/turn_right.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pbl2019/aworld-datagen path: /src/transactions/turn_right.rs use crate::actions::character_action::CharacterTurnRightPayload; use crate::connection::Connection; use crate::context::Context; use crate::dispatchers::character_dispatcher::CharacterDispatcher; <|fim_suffix|> updated.push...
code_fim
hard
{ "lang": "rust", "repo": "pbl2019/aworld-datagen", "path": "/src/transactions/turn_right.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: seik0ixtem/sqlplus_run path: /src/sub_proc.rs // code taken from here: // https://andres.svbtle.com/convert-subprocess-stdout-stream-into-non-blocking-iterator-in-rust use std::io::prelude::*; use std::process::{Command, Stdio}; use std::sync::mpsc; use std::thread; use std::io::BufReader; <|f...
code_fim
hard
{ "lang": "rust", "repo": "seik0ixtem/sqlplus_run", "path": "/src/sub_proc.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> stdin.write_all(buf).expect("unexpected"); } pub fn packets(&mut self) -> SubProcessIntoIterator { SubProcessIntoIterator { subprocess: self, } } } pub struct SubProcessIntoIterator<'a> { subprocess: &'a mut SubProc, } impl <'a>Iterator for SubProcess...
code_fim
hard
{ "lang": "rust", "repo": "seik0ixtem/sqlplus_run", "path": "/src/sub_proc.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ordovicia/oci-image-rs path: /image-spec/src/lib.rs //! OCI image schema in Rust. //! //! Schema in this crate is based on the v1.0.1 release of the OCI image spec. See the //! [OCI image spec] for more information about the spec. //! //! [OCI image spec]: https://github.com/opencontainers/image...
code_fim
hard
{ "lang": "rust", "repo": "ordovicia/oci-image-rs", "path": "/image-spec/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ser.collect_str(self) } } #[cfg(feature = "serde")] impl<'de> serde::Deserialize<'de> for $s { fn deserialize<D: serde::Deserializer<'de>>(deser: D) -> Result<Self, D::Error> { let s = String::deserialize(deser)?; ...
code_fim
hard
{ "lang": "rust", "repo": "ordovicia/oci-image-rs", "path": "/image-spec/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn team_from_query_param_test() { let team = &Team::from_query_param("user~1").unwrap(); assert_eq!("[{\"id\":\"team1\",\"type\":\"official\"},{\"id\":\"other_team1\",\"type\":\"virtual\"}]", json::encode(team).unwrap()); } #[test] fn teams_t...
code_fim
hard
{ "lang": "rust", "repo": "danpersa/rusty-team", "path": "/src/team.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Team { fn new(user_number: &str) -> Vec<Team> { vec![ Team { id: "team".to_string() + user_number, team_type: "official".to_string() }, Team { id: "other_team".to_string() + user_number, team_type: "virtual".to_string() } ] } pub fn from_query_para...
code_fim
hard
{ "lang": "rust", "repo": "danpersa/rusty-team", "path": "/src/team.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danpersa/rusty-team path: /src/team.rs use rustc_serialize::{Encodable, Encoder}; static MEMBER_FORMAT: &'static str = "The member param should have the format `user~1`."; static MEMBER_START_ERR: &'static str = "The member param does not start with `user~`."; static TEAMS_MISSING: &'static str...
code_fim
hard
{ "lang": "rust", "repo": "danpersa/rusty-team", "path": "/src/team.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> memory; pub mod net; pub mod process; pub mod virt;<|fim_prefix|>// repo: ilya-epifanov/heim path: /benchmarks/src/lib.rs //! `[lib]` part contains a bunch of criterion groups, //! benchmarking each one of the `heim` component<|fim_middle|>s. pub mod cpu; pub mod disk; pub mod host; pub mod
code_fim
easy
{ "lang": "rust", "repo": "ilya-epifanov/heim", "path": "/benchmarks/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilya-epifanov/heim path: /benchmarks/src/lib.rs //! `[lib]` part contains a bunch of criterion groups, //! benchmarking each one of the `heim` component<|fim_suffix|> memory; pub mod net; pub mod process; pub mod virt;<|fim_middle|>s. pub mod cpu; pub mod disk; pub mod host; pub mod
code_fim
easy
{ "lang": "rust", "repo": "ilya-epifanov/heim", "path": "/benchmarks/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rust path: /src/tools/clippy/tests/ui-toml/print_macro/print_macro.rs //@compile-flags: --test #![warn(clippy::print_stdout)] #![warn(clippy::print_stderr)] <|fim_suffix|> print!("{n}"); eprint!("{n}"); } #[test] pub fn foo1() { print!("{}", 1); eprint!("{}", 1); } #[...
code_fim
easy
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/src/tools/clippy/tests/ui-toml/print_macro/print_macro.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] fn foo3() { print!("{}", 1); eprint!("{}", 1); }<|fim_prefix|>// repo: rust-lang/rust path: /src/tools/clippy/tests/ui-toml/print_macro/print_macro.rs //@compile-flags: --test #![warn(clippy::print_stdout)] #![warn(clippy::print_stderr)] <|fim_middle|>fn foo(n: u32) { print!("{n...
code_fim
medium
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/src/tools/clippy/tests/ui-toml/print_macro/print_macro.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rbalicki2/hello-rocket path: /src/models/mod.rs mod user; mod id; mod limit_offset_param; mod photo; mod auth_token; mod authenticated_user; mod user_role; pub use self::user::*; pub use self::id::*; <|fim_suffix|>th_token::*; pub use self::authenticated_user::*; pub use self::user_role::*;<|fi...
code_fim
medium
{ "lang": "rust", "repo": "rbalicki2/hello-rocket", "path": "/src/models/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub use self::limit_offset_param::*; pub use self::photo::*; pub use self::auth_token::*; pub use self::authenticated_user::*; pub use self::user_role::*;<|fim_prefix|>// repo: rbalicki2/hello-rocket path: /src/models/mod.rs mod user; mod id; mod limit_offset_param; mod photo; mod auth_token; mod aut<|fi...
code_fim
medium
{ "lang": "rust", "repo": "rbalicki2/hello-rocket", "path": "/src/models/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>th_token::*; pub use self::authenticated_user::*; pub use self::user_role::*;<|fim_prefix|>// repo: rbalicki2/hello-rocket path: /src/models/mod.rs mod user; mod id; mod limit_offset_param; mod photo; mod auth_token; mod aut<|fim_middle|>henticated_user; mod user_role; pub use self::user::*; pub use sel...
code_fim
medium
{ "lang": "rust", "repo": "rbalicki2/hello-rocket", "path": "/src/models/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn new(width: u32, height: u32) -> CaRender { CaRender { width, height, } } }<|fim_prefix|>// repo: Xulder/sand-engine path: /src/carender.rs use ::image; pub use graphics::*; use image::RgbaImage; use opengl_graphics::{GlGraphics, Texture, TextureSetti...
code_fim
hard
{ "lang": "rust", "repo": "Xulder/sand-engine", "path": "/src/carender.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Xulder/sand-engine path: /src/carender.rs use ::image; pub use graphics::*; use image::RgbaImage; use opengl_graphics::{GlGraphics, Texture, TextureSettings}; use piston::input::RenderArgs; use crate::caengine::SandBox; <|fim_suffix|>impl CaRender { pub fn render_sandbox(&mut self, sandbox...
code_fim
medium
{ "lang": "rust", "repo": "Xulder/sand-engine", "path": "/src/carender.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match self { Literal::Signed(val) => write!(f, "{}", val), Literal::SignedLong(val) => write!(f, "{}L", val), Literal::SignedLongLong(val) => write!(f, "{}LL", val), Literal::Unsigned(val) => write!(f, "{}U", val), Literal::UnsignedLong(v...
code_fim
medium
{ "lang": "rust", "repo": "calebzulawski/crusty", "path": "/src/literal.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: calebzulawski/crusty path: /src/literal.rs #[derive(Debug)] pub enum Literal { Signed(i128), SignedLong(i128), SignedLongLong(i128), Unsigned(u128), UnsignedLong(u128), UnsignedLongLong(u128), Character(char), WideCharacter(char), Float(FloatConstant), Dou...
code_fim
hard
{ "lang": "rust", "repo": "calebzulawski/crusty", "path": "/src/literal.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn scientific(integer: i128, fraction: i128, exponent: i128) -> Self { Self { value: format!("{}.{}e{}", integer, fraction, exponent), } } pub fn from_float(float: f64) -> Self { Self { value: format!("{:.}", float), } } } impl ...
code_fim
hard
{ "lang": "rust", "repo": "calebzulawski/crusty", "path": "/src/literal.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> 3 } fn position(&self, face: usize, vert: usize) -> [f32; 3] { self.positions[self.indices.map(face, vert)].0 } fn normal(&self, face: usize, vert: usize) -> [f32; 3] { self.normals[self.indices.map(face, vert)].0 } fn tex_coord(&self, face: usize, vert: usi...
code_fim
hard
{ "lang": "rust", "repo": "MirecIT/amethyst", "path": "/amethyst_gltf/src/importer/mesh.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MirecIT/amethyst path: /amethyst_gltf/src/importer/mesh.rs use std::{iter::repeat, ops::Range}; use amethyst_assets::error::Error; use amethyst_core::math::{zero, Vector3}; use amethyst_rendy::{ rendy::mesh::{Color, MeshBuilder, Normal, Position, Tangent, TexCoord}, skinning::JointCombi...
code_fim
hard
{ "lang": "rust", "repo": "MirecIT/amethyst", "path": "/amethyst_gltf/src/importer/mesh.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/nghttp2 path: /src/frames/frame_header.rs use crate::StreamId; use libnghttp2_sys::nghttp2_frame_hd; <|fim_suffix|> /// Access the stream identifier (aka, stream ID). #[inline] fn stream_id(&self) -> StreamId { self.header().stream_id } }<|fim_middle|>/// Access the Header fi...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/nghttp2", "path": "/src/frames/frame_header.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Access the stream identifier (aka, stream ID). #[inline] fn stream_id(&self) -> StreamId { self.header().stream_id } }<|fim_prefix|>// repo: isgasho/nghttp2 path: /src/frames/frame_header.rs use crate::StreamId; use libnghttp2_sys::nghttp2_frame_hd; <|fim_middle|>/// Access the Header fi...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/nghttp2", "path": "/src/frames/frame_header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Get the flags from the Frame Header. /// /// TODO(yw): figure out which flags /// TODO(yw): create a flags type #[inline] fn flags(&self) -> u8 { self.header().flags } /// Access the stream identifier (aka, stream ID). #[inline] fn stream_id(&self) -> StreamId { self.heade...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/nghttp2", "path": "/src/frames/frame_header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Sink<Message> for WebSocket { type Error = Error; fn poll_ready(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> { match ready!(Pin::new(&mut self.inner).poll_ready(cx)) { Ok(()) => Poll::Ready(Ok(())), Err(e) => Poll::Ready(Err...
code_fim
hard
{ "lang": "rust", "repo": "Troland/viz", "path": "/viz-core/src/ws.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Troland/viz path: /viz-core/src/ws.rs //! WebSockets //! Thanks: https://github.com/seanmonstar/warp use std::{ borrow::Cow, fmt, future::Future, pin::Pin, task::{Context, Poll}, }; use headers::{ Connection, HeaderMapExt, SecWebsocketAccept, SecWebsocketKey, SecWebsock...
code_fim
hard
{ "lang": "rust", "repo": "Troland/viz", "path": "/viz-core/src/ws.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>read_id::*; pub use self::thread_rights::*; pub use self::thread_enum::*; pub use self::thread::*;<|fim_prefix|>// repo: vOROn200/external path: /src/thread/mod.rs /*! Threads. !*/ mod thread_id; mod thread_right<|fim_middle|>s; mod thread_enum; mod thread; pub use self::th
code_fim
easy
{ "lang": "rust", "repo": "vOROn200/external", "path": "/src/thread/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vOROn200/external path: /src/thread/mod.rs /*! Threads. !*/ mod thread_id; mod thread_right<|fim_suffix|>se self::thread_enum::*; pub use self::thread::*;<|fim_middle|>s; mod thread_enum; mod thread; pub use self::thread_id::*; pub use self::thread_rights::*; pub u
code_fim
medium
{ "lang": "rust", "repo": "vOROn200/external", "path": "/src/thread/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>se self::thread_enum::*; pub use self::thread::*;<|fim_prefix|>// repo: vOROn200/external path: /src/thread/mod.rs /*! Threads. !*/ mod thread_id; mod thread_rights; mod thread_enum; mod thread; pub use self::th<|fim_middle|>read_id::*; pub use self::thread_rights::*; pub u
code_fim
easy
{ "lang": "rust", "repo": "vOROn200/external", "path": "/src/thread/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Create a `toml::Table` from a byte array. /// /// `None` will be returned if the byte array contains invalid UTF-8 or does not represent a /// `toml::Table`. pub fn table_from_bytes(bytes: &[u8]) -> Option<toml::Table> { str::from_utf8(bytes) .ok() .and_then(table_from_str) } pub ...
code_fim
medium
{ "lang": "rust", "repo": "mfdii/habitat", "path": "/components/core/src/util/toml.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mfdii/habitat path: /components/core/src/util/toml.rs // Copyright (c) 2017 Chef Software Inc. and/or applicable contributors // // 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 ...
code_fim
hard
{ "lang": "rust", "repo": "mfdii/habitat", "path": "/components/core/src/util/toml.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>use toml; /// Create a `toml::Table` from a byte array. /// /// `None` will be returned if the byte array contains invalid UTF-8 or does not represent a /// `toml::Table`. pub fn table_from_bytes(bytes: &[u8]) -> Option<toml::Table> { str::from_utf8(bytes) .ok() .and_then(table_from_s...
code_fim
medium
{ "lang": "rust", "repo": "mfdii/habitat", "path": "/components/core/src/util/toml.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn unzip<P: AsRef<Path>, R: Read + Seek>(zip: &mut ZipArchive<R>, dir: P) -> Result<PathBuf> { for i in 0..zip.len() { let mut file = zip.by_index(i)?; let outpath = dir.as_ref().join(file.sanitized_name()); if file.name().ends_with('/') { fs::create_dir_all(&o...
code_fim
medium
{ "lang": "rust", "repo": "raftario/Meca", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(unix)] { use std::os::unix::fs::PermissionsExt; if let Some(mode) = file.unix_mode() { fs::set_permissions(&outpath, fs::Permissions::from_mode(mode))?; } } } let mut walkdir = WalkDir::new(&dir) .min_depth...
code_fim
hard
{ "lang": "rust", "repo": "raftario/Meca", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raftario/Meca path: /src/utils.rs use crate::Result; use anyhow::anyhow; use std::{ fs, io::{self, Read, Seek}, path::{Path, PathBuf}, }; use walkdir::WalkDir; use zip::ZipArchive; #[macro_export] macro_rules! with_progress { ($f:expr, $m:expr) => {{ let p = indicatif::P...
code_fim
medium
{ "lang": "rust", "repo": "raftario/Meca", "path": "/src/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_inv() { let bp = RistrettoElem(constants::RISTRETTO_BASEPOINT_POINT); let bp_inv = Ristretto::inv(&bp); assert!(Ristretto::op(&bp, &bp_inv) == Ristretto::id()); assert_ne!(bp, bp_inv); } #[test] fn test_exp() { let bp = RistrettoElem(constants::RISTRETTO_BASE...
code_fim
hard
{ "lang": "rust", "repo": "cambrian/accumulator", "path": "/src/group/ristretto.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cambrian/accumulator path: /src/group/ristretto.rs //! Ristretto group implementation (based on the `curve25519-dalek` crate). use super::Group; use crate::util::{int, TypeRep}; use curve25519_dalek::ristretto::RistrettoPoint; use curve25519_dalek::scalar::Scalar; use curve25519_dalek::traits::I...
code_fim
hard
{ "lang": "rust", "repo": "cambrian/accumulator", "path": "/src/group/ristretto.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut response = Response::new(Body::empty()); let hero_doc = request.into_body().concat2().and_then(move |body: Chunk| { let connection = db::establish_connection(); let json: DocumentDto<HeroDto> = serde_json::from_slice(&body).unwrap(); let hero_dto = json.deserialize(...
code_fim
medium
{ "lang": "rust", "repo": "romainbellande/rust-hyper-jsonapi", "path": "/src/modules/hero/controller.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: romainbellande/rust-hyper-jsonapi path: /src/modules/hero/controller.rs use hyper::{Response, Body, Request, Chunk}; use futures::future; use futures::Stream; use futures::Future; use crate::helpers::{BoxFuture}; use crate::db; use super::model::{Hero, HeroDto}; use japi::api::{DocumentDto}; u...
code_fim
hard
{ "lang": "rust", "repo": "romainbellande/rust-hyper-jsonapi", "path": "/src/modules/hero/controller.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // directory the main .proto file resides in let proto_dir = proto_path .parent() .expect("proto file should reside in a directory"); tonic_build::configure() .type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") .compile(&[proto_path], &[prot...
code_fim
medium
{ "lang": "rust", "repo": "kuberails/bossman", "path": "/bossman_server/build.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kuberails/bossman path: /bossman_server/build.rs use std::path::Path; fn main() -> Result<(), Box<dyn std::error::Error>> { <|fim_suffix|> // directory the main .proto file resides in let proto_dir = proto_path .parent() .expect("proto file should reside in a directory");...
code_fim
medium
{ "lang": "rust", "repo": "kuberails/bossman", "path": "/bossman_server/build.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> tonic_build::configure() .type_attribute(".", "#[derive(serde::Serialize, serde::Deserialize)]") .compile(&[proto_path], &[proto_dir])?; Ok(()) }<|fim_prefix|>// repo: kuberails/bossman path: /bossman_server/build.rs use std::path::Path; fn main() -> Result<(), Box<dyn std::erro...
code_fim
medium
{ "lang": "rust", "repo": "kuberails/bossman", "path": "/bossman_server/build.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let pairs: Vec<_> = udp_lines[0] .split_ascii_whitespace() .zip(udp_lines[1].split_ascii_whitespace()) .collect(); let udp_stats: HashMap<String, usize> = pairs[1..] .iter() .map(|(label, val)| (label.to_string(), val.parse::<usize>().unwrap())) .col...
code_fim
hard
{ "lang": "rust", "repo": "jstarry/solana", "path": "/core/src/system_monitor_service.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jstarry/solana path: /core/src/system_monitor_service.rs #[cfg(target_os = "linux")] use std::{fs::File, io::BufReader, path::Path}; use { solana_sdk::timing::AtomicInterval, std::{ collections::HashMap, io::BufRead, sync::{ atomic::{AtomicBool, Orderi...
code_fim
hard
{ "lang": "rust", "repo": "jstarry/solana", "path": "/core/src/system_monitor_service.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lexkane/Rust path: /Concurrency/src/SendSync.rs use std::cell::Cell; fn main(){ <|fim_suffix|> }); counter.set(counter.get()+1) }).unwrap(); println!("{}",counter.get()); }<|fim_middle|> let counter =Cell::new(0); crossbeam::scope(|ls|{ s.spawn(|_|...
code_fim
medium
{ "lang": "rust", "repo": "Lexkane/Rust", "path": "/Concurrency/src/SendSync.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> }); counter.set(counter.get()+1) }).unwrap(); println!("{}",counter.get()); }<|fim_prefix|>// repo: Lexkane/Rust path: /Concurrency/src/SendSync.rs use std::cell::Cell; fn main(){ <|fim_middle|> let counter =Cell::new(0); crossbeam::scope(|ls|{ s.spawn(|_|...
code_fim
medium
{ "lang": "rust", "repo": "Lexkane/Rust", "path": "/Concurrency/src/SendSync.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let res = lcb_get3(instance, std::ptr::null(), &gcmd as *const lcb_CMDGET); println!("Get Res: {:?}", res); let res = lcb_wait(instance); println!("Get Wait Res: {:?}", res); lcb_destroy(instance); } } unsafe extern "C" fn op_callback(instance: lcb_t, cbtype:...
code_fim
hard
{ "lang": "rust", "repo": "daschl/couchbase-rs", "path": "/couchbase-sys/examples/helloworld.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let key = "21st_amendment_brewery_cafe"; let ckey = CString::new(key).unwrap(); let mut gcmd = lcb_CMDGET::default(); gcmd.key._type = lcb_KVBUFTYPE::LCB_KV_COPY; gcmd.key.contig.bytes = ckey.as_ptr() as *const libc::c_void; gcmd.key.contig.nbytes = key.len(...
code_fim
medium
{ "lang": "rust", "repo": "daschl/couchbase-rs", "path": "/couchbase-sys/examples/helloworld.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: daschl/couchbase-rs path: /couchbase-sys/examples/helloworld.rs extern crate couchbase_sys; extern crate libc; use couchbase_sys::*; use std::ffi::CString; use std::ptr; use std::ffi::CStr; /// Run with: export LCB_LOGLEVEL=5; cargo run --example=helloworld fn main() { let connstr = CStrin...
code_fim
hard
{ "lang": "rust", "repo": "daschl/couchbase-rs", "path": "/couchbase-sys/examples/helloworld.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Before serializing the packet, it is very important to call // finalize() to ensure the header of the message is consistent // with its payload. Otherwise, a panic may occur when calling // `serialize()` packet.finalize(); // Prepare a buffer to serialize the packet. Note that ...
code_fim
medium
{ "lang": "rust", "repo": "little-dude/netlink", "path": "/netlink-packet-core/examples/rtnetlink.rs", "mode": "spm", "license": "MITNFA", "source": "the-stack-v2" }
<|fim_prefix|>// repo: little-dude/netlink path: /netlink-packet-core/examples/rtnetlink.rs // SPDX-License-Identifier: MIT use netlink_packet_core::{NetlinkHeader, NetlinkMessage, NLM_F_DUMP, NLM_F_REQUEST}; use netlink_packet_route::rtnl::{LinkMessage, RtnlMessage}; <|fim_suffix|> // Before serializing the pack...
code_fim
hard
{ "lang": "rust", "repo": "little-dude/netlink", "path": "/netlink-packet-core/examples/rtnetlink.rs", "mode": "psm", "license": "MITNFA", "source": "the-stack-v2" }
<|fim_suffix|> pub fn to_vec(&self) -> Vec<Arc<T>> { let state = self.stream.state_mutex.lock().unwrap(); return state.messages.clone(); } pub fn write(&mut self, msg: T) { let mut inner = self.stream.state_mutex.lock().unwrap(); if self.stream.is_terminated.load(Ordering::Re...
code_fim
hard
{ "lang": "rust", "repo": "iasoon/MOZAIC2", "path": "/src/msg_stream.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn clone(&self) -> Self { let mut r = self.stream_handle.reader(); r.pos = self.pos; return r; } } impl<T> Drop for MsgStreamReader<T> { fn drop(&mut self) { let mut inner = self.stream_handle.stream.state_mutex.lock().unwrap(); inner.wakers.retain(...
code_fim
hard
{ "lang": "rust", "repo": "iasoon/MOZAIC2", "path": "/src/msg_stream.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iasoon/MOZAIC2 path: /src/msg_stream.rs use std::sync::{Arc, Mutex}; use std::pin::Pin; use futures::task::{Context, Poll}; use futures::FutureExt; use futures::{Future, Stream}; use futures::task::AtomicWaker; use std::sync::atomic::{AtomicUsize, AtomicBool, Ordering}; // TODO: restructure thi...
code_fim
hard
{ "lang": "rust", "repo": "iasoon/MOZAIC2", "path": "/src/msg_stream.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let token = match output.as_str() { "goto" => Token::Goto, "if" => Token::If, "then" => Token::Then, "else" => Token::Else, "end" => Token::End, "abs" => Token::Abs, "sqrt" => Token::Sqrt, "sin" => Token::Sin, ...
code_fim
hard
{ "lang": "rust", "repo": "Jerald/yoloxide", "path": "/src/tokenizer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Jerald/yoloxide path: /src/tokenizer.rs use yolol_number::YololNumber; use crate::types::Token; use crate::types::SlidingWindow; use crate::types::VecWindow; pub fn tokenize(input: String) -> Result<Vec<Token>, String> { let mut output_vec: Vec<Token> = Vec::new(); let mut w...
code_fim
hard
{ "lang": "rust", "repo": "Jerald/yoloxide", "path": "/src/tokenizer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> impl Render for DOFCamera { fn render(&self, scene: Vec<Box<dyn Object>>, width: u32, height: u32, samples: u32, filename: String) { // The resulting image let mut finalimg: RgbImage = ImageBuffer::new(width, height); // The other 2 vectors for an orthonormal basis let...
code_fim
hard
{ "lang": "rust", "repo": "kingeta/rust_trace", "path": "/src/render.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kingeta/rust_trace path: /src/render.rs use image::{ImageBuffer, RgbImage}; use super::vector::*; use super::colour::*; use super::primitive::*; use super::material::random_float; //texture, material (?) //// Define a scene, with a background and the shapes in it /*pub struct Scene ( pub ...
code_fim
hard
{ "lang": "rust", "repo": "kingeta/rust_trace", "path": "/src/render.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>RROR it is undefined behavior to use this value }<|fim_prefix|>// repo: michalt/rust path: /src/test/ui/consts/const-eval/issue-52442.rs fn main() { [(); { &loop { break } as *const _ as usize } ]; //~^ ERROR casting pointers<|fim_middle|> to integers in constants is unstable //~| E
code_fim
easy
{ "lang": "rust", "repo": "michalt/rust", "path": "/src/test/ui/consts/const-eval/issue-52442.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: michalt/rust path: /src/test/ui/consts/const-eval/issue-52442.rs fn main() { [(); { &loop { break } as *cons<|fim_suffix|> to integers in constants is unstable //~| ERROR it is undefined behavior to use this value }<|fim_middle|>t _ as usize } ]; //~^ ERROR casting pointers
code_fim
easy
{ "lang": "rust", "repo": "michalt/rust", "path": "/src/test/ui/consts/const-eval/issue-52442.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> to integers in constants is unstable //~| ERROR it is undefined behavior to use this value }<|fim_prefix|>// repo: michalt/rust path: /src/test/ui/consts/const-eval/issue-52442.rs fn main() { [(); { &loop { break } as *cons<|fim_middle|>t _ as usize } ]; //~^ ERROR casting pointers
code_fim
easy
{ "lang": "rust", "repo": "michalt/rust", "path": "/src/test/ui/consts/const-eval/issue-52442.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match self.next() { Some(value) => V::unmarshal(value) .map(Option::Some), None => Ok(None) } } }<|fim_prefix|>// repo: CristianNeamtu/rs-bind path: /src/container/seq_iter.rs use std::slice::Iter; use std::vec::IntoIter; use container...
code_fim
medium
{ "lang": "rust", "repo": "CristianNeamtu/rs-bind", "path": "/src/container/seq_iter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl SeqAccess for IntoIter<Value> { fn next_element<V: Deserializable>(&mut self) -> Result<Option<V>, BindError> { match self.next() { Some(value) => V::unmarshal(value) .map(Option::Some), None => Ok(None) } } }<|fim_prefix|>// rep...
code_fim
hard
{ "lang": "rust", "repo": "CristianNeamtu/rs-bind", "path": "/src/container/seq_iter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CristianNeamtu/rs-bind path: /src/container/seq_iter.rs use std::slice::Iter; use std::vec::IntoIter; use container::SeqAccess; use error::BindError; use traits::Deserializable; use types::Value; impl SeqAccess for Iter<'_, Value> { fn next_element<V: Deserializable>(&mut self) ->...
code_fim
medium
{ "lang": "rust", "repo": "CristianNeamtu/rs-bind", "path": "/src/container/seq_iter.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vhdirk/webkit2gtk5-rs path: /webkit2gtk-webextension/src/auto/dom_html_font_element.rs // This file was generated by gir (https://github.com/gtk-rs/gir) // from gir-files (https://github.com/vhdirk/gir-files.git) // from webkit2gtk-gir-files // DO NOT EDIT use crate::DOMElement; use crate::DOME...
code_fim
hard
{ "lang": "rust", "repo": "vhdirk/webkit2gtk5-rs", "path": "/webkit2gtk-webextension/src/auto/dom_html_font_element.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[doc(alias = "face")] fn connect_face_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; #[doc(alias = "size")] fn connect_size_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId; } impl<O: IsA<DOMHTMLFontElement>> DOMHTMLFontElementExt for O { fn color(&sel...
code_fim
hard
{ "lang": "rust", "repo": "vhdirk/webkit2gtk5-rs", "path": "/webkit2gtk-webextension/src/auto/dom_html_font_element.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>(), ) .into_iter() .map(|row| { let c = row.into_iter().collect::<Counter<_>>(); c.most_common()[c.len() - 1].0 }) .collect() }<|fim_prefix|>// repo: zaksky7/Rust-project path: /src/year2016/day06.rs use counter::Counter; use crate::utils::*; pub fn part1(input: &str...
code_fim
hard
{ "lang": "rust", "repo": "zaksky7/Rust-project", "path": "/src/year2016/day06.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zaksky7/Rust-project path: /src/year2016/day06.rs use counter::Counter; use crate::utils::*; pub fn part1(input: &str) -> String { transpose( &input .lines() .map(|x| x.chars().collect()) .collect::<Vec<_>>(), ) .into_iter() .map(|row...
code_fim
medium
{ "lang": "rust", "repo": "zaksky7/Rust-project", "path": "/src/year2016/day06.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn part2(input: &str) -> String { transpose( &input .lines() .map(|x| x.chars().collect()) .collect::<Vec<_>>(), ) .into_iter() .map(|row| { let c = row.into_iter().collect::<Counter<_>>(); c.most_common()[c.len() - 1].0 ...
code_fim
medium
{ "lang": "rust", "repo": "zaksky7/Rust-project", "path": "/src/year2016/day06.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> foo(1, 2, 3) == 1; foo(1, 2) == 3; foo() == 3; bar([1, 2, 3], Some { a : [1, 2, 3], b : false }); bar([1, 2], Some { a : [1, 2, 3], b : false }); bar([1, 2]); baz()[0]; baz(1); cats().a[0] == 1; }<|fim_prefix|>// repo: mucompilers/project path: /pa3/t...
code_fim
medium
{ "lang": "rust", "repo": "mucompilers/project", "path": "/pa3/tests-p2/13-funcall.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }