text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> fn update(&mut self, mut data: StateData<GameData>) -> CustomTrans<'a, 'b> { data.data.update(&data.world); let auth = &mut data.world.fetch_mut::<Dirty<Auth>>(); if !auth.read().valid() { if auth.read().should_validate() { // Start validation ...
code_fim
hard
{ "lang": "rust", "repo": "HoppinWorld/hoppinworldclient", "path": "/src/state/login.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> println!(" Available modes (width x height x bit-depth):"); for mode in monitor.video_modes() { let PhysicalSize { width, height } = mode.size(); let bits = mode.bit_depth(); let m_hz = mode.refresh_rate_millihertz(); println!( " {width}x{height}x{bi...
code_fim
hard
{ "lang": "rust", "repo": "rust-windowing/winit", "path": "/examples/monitor_list.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-windowing/winit path: /examples/monitor_list.rs #![allow(clippy::single_match)] use simple_logger::SimpleLogger; use winit::dpi::{PhysicalPosition, PhysicalSize}; use winit::monitor::MonitorHandle; use winit::{event_loop::EventLoop, window::WindowBuilder}; <|fim_suffix|> println!()...
code_fim
hard
{ "lang": "rust", "repo": "rust-windowing/winit", "path": "/examples/monitor_list.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ulysseB/telamon path: /src/device/argument.rs //! Maps rust types to telamon data types. use crate::ir; use libc; use num::integer::div_rem; use rand::Rng; /// Represents a value that can be used as a `Function` argument. Must ensures the type is a scalar /// and does not contains any reference...
code_fim
hard
{ "lang": "rust", "repo": "ulysseB/telamon", "path": "/src/device/argument.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Represents an array on the device. pub trait ArrayArgument: Send + Sync { // TODO(cc_perf): return a `Cow` instead of a `Vec` to avoid copying when testing // on a local CPU. // TODO(cleanup): use a type parameter instead of casting objects into bytes. For // this we first need rust/is...
code_fim
hard
{ "lang": "rust", "repo": "ulysseB/telamon", "path": "/src/device/argument.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yaahc/coepi-backend-rust path: /server/src/storage.rs use super::{ReportTimestamp, SignedReport}; use eyre::ErrReport; <|fim_suffix|>pub(crate) fn get(timeframe: ReportTimestamp) -> Result<Vec<u8>, ErrReport> { unimplemented!(); }<|fim_middle|>pub(crate) fn save(report: SignedReport) -> Res...
code_fim
medium
{ "lang": "rust", "repo": "yaahc/coepi-backend-rust", "path": "/server/src/storage.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) fn get(timeframe: ReportTimestamp) -> Result<Vec<u8>, ErrReport> { unimplemented!(); }<|fim_prefix|>// repo: yaahc/coepi-backend-rust path: /server/src/storage.rs use super::{ReportTimestamp, SignedReport}; use eyre::ErrReport; <|fim_middle|>pub(crate) fn save(report: SignedReport) -> Res...
code_fim
medium
{ "lang": "rust", "repo": "yaahc/coepi-backend-rust", "path": "/server/src/storage.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let archived_id = query(&format!( "INSERT INTO {}(user_id, url, title) values(?, ?, ?);", ARCHIVED_LINKS_TABLE )) .bind(article_data.user_id) .bind(article_data.url.to_string()) ...
code_fim
hard
{ "lang": "rust", "repo": "kgusakov/save2read", "path": "/src/storage.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kgusakov/save2read path: /src/storage.rs use anyhow::{Context, Result}; use sqlx::sqlite::Sqlite; use sqlx::Row; use sqlx::{query, Pool}; use url::Url; pub static PENDING_LINKS_TABLE: &str = "pending_links"; pub static ARCHIVED_LINKS_TABLE: &str = "archived_links"; pub struct Storage { poo...
code_fim
hard
{ "lang": "rust", "repo": "kgusakov/save2read", "path": "/src/storage.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match rows.first() { Some(u) => Ok(Some(ArticleData { user_id: u .try_get("user_id") .with_context(|| format!("Can't get field user_id from db"))?, url: u .try_get("url") .wi...
code_fim
hard
{ "lang": "rust", "repo": "kgusakov/save2read", "path": "/src/storage.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let class = "shaded"; let targeted_ids = ["shade", "today"]; for id in &targeted_ids { if let Some(element) = utils::document().get_element_by_id(id) { let class_list = element.class_list(); if class_list.contains(class) { ...
code_fim
hard
{ "lang": "rust", "repo": "YaxinCheng/WAtherSM", "path": "/src/model.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn display_weather(&mut self, title: String, weather: LocationWeather) -> bool { let window = utils::window(); let portrait = match (window.inner_height(), window.inner_width()) { (Ok(height), Ok(width)) => { height.as_f64().unwrap_or_default() > width.as_f6...
code_fim
hard
{ "lang": "rust", "repo": "YaxinCheng/WAtherSM", "path": "/src/model.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: YaxinCheng/WAtherSM path: /src/model.rs use crate::api::locations::Storage; use crate::api::{LocationWeather, WeatherAPI}; use crate::views::{View, WeatherBoard}; use anyhow::Error; use wasm_bindgen::JsCast; use web_sys::HtmlMediaElement; use yew::format::Json; use yew::services::console::Consol...
code_fim
hard
{ "lang": "rust", "repo": "YaxinCheng/WAtherSM", "path": "/src/model.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gre/gre path: /plots/examples/807/main.rs routes_above.push(route); } else { routes_below.push(route); } } route = vec![c, p]; } else { route.push(p); } prev = p; } if route.len()...
code_fim
hard
{ "lang": "rust", "repo": "gre/gre", "path": "/plots/examples/807/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> base_y -= yincr; } } // calculate a moving average let smooth = 40; let sf = smooth as f64; let mut sum = 0.0; let mut acc = Vec::new(); let mut smooth_heights: Vec<(f64, f64, f64)> = Vec::new(); for (i, h) in height_map.iter().enumerate() { if acc.len() == smooth { le...
code_fim
hard
{ "lang": "rust", "repo": "gre/gre", "path": "/plots/examples/807/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if route.len() > min_route { routes.push((1, route)); } base_y -= yincr; } } // calculate a moving average let smooth = 40; let sf = smooth as f64; let mut sum = 0.0; let mut acc = Vec::new(); let mut smooth_heights: Vec<(f64, f64, f64)> = Vec::new(); for (i...
code_fim
hard
{ "lang": "rust", "repo": "gre/gre", "path": "/plots/examples/807/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let dir = project_dir(); let path = path.strip_prefix(&dir).unwrap_or_else(|_| path); if expected.trim() == actual.trim() { println!("whitespace difference, rewriting"); println!("file: {}\n", path.display()); file::put_text(path, actual).unwrap(); return; }...
code_fim
hard
{ "lang": "rust", "repo": "borela-forks/libsyntax2", "path": "/tests/testutils/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: borela-forks/libsyntax2 path: /tests/testutils/src/lib.rs extern crate difference; extern crate file; use std::path::{Path, PathBuf}; use std::fs::read_dir; use difference::Changeset; /// Read file and normalize newlines. /// /// `rustc` seems to always normalize `\r\n` newlines to `\n`: /// ...
code_fim
hard
{ "lang": "rust", "repo": "borela-forks/libsyntax2", "path": "/tests/testutils/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn Send(&self,url:&str){ //TODO ちゃんと真面目なコードを書くこと let json = serde_json::to_vec(&self).unwrap(); let mut stream = TcpStream::connect(&url).unwrap(); stream.write(&json).unwrap(); stream.flush().unwrap(); } fn Receive(url:&str)->Option<Command>{ /...
code_fim
hard
{ "lang": "rust", "repo": "tnctinfossl/glcommand", "path": "/src/commands.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tnctinfossl/glcommand path: /src/commands.rs #[macro_use] use serde_derive::{Deserialize,Serialize}; use std::net::{TcpListener,TcpStream}; use std::io::{Write,Result,Error}; use serde_json; #[derive(Debug,Serialize, Deserialize)] pub enum Direction{ RightToLeft, LeftToRight, } #[deri...
code_fim
hard
{ "lang": "rust", "repo": "tnctinfossl/glcommand", "path": "/src/commands.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Command { fn Send(&self,url:&str){ //TODO ちゃんと真面目なコードを書くこと let json = serde_json::to_vec(&self).unwrap(); let mut stream = TcpStream::connect(&url).unwrap(); stream.write(&json).unwrap(); stream.flush().unwrap(); } fn Receive(url:&str)->Option<Com...
code_fim
hard
{ "lang": "rust", "repo": "tnctinfossl/glcommand", "path": "/src/commands.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: forkkit/olin path: /cwa/olin/src/bin/shaman.rs #![no_main] extern crate olin; use std::io::Write; #[no_mangle] pub extern "C" fn cwa_main() -> i32 { olin::panic::set_hook(); <|fim_suffix|> out.write(bytes) .map_err(|e| { olin::log::error(&format!("can't write to st...
code_fim
medium
{ "lang": "rust", "repo": "forkkit/olin", "path": "/cwa/olin/src/bin/shaman.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> out.write(bytes) .map_err(|e| { olin::log::error(&format!("can't write to stdout: {:?}", e)); 1 }).unwrap(); 0 }<|fim_prefix|>// repo: forkkit/olin path: /cwa/olin/src/bin/shaman.rs #![no_main] extern crate olin; use std::io::Write; #[no_mangle] pub ext...
code_fim
medium
{ "lang": "rust", "repo": "forkkit/olin", "path": "/cwa/olin/src/bin/shaman.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Creates a test context and spawns the fake entity resolver. async fn test_context() -> Result<Vec<ContextEntity>, Error> { let (entity_resolver, request_stream) = fidl::endpoints::create_proxy_and_stream::<EntityResolverMarker>().unwrap(); let mut fake_entity_resolve...
code_fim
hard
{ "lang": "rust", "repo": "winksaville/fuchsia", "path": "/src/stories/bin/discovermgr/src/suggestion_providers/contextual_suggestions_provider.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: winksaville/fuchsia path: /src/stories/bin/discovermgr/src/suggestion_providers/contextual_suggestions_provider.rs // Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { crate:...
code_fim
hard
{ "lang": "rust", "repo": "winksaville/fuchsia", "path": "/src/stories/bin/discovermgr/src/suggestion_providers/contextual_suggestions_provider.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: datastark/interbtc path: /crates/relay/src/types.rs use codec::{Decode, Encode}; use sp_std::fmt::Debug; <|fim_suffix|>/// Bonded participant which can suggest and vote on proposals. #[derive(Encode, Decode, Default, Clone, PartialEq, Debug)] pub struct StakedRelayer<Balance, BlockNumber> { ...
code_fim
medium
{ "lang": "rust", "repo": "datastark/interbtc", "path": "/crates/relay/src/types.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Bonded participant which can suggest and vote on proposals. #[derive(Encode, Decode, Default, Clone, PartialEq, Debug)] pub struct StakedRelayer<Balance, BlockNumber> { // total stake for this participant pub stake: Balance, // the height at which the participant bonded pub height: Blo...
code_fim
medium
{ "lang": "rust", "repo": "datastark/interbtc", "path": "/crates/relay/src/types.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Material::Lambertian { albedo: Vec3::new(0.8, 0.8, 0.0)} } } pub fn scatter(material: &Material, ray_in: &Ray, hit: & HitRecord, attenuation: &mut Vec3, scattered: &mut Ray) -> bool { match material { &Material::Lambertian {ref albedo} => { let target = hit.p + hit.nor...
code_fim
medium
{ "lang": "rust", "repo": "marcclintdion/raytracing-rs", "path": "/src/material.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marcclintdion/raytracing-rs path: /src/material.rs use ray::Ray; use vec3::Vec3; use hittable::HitRecord; use rand; use rand::Rng; use vec3; #[derive(Copy, Clone)] pub enum Material { Lambertian {albedo: Vec3}, Metal {albedo: Vec3, fuzz: f32}, // Dielectrinc {} } impl Default for Ma...
code_fim
medium
{ "lang": "rust", "repo": "marcclintdion/raytracing-rs", "path": "/src/material.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aticu/quantumc path: /src/file_handle.rs //! This module is supposed to abstract file handling from other modules. use std::fmt; use std::fs::File; use std::io::Error; use std::io::prelude::*; /// The file handle represents a file within the compiler. #[derive(PartialEq, Eq)] pub struct FileHa...
code_fim
hard
{ "lang": "rust", "repo": "aticu/quantumc", "path": "/src/file_handle.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl fmt::Debug for FileHandle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.debug_struct("FileHandle") .field("path", &self.path) .finish() } }<|fim_prefix|>// repo: aticu/quantumc path: /src/file_handle.rs //! This module is supposed to abstract file...
code_fim
hard
{ "lang": "rust", "repo": "aticu/quantumc", "path": "/src/file_handle.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Creates a new file handle with a fake file for testing purposes. #[cfg(test)] pub fn test_new(path: String, content: String) -> FileHandle { FileHandle { path, content } } } impl fmt::Debug for FileHandle { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.d...
code_fim
hard
{ "lang": "rust", "repo": "aticu/quantumc", "path": "/src/file_handle.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: racer-rust/racer path: /test_project/test_fixtures/src/lib.rs //! This is a test project for racer. //! //! # Example: //! Basic Usage. //! //! ``` //! extern crate fixtures; //! use fixtures::foo; //! fn main { //! println!("Racer") //! } //! ``` //! //! ## Notes: //! - We should check race...
code_fim
easy
{ "lang": "rust", "repo": "racer-rust/racer", "path": "/test_project/test_fixtures/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use test_crate2::useless_func; pub type UsizeVec = Vec<usize>;<|fim_prefix|>// repo: racer-rust/racer path: /test_project/test_fixtures/src/lib.rs //! This is a test project for racer. //! //! # Example: //! Basic Usage. //! //! ``` //! extern crate fixtures; //! use fixtures::foo; //! fn main { //!...
code_fim
easy
{ "lang": "rust", "repo": "racer-rust/racer", "path": "/test_project/test_fixtures/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // MAXIMUM_NUMBER = 21; // this statement cause an error }<|fim_prefix|>// repo: ManishVerma16/Rust_Learning path: /rust_basics/src/constants.rs // contants are the variable that are declared in global socpe and cannot be changed. // constants are declared with all letter in Uppercase and spacing is ...
code_fim
medium
{ "lang": "rust", "repo": "ManishVerma16/Rust_Learning", "path": "/rust_basics/src/constants.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ManishVerma16/Rust_Learning path: /rust_basics/src/constants.rs // contants are the variable that are declared in global socpe and cannot be changed. // constants are declared with all letter in Uppercase and spacing is signified by undersocres then the data type of constant variable <|fim_suff...
code_fim
easy
{ "lang": "rust", "repo": "ManishVerma16/Rust_Learning", "path": "/rust_basics/src/constants.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>{ let b = config::Config::parse("/etc/fstab"); println!("{:?}",b); }<|fim_prefix|>// repo: blackjack/bb path: /src/main.rs extern crate toml; extern crate rustc_serialize; <|fim_middle|>mod config; fn main()
code_fim
easy
{ "lang": "rust", "repo": "blackjack/bb", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: blackjack/bb path: /src/main.rs extern crate toml; extern crate rustc_serialize; <|fim_suffix|>{ let b = config::Config::parse("/etc/fstab"); println!("{:?}",b); }<|fim_middle|>mod config; fn main()
code_fim
easy
{ "lang": "rust", "repo": "blackjack/bb", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yangfengzzz/box2d-rs path: /src/private/collision/b2_collide_edge.rs use crate::b2_collision::*; use crate::b2_math::*; use crate::b2_settings::*; use crate::shapes::b2_circle_shape::*; use crate::shapes::b2_edge_shape::*; use crate::shapes::b2_polygon_shape::*; // Compute contact points for ed...
code_fim
hard
{ "lang": "rust", "repo": "yangfengzzz/box2d-rs", "path": "/src/private/collision/b2_collide_edge.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let radius: f32 = polygon_b.base.m_radius + edge_a.base.m_radius; let edge_axis: B2epaxis = b2_compute_edge_separation(temp_polygon_b, v1, normal1); if edge_axis.separation > radius { return; } let polygon_axis: B2epaxis = b2_compute_polygon_separation(temp_polygon_b, v1, v2); if polygon_axis.se...
code_fim
hard
{ "lang": "rust", "repo": "yangfengzzz/box2d-rs", "path": "/src/private/collision/b2_collide_edge.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rf.i1 = 0; rf.i2 = 1; rf.v1 = v1; rf.v2 = v2; rf.normal = primary_axis.normal; rf.side_normal1 = -edge1; rf.side_normal2 = edge1; } else { manifold.manifold_type = B2manifoldType::EFaceB; clip_points[0].v = v2; clip_points[0].id.cf.index_a = 1; clip_points[0].id.cf.index_b = primar...
code_fim
hard
{ "lang": "rust", "repo": "yangfengzzz/box2d-rs", "path": "/src/private/collision/b2_collide_edge.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rtialEq)] pub struct Inner { } }<|fim_prefix|>// repo: overvenus/prost path: /tests/packages/gizmo/factory.rs #[derive(Debug, Message, PartialEq)] pub<|fim_middle|> struct GizmoFactory { } pub mod gizmo_factory { #[derive(Debug, Message, Pa
code_fim
medium
{ "lang": "rust", "repo": "overvenus/prost", "path": "/tests/packages/gizmo/factory.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: overvenus/prost path: /tests/packages/gizmo/factory.rs #[derive(Debug, Message, PartialEq)] pub struct GizmoFactory { } pub mod gizmo_f<|fim_suffix|>rtialEq)] pub struct Inner { } }<|fim_middle|>actory { #[derive(Debug, Message, Pa
code_fim
easy
{ "lang": "rust", "repo": "overvenus/prost", "path": "/tests/packages/gizmo/factory.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Add types w.insert(String::from("int"), String::from("int")); w.insert(String::from("bool"), String::from("bool")); w.insert(String::from("string"), String::from("string")); Reserved { words: w } } }<|fim_prefix|>// repo: cjkenn/tank pat...
code_fim
hard
{ "lang": "rust", "repo": "cjkenn/tank", "path": "/src/syntax/reserved.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cjkenn/tank path: /src/syntax/reserved.rs use std::collections::HashMap; #[derive(Debug)] pub struct Reserved { pub words: HashMap<String, String> } <|fim_suffix|> // Add types w.insert(String::from("int"), String::from("int")); w.insert(String::from("bool"), String:...
code_fim
hard
{ "lang": "rust", "repo": "cjkenn/tank", "path": "/src/syntax/reserved.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexcrichton/cfg-specialize path: /cfg-specialize-macros/src/lib.rs extern crate proc_macro; use proc_macro2::{Delimiter, Ident, Span, TokenStream, TokenTree}; use quote::ToTokens; use quote::{quote, quote_spanned}; use syn::fold::Fold; use syn::*; #[proc_macro_attribute] pub fn cfg_specialize...
code_fim
hard
{ "lang": "rust", "repo": "alexcrichton/cfg-specialize", "path": "/cfg-specialize-macros/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for item in self.0 { item.to_tokens(tokens); } } } struct FulfillFeature<'a>(&'a str); impl<'a> Fold for FulfillFeature<'a> { fn fold_macro(&mut self, mut mac: Macro) -> Macro { if mac.path.leading_colon.is_some() { return mac; } if...
code_fim
hard
{ "lang": "rust", "repo": "alexcrichton/cfg-specialize", "path": "/cfg-specialize-macros/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// A struct with two fields struct Point { x: f32, y: f32, } // Structs can be reused as fields of another struct #[allow(dead_code)] struct Rectangle { p1: Point, p2: Point, }<|fim_prefix|>// repo: skreimeyer/rustbuddy path: /rust/cases/sample_struct.rs struct Person<'a> { name: &'a...
code_fim
easy
{ "lang": "rust", "repo": "skreimeyer/rustbuddy", "path": "/rust/cases/sample_struct.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: skreimeyer/rustbuddy path: /rust/cases/sample_struct.rs struct Person<'a> { name: &'a str, age: u8, } <|fim_suffix|>// A tuple struct struct Pair(i32, f32); // A struct with two fields struct Point { x: f32, y: f32, } // Structs can be reused as fields of another struct #[allo...
code_fim
easy
{ "lang": "rust", "repo": "skreimeyer/rustbuddy", "path": "/rust/cases/sample_struct.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>// A tuple struct struct Pair(i32, f32); // A struct with two fields struct Point { x: f32, y: f32, } // Structs can be reused as fields of another struct #[allow(dead_code)] struct Rectangle { p1: Point, p2: Point, }<|fim_prefix|>// repo: skreimeyer/rustbuddy path: /rust/cases/sample_s...
code_fim
easy
{ "lang": "rust", "repo": "skreimeyer/rustbuddy", "path": "/rust/cases/sample_struct.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: plaflamme/pico-temp path: /src/gpio.rs use core::marker::PhantomData; use rp2040_pac::generic::{Reg, ResetValue, Writable}; pub struct Pin<F> { pin: u8, _func: PhantomData<F>, } pub struct Unspecified; pub struct Sio<IO> { _io: PhantomData<IO>, } pub struct Input<M> { _mode: Ph...
code_fim
hard
{ "lang": "rust", "repo": "plaflamme/pico-temp", "path": "/src/gpio.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn pull_up(self) -> Pin<Sio<Input<PullUp>>> { self.pad_reg().write(|w| { w.pue(); w }); Pin { pin: self.pin, _func: PhantomData, } } pub fn pull_down(self) -> Pin<Sio<Input<PullDown>>> { self.pad_reg()...
code_fim
hard
{ "lang": "rust", "repo": "plaflamme/pico-temp", "path": "/src/gpio.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Pin<Sio<Output>> { pub fn set(&self) { self.out_set(); } pub fn clr(&self) { self.out_clr(); } } impl<M> Pin<Sio<Input<M>>> { pub fn schmitt_trigger(self) -> Pin<Sio<Input<SchmittTrigger>>> { self.pad_reg().write(|w| { w.schmitt(); ...
code_fim
hard
{ "lang": "rust", "repo": "plaflamme/pico-temp", "path": "/src/gpio.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jre2/prescience path: /src/main.rs #![feature(associated_consts)] #![feature(collections)] #![feature(custom_derive)] #![feature(enumset)] #![feature(iter_arith)] #![feature(libc)] #![feature(unboxed_closures)] extern crate collections; #[macro_use] extern crate itertools; extern crate time; ex...
code_fim
hard
{ "lang": "rust", "repo": "jre2/prescience", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!( "# effects {}", st.effects.effects.len() ); st.effects.defrag(); println!( "# effects {}", st.effects.effects.len() ); println!( "{:?}", st.effects.effects ); } fn main() { let mut st = State::mk_test( 2, 4, 1.5 ); st.render(); st.do_turn(); st.render(); let ...
code_fim
medium
{ "lang": "rust", "repo": "jre2/prescience", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pingw33n/remark path: /log/src/util/atomic.rs // copied from syncbox // TODO remove when std::sync::atomic::AtomicU64 is stable. pub use inner::*; #[cfg(target_pointer_width = "64")] mod inner { use std::sync::atomic::{AtomicUsize, Ordering}; pub struct AtomicU64 { v: AtomicUs...
code_fim
hard
{ "lang": "rust", "repo": "pingw33n/remark", "path": "/log/src/util/atomic.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] pub fn compare_and_swap(&self, old: u64, new: u64, order: Ordering) -> u64 { let mut lock = self.v.lock(); let prev = *lock; if prev != old { return prev; } *lock = new; prev } ...
code_fim
hard
{ "lang": "rust", "repo": "pingw33n/remark", "path": "/log/src/util/atomic.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TianTianForever/Rust-Tutorial path: /nine_days_of_rust/lifetimes.rs // fn take_word(s: &String) -> &str { } //it can only use 'String' type. <|fim_suffix|>// This function 'first_word' have a BUG !!! pub fn first_word<'a>(s: &'a String) -> usize { let bytes = s.as_bytes(); for (i, &it...
code_fim
hard
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/nine_days_of_rust/lifetimes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// This function 'first_word' have a BUG !!! pub fn first_word<'a>(s: &'a String) -> usize { let bytes = s.as_bytes(); for (i, &item) in bytes.iter().enumerate() { if item == b' ' { return i; } } s.len() }<|fim_prefix|>// repo: TianTianForever/Rust-Tutorial pat...
code_fim
hard
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/nine_days_of_rust/lifetimes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RReverser/rust path: /src/librustc_incremental/persist/preds.rs // Copyright 2012-2015 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-AP...
code_fim
hard
{ "lang": "rust", "repo": "RReverser/rust", "path": "/src/librustc_incremental/persist/preds.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> g.add_edge(NodeIndex(3), NodeIndex(0), ()); g.add_edge(NodeIndex(4), NodeIndex(3), ()); g.add_edge(NodeIndex(7), NodeIndex(4), ()); g.add_edge(NodeIndex(5), NodeIndex(3), ()); g.add_edge(NodeIndex(7), NodeIndex(5), ()); g.add_edge(NodeIndex(8), NodeIndex(5), ()); g.add_edge(Nod...
code_fim
hard
{ "lang": "rust", "repo": "RReverser/rust", "path": "/src/librustc_incremental/persist/preds.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl NodeIndexSet { fn new(total_node_count: usize) -> NodeIndexSet { NodeIndexSet { bitset: BitVector::new(total_node_count), nodes: Vec::new(), } } #[inline] fn clear(&mut self) { self.bitset.clear(); self.nodes.clear(); } ...
code_fim
hard
{ "lang": "rust", "repo": "RReverser/rust", "path": "/src/librustc_incremental/persist/preds.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> write![f, [dotdotdot_token.format(), pattern.format()]] } }<|fim_prefix|>// repo: rome/tools path: /crates/rome_js_formatter/src/js/bindings/array_binding_pattern_rest_element.rs use crate::prelude::*; use rome_formatter::write; use rome_js_syntax::JsArrayBindingPatternRestElement; use rome_...
code_fim
hard
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_js_formatter/src/js/bindings/array_binding_pattern_rest_element.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rome/tools path: /crates/rome_js_formatter/src/js/bindings/array_binding_pattern_rest_element.rs use crate::prelude::*; use rome_formatter::write; use rome_js_syntax::JsArrayBindingPatternRestElement; use rome_js_syntax::JsArrayBindingPatternRestElementFields; #[derive(Debug, Clone, Default)] ...
code_fim
hard
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_js_formatter/src/js/bindings/array_binding_pattern_rest_element.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sonald/redis-cli-rs path: /src/redis.rs use std::fmt; use std::error::Error; use bytes::Bytes; #[derive(Debug)] pub enum RedisValue { Str(String), Bulk(String), Array(Vec<RedisValue>), Int(i64), Nil, Error(String), } impl fmt::Display for RedisValue { fn fmt(&self, ...
code_fim
hard
{ "lang": "rust", "repo": "sonald/redis-cli-rs", "path": "/src/redis.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let r = RedisValue::Nil; assert_eq!(&r.to_wire().expect(""), b"$-1\r\n"); } #[test] fn test_to_wire_str() { let r = RedisValue::Str("hello".to_string()); assert_eq!(&r.to_wire().expect(""), b"+hello\r\n"); } #[test] fn test_to_wire_bulk() { l...
code_fim
hard
{ "lang": "rust", "repo": "sonald/redis-cli-rs", "path": "/src/redis.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> take_owenership(s3); // s3 already invalid makes_copy(x); println!("still valid x: {}", x); } fn take_owenership(some_string: String) { println!("some_string: {}", some_string); } fn makes_copy(some_int: i32) { println!("some_int: {}", some_int); }<|fim_prefix|>// repo: maasdi/i...
code_fim
hard
{ "lang": "rust", "repo": "maasdi/intorust", "path": "/ownership/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maasdi/intorust path: /ownership/src/main.rs fn main() { let s1 = String::from("hello"); let s2 = s1; println!("The value of s2 is {}", s2); // s1 already invalid let s3 = s2.clone(); println!("Ts2: {}, s3: {}", s2, s3); let x = 5; let y = x; println!("x: {...
code_fim
medium
{ "lang": "rust", "repo": "maasdi/intorust", "path": "/ownership/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn take_owenership(some_string: String) { println!("some_string: {}", some_string); } fn makes_copy(some_int: i32) { println!("some_int: {}", some_int); }<|fim_prefix|>// repo: maasdi/intorust path: /ownership/src/main.rs fn main() { let s1 = String::from("hello"); let s2 = s1; prin...
code_fim
medium
{ "lang": "rust", "repo": "maasdi/intorust", "path": "/ownership/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> !self.eq(other) } } struct Codebook(HashMap<char, Vec<Bit>>); impl HuffmanNode { pub fn codebook(&self) -> Codebook { let mut codes = HashMap::new(); fn traversal(codes: &mut HashMap<char, Vec<Bit>>, item: &Box<Option<HuffmanNode>>, code: Vec<Bit>) {...
code_fim
hard
{ "lang": "rust", "repo": "zackmdavis/Standard_Algorithms", "path": "/huffman_coding.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zackmdavis/Standard_Algorithms path: /huffman_coding.rs // somewhat literal-minded port of the code demonstrated in // http://zackmdavis.net/blog/2013/06/huffman/ use std::cmp::Ordering; use std::collections::{BinaryHeap, HashMap}; type Bit = bool; const ZERO: Bit = false; const ONE: Bit = tr...
code_fim
hard
{ "lang": "rust", "repo": "zackmdavis/Standard_Algorithms", "path": "/huffman_coding.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut ciphertext = Vec::new(); for character in plaintext.chars() { let codeword = &self.0[&character]; ciphertext.extend_from_slice(codeword); } ciphertext } } fn main() { let mut frequencies = HashMap::new(); let frequency_data = vec...
code_fim
hard
{ "lang": "rust", "repo": "zackmdavis/Standard_Algorithms", "path": "/huffman_coding.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>se grammar::Grammar; pub use symbol::Symbol;<|fim_prefix|>// repo: GDGVIT/Code-Reviewer path: /whiplash/src/grammar/mod.rs pub mod grammar; pub mod production; pub mo<|fim_middle|>d reader; pub mod errors; pub mod symbol; pub mod first_set; pub mod follow_set; pub u
code_fim
medium
{ "lang": "rust", "repo": "GDGVIT/Code-Reviewer", "path": "/whiplash/src/grammar/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GDGVIT/Code-Reviewer path: /whiplash/src/grammar/mod.rs pub mod grammar; pub mod production; pub mod reader; pub mod errors; pub mod symbol; pu<|fim_suffix|>se grammar::Grammar; pub use symbol::Symbol;<|fim_middle|>b mod first_set; pub mod follow_set; pub u
code_fim
easy
{ "lang": "rust", "repo": "GDGVIT/Code-Reviewer", "path": "/whiplash/src/grammar/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Opts { pub fn propagate_verbose(mut self) -> Self { if self.verbose == 0 { return self; } match self.command { Command::Update(ref mut c) => c.verbose = true, Command::Txt(ref mut c) => c.verbose = true, Command::Clear(ref mu...
code_fim
hard
{ "lang": "rust", "repo": "matsadler/quack", "path": "/src/opts.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matsadler/quack path: /src/opts.rs use duck_dns::{Label, Token}; use structopt::StructOpt; use crate::commands::{check_ip::CheckIp, clear::Clear, txt::Txt, update::Update}; #[derive(StructOpt, Debug)] pub struct Opts { /// Silence all output #[structopt(short = "q", long = "quiet", con...
code_fim
hard
{ "lang": "rust", "repo": "matsadler/quack", "path": "/src/opts.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self::new(value.domain, value.token) } } impl Opts { pub fn propagate_verbose(mut self) -> Self { if self.verbose == 0 { return self; } match self.command { Command::Update(ref mut c) => c.verbose = true, Command::Txt(ref mut c) ...
code_fim
hard
{ "lang": "rust", "repo": "matsadler/quack", "path": "/src/opts.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sundowns/gameoff-2019 path: /src/components/leap.rs use amethyst::core::math::{Point2, Vector3}; pub struct Leap { pub is_leaping: bool, pub leap_ready: bool, pub range: f32, pub target: Option<Point2<f32>>, pub velocity: Vector3<f32>, } <|fim_suffix|>impl Leap { pub fn new(range: ...
code_fim
hard
{ "lang": "rust", "repo": "sundowns/gameoff-2019", "path": "/src/components/leap.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Leap { pub fn new(range: f32) -> Leap { Leap { is_leaping: false, leap_ready: true, range: range, target: None, velocity: Vector3::new(0.0, 0.0, 0.0), } } }<|fim_prefix|>// repo: sundowns/gameoff-2019 path: /src/components/leap.rs use amethyst::core::math::{...
code_fim
medium
{ "lang": "rust", "repo": "sundowns/gameoff-2019", "path": "/src/components/leap.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn _update_text_field_by_index(&mut self, index: usize, new_text: String) { self.text_fields[index].update_text(new_text); } pub fn _set_textfield_name(&mut self, name: &String, new_name: &String) { for text in &mut self.text_fields { if text.name_matches(name) { text._s...
code_fim
hard
{ "lang": "rust", "repo": "lilith645/DelinquentFood", "path": "/src/modules/system_interface/widget.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn _duplicate_button(&mut self, button_to_duplicate: &String, new_button_name: &String) { for i in 0..self.buttons.len() { if self.buttons[i].name_matches(button_to_duplicate) { let mut button = self.buttons[i].clone(); button._set_name(new_button_name); self.button...
code_fim
hard
{ "lang": "rust", "repo": "lilith645/DelinquentFood", "path": "/src/modules/system_interface/widget.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lilith645/DelinquentFood path: /src/modules/system_interface/widget.rs Widget { let pos = (self.position-self.size*0.5) + relative_position; self.selections.push(Selection::_new_upwards(pos, option_size, relative_text_position, text_size, ...
code_fim
hard
{ "lang": "rust", "repo": "lilith645/DelinquentFood", "path": "/src/modules/system_interface/widget.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.context .verify_ecdsa(&message, &normalized_signature, verifying_key) .is_ok() } } /// This implementation initializes a `libsecp256k1` context once on the first call to /// `to_verifying_key` if it was not initialized previously. impl SigningKey<Es256k> for Secre...
code_fim
hard
{ "lang": "rust", "repo": "slowli/jwt-compact", "path": "/src/alg/es256k.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: slowli/jwt-compact path: /src/alg/es256k.rs //! `ES256K` algorithm implementation using the `secp256k1` crate. use lazy_static::lazy_static; use secp256k1::{ constants::{ COMPACT_SIGNATURE_SIZE, FIELD_SIZE, SECRET_KEY_SIZE, UNCOMPRESSED_PUBLIC_KEY_SIZE, }, ecdsa::Signature, ...
code_fim
hard
{ "lang": "rust", "repo": "slowli/jwt-compact", "path": "/src/alg/es256k.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(update) = e.update_args() { let bubbs = &mut bubbles; for bubble in bubbs { bubble.y -= bubble.speed * update.dt; if bubble.y + bubble.radius <= 0.0 { bubble.y = HEIGHT + bubble.radius } } } } }<|fim_prefix|>// repo: rajraj/rust-lea...
code_fim
hard
{ "lang": "rust", "repo": "rajraj/rust-learning", "path": "/rust_lamp/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for bubble in bubbs { ellipse( bubble_color, [ bubble.x - bubble.radius, bubble.y - bubble.radius, bubble.radius * 2.0, bubble.radius * 2.0, ], context.transform, graphics,...
code_fim
hard
{ "lang": "rust", "repo": "rajraj/rust-learning", "path": "/rust_lamp/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rajraj/rust-learning path: /rust_lamp/src/main.rs use piston_window::*; use rand::*; const HEIGHT: f64 = 720.0; const WIDTH: f64 = 1280.0; struct Bubble { speed: f64, radius: f64, x: f64, y: f64, } impl Bubble { pub fn new(num: Option<f64>) -> Bubble { let radius = (random::<f64...
code_fim
hard
{ "lang": "rust", "repo": "rajraj/rust-learning", "path": "/rust_lamp/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: U007D/minesweeper path: /src/view/unit_tests/stdin_mock.rs use std::{ io::{ BufRead, Error as IoError, Read, }, }; use crate::StdResult; #[derive(Clone, Debug, Eq, PartialEq)] pub struct StdInMock { strings: Vec<String>, row_idx: Option<usize>, row_l...
code_fim
hard
{ "lang": "rust", "repo": "U007D/minesweeper", "path": "/src/view/unit_tests/stdin_mock.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl BufRead for StdInMock { fn fill_buf(&mut self) -> StdResult<&[u8], IoError> { // *1 - no out-of-bounds indexing ∵ `self.col` is match guarded to be < `self.row_len` // *2 - no out-of-bounds indexing ∵ `i` is bounded by a `checked_add()` and `and_then()` bounds check // see...
code_fim
hard
{ "lang": "rust", "repo": "U007D/minesweeper", "path": "/src/view/unit_tests/stdin_mock.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn deref(&self) -> &Self::Target { &self.file } } impl AsRef<Path> for ManifestPath { fn as_ref(&self) -> &Path { self.file.as_ref() } }<|fim_prefix|>// repo: rust-lang/rust-analyzer path: /crates/project-model/src/manifest_path.rs //! See [`ManifestPath`]. use std::{fmt,...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust-analyzer", "path": "/crates/project-model/src/manifest_path.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl ops::Deref for ManifestPath { type Target = AbsPath; fn deref(&self) -> &Self::Target { &self.file } } impl AsRef<Path> for ManifestPath { fn as_ref(&self) -> &Path { self.file.as_ref() } }<|fim_prefix|>// repo: rust-lang/rust-analyzer path: /crates/project-mode...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust-analyzer", "path": "/crates/project-model/src/manifest_path.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rust-analyzer path: /crates/project-model/src/manifest_path.rs //! See [`ManifestPath`]. use std::{fmt, ops, path::Path}; use paths::{AbsPath, AbsPathBuf}; /// More or less [`AbsPathBuf`] with non-None parent. /// /// We use it to store path to Cargo.toml, as we frequently use the pa...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust-analyzer", "path": "/crates/project-model/src/manifest_path.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let instr_info = format!( "PC: {:#06x} | Opcode: {:#04x} | Instruction: {}", instr.addr, instr.opcode, instr.description ); if instr.is_prefixed { println!("{} (Prefixed)", instr_info); } else { println!("{}", instr_info); ...
code_fim
hard
{ "lang": "rust", "repo": "DiscoBiscuit99/DiscoGB", "path": "/src/gameboy/cpu/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DiscoBiscuit99/DiscoGB path: /src/gameboy/cpu/mod.rs use std::sync::{Arc, RwLock}; use super::memory::Memory; mod instructions; use instructions::*; mod registers; use registers::Registers; /// Represents the CPU of the GameBoy. #[derive(Debug, Clone)] pub struct Cpu { /// The program co...
code_fim
hard
{ "lang": "rust", "repo": "DiscoBiscuit99/DiscoGB", "path": "/src/gameboy/cpu/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns a byte from the memory at the address of the program counter. pub fn next_byte(&mut self) -> u8 { let byte = self.mem.try_read().unwrap().read_byte(self.pc); self.pc += 1; byte } /// Returns a word from the memory at the address of the program counter. ...
code_fim
hard
{ "lang": "rust", "repo": "DiscoBiscuit99/DiscoGB", "path": "/src/gameboy/cpu/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AshTS/LLVMCompiler path: /src/parser/node.rs use crate::tokenizer::Token; /// Expression Types #[derive(Debug, Clone, Copy, PartialEq)] pub enum ExpressionType { ArrayAccess, FunctionCall, PostIncrement, PostDecrement, PreIncrement, PreDecrement, UnaryPlus, Unary...
code_fim
hard
{ "lang": "rust", "repo": "AshTS/LLVMCompiler", "path": "/src/parser/node.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Display a parse tree pub fn display_parse_tree(node: ParseTreeNode, prev: String, is_last: bool) { let mut mprev = prev.clone(); let (text, nodes) = render_node(node); if mprev.len() > 0 { mprev.pop(); mprev += if is_last {"└"} else {"├"}; } println!("{}{}...
code_fim
hard
{ "lang": "rust", "repo": "AshTS/LLVMCompiler", "path": "/src/parser/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> capacity: usize, field: &Field, ranges: Vec<&SmallVec<[SortKeyArrayRange; 4]>>, flatten_dedup_arrays: &mut Vec<ArrayRef>, batch_idx_to_flatten_array_idx: &HashMap<usize, usize>, merge_operator: &MergeOperator, empty_array: ArrayRef, ) -> ArrayRef { assert_eq!(ranges.len(), ...
code_fim
hard
{ "lang": "rust", "repo": "alldatacenter/alldata", "path": "/lake/LakeSoul/native-io/lakesoul-io/src/sorted_merge/combiner.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // For the case that consecutive rows of target array are extended from the same source array flatten_array_ranges.dedup_by_key(|range| range.batch_idx); let mut batch_idx_to_flatten_array_idx = HashMap::<usize, usize>::with_capacity(16); le...
code_fim
hard
{ "lang": "rust", "repo": "alldatacenter/alldata", "path": "/lake/LakeSoul/native-io/lakesoul-io/src/sorted_merge/combiner.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alldatacenter/alldata path: /lake/LakeSoul/native-io/lakesoul-io/src/sorted_merge/combiner.rs /* * Copyright [2022] [DMetaSoul Team] * * 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...
code_fim
hard
{ "lang": "rust", "repo": "alldatacenter/alldata", "path": "/lake/LakeSoul/native-io/lakesoul-io/src/sorted_merge/combiner.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }