text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: doytsujin/rhai path: /src/packages/string_more.rs !string.is_empty() { s.make_mut().push_str(string); } s } #[rhai_fn(name = "+", name = "append")] pub fn add_append_str(string1: ImmutableString, string2: ImmutableString) -> ImmutableString { st...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/rhai", "path": "/src/packages/string_more.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for _ in 0..(len as usize - orig_len) { p.push(character); } #[cfg(not(feature = "unchecked"))] if _ctx.engine().max_string_size() > 0 && string.len() > _ctx.engine().max_string_size() { return Err(crate::EvalAltR...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/rhai", "path": "/src/packages/string_more.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doytsujin/rhai path: /src/packages/string_more.rs const_empty_string(); } let mut chars = StaticVec::<char>::with_capacity(len as usize); for _ in 0..len { match string.make_mut().pop() { Some(c) => chars.push(c), None => brea...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/rhai", "path": "/src/packages/string_more.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> TMat4::new( m.m11, m.m12, _0, _0, m.m21, m.m22, _0, _0, _0, _0, _1, _0, _0, _0, _0, _1, ) } /// Converts a 4x4 matrix to a 2x2 matrix. pub fn mat4_to_mat2<N: Scalar>(m: &TMat4<N>) -> TMat2<N> { TMat2::new( m.m11, m.m12, m.m21, m.m22, ) } //...
code_fim
hard
{ "lang": "rust", "repo": "JD557/nalgebra", "path": "/nalgebra-glm/src/gtc/type_ptr.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JD557/nalgebra path: /nalgebra-glm/src/gtc/type_ptr.rs use na::{Scalar, Real, DefaultAllocator, Quaternion}; use traits::{Number, Alloc, Dimension}; use aliases::{Qua, TMat, TMat2, TMat3, TMat4, TVec1, TVec2, TVec3, TVec4, TMat2x3, TMat2x4, TMat3x2, TMat3x4, TMat4x2, TMat4x3}; //...
code_fim
hard
{ "lang": "rust", "repo": "JD557/nalgebra", "path": "/nalgebra-glm/src/gtc/type_ptr.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/// Creates a quaternion from a slice arranged as `[x, y, z, w]`. pub fn make_quat<N: Real>(ptr: &[N]) -> Qua<N> { Quaternion::from_vector(TVec4::from_column_slice(ptr)) } /// Creates a 1D vector from a slice. pub fn make_vec1<N: Scalar>(v: &TVec1<N>) -> TVec1<N> { *v } /// Creates a 1D vector f...
code_fim
hard
{ "lang": "rust", "repo": "JD557/nalgebra", "path": "/nalgebra-glm/src/gtc/type_ptr.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: morgueye4/substrate-stellar-sdk path: /src/utils/sha256.rs use core::convert::{AsRef, TryInto}; use sha2::{Digest, Sha256}; <|fim_suffix|>pub fn sha256<T: AsRef<[u8]>>(data: T) -> BinarySha256Hash { let mut hasher = Sha256::new(); hasher.update(data); hasher.finalize().as_slice().tr...
code_fim
easy
{ "lang": "rust", "repo": "morgueye4/substrate-stellar-sdk", "path": "/src/utils/sha256.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn sha256<T: AsRef<[u8]>>(data: T) -> BinarySha256Hash { let mut hasher = Sha256::new(); hasher.update(data); hasher.finalize().as_slice().try_into().unwrap() }<|fim_prefix|>// repo: morgueye4/substrate-stellar-sdk path: /src/utils/sha256.rs use core::convert::{AsRef, TryInto}; use sha2::...
code_fim
easy
{ "lang": "rust", "repo": "morgueye4/substrate-stellar-sdk", "path": "/src/utils/sha256.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: minecrawler/cubic_spline path: /src/result.rs /// Wrapper for resulting vector of "points". /// "Points" type may be any which implements `PushPoint` trait pub struct SplineResult<T> { pts: Vec<T>, } impl<T> SplineResult<T> { /// Constructs a new `SplineResult<T>` with empty `Vec<T>` /// ...
code_fim
hard
{ "lang": "rust", "repo": "minecrawler/cubic_spline", "path": "/src/result.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Get mutable referense to inner `Vec<T>` pub fn pts(&mut self) -> &mut Vec<T> { self.pts.as_mut() } } /// Trait that contains one method to push `x` and `y` to SplineResult ( or your result data ) pub trait PushPoint { /// /// # Example /// ``` /// use cubic_spline::{PushPoint,Spline...
code_fim
hard
{ "lang": "rust", "repo": "minecrawler/cubic_spline", "path": "/src/result.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Moves the resulting point out of the `SplineResult` pub fn get(self) -> Vec<T> { self.pts } /// Get mutable referense to inner `Vec<T>` pub fn pts(&mut self) -> &mut Vec<T> { self.pts.as_mut() } } /// Trait that contains one method to push `x` and `y` to SplineResult ( or your re...
code_fim
hard
{ "lang": "rust", "repo": "minecrawler/cubic_spline", "path": "/src/result.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ArchDH/rust_practice path: /src/vector.rs // vectors = dynamic lists where elements are the same data types pub fn run(){ let mut numbers : Vec<i32> = vec![1, 2, 3, 4, 5]; // let mut name: Vec<type> = vec![values] <|fim_suffix|> println!("{:?}", numbers); // pop off the last value...
code_fim
hard
{ "lang": "rust", "repo": "ArchDH/rust_practice", "path": "/src/vector.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Loop throught vectur values for i in numbers.iter() { println!("number : {}", i); } // Loop and mutate values for i in numbers.iter_mut(){ *i +=10; } println!("{:?}", numbers); }<|fim_prefix|>// repo: ArchDH/rust_practice path: /src/vector.rs // vectors = ...
code_fim
hard
{ "lang": "rust", "repo": "ArchDH/rust_practice", "path": "/src/vector.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // pop off the last value numbers.pop(); println!("{:?}", numbers); // Loop throught vectur values for i in numbers.iter() { println!("number : {}", i); } // Loop and mutate values for i in numbers.iter_mut(){ *i +=10; } println!("{:?}", numbers);...
code_fim
hard
{ "lang": "rust", "repo": "ArchDH/rust_practice", "path": "/src/vector.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nphyx/scrapsrl path: /src/system/mapgen/roads.rs use super::{util::*, MapGenBundle}; use crate::component::{Color, Description, Pos}; use crate::resource::Tile; use crate::util::colors::lerp; use crate::util::*; /// FIXME don't hardcode this const VEHICLES: [&str; 8] = [ "vehicle_sedan", ...
code_fim
hard
{ "lang": "rust", "repo": "nphyx/scrapsrl", "path": "/src/system/mapgen/roads.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let dashed = bundle.assets.get_icon("road_line_dashed").ch(); let line = bundle.assets.get_icon("road_line_single").ch(); let dbl = bundle.assets.get_icon("road_line_double").ch(); let damage_icon = bundle.assets.get_icon("road_cracked").ch(); let lanes = bundle.world.get_road(bundle.r...
code_fim
hard
{ "lang": "rust", "repo": "nphyx/scrapsrl", "path": "/src/system/mapgen/roads.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MCHSoda/BadRust path: /src/main.rs //file ~/IdeaProjects/BadRust/src/main.rs use std::io; fn main() { let z = "a"; let x = 5; let y = 6; <|fim_suffix|> let mut number = String::new(); //makes a new variable following a new string as well as being mutual io::stdin() //inpu...
code_fim
medium
{ "lang": "rust", "repo": "MCHSoda/BadRust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut number = String::new(); //makes a new variable following a new string as well as being mutual io::stdin() //input output standard input .read_line(&mut number) //this reads the line user inputs using earlier mutual string variable "guess" .expect("u failed to read"); //for...
code_fim
medium
{ "lang": "rust", "repo": "MCHSoda/BadRust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("welcome to the black mesa facility at sector {} {} {}", x, y, z); println!("say number"); //prints message let mut number = String::new(); //makes a new variable following a new string as well as being mutual io::stdin() //input output standard input .read_line(&mut nu...
code_fim
medium
{ "lang": "rust", "repo": "MCHSoda/BadRust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let header = $root::std_msgs::Header { seq: t.header.seq, stamp: t.header.stamp, frame_id: t.header.frame_id, }; let goal_id = $root::actionlib_msgs::GoalID { ...
code_fim
hard
{ "lang": "rust", "repo": "ZhangHanDong/rosrust", "path": "/rosrust_actionlib/src/macros.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn from_response(t: $crate::Response<Self::Body>) -> Self { let header = $root::std_msgs::Header { seq: t.header.seq, stamp: t.header.stamp, frame_id: t.header.frame_id, }; ...
code_fim
hard
{ "lang": "rust", "repo": "ZhangHanDong/rosrust", "path": "/rosrust_actionlib/src/macros.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZhangHanDong/rosrust path: /rosrust_actionlib/src/macros.rs #[macro_export] macro_rules! action { ($root: path; $($package:ident : $action: ident),*) => { $($crate::action!(INNER, $root, $package, $action);)* }; (INNER, $root:path, $package: ident, $action: ident) => { ...
code_fim
hard
{ "lang": "rust", "repo": "ZhangHanDong/rosrust", "path": "/rosrust_actionlib/src/macros.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jduan/cosmos path: /rust_sandbox/rust_mio_example/src/lib.rs use mio::event::Event; use mio::net::{TcpListener, TcpStream}; use mio::{Events, Interest, Poll, Token}; use std::collections::HashMap; use std::io::{self, Read, Write}; // Setup some tokens to allow us to identify which event is for ...
code_fim
hard
{ "lang": "rust", "repo": "jduan/cosmos", "path": "/rust_sandbox/rust_mio_example/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if event.is_readable() { println!("Connection is ready for read again"); let mut connection_closed = false; // We can (maybe) read from the connection. We need to keep reading until we // get a WOULD_BLOCK. If we don't read all the data, we may never get notified again....
code_fim
hard
{ "lang": "rust", "repo": "jduan/cosmos", "path": "/rust_sandbox/rust_mio_example/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let ttls = vec![1, 3, 5, 10, 100, 500, 1_000, 3_000]; let mut causets = vec![]; for ttl in &ttls { causets.push(Config { n: 10, cone: 1000, ttl: Duration::from_millis(*ttl), }) } c.bench_function_over_inputs("bench_dense_detect_with_c...
code_fim
hard
{ "lang": "rust", "repo": "whtcorpsinc/einsteindb-prod", "path": "/tests/benches/deadlock_detector/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: whtcorpsinc/einsteindb-prod path: /tests/benches/deadlock_detector/mod.rs // Copyright 2019 WHTCORPS INC Project Authors. Licensed under Apache-2.0. use criterion::{Bencher, Criterion}; use ekvproto::deadlock::*; use rand::prelude::*; use edb::server::lock_manager::deadlock::DetectBlock; use vi...
code_fim
hard
{ "lang": "rust", "repo": "whtcorpsinc/einsteindb-prod", "path": "/tests/benches/deadlock_detector/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let cones = vec![ 10, 100, 1_000, 10_000, 10_000, 100_000, 1_000_000, 10_000_000, 100_000_000, ]; let mut causets = vec![]; for cone in cones { causets.push(Config { n: 10, cone, ...
code_fim
hard
{ "lang": "rust", "repo": "whtcorpsinc/einsteindb-prod", "path": "/tests/benches/deadlock_detector/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pka/doctags path: /doctagsfs/src/vfs.rs use anyhow::{Context, Result}; use doctags::search::{doc_from_id, doc_from_path}; use failure::ResultExt; use std::collections::HashMap; use std::ffi::OsStr; use std::path::Path; use tantivy::collector::{FacetCollector, TopDocs}; use tantivy::query::{AllQu...
code_fim
hard
{ "lang": "rust", "repo": "pka/doctags", "path": "/doctagsfs/src/vfs.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn entry_from_dir_entry(&self, parent_id: u64, name: &OsStr) -> Result<Option<VfsEntry>> { if let Some(ids) = self.children.get(&parent_id) { let entry = ids .iter() .map(|id| &self.entries[id]) .find(|e| e.entry == FsEntry::Tag(n...
code_fim
hard
{ "lang": "rust", "repo": "pka/doctags", "path": "/doctagsfs/src/vfs.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut entries = Vec::new(); for (_score, doc_address) in top_docs { let doc = searcher.doc(doc_address).compat()?; // debug!("doc: {}", schema.to_json(&doc)); let id = doc .get_first(id_field) ...
code_fim
hard
{ "lang": "rust", "repo": "pka/doctags", "path": "/doctagsfs/src/vfs.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if status != 0 { Err(format!("Failed to set objective weights ({} ({}))", errstr(self.env.inner, status).unwrap(), status)) } else { self.set_objective_type(ty) } } } ...
code_fim
hard
{ "lang": "rust", "repo": "emallson/rplex", "path": "/src/lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emallson/rplex path: /src/lib.rs CInt; // setting objective fn CPXchgobj(env: *mut CEnv, lp: *mut CProblem, cnt: CInt, indices: *const CInt, values: *const c_double) -> c_int; fn CPXchgobjsen(env: *...
code_fim
hard
{ "lang": "rust", "repo": "emallson/rplex", "path": "/src/lib.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> /// Add an initial solution to the problem. /// /// `vars` is an array of indices (i.e. the result of `prob.add_variable`) and `values` are /// their values. pub fn add_initial_soln(&mut self, vars: &[usize], values: &[f64]) -> Result<(), String> { assert!(values.len() == vars....
code_fim
hard
{ "lang": "rust", "repo": "emallson/rplex", "path": "/src/lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sjmelia/newton-raphson path: /src/lib.rs //! A minimal module for calculating roots using the Newton-Raphson method, //! as described by [Wikipedia](https://en.wikipedia.org/wiki/Newton's_method) //! //! # Examples //! //! [Solution of cos(c) = x^3^] //! (https://en.wikipedia.org/wiki/Newton%27s...
code_fim
hard
{ "lang": "rust", "repo": "sjmelia/newton-raphson", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Runs through one iteration of the Newton-Raphson method /// /// # Examples /// /// [Finding the square root of a number] /// (https://en.wikipedia.org/wiki/Newton%27s_method#Square_root_of_a_number) /// /// ``` /// use newton_raphson::iteration; /// fn sqrt_of_612(x: f64) -> f64 { /// (x * x) - 61...
code_fim
hard
{ "lang": "rust", "repo": "sjmelia/newton-raphson", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> rectangle( color, [ x, y, width, height, ], con.transform, g, ); }<|fim_prefix|>// repo: connormcn37/rust-breakout path: /src/draw.rs use piston_window::{rectangle, Context, G2d}; use piston_window::types::Col...
code_fim
medium
{ "lang": "rust", "repo": "connormcn37/rust-breakout", "path": "/src/draw.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: connormcn37/rust-breakout path: /src/draw.rs use piston_window::{rectangle, Context, G2d}; use piston_window::types::Color; <|fim_suffix|> rectangle( color, [ x, y, width, height, ], con.transform, g, ...
code_fim
medium
{ "lang": "rust", "repo": "connormcn37/rust-breakout", "path": "/src/draw.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_name(&self, shstrtab: &[u8]) -> String { let mut string_table = String::new(); let mut index = self.sh_name as usize; loop { if shstrtab[index] > 0 { string_table.push(shstrtab[index] as char); index += 1; } els...
code_fim
hard
{ "lang": "rust", "repo": "xermicus/elftool", "path": "/src/section_header.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn parse_shdr(input_file: &[u8], ehdr: &Elf64Ehdr) -> Result<Vec<Elf64Shdr>, Error> { let mut shdr_table = Vec::new(); for i in 0..ehdr.e_shnum { let i_offset = (ehdr.e_shoff + (i * ehdr.e_shentsize) as u64) as usize; let input_buffer = &input_file[i_offset..i_offset + ehdr.e_s...
code_fim
hard
{ "lang": "rust", "repo": "xermicus/elftool", "path": "/src/section_header.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xermicus/elftool path: /src/section_header.rs use {Elf64Addr, Elf64Off}; use elf_header::Elf64Ehdr; use helpers::{Error, SH_TYPES, SH_FLAGS, cast_u32, cast_u64}; #[derive(Default, Debug)] pub struct Elf64Shdr { sh_name: u32, sh_type: u32, sh_flags: u64, sh_addr: Elf64Addr, s...
code_fim
hard
{ "lang": "rust", "repo": "xermicus/elftool", "path": "/src/section_header.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if result.is_empty() { return Err(CustomError::NotFound("找不到文章".into())); } Ok(Json(result)) }<|fim_prefix|>// repo: MIracleyin/blog path: /server/src/article/search.rs use std::sync::Arc; use ntex::web::types::{Path, State, Json}; use crate::{AppState, errors::CustomError, models:...
code_fim
hard
{ "lang": "rust", "repo": "MIracleyin/blog", "path": "/server/src/article/search.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MIracleyin/blog path: /server/src/article/search.rs use std::sync::Arc; use ntex::web::types::{Path, State, Json}; use crate::{AppState, errors::CustomError, models::article::ArticlePreview}; <|fim_suffix|> let result = sqlx::query!( "SELECT id, title, date FROM articles WHERE titl...
code_fim
medium
{ "lang": "rust", "repo": "MIracleyin/blog", "path": "/server/src/article/search.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bjornwsv/newrustacean.com path: /src/interview/rbr_2017/ben_striegel.rs //! Ben Striegel //! //! - **Date:** December 10, 2017 (recorded October 27, 2017) //! - **Audio:** //! + [M4A] //! + [MP3] //! + [Ogg] //! //! [M4A]: http://www.podtrac.com/pts/redirect.m4a/cdn.newrust...
code_fim
hard
{ "lang": "rust", "repo": "bjornwsv/newrustacean.com", "path": "/src/interview/rbr_2017/ben_striegel.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>.newrustacean.com/interview/rbr_2017/ben_striegel.mp3"> //! <source src="http://www.podtrac.com/pts/redirect.ogg/cdn.newrustacean.com/interview/rbr_2017/ben_striegel.ogg"> //! </audio> #[doc(include = "../docs/rbr_2017/ben-striegel.md")] pub struct Transcript;<|fim_prefix|>// repo: bjornwsv/newrustacea...
code_fim
hard
{ "lang": "rust", "repo": "bjornwsv/newrustacean.com", "path": "/src/interview/rbr_2017/ben_striegel.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>e="width: 100%" title="Rust Belt Rust 2017: Colin Dean" controls preload=metadata> //! <source src="http://www.podtrac.com/pts/redirect.m4a/cdn.newrustacean.com/interview/rbr_2017/ben_striegel.m4a"> //! <source src="http://www.podtrac.com/pts/redirect.mp3/cdn.newrustacean.com/interview/rbr_2017/ben_st...
code_fim
hard
{ "lang": "rust", "repo": "bjornwsv/newrustacean.com", "path": "/src/interview/rbr_2017/ben_striegel.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AgoraNomic/Treasuror path: /assetlib/src/model/mod.rs use std::collections::HashMap; mod amount; mod context; pub mod dates; mod entity; mod history; mod report; mod unit; <|fim_suffix|>pub use crate::model::{ amount::Amount, context::Context, entity::{Entities, Entity, EntityKind}...
code_fim
easy
{ "lang": "rust", "repo": "AgoraNomic/Treasuror", "path": "/assetlib/src/model/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub use crate::model::{ amount::Amount, context::Context, entity::{Entities, Entity, EntityKind}, history::{DatedHistoryEntry, HistoryEntry}, report::Report, unit::{Currency, FullUnit}, };<|fim_prefix|>// repo: AgoraNomic/Treasuror path: /assetlib/src/model/mod.rs use std::collect...
code_fim
easy
{ "lang": "rust", "repo": "AgoraNomic/Treasuror", "path": "/assetlib/src/model/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rozaliev/monkeys path: /src/lib.rs pub fn async<F, Y, R>(mut f: F) -> Stream<Y, R> where F: FnOnce(&mut Flow<Y, R>) -> R + 'static, Y: Reflect + 'static, R: Reflect + 'static { let stack = PooledStack::new(); let mut transfer = Transfer::new(Context::new(&stack, i...
code_fim
hard
{ "lang": "rust", "repo": "rozaliev/monkeys", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rozaliev/monkeys path: /src/lib.rs Scheduler { work_queue: RefCell::new(VecDeque::new()), blocked: RefCell::new(HashMap::new()), completed: RefCell::new(HashMap::new()), ready_to_yield: RefCell::new(HashMap::new()), external_notif...
code_fim
hard
{ "lang": "rust", "repo": "rozaliev/monkeys", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let opt = SCHEDULER.with(|sc| { sc.schedule_till(self.co_id); sc.get_yield_for(self.co_id) }); if opt.is_none() { self.is_done = true; } opt } } impl<Y, R> Drop for Stream<Y, R> { fn drop(&mut self) { if self.is...
code_fim
hard
{ "lang": "rust", "repo": "rozaliev/monkeys", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // The count of '~' or '`' characters let mut cnt: uint = 0; for &ch in buf.iter() { if ch == item { cnt += 1; } else { break; } } if cnt >= 3 { Some((buf.slice_from(cnt), cnt, item)) } else { None } } #[test] fn test_is_codefence() {...
code_fim
hard
{ "lang": "rust", "repo": "jmars/rust-markdown", "path": "/markdown.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jmars/rust-markdown path: /markdown.rs // This code is heavily inspired by hoedown. // // Performance observations: // // Note that buf.head() == Some(&ch) is much faster than buf[0] == ch. // static SP: u8 = b' '; static NL: u8 = b'\n'; static CR: u8 = b'\r'; static TAB: u8 = b'\t'; static ST...
code_fim
hard
{ "lang": "rust", "repo": "jmars/rust-markdown", "path": "/markdown.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for &ch in buf.iter() { if ch == item { cnt += 1; } else { break; } } if cnt >= 3 { Some((buf.slice_from(cnt), cnt, item)) } else { None } } #[test] fn test_is_codefence() { assert!(is_codefence(b"```").is_some()); assert!(is_codefence...
code_fim
hard
{ "lang": "rust", "repo": "jmars/rust-markdown", "path": "/markdown.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Hossein-Noroozpour/vulkust path: /vulkust/src/render/light/mod.rs use super::command::Pool as CmdPool; use super::engine::Engine; use super::gapi::GraphicApiEngine; use super::model::Model; use super::object::{Object, Transferable}; use super::shadower::Shadower; use super::sync::Semaphore; use ...
code_fim
hard
{ "lang": "rust", "repo": "Hossein-Noroozpour/vulkust", "path": "/vulkust/src/render/light/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self, g_engine: &GraphicApiEngine, cmd_pool: &Arc<CmdPool>, shadower: &Shadower, kernel_index: usize, frame_number: usize, ); fn render_shadow_mapper(&self, shadower: &Shadower, frame_number: usize, kernel_index: usize); fn submit_shadow_mapper(...
code_fim
hard
{ "lang": "rust", "repo": "Hossein-Noroozpour/vulkust", "path": "/vulkust/src/render/light/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: puppetmaster-/shoot-out-your-life path: /src/assets.rs use tetra::Context; use tetra::audio::Sound; use tetra::graphics::{Animation,Texture, Text, Rectangle, Font}; use std::collections::HashMap; pub struct Assets{ sounds: HashMap<SoundName, Sound>, animations: HashMap<AnimationName, Animatio...
code_fim
hard
{ "lang": "rust", "repo": "puppetmaster-/shoot-out-your-life", "path": "/src/assets.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn build_textures(ctx: &mut Context) ->tetra::Result<HashMap<TextureName, Texture>>{ let textures: HashMap<TextureName, Texture> = [ (TextureName::Life, Texture::from_file_data(ctx,include_bytes!("../assets/art/life_art.png"))?), (TextureName::Level, Texture::from_file_data(ctx,include_bytes!("../ass...
code_fim
hard
{ "lang": "rust", "repo": "puppetmaster-/shoot-out-your-life", "path": "/src/assets.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PeterCxy/cs140e-os path: /pi/src/atags/atag.rs use atags::raw; pub use atags::raw::{Core, Mem}; /// An ATAG. #[derive(Debug, Copy, Clone)] pub enum Atag { Core(raw::Core), Mem(raw::Mem), Cmd(&'static str), Unknown(u32), None } impl Atag { /// Returns `Some` if this is ...
code_fim
hard
{ "lang": "rust", "repo": "PeterCxy/cs140e-os", "path": "/pi/src/atags/atag.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> From<&'a raw::Cmd> for Atag { fn from(cmd: &raw::Cmd) -> Atag { // The cmd is a null-terminated string // The ending point must be found first let start = &cmd.cmd as *const u8; let mut index = start as usize; loop { let byte = unsafe { ...
code_fim
hard
{ "lang": "rust", "repo": "PeterCxy/cs140e-os", "path": "/pi/src/atags/atag.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: allonsy/gitbot path: /src/main.rs //! Main spinup for gitbot extern crate curl; extern crate rustc_serialize; mod codegen; use std::fs::File; use std::io::Read; use curl::http; use rustc_serialize::json; #[derive(RustcDecodable, RustcEncodable)] /// Represents a Bearer token from github that ...
code_fim
hard
{ "lang": "rust", "repo": "allonsy/gitbot", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut hand = http::handle(); let mut req = hand.get("https://api.github.com/users/allonsy"); req = add_auth_header(req, &tok); let resp = req.exec().unwrap(); let resp_string = std::string::String::from_utf8(resp.move_body()).unwrap(); println!("response is: {}", resp_string); } #[allow(dea...
code_fim
hard
{ "lang": "rust", "repo": "allonsy/gitbot", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(dead_code)] fn add_auth_header<'a,'b>(req : http::Request<'a,'b>, tok : &Bearer) -> http::Request<'a,'b> { req.header("Authorization", &format!("token {}", tok.access_token)) .header("User-Agent", "gitbot v0.0.1 scraper") }<|fim_prefix|>// repo: allonsy/gitbot path: /src/main.r...
code_fim
hard
{ "lang": "rust", "repo": "allonsy/gitbot", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for decimal in data.into_iter() { push_binary(&mut self.data, 8, decimal as u16); } } for _ in 0..remainder_bits(self.version) { self.data.push(0); } self } }<|fim_prefix|>// repo: AurevoirXavier/qrustcode path: /src/encoder/bits.rs use super::Encoder; pub fn pu...
code_fim
hard
{ "lang": "rust", "repo": "AurevoirXavier/qrustcode", "path": "/src/encoder/bits.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let re_cws = (CAPACITIES[self.version][self.ec_level] - data.len() as u16) / 8; let mut decimals = vec![]; for binary in data.chunks(8) { decimals.push(decimal(binary)); } let mut paddings = [236u8, 17].iter().cycle(); for _ in 0..re_cws { decimals.push(*paddings....
code_fim
hard
{ "lang": "rust", "repo": "AurevoirXavier/qrustcode", "path": "/src/encoder/bits.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AurevoirXavier/qrustcode path: /src/encoder/bits.rs use super::Encoder; pub fn push_binary(binary: &mut Vec<u8>, bits_count: usize, mut num: u16) { let mut len = binary.len() + bits_count; binary.resize(len, 0); while num != 0 { len -= 1; binary[len] = (num & 1) as...
code_fim
hard
{ "lang": "rust", "repo": "AurevoirXavier/qrustcode", "path": "/src/encoder/bits.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zesterer/mutation path: /src/lib.rs #![feature(generic_associated_types, arbitrary_self_types, trait_alias)] use core::ops::Deref; pub trait IsRef<'a> { type Inner: 'a; type Mut: Mut; type Map<B> where B: 'a; fn map<B: GenMut<'a>, F, G>( self, f: F, g: ...
code_fim
hard
{ "lang": "rust", "repo": "zesterer/mutation", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn iter<'a, R: Ref<'a, Self>>(self: R) -> impl Iterator<Item = RefMap<'a, R, T>> where T: 'a { self.map::<SliceIter<T>, _, _>( |this: &Self| this.0.iter(), |this: &mut Self| this.0.iter_mut(), ) } pub fn iter_positive<'a, R: Ref<'a, Self>>(self: R) ...
code_fim
hard
{ "lang": "rust", "repo": "zesterer/mutation", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (_, text) = buf_file.lines().fold((0f32, String::new()), |state, line| { let new_state = challenge3::decrypt_from_hex(&line.unwrap(), XorDecryptor); if new_state.0 > state.0 { new_state } else { state } }); println!("Challenge 4 : {}...
code_fim
medium
{ "lang": "rust", "repo": "anoopelias/matasano", "path": "/rust-matasano/src/challenge4.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anoopelias/matasano path: /rust-matasano/src/challenge4.rs use std::fs::File; use std::io::BufReader; use std::io::BufRead; use libs::cryptor::XorDecryptor; use challenge3; <|fim_suffix|> let (_, text) = buf_file.lines().fold((0f32, String::new()), |state, line| { let new_state = ch...
code_fim
medium
{ "lang": "rust", "repo": "anoopelias/matasano", "path": "/rust-matasano/src/challenge4.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /cargo-atcoder/contests/abc252/src/bin/b.rs use proconio::{input, marker::Usize1}; <|fim_suffix|> input! { n: usize, k: usize, a: [usize; n], b: [Usize1; k], }; let max = *a.iter().max().unwrap(); for (i, a_i) in a.iter()...
code_fim
easy
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc252/src/bin/b.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input! { n: usize, k: usize, a: [usize; n], b: [Usize1; k], }; let max = *a.iter().max().unwrap(); for (i, a_i) in a.iter().copied().enumerate() { if a_i == max && b.contains(&i) { println!("Yes"); return; } } ...
code_fim
easy
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc252/src/bin/b.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut library = ProgramLibraryManager::new(LIBRARY_DIRECTORY_NAME).expect("library loading error"); #[cfg(feature = "glutin-window")] let mut window = window::glutin::GlutinWindow::new("Program launcher", DEFAULT_WINDOW_WIDTH, DEFAULT_WINDOW_HEIGHT, full_screen); let mut input = InputM...
code_fim
hard
{ "lang": "rust", "repo": "jutuon/program-launcher", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jutuon/program-launcher path: /src/main.rs #[macro_use] extern crate conrod; #[cfg(feature = "glutin-window")] extern crate gilrs; #[cfg(feature = "sdl2-window")] extern crate sdl2; extern crate backend_library; pub mod input; pub mod window; pub mod ui; pub mod renderer; pub mod utils; us...
code_fim
hard
{ "lang": "rust", "repo": "jutuon/program-launcher", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> part1 } fn sum_up(value: simd_json::value::BorrowedValue) -> i64 { match value { simd_json::BorrowedValue::Static(node) => match node { simd_json::StaticNode::I64(n) => n, simd_json::StaticNode::U64(n) => n as i64, _ => 0, }, simd_json:...
code_fim
medium
{ "lang": "rust", "repo": "PurpleMyst/aoc-2015-redux", "path": "/day12/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PurpleMyst/aoc-2015-redux path: /day12/src/lib.rs use std::borrow::Cow; fn solve_part1(mut inp: &[u8]) -> i64 { let mut part1 = 0; while let Some(idx) = inp.iter().position(|&ch| matches!(ch, b'-' | b'0'..=b'9')) { let (_, inp2) = inp.split_at(idx); let (sign, mut inp2...
code_fim
medium
{ "lang": "rust", "repo": "PurpleMyst/aoc-2015-redux", "path": "/day12/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(value) = self.vars_for_prop_hoisting.remove(&obj.to_id()) { member.obj = value; self.changed = true; report_change!("hoist_props: Inlined a property"); } } } } impl Optimizer<'_> { /// Converts `{ a: 1 }.a...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_ecma_minifier/src/compress/optimize/props.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: swc-project/swc path: /crates/swc_ecma_minifier/src/compress/optimize/props.rs use swc_common::DUMMY_SP; use swc_ecma_ast::*; use swc_ecma_utils::{contains_this_expr, prop_name_eq, ExprExt}; use super::{unused::PropertyAccessOpts, Optimizer}; use crate::util::deeply_contains_this_expr; /// Met...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_ecma_minifier/src/compress/optimize/props.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> cmp::max(left_height, right_height) + 1 } } #[cfg(test)] mod tests { use super::*; #[test] fn bast_validate_1() { // Arrange let input = [1, 2, 3, 4, 5, 6, 7]; // Act let bst = BinarySearchTree::create_from_sorted_array(&input); // Asser...
code_fim
hard
{ "lang": "rust", "repo": "svenschmidt75/Rust", "path": "/DSandAlg/CodingProblems/CrackingTheCodingInterview/4_2/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: svenschmidt75/Rust path: /DSandAlg/CodingProblems/CrackingTheCodingInterview/4_2/src/lib.rs // Cracking the Coding Interview // 6th ed, p. 109, ex. 4.2 use std::cmp; use std::collections::VecDeque; struct Node { value: i64, left: Option<Box<Node>>, right: Option<Box<Node>>, } impl...
code_fim
hard
{ "lang": "rust", "repo": "svenschmidt75/Rust", "path": "/DSandAlg/CodingProblems/CrackingTheCodingInterview/4_2/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn height_internal(node: &Node) -> u32 { let left_height = if node.left.is_some() { BinarySearchTree::height_internal(node.left.as_ref().unwrap()) } else { 0 }; let right_height = if node.right.is_some() { BinarySearchTree::height_in...
code_fim
hard
{ "lang": "rust", "repo": "svenschmidt75/Rust", "path": "/DSandAlg/CodingProblems/CrackingTheCodingInterview/4_2/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: goiw111/gateway path: /src/routes/seission.rs use actix_web::{web ,get, post, Responder, HttpResponse}; use crate::loger::Loger; use crate::loger::Loged; use actix_web::web::Data; use crate::AppData; use actix_web::http; use rand::{thread_rng, Rng}; use rand::distributions::Alphanumeric; use sai...
code_fim
hard
{ "lang": "rust", "repo": "goiw111/gateway", "path": "/src/routes/seission.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[post("/seission", wrap = "Loger")] async fn seission( form: web::Form<Credentials>, req: HttpRequest, mut loged: Loged, data: Data<Mutex<AppData>>) -> impl Responder { if let Ok(data) = data.lock() { if let None = loged.get(&data.key) { if let Some(c) = r...
code_fim
hard
{ "lang": "rust", "repo": "goiw111/gateway", "path": "/src/routes/seission.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let verify_length = |length: usize| { assert_eq!( length, 3, "Tried to set triangle vertex indices with list of {} indices", length ); }; match (property_name.as_str(), property) { ("vertex_index" ...
code_fim
hard
{ "lang": "rust", "repo": "lars-frogner/Impact", "path": "/src/scene/io/ply.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl PropertyAccess for PlyTriangleVertexIndices { fn new() -> Self { Self([0; 3]) } fn set_property(&mut self, property_name: String, property: Property) { let verify_length = |length: usize| { assert_eq!( length, 3, "Tried to set t...
code_fim
hard
{ "lang": "rust", "repo": "lars-frogner/Impact", "path": "/src/scene/io/ply.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lars-frogner/Impact path: /src/scene/io/ply.rs //! Input/output of mesh data in Polygon File Format. use crate::{ geometry::{ TextureProjection, TriangleMesh, VertexColor, VertexNormalVector, VertexPosition, VertexTextureCoords, }, rendering::fre, scene::{MeshCom...
code_fim
hard
{ "lang": "rust", "repo": "lars-frogner/Impact", "path": "/src/scene/io/ply.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yukihane/hello-rust path: /error-handling/src/bin/rust-book.rs // https://doc.rust-lang.org/book/ch09-02-recoverable-errors-with-result.html // にある、Error を Box する方法。ちなみに日本語版 // https://doc.rust-jp.rs/book-ja/ch09-02-recoverable-errors-with-result.html // にはまだ無い // 実践Rustプログラミング入門 p.173 // 独自エラー...
code_fim
medium
{ "lang": "rust", "repo": "yukihane/hello-rust", "path": "/error-handling/src/bin/rust-book.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let res = num_str.trim().parse::<i32>().map(|t| t * 2)?; Ok(res) } fn main() { match get_int_from_file() { Ok(x) => println!("{}", x), Err(e) => println!("{}", e), } }<|fim_prefix|>// repo: yukihane/hello-rust path: /error-handling/src/bin/rust-book.rs // https://doc.rus...
code_fim
medium
{ "lang": "rust", "repo": "yukihane/hello-rust", "path": "/error-handling/src/bin/rust-book.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Darksecond/unx path: /bootinfo/src/boot_info.rs use core::slice; const MAX_MEMORY_MAP_ENTRIES: usize = 256; #[derive(Debug)] pub struct MemoryMap { num_entries: usize, entries: [MemoryMapEntry; MAX_MEMORY_MAP_ENTRIES], } impl MemoryMap { pub fn add_entry(&mut self, entr...
code_fim
hard
{ "lang": "rust", "repo": "Darksecond/unx", "path": "/bootinfo/src/boot_info.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> MemoryMapEntry { start: 0, size: 0, memory_type: MemoryType::Unusable, } } } #[derive(Debug, Default, Copy, Clone)] pub struct ConsoleFont { pub font_base: u64, pub font_size: usize, } impl ConsoleFont { pub fn as_slice(&...
code_fim
hard
{ "lang": "rust", "repo": "Darksecond/unx", "path": "/bootinfo/src/boot_info.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Default, Copy, Clone)] pub struct ConsoleFont { pub font_base: u64, pub font_size: usize, } impl ConsoleFont { pub fn as_slice(&self) -> &[u8] { unsafe { slice::from_raw_parts(self.font_base as *const u8, self.font_size) } } } impl AsRef<[u8]> for Cons...
code_fim
hard
{ "lang": "rust", "repo": "Darksecond/unx", "path": "/bootinfo/src/boot_info.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl Update { /// Starts building a query that will update rows in the specified table. pub fn table<S: Into<String>>(table_name: S) -> Update { Update { table_name: table_name.into(), updates: Vec::new(), condition: None, } } /// Adds a...
code_fim
hard
{ "lang": "rust", "repo": "ni-balexand/rust-msi", "path": "/src/internal/query.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ni-balexand/rust-msi path: /src/internal/query.rs ins_key(&keys) { already_exists!( "Table {:?} already contains a row with \ key {:?}", self.table_name, keys ); ...
code_fim
hard
{ "lang": "rust", "repo": "ni-balexand/rust-msi", "path": "/src/internal/query.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ni-balexand/rust-msi path: /src/internal/query.rs ng_pool, tables)? .into_table_and_values(); let (table2, rows2) = select2 .exec(comp, string_pool, tables)? .into_table_and_values(); let columns = ...
code_fim
hard
{ "lang": "rust", "repo": "ni-balexand/rust-msi", "path": "/src/internal/query.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mozilla/gecko-dev path: /third_party/rust/icu_locid/src/extensions/unicode/key.rs // This file is part of ICU4X. For terms of use, please see the file // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). impl_tinyst...
code_fim
hard
{ "lang": "rust", "repo": "mozilla/gecko-dev", "path": "/third_party/rust/icu_locid/src/extensions/unicode/key.rs", "mode": "psm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_suffix|>es()[1].is_ascii_alphabetic(), s.to_ascii_lowercase(), (s.all_bytes()[0].is_ascii_lowercase() || s.all_bytes()[0].is_ascii_digit()) && s.all_bytes()[1].is_ascii_lowercase(), InvalidExtension, ["ca", "8a"], ["a", "a8", "abc"], );<|fim_prefix|>// repo: mozilla/gecko-dev path: /t...
code_fim
hard
{ "lang": "rust", "repo": "mozilla/gecko-dev", "path": "/third_party/rust/icu_locid/src/extensions/unicode/key.rs", "mode": "spm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pepsighan/papito path: /papito_dom/src/vlist.rs use vnode::VNode; use std::fmt::Display; use std::fmt::{Formatter, self}; use indexmap::IndexMap; use CowStr; #[cfg(not(target_arch = "wasm32"))] use traits::ServerRender; type Key = CowStr; #[derive(Debug, Eq, PartialEq)] pub struct VList { ...
code_fim
hard
{ "lang": "rust", "repo": "pepsighan/papito", "path": "/papito_dom/src/vlist.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(not(target_arch = "wasm32"))] impl ServerRender for VList { fn server_render(&mut self) { for (_, child) in self.children.iter_mut() { child.server_render(); } } } #[cfg(target_arch = "wasm32")] mod wasm { use super::VList; use vdiff::{DOMPatch, DOMRemove...
code_fim
hard
{ "lang": "rust", "repo": "pepsighan/papito", "path": "/papito_dom/src/vlist.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if !reply.starts_with(PREFIX) { return None; } reply = &reply[SKIP..]; let mut split = reply.split('.'); // we should avoid allocating to prevent // large performance degradations in // parsing this. let mut tokens: [Option<&st...
code_fim
hard
{ "lang": "rust", "repo": "lambdaR/nats.rs", "path": "/src/message.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lambdaR/nats.rs path: /src/message.rs use std::{ fmt, io, sync::{ atomic::{AtomicBool, Ordering}, Arc, }, }; use crate::{client::Client, Headers}; /// A message received on a subject. #[derive(Clone)] pub struct Message { /// The subject this message came from. ...
code_fim
hard
{ "lang": "rust", "repo": "lambdaR/nats.rs", "path": "/src/message.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Value::Function(instructions, heap, symbol_table) = f { let mut vm = VM::from(heap, symbol_table); let result = vm.run(instructions); if let Result::Ok(ReturnValue::Value(v)) = result { self.data_st...
code_fim
hard
{ "lang": "rust", "repo": "dave-nachman/bytelang", "path": "/src/vm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }