text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: husnainsuleman/rust_code path: /method_syentex/src/main.rs #[derive(Debug)] struct life { width:u32, height:u32, } fn main (){ let rect_1=life{width:50,height:50,}; let rect_2=life{width:20,height:533,}; println!("Area Rectacgle1 {}",rect_1.area()); println!("Area Re...
code_fim
hard
{ "lang": "rust", "repo": "husnainsuleman/rust_code", "path": "/method_syentex/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} #[repr(C)] #[derive(Copy, Clone)] pub struct MIDIThruConnectionParams { pub version: UInt32, pub numSources: UInt32, pub sources: [MIDIThruConnectionEndpoint; 8usize], pub numDestinations: UInt32, pub destinations: [MIDIThruConnectionEndpoint; 8usize], pub channelMap: [UInt8; 16u...
code_fim
hard
{ "lang": "rust", "repo": "dtwood/core-midi-rs", "path": "/core-midi-sys/src/thru_connection.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} #[repr(C)] #[derive(Copy, Clone)] pub struct MIDIControlTransform { pub controlType: MIDITransformControlType, pub remappedControlType: MIDITransformControlType, pub controlNumber: UInt16, pub transform: MIDITransformType, pub param: SInt16, } impl ::std::default::Default for MIDICon...
code_fim
hard
{ "lang": "rust", "repo": "dtwood/core-midi-rs", "path": "/core-midi-sys/src/thru_connection.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dtwood/core-midi-rs path: /core-midi-sys/src/thru_connection.rs // automatically generated by rust-bindgen #![allow(dead_code, non_camel_case_types, non_upper_case_globals, non_snake_case)] /* use core_foundation_sys::*; use super::MIDIServices::*; pub type MIDIThru...
code_fim
hard
{ "lang": "rust", "repo": "dtwood/core-midi-rs", "path": "/core-midi-sys/src/thru_connection.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut request_body = ::std::vec::Vec::new(); while let Some(chunk) = StreamExt::next($req_body).await { request_body.extend_from_slice(&chunk.unwrap()); } request_body }}; }<|fim_prefix|>// repo: rustbunker/holdmybackup path: /src/http/mod.rs pub(super) m...
code_fim
medium
{ "lang": "rust", "repo": "rustbunker/holdmybackup", "path": "/src/http/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustbunker/holdmybackup path: /src/http/mod.rs pub(super) mod handler; use { super::config::config_file::Config, hyper::{ Body, Method, Request, Response, StatusCode, }, std::sync::{ Arc, Mutex, }, tracing_subscribe...
code_fim
hard
{ "lang": "rust", "repo": "rustbunker/holdmybackup", "path": "/src/http/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn exec(config: Config, args: &ArgMatches) -> BifrostResult<()> { let config = config.config_manifest(&args); return bifrost_run::run(config, &args); }<|fim_prefix|>// repo: ericdeansanchez/bifrost path: /src/bin/bifrost/commands/run.rs //! Executes `bifrost run`. use bifrost::core::config::C...
code_fim
easy
{ "lang": "rust", "repo": "ericdeansanchez/bifrost", "path": "/src/bin/bifrost/commands/run.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ericdeansanchez/bifrost path: /src/bin/bifrost/commands/run.rs //! Executes `bifrost run`. use bifrost::core::config::Config; use bifrost::ops::bifrost_run; use bifrost::util::BifrostResult; <|fim_suffix|>pub fn exec(config: Config, args: &ArgMatches) -> BifrostResult<()> { let config = con...
code_fim
easy
{ "lang": "rust", "repo": "ericdeansanchez/bifrost", "path": "/src/bin/bifrost/commands/run.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] struct Person { name: String, age: String, country: String, }<|fim_prefix|>// repo: kamranajabbar/aiot_rust_q1_assignment2 path: /src/question_10.rs use std::io; pub fn run() { println!("Please enter name"); let mut name = String::new(); io::stdin().read_line(&mut name).expect("F...
code_fim
medium
{ "lang": "rust", "repo": "kamranajabbar/aiot_rust_q1_assignment2", "path": "/src/question_10.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let my_array = [person.name.trim(), person.age.trim(), person.country.trim()]; println!("Print New Created Array : {:?}", my_array); } #[derive(Debug)] struct Person { name: String, age: String, country: String, }<|fim_prefix|>// repo: kamranajabbar/aiot_rust_q1_assignment2 path: /src/question_10....
code_fim
hard
{ "lang": "rust", "repo": "kamranajabbar/aiot_rust_q1_assignment2", "path": "/src/question_10.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kamranajabbar/aiot_rust_q1_assignment2 path: /src/question_10.rs use std::io; pub fn run() { println!("Please enter name"); let mut name = String::new(); io::stdin().read_line(&mut name).expect("Failed to read line"); println!("Please enter age"); let mut age = String::new(); io::stdin(...
code_fim
medium
{ "lang": "rust", "repo": "kamranajabbar/aiot_rust_q1_assignment2", "path": "/src/question_10.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tailhook/stator path: /src/inner/mod.rs mod start; mod main; mod manager; mod eventfd; pub mod ffi; use std::io; use std::sync::{Arc, Mutex}; use std::thread::JoinHandle; use std::sync::atomic::AtomicUsize; use std::collections::{VecDeque, HashMap}; use rotor::{Notifier, Machine}; use rotor::...
code_fim
hard
{ "lang": "rust", "repo": "tailhook/stator", "path": "/src/inner/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub enum Fsm { Main(Main), Carbon(carbon::Fsm<Context, TcpStream>), Http(http::Fsm), Redis(redis::Fsm<TcpStream>), } pub enum Command { NewCarbon(carbon::Seed), NewHttp(http::Seed), NewRedis(redis::Seed), AcceptHttp(<http::Fsm as Machine>::Seed), } pub enum Socket { Ca...
code_fim
hard
{ "lang": "rust", "repo": "tailhook/stator", "path": "/src/inner/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub enum Socket { Carbon(carbon::Sink), HttpServer, HttpRequest(Arc<Mutex<Option<Box<[u8]>>>>, Notifier), Redis(redis::Redis<TcpStream>) }<|fim_prefix|>// repo: tailhook/stator path: /src/inner/mod.rs mod start; mod main; mod manager; mod eventfd; pub mod ffi; use std::io; use std::sync...
code_fim
hard
{ "lang": "rust", "repo": "tailhook/stator", "path": "/src/inner/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self(Mutex::new(&bytes[1..])) } } fn main() { let owner = vec![1, 2, 3]; let owner2 = vec![6, 6, 6]; let data = zc::from!(owner, StructWithBytes, [u8]); dbg!(data.get::<StructWithBytes>()); *data.get::<StructWithBytes>().0.lock().unwrap() = &owner2; drop(owner2); d...
code_fim
medium
{ "lang": "rust", "repo": "avitex/rust-zc", "path": "/tests/invalid-use/dependant_interior_mut.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: avitex/rust-zc path: /tests/invalid-use/dependant_interior_mut.rs use std::sync::Mutex; use zc::Dependant; #[derive(Debug, Dependant)] pub struct StructWithBytes<'a>(Mutex<&'a [u8]>); impl<'a> From<&'a [u8]> for StructWithBytes<'a> { fn from(bytes: &'a [u8]) -> Self { <|fim_suffix|>fn mai...
code_fim
medium
{ "lang": "rust", "repo": "avitex/rust-zc", "path": "/tests/invalid-use/dependant_interior_mut.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let view = db.read_view(); let tree = view.tree(treename); let mut cursor = tree.cursor(); cursor.seek_first().await?; while cursor.valid() { let (key, value) = cursor.key_value(); let...
code_fim
hard
{ "lang": "rust", "repo": "brson/blocksy2", "path": "/examples/run.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brson/blocksy2 path: /examples/run.rs use std::fs; use std::path::PathBuf; use std::env; use blocksy2::{Db, DbConfig}; use futures::executor::block_on; use anyhow::Result; fn main() -> Result<()> { let treename = "default"; let config = DbConfig { data_dir: PathBuf::from("testd...
code_fim
hard
{ "lang": "rust", "repo": "brson/blocksy2", "path": "/examples/run.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>' a T > { } unsafe impl < ' a T : ? Sized > StableDeref for RefMut < ' a T > { } # [ cfg ( feature = " std " ) ] unsafe impl < ' a T : ? Sized > StableDeref for MutexGuard < ' a T > { } # [ cfg ( feature = " std " ) ] unsafe impl < ' a T : ? Sized > StableDeref for RwLockReadGuard < ' a T > { } # [ cfg ( ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/stable_deref_trait/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified-and-comments-removed path: /third_party/rust/stable_deref_trait/src/lib.rs # ! [ cfg_attr ( not ( feature = " std " ) no_std ) ] # [ cfg ( feature = " std " ) ] extern crate core ; # [ cfg ( feature = " alloc " ) ] extern crate alloc ; use core : : ops : : Deref ; pub...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/stable_deref_trait/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-datetime/zoneinfo-data path: /src/data/Europe/Kaliningrad.rs ixedTimespan { // 1916-04-30T22:00:00.000 UTC offset: 7200, // UTC offset 3600, DST offset 3600 is_dst: true, name: Cow::Borrowed("CEST"), }), (-1680483600, FixedTimespan { ...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/Europe/Kaliningrad.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>espan { // 2001-10-28T00:00:00.000 UTC offset: 7200, // UTC offset 7200, DST offset 0 is_dst: false, name: Cow::Borrowed("EET"), }), (1017532800, FixedTimespan { // 2002-03-31T00:00:00.000 UTC offset: 10800, // UTC offset 7200, DST offs...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/Europe/Kaliningrad.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-datetime/zoneinfo-data path: /src/data/Europe/Kaliningrad.rs u make may be overwritten. // ------ use std::borrow::Cow; use datetime::zone::{StaticTimeZone, FixedTimespanSet, FixedTimespan}; pub static ZONE: StaticTimeZone<'static> = StaticTimeZone { name: "Europe/Kaliningrad", f...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/Europe/Kaliningrad.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: silverweed/ecsde path: /inle/inle_common/src/units.rs pub const fn bytes(bytes: usize) -> usize { bytes } pub const fn kilobytes(bytes: usize) -> usize { bytes * 1024 } <|fim_suffix|>pub const fn gigabytes(bytes: usize) -> usize { megabytes(bytes) * 1024 } pub fn format_bytes_pret...
code_fim
medium
{ "lang": "rust", "repo": "silverweed/ecsde", "path": "/inle/inle_common/src/units.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub const fn gigabytes(bytes: usize) -> usize { megabytes(bytes) * 1024 } pub fn format_bytes_pretty(bytes: usize) -> String { if bytes < kilobytes(1) { format!("{} B", bytes) } else if bytes < megabytes(1) { format!("{:.2} KB", bytes as f64 / 1024.) } else if bytes < giga...
code_fim
medium
{ "lang": "rust", "repo": "silverweed/ecsde", "path": "/inle/inle_common/src/units.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn selects(mut self, params: &Vec<String>) -> DocumentSelection<'a> { for i in params.iter() { self = self.select(i); } self } fn select(self, params: &str) -> DocumentSelection<'a> { return match self { self::ParseSelection(d) => { ...
code_fim
hard
{ "lang": "rust", "repo": "ptechen/Capricorn", "path": "/src/document_selection.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return match self { self::ParseSelection(d) => { let s = d.select(params); DocumentSelection::ParseSelection(s) } self::ParseDocument(d) => { let s = d.select(params); DocumentSelection::ParseSelect...
code_fim
hard
{ "lang": "rust", "repo": "ptechen/Capricorn", "path": "/src/document_selection.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ptechen/Capricorn path: /src/document_selection.rs use crate::document_selection::DocumentSelection::ParseDocument; use crate::document_selection::DocumentSelection::ParseNode; use crate::document_selection::DocumentSelection::ParseSelection; use crate::parse::SelectParams; use crate::text_attr_...
code_fim
hard
{ "lang": "rust", "repo": "ptechen/Capricorn", "path": "/src/document_selection.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> receiver } fn init(self: &Arc<Self>) { self.spawn_thread() } fn spawn_thread(self: &Arc<Self>) { use tokio::spawn; use tokio::task::JoinHandle; let self_arc = Arc::clone(&self); let _: JoinHandle<()> = spawn(async move { self_arc.thread()....
code_fim
hard
{ "lang": "rust", "repo": "stuqdog/rust-webrtc-client-server-example", "path": "/server/src/webrtc_media_receiver.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let self_arc = Arc::clone(&self); let _: JoinHandle<()> = spawn(async move { self_arc.thread().await }); } async fn thread(self: &Arc<Self>) { use crate::ChannelMessage; use webrtc::media::rtp::rtp_codec::RTPCodecType; use webrtc_util::marshal::Marshal; ...
code_fim
medium
{ "lang": "rust", "repo": "stuqdog/rust-webrtc-client-server-example", "path": "/server/src/webrtc_media_receiver.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stuqdog/rust-webrtc-client-server-example path: /server/src/webrtc_media_receiver.rs use core::fmt; use std::sync::Arc; use webrtc::media::rtp::rtp_receiver::RTCRtpReceiver; use webrtc::media::track::track_remote::TrackRemote; use crate::ChannelSender; pub struct WebRtcMediaReceiver { cha...
code_fim
hard
{ "lang": "rust", "repo": "stuqdog/rust-webrtc-client-server-example", "path": "/server/src/webrtc_media_receiver.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(complement) = complement(c) { ns.push(complement) } } } ns.iter().rev().collect() }<|fim_prefix|>// repo: ajdust/euler path: /rosalind/rust-rosalind/src/revc.rs use std::io::{BufReader, BufRead}; pub fn complement(c: char) -> Option<char>...
code_fim
medium
{ "lang": "rust", "repo": "ajdust/euler", "path": "/rosalind/rust-rosalind/src/revc.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajdust/euler path: /rosalind/rust-rosalind/src/revc.rs use std::io::{BufReader, BufRead}; pub fn complement(c: char) -> Option<char> { match c { 'A' => Some('T'), 'C' => Some('G'), <|fim_suffix|>s = Vec::new(); for line in reader.lines() { let line = line.expect...
code_fim
medium
{ "lang": "rust", "repo": "ajdust/euler", "path": "/rosalind/rust-rosalind/src/revc.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> log::trace!("Assets request: {}", tail.as_str()); let mime = mime_guess::from_path(tail.as_str()).first_or_octet_stream(); let mut resp = self .assets .get(tail.as_str()) .map(|data| data.clone().into_response()) .unwrap_or_else(|| St...
code_fim
hard
{ "lang": "rust", "repo": "therustmonk/teleport", "path": "/server/src/server/actors/live_server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ws.on_upgrade(|weboscket| Self::handle(weboscket, engine)) } async fn handle(websocket: WebSocket, engine: Engine) { let this = Self { engine }; if let Err(err) = this.routine(websocket).await { log::warn!("LiveHandler error: {}", err); } } asy...
code_fim
hard
{ "lang": "rust", "repo": "therustmonk/teleport", "path": "/server/src/server/actors/live_server.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: therustmonk/teleport path: /server/src/server/actors/live_server.rs use crate::server::actors::Engine; use crate::server::assets::{read_assets, Assets}; use anyhow::Error; use async_trait::async_trait; use futures::{SinkExt, StreamExt}; use headers::{ContentType, HeaderMapExt}; use meio::{wrappe...
code_fim
hard
{ "lang": "rust", "repo": "therustmonk/teleport", "path": "/server/src/server/actors/live_server.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// TODO: impl ObjectLayer impl ObjectLayer { pub fn new(objects: Vec<Object>, id: usize, name: String) -> ObjectLayer { ObjectLayer { id, name, objects } } } impl Layer for ObjectLayer { fn update(&mut self, _render_ctx: &mut RenderContext) { // TODO: implement } fn o...
code_fim
hard
{ "lang": "rust", "repo": "Feilkin/mela", "path": "/src/asset/tilemap/layers.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn draw(&self, camera: &Matrix4<f32>, render_ctx: &mut RenderContext) { self.spritebatch.draw(camera, render_ctx); } fn draw_to( &self, camera: &Matrix4<f32>, view: &[&TextureView], render_ctx: &mut RenderContext, ) { self.spritebatch.draw_t...
code_fim
hard
{ "lang": "rust", "repo": "Feilkin/mela", "path": "/src/asset/tilemap/layers.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Feilkin/mela path: /src/asset/tilemap/layers.rs //! Tilemap layers use nalgebra::Matrix4; use wgpu::TextureView; use crate::asset::tilemap::tile::Tile; use crate::asset::tilemap::Object; use crate::asset::{Asset, AssetState}; use crate::ecs::world::World; use crate::gfx::{RenderContext, Sprite...
code_fim
hard
{ "lang": "rust", "repo": "Feilkin/mela", "path": "/src/asset/tilemap/layers.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: corymcdonald/advent_of_code path: /a2018/day2/src/main.rs const PUZZLE: &str = include_str!("day2.txt"); // fn count(line: &str) -> (i32, i32) { // let mut two = 0; // let mut three = 0; // for x in line.chars() { // let count = line.matches(x).count(); // if count ...
code_fim
hard
{ "lang": "rust", "repo": "corymcdonald/advent_of_code", "path": "/a2018/day2/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // // Create list of hashes so we can find the set difference PUZZLE .lines() .for_each( |x| { PUZZLE.lines().for_each( |y| { let (similarities, diff) = difference(x.chars().collect(), y.chars().collect()); if diff == 1 { ...
code_fim
hard
{ "lang": "rust", "repo": "corymcdonald/advent_of_code", "path": "/a2018/day2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: keeperofdakeys/asn1-parse path: /src/parse/set_of.rs use nom::is_alphanumeric; use data::Asn1Type; use parse::asn1_type; use parse::space::skip_other; <|fim_suffix|>#[test] fn test_set_of() { assert_eq!( Asn1Type::SetOf(None, Box::new(Asn1Type::Integer)), asn1_set_of("SET OF INTEGER,...
code_fim
hard
{ "lang": "rust", "repo": "keeperofdakeys/asn1-parse", "path": "/src/parse/set_of.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_set_of() { assert_eq!( Asn1Type::SetOf(None, Box::new(Asn1Type::Integer)), asn1_set_of("SET OF INTEGER,".as_bytes()).unwrap().1 ); assert_eq!( Asn1Type::SetOf(Some("value".into()), Box::new(Asn1Type::Type("OCTET STRING".into()))), asn1_set_of("SET OF value OCTET STRIN...
code_fim
hard
{ "lang": "rust", "repo": "keeperofdakeys/asn1-parse", "path": "/src/parse/set_of.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kyranet/lyrch path: /src/lib/util/event_handlers.rs use crate::lib::core::ThreadPoolContainer; use crate::lib::framework::LyrchFramework; use crate::lib::settings::guilds::GuildSettingsHandler; use crate::lib::settings::SettingsHandler; use serenity::framework::Framework; use serenity::model::pr...
code_fim
medium
{ "lang": "rust", "repo": "kyranet/lyrch", "path": "/src/lib/util/event_handlers.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> &self, ctx: Context, incomplete: PartialGuild, _full: Option<Arc<RwLock<Guild>>>, ) { let mut data = ctx.data.write(); let settings = data.get_mut::<GuildSettingsHandler>().unwrap(); settings.remove(incomplete.id); } }<|fim_prefix|>// repo: k...
code_fim
medium
{ "lang": "rust", "repo": "kyranet/lyrch", "path": "/src/lib/util/event_handlers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> &self, ctx: Context, _: Option<Message>, new_message: Option<Message>, _: MessageUpdateEvent, ) { if let Some(message) = new_message { let mut framework: LyrchFramework; let tp: Arc<Mutex<ThreadPool>>; { ...
code_fim
hard
{ "lang": "rust", "repo": "kyranet/lyrch", "path": "/src/lib/util/event_handlers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aristotle9/qt_generator-output path: /qt_gui/src/show_event.rs /// C++ type: <span style='color: green;'>```QShowEvent```</span> #[repr(C)] pub struct ShowEvent(u8); impl ShowEvent { /// C++ method: <span style='color: green;'>```[constructor] void QShowEvent::QShowEvent()```</span> /// /...
code_fim
medium
{ "lang": "rust", "repo": "aristotle9/qt_generator-output", "path": "/qt_gui/src/show_event.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ::std::ops::DerefMut for ::show_event::ShowEvent { fn deref_mut(&mut self) -> &mut ::qt_core::event::Event { let ffi_result = unsafe { ::ffi::qt_gui_c_QShowEvent_G_static_cast_QEvent_ptr(self as *mut ::show_event::ShowEvent) }; unsafe { ffi_result.as_mut() }.expect("Attempted to conve...
code_fim
hard
{ "lang": "rust", "repo": "aristotle9/qt_generator-output", "path": "/qt_gui/src/show_event.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ::std::ops::Deref for ::show_event::ShowEvent { type Target = ::qt_core::event::Event; fn deref(&self) -> &::qt_core::event::Event { let ffi_result = unsafe { ::ffi::qt_gui_c_QShowEvent_G_static_cast_QEvent_ptr(self as *const ::show_event::ShowEvent as *mut ::show_event::ShowEvent) }; uns...
code_fim
hard
{ "lang": "rust", "repo": "aristotle9/qt_generator-output", "path": "/qt_gui/src/show_event.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Roughsketch/nds path: /src/build.rs use std::path::{Path, PathBuf}; use anyhow::{ensure, Result}; // == Errors == #[derive(Debug, thiserror::Error)] pub enum BuildError { #[error("Missing required directory: '{0}'.")] MissingFolderError(&'static str), #[error("Missing required fil...
code_fim
hard
{ "lang": "rust", "repo": "Roughsketch/nds", "path": "/src/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Self { root: root.to_path_buf(), }) } /// Determines whether a given path is a valid NDS ROM. /// A valid NDS ROM directory is made when a ROM is extracted /// with an [`Extractor`] and includes the following: /// /// ./data/ /// ./overlay/ /...
code_fim
hard
{ "lang": "rust", "repo": "Roughsketch/nds", "path": "/src/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while ans.len() < m * n { match f { 0 => { for i in corner[0].1..=corner[1].1 { ans.push(matrix[corner[0].0][i]); } corner[0].0 += 1; corner[1].0 += 1; ...
code_fim
hard
{ "lang": "rust", "repo": "YXL76/leetcode", "path": "/rust/src/bin/54.spiral-matrix.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: YXL76/leetcode path: /rust/src/bin/54.spiral-matrix.rs /* * @lc app=leetcode id=54 lang=rust * * [54] Spiral Matrix */ // @lc code=start impl Solution { pub fn spiral_order(matrix: Vec<Vec<i32>>) -> Vec<i32> { let m = matrix.len(); let n = matrix[0].len(); let mu...
code_fim
hard
{ "lang": "rust", "repo": "YXL76/leetcode", "path": "/rust/src/bin/54.spiral-matrix.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ming a child of a node that is /// not a [Document] node. /// - The operation would result in a [Document] node having more than one [Element] child node. HierarchyRequestError }<|fim_prefix|>// repo: RSSchermer/ARWA path: /arwa/src/dom/hierarchy_request_error.rs use crate::dom_exception_wr...
code_fim
hard
{ "lang": "rust", "repo": "RSSchermer/ARWA", "path": "/arwa/src/dom/hierarchy_request_error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RSSchermer/ARWA path: /arwa/src/dom/hierarchy_request_error.rs use crate::dom_exception_wrapper; dom_exception_wrapper! { /// Error that is returned when an operation would result in an invalid DOM tree hierarchy. /// /// DOM modifying opera<|fim_suffix|>e node /// it is to be...
code_fim
medium
{ "lang": "rust", "repo": "RSSchermer/ARWA", "path": "/arwa/src/dom/hierarchy_request_error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] #[derive(Clone)] #[derive(Queryable)] #[derive(Serialize)] #[derive(Deserialize)] pub struct Post { pub id: i32, pub title: String, pub body: String, pub published: bool, } #[derive(Insertable)] #[derive(Serialize)] #[derive(Deserialize)] #[table_name = "posts"] pub struc...
code_fim
medium
{ "lang": "rust", "repo": "craigfay/jesse", "path": "/src/db/models.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: craigfay/jesse path: /src/db/models.rs use super::schema::posts; use serde::{Serialize, Deserialize}; use diesel::Insertable; use diesel::query_builder::AsChangeset; pub trait ModelInsertion<'a, M>: Insertable<M> + Serialize + Deserialize<'a> + AsChangeset { } pub struct Model { name: Stri...
code_fim
medium
{ "lang": "rust", "repo": "craigfay/jesse", "path": "/src/db/models.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> write!(f, "{}", self.id.simple()) } } impl ::std::fmt::Display for $id { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> fmt::Result { write!(f, "{}", self.id.simple()) } } }; } id!(MasterId); id!(TableId); i...
code_fim
hard
{ "lang": "rust", "repo": "danburkert/kudu-rs", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone)] pub struct Options { rpc: krpc::Options, admin_timeout: Duration, } impl Default for Options { fn default() -> Options { Options { rpc: krpc::Options::default(), admin_timeout: Duration::from_secs(60), } } } pub trait IntoMasterAdd...
code_fim
hard
{ "lang": "rust", "repo": "danburkert/kudu-rs", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danburkert/kudu-rs path: /src/lib.rs #![feature(nll)] extern crate byteorder; extern crate bytes; extern crate ieee754; extern crate ifaces; extern crate krpc; extern crate parking_lot; extern crate prost; extern crate prost_types; extern crate rand; extern crate tokio; extern crate tokio_timer...
code_fim
hard
{ "lang": "rust", "repo": "danburkert/kudu-rs", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jakmeier/paddlers-browser-game path: /paddlers-frontend/src/game.rs pub(crate) mod abilities; pub(crate) mod buildings; pub(crate) mod components; #[cfg(feature = "dev_view")] pub(crate) mod dev_view; pub(crate) mod dialogue; pub(crate) mod fight; pub(crate) mod forestry; pub(crate) mod game_eve...
code_fim
hard
{ "lang": "rust", "repo": "jakmeier/paddlers-browser-game", "path": "/paddlers-frontend/src/game.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok(game) } /// To be called when game has just been started, after loading finished. /// Some game initialization requires event manager to be active already, this should be guaranteed by this point. pub fn post_load(&mut self) -> PadlResult<()> { // Make sure all units are...
code_fim
hard
{ "lang": "rust", "repo": "jakmeier/paddlers-browser-game", "path": "/paddlers-frontend/src/game.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Deletes all building entities (lazy, requires world.maintain()) fn flush_buildings(world: &World) -> PadlResult<()> { let b = world.read_storage::<buildings::Building>(); for (entity, _marker) in (&world.entities(), &b).join() { world .entities() .delete(entity)...
code_fim
hard
{ "lang": "rust", "repo": "jakmeier/paddlers-browser-game", "path": "/paddlers-frontend/src/game.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: johnellis1392/programming_problems path: /leetcode/rust/src/binary_tree_minimum_depth.rs use std::collections::VecDeque; use std::cmp::min; use crate::tree::*; // Solution from LeetCode using a deque and graph search rather than recursion. struct _Solution {} impl _Solution { pub fn _min_de...
code_fim
medium
{ "lang": "rust", "repo": "johnellis1392/programming_problems", "path": "/leetcode/rust/src/binary_tree_minimum_depth.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(min_depth(node(3, leaf(9), node(20, leaf(15), leaf(7)))), 2); } #[test] fn test2() { assert_eq!(min_depth(node(2, None, node(3, None, node(4, None, node(5, None, leaf(6)))))), 5); } }<|fim_prefix|>// repo: johnellis1392/programming_problems path: /leetcode/rust/src/binary_tre...
code_fim
medium
{ "lang": "rust", "repo": "johnellis1392/programming_problems", "path": "/leetcode/rust/src/binary_tree_minimum_depth.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Waiting 10 seconds for stabilization..."); thread::sleep(std::time::Duration::from_secs(10)); liumos_serial_conn.send_line("version")?; liumos_serial_conn.exp_regex("liumOS version: ").unwrap(); println!( "liumOS version: {}", liumos_serial_conn.read_line().u...
code_fim
hard
{ "lang": "rust", "repo": "hikalium/liumos", "path": "/e2etest/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hikalium/liumos path: /e2etest/src/main.rs extern crate rexpect; use retry::delay::Fixed; use retry::retry_with_index; use clap::App; use clap::Arg; use rexpect::errors::*; use rexpect::session::PtySession; use rexpect::spawn; use rexpect::ReadUntil; use std::path::Path; use std::thread; cons...
code_fim
hard
{ "lang": "rust", "repo": "hikalium/liumos", "path": "/e2etest/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let cmd = "bash"; let p = spawn(&cmd, Some(TIMEOUT_MILLISECONDS)) .unwrap_or_else(|e| panic!("Failed to connect to local shell: {}", e)); println!("Connected to local shell"); p } fn expect_liumos_command_result(liumos_serial_conn: &mut PtySession, input: &str, expected: &str) { ...
code_fim
hard
{ "lang": "rust", "repo": "hikalium/liumos", "path": "/e2etest/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn set_page_position(&mut self, pos: &Position) { self.position = pos.clone(); } } use std::str::FromStr; use std::fmt::Debug; #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] struct DataWrapper<T> where T : Debug { data: Option<T>, } use std::collections::{VecDeque...
code_fim
hard
{ "lang": "rust", "repo": "musoke/issue-tracking", "path": "/tools/sit-issue-import/src/graphql.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: musoke/issue-tracking path: /tools/sit-issue-import/src/graphql.rs use serde::Deserialize; pub trait Query { type Result; fn query(&self) -> String; } pub trait Pageable { type Item; fn after(&self, cursor: String) -> Self; } pub trait HasPageInfo { fn page_info(&self) -> ...
code_fim
hard
{ "lang": "rust", "repo": "musoke/issue-tracking", "path": "/tools/sit-issue-import/src/graphql.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>} impl<S, Q, P, T, Iter> Iterator for PageableRequest<S, Q, P> where S: AsRef<str>, Q : Pageable + Query<Result = T>, P: PageHandler, ...
code_fim
hard
{ "lang": "rust", "repo": "musoke/issue-tracking", "path": "/tools/sit-issue-import/src/graphql.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yeethawe/PokemonRust path: /pokemon_rust/src/battle/tests/moves/mod.rs mod acid; mod acid_armor; mod agility; mod amnesia; mod aurora_beam; mod barrier; mod bite; mod bone_club; mod bubble; mod bubble_beam; mod comet_punch; mod confuse_ray; mod confusion; mod constrict; mod crab_hammer; mod cut;...
code_fim
hard
{ "lang": "rust", "repo": "yeethawe/PokemonRust", "path": "/pokemon_rust/src/battle/tests/moves/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>; mod meditate; mod mega_kick; mod mega_punch; mod peck; mod poison_gas; mod poison_powder; mod poison_sting; mod pound; mod psychic; mod psybeam; mod quick_attack; mod razor_leaf; mod rock_slide; mod rock_throw; mod rolling_kick; mod sand_attack; mod scratch; mod screech; mod sharpen; mod sing; mod slam;...
code_fim
hard
{ "lang": "rust", "repo": "yeethawe/PokemonRust", "path": "/pokemon_rust/src/battle/tests/moves/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> use super::*; #[test] #[no_coverage] fn test_compile() { let m = X::default_mutator(); let (_value, _): (X, _) = m.random_arbitrary(10.0); } }<|fim_prefix|>// repo: loiclec/fuzzcheck-rs path: /fuzzcheck/tests/expansions/enums_with_one_item_one_field.rs use fuzzcheck::D...
code_fim
easy
{ "lang": "rust", "repo": "loiclec/fuzzcheck-rs", "path": "/fuzzcheck/tests/expansions/enums_with_one_item_one_field.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: loiclec/fuzzcheck-rs path: /fuzzcheck/tests/expansions/enums_with_one_item_one_field.rs use fuzzcheck::DefaultMutator; #[derive(Clone, DefaultMutator)] pub enum X { A(u8), } <|fim_suffix|> let m = X::default_mutator(); let (_value, _): (X, _) = m.random_arbitrary(10.0); ...
code_fim
medium
{ "lang": "rust", "repo": "loiclec/fuzzcheck-rs", "path": "/fuzzcheck/tests/expansions/enums_with_one_item_one_field.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let cash_workers = match transaction.get_transaction_type() { CashOperationType::CashIn => &self.cash_in_workers_txs, CashOperationType::CashOut => &self.cash_out_workers_txs, }; self.logger.log(format!("IA Worker {}:\tfinished processin...
code_fim
hard
{ "lang": "rust", "repo": "FedeAlvarezA/concurrentes-proyecto2", "path": "/src/processing_worker.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FedeAlvarezA/concurrentes-proyecto2 path: /src/processing_worker.rs use rand::{thread_rng, Rng}; use std::time; use std::{sync::Arc, thread}; use crate::cash_operation_type::CashOperationType; use crate::logger::Logger; use crate::transaction::Transaction; use std::sync::mpsc::{SyncSender, TryS...
code_fim
hard
{ "lang": "rust", "repo": "FedeAlvarezA/concurrentes-proyecto2", "path": "/src/processing_worker.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let _output = String::from_utf8(scripts_deployed.stdout)?; Command::new("make") .arg("deploy-pw-lock-local") .stderr(Stdio::inherit()) .spawn()? .wait()?; let sleep_time = std::time::Duration::from_secs(5);...
code_fim
hard
{ "lang": "rust", "repo": "pLabarta/trampoline-rs", "path": "/src/bin/trampoline.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pLabarta/trampoline-rs path: /src/bin/trampoline.rs use anyhow::Result; use ckb_types::H256; use std::path::PathBuf; use std::process::{Command, Stdio}; use std::str::FromStr; use structopt::StructOpt; use trampoline::handlers::{create_ckb_dapp, deploy, faucet, new_project, pw_config}; use tramp...
code_fim
hard
{ "lang": "rust", "repo": "pLabarta/trampoline-rs", "path": "/src/bin/trampoline.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jonasohland/htrk path: /htrkapi/src/lib.rs use htrk; use std::ffi::c_void; use std::os::raw::c_char; mod c; /// Callback function pointer type #[allow(non_camel_case_types)] type htrk_discovery_callback = extern fn(*const c_char, *mut c_void) -> c_void; <|fim_suffix|>#[no_mangle] pub extern "...
code_fim
hard
{ "lang": "rust", "repo": "jonasohland/htrk", "path": "/htrkapi/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[no_mangle] pub extern "C" fn htrk_discovery_stop(_ctx: *mut htrk_discovery_ctx) {}<|fim_prefix|>// repo: jonasohland/htrk path: /htrkapi/src/lib.rs use htrk; use std::ffi::c_void; use std::os::raw::c_char; mod c; /// Callback function pointer type #[allow(non_camel_case_types)] type htrk_discovery_ca...
code_fim
hard
{ "lang": "rust", "repo": "jonasohland/htrk", "path": "/htrkapi/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: B-Curve/rust_Minecraft path: /src/world/block/block.rs use serde; use serde_json; use serde_json::Error; use std::fs::File; use std::io::BufReader; use std::io::prelude::*; use math::{Vec2, vec2, Vec3, vec3, Vec3i, Mat4, One, Ext::{scale, rotate, translate}}; use world::block::block_type::{Blo...
code_fim
hard
{ "lang": "rust", "repo": "B-Curve/rust_Minecraft", "path": "/src/world/block/block.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn build_right_face(&self, translation: &Vec3i, off: u32, translate_from_scale: bool) -> (Vec<Vertex>, Vec<u32>) { let uv = Block::get_uv(&self.texture_right, self.scale_x.unwrap_or(1.0), self.scale_y.unwrap_or(1.0)); let t = self.vi_v(translation); let s = self.get_scale(t...
code_fim
hard
{ "lang": "rust", "repo": "B-Curve/rust_Minecraft", "path": "/src/world/block/block.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn build_top_face(&self, translation: &Vec3i, off: u32, translate_from_scale: bool) -> (Vec<Vertex>, Vec<u32>) { let uv = Block::get_uv(&self.texture_top, self.scale_x.unwrap_or(1.0), self.scale_y.unwrap_or(1.0)); let t = self.vi_v(translation); let s = self.get_scale(trans...
code_fim
hard
{ "lang": "rust", "repo": "B-Curve/rust_Minecraft", "path": "/src/world/block/block.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexFickle/spades path: /src/player/array.rs use super::Player; /// Length four array that uses `Player` as an index. #[derive(Clone)] pub struct Array<T> where T: Clone, { /// The internal storage. array: [T; 4], } impl<T> Array<T> where T: Clone, { /// Creates a new array...
code_fim
hard
{ "lang": "rust", "repo": "alexFickle/spades", "path": "/src/player/array.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Conditionally Default impl<T> Default for Array<T> where T: Default + Clone, { fn default() -> Self { Self { array: [T::default(), T::default(), T::default(), T::default()], } } } /// Conditionally Copy impl<T> Copy for Array<T> where T: Copy + Clone {} /// Co...
code_fim
hard
{ "lang": "rust", "repo": "alexFickle/spades", "path": "/src/player/array.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xxuejie/ckb-boxer path: /src/lib.rs #[macro_use] extern crate derive_more; use ckb_app_config::{AppConfig, ExitCode, Setup, SetupGuard}; use ckb_build_info::Version; use ckb_chain::chain::ChainService; use ckb_error::Error as CkbError; use ckb_shared::shared::{Shared, SharedBuilder}; use ckb_ty...
code_fim
hard
{ "lang": "rust", "repo": "xxuejie/ckb-boxer", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Error::Exit(c as i32) } } impl From<&str> for Error { fn from(s: &str) -> Self { Error::Other(s.to_string()) } } impl std::error::Error for Error {} pub struct Boxer { #[allow(dead_code)] guard: SetupGuard, shared: Shared, chain: ChainService, } impl Boxer {...
code_fim
hard
{ "lang": "rust", "repo": "xxuejie/ckb-boxer", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Boxer { #[allow(dead_code)] guard: SetupGuard, shared: Shared, chain: ChainService, } impl Boxer { pub fn create<P: AsRef<Path>>(config_dir: P) -> Result<Boxer, Error> { let config = AppConfig::load_for_subcommand(config_dir, "run")?; let setup = Setup { ...
code_fim
hard
{ "lang": "rust", "repo": "xxuejie/ckb-boxer", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let matches = App::new(crate_name!()) .about(crate_description!()) .version(solana_version::version!()) .setting(AppSettings::SubcommandRequiredElseHelp) .arg( Arg::with_name("data_file") .long("data-file") .value_name("PATH")...
code_fim
hard
{ "lang": "rust", "repo": "project-serum/solana", "path": "/stake-monitor/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(account_info) = accounts_info.account_info.get(&account_address.to_string()) { if let Some(slot) = account_info.compliant_since { println!( "{}Account compliant since slot {} with a balance of {} SOL", Emoji("✅ ", ""), slo...
code_fim
hard
{ "lang": "rust", "repo": "project-serum/solana", "path": "/stake-monitor/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: project-serum/solana path: /stake-monitor/src/main.rs use clap::{ crate_description, crate_name, value_t, value_t_or_exit, App, AppSettings, Arg, SubCommand, }; use console::Emoji; use log::*; use solana_clap_utils::{ input_parsers::pubkey_of, input_validators::{is_pubkey, is_slot, i...
code_fim
hard
{ "lang": "rust", "repo": "project-serum/solana", "path": "/stake-monitor/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dakom/shipyard-scenegraph path: /crate/src/systems.rs use crate::hierarchy::SceneGraph; use crate::traits::required::*; use crate::{ components::*, views::{LocalTransformDataMut, LocalTransformStoragesMut}, }; use shipyard::*; use shipyard_hierarchy::*; use std::collections::HashSet; pu...
code_fim
hard
{ "lang": "rust", "repo": "dakom/shipyard-scenegraph", "path": "/crate/src/systems.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> id: EntityId, mut dirty: bool, parent: EntityId, parent_storage: &View<Parent<SceneGraph>>, child_storage: &View<Child<SceneGraph>>, local_transform_storage: &View<LocalTransform<M, N>>, dirty_transform_storage: &mut ViewMut<DirtyTransform>, ...
code_fim
hard
{ "lang": "rust", "repo": "dakom/shipyard-scenegraph", "path": "/crate/src/systems.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gba-rs/gba-emu path: /src/memory/timer_registers.rs use wasm_bindgen::__rt::core::cell::RefCell; use wasm_bindgen::__rt::std::rc::Rc; use memory_macros::*; use super::GbaMem; io_register! ( TimerDataRegister => 2, [0x4000100, 0x4000104, 0x4000108, 0x400010C], data: 0, 16 ); <|fim_suffi...
code_fim
hard
{ "lang": "rust", "repo": "gba-rs/gba-emu", "path": "/src/memory/timer_registers.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn write_reload(&mut self, value: u16) { let mut mem_ref = self.memory.borrow_mut(); let address = 0x1000_0000 + (self.index * 2); mem_ref[address] = (value & 0xFF) as u8; mem_ref[address + 1] = ((value & 0xFF00) >> 8) as u8; } }<|fim_prefix|>// repo: gba-rs/g...
code_fim
hard
{ "lang": "rust", "repo": "gba-rs/gba-emu", "path": "/src/memory/timer_registers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: georust/geo path: /geo/src/algorithm/geodesic_intermediate.rs use crate::{CoordFloat, Point}; use geographiclib_rs::{DirectGeodesic, Geodesic, InverseGeodesic}; /// Returns a new Point along a route between two existing points on an ellipsoidal model of the earth pub trait GeodesicIntermediate...
code_fim
hard
{ "lang": "rust", "repo": "georust/geo", "path": "/geo/src/algorithm/geodesic_intermediate.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn various_f_values_test() { let p1 = Point::new(10.0, 20.0); let p2 = Point::new(125.0, 25.0); let i20 = p1.geodesic_intermediate(&p2, 0.2); let i50 = p1.geodesic_intermediate(&p2, 0.5); let i80 = p1.geodesic_intermediate(&p2, 0.8); let i20_...
code_fim
hard
{ "lang": "rust", "repo": "georust/geo", "path": "/geo/src/algorithm/geodesic_intermediate.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: str4d/rage path: /age/src/i18n.rs use i18n_embed::{ fluent::{fluent_language_loader, FluentLanguageLoader}, unic_langid::LanguageIdentifier, DefaultLocalizer, LanguageLoader, Localizer, }; use lazy_static::lazy_static; use rust_embed::RustEmbed; <|fim_suffix|>/// age-localized versi...
code_fim
hard
{ "lang": "rust", "repo": "str4d/rage", "path": "/age/src/i18n.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// age-localized version of the write! macro. #[doc(hidden)] #[macro_export] macro_rules! wfl { ($f:ident, $message_id:literal) => { write!($f, "{}", $crate::fl!($message_id)) }; } /// age-localized version of the writeln! macro. #[doc(hidden)] #[macro_export] macro_rules! wlnfl { ($...
code_fim
hard
{ "lang": "rust", "repo": "str4d/rage", "path": "/age/src/i18n.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }