text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> let (addr, len) = match response { VmMemResponse::MemoryAllocate(addr, len) => (addr, len), _ => { error!("fpga-afu: unexpected response type: {:?}", &response); return Err(Error::ErrUnspec); } }; debug!("addr at ...
code_fim
hard
{ "lang": "rust", "repo": "baka233/firecracker", "path": "/src/devices/src/virtio/fpga/fpga_map_region.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let _ = mem_controller_lock .execute_vm_mem_request(VmMemRequest::UnsetKvmUserMem(slot)) .map_err(|e| { error!( "unser kvm user mem failed, region: {:?}, err: {:?}", &self, e ); e ...
code_fim
hard
{ "lang": "rust", "repo": "baka233/firecracker", "path": "/src/devices/src/virtio/fpga/fpga_map_region.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn pointer_down(&mut self, x: f32, y: f32) { self.pointer_x = x; self.pointer_y = y; self.pointer_down = true; } pub fn pointer_up(&mut self, x: f32, y: f32) { self.pointer_x = x; self.pointer_y = y; self.pointer_up = true; } pub fn...
code_fim
hard
{ "lang": "rust", "repo": "kettle11/kui", "path": "/src/ui.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /* pub fn animate(&mut self, widget: &mut impl Widget) { self.animation_frame_requested = false; let elapsed = if let Some(last_time_stamp) = self.last_animation_timestamp { last_time_stamp.elapsed().as_secs_f32() * 1000. } else { 0. }; ...
code_fim
hard
{ "lang": "rust", "repo": "kettle11/kui", "path": "/src/ui.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kettle11/kui path: /src/ui.rs le, _rectangle: Rectangle, _text_properties: &TextProperties, ) { } } pub trait ToAny { fn to_any(self: Box<Self>) -> Box<dyn Any>; } impl<T: Any + Widget> ToAny for T { fn to_any(self: Box<Self>) -> Box<dyn Any> { self ...
code_fim
hard
{ "lang": "rust", "repo": "kettle11/kui", "path": "/src/ui.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iferc/possible-rs path: /src/zip.rs use super::Possible; impl<T> Possible<T> { /// Zips `self` with another `Possible`. /// /// If `self` and `other` are both `Possible::Some`, returns `Possible::Some((s, o))`. /// If one of `self` or `other` are `Possible::None`, returns `Possi...
code_fim
hard
{ "lang": "rust", "repo": "iferc/possible-rs", "path": "/src/zip.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t_eq!(x.zip(y), Possible::Some((1, "hi"))); /// assert_eq!(x.zip(z), Possible::None); /// assert_eq!(y.zip(w), Possible::Void); /// assert_eq!(w.zip(y), Possible::Void); /// ``` pub fn zip<U>(self, other: Possible<U>) -> Possible<(T, U)> { match (self, other) { (Pos...
code_fim
hard
{ "lang": "rust", "repo": "iferc/possible-rs", "path": "/src/zip.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TomCrypto/lpc11xx path: /src/c_can/cantest.rs #[doc = "Reader of register CANTEST"] pub type R = crate::R<u32, super::CANTEST>; #[doc = "Writer for register CANTEST"] pub type W = crate::W<u32, super::CANTEST>; #[doc = "Register CANTEST `reset()`'s with value 0"] impl crate::ResetValue for super...
code_fim
hard
{ "lang": "rust", "repo": "TomCrypto/lpc11xx", "path": "/src/c_can/cantest.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match variant { RX_A::RECESSIVE => false, RX_A::DORMANT => true, } } } #[doc = "Reader of field `RX`"] pub type RX_R = crate::R<bool, RX_A>; impl RX_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> RX_A { ...
code_fim
hard
{ "lang": "rust", "repo": "TomCrypto/lpc11xx", "path": "/src/c_can/cantest.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match variant { TX_A::LEVEL => 0, TX_A::TXD => 1, TX_A::LOW => 2, TX_A::HIGH => 3, } } } #[doc = "Reader of field `TX`"] pub type TX_R = crate::R<u8, TX_A>; impl TX_R { #[doc = r"Get enumerated values variant"] #[inline(always)] ...
code_fim
hard
{ "lang": "rust", "repo": "TomCrypto/lpc11xx", "path": "/src/c_can/cantest.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dylanmckay/engine path: /src/gfx/src/gl/mesh.rs use gl::gl; use gl::vertex; use gl::gl::types::*; use gl::Type; use gl::util; use geom; use libc::c_void; use std::{self, mem}; /// A raw hardware buffer. #[derive(Copy,Clone)] pub struct RawBuffer { /// The OpenGL buffer object, buffer: ...
code_fim
hard
{ "lang": "rust", "repo": "dylanmckay/engine", "path": "/src/gfx/src/gl/mesh.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Gets the raw index buffer. pub fn raw_index_buffer<'a>(&'a self) -> &'a RawBuffer { &self.index_buffer } /// Gets the raw vertex buffer. pub fn raw_vertex_buffer<'a>(&'a self) -> &'a RawBuffer { &self.vertex_buffer } /// Binds the index array. pub fn b...
code_fim
hard
{ "lang": "rust", "repo": "dylanmckay/engine", "path": "/src/gfx/src/gl/mesh.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CyberFlameGO/abi_stable_crates path: /abi_stable/src/std_types/vec.rs ptr, }; use serde::{Deserialize, Deserializer, Serialize, Serializer}; use core_extensions::prelude::*; use crate::{ sabi_types::Constructor, std_types::{RSlice, RSliceMut,utypeid::{UTypeId,new_utypeid}}, prefi...
code_fim
hard
{ "lang": "rust", "repo": "CyberFlameGO/abi_stable_crates", "path": "/abi_stable/src/std_types/vec.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> /// Retains only the elements that satisfy the `pred` predicate /// /// This means that a element will be removed if `pred(that_element)` /// returns false. /// /// # Example /// /// ``` /// use abi_stable::std_types::RVec; /// /// { /// let mut list=(0...
code_fim
hard
{ "lang": "rust", "repo": "CyberFlameGO/abi_stable_crates", "path": "/abi_stable/src/std_types/vec.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CyberFlameGO/abi_stable_crates path: /abi_stable/src/std_types/vec.rs q!(list.is_empty(),true); /// /// list.push(0x1337); /// assert_eq!(list.is_empty(),false); /// /// list.push(0xC001); /// assert_eq!(list.is_empty(),false); /// /// ``` #[inline(always)] ...
code_fim
hard
{ "lang": "rust", "repo": "CyberFlameGO/abi_stable_crates", "path": "/abi_stable/src/std_types/vec.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bridger-herman/sl-wasm path: /src/main.rs extern crate log; extern crate wasm_bindgen; extern crate wasm_logger; #[macro_use] extern crate lazy_static; #[macro_use] mod term_buf; mod c51; mod common; mod d51; mod logo; mod train; use crate::c51::C51; use crate::common::*; use wasm_bindgen::pre...
code_fim
hard
{ "lang": "rust", "repo": "bridger-herman/sl-wasm", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // let conf = Config { // accident: matches.opt_present("accident"), // fly: matches.opt_present("fly"), // smoke: !matches.opt_present("no-smoke"), // smoke_state: smoke::SmokeState::new(), // }; // match sl_type { // SLType::Logo => Logo::new(conf).run(), // SLType::C...
code_fim
hard
{ "lang": "rust", "repo": "bridger-herman/sl-wasm", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // let mut opts = Options::new(); // opts.optflag("l", "logo", "select logo"); // opts.optflag("c", "c51", "select C51"); // opts.optflag("F", "fly", "enable fly mode"); // opts.optflag("a", "accident", "enable accident mode"); // opts.optflag("s", "no-smoke", "disable smoke mode")...
code_fim
hard
{ "lang": "rust", "repo": "bridger-herman/sl-wasm", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.satisfy_constraints(); } pub fn do_verlet_timestep_for(&mut self, particle_num: usize, constraint_num: usize) { self.particles[particle_num - 1].verlet(); self.satisfy_constraint_for(constraint_num); } #[allow(dead_code)] pub fn do_eurler_timestep(&mut se...
code_fim
hard
{ "lang": "rust", "repo": "smokku/soldank", "path": "/client/src/particles.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn pos(&self, particle_num: usize) -> Vec2 { self.particles[particle_num - 1].pos } pub fn pos_mut(&mut self, particle_num: usize) -> &mut Vec2 { &mut self.particles[particle_num - 1].pos } pub fn old_pos(&self, particle_num: usize) -> Vec2 { self.particle...
code_fim
hard
{ "lang": "rust", "repo": "smokku/soldank", "path": "/client/src/particles.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: smokku/soldank path: /client/src/particles.rs use super::*; use std::io::{BufRead, BufReader}; use std::path::PathBuf; // Notes: // * Particle & constraint vectors are kept private to prevent mismatch between // zero-based and one-based indexing. // * These private vectors are zero-based (no ...
code_fim
hard
{ "lang": "rust", "repo": "smokku/soldank", "path": "/client/src/particles.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for frame in self.frames.iter() { encoder.write_frame(frame)?; } } Ok(data.into_boxed_slice()) } }<|fim_prefix|>// repo: prixt/wiki2life-twitterbot path: /src/giffer.rs use std::error::Error; use gif::*; pub struct Giffer<'a> { width: u16...
code_fim
hard
{ "lang": "rust", "repo": "prixt/wiki2life-twitterbot", "path": "/src/giffer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prixt/wiki2life-twitterbot path: /src/giffer.rs use std::error::Error; use gif::*; pub struct Giffer<'a> { width: u16, height: u16, colors: [u8;6], frames: Vec<Frame<'a>>, } impl<'a> Giffer<'a> { pub fn new(width: u16, height: u16, live_color: [u8;3], dead_color: [u8;3]) -> Se...
code_fim
hard
{ "lang": "rust", "repo": "prixt/wiki2life-twitterbot", "path": "/src/giffer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ecafkoob/ockam path: /implementations/rust/ockam/ockam_entity/src/lease/json_proto.rs use crate::{Lease, TTL}; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use tracing::error; #[derive(Serialize, Deserialize, PartialEq, Debug)] pub struct LeaseProtocolPermissions { ac...
code_fim
hard
{ "lang": "rust", "repo": "ecafkoob/ockam", "path": "/implementations/rust/ockam/ockam_entity/src/lease/json_proto.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn as_json(&self) -> String { serde_json::to_string(self).unwrap() } } #[cfg(test)] mod tests { use crate::lease::json_proto::{LeaseProtocolRequest, LeaseProtocolResponse}; use crate::Lease; use std::time::SystemTime; #[test] fn test_serialize_get() { let ...
code_fim
hard
{ "lang": "rust", "repo": "ecafkoob/ockam", "path": "/implementations/rust/ockam/ockam_entity/src/lease/json_proto.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bevyengine/bevy path: /crates/bevy_core_pipeline/src/bloom/downsampling_pipeline.rs use super::{BloomSettings, BLOOM_SHADER_HANDLE, BLOOM_TEXTURE_FORMAT}; use crate::fullscreen_vertex_shader::fullscreen_shader_vertex_state; use bevy_ecs::{ prelude::{Component, Entity}, system::{Commands,...
code_fim
hard
{ "lang": "rust", "repo": "bevyengine/bevy", "path": "/crates/bevy_core_pipeline/src/bloom/downsampling_pipeline.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Bind group layout let bind_group_layout = render_device.create_bind_group_layout(&BindGroupLayoutDescriptor { label: Some("bloom_downsampling_bind_group_layout_with_settings"), entries: &[texture, sampler, settings], }); /...
code_fim
hard
{ "lang": "rust", "repo": "bevyengine/bevy", "path": "/crates/bevy_core_pipeline/src/bloom/downsampling_pipeline.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut indent_count = 0; // Automatically indent the text to be inserted. // // This is sort of a hack. I designed multiple cursors so that all cursors are applied // at once, but operations such as autoindenting are much asier to implement if ...
code_fim
hard
{ "lang": "rust", "repo": "mwatts/makepad", "path": "/studio/src/editor_state.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mwatts/makepad path: /studio/src/editor_state.rs est, ); } /// For each cursor in the cursor set of the session with the given `session_id`, if the /// selection of the cursor is empty, deletes the character at the caret of the cursor. /// Otherwise, removes the selectio...
code_fim
hard
{ "lang": "rust", "repo": "mwatts/makepad", "path": "/studio/src/editor_state.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mwatts/makepad path: /studio/src/editor_state.rs ment.should_be_destroyed { self.destroy_document_deferred(document_id, send_request); } document_id } /// Schedules the document with the given `document_id` to be destroyed. /// /// If the document is ...
code_fim
hard
{ "lang": "rust", "repo": "mwatts/makepad", "path": "/studio/src/editor_state.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TilBlechschmidt/thirtyfour path: /src/query/poller.rs use crate::http::connection_async::WebDriverHttpClientAsync; use crate::support::sleep; use crate::GenericWebDriver; use serde::{Deserialize, Serialize}; use std::time::{Duration, Instant}; /// Parameters used to determine the polling / time...
code_fim
hard
{ "lang": "rust", "repo": "TilBlechschmidt/thirtyfour", "path": "/src/query/poller.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(i) = self.interval { // Next poll is due no earlier than this long after the first poll started. let minimum_elapsed = i * self.cur_tries; // But this much time has elapsed since the first poll started. let actual_elapsed = self.start.el...
code_fim
hard
{ "lang": "rust", "repo": "TilBlechschmidt/thirtyfour", "path": "/src/query/poller.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if self.timeout.filter(|t| &self.start.elapsed() < t).is_none() && self.cur_tries >= self.min_tries { return false; } if let Some(i) = self.interval { // Next poll is due no earlier than this long after the first poll started. ...
code_fim
hard
{ "lang": "rust", "repo": "TilBlechschmidt/thirtyfour", "path": "/src/query/poller.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marccampbell/auditable path: /src/auditable/auditevent.rs extern crate redis; extern crate time; use iron::prelude::*; use iron::status; use bodyparser::*; use redis::Commands; use std::env; use uuid::Uuid; pub fn auditevent_create(req: &mut Request) -> IronResult<Response> { let body = re...
code_fim
hard
{ "lang": "rust", "repo": "marccampbell/auditable", "path": "/src/auditable/auditevent.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> redis::cmd("HMSET").arg(event_id.clone()).arg(&[ ("action", self.action.clone()), ("actor", self.actor.clone()), ("created.at", now.sec.to_string()) ]).execute(&connect_result); redis::cmd("ZADD").arg("audit.events").arg(now.sec).arg(event_id.cl...
code_fim
hard
{ "lang": "rust", "repo": "marccampbell/auditable", "path": "/src/auditable/auditevent.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Testing multiple TCP messages is kind of interesting // because we need to make sure we don't corrupt the // stream/buffer when receiving them, as opposed to UDP // where we work with individual datagrams. server_node.enqueue_message(SendMessage { // Peer ID 0 is self. ...
code_fim
hard
{ "lang": "rust", "repo": "jeffparsons/planetkit", "path": "/planetkit/src/net/tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jeffparsons/planetkit path: /planetkit/src/net/tests.rs use std; use std::time::Duration; use slog; use specs; use super::*; // Nothing interesting in here! #[derive(Serialize, Deserialize, Debug, Eq, PartialEq, Clone)] struct TestMessage { disposition: String, } impl GameMessage for Test...
code_fim
hard
{ "lang": "rust", "repo": "jeffparsons/planetkit", "path": "/planetkit/src/net/tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ifsheldon/RustyOOPatterns path: /src/strategy_pattern/behaviors.rs //! //! This mod contains structs of behaviors //! //! /// /// The struct of behavior /// /// Including behaviors/methods and needed information/fields /// pub struct AppleEater { apple: u32 } impl AppleEater { pub fn ne...
code_fim
medium
{ "lang": "rust", "repo": "ifsheldon/RustyOOPatterns", "path": "/src/strategy_pattern/behaviors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn eat_apple(&mut self) { self.apple += 1; } } /// /// trait for achieving pseudo-inheritance in Rust /// /// for methods not changing fields pub trait AsAppleEater { fn as_apple_eater(&self) -> &AppleEater; fn report(&self) { self.as_apple_eater().report() } } /// /// trait for achi...
code_fim
medium
{ "lang": "rust", "repo": "ifsheldon/RustyOOPatterns", "path": "/src/strategy_pattern/behaviors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// /// trait for achieving pseudo-inheritance in Rust /// /// for methods changing fields pub trait AsMutAppleEater: AsAppleEater { fn as_mut_apple_eater(&mut self) -> &mut AppleEater; fn eat_apple(&mut self) { self.as_mut_apple_eater().eat_apple(); self.report(); } }<|fi...
code_fim
hard
{ "lang": "rust", "repo": "ifsheldon/RustyOOPatterns", "path": "/src/strategy_pattern/behaviors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: worace/geoq path: /src/geoq/par.rs use crate::geoq::{ entity::{self, Entity}, error::Error, input, reader, }; use num_cpus; use std::io; use std::{ io::BufRead, sync::{ mpsc::{sync_channel, Receiver, RecvError, SyncSender}, Arc, }, thread::{self, JoinH...
code_fim
hard
{ "lang": "rust", "repo": "worace/geoq", "path": "/src/geoq/par.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let printer_thread = thread::spawn(move || { while !output_channels.is_empty() { for i in 0..output_channels.len() { let output = output_channels[i].recv(); match output { Err(RecvError) => continue, Ok(WorkerO...
code_fim
hard
{ "lang": "rust", "repo": "worace/geoq", "path": "/src/geoq/par.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> printer_thread .join() .expect("Couldn't wait for printer thread to complete"); Ok(()) } #[cfg(test)] mod tests { use crate::geoq::par::for_entity_par; #[test] fn test_par_entities() { // Problem: // Outputs need to be processed by the single printer ...
code_fim
hard
{ "lang": "rust", "repo": "worace/geoq", "path": "/src/geoq/par.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let windowState = Rc::new( WindowState { drawingArea: drawingArea, color: RefCell::new( Color { red: 0, green: 0, blue: 255 } ) } ); { let ws = windowState.clone(); button.connect_clicked(move |_| { ...
code_fim
hard
{ "lang": "rust", "repo": "ruimo/rust-study-klavier", "path": "/gtk03/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ruimo/rust-study-klavier path: /gtk03/src/main.rs extern crate gtk; use std::cell::RefCell; use gtk::prelude::*; use std::rc::Rc; struct Color { red: u8, green: u8, blue: u8 } impl Color { fn set_color(&mut self, new_color: Color) { *self = new_color; } } struct W...
code_fim
medium
{ "lang": "rust", "repo": "ruimo/rust-study-klavier", "path": "/gtk03/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> window1.connect_delete_event(move |_, _| { gtk::main_quit(); Inhibit(false) }); let button: gtk::Button = builder.get_object("button1").unwrap(); let drawingArea: gtk::DrawingArea = builder.get_object("drawingarea1").unwrap(); drawingArea.set_size_request(300, 300); ...
code_fim
hard
{ "lang": "rust", "repo": "ruimo/rust-study-klavier", "path": "/gtk03/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if between { players = players[1..].to_string(); } let mut white = false; let mut black = false; for mut player in players.split(",") { let first_char = player.chars().next().unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "enricobn/chessrw", "path": "/src/bin/chessrw.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: enricobn/chessrw path: /src/bin/chessrw.rs *; use chessrw::base::position::*; use chessrw::base::fen::*; use chessrw::base::game::*; /** * ficsgamesdb_201801_standard_nomovetimes_14117.pgn * Downloaded from https://www.ficsgames.org/download.html : * Standard (all ratings) * 2018 / January ...
code_fim
hard
{ "lang": "rust", "repo": "enricobn/chessrw", "path": "/src/bin/chessrw.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: enricobn/chessrw path: /src/bin/chessrw.rs sgames.org/download.html : * Standard (all ratings) * 2018 / January * No move times * * Without write file nor other filters --noprogress: * 81,871 games red in 1 second 275 millis. * * Without write file and --blackwins --noprogress: * 37,5...
code_fim
hard
{ "lang": "rust", "repo": "enricobn/chessrw", "path": "/src/bin/chessrw.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { b::foo() }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/svh-add-nothing.rs // run-pass // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-base.rs <|fim_middle|>// pretty-expanded FI...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/svh-add-nothing.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/svh-add-nothing.rs // run-pass // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-base.rs <|fim_suffix|>extern crate a; extern crate b; fn main() { b::foo() }<|...
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/svh-add-nothing.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>extern crate a; extern crate b; fn main() { b::foo() }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/svh-add-nothing.rs // run-pass // note that these aux-build directives must be in this order // aux-build:svh-a-base.rs // aux-build:svh-b.rs // aux-build:svh-a-base.rs <|...
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/svh-add-nothing.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: popboykingdjko/awstream path: /profiling/video/src/lib.rs //! This crate wraps `gstreamer` and `opencv` to simplify the interface of //! loading videos. Currenlty it only supports loading image but adding video //! files is easy (TODO). //! //! There are two types of data that can be loaded: fra...
code_fim
hard
{ "lang": "rust", "repo": "popboykingdjko/awstream", "path": "/profiling/video/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> impl From<gst::Error> for Error { fn from(err: gst::Error) -> Error { Error::from_kind(ErrorKind::Gst(err.message())) } } } fn skip_to_fps(skip: usize) -> f64 { (30.0 / (skip as f64 + 1.0) * 10.0).round() / 10.0 }<|fim_prefix|>// repo: popboykingdjko/awstream path...
code_fim
hard
{ "lang": "rust", "repo": "popboykingdjko/awstream", "path": "/profiling/video/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Ensure a package name is [valid][validate_package_name] pub fn sanitize_package_name(name: &str, placeholder: char) -> String { let mut slug = String::new(); let mut chars = name.chars(); while let Some(ch) = chars.next() { if (unicode_xid::UnicodeXID::is_xid_start(ch) || ch == '_'...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/cargo", "path": "/src/cargo/util/restricted_names.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/cargo path: /src/cargo/util/restricted_names.rs //! Helpers for validating and checking names like package and crate names. use crate::util::CargoResult; use anyhow::bail; use std::path::Path; /// Returns `true` if the name contains non-ASCII characters. pub fn is_non_ascii_name(name...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/cargo", "path": "/src/cargo/util/restricted_names.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>/// Check the entire path for names reserved in Windows. pub fn is_windows_reserved_path(path: &Path) -> bool { path.iter() .filter_map(|component| component.to_str()) .any(|component| { let stem = component.split('.').next().unwrap(); is_windows_reserved(stem) ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/cargo", "path": "/src/cargo/util/restricted_names.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> csp::Csp, last_page::LastPage, push::Push, security_headers::SecurityHeaders, };<|fim_prefix|>// repo: Zarthus/paste path: /webserver/src/routes/web/fairings.rs pub mod csp; pub mod last_page; pub mod push<|fim_middle|>; pub mod security_headers; pub use self::{
code_fim
easy
{ "lang": "rust", "repo": "Zarthus/paste", "path": "/webserver/src/routes/web/fairings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Push, security_headers::SecurityHeaders, };<|fim_prefix|>// repo: Zarthus/paste path: /webserver/src/routes/web/fairings.rs pub mod csp; pub mod last_page; pub mod push<|fim_middle|>; pub mod security_headers; pub use self::{ csp::Csp, last_page::LastPage, push::
code_fim
medium
{ "lang": "rust", "repo": "Zarthus/paste", "path": "/webserver/src/routes/web/fairings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Zarthus/paste path: /webserver/src/routes/web/fairings.rs pub mod csp; pub mod last_page; pub mod push<|fim_suffix|>Push, security_headers::SecurityHeaders, };<|fim_middle|>; pub mod security_headers; pub use self::{ csp::Csp, last_page::LastPage, push::
code_fim
medium
{ "lang": "rust", "repo": "Zarthus/paste", "path": "/webserver/src/routes/web/fairings.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: datascientist1976/awsudo path: /src/awsudo/dispatcher.rs use std::process::{Command, Stdio}; pub fn run(command: String)<|fim_suffix|>t()) .output() .expect("Something went wrong"); }<|fim_middle|> { Command::new("sh") .arg("-c") .arg(command) .stdout...
code_fim
medium
{ "lang": "rust", "repo": "datascientist1976/awsudo", "path": "/src/awsudo/dispatcher.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) .stdout(Stdio::inherit()) .stderr(Stdio::inherit()) .output() .expect("Something went wrong"); }<|fim_prefix|>// repo: datascientist1976/awsudo path: /src/awsudo/dispatcher.rs use std::process::{Command, Stdio}; pub fn run(command: String)<|fim_middle|> { Command::n...
code_fim
medium
{ "lang": "rust", "repo": "datascientist1976/awsudo", "path": "/src/awsudo/dispatcher.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub const MAX_KCTL_NAME: usize = 96;<|fim_prefix|>// repo: chromium/chromium path: /third_party/rust/libc/v0_2/crate/src/unix/bsd/apple/long_array.rs s! { pub struct ctl_info { pub ctl_id: u32, pub ctl_nam<|fim_middle|>e: [::c_char; MAX_KCTL_NAME], } }
code_fim
easy
{ "lang": "rust", "repo": "chromium/chromium", "path": "/third_party/rust/libc/v0_2/crate/src/unix/bsd/apple/long_array.rs", "mode": "spm", "license": "GPL-1.0-or-later", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chromium/chromium path: /third_party/rust/libc/v0_2/crate/src/unix/bsd/apple/long_array.rs s! { pub struct ctl_info { pub ctl_id: u32, pub ctl_nam<|fim_suffix|> pub const MAX_KCTL_NAME: usize = 96;<|fim_middle|>e: [::c_char; MAX_KCTL_NAME], } }
code_fim
easy
{ "lang": "rust", "repo": "chromium/chromium", "path": "/third_party/rust/libc/v0_2/crate/src/unix/bsd/apple/long_array.rs", "mode": "psm", "license": "GPL-1.0-or-later", "source": "the-stack-v2" }
<|fim_prefix|>// repo: serenity-rs/serenity path: /src/builder/create_channel.rs use std::collections::HashMap; use crate::json::{from_number, json, Value}; use crate::model::prelude::*; /// A builder for creating a new [`GuildChannel`] in a [`Guild`]. /// /// Except [`Self::name`], all fields are optional. /// /// ...
code_fim
hard
{ "lang": "rust", "repo": "serenity-rs/serenity", "path": "/src/builder/create_channel.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> self } /// Set an interesting topic. /// /// **Note**: Must be between 0 and 1000 characters long. pub fn topic<D: ToString>(&mut self, topic: D) -> &mut Self { self.0.insert("topic", Value::from(topic.to_string())); self } /// Specify if this channel...
code_fim
hard
{ "lang": "rust", "repo": "serenity-rs/serenity", "path": "/src/builder/create_channel.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> /// Specify where the channel should be located. pub fn position(&mut self, pos: u32) -> &mut Self { self.0.insert("position", from_number(pos)); self } /// A set of overwrites defining what a user or a user carrying a certain role can /// and cannot do. /// /...
code_fim
hard
{ "lang": "rust", "repo": "serenity-rs/serenity", "path": "/src/builder/create_channel.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maciejkula/sbr-sys path: /src/lib.rs #![deny(missing_docs)] //! C bindings for [Sbr](https://github.com/maciejkula/sbr-rs). #[macro_use] extern crate const_cstr; #[macro_use] extern crate itertools; extern crate bincode; extern crate libc; extern crate sbr; mod ffi_results; #[macro_use] mod ff...
code_fim
hard
{ "lang": "rust", "repo": "maciejkula/sbr-sys", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok( sbr::models::ewma::Hyperparameters::new(self.num_items, self.max_sequence_length) .learning_rate(self.learning_rate) .embedding_dim(self.item_embedding_dim) .l2_penalty(self.l2_penalty) .num_epochs(self.num_epochs) ...
code_fim
hard
{ "lang": "rust", "repo": "maciejkula/sbr-sys", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dbalabka/visioncortex path: /src/shape/skeleton.rs use crate::{BinaryImage, MonoImage, MonoImageItem, SampleStat, SampleStatBuilder, Shape}; /// The skeleton of a binary image (aka medial axis) pub struct Skeleton { pub image: BinaryImage, pub stat: SampleStat, } impl Shape { pub f...
code_fim
hard
{ "lang": "rust", "repo": "dbalabka/visioncortex", "path": "/src/shape/skeleton.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // diagonal scanline go towards south east let mut x: i32 = 0; let mut y: i32 = 0; let mut xx = self.width - 1; let mut yy = 0; while x < self.width as i32 && y < self.height as i32 { let mut u = false; let mut span = 0; w...
code_fim
hard
{ "lang": "rust", "repo": "dbalabka/visioncortex", "path": "/src/shape/skeleton.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aws/s2n-tls path: /bindings/rust/s2n-tls/src/callbacks/async_cb.rs // Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. // SPDX-License-Identifier: Apache-2.0 //! Support for asynchronous callbacks. //! //! The general flow for an async callback is: //! 1. The application sets ...
code_fim
hard
{ "lang": "rust", "repo": "aws/s2n-tls", "path": "/bindings/rust/s2n-tls/src/callbacks/async_cb.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pin_project! { // Stores the [`ConnectionFuture`] and associated state. pub(crate) struct AsyncCallback { #[pin] future: OptionalFuture, cleanup: MarkDone, } } impl AsyncCallback { pub(crate) fn poll( self: Pin<&mut Self>, conn: &mut Connection, ...
code_fim
hard
{ "lang": "rust", "repo": "aws/s2n-tls", "path": "/bindings/rust/s2n-tls/src/callbacks/async_cb.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: schedutron/ion-1 path: /src/lib/shell/pipe_exec/mod.rs } { Ok(f) => match output.from { RedirectFrom::Stderr => $job.stderr(f), RedirectFrom::Stdout => $job.stdout(f), RedirectFrom::Both =...
code_fim
hard
{ "lang": "rust", "repo": "schedutron/ion-1", "path": "/src/lib/shell/pipe_exec/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) trait PipelineExecution { /// Given a pipeline, generates commands and executes them. /// /// The `Pipeline` structure contains a vector of `Job`s, and redirections to perform on the /// pipeline. Executing a pipeline involves creating a vector of commands, of which each ///...
code_fim
hard
{ "lang": "rust", "repo": "schedutron/ion-1", "path": "/src/lib/shell/pipe_exec/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(results) } fn wait(&mut self, pgid: u32, commands: Vec<RefinedJob>) -> i32 { // TODO: Find a way to only do this when absolutely necessary. let as_string = commands .iter() .map(RefinedJob::long) .collect::<Vec<String>>() ...
code_fim
hard
{ "lang": "rust", "repo": "schedutron/ion-1", "path": "/src/lib/shell/pipe_exec/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rillian/cubeb-pulse-rs path: /src/backend/context.rs ter_mut()) { *e2 = e1; } Ok(Box::into_raw(coll) as *mut cubeb::DeviceCollection) } pub fn register_device_collection_changed(&mut self, devtype: cubeb::DeviceT...
code_fim
hard
{ "lang": "rust", "repo": "rillian/cubeb-pulse-rs", "path": "/src/backend/context.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> // pub fn pulse_stream_cork(&self, stream: *mut pa_stream, state: CorkState) { unsafe extern "C" fn cork_success(_: *mut pa_stream, _: i32, u: *mut c_void) { let mainloop = u as *mut pa_threaded_mainloop; pa_threaded_mainloop_signal(mainloop, 0); } ...
code_fim
hard
{ "lang": "rust", "repo": "rillian/cubeb-pulse-rs", "path": "/src/backend/context.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> pub fn preferred_channel_layout(&self) -> Result<cubeb::ChannelLayout> { unsafe { pa_threaded_mainloop_lock(self.mainloop); while self.default_sink_info.is_null() { pa_threaded_mainloop_wait(self.mainloop); } pa_threaded_mainloop_...
code_fim
hard
{ "lang": "rust", "repo": "rillian/cubeb-pulse-rs", "path": "/src/backend/context.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> pub fn add(&mut self, info: &StaticHandlerInfo) { assert!( !info.handler_name.is_empty(), "handler name should not be empty" ); self.0 .entry(info.handler_name.to_string()) .and_modify(|handler_hash| { let method_...
code_fim
hard
{ "lang": "rust", "repo": "tfgco/pitaya-rs", "path": "/src/pitaya_core/src/handler.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tfgco/pitaya-rs path: /src/pitaya_core/src/handler.rs use crate::{context, protos, session, Route}; use std::{collections::HashMap, future::Future, pin::Pin}; pub type Method = for<'a> fn( context::Context, Option<session::Session>, &'a protos::Request, ) -> Pin<Box<dyn Future<Outpu...
code_fim
medium
{ "lang": "rust", "repo": "tfgco/pitaya-rs", "path": "/src/pitaya_core/src/handler.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kamranajabbar/ch_03_common_concepts path: /src/print.rs pub fn run(){ // Print to console println!("Hello Kamran"); println!("My Number is {}", 10); //Basic formatting println!("My name is {} and i am from {}.", "Kamran Jabbar", "Pakistan"); <|fim_suffix|> //Named Argume...
code_fim
medium
{ "lang": "rust", "repo": "kamranajabbar/ch_03_common_concepts", "path": "/src/print.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //Positional Arguments println!("{0} is living in {1} city and {0} is working in {2} since {3}", "KJ", "Karachi", "M3tech", "2016"); //Named Arguments println!("{name} is working in {company_name} Since {year}", name="KJ", company_name="M3Technologies", year="2016"); //Placeholder tr...
code_fim
medium
{ "lang": "rust", "repo": "kamranajabbar/ch_03_common_concepts", "path": "/src/print.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use std::cmp::max; impl Solution { pub fn find_max_consecutive_ones(nums: Vec<i32>) -> i32 { let mut res = 0; let mut lastDp = 0; // 递推式只和前一项有关,所以只保留前一项 for v in nums.into_iter() { if v == 1 { lastDp = lastDp + 1; } else { ...
code_fim
medium
{ "lang": "rust", "repo": "aiifabbf/leetcode-memo", "path": "/485.rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aiifabbf/leetcode-memo path: /485.rust/src/main.rs /* .. default-role:: math 给一个全是0和1的array,最长的全1 substring(要连续)的长度是多少 DP最好做。设 ``dp[i]`` 是以第 `i - 1` 个元素结尾的最长的全1 substring的长度。递推式很容易写出来 .. math:: \operatorname{OPT}(i) = \begin{cases} \operatorname{OPT}(i - 1) + 1, & a_{i - 1} = 1 \...
code_fim
hard
{ "lang": "rust", "repo": "aiifabbf/leetcode-memo", "path": "/485.rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let encrypted_data = ecb.encrypt_vec(data.as_slice()); let mut rng = OsRng; let encrypted_aes_key = public_key.encrypt( &mut rng, PaddingScheme::new_oaep::<sha2::Sha256>(), random_aes_key.as_ref(), )?; Ok((encrypted_data, encry...
code_fim
hard
{ "lang": "rust", "repo": "Lrs121/rustfoil", "path": "/src/encryption.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lrs121/rustfoil path: /src/encryption.rs use aes::Aes128; use block_modes::block_padding::ZeroPadding; use block_modes::{BlockMode, Ecb}; use rand::rngs::OsRng; use rand::RngCore; use rsa::{pem, PaddingScheme, PublicKey, RSAPublicKey}; use std::convert::TryFrom; use std::fs::File; use std::io::{...
code_fim
medium
{ "lang": "rust", "repo": "Lrs121/rustfoil", "path": "/src/encryption.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn alloc_id(&self, _: &AllocIDRequest) -> Option<Result<AllocIDResponse>> { let mut resp = AllocIDResponse::new(); resp.set_header(Service::header()); let id = self.id_allocator.fetch_add(1, Ordering::SeqCst); resp.set_id(id as u64); Some(Ok(resp)) } /...
code_fim
hard
{ "lang": "rust", "repo": "skyformat99/tikv", "path": "/tests/pd/mock/mocker/service.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn region_heartbeat(&self, _: &RegionHeartbeatRequest) -> Option<Result<RegionHeartbeatResponse>> { let mut resp = RegionHeartbeatResponse::new(); let header = Service::header(); resp.set_header(header); Some(Ok(resp)) ...
code_fim
hard
{ "lang": "rust", "repo": "skyformat99/tikv", "path": "/tests/pd/mock/mocker/service.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: skyformat99/tikv path: /tests/pd/mock/mocker/service.rs // Copyright 2017 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache...
code_fim
hard
{ "lang": "rust", "repo": "skyformat99/tikv", "path": "/tests/pd/mock/mocker/service.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> layers_metadata: Vec<ImgLayerMetadata>, img_layers_receiver: Receiver<ImgPacket>, samples_sender: Sender<Vec<f32>>, ) -> ImgInterpreter { let layer_handlers = derive_layer_handlers(layers_metadata); ImgInterpreter::new( img_layers_receiver, samples_sender, TEMP_...
code_fim
hard
{ "lang": "rust", "repo": "ajyoon/spectrophoner", "path": "/src/conductor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> thread::Builder::new() .name("StaticImgDispatcher".to_string()) .spawn(move || { img_dispatcher.begin_dispatch(); }) .unwrap(); let mixed_samples_receiver = mixer::mix( interpreter_sample_receivers, (TEMP_HARDCODED_OSC_COUNT as f32) * 0....
code_fim
hard
{ "lang": "rust", "repo": "ajyoon/spectrophoner", "path": "/src/conductor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajyoon/spectrophoner path: /src/conductor.rs use std::cmp::Ordering::*; use std::collections::HashMap; use std::path::Path; use std::sync::mpsc::{channel, Receiver, Sender}; use std::thread; use audio_streamer::AudioStreamer; use portaudio_streamer::PortAudioStreamer; use img_dispatcher::{ ...
code_fim
hard
{ "lang": "rust", "repo": "ajyoon/spectrophoner", "path": "/src/conductor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Spxg/fat32 path: /src/dir.rs use block_device::BlockDevice; use crate::bpb::BIOSParameterBlock; use crate::entry::Entry; use crate::BUFFER_SIZE; use crate::tool::{ is_illegal, sfn_or_lfn, get_count_of_lfn, get_lfn_index, generate_checksum, }; use crate::entry::NameType; use c...
code_fim
hard
{ "lang": "rust", "repo": "Spxg/fat32", "path": "/src/dir.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// To Iterate Dir #[derive(Debug, Copy, Clone)] pub struct DirIter<'a, T> where T: BlockDevice + Clone + Copy, <T as BlockDevice>::Error: core::fmt::Debug { device: T, fat: FAT<T>, bpb: &'a BIOSParameterBlock, offset: usize, sector_offset: usize, index: usize, bu...
code_fim
hard
{ "lang": "rust", "repo": "Spxg/fat32", "path": "/src/dir.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tx.send((vec![200, 237], id,5,cobalt::MessageKind::Ordered)); thread::sleep_ms(20); //Sending all files for filename in pathes{ //Opening file let mut file = File::open(&filename).unwrap(); let mut buf = vec![]...
code_fim
hard
{ "lang": "rust", "repo": "TheHellBox/OpenHMD-Chat-Server", "path": "/src/network/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for x in textures{ let path = x.unwrap().path(); if path.is_file(){ //Checking if format is ok if path.extension().unwrap() == "png" || path.extension().unwrap() == "jpg" || path.extension().unwrap() == "jpeg"{ ...
code_fim
hard
{ "lang": "rust", "repo": "TheHellBox/OpenHMD-Chat-Server", "path": "/src/network/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheHellBox/OpenHMD-Chat-Server path: /src/network/mod.rs pub mod client_params; use std::collections::HashMap; use bytevec::{ByteEncodable, ByteDecodable}; use cobalt; use player; use support; use std::thread; use std::sync::mpsc; use cobalt::{ BinaryRateLimiter, Config, NoopPacketModifier...
code_fim
hard
{ "lang": "rust", "repo": "TheHellBox/OpenHMD-Chat-Server", "path": "/src/network/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use chrono::{FixedOffset, LocalResult, SecondsFormat, TimeZone, Utc}; use crate::{parsers::MessageStream, HeaderValue}; #[test] fn parse_dates() { let inputs = [ ( "Tue, 1 Jul 2003 10:52:37 +0200", "2003-07-01T1...
code_fim
hard
{ "lang": "rust", "repo": "stalwartlabs/mail-parser", "path": "/src/parsers/fields/date.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stalwartlabs/mail-parser path: /src/parsers/fields/date.rs MONTH .get(self.month.saturating_sub(1) as usize) .unwrap_or(&""), self.year, self.hour, self.minute, self.second, if self.tz_before_gm...
code_fim
hard
{ "lang": "rust", "repo": "stalwartlabs/mail-parser", "path": "/src/parsers/fields/date.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }