text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> fn sparse_except(except: &[u8]) -> Vec<u8> { let mut except_set = vec![false; 256]; for &b in except { except_set[b as usize] = true; } let mut set = vec![]; for b in (0..256).map(|b| b as u8) { if !except_set[b as usize] { ...
code_fim
hard
{ "lang": "rust", "repo": "codeslangers/ripgrep", "path": "/crates/regex/src/non_matching.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matter-labs/zksync path: /core/lib/circuit/benches/criterion/transfer.rs use crate::generate_accounts; use crate::utils::ZkSyncStateGenerator; use criterion::{black_box, criterion_group, Bencher, BenchmarkId, Criterion}; use num::BigUint; use zksync_circuit::witness::{utils::SigDataInput, Witnes...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/zksync", "path": "/core/lib/circuit/benches/criterion/transfer.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Measures the time of trasfer calculate operations fn transfer_calculate_operations(b: &mut Bencher<'_>) { let accounts = generate_accounts(10); let account_from = &accounts[0]; let account_to = &accounts[0]; let transfer_op = TransferOp { tx: account_from .zksync_ac...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/zksync", "path": "/core/lib/circuit/benches/criterion/transfer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let witness = TransferWitnessBn256::apply_tx(&mut circuit_account_tree, &transfer_op); let input = SigDataInput::from_transfer_op(&transfer_op).expect("SigDataInput creation failed"); let setup = || (input.clone()); b.iter_with_setup(setup, |input| { let _ops = black_box(witness.ca...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/zksync", "path": "/core/lib/circuit/benches/criterion/transfer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MiyamonY/atcoder path: /abc/080/c/02/main.rs use std::cmp::max; use std::io::*; use std::str::FromStr; use std::vec::Vec; fn read<T: FromStr>() -> T { let stdin = stdin(); let stdin = stdin.lock(); let token: String = stdin .bytes() .map(|c| c.expect("failed to read ...
code_fim
medium
{ "lang": "rust", "repo": "MiyamonY/atcoder", "path": "/abc/080/c/02/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut ps: Vec<Vec<i64>> = Vec::new(); for i in 0..n { ps.push(Vec::new()); for _ in 0..11 { ps[i].push(read()) } } let ans = (1..1 << 10) .map(|pat| (0..n).map(|j| ps[j][open_num(pat, &fs[j])]).sum()) .fold(-1 << 60, max); println...
code_fim
hard
{ "lang": "rust", "repo": "MiyamonY/atcoder", "path": "/abc/080/c/02/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use std::prelude::v1::*; use std::sync::{Arc, SgxMutex}; extern crate rand; extern crate sgx_rand; extern crate rustc_serialize as serialize; extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; extern crate prost; extern crate prost_types; extern crate bytes; extern crat...
code_fim
medium
{ "lang": "rust", "repo": "samuel199-creator/hello-rust", "path": "/enclave/some_algo/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: samuel199-creator/hello-rust path: /enclave/some_algo/src/lib.rs #![allow(non_snake_case)] #![allow(non_camel_case_types)] #![allow(dead_code)] <|fim_suffix|>extern crate prost; extern crate prost_types; extern crate bytes; extern crate anyhow; extern crate mio; use anyhow::Result; pub(crate)...
code_fim
hard
{ "lang": "rust", "repo": "samuel199-creator/hello-rust", "path": "/enclave/some_algo/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SkiFire13/rust-bheap-bench path: /src/hole.rs #![allow(unused_unsafe)] use std::mem::ManuallyDrop; use std::ptr; pub(crate) struct Hole<'a, T: 'a> { data: &'a mut [T], elt: ManuallyDrop<T>, pos: usize, } <|fim_suffix|> #[inline] pub(crate) fn pos(&self) -> usize { s...
code_fim
hard
{ "lang": "rust", "repo": "SkiFire13/rust-bheap-bench", "path": "/src/hole.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] pub(crate) fn pos(&self) -> usize { self.pos } #[inline] pub(crate) fn element(&self) -> &T { &self.elt } #[inline] pub(crate) unsafe fn get(&self, index: usize) -> &T { debug_assert!(index != self.pos); debug_assert!(index < self...
code_fim
hard
{ "lang": "rust", "repo": "SkiFire13/rust-bheap-bench", "path": "/src/hole.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aditya-konarde/cincinnati path: /graph-builder/src/main.rs // Copyright 2018 Alex Crawford // // 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.apa...
code_fim
hard
{ "lang": "rust", "repo": "aditya-konarde/cincinnati", "path": "/graph-builder/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let state = graph::State::new(opts.mandatory_client_parameters.clone()); let addr = (opts.address, opts.port); let app_prefix = opts.path_prefix.clone(); { let state = state.clone(); thread::spawn(move || graph::run(&opts, &state)); } server::new(move || { ...
code_fim
hard
{ "lang": "rust", "repo": "aditya-konarde/cincinnati", "path": "/graph-builder/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: siler/sled path: /crates/sled/src/materializer.rs use std::sync::Mutex; use super::*; #[derive(Debug)] pub(crate) struct BLinkMaterializer { pub(super) recovery: Mutex<Recovery>, config: Config, } impl Materializer for BLinkMaterializer { type PageFrag = Frag; // a vector of ...
code_fim
hard
{ "lang": "rust", "repo": "siler/sled", "path": "/crates/sled/src/materializer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn size_in_bytes(&self, frag: &Frag) -> usize { match *frag { Frag::Base(ref node, _prev_root) => { std::mem::size_of::<Frag>() .saturating_add(node.size_in_bytes() as usize) } _ => std::mem::size_of::<Frag>(), } ...
code_fim
hard
{ "lang": "rust", "repo": "siler/sled", "path": "/crates/sled/src/materializer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tiffany352/sodiumoxide path: /src/newtype_macros.rs macro_rules! newtype_clone (($newtype:ident) => ( impl Clone for $newtype { fn clone(&self) -> $newtype { let &$newtype(v) = self; $newtype(v) } } )); macro_rules...
code_fim
hard
{ "lang": "rust", "repo": "tiffany352/sodiumoxide", "path": "/src/newtype_macros.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let &$newtype(ref b) = self; b.index(_index) } } /// Allows a user to access the byte contents of an object as a slice. /// /// WARNING: it might be tempting to do comparisons on objects /// by using `x[] == y[]`. This will open up for timing attacks ...
code_fim
hard
{ "lang": "rust", "repo": "tiffany352/sodiumoxide", "path": "/src/newtype_macros.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: elpassion/advent_of_code path: /day_1/src/main.rs use std::fs::File; use std::io::prelude::*; fn main() { let filename = "input.txt"; println!("In file {}", filename); let mut f = File::open(filename).expect("file not found"); let mut contents = String::new(); f.read_to_st...
code_fim
hard
{ "lang": "rust", "repo": "elpassion/advent_of_code", "path": "/day_1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(4, adder(String::from("1111"))); } #[test] fn test_1234() { assert_eq!(0, adder(String::from("1234"))); } #[test] fn test_91212129() { assert_eq!(9, adder(String::from("91212129"))); } }<|fim_prefix|>// repo: elpassion/advent_of_code path: /day_1...
code_fim
hard
{ "lang": "rust", "repo": "elpassion/advent_of_code", "path": "/day_1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_1122() { assert_eq!(3, adder(String::from("1122"))); } #[test] fn test_1111() { assert_eq!(4, adder(String::from("1111"))); } #[test] fn test_1234() { assert_eq!(0, adder(String::from("1234"))); } #[test] fn test_91212129() {...
code_fim
hard
{ "lang": "rust", "repo": "elpassion/advent_of_code", "path": "/day_1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Base address, each channel is offset by 0x100 pub const PADDR: u64 = MMIO_BASE + 0x0000_7000; pub const CHANNEL0_OFFSET: u64 = 0x000; pub const CHANNEL1_OFFSET: u64 = 0x100; pub const CHANNEL2_OFFSET: u64 = 0x200; pub const CHANNEL3_OFFSET: u64 = 0x300; pub const CHANNEL4_OFFSET: u64 = 0x400; pub con...
code_fim
hard
{ "lang": "rust", "repo": "jonlamb-gh/rpi3-rust-fel4-workspace", "path": "/bcm2837/src/dma.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jonlamb-gh/rpi3-rust-fel4-workspace path: /bcm2837/src/dma.rs use super::MMIO_BASE; use core::ops::Deref; use register::mmio::{ReadOnly, ReadWrite}; register_bitfields! { u32, /// Control and status CS [ ACTIVE OFFSET(0) NUMBITS(1) [], END OFFSET(1) NUMBITS(1) [], ...
code_fim
hard
{ "lang": "rust", "repo": "jonlamb-gh/rpi3-rust-fel4-workspace", "path": "/bcm2837/src/dma.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tomaka/winapi-rs path: /lib/comdlg32-sys/src/lib.rs // Copyright © 2015, Peter Atashian // Licensed under the MIT License <LICENSE.md> //! FFI bindings to comdlg32. #![cfg(windows)] extern crate winapi; use winapi::*; extern "system" { pub fn ChooseColorA(lpcc: LPCHOOSECOLORA) -> BOOL; p...
code_fim
hard
{ "lang": "rust", "repo": "tomaka/winapi-rs", "path": "/lib/comdlg32-sys/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>psd: LPPAGESETUPDLGW) -> BOOL; pub fn PrintDlgA(pPD: LPPRINTDLGA) -> BOOL; pub fn PrintDlgExA(pPD: LPPRINTDLGEXA) -> HRESULT; pub fn PrintDlgExW(pPD: LPPRINTDLGEXW) -> HRESULT; pub fn PrintDlgW(pPD: LPPRINTDLGW) -> BOOL; pub fn ReplaceTextA(lpfr: LPFINDREPLACEA) -> HWND; pub fn Rep...
code_fim
hard
{ "lang": "rust", "repo": "tomaka/winapi-rs", "path": "/lib/comdlg32-sys/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jmpesp/advent-of-code-2019 path: /src/bin/day04.rs fn pass(input: usize) -> bool { let input_s = format!("{}", input); // Two adjacent digits are the same let mut adjacent_the_same = false; for i in 0..(input_s.len() - 1) { let a = input_s.chars().nth(i + 0).unwrap(); ...
code_fim
medium
{ "lang": "rust", "repo": "jmpesp/advent-of-code-2019", "path": "/src/bin/day04.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert!(!pass(123789)); } fn main() { let mut count = 0; for i in 235741..(706948 + 1) { if pass(i) { count = count + 1; } } println!("{}", count); }<|fim_prefix|>// repo: jmpesp/advent-of-code-2019 path: /src/bin/day04.rs fn pass(input: usize) -> bool { ...
code_fim
medium
{ "lang": "rust", "repo": "jmpesp/advent-of-code-2019", "path": "/src/bin/day04.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: abesto/rktrl path: /src/systems/prelude.rs pub use bracket_lib::prelude::*; pub use legion::{ query::component, system, systems::Comm<|fim_suffix|>eanup::{DeferredCleanup, DeferredCleanupHelper}, util::{vector::*, world_ext::WorldExt}, };<|fim_middle|>andBuffer, world::SubWorld, Entity, ...
code_fim
medium
{ "lang": "rust", "repo": "abesto/rktrl", "path": "/src/systems/prelude.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>eanup::{DeferredCleanup, DeferredCleanupHelper}, util::{vector::*, world_ext::WorldExt}, };<|fim_prefix|>// repo: abesto/rktrl path: /src/systems/prelude.rs pub use bracket_lib::prelude::*; pub use legion::{ query::component, system, systems::Comm<|fim_middle|>andBuffer, world::SubWorld, Entity, ...
code_fim
medium
{ "lang": "rust", "repo": "abesto/rktrl", "path": "/src/systems/prelude.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> cause_and_effect::*, components::*, resources::{Input, *}, systems::entity_cleanup::{DeferredCleanup, DeferredCleanupHelper}, util::{vector::*, world_ext::WorldExt}, };<|fim_prefix|>// repo: abesto/rktrl path: /src/systems/prelude.rs pub use bracket_lib::prelude::*; pub use legion::{...
code_fim
medium
{ "lang": "rust", "repo": "abesto/rktrl", "path": "/src/systems/prelude.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> is_invalid_query( request() .method("GET") .path("/v3/streams_report") .reply(&api) .await, ); is_invalid_query( request() .method("GET") .path("/v3/streams_report?foo=bar") .reply(&api) ...
code_fim
hard
{ "lang": "rust", "repo": "Takayamashi/HoloStats", "path": "/server/holostats-api/v3/tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Takayamashi/HoloStats path: /server/holostats-api/v3/tests.rs use bytes::Bytes; use holostats_database::Database; use pretty_assertions::assert_eq; use serde::Serialize; use serde_json::to_string; use warp::http::{header::CONTENT_TYPE, Response, StatusCode}; use warp::test::request; use warp::Fi...
code_fim
hard
{ "lang": "rust", "repo": "Takayamashi/HoloStats", "path": "/server/holostats-api/v3/tests.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: igor-petruk/rcsv path: /rcsv.rs extern mod extra; use std::io::*; use self::extra::sort::*; use self::extra::getopts::*; use std::os; mod regex; #[deriving(Eq, Clone)] struct SortableLine<T>{ comparable_part: T, line: ~str } impl <T:Ord> Ord for SortableLine<T>{ fn lt(&self, other: &Sorta...
code_fim
hard
{ "lang": "rust", "repo": "igor-petruk/rcsv", "path": "/rcsv.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // let numeric = matches.opt_present("g"); // let ignore_case = matches.opt_present("f"); // let reverse = matches.opt_present("r"); // let unique = matches.opt_present("u"); // println(fmt!("%? %? %? %?", numeric, ignore_case, reverse, unique)); // while (!stdin().eof()){ // let ...
code_fim
hard
{ "lang": "rust", "repo": "igor-petruk/rcsv", "path": "/rcsv.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //b let mut lines: ~[~SortableLine<~str>] = ~[]; // let args = os::args(); // let opts = ~[ // optflag("g"), // optflag("f"), // optflag("r"), // optflag("u") // // optflag("help") // ]; // let matches = match getopts(args.tail(), opts) { /...
code_fim
hard
{ "lang": "rust", "repo": "igor-petruk/rcsv", "path": "/rcsv.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } Opcode::LogicalAnd => { let r1 = self.stack.pop_bool(&self.state)?; let r2 = self.stack.pop_bool(&self.state)?; self.stack.push_bool(r1 && r2); self.incr_pc(); Ok(true) } Opcode::LogicalOr => { let r1 = self.stack.pop_bool(&self.state)?; let...
code_fim
hard
{ "lang": "rust", "repo": "dysquard/arb-os", "path": "/src/run/emulator.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dysquard/arb-os path: /src/run/emulator.rs ack is empty returns an /// `ExecutionError`. pub fn pop(&mut self, state: &MachineState) -> Result<Value, ExecutionError> { match self.contents.pop_back() { Some(v) => Ok(v), None => Err(ExecutionError::new("stac...
code_fim
hard
{ "lang": "rust", "repo": "dysquard/arb-os", "path": "/src/run/emulator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dysquard/arb-os path: /src/run/emulator.rs MachineState) -> Result<Value, ExecutionError> { match self.contents.pop_back() { Some(v) => Ok(v), None => Err(ExecutionError::new("stack underflow", state, None)), } } ///If the top `Value` on the stack...
code_fim
hard
{ "lang": "rust", "repo": "dysquard/arb-os", "path": "/src/run/emulator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let _ = writeln!( content, " {:>rank_len$} | {:^len1$} | {:^len2$} | {:^len3$}", "Badges>", badges[0].0, badges[1].0, badges[2].0, rank_len = rank_len...
code_fim
hard
{ "lang": "rust", "repo": "JoshiDhima/Bathbot", "path": "/src/embeds/osu/bws.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JoshiDhima/Bathbot path: /src/embeds/osu/bws.rs use crate::{embeds::Author, util::numbers::with_comma_int}; use hashbrown::HashSet; use rosu_v2::model::user::User; use std::{collections::BTreeMap, fmt::Write, iter, mem}; pub struct BWSEmbed { description: String, title: String, thu...
code_fim
hard
{ "lang": "rust", "repo": "JoshiDhima/Bathbot", "path": "/src/embeds/osu/bws.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> content.push_str("```"); content } None => { let bws1 = with_comma_int(bws(stats.global_rank, badges[0].0)).to_string(); let bws2 = with_comma_int(bws(stats.global_rank, badges[1].0)).to_string(); let ...
code_fim
hard
{ "lang": "rust", "repo": "JoshiDhima/Bathbot", "path": "/src/embeds/osu/bws.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>HINT : usize = 4 ; const MIME_TYPE : & ' static str = " text / plain ; charset = utf - 8 " ; } impl fmt : : Display for Test { # [ inline ] fn fmt ( & self f : & mut fmt : : Formatter < ' _ > ) - > fmt : : Result { self . render_into ( f ) . map_err ( | _ | fmt : : Error { } ) } } fn render ( t : & dyn Dy...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/askama/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified-and-comments-removed path: /third_party/rust/askama/src/lib.rs # ! [ forbid ( unsafe_code ) ] # ! [ deny ( elided_lifetimes_in_paths ) ] # ! [ deny ( unreachable_pub ) ] mod error ; pub mod filters ; pub mod helpers ; use std : : fmt ; pub use askama_derive : : Templa...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/askama/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> impl ICU4XPluralOperands { /// Construct for a given string representing a number #[diplomat::rust_link(icu::plurals::PluralOperands::from_str, FnInStruct)] pub fn create_from_string(s: &str) -> Result<Box<ICU4XPluralOperands>, ICU4XError> { let s = s.as_bytes(); //...
code_fim
hard
{ "lang": "rust", "repo": "mozilla/gecko-dev", "path": "/third_party/rust/icu_capi/src/pluralrules.rs", "mode": "spm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_suffix|> /// Get all of the categories needed in the current locale #[diplomat::rust_link(icu::plurals::PluralRules::categories, FnInStruct)] pub fn categories(&self) -> ICU4XPluralCategories { self.0.categories().fold( ICU4XPluralCategories { ...
code_fim
hard
{ "lang": "rust", "repo": "mozilla/gecko-dev", "path": "/third_party/rust/icu_capi/src/pluralrules.rs", "mode": "spm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mozilla/gecko-dev path: /third_party/rust/icu_capi/src/pluralrules.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 ). #[diplomat::bridge] pub...
code_fim
hard
{ "lang": "rust", "repo": "mozilla/gecko-dev", "path": "/third_party/rust/icu_capi/src/pluralrules.rs", "mode": "psm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_prefix|>// repo: verrchu/poker-lib path: /src/card/rank.rs use std::hash::Hash; #[derive(Debug, Clone, Copy, PartialEq, PartialOrd, Eq, Ord, Hash)] pub enum Rank { Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten, Jack, Queen, King, Ace, } impl Rank { ...
code_fim
hard
{ "lang": "rust", "repo": "verrchu/poker-lib", "path": "/src/card/rank.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let lhs = Rank::Jack; assert_gt!(lhs, Rank::Two); assert_gt!(lhs, Rank::Three); assert_gt!(lhs, Rank::Four); assert_gt!(lhs, Rank::Five); assert_gt!(lhs, Rank::Six); assert_gt!(lhs, Rank::Seven); assert_gt!(lhs, Rank::Eight); assert_...
code_fim
hard
{ "lang": "rust", "repo": "verrchu/poker-lib", "path": "/src/card/rank.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> NAME } } #[async_trait] impl Ensurable for Docker { async fn is_present(&self) -> Result<bool> { is_binary_present(self).await } async fn make_present(&self) -> Result<()> { Command::new("curl") .arg("-fsSL") .arg("https://get....
code_fim
medium
{ "lang": "rust", "repo": "twitchax/kfpl", "path": "/src/services/docker.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: twitchax/kfpl path: /src/services/docker.rs use tokio::process::Command; use anyhow::{Result, Context}; use async_trait::async_trait; use crate::{ services::model::{Nameable, Ensurable, is_binary_present}, helpers::ExitStatusIntoUnit }; <|fim_suffix|> async fn make_present(...
code_fim
hard
{ "lang": "rust", "repo": "twitchax/kfpl", "path": "/src/services/docker.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Command::new("rm") .arg("-f") .arg("get-docker.sh") .status().await .status_to_unit() .context("Failed to delete the docker install script.")?; Ok(()) } }<|fim_prefix|>// repo: twitchax/kfpl path: /src/services/dock...
code_fim
hard
{ "lang": "rust", "repo": "twitchax/kfpl", "path": "/src/services/docker.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: giancarloC/AdventOfCode2020 path: /day4/src/part1.rs use std::io::{self, BufReader}; use std::io::prelude::*; use std::fs::File; pub fn get_result(){ match count_passports() { Ok(num) => print_answer(num), Err(_e) => println!("Incorrect Input"), } } <|fim_suffix|> le...
code_fim
hard
{ "lang": "rust", "repo": "giancarloC/AdventOfCode2020", "path": "/day4/src/part1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: samurailobster/rust-blockchain-1 path: /protocol/src/payload/register/peer_registering.rs use payload::{Parser, Payload, PayloadBuilder}; /// Model for the event `PeerRegistering` /// /// ``` /// // 00 01 02 03 04 05 06 07 08 09 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31...
code_fim
hard
{ "lang": "rust", "repo": "samurailobster/rust-blockchain-1", "path": "/protocol/src/payload/register/peer_registering.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use payload::Parser; #[test] fn test_building_and_parsing() { let addr = String::from("172.0.0.1"); let peer_registering = PeerRegisteringPayload { addr: addr.clone() }; let peer_registering = peer_regist...
code_fim
hard
{ "lang": "rust", "repo": "samurailobster/rust-blockchain-1", "path": "/protocol/src/payload/register/peer_registering.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: net3f/polkadot-tests path: /adapters/substrate/src/host_api/allocator.rs use crate::host_api::utils::{str, ParsedInput, Runtime}; use parity_scale_codec::Encode; /// The Wasm function tests both the allocation and freeing of the buffer pub fn ext_allocator_malloc_version_1(mut rtm: Runtime, inp...
code_fim
medium
{ "lang": "rust", "repo": "net3f/polkadot-tests", "path": "/adapters/substrate/src/host_api/allocator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{}", str(&res)); } pub fn ext_allocator_free_version_1(rtm: Runtime, input: ParsedInput) { ext_allocator_malloc_version_1(rtm, input) }<|fim_prefix|>// repo: net3f/polkadot-tests path: /adapters/substrate/src/host_api/allocator.rs use crate::host_api::utils::{str, ParsedInput, Runtime}...
code_fim
medium
{ "lang": "rust", "repo": "net3f/polkadot-tests", "path": "/adapters/substrate/src/host_api/allocator.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alberthuang24/kube-rust path: /crates/kubernetes-client/src/models/v1_scope_selector.rs /* * Kubernetes * * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) * * The version of the OpenAPI document: v1.21.1 * * Generated by: https:...
code_fim
medium
{ "lang": "rust", "repo": "alberthuang24/kube-rust", "path": "/crates/kubernetes-client/src/models/v1_scope_selector.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl V1ScopeSelector { /// A scope selector represents the AND of the selectors represented by the scoped-resource selector requirements. pub fn new() -> V1ScopeSelector { V1ScopeSelector { match_expressions: None, } } }<|fim_prefix|>// repo: alberthuang24/kube-rust...
code_fim
hard
{ "lang": "rust", "repo": "alberthuang24/kube-rust", "path": "/crates/kubernetes-client/src/models/v1_scope_selector.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct V1ScopeSelector { /// A list of scope selector requirements by scope of the resources. #[serde(rename = "matchExpressions", skip_serializing_if = "Option::is_none")] pub match_expressions: Option<Vec<crate::models::V1Scoped...
code_fim
medium
{ "lang": "rust", "repo": "alberthuang24/kube-rust", "path": "/crates/kubernetes-client/src/models/v1_scope_selector.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Corallus-Caninus/windows-rs path: /crates/deps/sys/src/Windows/Security/Cryptography/Core/mod.rs #![allow(non_snake_case, non_camel_case_types, non_upper_case_globals, clashing_extern_declarations, clippy::all)] #[link(name = "windows")] extern "system" {} pub type AsymmetricKeyAlgorithmProvider...
code_fim
hard
{ "lang": "rust", "repo": "Corallus-Caninus/windows-rs", "path": "/crates/deps/sys/src/Windows/Security/Cryptography/Core/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> *self } } pub type EncryptedAndAuthenticatedData = *mut ::core::ffi::c_void; pub type HashAlgorithmProvider = *mut ::core::ffi::c_void; pub type KeyDerivationAlgorithmProvider = *mut ::core::ffi::c_void; pub type KeyDerivationParameters = *mut ::core::ffi::c_void; pub type MacAlgorithmProvider...
code_fim
hard
{ "lang": "rust", "repo": "Corallus-Caninus/windows-rs", "path": "/crates/deps/sys/src/Windows/Security/Cryptography/Core/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &mut self, lp: &mut LayerPack, path_array: Vec<path::Pos>, ) -> Vec<path::Pos> { let mut path_array_downstr = Vec::new(); for n in path_array.windows(2) { let i0 = n[0].0; let j0 = n[0].1; let i1 = n[1].0; let j1 = n[1].1; let index_downstr = lp.xy.ind(i1, j1); let index_curre...
code_fim
hard
{ "lang": "rust", "repo": "nicholasguan/pglowrpg", "path": "/apps/worldgen/src/layer_ops/river_mapping/width_ops.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nicholasguan/pglowrpg path: /apps/worldgen/src/layer_ops/river_mapping/width_ops.rs use crate::layer_ops::river_mapping::{RgParams, RiverEntry}; use codec::LayerPack; use constants_world::*; impl RgParams { pub fn map_width( &mut self, lp: &mut LayerPack, ) { //Must be cloned let widt...
code_fim
hard
{ "lang": "rust", "repo": "nicholasguan/pglowrpg", "path": "/apps/worldgen/src/layer_ops/river_mapping/width_ops.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut count = 0; loop { count += 1; println!("count: {}", count); if count >= 10 { break; } } } fn do_while() { let mut count = 0; while count <= 10 { println!("count: {}", count); count += 1; } } fn do_for() { l...
code_fim
medium
{ "lang": "rust", "repo": "yszk0123-sandbox/hello_rust", "path": "/projects/loops/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn do_while() { let mut count = 0; while count <= 10 { println!("count: {}", count); count += 1; } } fn do_for() { let items = [10, 20, 30]; for item in items.iter() { println!("item: {}", item); } }<|fim_prefix|>// repo: yszk0123-sandbox/hello_rust path...
code_fim
medium
{ "lang": "rust", "repo": "yszk0123-sandbox/hello_rust", "path": "/projects/loops/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yszk0123-sandbox/hello_rust path: /projects/loops/src/main.rs fn main() { println!("[Loop]"); do_loop(); println!("[While]"); do_while(); println!("[For]"); do_for(); } fn do_loop() { let mut count = 0; loop { count += 1; println!("count: {}", ...
code_fim
medium
{ "lang": "rust", "repo": "yszk0123-sandbox/hello_rust", "path": "/projects/loops/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>macro_rules! gen_include_optional_macro { ( $new_macro:ident! using $original_macro:ident! with example file ending $ending:literal ) => { gen_include_optional_macro!( $new_macro! using $original_macro! with example file ending $e...
code_fim
hard
{ "lang": "rust", "repo": "lyricwulf/include_optional", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lyricwulf/include_optional path: /src/lib.rs #![deny(clippy::pedantic)] #![deny(clippy::cargo)] #![deny(clippy::nursery)] #![feature(proc_macro_span, path_try_exists)] #![doc = include_str!("../README.md")] use proc_macro::TokenStream; use quote::{quote, quote_spanned}; use std::path::PathBuf; ...
code_fim
hard
{ "lang": "rust", "repo": "lyricwulf/include_optional", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: syrupofplum/rustcommon path: /src/redisaccessor_actix.rs use actix::prelude::*; use actix_redis::{Command, RedisActor, Error}; use redis_async::{resp::RespValue, resp_array}; use crate::redisaccessor::{RedisAccessorError, RedisAccessorErrorType, RedisAccessor}; macro_rules! check_conn_open { ...
code_fim
hard
{ "lang": "rust", "repo": "syrupofplum/rustcommon", "path": "/src/redisaccessor_actix.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn user(mut self, user: &'a str) -> Self { self.user = user; self } pub fn passwd(mut self, passwd: &'a str) -> Self { self.passwd = passwd; self } pub fn db(mut self, db: i64) -> Self { self.db = db; self } pub fn open_con...
code_fim
hard
{ "lang": "rust", "repo": "syrupofplum/rustcommon", "path": "/src/redisaccessor_actix.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danielgallagher0/bluetooth-hci path: /src/host/uart.rs //! Implementation of the HCI that includes the packet ID byte in the header. extern crate nb; use byteorder::{ByteOrder, LittleEndian}; const PACKET_TYPE_HCI_COMMAND: u8 = 0x01; // const PACKET_TYPE_ACL_DATA: u8 = 0x02; // const PACKET_T...
code_fim
hard
{ "lang": "rust", "repo": "danielgallagher0/bluetooth-hci", "path": "/src/host/uart.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn read_event<E, T, Vendor, VE>( controller: &mut T, ) -> nb::Result<crate::Event<Vendor>, Error<E, VE>> where T: crate::Controller<Error = E>, Vendor: crate::event::VendorEvent<Error = VE>, { const MAX_EVENT_LENGTH: usize = 255; const PACKET_HEADER_LENGTH: usize = 1; const EVENT_P...
code_fim
hard
{ "lang": "rust", "repo": "danielgallagher0/bluetooth-hci", "path": "/src/host/uart.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: djedou/djed_maths path: /src/sets/types.rs #[derive(Debug, PartialEq)] pub enum Inclusion<T><|fim_suffix|> Complement<T> { Value(Vec<T>), NotAllowed }<|fim_middle|> { ProperlyIncluded, NotIncluded(Vec<T>), NotAllowed } #[derive(Debug, PartialEq)] pub enum
code_fim
medium
{ "lang": "rust", "repo": "djedou/djed_maths", "path": "/src/sets/types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Complement<T> { Value(Vec<T>), NotAllowed }<|fim_prefix|>// repo: djedou/djed_maths path: /src/sets/types.rs #[derive(Debug, PartialEq)] pub enum Inclusion<T><|fim_middle|> { ProperlyIncluded, NotIncluded(Vec<T>), NotAllowed } #[derive(Debug, PartialEq)] pub enum
code_fim
medium
{ "lang": "rust", "repo": "djedou/djed_maths", "path": "/src/sets/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bytebuddha/xi-term path: /src/components/editor/actions.rs use futures::Future; use super::Editor; use core::ActionHandler; use actions::EditorAction; use components::{ EditorResponse, Message }; <|fim_suffix|> fn perform_action(&mut self, action: EditorAction) -> Self::Output { mat...
code_fim
hard
{ "lang": "rust", "repo": "bytebuddha/xi-term", "path": "/src/components/editor/actions.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match action { EditorAction::View(action) => { if let Some(view) = self.views.get_mut(&self.current_view) { From::from(view.perform_action(action)) } else { EditorResponse::Continue } },...
code_fim
hard
{ "lang": "rust", "repo": "bytebuddha/xi-term", "path": "/src/components/editor/actions.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vgao1996/libra path: /consensus/src/util/mutex_map.rs use futures::compat::Future01CompatExt; use std::{ collections::HashMap, hash::Hash, sync::{self, Arc}, }; type AsyncMutex = futures_locks::Mutex<()>; impl<T> Drop for MutexMapGuard<T> where T: Hash + Eq + Clone, { fn dr...
code_fim
hard
{ "lang": "rust", "repo": "vgao1996/libra", "path": "/consensus/src/util/mutex_map.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn guard_dropped(&self, key: &T) { let mut map = self.0.lock().unwrap(); // This is a bit obscure, but we have to remove mutex from map before we can try // to unwrap it. If unwrap fails(pending references exist), we put mutex back into map // Since we are holding lock ...
code_fim
hard
{ "lang": "rust", "repo": "vgao1996/libra", "path": "/consensus/src/util/mutex_map.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yuchennil/primes path: /src/wheel.rs use std::cmp; use crate::constants::SEGMENT_LENGTH; use crate::origin::Origin; use crate::segment::WheelSegment; /// Iterate through wheel_segment within [segment_start, segment_end) /// /// When primes in this WheelSegment run out: /// 1) If this reaches t...
code_fim
hard
{ "lang": "rust", "repo": "yuchennil/primes", "path": "/src/wheel.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Sieve the next segment, consuming and returning self pub fn advance_segment(mut self) -> Self { self.segment_start = self.segment_end; self.segment_end = cmp::min(self.segment_start + SEGMENT_LENGTH, self.end); self.wheel_segment = WheelSegment::new(&self.ori...
code_fim
hard
{ "lang": "rust", "repo": "yuchennil/primes", "path": "/src/wheel.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pcsm/coremidi path: /src/entity.rs use coremidi_sys::MIDIObjectRef; use std::ops::Deref; use crate::object::Object; <|fim_suffix|>impl From<Object> for Entity { fn from(object: Object) -> Self { Self::new(object.0) } } impl From<Entity> for Object { fn from(entity: Entity)...
code_fim
hard
{ "lang": "rust", "repo": "pcsm/coremidi", "path": "/src/entity.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self::new(object.0) } } impl From<Entity> for Object { fn from(entity: Entity) -> Self { entity.object } }<|fim_prefix|>// repo: pcsm/coremidi path: /src/entity.rs use coremidi_sys::MIDIObjectRef; use std::ops::Deref; use crate::object::Object; /// A [MIDI object](https://d...
code_fim
hard
{ "lang": "rust", "repo": "pcsm/coremidi", "path": "/src/entity.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("cargo:rustc-link-search=/usr/local/lib"); println!("cargo:rustc-link-lib=static=flatbuffers"); println!("cargo:rerun-if-changed={}", &schema); println!("Output directory: {}", &out_dir); }<|fim_prefix|>// repo: cocagne/aspen-server path: /build.rs use std::process::Command; use ...
code_fim
medium
{ "lang": "rust", "repo": "cocagne/aspen-server", "path": "/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cocagne/aspen-server path: /build.rs use std::process::Command; use std::env; fn main() { let out_dir = env::var("OUT_DIR").unwrap(); <|fim_suffix|> Command::new("flatc").args(&["--rust", "-o", "src", schema]) .status().unwrap(); println!("cargo:rustc-link-se...
code_fim
easy
{ "lang": "rust", "repo": "cocagne/aspen-server", "path": "/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let paperspace = Paperspace::new( &String::from(options.value_of("token").unwrap()) ); thread::spawn(move || { paperspace.run(ps_rx, ui_tx); }); let mut ui = Ui::new(ui_rx, ps_tx); ui.run(); }<|fim_prefix|>// repo: tallyw00d/paperpi path: /src/main.rs extern crat...
code_fim
medium
{ "lang": "rust", "repo": "tallyw00d/paperpi", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tallyw00d/paperpi path: /src/main.rs extern crate cursive; extern crate reqwest; #[macro_use] extern crate serde_derive; extern crate serde; extern crate serde_json; #[macro_use] extern crate serializable_enum; extern crate clap; extern crate crossbeam_channel; mod ui; mod paperspace; use std:...
code_fim
medium
{ "lang": "rust", "repo": "tallyw00d/paperpi", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn parse_err() { for i in 0b0000_1000..=0b1111_1111 { assert_eq!(InstructionJumpCondition::try_from(i), Err(())); } }<|fim_prefix|>// repo: LoungeCPP/pir-8-emu path: /tests/isa/instruction/instruction_jump_condition/mod.rs use pir_8_emu::isa::instruction::InstructionJumpCondition;...
code_fim
medium
{ "lang": "rust", "repo": "LoungeCPP/pir-8-emu", "path": "/tests/isa/instruction/instruction_jump_condition/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LoungeCPP/pir-8-emu path: /tests/isa/instruction/instruction_jump_condition/mod.rs use pir_8_emu::isa::instruction::InstructionJumpCondition; use std::convert::TryFrom; mod is_satisfied; mod serialise; mod parse_ok; mod display; <|fim_suffix|> for i in 0b0000_1000..=0b1111_1111 { a...
code_fim
easy
{ "lang": "rust", "repo": "LoungeCPP/pir-8-emu", "path": "/tests/isa/instruction/instruction_jump_condition/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0b0000_1000..=0b1111_1111 { assert_eq!(InstructionJumpCondition::try_from(i), Err(())); } }<|fim_prefix|>// repo: LoungeCPP/pir-8-emu path: /tests/isa/instruction/instruction_jump_condition/mod.rs use pir_8_emu::isa::instruction::InstructionJumpCondition; use std::convert::TryFro...
code_fim
medium
{ "lang": "rust", "repo": "LoungeCPP/pir-8-emu", "path": "/tests/isa/instruction/instruction_jump_condition/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/connectivity/lowpan/service/src/service.rs onnectorRequestStream, MeshcopConnectorRequest, MeshcopConnectorRequestStream, TelemetryProviderConnectorRequest, TelemetryProviderConnectorRequestStream, MAX_LOWPAN_DEVICES, }; use lowpan_driver_common::{AsyncConditi...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/connectivity/lowpan/service/src/service.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> // Devices have been added or removed, let's sort them out. // Calculate devices added. // This mechanism is O(n^2), but in reality n is going to // almost always be 1---so it makes sense to pr...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/connectivity/lowpan/service/src/service.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/connectivity/lowpan/service/src/service.rs >, pub devices_factory: Arc<Mutex<HashMap<String, FactoryDriverProxy>>>, pub added_removed_cond: Arc<AsyncCondition>, pub spawner: S, } impl<S: Spawn> LowpanService<S> { pub fn with_spawner(spawner: S) -> Low...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/connectivity/lowpan/service/src/service.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jeffparsons/grit-rs path: /git-pack/src/data/file/mod.rs /// pub mod decode_entry; mod init; /// pub mod verify; /// A return value of a resolve function, which given an [`ObjectId`][git_hash::ObjectId] determines where an object can be <|fim_suffix|>icate an object is within this pack, at the ...
code_fim
medium
{ "lang": "rust", "repo": "jeffparsons/grit-rs", "path": "/git-pack/src/data/file/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>icate an object is within this pack, at the given entry, and thus can be looked up locally. InPack(crate::data::Entry), /// Indicates the object of `kind` was found outside of the pack, and its data was written into an output /// vector which now has a length of `end`. #[allow(missing_docs...
code_fim
medium
{ "lang": "rust", "repo": "jeffparsons/grit-rs", "path": "/git-pack/src/data/file/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn pop_u16(&mut self) -> u16 { (self.pop_u8() as u16) << 8 | self.pop_u8() as u16 } fn bc(&self) -> u16 { (self.reg_b as u16) << 8 | (self.reg_c as u16) } fn set_bc(&mut self, value: u16) { self.reg_b = (value >> 8) as u8; self.reg_c = (value & 0xFF) a...
code_fim
hard
{ "lang": "rust", "repo": "BronTron4k/Rust-Boy", "path": "/src/cpu.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BronTron4k/Rust-Boy path: /src/cpu.rs use super::mmu; pub struct Cpu { reg_a: u8, // Accumlator reg_f: RegFlag, // Flags // General Purpose reg_b: u8, reg_c: u8, reg_d: u8, reg_e: u8, reg_h: u8, reg_l: u8, reg_sp: u16, // Stack Pointer reg_pc: u16, ...
code_fim
hard
{ "lang": "rust", "repo": "BronTron4k/Rust-Boy", "path": "/src/cpu.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn de(&self) -> u16 { (self.reg_d as u16) << 8 | (self.reg_e as u16) } fn set_de(&mut self, value: u16) { self.reg_d = (value >> 8) as u8; self.reg_e = (value & 0xFF) as u8; } fn hl(&self) -> u16 { (self.reg_h as u16) << 8 | (self.reg_l as u16) } ...
code_fim
hard
{ "lang": "rust", "repo": "BronTron4k/Rust-Boy", "path": "/src/cpu.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> where A: Array<T> + Array<Self>; #[inline(always)] fn into_array_mut<A>(v: &mut <A as Array<Self>>::Type) -> &mut <A as Array<T>>::Type where A: Array<T> + Array<Self>; }<|fim_prefix|>// repo: Popog/beagle-rs path: /src/utils.rs use consts::Array; /// A trait to cast references back and...
code_fim
medium
{ "lang": "rust", "repo": "Popog/beagle-rs", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Popog/beagle-rs path: /src/utils.rs use consts::Array; /// A trait to cast references back and forth between types pub trait RefCast<T> { #[inline(always)] fn from_ref(v: &T) -> &Self; #[inline(always)] fn from_mut(v: &mut T) -> &mut Self; <|fim_suffix|> #[inline(always)] ...
code_fim
medium
{ "lang": "rust", "repo": "Popog/beagle-rs", "path": "/src/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danielpclark/rutie path: /src/rubysys/types.rs use crate::rubysys::libc::{intptr_t, uintptr_t}; pub use crate::rubysys::{ libc::{c_char, c_double, c_int, c_long, c_void, size_t, ssize_t}, typed_data::{RbDataType, RbDataTypeFunction}, value::{Value, ValueType}, }; <|fim_suffix|>pub ...
code_fim
hard
{ "lang": "rust", "repo": "danielpclark/rutie", "path": "/src/rubysys/types.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] pub struct RBasic { pub flags: InternalValue, pub klass: InternalValue, } #[repr(C)] pub enum st_retval { Continue, Stop, Delete, Check, Replace, }<|fim_prefix|>// repo: danielpclark/rutie path: /src/rubysys/types.rs use crate::rubysys::libc::{intptr_t, uintptr_t};...
code_fim
hard
{ "lang": "rust", "repo": "danielpclark/rutie", "path": "/src/rubysys/types.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: r2gnl/xaynet path: /rust/xaynet-analytics/src/data_combination/data_points/screen_enter_count.rs use crate::{ data_combination::data_points::data_point::{ CalcScreenEnterCount, CalculateDataPoints, DataPointMetadata, }, database::analytics_event::data_model::{...
code_fim
hard
{ "lang": "rust", "repo": "r2gnl/xaynet", "path": "/rust/xaynet-analytics/src/data_combination/data_points/screen_enter_count.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }