text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> input! { n: usize, x: i64, m: i64, } let mut current: i64 = x; let mut dist = vec![0; m as usize]; let mut d = 1; let mut sum = vec![0; m as usize + 1]; let (head, cycle) = loop { let cd = dist[current as usize]; if cd != 0 { ...
code_fim
medium
{ "lang": "rust", "repo": "minus3theta/contest", "path": "/cargo/abc179/src/bin/e.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: minus3theta/contest path: /cargo/abc179/src/bin/e.rs #[allow(unused_imports)] use itertools::Itertools; #[allow(unused_imports)] use num::Integer; #[allow(unused_imports)] use proconio::derive_readable; use proconio::fastout; use proconio::input; #[allow(unused_imports)] use proconio::marker::*;...
code_fim
medium
{ "lang": "rust", "repo": "minus3theta/contest", "path": "/cargo/abc179/src/bin/e.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Serialize, Deserialize, Debug)] struct EmbedFooter { text: String, icon_url: String, proxy_icon_url: String, } #[derive(Clone, Serialize, Deserialize, Debug)] struct EmbedField { name: String, value: String, inline: bool, } // ========== IMPLS ===========<|fim_pre...
code_fim
hard
{ "lang": "rust", "repo": "soruh/rusty-interaction", "path": "/src/types/embed.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: soruh/rusty-interaction path: /src/types/embed.rs use serde::{Deserialize, Serialize}; use serde_with::*; use std::time::SystemTime; // ======== Structures ========= #[skip_serializing_none] #[derive(Clone, Serialize, Deserialize, Debug)] pub struct Embed { title: String, r#type: Stri...
code_fim
medium
{ "lang": "rust", "repo": "soruh/rusty-interaction", "path": "/src/types/embed.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Serialize, Deserialize, Debug)] struct EmbedAuthor { name: String, url: String, icon_url: String, proxy_icon_url: String, } #[derive(Clone, Serialize, Deserialize, Debug)] struct EmbedFooter { text: String, icon_url: String, proxy_icon_url: String, } #[derive(...
code_fim
hard
{ "lang": "rust", "repo": "soruh/rusty-interaction", "path": "/src/types/embed.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexweav/raytracer path: /src/metal.rs use crate::hittable::HitRecord; use crate::material::Material; use crate::ray::Ray; use crate::vector::Vector; pub struct Metal { albedo: Vector, fuzz: f64, } <|fim_suffix|> v - (2.0 * Vector::dot(v, n) * n) } } impl Material for Metal...
code_fim
hard
{ "lang": "rust", "repo": "alexweav/raytracer", "path": "/src/metal.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let reflected = Self::reflect(&ray_in.direction().unit_vector(), &hit_record.normal); let scattered = Ray::new( &hit_record.p, &(reflected + self.fuzz * Vector::random_in_unit_sphere()), ); let attenuation = self.albedo.clone(); let scatter =...
code_fim
medium
{ "lang": "rust", "repo": "alexweav/raytracer", "path": "/src/metal.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for &(ref name, ref message) in output.iter() { println!("{:4}{:12} {}", "", name, message); } println!("{:4}operands: {}", "", ops.len()); for op in ops { println!("{:8}{:?}", "", op); } } Ok(()) } fn example() -> CsResult<()> { ...
code_fim
hard
{ "lang": "rust", "repo": "capstone-rust/capstone-rs", "path": "/capstone-rs/examples/demo.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: capstone-rust/capstone-rs path: /capstone-rs/examples/demo.rs extern crate capstone; use capstone::prelude::*; use capstone::InsnDetail; const MIPS_CODE: &[u8] = b"\x56\x34\x21\x34\xc2\x17\x01\x00"; const X86_CODE: &[u8] = b"\x55\x48\x8b\x05\xb8\x13\x00\x00\xe9\x14\x9e\x08\x00\x45\x31\xe4"; ...
code_fim
hard
{ "lang": "rust", "repo": "capstone-rust/capstone-rs", "path": "/capstone-rs/examples/demo.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: markrepedersen/liveshare path: /src/range.rs use serde::{Deserialize, Serialize}; use std::ops::Add; #[derive(Clone, Debug, Deserialize, Serialize)] pub struct Point { pub row: usize, pub column: usize, } impl Add<(usize, usize)> for Point { type Output = Point; fn add(self, r...
code_fim
medium
{ "lang": "rust", "repo": "markrepedersen/liveshare", "path": "/src/range.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { start: self.start + rhs.start, end: self.end + rhs.end, } } } impl Range { pub fn new(start: (usize, usize), end: (usize, usize)) -> Self { Self { start: Point::new(start.0, start.1), end: Point::new(end.0, end.1), ...
code_fim
hard
{ "lang": "rust", "repo": "markrepedersen/liveshare", "path": "/src/range.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { row: self.row + rhs.0, column: self.column + rhs.1, } } } impl Add<Point> for Point { type Output = Point; fn add(self, rhs: Point) -> Self::Output { Self { row: self.row + rhs.row, column: self.column + rhs.colum...
code_fim
medium
{ "lang": "rust", "repo": "markrepedersen/liveshare", "path": "/src/range.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adamgreig/stm32ral path: /src/stm32g0/peripherals/ucpd_v2.rs RW {} } /// Hard Reset message sent The flag indicates that the Hard Reset message is sent. The flag is cleared by setting the HRSTSENTCF bit. pub mod HRSTSENT { /// Offset (5 bits) pub const offset: u32 =...
code_fim
hard
{ "lang": "rust", "repo": "adamgreig/stm32ral", "path": "/src/stm32g0/peripherals/ucpd_v2.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Transmit message abort The flag indicates that a Tx message is aborted due to a subsequent Hard Reset message send request taking priority during transmit. It is cleared by setting the TXMSGABTCF bit. pub mod TXMSGABT { /// Offset (3 bits) pub const offset: u32 = 3; ///...
code_fim
hard
{ "lang": "rust", "repo": "adamgreig/stm32ral", "path": "/src/stm32g0/peripherals/ucpd_v2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// RXORDDET interrupt enable pub mod RXORDDETIE { /// Offset (9 bits) pub const offset: u32 = 9; /// Mask (1 bit: 1 << 9) pub const mask: u32 = 1 << offset; /// Read-only values (empty) pub mod R {} /// Write-only values (empty) pub ...
code_fim
hard
{ "lang": "rust", "repo": "adamgreig/stm32ral", "path": "/src/stm32g0/peripherals/ucpd_v2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut count: usize = 0; for answer in response.answers::<MX>() { count += 1; println!("{:?}", answer); } // Verify that the iterator made it through all of the answers assert_eq!(response.get_section_count(Section::Answer), count); } // This DNS domain no longer res...
code_fim
hard
{ "lang": "rust", "repo": "mikedilger/resolv-rs", "path": "/src/tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mikedilger/resolv-rs path: /src/tests.rs use crate::{Resolver, Class, RecordType, Section}; use crate::record::MX; use crate::record::TLSA; #[test] fn basic_test_query() { let mut resolver = Resolver::new().unwrap(); let mut response = resolver.query(b"gmail.com", Class::IN, RecordType:...
code_fim
hard
{ "lang": "rust", "repo": "mikedilger/resolv-rs", "path": "/src/tests.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Verify that some of the default options came back to us let flags = response.get_flags(); assert_eq!(flags.question_response(), true); assert_eq!(flags.recursion_desired(), true); // Verify that the question section has something in it assert!(response.get_section_count(Section...
code_fim
hard
{ "lang": "rust", "repo": "mikedilger/resolv-rs", "path": "/src/tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fulmicoton/fst path: /src/raw/shared_vector_slice.rs use std::sync::Arc; use std::borrow::Cow; /// A read only view on a Vec<u8> /// /// It is the anonymous memory of the MmapReadOnly struct. pub struct SharedVectorSlice { bytes: Arc<Cow<'static, [u8]>>, offset: usize, len: usize, ...
code_fim
hard
{ "lang": "rust", "repo": "fulmicoton/fst", "path": "/src/raw/shared_vector_slice.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let vals: Vec<u8> = (0..100).collect(); let shared_vector_slice = SharedVectorSlice::from(vals); { let slice_3_5 = unsafe { &shared_vector_slice.as_slice()[3..5]}; assert_eq!(slice_3_5.len(), 2); assert_eq!(slice_3_5[0], 3); assert_eq!(slice_3_5[1], 4); } ...
code_fim
hard
{ "lang": "rust", "repo": "fulmicoton/fst", "path": "/src/raw/shared_vector_slice.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl From<Vec<u8>> for SharedVectorSlice { fn from(bytes: Vec<u8>) -> SharedVectorSlice { let num_bytes = bytes.len(); SharedVectorSlice { bytes: Arc::new(Cow::Owned(bytes)), offset: 0, len: num_bytes, } } } impl From<&'static [u8]> for ...
code_fim
medium
{ "lang": "rust", "repo": "fulmicoton/fst", "path": "/src/raw/shared_vector_slice.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'s> System<'s> for InputToGameInputSystem { type SystemData = InputToGameInputSystemData<'s>; fn run( &mut self, InputToGameInputSystemData { session_status, input_ec, mut game_input_ec, }: Self::SystemData, ) { let inpu...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/game_input/src/system/input_to_game_input_system.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if session_status != &SessionStatus::HostEstablished && session_status != &SessionStatus::JoinEstablished { input_events .filter_map(|input_event| GameInputEvent::try_from(input_event).ok()) .for_each(|game_input_event| game_input_ec....
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/game_input/src/system/input_to_game_input_system.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azriel91/autexousious path: /crate/game_input/src/system/input_to_game_input_system.rs use std::convert::TryFrom; use amethyst::{ derive::SystemDesc, ecs::{Read, System, World, Write}, input::InputEvent, shred::{ResourceId, SystemData}, shrev::{EventChannel, ReaderId}, }; us...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/game_input/src/system/input_to_game_input_system.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ys-kalyakin/leetcode path: /rust/src/move_zeroes/mod.rs /// https://leetcode.com/problems/move-zeroes/ #[allow(dead_code)] pub fn move_zeroes(nums: &mut Vec<i32>) { if nums.len() == 1 { return; } let mut i = 0; let len = nums.len(); while i < len { if nums[i...
code_fim
medium
{ "lang": "rust", "repo": "ys-kalyakin/leetcode", "path": "/rust/src/move_zeroes/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut v = vec![0, 1, 0, 3, 12]; super::move_zeroes(&mut v); assert_eq!(vec![1, 3, 12, 0, 0], v); } }<|fim_prefix|>// repo: ys-kalyakin/leetcode path: /rust/src/move_zeroes/mod.rs /// https://leetcode.com/problems/move-zeroes/ #[allow(dead_code)] pub fn move_zeroes(nums: &mu...
code_fim
hard
{ "lang": "rust", "repo": "ys-kalyakin/leetcode", "path": "/rust/src/move_zeroes/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: risooonho/bytepath-rs path: /src/systems/spawn.rs use specs::world::*; use specs::*; use crate::components::*; use crate::entities::*; use crate::resources::*; use std::time::{Duration, Instant}; pub struct SpawnSystem; <|fim_suffix|> &mut self, (entities, lazy, game_settings, mut spa...
code_fim
hard
{ "lang": "rust", "repo": "risooonho/bytepath-rs", "path": "/src/systems/spawn.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if now.duration_since(spawn_info.ammo_last) > spawn_info.ammo_every && spawn_info.ammo_count < spawn_info.ammo_max { create_ammo(&entities, &lazy, &game_settings, &mut physics); spawn_info.ammo_last = now; spawn_info.ammo_count += 1; } } }<|fim_prefix|>// repo: risooo...
code_fim
hard
{ "lang": "rust", "repo": "risooonho/bytepath-rs", "path": "/src/systems/spawn.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> offset += mid_idx + 1; } Ordering::Greater => { sub_array = &sub_array[..mid_idx]; } } } None }<|fim_prefix|>// repo: scarvalhojr/exercism path: /rust/binary-search/src/lib.rs use std::cmp::Ordering; pub fn find<T, C>(array: C, key: ...
code_fim
medium
{ "lang": "rust", "repo": "scarvalhojr/exercism", "path": "/rust/binary-search/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: scarvalhojr/exercism path: /rust/binary-search/src/lib.rs use std::cmp::Ordering; pub fn find<T, C>(array: C, key: T) -> Option<usize> where T: Ord, C: AsRef<[T]>, { let mut offset = 0; let mut sub_array = a<|fim_suffix|>=> { return Some(offset + mid_idx); ...
code_fim
medium
{ "lang": "rust", "repo": "scarvalhojr/exercism", "path": "/rust/binary-search/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Atul9/linux-io-uring path: /tests/poll_test.rs use linux_io_uring::{ opcode, IoUring }; #[test] fn test_poll_add() -> anyhow::Result<()> { let mut io_uring = IoUring::new(1)?; let (rp, wp) = nix::unistd::pipe()?; // just test, we don't close let entry = opcode::PollAdd::new(opcode...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/linux-io-uring", "path": "/tests/poll_test.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut io_uring = IoUring::new(1)?; let (rp, _) = nix::unistd::pipe()?; // just test, we don't close let token = 0x43; let entry = opcode::PollAdd::new(opcode::Target::Fd(rp), libc::POLLIN); unsafe { io_uring .submission() .available() .pu...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/linux-io-uring", "path": "/tests/poll_test.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let entry = opcode::PollAdd::new(opcode::Target::Fd(rp), libc::POLLIN); unsafe { io_uring .submission() .available() .push(entry.build().user_data(token)) .map_err(drop) .expect("queue is full"); } io_uring.submit()?; ...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/linux-io-uring", "path": "/tests/poll_test.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mut bounds: Rect, batch: &mut DrawBatch, children: &mut [Box<dyn UiElement>], mouse_coverage: &mut MouseCoverage, ) { let mut x = bounds.x1; for c in children { batch.set_clipping(Some(Rect::with_exact( x, bounds.y1, bounds.x2 + 1, ...
code_fim
medium
{ "lang": "rust", "repo": "thebracket/bracket-ui", "path": "/src/container/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thebracket/bracket-ui path: /src/container/mod.rs pub mod root; use bracket_lib::prelude::{DrawBatch, Rect}; pub use root::*; pub mod panel; pub use panel::*; pub mod border; pub use border::*; <|fim_suffix|>fn panel_inner_render( mut bounds: Rect, batch: &mut DrawBatch, children: &...
code_fim
medium
{ "lang": "rust", "repo": "thebracket/bracket-ui", "path": "/src/container/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn panel_inner_render( mut bounds: Rect, batch: &mut DrawBatch, children: &mut [Box<dyn UiElement>], mouse_coverage: &mut MouseCoverage, ) { let mut x = bounds.x1; for c in children { batch.set_clipping(Some(Rect::with_exact( x, bounds.y1, ...
code_fim
medium
{ "lang": "rust", "repo": "thebracket/bracket-ui", "path": "/src/container/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(ref label) = section.label { report_warning!(reports; "unused label on `class`"; label.span); } let mut index = 0; for meta in section.top_level.iter() { if let Some(ref label) = meta.label { match meta.body { MetaInstruction::Bootst...
code_fim
hard
{ "lang": "rust", "repo": "Thinkofname/jas", "path": "/src/codegen/labels.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Thinkofname/jas path: /src/codegen/labels.rs use ast::*; use codegen::Generator; use reporting::*; use sections::*; #[derive(Clone, Copy, Debug)] pub enum LabelKind { Constant(u32), Item, Reserved, Bootstrap(u16), Code(u16), } pub fn expand_labels(gen: &mut Generator, secti...
code_fim
hard
{ "lang": "rust", "repo": "Thinkofname/jas", "path": "/src/codegen/labels.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for field in section.fields.iter() { if let Some(ref label) = field.label { insert_label!(label, LabelKind::Item); } for meta in field.meta.iter() { if let Some(ref label) = meta.label { report_warning!(reports; "unused label on `{}`", me...
code_fim
hard
{ "lang": "rust", "repo": "Thinkofname/jas", "path": "/src/codegen/labels.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> { CarriageReturnDelay::Zero } } impl MultipleBits for CarriageReturnDelay { #[cfg(any(target_os = "android", target_os = "fuschia", target_os = "ios", target_os = "linux", target_os = "macos"))] const Bitmask: tcflag_t = CRDLY; #[inline(always)] fn transmute_from_clean_mode_flags(clean_mode_flags...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/simple-http-server", "path": "/workspace/simple-http-server-epoll/src/terminal/CarriageReturnDelay.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for CarriageReturnDelay { #[inline(always)] fn default() -> Self { CarriageReturnDelay::Zero } } impl MultipleBits for CarriageReturnDelay { #[cfg(any(target_os = "android", target_os = "fuschia", target_os = "ios", target_os = "linux", target_os = "macos"))] const Bitmask: tcflag_t =...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/simple-http-server", "path": "/workspace/simple-http-server-epoll/src/terminal/CarriageReturnDelay.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemonrock/simple-http-server path: /workspace/simple-http-server-epoll/src/terminal/CarriageReturnDelay.rs // This file is part of simple-http-server. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubuserconte...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/simple-http-server", "path": "/workspace/simple-http-server-epoll/src/terminal/CarriageReturnDelay.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub mod sb; pub mod stm; pub mod tbm; pub mod tcm; pub mod trbm; pub mod tvm; pub mod udm; pub mod wm;<|fim_prefix|>// repo: rodrigocfd/winsafe path: /src/comctl/messages/mod.rs pub mod bcm; pub mod cb; pub mod dtm; pub mod em; <|fim_middle|>pub mod hdm; pub mod lvm; pub mod mcm; pub mod p...
code_fim
easy
{ "lang": "rust", "repo": "rodrigocfd/winsafe", "path": "/src/comctl/messages/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rodrigocfd/winsafe path: /src/comctl/messages/mod.rs pub mod bcm; pub mod cb; pub mod dtm; pub mod em; <|fim_suffix|> pub mod trbm; pub mod tvm; pub mod udm; pub mod wm;<|fim_middle|>pub mod hdm; pub mod lvm; pub mod mcm; pub mod pbm; pub mod sb; pub mod stm; pub mod tbm; pub mod t...
code_fim
medium
{ "lang": "rust", "repo": "rodrigocfd/winsafe", "path": "/src/comctl/messages/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub mod trbm; pub mod tvm; pub mod udm; pub mod wm;<|fim_prefix|>// repo: rodrigocfd/winsafe path: /src/comctl/messages/mod.rs pub mod bcm; pub mod cb; pub mod dtm; pub mod em; pub mod hdm; pub mod lvm; pub mod mcm; pub mod pbm; <|fim_middle|> pub mod sb; pub mod stm; pub mod tbm; pub mod t...
code_fim
easy
{ "lang": "rust", "repo": "rodrigocfd/winsafe", "path": "/src/comctl/messages/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sile/trackable_derive path: /src/lib.rs //! This crate provides `TrackableError` derive macro. //! //! This crate should not be used directly. //! See [trackable] documentation for the usage of `#[derive(TrackableError)]`. //! //! [trackable]: https://docs.rs/trackable #![recursion_limit = "128"...
code_fim
hard
{ "lang": "rust", "repo": "sile/trackable_derive", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] fn history(&self) -> Option<&::trackable::History<Self::Event>> { self.0.history() } #[inline] fn history_mut(&mut self) -> Option<&mut ::trackable::History<Self::Event>> { self.0.history_mut() ...
code_fim
hard
{ "lang": "rust", "repo": "sile/trackable_derive", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn send( &self, message: Self::Message, ) -> Result<(), Box<dyn Error>>; fn on_tick(&self) -> Result<(), Box<dyn Error>>; fn state(&'a self) -> Self::State; }<|fim_prefix|>// repo: dillonhicks/locutus path: /locutus-actor/src/lib.rs pub(crate) mod deps { #[cfg(feature ...
code_fim
hard
{ "lang": "rust", "repo": "dillonhicks/locutus", "path": "/locutus-actor/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dillonhicks/locutus path: /locutus-actor/src/lib.rs pub(crate) mod deps { #[cfg(feature = "serde")] pub use serde1 as serde; #[cfg(feature = "uuid")] pub use uuid1 as uuid; } use std::fmt; #[cfg(feature = "serde")] use crate::deps::serde::Serialize; pub trait Error: std::erro...
code_fim
hard
{ "lang": "rust", "repo": "dillonhicks/locutus", "path": "/locutus-actor/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>. get ( ) ) } ) } / / / Removes other Interest from self . / / / / / / Returns None if the set would be empty after removing other . / / / / / / / / / use mio : : Interest ; / / / / / / const RW_INTERESTS : Interest = Interest : : READABLE . add ( Interest : : WRITABLE ) ; / / / / / / / / As long a one in...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/mio/src/interest.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>terest contains AIO readiness pub const fn is_aio ( self ) - > bool { ( self . 0 . get ( ) & AIO ) ! = 0 } / / / Returns true if Interest contains LIO readiness pub const fn is_lio ( self ) - > bool { ( self . 0 . get ( ) & LIO ) ! = 0 } } impl ops : : BitOr for Interest { type Output = Self ; # [ inline ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/mio/src/interest.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/mio/src/interest.rs use std : : num : : NonZeroU8 ; use std : : { fmt ops } ; / / / Interest used in registering . / / / / / / Interest are used in [ registering ] [ event : : Source ] s with [ Poll ] they / / / indicate what readiness should b...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/mio/src/interest.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn criterion_benchmark(c: &mut Criterion) { c.bench_function("Construction - b - aHash", |b| { b.iter(|| construction_map_ahash()) }); c.bench_function("Construction - b - rustc-hash", |b| { b.iter(|| construction_map_rustc()) }); } criterion_group!(benches, criterion_benc...
code_fim
medium
{ "lang": "rust", "repo": "neeldug/hash-bench", "path": "/benches/construction-b.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neeldug/hash-bench path: /benches/construction-b.rs use criterion::{criterion_group, criterion_main, Criterion}; use hashbrown::HashMap; use rustc_hash::FxHashMap; <|fim_suffix|>fn construction_map_rustc() { for n in 0..500000 { let mut map: FxHashMap<i32, i32> = FxHashMap::default(...
code_fim
hard
{ "lang": "rust", "repo": "neeldug/hash-bench", "path": "/benches/construction-b.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> c.bench_function("Construction - b - aHash", |b| { b.iter(|| construction_map_ahash()) }); c.bench_function("Construction - b - rustc-hash", |b| { b.iter(|| construction_map_rustc()) }); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches);<|fim_prefi...
code_fim
hard
{ "lang": "rust", "repo": "neeldug/hash-bench", "path": "/benches/construction-b.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: erickmerchant/my-blog path: /src/models/entry/frontmatter.rs use super::feed::Feed; use chrono::NaiveDate; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)] pub struct Frontmatter { #[serde(default)] pub title: Option<String>, <|fim_suffix|> ...
code_fim
hard
{ "lang": "rust", "repo": "erickmerchant/my-blog", "path": "/src/models/entry/frontmatter.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(default)] pub tags: Option<Vec<String>>, #[serde(default)] pub feed: Option<Feed>, }<|fim_prefix|>// repo: erickmerchant/my-blog path: /src/models/entry/frontmatter.rs use super::feed::Feed; use chrono::NaiveDate; use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Eq, Se...
code_fim
medium
{ "lang": "rust", "repo": "erickmerchant/my-blog", "path": "/src/models/entry/frontmatter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(default)] pub date: Option<NaiveDate>, #[serde(default)] pub tags: Option<Vec<String>>, #[serde(default)] pub feed: Option<Feed>, }<|fim_prefix|>// repo: erickmerchant/my-blog path: /src/models/entry/frontmatter.rs use super::feed::Feed; use chrono::NaiveDate; use serde::{Deserialize, Ser...
code_fim
medium
{ "lang": "rust", "repo": "erickmerchant/my-blog", "path": "/src/models/entry/frontmatter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iwburns/aoc-2017-polylang path: /rust/day-3/problem-2/src/main.rs #[derive(Debug, Copy, Clone)] struct Point { x: i32, y: i32, } #[derive(Debug, Copy, Clone)] struct MemBlock { point: Point, value: u32, } #[derive(Debug, Copy, Clone)] enum Move { Right { total: u32, moves_l...
code_fim
hard
{ "lang": "rust", "repo": "iwburns/aoc-2017-polylang", "path": "/rust/day-3/problem-2/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let next_move = if moves_left > 1 { Move::Left { total, moves_left: moves_left - 1} } else { Move::Down { total, moves_left: total } }; (next_move, next_point) }, Move::Up { total, moves_left } => { ...
code_fim
hard
{ "lang": "rust", "repo": "iwburns/aoc-2017-polylang", "path": "/rust/day-3/problem-2/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if value as usize > size { break; } } memory } fn get_next_move_and_point(curr_move: Move, curr_point: Point) -> (Move, Point) { let Point { x, y } = curr_point; match curr_move { Move::Right { total, moves_left } => { let next_point = Poi...
code_fim
hard
{ "lang": "rust", "repo": "iwburns/aoc-2017-polylang", "path": "/rust/day-3/problem-2/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: litttley/editor.sh path: /yeditor/src/room/room.rs vents { Packet(ClientResponses), Destroy, // destroy current client } struct RoomClient { id: u32, name: String, recipient: RoomClientListener, } #[derive(Debug, Clone, Message)] pub enum RoomEvents { Closed(String), //...
code_fim
hard
{ "lang": "rust", "repo": "litttley/editor.sh", "path": "/yeditor/src/room/room.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let msg = ClientResponses::Editor(payload); self.broadcast_excludes(ClientEvents::Packet(msg), vec![client_id]); Ok(()) } pub fn on_command( &mut self, ctx: &mut <Self as Actor>::Context, client_id: u32, payload: CommandRequestParams, )...
code_fim
hard
{ "lang": "rust", "repo": "litttley/editor.sh", "path": "/yeditor/src/room/room.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: litttley/editor.sh path: /yeditor/src/room/room.rs clients: HashMap::new(), next_client_id: 1, runner_proxy_addr: None, terminal_stdout: VecDeque::new(), stop_handle: None, code_buffer: TextBuffer::new(), pad: N...
code_fim
hard
{ "lang": "rust", "repo": "litttley/editor.sh", "path": "/yeditor/src/room/room.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matsutake-eg/atcoder path: /rust/abc183/src/bin/d.rs #![allow(unused_imports)] use itertools::Itertools; use itertools_num::ItertoolsNum as _; use num_integer::*; use petgraph::*; use proconio::fastout; use proconio::input; use proconio::marker::*; use std::cmp::*; use std::collections::*; use s...
code_fim
medium
{ "lang": "rust", "repo": "matsutake-eg/atcoder", "path": "/rust/abc183/src/bin/d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut l = vec![0; 200_001]; for (s, t, p) in stp { l[s] += p; l[t] += -p; } let l = l.iter().cumsum().collect::<Vec<i64>>(); println!( "{}", if *l.iter().max().unwrap() > w { "No" } else { "Yes" } ); }<|fim_p...
code_fim
hard
{ "lang": "rust", "repo": "matsutake-eg/atcoder", "path": "/rust/abc183/src/bin/d.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NicolasLagaillardie/mpst_rust_github path: /src/functionmpst/choose.rs leCtoAll<R4, R5>, RoleC<RoleEnd>, >; #[doc(hidden)] macro_rules! choose_mpst_a { ( $session_1:ty, $session_2:ty, $session_3:ty, $stack_1:ty, $stack_2:ty, $stack_3:ty, ...
code_fim
hard
{ "lang": "rust", "repo": "NicolasLagaillardie/mpst_rust_github", "path": "/src/functionmpst/choose.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Given a choice from A, to other processes, between two /// [`MeshedChannels`], choose the /// first option for each. /// /// A has to encapsulate all possible /// [`MeshedChannels`] for each other /// role. This function creates the 6 new binary /// [`Session`], the 3 new /// [`Role`] related to each ...
code_fim
hard
{ "lang": "rust", "repo": "NicolasLagaillardie/mpst_rust_github", "path": "/src/functionmpst/choose.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Given a choice from B, to other processes, between two /// [`MeshedChannels`], choose the /// first option for each. /// /// B has to encapsulate all possible /// [`MeshedChannels`] for each other /// role. This function creates the 6 new binary /// [`Session`], the 3 new /// [`Role`] related to each ...
code_fim
hard
{ "lang": "rust", "repo": "NicolasLagaillardie/mpst_rust_github", "path": "/src/functionmpst/choose.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn stop_advertising(self: &Self) -> Box<impl Future<Item = (), Error = Error>> { self.peripheral_manager.stop_advertising(); Box::new(future::ok(())) } pub fn is_advertising(self: &Self) -> Box<impl Future<Item = bool, Error = Error>> { Box::new(future::ok(self.per...
code_fim
hard
{ "lang": "rust", "repo": "MusiCodeXQ/bluster", "path": "/src/peripheral/corebluetooth/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn start_advertising( self: &Self, name: &str, uuids: &[Uuid], ) -> Box<impl Future<Item = Box<impl Stream<Item = (), Error = Error>>, Error = Error>> { self.peripheral_manager.start_advertising(name, uuids); // TODO: Create an actual stream let...
code_fim
hard
{ "lang": "rust", "repo": "MusiCodeXQ/bluster", "path": "/src/peripheral/corebluetooth/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MusiCodeXQ/bluster path: /src/peripheral/corebluetooth/mod.rs mod characteristic_flags; mod constants; mod error; mod events; mod ffi; mod into_bool; mod into_cbuuid; mod peripheral_manager; use futures::{future, prelude::*}; use std::{ sync::{Arc, Mutex}, time, }; use tokio::{runtime::...
code_fim
hard
{ "lang": "rust", "repo": "MusiCodeXQ/bluster", "path": "/src/peripheral/corebluetooth/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/libstd/sys/redox/fast_thread_local.rs #![cfg(target_thread_local)] #![unstable(feature = "thread_local_internals", issue = "0")] use crate::cell::{Cell, UnsafeCell}; use crate::mem; use crate::ptr; pub struct Key<T> { inner: UnsafeCell<Option<T>>...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/libstd/sys/redox/fast_thread_local.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub unsafe fn register_dtor(t: *mut u8, dtor: unsafe extern fn(*mut u8)) { // The fallback implementation uses a vanilla OS-based TLS key to track // the list of destructors that need to be run for this thread. The key // then has its own destructor which runs all the other destructors. //...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/libstd/sys/redox/fast_thread_local.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Transfer errors. #[derive(Error, Debug, Clone, PartialEq, Eq, Serialize, Deserialize)] pub enum Error { #[error("The transfer fee is missing.")] MissingFee, #[error("Invalid fee blinded amount.")] InvalidFeeBlindedAmount, #[error("Too low amount for the transfer fee: {paid}. Min re...
code_fim
hard
{ "lang": "rust", "repo": "maidsafe/temp_safe_network", "path": "/safenode/src/network_transfers/error.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maidsafe/temp_safe_network path: /safenode/src/network_transfers/error.rs // Copyright 2023 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under The General Public License (GPL), version 3. // Unless required by applicable law or agreed to in writing, the SAFE Network ...
code_fim
hard
{ "lang": "rust", "repo": "maidsafe/temp_safe_network", "path": "/safenode/src/network_transfers/error.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sile/erl_parse path: /src/cst/mod.rs use crate::traits::{Parse, TokenRead}; use crate::{Parser, Result}; pub use self::expr::Expr; pub use self::form::Form; pub use self::guard_test::GuardTest; pub use self::literal::Literal; pub use self::pattern::Pattern; pub use self::ty::Type; <|fim_suffix...
code_fim
hard
{ "lang": "rust", "repo": "sile/erl_parse", "path": "/src/cst/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod expr; mod form; mod guard_test; mod literal; mod pattern; mod ty; /// `Vec<Form>` #[derive(Debug, Clone)] pub struct ModuleDecl { pub forms: Vec<Form>, } impl Parse for ModuleDecl { fn parse<T>(parser: &mut Parser<T>) -> Result<Self> where T: TokenRead, { let mut forms...
code_fim
medium
{ "lang": "rust", "repo": "sile/erl_parse", "path": "/src/cst/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> where T: TokenRead, { let mut forms = Vec::new(); while !track!(parser.eos())? { let form = track!(parser.parse())?; forms.push(form); } Ok(ModuleDecl { forms }) } }<|fim_prefix|>// repo: sile/erl_parse path: /src/cst/mod.rs use ...
code_fim
hard
{ "lang": "rust", "repo": "sile/erl_parse", "path": "/src/cst/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/phosphor path: /src/renderpass/mod.rs //! Custom RenderPass types. pub mod deferred_shading; pub use self::deferred_shading::DeferredShadingRenderPass; <|fim_suffix|>pub mod occlusion; pub use self::occlusion::OcclusionRenderPass; pub mod postprocess; pub use self::postprocess::PostPr...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/phosphor", "path": "/src/renderpass/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub mod postprocess; pub use self::postprocess::PostProcessRenderPass;<|fim_prefix|>// repo: isgasho/phosphor path: /src/renderpass/mod.rs //! Custom RenderPass types. pub mod deferred_shading; pub use self::deferred_shading::DeferredShadingRenderPass; pub mod deferred_lighting; pub use self::deferred_...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/phosphor", "path": "/src/renderpass/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.value += self.freq.read() / 44_100.0; Some((self.value % 1.0) - 0.5) } }<|fim_prefix|>// repo: RandomInsano/floaterator path: /src/generators/gen_saw.rs use super::super::controls::Knob; pub struct GenSaw { value: f64, freq: Knob, } impl GenSaw { pub fn new(freq: K...
code_fim
easy
{ "lang": "rust", "repo": "RandomInsano/floaterator", "path": "/src/generators/gen_saw.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RandomInsano/floaterator path: /src/generators/gen_saw.rs use super::super::controls::Knob; pub struct GenSaw { value: f64, freq: Knob, } impl GenSaw { pub fn new(freq: Knob) -> Box<Self> { let a = Self { value: 0.0, freq: freq, }; B...
code_fim
medium
{ "lang": "rust", "repo": "RandomInsano/floaterator", "path": "/src/generators/gen_saw.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Some((self.value % 1.0) - 0.5) } }<|fim_prefix|>// repo: RandomInsano/floaterator path: /src/generators/gen_saw.rs use super::super::controls::Knob; pub struct GenSaw { value: f64, freq: Knob, } impl GenSaw { pub fn new(freq: Knob) -> Box<Self> { let a = Self { ...
code_fim
medium
{ "lang": "rust", "repo": "RandomInsano/floaterator", "path": "/src/generators/gen_saw.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // TODO split game into "game" and "state", // so that this workaround isn't necessary let mut actions = Vec::new(); for (id, entity) in &game.entities { actions.push(Action::Move { id: *id, loc: Location { x: ...
code_fim
medium
{ "lang": "rust", "repo": "battlecode/battlecode-hackathon", "path": "/player-rust/examples/rustplayer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: battlecode/battlecode-hackathon path: /player-rust/examples/rustplayer.rs extern crate battlecode_hackathon; use battlecode_hackathon::*; fn run() -> Result<()> { let mut game = Game::new("rustplayer")?; <|fim_suffix|> // TODO split game into "game" and "state", // so that ...
code_fim
medium
{ "lang": "rust", "repo": "battlecode/battlecode-hackathon", "path": "/player-rust/examples/rustplayer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phodal-archive/charj path: /compiler/src/neat/program.rs use crate::neat::unit::resolve_unit; use crate::neat::Namespace; use cjc_parser::parse<|fim_suffix|> => { resolve_unit(unit, namespace); } Err(_) => {} } }<|fim_middle|>r::parse_program; pub fn program(inpu...
code_fim
medium
{ "lang": "rust", "repo": "phodal-archive/charj", "path": "/compiler/src/neat/program.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> => { resolve_unit(unit, namespace); } Err(_) => {} } }<|fim_prefix|>// repo: phodal-archive/charj path: /compiler/src/neat/program.rs use crate::neat::unit::resolve_unit; use crate::neat::Namespace; use cjc_parser::parse<|fim_middle|>r::parse_program; pub fn program(inpu...
code_fim
medium
{ "lang": "rust", "repo": "phodal-archive/charj", "path": "/compiler/src/neat/program.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wasniksudesh/Rust path: /Basic commands compilation/src/vectors.rs pub fn run(){ let arr:[i8;1]=[10]; println!("inside vectors {:?}",arr); let mut vecc:Vec<i32> = vec![2,3,4,5]; println!("This si noew {:?}",vecc); vecc<|fim_suffix|>in vecc.iter_mut(){ *x *= 2; ...
code_fim
medium
{ "lang": "rust", "repo": "wasniksudesh/Rust", "path": "/Basic commands compilation/src/vectors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>in vecc.iter_mut(){ *x *= 2; println!("this si in loop {}",x); } }<|fim_prefix|>// repo: wasniksudesh/Rust path: /Basic commands compilation/src/vectors.rs pub fn run(){ let arr:[i8;1]=[10]; println!("inside vectors {:?}",arr); l<|fim_middle|>et mut vecc:Vec<i32> = vec![2,...
code_fim
medium
{ "lang": "rust", "repo": "wasniksudesh/Rust", "path": "/Basic commands compilation/src/vectors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> wallright: _, walldown: _, wallleft: _, } = self; let left = coords.iter().find(|&c| c.x == x - 1 && c.y == y).clone(); let top = coords.iter().find(|&c| c.x == x && c.y == y + 1).clone(); let right = coords.iter().f...
code_fim
hard
{ "lang": "rust", "repo": "roby0970/masters-backend", "path": "/src/coordinates/model.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: roby0970/masters-backend path: /src/coordinates/model.rs use serde::{Deserialize, Serialize}; use crate::schema::coordinates; use diesel::prelude::*; use crate::db; use crate::error_handler::CustomError; use pathfinding::prelude::{absdiff}; #[derive(Deserialize, Serialize, Debug, AsChangeset, ...
code_fim
hard
{ "lang": "rust", "repo": "roby0970/masters-backend", "path": "/src/coordinates/model.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn read(&self, out: &mut [u8]) -> Result<usize, StatusCode> { let res: AbiResult = unsafe { kvs::get_read(self.0, 0, out.as_mut_ptr(), out.len() as u32) }.into(); let res: Result<_, _> = res.into(); res.map(|v| v as usize) } } #[derive(Debug)] pub struct Li...
code_fim
hard
{ "lang": "rust", "repo": "yaedo/wasp.rs", "path": "/wasp-core/src/kvs.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yaedo/wasp.rs path: /wasp-core/src/kvs.rs use crate::types::{read_string, AbiResult, StatusCode}; use alloc::string::String; use wasp_abi::kvs; #[derive(Debug)] pub struct Get(u32); impl Drop for Get { fn drop(&mut self) { unsafe { kvs::get_close(self.0) }; } } pub fn get(key:...
code_fim
hard
{ "lang": "rust", "repo": "yaedo/wasp.rs", "path": "/wasp-core/src/kvs.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: humanwhocodes/momoa path: /rust/src/ast.rs use crate::location::*; use crate::tokens::Token; use serde::{Deserialize, Serialize}; #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] #[serde(tag = "type")] pub enum Node { Document(Box<DocumentNode>), String(Box<ValueNode<String>>)...
code_fim
hard
{ "lang": "rust", "repo": "humanwhocodes/momoa", "path": "/rust/src/ast.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct ElementNode { pub value: Node, pub loc: LocationRange, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct NullNode { pub loc: LocationRange, } #[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]...
code_fim
hard
{ "lang": "rust", "repo": "humanwhocodes/momoa", "path": "/rust/src/ast.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct DocumentNode { pub body: Node, pub loc: LocationRange, pub tokens: Vec<Token>, }<|fim_prefix|>// repo: humanwhocodes/momoa path: /rust/src/ast.rs use crate::location::*; use crate::tokens::Token; use serde::{Deserialize, Se...
code_fim
hard
{ "lang": "rust", "repo": "humanwhocodes/momoa", "path": "/rust/src/ast.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> radio_button_add_number_before_name.connect_clicked(move |_e| { update_examples(&window_rules, None); }); let window_rules = gui_data.window_rules.clone(); radio_button_add_number_after_name.connect_clicked(move |_e| { update_examples(&window_rules, None); }); let ...
code_fim
hard
{ "lang": "rust", "repo": "radioreptile/szyszka", "path": "/src/connect_rule_window_add_number_click.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: radioreptile/szyszka path: /src/connect_rule_window_add_number_click.rs use crate::class_gui_data::GuiData; use crate::example_fields::update_examples; use crate::help_function::validate_number; use gtk::prelude::*; pub fn connect_rule_window_add_number_click(gui_data: &GuiData) { let windo...
code_fim
hard
{ "lang": "rust", "repo": "radioreptile/szyszka", "path": "/src/connect_rule_window_add_number_click.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let window_rules = gui_data.window_rules.clone(); entry_add_number_start_number.connect_changed(move |e| { e.set_text(validate_number(e.text().to_string()).as_str()); update_examples(&window_rules, None); }); let window_rules = gui_data.window_rules.clone(); entry_add_n...
code_fim
hard
{ "lang": "rust", "repo": "radioreptile/szyszka", "path": "/src/connect_rule_window_add_number_click.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }