text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> self, f: impl FnOnce(&mut Formatter<'_, W>) -> Result<(), W::Error>, ) -> Result<(), W::Error> { f(self) } }<|fim_prefix|>// repo: Rahix/ufmt path: /src/sealed.rs use crate::{uWrite, Formatter}; pub trait DoAsFormatter { type Writer: uWrite; fn do_as_formatter( ...
code_fim
medium
{ "lang": "rust", "repo": "Rahix/ufmt", "path": "/src/sealed.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Rahix/ufmt path: /src/sealed.rs use crate::{uWrite, Formatter}; pub trait DoAsFormatter { type Writer: uWrite; fn do_as_formatter( self, f: impl FnOnce(&mut Formatter<'_, Self::Writer>) -> Result<(), <Self::Writer as uWrite>::Error>, ) -> Result<(), <Self::Writer as...
code_fim
medium
{ "lang": "rust", "repo": "Rahix/ufmt", "path": "/src/sealed.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: togglebyte/nightmaregl path: /src/color.rs #![deny(missing_docs)] use crate::pixels::Pixel; #[derive(Debug, Copy, Clone)] /// A colour with values ranging from 0.0 to 1.0 pub struct Color { /// Red pub r: f32, /// Green pub g: f32, /// Blue pub b: f32, /// Alpha ...
code_fim
medium
{ "lang": "rust", "repo": "togglebyte/nightmaregl", "path": "/src/color.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self { r: 0.0, g: 0.0, b: 0.0, a: 1.0, } } } impl From<Pixel> for Color { fn from(p: Pixel) -> Self { Self { r: (p.r as f32 / 255.0), g: (p.g as f32 / 255.0), b: (p.b as f32 / 255.0), ...
code_fim
medium
{ "lang": "rust", "repo": "togglebyte/nightmaregl", "path": "/src/color.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for Color { fn default() -> Self { Self { r: 0.0, g: 0.0, b: 0.0, a: 1.0, } } } impl From<Pixel> for Color { fn from(p: Pixel) -> Self { Self { r: (p.r as f32 / 255.0), g: (p.g as f32 ...
code_fim
hard
{ "lang": "rust", "repo": "togglebyte/nightmaregl", "path": "/src/color.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let addr = vec![ 0xa3, 0xb2, 0xcc, 0xdd, 0x71, 0x86, 0xf1, 0x68, 0x5f, 0x21, 0xf2, 0x48, 0x2a, 0xf4, 0xfb, 0x34, 0x46, 0xa8, 0x4b, 0x35, ]; let heartbeat = Heartbeat { validator_address: addr, validator_index: 1, height: 1...
code_fim
hard
{ "lang": "rust", "repo": "wannabit-jayb/kms", "path": "/src/types/heartbeat.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wannabit-jayb/kms path: /src/types/heartbeat.rs use super::TendermintSign; use subtle_encoding::hex::encode; #[derive(Clone, PartialEq, Message)] pub struct Heartbeat { #[prost(bytes, tag = "1")] pub validator_address: Vec<u8>, #[prost(sint64)] pub validator_index: i64, #[pr...
code_fim
hard
{ "lang": "rust", "repo": "wannabit-jayb/kms", "path": "/src/types/heartbeat.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(got, want) } #[test] fn test_serializationuns_withoutaddr() { // identical to above but without validator_adress: let heartbeat = Heartbeat { validator_address: vec![], validator_index: 1, height: 15, round: 10...
code_fim
hard
{ "lang": "rust", "repo": "wannabit-jayb/kms", "path": "/src/types/heartbeat.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Copy, Clone, Debug, EnumIter)] pub enum Relation {} impl ColumnTrait for Column { type EntityName = Entity; fn def(&self) -> ColumnDef { match self { Self::Id => ColumnType::String(None).def().unique(), Self::CreatedAt => ColumnType::BigInteger.def(), ...
code_fim
hard
{ "lang": "rust", "repo": "L2-Technology/sensei", "path": "/entity/src/peer_address.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Debug, PartialEq, DeriveModel, DeriveActiveModel, Deserialize, Serialize)] pub struct Model { pub id: String, pub created_at: i64, pub updated_at: i64, pub last_connected_at: i64, pub node_id: String, pub pubkey: String, pub address: Vec<u8>, pub source: i16...
code_fim
hard
{ "lang": "rust", "repo": "L2-Technology/sensei", "path": "/entity/src/peer_address.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: L2-Technology/sensei path: /entity/src/peer_address.rs use sea_orm::{entity::prelude::*, ActiveValue}; use serde::{Deserialize, Serialize}; use crate::seconds_since_epoch; #[derive(Debug, Clone, PartialEq, EnumIter, DeriveActiveEnum, Serialize, Deserialize)] #[sea_orm(rs_type = "i16", db_type ...
code_fim
hard
{ "lang": "rust", "repo": "L2-Technology/sensei", "path": "/entity/src/peer_address.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> frame.draw_line(50.0, 50.0, 100.0, 100.0, 15.0); frame.draw_lines(vec![(100.0, 100.0),window.mouse_pos(),(0.0, 100.0)].into_iter(), 10.0); frame.draw_arc((200.0, 200.0), 100.0, a, b, 4.0); a += 0.001; b += 0.001; } }<|fim_prefix|>// repo: TyOverby/lux-deprecate...
code_fim
medium
{ "lang": "rust", "repo": "TyOverby/lux-deprecated", "path": "/examples/lines.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TyOverby/lux-deprecated path: /examples/lines.rs extern crate lux; use lux::prelude::*; fn main() { <|fim_suffix|> frame.draw_line(50.0, 50.0, 100.0, 100.0, 15.0); frame.draw_lines(vec![(100.0, 100.0),window.mouse_pos(),(0.0, 100.0)].into_iter(), 10.0); frame.draw_arc((2...
code_fim
medium
{ "lang": "rust", "repo": "TyOverby/lux-deprecated", "path": "/examples/lines.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: finchers-rs/finchers path: /tests/endpoint/macros.rs use finchers::endpoint::syntax; #[test] fn compile_test_path() { let _ = syntax::path!("/"); let _ = syntax::path!("/foo"); let _ = syntax::path!("/foo/"); let _ = syntax::path!("/foo/<i32>"); let _ = syntax::path!("/foo/<...
code_fim
medium
{ "lang": "rust", "repo": "finchers-rs/finchers", "path": "/tests/endpoint/macros.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// let e1 = syntax::segment("foo"); // let e2 = routes!(e1, syntax::segment("bar"), syntax::segment("baz")); // let e3 = routes!(syntax::segment("foobar"), e2); // let _e4 = routes!(syntax::segment("foobar"), e3,); // } #[test] fn test_extract_path_statics() { let mut runner = fincher...
code_fim
hard
{ "lang": "rust", "repo": "finchers-rs/finchers", "path": "/tests/endpoint/macros.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> matches::assert_matches!(runner.apply_raw("/foo/bar"), Ok(())); matches::assert_matches!(runner.apply_raw("/"), Err(..)); } #[test] fn test_extract_path_single_param() { let mut runner = finchers::test::runner({ syntax::path!("/foo/<i32>") }); matches::assert_matches!(runner.apply("/foo/...
code_fim
medium
{ "lang": "rust", "repo": "finchers-rs/finchers", "path": "/tests/endpoint/macros.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: schallert/foundationdb-rs path: /foundationdb/tests/watch.rs // Copyright 2018 foundationdb-rs developers, https://github.com/bluejekyll/foundationdb-rs/graphs/contributors // // Licensed under the Apache License, Version 2.0, <LICENSE-APACHE or // http://apache.org/licenses/LICENSE-2.0> or the ...
code_fim
hard
{ "lang": "rust", "repo": "schallert/foundationdb-rs", "path": "/foundationdb/tests/watch.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[tokio::test] async fn test_watch_without_commit() -> error::Result<()> { common::setup_static(); const KEY: &[u8] = b"test-watch-2"; let db = common::create_db().await?; let trx = db.create_trx()?; eprintln!("setting watch"); // trx will be dropped without `commit`, so a watch ...
code_fim
hard
{ "lang": "rust", "repo": "schallert/foundationdb-rs", "path": "/foundationdb/tests/watch.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let v = vec![ 1_f64, 2_f64, 3_f64, 4_f64, 5_f64, 6_f64, 7_f64, 8_f64, 9_f64, 10_f64, 11_f64, 12_f64, 13_f64, 14_f64, 15_f64, 16_f64, ]; let of_25 = OverlappingFrames::new(&v, 4, 0.25); let of_50 = OverlappingFrames::new(&v, 4, 0.50); let of_7...
code_fim
hard
{ "lang": "rust", "repo": "deekerno/audisee", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let advance_amount = std::cmp::min(self.stride, self.buffer.len()); self.buffer.drain(0..advance_amount); Some(subslice) } else { None } } } pub(crate) const TEST_SIGNAL: &[f64] = &[ 0.35039299166804794, 0.2264099842027547, ...
code_fim
hard
{ "lang": "rust", "repo": "deekerno/audisee", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: deekerno/audisee path: /src/utils.rs //! Utility crate. /// This struct is used to create overlapping frames of a signal. /// /// Splitting an audio signal into successive non-overlapping /// frames can lead to smearing of bin magnitudes as it is possible that /// the signal may not start and e...
code_fim
hard
{ "lang": "rust", "repo": "deekerno/audisee", "path": "/src/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mr-Milk/neighborhood_analysis path: /src/lib.rs RTree, RTreeObject, AABB}; use spade::BoundingRect; // pyo3 dependencies use pyo3::exceptions::PyTypeError; use pyo3::prelude::*; use pyo3::wrap_pyfunction; #[pymodule] fn neighborhood_analysis(_py: Python, m: &PyModule) -> PyResult<()> { m.a...
code_fim
hard
{ "lang": "rust", "repo": "Mr-Milk/neighborhood_analysis", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let count = bbox_list.len(); let mut neighbors = vec![]; if has_labels { for i in 0..count { neighbors.push(result.get(&i).unwrap().clone().iter().map( |t| { labels[*t] } ).collect()) } } else { for i in 0..count { ...
code_fim
hard
{ "lang": "rust", "repo": "Mr-Milk/neighborhood_analysis", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mr-Milk/neighborhood_analysis path: /src/lib.rs rtools; use rand::seq::SliceRandom; use rand::thread_rng; use std::collections::HashMap; use kdbush::KDBush; use counter::Counter; use rayon::prelude::*; use rstar::{RTree, RTreeObject, AABB}; use spade::BoundingRect; // pyo3 dependencies use pyo...
code_fim
hard
{ "lang": "rust", "repo": "Mr-Milk/neighborhood_analysis", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: eviltak/physics2d-rs path: /src/collision/broad_phase/bounds_tree/mod.rs extern crate core; #[cfg(test)] mod tests; use crate::math::{Bounds, Vec2}; use crate::util::pool; use crate::world::{Bodies, ConstraintsMap, BodyPair, Body, BodyId}; use crate::collision::ContactConstraint; use std; use...
code_fim
hard
{ "lang": "rust", "repo": "eviltak/physics2d-rs", "path": "/src/collision/broad_phase/bounds_tree/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let parent_id = self.get_node(leaf_id).parent; let sibling_id = { let parent = self.get_node(parent_id); if parent.left == leaf_id { parent.right } else { parent.left } }; if self.root_...
code_fim
hard
{ "lang": "rust", "repo": "eviltak/physics2d-rs", "path": "/src/collision/broad_phase/bounds_tree/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct BoundsTreeBroadPhase { tree: BoundsTree<BodyId>, reinserted_bodies: Vec<BodyId>, } impl BoundsTreeBroadPhase { pub fn new() -> BoundsTreeBroadPhase { BoundsTreeBroadPhase { tree: BoundsTree::new(), reinserted_bodies: Vec::new(), } } ...
code_fim
hard
{ "lang": "rust", "repo": "eviltak/physics2d-rs", "path": "/src/collision/broad_phase/bounds_tree/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Greast/r-graph path: /src/extended/header.rs use std::cmp::Ordering; #[derive(Default, Copy, Clone, Debug)] pub struct Header<Head, Body>(pub Head, pub Body); impl<Head, Body> PartialEq for Header<Head, Body> where Head: PartialEq, { fn eq(&self, other: &Self) -> bool { <|fim_suffix|> ...
code_fim
hard
{ "lang": "rust", "repo": "Greast/r-graph", "path": "/src/extended/header.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<Head, Body> Ord for Header<Head, Body> where Head: Ord, { fn cmp(&self, other: &Self) -> Ordering { self.0.cmp(&other.0) } }<|fim_prefix|>// repo: Greast/r-graph path: /src/extended/header.rs use std::cmp::Ordering; #[derive(Default, Copy, Clone, Debug)] pub struct Header<Head, ...
code_fim
hard
{ "lang": "rust", "repo": "Greast/r-graph", "path": "/src/extended/header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: radicle-dev/bitcoins-rs path: /bitcoins/src/types/utxo.rs //! UTXO struct. Holds information necessary for signing future txns. //! //! The UTXO struct holds the outpoint, value, and script pubkey of a previous output. It may also //! hold the underlying witness script or redeem script if any. I...
code_fim
hard
{ "lang": "rust", "repo": "radicle-dev/bitcoins-rs", "path": "/bitcoins/src/types/utxo.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Return a reference to the spend script pub fn spend_script(&self) -> &SpendScript { &self.spend_script } /// Return the script that ought to be signed. This is the spend_script (redeem/witness /// script) if present, the script pubkey if legacy PKH, and the legacy PKH scri...
code_fim
hard
{ "lang": "rust", "repo": "radicle-dev/bitcoins-rs", "path": "/bitcoins/src/types/utxo.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Erguotou/lpc-pac path: /lpc54608/src/syscon/ahbclkctrl1.rs 0_R = crate::R<bool, bool>; #[doc = "Write proxy for field `FLEXCOMM0`"] pub struct FLEXCOMM0_W<'a> { w: &'a mut W, } impl<'a> FLEXCOMM0_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a...
code_fim
hard
{ "lang": "rust", "repo": "Erguotou/lpc-pac", "path": "/lpc54608/src/syscon/ahbclkctrl1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[doc = r"Clears the field bit"] #[inline(always)] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc = r"Writes raw bits to the field"] #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 27)) | (((val...
code_fim
hard
{ "lang": "rust", "repo": "Erguotou/lpc-pac", "path": "/lpc54608/src/syscon/ahbclkctrl1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Erguotou/lpc-pac path: /lpc54608/src/syscon/ahbclkctrl1.rs th value 0"] impl crate::ResetValue for super::AHBCLKCTRL1 { type Type = u32; #[inline(always)] fn reset_value() -> Self::Type { 0 } } #[doc = "Reader of field `MRT`"] pub type MRT_R = crate::R<bool, bool>; #[doc ...
code_fim
hard
{ "lang": "rust", "repo": "Erguotou/lpc-pac", "path": "/lpc54608/src/syscon/ahbclkctrl1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andoriyu/material-design-icons-rs path: /src/materialiconsround/image/icon_wb_sunny.rs pub struct IconWbSunny { props: crate::Props, } impl yew::Component for IconWbSunny { type Properties = crate::Props; type Message = (); fn create(props: Self::Properties, _: yew::prelude::Compon...
code_fim
medium
{ "lang": "rust", "repo": "andoriyu/material-design-icons-rs", "path": "/src/materialiconsround/image/icon_wb_sunny.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn input() -> String { let mut file = File::open("src/year_2015/input/input_day_2").unwrap(); let mut string = String::new(); let _ = file.read_to_string(&mut string); string }<|fim_prefix|>// repo: jmageau/advent_of_code path: /src/year_2015/day_2.rs use std::fs::File; use std::io::prelu...
code_fim
hard
{ "lang": "rust", "repo": "jmageau/advent_of_code", "path": "/src/year_2015/day_2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jmageau/advent_of_code path: /src/year_2015/day_2.rs use std::fs::File; use std::io::prelude::*; pub fn answers() -> String { format!("{}, {}", answer_one(), answer_two()) } fn answer_one() -> String { let input = input(); let lines = input.lines(); let mut total_area = 0; ...
code_fim
medium
{ "lang": "rust", "repo": "jmageau/advent_of_code", "path": "/src/year_2015/day_2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut total_length = 0; for line in lines { let dimensions: Vec<u32> = line.split('x').map(|d| d.parse::<u32>().unwrap()).collect(); let wrap_length = 2 * (dimensions.iter().sum::<u32>() - dimensions.iter().max().unwrap()); let ribbon_length = dimensions.iter().product::<...
code_fim
hard
{ "lang": "rust", "repo": "jmageau/advent_of_code", "path": "/src/year_2015/day_2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut c = Context::new(); run_ast(&c, &a); println!("{:?}", c); }<|fim_prefix|>// repo: leizongmin/tvm-rust path: /src/main.rs extern crate tvm; use tvm::*; fn main() { <|fim_middle|> let mut a = AST::new(OpCode::Block, None); a.push(AST::new(OpCode::Print, Some(vec![Value::String("...
code_fim
hard
{ "lang": "rust", "repo": "leizongmin/tvm-rust", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: leizongmin/tvm-rust path: /src/main.rs extern crate tvm; use tvm::*; fn main() { <|fim_suffix|> let mut c = Context::new(); run_ast(&c, &a); println!("{:?}", c); }<|fim_middle|> let mut a = AST::new(OpCode::Block, None); a.push(AST::new(OpCode::Print, Some(vec![Value::String("...
code_fim
hard
{ "lang": "rust", "repo": "leizongmin/tvm-rust", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// The number of bits used to represent a single limb /// This is also known as the number of bits in a word pub(crate) const WORD_BITS: usize = 32;<|fim_prefix|>// repo: roynalnaruto/Curve448 path: /src/field/scalar/constants.rs // Fow now, this will be specific to 32-bit saturated limbs <|fim_middle|...
code_fim
medium
{ "lang": "rust", "repo": "roynalnaruto/Curve448", "path": "/src/field/scalar/constants.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: roynalnaruto/Curve448 path: /src/field/scalar/constants.rs // Fow now, this will be specific to 32-bit saturated limbs <|fim_suffix|>/// The number of bits used to represent a single limb /// This is also known as the number of bits in a word pub(crate) const WORD_BITS: usize = 32;<|fim_middle|...
code_fim
medium
{ "lang": "rust", "repo": "roynalnaruto/Curve448", "path": "/src/field/scalar/constants.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if i + 1 < m { deq.push_back((i + 1, j)); } if 0 < j { deq.push_back((i, j - 1)); } if j + 1 < n { deq.push_back((i, j + 1)); } } } } }<...
code_fim
hard
{ "lang": "rust", "repo": "sym233/leetcode_problems", "path": "/200. Number of Islands/200. Number of Islands.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sym233/leetcode_problems path: /200. Number of Islands/200. Number of Islands.rs use std::collections::VecDeque; impl Solution { pub fn num_islands(grid: Vec<Vec<char>>) -> i32 { let m = grid.len(); let n = grid[0].len(); let mut grid = grid; let mut res = 0; ...
code_fim
hard
{ "lang": "rust", "repo": "sym233/leetcode_problems", "path": "/200. Number of Islands/200. Number of Islands.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: squirrel-labs/spine-rs path: /src/skeleton/animation/iter.rs use super::skin::SkinAnimation; use super::sprite::Sprites; <|fim_suffix|> let result = self.skin_animation.interpolate(self.time); self.time += self.delta; result } }<|fim_middle|>/// Iterator over a consta...
code_fim
hard
{ "lang": "rust", "repo": "squirrel-labs/spine-rs", "path": "/src/skeleton/animation/iter.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Iterator for AnimationIter<'a> { type Item = Sprites<'a>; fn next(&mut self) -> Option<Sprites<'a>> { let result = self.skin_animation.interpolate(self.time); self.time += self.delta; result } }<|fim_prefix|>// repo: squirrel-labs/spine-rs path: /src/skeleton/...
code_fim
medium
{ "lang": "rust", "repo": "squirrel-labs/spine-rs", "path": "/src/skeleton/animation/iter.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let result = self.skin_animation.interpolate(self.time); self.time += self.delta; result } }<|fim_prefix|>// repo: squirrel-labs/spine-rs path: /src/skeleton/animation/iter.rs use super::skin::SkinAnimation; use super::sprite::Sprites; /// Iterator over a constant period #[de...
code_fim
medium
{ "lang": "rust", "repo": "squirrel-labs/spine-rs", "path": "/src/skeleton/animation/iter.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nshcat/lsystems-gui path: /src/scene/lsystem/normal_color_test_material.rs use nalgebra_glm::{Vec3, Mat4}; use std::any::*; use std::ops::DerefMut; use crate::rendering::*; use crate::rendering::materials::*; use crate::rendering::shaders::*; use crate::rendering::uniforms::*; /// A material th...
code_fim
hard
{ "lang": "rust", "repo": "nshcat/lsystems-gui", "path": "/src/scene/lsystem/normal_color_test_material.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// The fragment shader source for this material const FRAGMENT_SHADER_SOURCE: &'static str = r#" #version 330 core in Vertex { vec4 normal; vec4 color; } vertex; out vec4 Out_Color; void main() { Out_C...
code_fim
hard
{ "lang": "rust", "repo": "nshcat/lsystems-gui", "path": "/src/scene/lsystem/normal_color_test_material.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> uniform mat4 projection; uniform mat4 view; uniform mat4 model; out Vertex { vec4 normal; vec4 color; } vertex; void main() { gl_Position = projection * view * model * vec4(Position, 1.0); ver...
code_fim
hard
{ "lang": "rust", "repo": "nshcat/lsystems-gui", "path": "/src/scene/lsystem/normal_color_test_material.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let ir = (255.99 * r.clamp(0.0, 0.999)) as u8; let ig = (255.99 * g.clamp(0.0, 0.999)) as u8; let ib = (255.99 * b.clamp(0.0, 0.999)) as u8; img.put_pixel(x, y, Rgb([ir, ig, ib])); }<|fim_prefix|>// repo: abinashpanda/ray-tracing path: /src/image.rs use crate::vec_three::Vec3; use image::...
code_fim
hard
{ "lang": "rust", "repo": "abinashpanda/ray-tracing", "path": "/src/image.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: abinashpanda/ray-tracing path: /src/image.rs use crate::vec_three::Vec3; use image::{Rgb, RgbImage}; <|fim_suffix|> let ir = (255.99 * r.clamp(0.0, 0.999)) as u8; let ig = (255.99 * g.clamp(0.0, 0.999)) as u8; let ib = (255.99 * b.clamp(0.0, 0.999)) as u8; img.put_pixel(x, y, Rgb...
code_fim
hard
{ "lang": "rust", "repo": "abinashpanda/ray-tracing", "path": "/src/image.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yuusti/rust-bms path: /src/bms_parser.rs use std::fs::File; use std::io::prelude::*; use regex::Regex; use std::collections::HashMap; use time; pub struct BmsScript { headers: HashMap<String, String>, channels: HashMap<String, Vec<String>>, } impl BmsScript { pub fn wav_file(&self,...
code_fim
hard
{ "lang": "rust", "repo": "yuusti/rust-bms", "path": "/src/bms_parser.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl BmsParser for BmsStringParser { fn parse(&self) -> BmsScript { println!("Start BmsStringParser::parse() at {}", time::precise_time_s()); let mut headers = HashMap::new(); let mut channels = HashMap::new(); for line in self.script.split('\n') { let trim...
code_fim
hard
{ "lang": "rust", "repo": "yuusti/rust-bms", "path": "/src/bms_parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: j-schwar/chii path: /src/lib.rs #![feature(bindings_after_at)] <|fim_suffix|>pub use encode::encode;<|fim_middle|>pub mod bit; pub mod comp; pub mod data; pub mod int; pub mod math; pub mod schema; pub mod vie; mod encode;
code_fim
medium
{ "lang": "rust", "repo": "j-schwar/chii", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod encode; pub use encode::encode;<|fim_prefix|>// repo: j-schwar/chii path: /src/lib.rs #![feature(bindings_after_at)] <|fim_middle|>pub mod bit; pub mod comp; pub mod data; pub mod int; pub mod math; pub mod schema; pub mod vie;
code_fim
medium
{ "lang": "rust", "repo": "j-schwar/chii", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.relative.iter() .any(|needle| { if needle.starts_with("/*") && item.ends_with(&needle[2..]) { return true; } item.ends_with(needle) }) { return true; } self.absolute.iter() .any(|needle| item.starts_with(needle)) } pub fn from_file(ignore_file:&str) -> Self ...
code_fim
hard
{ "lang": "rust", "repo": "thinkier/directory-tree-gen", "path": "/src/excludes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thinkier/directory-tree-gen path: /src/excludes.rs use std::io::{BufReader, BufRead}; use std::fs; use std::path::Path; #[derive(Clone, Debug)] pub struct Excludes { relative: Vec<String>, absolute: Vec<String>, } macro_rules! string_vec (($($item:expr),*) => ( vec![ $($item.to_string()),...
code_fim
hard
{ "lang": "rust", "repo": "thinkier/directory-tree-gen", "path": "/src/excludes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn handle_game_mode_selection_event( ir_app_event_sender_system_data: &mut IrAppEventSenderSystemData, game_mode_selection_event_args: GameModeSelectionEventArgs, ) { let game_mode_selection_event = match game_mode_selection_event_args { GameModeSelectionEventAr...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/input_reaction_play/src/ir_app_event_sender.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azriel91/autexousious path: /crate/input_reaction_play/src/ir_app_event_sender.rs use amethyst::ecs::{Entity, ReadStorage}; use asset_model::loaded::{AssetId, AssetIdMappings}; use control_settings_model::ControlSettingsEvent; use game_input_model::config::ControllerId; use game_mode_selection_m...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/input_reaction_play/src/ir_app_event_sender.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub type GameTime = usize; #[derive(Debug, Clone)] pub enum SkillDuration { Permanent, Temporary { duration: GameTime }, } impl From<SkillKind> for Skill { fn from (kind: SkillKind) -> Self { Self { kind, duration: SkillDuration::Permanent } } } i...
code_fim
medium
{ "lang": "rust", "repo": "nacl42/reveal", "path": "/src/skill.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl From<SkillKind> for Skill { fn from (kind: SkillKind) -> Self { Self { kind, duration: SkillDuration::Permanent } } } impl From<GameTime> for SkillDuration { fn from(time: GameTime) -> Self { SkillDuration::Temporary { duration: time } ...
code_fim
hard
{ "lang": "rust", "repo": "nacl42/reveal", "path": "/src/skill.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nacl42/reveal path: /src/skill.rs //! Experimental implementation of a simple Skill system. //! //! We wouldn't need this if we had an ECS. //! #[derive(Debug, Clone)] pub struct Skill { pub kind: SkillKind, pub duration: SkillDuration } impl Skill { pub fn new(kind: SkillKind) -> ...
code_fim
hard
{ "lang": "rust", "repo": "nacl42/reveal", "path": "/src/skill.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let j = 34.35 + 3034.9057*JC; let s = 50.08 + 1222.1138*JC; let p = 238.96 + 144.9600*JC; let mut long = (238.958116f64 + 144.96*JC).to_radians(); let mut lat = -3.908239_f64.to_radians(); let mut r = 40.7241346; for x in tuple_terms.iter() { let alpha = ((x.0 as f6...
code_fim
hard
{ "lang": "rust", "repo": "Cloudxtreme/astro-rust", "path": "/src/pluto.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Cloudxtreme/astro-rust path: /src/pluto.rs //! The dwarf planet Pluto use angle; use time; /** Computes the geocentric equatorial semidiameter of Pluto # Returns * `semidiameter`: Geocentric equatorial semidiameter *| in radians per AU* # Arguments * `pluto_earth_dist`: P...
code_fim
hard
{ "lang": "rust", "repo": "Cloudxtreme/astro-rust", "path": "/src/pluto.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for x in tuple_terms.iter() { let alpha = ((x.0 as f64)*j + (x.1 as f64)*s + (x.2 as f64)*p).to_radians(); let alpha_sin = alpha.sin(); let alpha_cos = alpha.cos(); long += x.3.to_radians()*alpha_sin + x.4.to_radians()*alpha_cos; lat += x.5.to_radians()*alpha_sin + x.6...
code_fim
hard
{ "lang": "rust", "repo": "Cloudxtreme/astro-rust", "path": "/src/pluto.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: heartyhardy/learnin-rust path: /src/loops.rs pub fn run(){ // Infinite loop let mut count: u8 = 0; loop{ count += 1; println!("Current count: {} ",count ); if count >= std::u8::MAX { break; } } // While loop (FizzBuzz) ...
code_fim
hard
{ "lang": "rust", "repo": "heartyhardy/learnin-rust", "path": "/src/loops.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // For Range loop for x in 0..100{ println!("{} {} {}", x , x %10 == 0, x % 10 ); } }<|fim_prefix|>// repo: heartyhardy/learnin-rust path: /src/loops.rs pub fn run(){ // Infinite loop let mut count: u8 = 0; loop{ count += 1; println!("Current count: {} ",c...
code_fim
hard
{ "lang": "rust", "repo": "heartyhardy/learnin-rust", "path": "/src/loops.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zhaofengli/attic path: /server/src/database/entity/chunkref.rs //! A reference binding a NAR and a chunk. //! //! A NAR is backed by a sequence of chunks. //! //! A chunk may become unavailable (e.g., disk corruption) and //! removed from the database, in which case all dependent NARs //! will b...
code_fim
hard
{ "lang": "rust", "repo": "zhaofengli/attic", "path": "/server/src/database/entity/chunkref.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>pub mod syscall; pub mod consts; pub mod fs;<|fim_prefix|>// repo: JM4ier/bitOS path: /dep/src/lib.rs #![no_std] ///! This is a small library of things that both the kernel and userspace need <|fim_middle|>extern crate alloc;
code_fim
easy
{ "lang": "rust", "repo": "JM4ier/bitOS", "path": "/dep/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JM4ier/bitOS path: /dep/src/lib.rs #![no_std] ///! This is a small library of things that both the kernel and userspace need <|fim_suffix|>pub mod syscall; pub mod consts; pub mod fs;<|fim_middle|>extern crate alloc;
code_fim
easy
{ "lang": "rust", "repo": "JM4ier/bitOS", "path": "/dep/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tormyst/FeGaBo path: /src/gb/mem/timer.rs pub struct Timer { div: u8, tima: u8, tma: u8, tac: u8, buffered_interupt: bool, subclock: usize, subdiv: usize, } impl Timer { pub fn new() -> Self { Timer { div: 0, tima: 0, tma: 0, tac: 0, buffered_interupt: f...
code_fim
hard
{ "lang": "rust", "repo": "Tormyst/FeGaBo", "path": "/src/gb/mem/timer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn write(&mut self, addr: u16, data: u8) -> bool { match addr { 0xFF04 => { self.div = 0x00; self.subdiv = 0x00; self.subclock = 0x00; true}, 0xFF05 => { self.tima = data; true}, 0xFF06 => { self.tma = data; true}, 0xFF07 => { self.tac = data...
code_fim
hard
{ "lang": "rust", "repo": "Tormyst/FeGaBo", "path": "/src/gb/mem/timer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn build_subcommand_start_break() -> App<'static, 'static> { App::new("start_break") } fn build_subcommand_end_break() -> App<'static, 'static> { App::new("end_break") }<|fim_prefix|>// repo: alpaca-tc/mf_attendance-rs path: /src/app.rs use clap::{crate_version, App}; pub fn build_app() -> App<...
code_fim
medium
{ "lang": "rust", "repo": "alpaca-tc/mf_attendance-rs", "path": "/src/app.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> App::new("clock_out") } fn build_subcommand_start_break() -> App<'static, 'static> { App::new("start_break") } fn build_subcommand_end_break() -> App<'static, 'static> { App::new("end_break") }<|fim_prefix|>// repo: alpaca-tc/mf_attendance-rs path: /src/app.rs use clap::{crate_version, App}...
code_fim
medium
{ "lang": "rust", "repo": "alpaca-tc/mf_attendance-rs", "path": "/src/app.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alpaca-tc/mf_attendance-rs path: /src/app.rs use clap::{crate_version, App}; pub fn build_app() -> App<'static, 'static> { App::new("mf_attendance") .version(crate_version!()) .subcommand(build_subcommand_login()) .subcommand(build_subcommand_clock_in()) .sub...
code_fim
hard
{ "lang": "rust", "repo": "alpaca-tc/mf_attendance-rs", "path": "/src/app.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let table_start = builder.tell(); builder.push_scalar((table_start - vtable_start) as SOffset); if self.x != 0u64 { builder.align(Self::ALIGNMENT_X); builder.push_scalar(self.x); } if self.y != 0u64 { ...
code_fim
hard
{ "lang": "rust", "repo": "PinkDiamond1/cfb", "path": "/tests/common/scalars_with_same_size_builder.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PinkDiamond1/cfb path: /tests/common/scalars_with_same_size_builder.rs //! This file is auto-generated by cfbc. pub mod example { #![allow(unused_imports, clippy::large_enum_variant)] use cfb::builder::{ Builder, Component, DesignatedComponent, NestedBufferComponent, ReferenceVe...
code_fim
hard
{ "lang": "rust", "repo": "PinkDiamond1/cfb", "path": "/tests/common/scalars_with_same_size_builder.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Wdiviner/geektime-rust path: /23_advanced_generics/src/functions.rs pub trait ImplTrait { // 允许 fn impl_in_args(s: impl Into<String>) -> String { s.into() } <|fim_suffix|> let mut iter = trait_object_as_return_working(10); assert_eq!(Some(10), iter.next()); ...
code_fim
hard
{ "lang": "rust", "repo": "Wdiviner/geektime-rust", "path": "/23_advanced_generics/src/functions.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut iter = generics_as_return_working(10); assert_eq!(Some(10), iter.next()); } #[test] fn test_return_trait_object() { let mut iter = trait_object_as_return_working(10); assert_eq!(Some(10), iter.next()); } }<|fim_prefix|>// repo: Wdiviner/geektime-rus...
code_fim
hard
{ "lang": "rust", "repo": "Wdiviner/geektime-rust", "path": "/23_advanced_generics/src/functions.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ltenfield/bank-transaction-example path: /src/main.rs use bankex::{args::Args,read}; //use std::io::Result; <|fim_suffix|> let args = Args::parse(); let Args { infile, verbose, } = args; if verbose == true { eprintln!("argument parse result infile:[{}] ve...
code_fim
easy
{ "lang": "rust", "repo": "ltenfield/bank-transaction-example", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let args = Args::parse(); let Args { infile, verbose, } = args; if verbose == true { eprintln!("argument parse result infile:[{}] verbose:[{}]",infile,verbose); } let transactions = read::transaction_reader(verbose, &infile).unwrap(); if verbose { ...
code_fim
easy
{ "lang": "rust", "repo": "ltenfield/bank-transaction-example", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Visa { visa_type: VisaType::BoardMember, board: None, expire_date: None, issue_date: 0, nft: Default::default(), } } } #[derive(Clone, Debug, Deserialize, Serialize, CandidType)] pub struct Ticket { pub id: String, pu...
code_fim
hard
{ "lang": "rust", "repo": "Pabsysop/PAB_Dfinity", "path": "/src/boards/visa/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Pabsysop/PAB_Dfinity path: /src/boards/visa/src/lib.rs use candid::{CandidType, Principal}; use serde::{Serialize, Deserialize}; use nft::NFT; #[derive(Clone, Debug, Deserialize, Serialize, CandidType)] pub enum VisaType { Citizenship, BoardMember, } <|fim_suffix|> Visa { ...
code_fim
hard
{ "lang": "rust", "repo": "Pabsysop/PAB_Dfinity", "path": "/src/boards/visa/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut data = self.data; for e in data.iter_mut() { *e -= other; } Array3D { data, size: self.size, } } } impl<T> std::ops::Mul<T> for Array3D<T> where T: std::ops::MulAssign + Copy, { type Output = Self; fn mul...
code_fim
hard
{ "lang": "rust", "repo": "rxcompile/fluid_simulation_rs", "path": "/src/math/array.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut data = self.data; for e in data.iter_mut() { *e += other; } Array3D { data, size: self.size, } } } impl<T> std::ops::Sub<T> for Array3D<T> where T: std::ops::SubAssign + Copy, { type Output = Self; fn sub...
code_fim
hard
{ "lang": "rust", "repo": "rxcompile/fluid_simulation_rs", "path": "/src/math/array.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rxcompile/fluid_simulation_rs path: /src/math/array.rs use super::{ index_pack, swapchain::{Swapchain, SwapchainPack}, Fillable, Indexable3D, SizeCreatable, }; use crate::{support_utils, Coords}; #[derive(Clone, Debug)] pub struct Array3D<T> { data: Vec<T>, size: Coords, } ...
code_fim
hard
{ "lang": "rust", "repo": "rxcompile/fluid_simulation_rs", "path": "/src/math/array.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ps ) ] #[ cfg( feature = "use_std" ) ] mod ops_test;<|fim_prefix|>// repo: Wandalen/wMath path: /rust/test/math/adapter/cgmath_test/mod.rs #[ cfg( feature = "use_std" ) ] mod x2_test; #[ cfg( feature = "use_std" ) ] mod x3_test; #[ cfg( fea<|fim_middle|>ture = "use_std" ) ] mod x4_test; #[ cfg( cgmath_...
code_fim
easy
{ "lang": "rust", "repo": "Wandalen/wMath", "path": "/rust/test/math/adapter/cgmath_test/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Wandalen/wMath path: /rust/test/math/adapter/cgmath_test/mod.rs #[ cfg( feature = "use_std" ) ] mod x2_test; #[ cf<|fim_suffix|>ture = "use_std" ) ] mod x4_test; #[ cfg( cgmath_ops ) ] #[ cfg( feature = "use_std" ) ] mod ops_test;<|fim_middle|>g( feature = "use_std" ) ] mod x3_test; #[ cfg( fe...
code_fim
easy
{ "lang": "rust", "repo": "Wandalen/wMath", "path": "/rust/test/math/adapter/cgmath_test/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let _be = ridge_regression(&y, &x, 0.1); let _b = linear_regression(&y, &x); } }<|fim_prefix|>// repo: wbglaeser/ml-linreg path: /src/main.rs use lin_reg::*; use ndarray::prelude::*; fn main() { let file_name = "example_data.csv"; let matrix_raw = read_data(file_name); ...
code_fim
medium
{ "lang": "rust", "repo": "wbglaeser/ml-linreg", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wbglaeser/ml-linreg path: /src/main.rs use lin_reg::*; use ndarray::prelude::*; <|fim_suffix|> let _be = ridge_regression(&y, &x, 0.1); let _b = linear_regression(&y, &x); } }<|fim_middle|>fn main() { let file_name = "example_data.csv"; let matrix_raw = read_data(fil...
code_fim
hard
{ "lang": "rust", "repo": "wbglaeser/ml-linreg", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(UpdateSurveyCommand { id: self.id, author, title: self.title, description: self.description, category: self.category, questions, }) } } impl Into<PatchQuestion> for UpdateQuestionDTO { fn into(self) -> Patc...
code_fim
hard
{ "lang": "rust", "repo": "libellis/survey-manager", "path": "/survey-manager-api/src/inputs/survey.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: libellis/survey-manager path: /survey-manager-api/src/inputs/survey.rs use serde::Deserialize; use survey_manager_core::app_services::commands::{CreateSurveyCommand, CreateQuestionCommand, CreateChoiceCommand, UpdateSurveyCommand, PatchQuestion, PatchChoice}; use std::convert::{Into, TryInto}; u...
code_fim
hard
{ "lang": "rust", "repo": "libellis/survey-manager", "path": "/survey-manager-api/src/inputs/survey.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Krenodeno/YARRT path: /src/hitables/moving_sphere.rs use super::aabb::*; use super::hitable::*; use crate::materials::Material; use std::sync::Arc; pub struct MovingSphere { pub center0: Vec3, pub center1: Vec3, pub time0: f64, pub time1: f64, pub radius: f64, pub materi...
code_fim
hard
{ "lang": "rust", "repo": "Krenodeno/YARRT", "path": "/src/hitables/moving_sphere.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn bounding_box(&self, t0: f64, t1: f64) -> Option<Aabb> { let box0 = Aabb { min: self.center(t0) - Vec3::new(self.radius, self.radius, self.radius), max: self.center(t0) + Vec3::new(self.radius, self.radius, self.radius), }; let box1 = Aabb { ...
code_fim
hard
{ "lang": "rust", "repo": "Krenodeno/YARRT", "path": "/src/hitables/moving_sphere.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // TEST CASE: let mut cmd = Command::cargo_bin(SWEEPTOOL)?; let c="pkh([c258d2e4/44h/1h/0h]tpubD6NzVbkrYhZ4Yg9Rz1bXTTrc4TqZ8odbPaXrnrWX6cbDsXvH96FLDeRsckXohEkzGdAn5hbtK6iN7pCB1DeUpVwofEXCsN2StwWtU2SxE3f/1/*)"; let d="pkh([c258d2e4/44h/1h/0h]tpubD6NzVbkrYhZ4Yg9Rz1bXTTrc4TqZ8odbPaXrnrWX6cbD...
code_fim
hard
{ "lang": "rust", "repo": "nochiel/sweeptool-cli", "path": "/tests/cli.rs", "mode": "spm", "license": "BSD-2-Clause-Patent", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0..tx.output.len() { let address = Address::from_script( &tx.output[i].script_pubkey, bdk::bitcoin::Network::Regtest, ) .unwrap(); // Here we are checking if the amounts are correc...
code_fim
hard
{ "lang": "rust", "repo": "nochiel/sweeptool-cli", "path": "/tests/cli.rs", "mode": "spm", "license": "BSD-2-Clause-Patent", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nochiel/sweeptool-cli path: /tests/cli.rs use assert_cmd::prelude::*; // Add methods on commands use bdk::bitcoin::util::psbt::*; use bdk::bitcoin::Address; use bdk::bitcoin::Network; use bdk::blockchain::noop_progress; use bdk::blockchain::ElectrumBlockchain; use bdk::database::MemoryDatabase; ...
code_fim
hard
{ "lang": "rust", "repo": "nochiel/sweeptool-cli", "path": "/tests/cli.rs", "mode": "psm", "license": "BSD-2-Clause-Patent", "source": "the-stack-v2" }
<|fim_suffix|> Time { frame_number: 0, delta_real_time:Duration::from_secs(0), time_scale: 1f32, delta_seconds: 0f32, delta_time: Duration::from_secs(0), delta_real_seconds: 0f32, absolute_real_time: Duration::default(), ...
code_fim
hard
{ "lang": "rust", "repo": "seija-engine/seija-old", "path": "/src/core/timing.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Time { frame_number: u64, delta_real_time: Duration, delta_seconds: f32, time_scale: f32, delta_time: Duration, delta_real_seconds: f32, absolute_real_time: Duration, absolute_time: Duration, } impl Time { pub fn inc_frame_number(&mut self) { self.f...
code_fim
hard
{ "lang": "rust", "repo": "seija-engine/seija-old", "path": "/src/core/timing.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }