text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: crodnun/rust path: /conditional/src/main.rs fn main() { println!("Hello conditional statements!"); let done: bool = false; if done { println!("We are done!"); } else { println!("We are NOT done!"); } let counter = 5; <|fim_suffix|> let mut y = if x...
code_fim
hard
{ "lang": "rust", "repo": "crodnun/rust", "path": "/conditional/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn make_move(&self, next_move: String) -> Result<Game, MoveError> { match make_move_internal(self, next_move) { Ok(game) => Ok(game), Err(e) => Err(e) } } }<|fim_prefix|>// repo: goofballLogic/narmi-chess path: /src/game/game.rs use std::vec::*; use sup...
code_fim
medium
{ "lang": "rust", "repo": "goofballLogic/narmi-chess", "path": "/src/game/game.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: goofballLogic/narmi-chess path: /src/game/game.rs use std::vec::*; use super::game_state::*; use super::moving::*; pub struct Game { pub state: GameState, pub moves: Vec<String> } <|fim_suffix|> pub fn make_move(&self, next_move: String) -> Result<Game, MoveError> { match ma...
code_fim
medium
{ "lang": "rust", "repo": "goofballLogic/narmi-chess", "path": "/src/game/game.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Keats/validator path: /validator/src/types.rs use std::borrow::Cow; use std::collections::{hash_map::Entry::Vacant, BTreeMap, HashMap}; use serde::ser::Serialize; use serde_derive::{Deserialize, Serialize}; use serde_json::{to_value, Value}; #[derive(Debug, PartialEq, Clone, Serialize, Deseria...
code_fim
hard
{ "lang": "rust", "repo": "Keats/validator", "path": "/validator/src/types.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if errors.is_empty() { parent } else { parent.and_then(|_| Err(ValidationErrors::new())).map_err(|mut parent_errors| { parent_errors.add_nested(field, ValidationErrorsKind::List(errors)); parent_errors }) } } ...
code_fim
hard
{ "lang": "rust", "repo": "Keats/validator", "path": "/validator/src/types.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: illis/qml-rust path: /src/qlistmodel/qobjectrefmut.rs use qlistmodel::{QListModel, QListModelItem}; use qobject::{QObjectContent, QObjectRefMut}; <|fim_suffix|> QObjectRefMut::new(value.as_cref_mut()) } }<|fim_middle|>impl<'a, T, I> From<&'a mut QListModel<T, I>> for QObjectRefMut<'a...
code_fim
medium
{ "lang": "rust", "repo": "illis/qml-rust", "path": "/src/qlistmodel/qobjectrefmut.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> QObjectRefMut::new(value.as_cref_mut()) } }<|fim_prefix|>// repo: illis/qml-rust path: /src/qlistmodel/qobjectrefmut.rs use qlistmodel::{QListModel, QListModelItem}; use qobject::{QObjectContent, QObjectRefMut}; <|fim_middle|>impl<'a, T, I> From<&'a mut QListModel<T, I>> for QObjectRefMut<'a...
code_fim
medium
{ "lang": "rust", "repo": "illis/qml-rust", "path": "/src/qlistmodel/qobjectrefmut.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MarcoIeni/svdtools path: /src/patch/add.rs use crate::patch::patcher::Patcher; use anyhow::{anyhow, Result}; impl Patcher { pub fn add_peripherals(&mut self) -> Result<()> { let add = &self.yaml.commands.add; for (peripheral_name, peripheral) in add { let periphe...
code_fim
hard
{ "lang": "rust", "repo": "MarcoIeni/svdtools", "path": "/src/patch/add.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn expected_fields() -> Vec<svd::Field> { vec![expected_field_a(), expected_field_b()] .iter() .map(|f| svd::Field::Single(f.clone())) .collect() } fn expected_reg01() -> RegisterInfo { let mut rb: svd::registerinfo::RegisterInfoBuilder = De...
code_fim
hard
{ "lang": "rust", "repo": "MarcoIeni/svdtools", "path": "/src/patch/add.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut pb: svd::peripheral::PeripheralBuilder = Default::default(); pb = pb.name("CPUID".to_string()); pb = pb.description(Some("CPUID descr".to_string())); pb = pb.base_address(0xE000ED00); pb = pb.address_block(Some(svd::AddressBlock { offset: 0x0, ...
code_fim
hard
{ "lang": "rust", "repo": "MarcoIeni/svdtools", "path": "/src/patch/add.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>; // Aligned Allocation pub fn mi_malloc_aligned(size: size_t, alignment: size_t) -> *mut c_void; pub fn mi_zalloc_aligned(size: size_t, alignment: size_t) -> *mut c_void; pub fn mi_realloc_aligned(p: *const c_void, newsize: size_t, alignment: size_t) -> *mut c_void; }<|fim_prefix|>// rep...
code_fim
medium
{ "lang": "rust", "repo": "wusyong/mimalloc-rs", "path": "/lmimalloc-sys/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ize_t, alignment: size_t) -> *mut c_void; pub fn mi_realloc_aligned(p: *const c_void, newsize: size_t, alignment: size_t) -> *mut c_void; }<|fim_prefix|>// repo: wusyong/mimalloc-rs path: /lmimalloc-sys/src/lib.rs #![no_std] use libc::{c_void, size_t}; extern "C" { // Basic Allocation pub f...
code_fim
medium
{ "lang": "rust", "repo": "wusyong/mimalloc-rs", "path": "/lmimalloc-sys/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wusyong/mimalloc-rs path: /lmimalloc-sys/src/lib.rs #![no_std] use libc::{c_void, size_t}; extern "C" { // Basic Allocation pub fn mi_free(p: *mut c_void); pub fn mi_malloc(size: s<|fim_suffix|>ize_t, alignment: size_t) -> *mut c_void; pub fn mi_realloc_aligned(p: *const c_void...
code_fim
hard
{ "lang": "rust", "repo": "wusyong/mimalloc-rs", "path": "/lmimalloc-sys/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// A wrapper around [std::collections::VecDeque] that holds [String]. Can be wrapped in an /// [fuchsia_inspect_derive::IValue] and written to inspect as a single property with its value /// being a comma-separated list that's concatenation of all of the items in the VecDeque. pub mod joinable_inspect_ve...
code_fim
medium
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/settings/inspect_utils/src/lib.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/settings/inspect_utils/src/lib.rs // Copyright 2022 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. <|fim_suffix|>/// A queue that controls an inspect node and writes in...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/settings/inspect_utils/src/lib.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/// A map that controls an inspect node and writes inserted items to the node automatically. pub mod managed_inspect_map; /// A queue that controls an inspect node and writes inserted items to the node automatically. pub mod managed_inspect_queue;<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/settin...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/settings/inspect_utils/src/lib.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: softprops/travis path: /src/error.rs //! Travis error types use hyper::Error as HttpError; use hyper::StatusCode; use hyper::error::UriError; use serde_json::error::Error as SerdeError; use std::io::Error as IoError; <|fim_suffix|>error_chain! { errors { Fault { code: S...
code_fim
medium
{ "lang": "rust", "repo": "softprops/travis", "path": "/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>error_chain! { errors { Fault { code: StatusCode, error: String, } } foreign_links { Codec(SerdeError); Http(HttpError); IO(IoError); Uri(UriError); } }<|fim_prefix|>// repo: softprops/travis path: /src/error.rs //! T...
code_fim
medium
{ "lang": "rust", "repo": "softprops/travis", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/consts/issue-65348.rs // check-pass struct Generic<T>(T); impl<T> Generic<T> { const ARRAY: [T; 0] = []; const NEWTYPE_ARRAY: Generic<[T; 0]> = Generic([]); const ARRAY_FIELD: Generic<(i32, [T; 0])> = Generic((0, [])); } <|fim_suf...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/consts/issue-65348.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub const fn array_field<T>() -> &'static T { &(Generic::<T>::ARRAY_FIELD.0).1[0] } fn main() {}<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/consts/issue-65348.rs // check-pass struct Generic<T>(T); impl<T> Generic<T> { const ARRAY: [T; 0] = []; const NEWTYPE_...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/consts/issue-65348.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: japaric-archived/eulermark.rs path: /src/json.rs extern crate serialize; use benchmark::Metric; use file::{read,write}; use hash::Hashes; use language::Language; use serialize::Decodable; use serialize::json; use std::collections::HashMap; pub fn parse_language_file(language_file: &Path) -> La...
code_fim
hard
{ "lang": "rust", "repo": "japaric-archived/eulermark.rs", "path": "/src/json.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> old_metrics.sort_by(|a, b| { a.language().cmp(&b.language()) }); new_metrics.sort_by(|a, b| { a.language().cmp(&b.language()) }); loop { match (old_metrics.pop(), new_metrics.pop()) { (None, None) => break, (Some(old), None) => { ...
code_fim
hard
{ "lang": "rust", "repo": "japaric-archived/eulermark.rs", "path": "/src/json.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xiaohanxu-nick/tools path: /crates/formatter/src/ts/script.rs use crate::{ format_elements, hard_line_break, join_elements, FormatElement, Formatter, ToFormatElement, }; use rslint_parser::ast::Script; impl ToFormatElement for Script { fn to_format_element(&self, formatter: &Formatter) -> For...
code_fim
medium
{ "lang": "rust", "repo": "xiaohanxu-nick/tools", "path": "/crates/formatter/src/ts/script.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tokens.push(join_elements(hard_line_break(), elements)); format_elements![concat_elements(tokens), hard_line_break()] } }<|fim_prefix|>// repo: xiaohanxu-nick/tools path: /crates/formatter/src/ts/script.rs use crate::{ format_elements, hard_line_break, join_elements, FormatElement, Formatter, ToFo...
code_fim
hard
{ "lang": "rust", "repo": "xiaohanxu-nick/tools", "path": "/crates/formatter/src/ts/script.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> format_elements![concat_elements(tokens), hard_line_break()] } }<|fim_prefix|>// repo: xiaohanxu-nick/tools path: /crates/formatter/src/ts/script.rs use crate::{ format_elements, hard_line_break, join_elements, FormatElement, Formatter, ToFormatElement, }; use rslint_parser::ast::Script; <|fim_middl...
code_fim
hard
{ "lang": "rust", "repo": "xiaohanxu-nick/tools", "path": "/crates/formatter/src/ts/script.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hotacium/algorithms-and-data-structures path: /src/sort/cocktail.rs use std::fmt::{Display, Debug}; // PartailOrd + Copy + Display + Debug // COCKTAIL SORT (a.k.a. SHAKER SORT) // // Example: 4(s) 5 1 8 7 3(e), (s = start, e = end) // // 4(s) 1 5 7 3(e) 8, swapped = true // 1 4(s) 5 3 7(e) 8, ...
code_fim
hard
{ "lang": "rust", "repo": "hotacium/algorithms-and-data-structures", "path": "/src/sort/cocktail.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> swapped = false; end -= 1; // end to start for i in (start..end-1).rev() { if slice[i] > slice[i+1] { slice.swap(i, i+1); swapped = true; } } start += 1; } } #[cfg(test)] mod test { u...
code_fim
hard
{ "lang": "rust", "repo": "hotacium/algorithms-and-data-structures", "path": "/src/sort/cocktail.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Corallus-Caninus/windows-rs path: /crates/deps/sys/src/Windows/Win32/System/WinRT/Xaml/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 const E_SURFACE_CONTENTS_LOST: u32 = 2...
code_fim
hard
{ "lang": "rust", "repo": "Corallus-Caninus/windows-rs", "path": "/crates/deps/sys/src/Windows/Win32/System/WinRT/Xaml/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>C)] pub struct TrackerHandle__ { pub unused: i32, } impl ::core::marker::Copy for TrackerHandle__ {} impl ::core::clone::Clone for TrackerHandle__ { fn clone(&self) -> Self { *self } } pub type XAML_REFERENCETRACKER_DISCONNECT = i32; pub const XAML_REFERENCETRACKER_DISCONNECT_DEFAULT: ...
code_fim
hard
{ "lang": "rust", "repo": "Corallus-Caninus/windows-rs", "path": "/crates/deps/sys/src/Windows/Win32/System/WinRT/Xaml/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>SourceNativeWithD2D = *mut ::core::ffi::c_void; pub type ISwapChainBackgroundPanelNative = *mut ::core::ffi::c_void; pub type ISwapChainPanelNative = *mut ::core::ffi::c_void; pub type ISwapChainPanelNative2 = *mut ::core::ffi::c_void; pub type ITrackerOwner = *mut ::core::ffi::c_void; pub type IVirtualSu...
code_fim
hard
{ "lang": "rust", "repo": "Corallus-Caninus/windows-rs", "path": "/crates/deps/sys/src/Windows/Win32/System/WinRT/Xaml/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oznakn/vc path: /src/ir.rs string_map: HashMap<&'input str, ValueStorage>, pub int_map: HashMap<&'input str, ValueStorage>, pub real_map: HashMap<&'input str, ValueStorage>, variable_storage_map: HashMap<&'input str, ValueStorage>, pub items: Vec<IRItem<'input>>, } impl<'input...
code_fim
hard
{ "lang": "rust", "repo": "oznakn/vc", "path": "/src/ir.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn build_expression(&mut self, ast_expression: &'input ast::Expression<'input>) -> ValueStorage { match ast_expression { ast::Expression::FunctionCallExpression { name, argument_list: argument_expression_list } => { let mut arguments = Vec::new(); le...
code_fim
hard
{ "lang": "rust", "repo": "oznakn/vc", "path": "/src/ir.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oznakn/vc path: /src/ir.rs ValueStorage) { self.items.push(IRItem::BinaryOp(target, op, operand1, operand2)); } #[inline] fn put_unary_op(&mut self, target: ValueStorage, op: Op, operand: ValueStorage) { self.items.push(IRItem::UnaryOp(target, op, operand)); } ...
code_fim
hard
{ "lang": "rust", "repo": "oznakn/vc", "path": "/src/ir.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fizzbuzz(45); fizzbuzz(102); fizzbuzz(105); fizzbuzz(120); }<|fim_prefix|>// repo: psibi/rwh path: /rust/fp/1/ex4.rs fn fizzbuzz(num: u32) { if (num % 15 == 0) { println!("Fizzbuzz"); } else if (num % 3 == 0) { println!("Fizz"); } else if (num % 5 == 0) { ...
code_fim
easy
{ "lang": "rust", "repo": "psibi/rwh", "path": "/rust/fp/1/ex4.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: psibi/rwh path: /rust/fp/1/ex4.rs fn fizzbuzz(num: u32) { if (num % 15 == 0) { println!("Fizzbuzz"); } else if (num % 3 == 0) { println!("Fizz"); } else if (num % 5 == 0) { println!("Buzz"); } else { println!("{}", num); } } <|fim_suffix|> ...
code_fim
easy
{ "lang": "rust", "repo": "psibi/rwh", "path": "/rust/fp/1/ex4.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: deadalusai/raytracer path: /raytracer-impl/src/obj_data.rs use std::collections::{HashMap, HashSet}; use std::sync::{Arc}; use crate::shapes::{Mesh, MeshFace}; use crate::texture::{MeshTexture, MeshTextureSet, ColorMap}; use crate::obj_format::{ObjObject, ObjMaterial}; #[derive(Default)] pub s...
code_fim
hard
{ "lang": "rust", "repo": "deadalusai/raytracer", "path": "/raytracer-impl/src/obj_data.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let obj = self.objects.get(object_name).expect("Selecting object"); // Prepare materials as "texture" lookups let material_names = obj.faces.iter() .filter_map(|o| o.mtl.as_ref()) .collect::<HashSet<_>>(); let mut textures = Vec::new(); ...
code_fim
hard
{ "lang": "rust", "repo": "deadalusai/raytracer", "path": "/raytracer-impl/src/obj_data.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lotuslocke/open-pond path: /open-pond-protocol/src/tests/message.rs #[cfg(test)] use crate::message::{MAX_PACKET_SIZE, MAX_PAYLOAD_SIZE, MIN_PACKET_SIZE}; #[cfg(test)] use crate::Message; #[test] fn new_message_success() { let payload = vec![1, 2, 3]; let id = 4; let message = Mess...
code_fim
hard
{ "lang": "rust", "repo": "lotuslocke/open-pond", "path": "/open-pond-protocol/src/tests/message.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn from_bytes_message_success() { let raw = vec![1, 0, 0, 0, 0, 1, 1]; let expected_id = 1; let expected_length = 1; let expected_payload = vec![1]; let message = Message::from_bytes(raw).unwrap(); assert_eq!(message.id, expected_id); assert_eq!(message.length, expect...
code_fim
hard
{ "lang": "rust", "repo": "lotuslocke/open-pond", "path": "/open-pond-protocol/src/tests/message.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/serde_arrow path: /serde_arrow/src/util/string_extractor.rs use serde::ser::{Impossible, Serialize, Serializer}; use crate::{fail, Error, Result}; macro_rules! unsupported { ($name:ident) => { fn $name(self) -> Result<Self::Ok> { return Err(Error::Custom(format!...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/serde_arrow", "path": "/serde_arrow/src/util/string_extractor.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn serialize_newtype_struct<T>(self, _name: &'static str, _value: &T) -> Result<Self::Ok> where T: ?Sized + Serialize, { fail!("serialize_newtype_struct not supported in schema tracing"); } fn serialize_newtype_variant<T>( self, _name: &'static str, ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/serde_arrow", "path": "/serde_arrow/src/util/string_extractor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: radicle-dev/juniper path: /juniper/src/macros/scalar.rs r $e:expr) => { $e }; ( @generate, meta = { name = $name:ty, outname = {$($outname:tt)+}, scalar = {$($scalar:tt)+}, $(description = $descr:tt,)* }, resolv...
code_fim
hard
{ "lang": "rust", "repo": "radicle-dev/juniper", "path": "/juniper/src/macros/scalar.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fn resolve_async<'a>( &'a self, info: &'a Self::TypeInfo, selection_set: Option<&'a [$crate::Selection<$crate::__juniper_insert_generic!($($scalar)+)>]>, executor: &'a $crate::Executor<Self::Context, $crate::__...
code_fim
hard
{ "lang": "rust", "repo": "radicle-dev/juniper", "path": "/juniper/src/macros/scalar.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: radicle-dev/juniper path: /juniper/src/macros/scalar.rs $scalar)+)> ) -> $crate::meta::MetaType<'r, $crate::__juniper_insert_generic!($($scalar)+)> where $crate::__juniper_insert_generic!($($scalar)+): 'r { l...
code_fim
hard
{ "lang": "rust", "repo": "radicle-dev/juniper", "path": "/juniper/src/macros/scalar.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nushell/nushell path: /crates/nu_plugin_inc/src/nu/mod.rs use crate::inc::SemVerAction; use crate::Inc; use nu_plugin::{EvaluatedCall, LabeledError, Plugin}; use nu_protocol::{ast::CellPath, PluginSignature, SyntaxShape, Value}; impl Plugin for Inc { fn signature(&self) -> Vec<PluginSignatu...
code_fim
hard
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu_plugin_inc/src/nu/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if call.has_flag("major") { self.for_semver(SemVerAction::Major); } if call.has_flag("minor") { self.for_semver(SemVerAction::Minor); } if call.has_flag("patch") { self.for_semver(SemVerAction::Patch); } self.inc(...
code_fim
hard
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu_plugin_inc/src/nu/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// expects to be normalized [0,1] pub trait Generator<T> { fn at(&mut self, i: isize) -> T; }<|fim_prefix|>// repo: gorilskij/terrain-generation-and-visualization path: /src/generation/mod.rs mod pseudo_random; mod sine; mod running_average; <|fim_middle|>pub use pseudo_random::PseudoRandomGenerator...
code_fim
medium
{ "lang": "rust", "repo": "gorilskij/terrain-generation-and-visualization", "path": "/src/generation/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gorilskij/terrain-generation-and-visualization path: /src/generation/mod.rs mod pseudo_random; mod sine; mod running_average; <|fim_suffix|>// expects to be normalized [0,1] pub trait Generator<T> { fn at(&mut self, i: isize) -> T; }<|fim_middle|>pub use pseudo_random::PseudoRandomGenerator...
code_fim
medium
{ "lang": "rust", "repo": "gorilskij/terrain-generation-and-visualization", "path": "/src/generation/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let return_type = ReturnType::new(fn_marshal_attr.as_ref(), fn_item.sig.output.clone())?; let function = Function::new( fn_item.sig.ident.clone(), fn_item.sig.inputs.clone(), &mappings, return_type, InnerFn::FunctionBody(fn_item), fn_marshal_attr, ...
code_fim
hard
{ "lang": "rust", "repo": "bbqsrc/cthulhu", "path": "/cthulhu_macro/src/call_fn.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bbqsrc/cthulhu path: /cthulhu_macro/src/call_fn.rs use log::debug; use proc_macro2::TokenStream; use quote::quote; use super::{function::Function, function::InnerFn, return_type::ReturnType}; use crate::attr::marshal::MarshalAttr; use crate::attr::SignatureExt; pub fn call_with_function( r...
code_fim
medium
{ "lang": "rust", "repo": "bbqsrc/cthulhu", "path": "/cthulhu_macro/src/call_fn.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>const BACKLIGHT: u8 = 0b0000_1000; const ENABLE: u8 = 0b0000_0100; // const READ_WRITE: u8 = 0b0000_0010; // Not used as no reading of the `HD44780` is done const REGISTER_SELECT: u8 = 0b0000_0001; impl<I2C: I2c> I2CBus<I2C> { pub fn new(i2c_bus: I2C, address: u8) -> I2CBus<I2C> { I2CBus { i2c_bus, ad...
code_fim
medium
{ "lang": "rust", "repo": "JohnDoneth/hd44780-driver", "path": "/src/non_blocking/bus/i2c.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JohnDoneth/hd44780-driver path: /src/non_blocking/bus/i2c.rs use core::future::Future; use embassy_traits::delay::Delay; use embassy_traits::i2c::I2c; use crate::error::Result; use crate::non_blocking::bus::DataBus; pub struct I2CBus<I2C: I2c> { i2c_bus: I2C, address: u8, } const BACKLIGHT:...
code_fim
hard
{ "lang": "rust", "repo": "JohnDoneth/hd44780-driver", "path": "/src/non_blocking/bus/i2c.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async move { let upper_nibble = byte & 0xF0; self.write_nibble(upper_nibble, data, delay).await; let lower_nibble = (byte & 0x0F) << 4; self.write_nibble(lower_nibble, data, delay).await; Ok(()) } } }<|fim_prefix|>// repo: JohnDoneth/hd44780-driver path: /src/non_blocking/bus/i2c.rs...
code_fim
hard
{ "lang": "rust", "repo": "JohnDoneth/hd44780-driver", "path": "/src/non_blocking/bus/i2c.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: InfernapeXavier/RustyBase path: /src/main.rs // Inner Attributes to suppress Cargo Warnings #![allow(dead_code)] #![allow(unused_variables)] #![allow(unused_imports)] // Importing the parser #[macro_use] extern crate lalrpop_util; // STD Imports use std::fs; use std::io; use std::io::prelude::...
code_fim
hard
{ "lang": "rust", "repo": "InfernapeXavier/RustyBase", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// This prints out the parse tree that is generated from the extended parser that handles functional expressions // #[test] // fn extparser_test() { // // EG Input: 1+(2*3) // print!("\n\nEnter in your Expression: "); // io::stdout().flush().unwrap(); // let mut input = String::new(); // ...
code_fim
hard
{ "lang": "rust", "repo": "InfernapeXavier/RustyBase", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Building the CNF let mut my_comparison = comparison::CNF::new(); my_comparison = my_comparison.grow_from_parse_tree_single( expression, &out_rec_file, &lineitem, &mut literal, ); // Building the temp record let table_file = Path::new("tpch/lineit...
code_fim
hard
{ "lang": "rust", "repo": "InfernapeXavier/RustyBase", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn call_close_int(&mut self, id: Call, keepalive: bool) -> CallBuilderImpl { let (builder, b1, b2) = self.cons.close_call(id, keepalive); if b1.capacity() > 0 || b1.len() > 0 { self.reuse(b1); } if b2.capacity() > 0 || b2.len() > 0 { self.reuse(b...
code_fim
hard
{ "lang": "rust", "repo": "SergejJurecko/mio_httpc", "path": "/src/httpc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SergejJurecko/mio_httpc path: /src/httpc.rs use crate::call::CallImpl; use crate::connection::{Con, ConTable}; use crate::resolve::DnsCache; use crate::tls_api::TlsConnector; use crate::types::*; use mio::{event::Event, Interest, Registry, Token}; use std::collections::VecDeque; // use fnv::FnvH...
code_fim
hard
{ "lang": "rust", "repo": "SergejJurecko/mio_httpc", "path": "/src/httpc.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let call = CallImpl::new(call_id, b, self.get_buf(), self.get_buf()); if !is_fixed { if let Some((con_id1, con_id2)) = self.cons .push_con(con1, call, poll, &self.cfg, self.con_offset)? { let call = Call::new(call_...
code_fim
hard
{ "lang": "rust", "repo": "SergejJurecko/mio_httpc", "path": "/src/httpc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let hello_ret = core.run(hello_ret).expect("rpc failed"); let hello_name_ret1 = core.run(hello_name_ret1).expect("rpc failed"); let hello_name_ret2 = core.run(hello_name_ret2).expect("rpc failed"); println!("RESPONSE: {:?}", hello_ret); println!("RESPONSE: {:?}", hello_name_ret1); ...
code_fim
hard
{ "lang": "rust", "repo": "KeenS/tokio-thrift", "path": "/examples/simple_server_client/src/bin/client.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KeenS/tokio-thrift path: /examples/simple_server_client/src/bin/client.rs extern crate futures; extern crate tokio_core as tokio; extern crate tokio_service as service; extern crate tokio_proto as proto; extern crate simple_server_client; extern crate tokio_thrift; <|fim_suffix|>pub fn main() {...
code_fim
medium
{ "lang": "rust", "repo": "KeenS/tokio-thrift", "path": "/examples/simple_server_client/src/bin/client.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // the client implements `HelloService` so you can call the methods directly let hello_ret = client.hello(); let hello_name_ret1 = client.hello_name("keen".to_string()); let hello_name_ret2 = client.hello_name("error".to_string()); let hello_ret = core.run(hello_ret).expect("rpc faile...
code_fim
hard
{ "lang": "rust", "repo": "KeenS/tokio-thrift", "path": "/examples/simple_server_client/src/bin/client.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn find_pos<'a>(&'a self, pos: i32, v: &mut Vec<&'a SegmentTreeNode<T>>) { if self.lower_bound > pos || self.upper_bound <= pos { return; } if self.lower_bound == pos && self.upper_bound == self.lower_bound + 1 { v.push(self); ...
code_fim
hard
{ "lang": "rust", "repo": "azurespace/segment-tree", "path": "/src/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if size > 1 { let mid = (lower_bound + upper_bound) / 2; children = Some( ( Box::new(SegmentTreeNode::<T>::new(lower_bound, mid)), Box::new(SegmentTreeNode::<T>::new(mid, upper_bound)) ) ...
code_fim
hard
{ "lang": "rust", "repo": "azurespace/segment-tree", "path": "/src/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azurespace/segment-tree path: /src/node.rs extern crate num; use std::cell::Cell; use num::integer::Integer; pub struct SegmentTreeNode<T:Copy> { lower_bound: i32, upper_bound: i32, pub value: Cell<T>, pub children: Option<(Box<SegmentTreeNode<T>>, Box<SegmentTreeNode<T>>)> } ...
code_fim
hard
{ "lang": "rust", "repo": "azurespace/segment-tree", "path": "/src/node.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Print results. let mut iter = 0; let mut json_vec: Vec<[f32; 4]> = Vec::new(); while (iter * 4) < bbox_res.len() { json_vec.push([ bbox_res[4 * iter + 1], // x1 bbox_res[4 * iter], // y1 bbox_res[4 * iter + 3], // x2 bbox_res[4...
code_fim
hard
{ "lang": "rust", "repo": "second-state/wasm-learning", "path": "/rust/face_detect/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: second-state/wasm-learning path: /rust/face_detect/src/main.rs use serde_json::json; use std::env; use std::error::Error; use std::io::{self, Read}; use tensorflow::{Graph, ImportGraphDefOptions, Session, SessionOptions, SessionRunArgs, Tensor}; fn main() -> Result<(), Box<dyn Error>> { let...
code_fim
hard
{ "lang": "rust", "repo": "second-state/wasm-learning", "path": "/rust/face_detect/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 0x192/iced_aw path: /src/web/date_picker.rs //! Use a date picker as an input element for picking dates. //! //! *This API requires the following crate features to be activated: date_picker* use dodrio::bumpalo; use iced_web::{Bus, Css, Element, Widget}; pub use crate::core::date::Date; pub use...
code_fim
hard
{ "lang": "rust", "repo": "0x192/iced_aw", "path": "/src/web/date_picker.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self, bump: &'b bumpalo::Bump, bus: &Bus<Message>, _style_sheet: &mut Css<'b>, ) -> dodrio::Node<'b> { use dodrio::builder::*; use wasm_bindgen::JsCast; //let style = self.style.active(); let on_submit = self.on_submit.clone(); ...
code_fim
hard
{ "lang": "rust", "repo": "0x192/iced_aw", "path": "/src/web/date_picker.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Type::String) } fn translate_array(&self, argument: Type) -> Result<Type> { Ok(Type::Array { argument: Box::new(argument), }) } fn translate_map(&self, key: Type, value: Type) -> Result<Type> { Ok(Type::Map { key: Box::new(key), ...
code_fim
hard
{ "lang": "rust", "repo": "reproto/reproto", "path": "/lib/backend-go/src/flavored.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reproto/reproto path: /lib/backend-go/src/flavored.rs //! Go flavor. #![allow(unused)] use crate::TYPE_SEP; use backend::package_processor; use genco::prelude::*; use genco::tokens::{FormatInto, Item, ItemStr}; use reproto_core::errors::Result; use reproto_core::{ CoreFlavor, Diagnostics, ...
code_fim
hard
{ "lang": "rust", "repo": "reproto/reproto", "path": "/lib/backend-go/src/flavored.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilian98/extended-array path: /src/demo/demo.rs /// This file and package manages the demo - downloads csv data for the coronavirus, parses it and returns it to main use std::{collections::HashMap, str::FromStr}; use reqwest::Error; /// Element is a struct used for storing the important informat...
code_fim
hard
{ "lang": "rust", "repo": "ilian98/extended-array", "path": "/src/demo/demo.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut count = match r.get("weekly_count").unwrap().parse::<i64>() { Err(e) => { println!( "Error when parsing {} - {:?}", r.get("weekly_count").unwrap(), e ...
code_fim
hard
{ "lang": "rust", "repo": "ilian98/extended-array", "path": "/src/demo/demo.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gabisurita/spoilers path: /spoilers_derive/src/storage.rs use syn; use quote; pub fn impl_postgre_storage(ast: &syn::DeriveInput) -> quote::Tokens { let class_name = &ast.ident; quote! { type DatabaseConnectionPool = r2d2::Pool<r2d2_diesel::ConnectionManager<diesel::pg::PgConn...
code_fim
hard
{ "lang": "rust", "repo": "gabisurita/spoilers", "path": "/spoilers_derive/src/storage.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let database_url = env::var("DATABASE_URL").expect("DATABASE_URL must be set"); let queue_url = env::var("REDIS_URL").expect("REDIS_URL must be set"); let db_manager = r2d2_diesel::ConnectionManager::new(database_url); let queue_manager = r...
code_fim
hard
{ "lang": "rust", "repo": "gabisurita/spoilers", "path": "/spoilers_derive/src/storage.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cobalt-org/liquid-rust path: /crates/core/src/error/trace.rs /// User-visible call trace #[derive(Clone, PartialEq, Eq, Debug, Default)] pub(crate) struct Trace { trace: Option<crate::model::KString>, context: Vec<(crate::model::KString, crate::model::KString)>, } <|fim_suffix|> pub(...
code_fim
hard
{ "lang": "rust", "repo": "cobalt-org/liquid-rust", "path": "/crates/core/src/error/trace.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn get_trace(&self) -> Option<&str> { self.trace.as_ref().map(|s| s.as_str()) } pub(crate) fn get_context(&self) -> &[(crate::model::KString, crate::model::KString)] { self.context.as_ref() } }<|fim_prefix|>// repo: cobalt-org/liquid-rust path: /crates/core/src...
code_fim
medium
{ "lang": "rust", "repo": "cobalt-org/liquid-rust", "path": "/crates/core/src/error/trace.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn append_context( &mut self, key: crate::model::KString, value: crate::model::KString, ) { self.context.push((key, value)); } pub(crate) fn get_trace(&self) -> Option<&str> { self.trace.as_ref().map(|s| s.as_str()) } pub(crate) ...
code_fim
hard
{ "lang": "rust", "repo": "cobalt-org/liquid-rust", "path": "/crates/core/src/error/trace.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Computes the state and partials of the provided function. /// /// # How to read this signature: /// Let `x` be a state vector and `f` be a function whose gradient is seeked. /// Calling `partials` will return a tuple of ( f(x), ∂f(x)/∂x ). /// If the function `f` is defined as f: Y^{n} → Y^{n}, where ...
code_fim
hard
{ "lang": "rust", "repo": "benruijl/dual_num", "path": "/src/differentials.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0..N::dim() { for j in 0..M::dim() { if j == 0 { // The state is duplicated in every column state[(i, 0)] = state_n_grad[(i, 0)].real(); } grad[(i, j)] = state_n_grad[(i, j)].dual(); } } (state, grad...
code_fim
hard
{ "lang": "rust", "repo": "benruijl/dual_num", "path": "/src/differentials.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benruijl/dual_num path: /src/differentials.rs use na::{allocator::Allocator, DefaultAllocator, DimName, MatrixMN, Real, VectorN}; use {Dual, Num, One, Scalar}; /// Evaluates the function using dual numbers to get the partial derivative at the input point #[inline] pub fn differentiate<T: Scala...
code_fim
hard
{ "lang": "rust", "repo": "benruijl/dual_num", "path": "/src/differentials.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { println!("{}", String::from("2017 AOC #16")); println!("Part One: {:?}", solve().0); println!("Part Two: {:?}", solve().1); } #[cfg(test)] mod test { use super::*; #[test] fn test_one() { assert_eq!(solve().0, "bijankplfgmeodhc"); } #[test] fn test...
code_fim
hard
{ "lang": "rust", "repo": "ambuc/aoc-2017-rust", "path": "/16.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for &step in steps { &self.step(&step.to_string()); } } fn step(&mut self, step: &String) { let verb = step.chars().next().unwrap(); let (_, val) = step.split_at(1); match verb { 's' => { let shift: i32 = val.parse::<...
code_fim
hard
{ "lang": "rust", "repo": "ambuc/aoc-2017-rust", "path": "/16.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ambuc/aoc-2017-rust path: /16.rs mod input; static PATH: &'static str = "input/16.txt"; use std::str; // a b c d e f g h // 1 2 3 4 5 6 7 8 // 0000 0001 0010 0011 0100 0101 0110 0111 // i j k l m n o p // 9 10 11 1...
code_fim
hard
{ "lang": "rust", "repo": "ambuc/aoc-2017-rust", "path": "/16.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self, instance: &ProblemInstance, solution: ProblemSolution, ) -> ProblemSolution; }<|fim_prefix|>// repo: Daniel-del-Castillo/daap8 path: /src/problem_solver/local_search/mod.rs use super::{ProblemInstance, ProblemSolution}; mod swap; pub use swap::Swap; /// A trait that sp...
code_fim
hard
{ "lang": "rust", "repo": "Daniel-del-Castillo/daap8", "path": "/src/problem_solver/local_search/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Daniel-del-Castillo/daap8 path: /src/problem_solver/local_search/mod.rs use super::{ProblemInstance, ProblemSolution}; mod swap; pub use swap::Swap; /// A trait that specifies how a local search should behave. A local search /// should search for better solutions inside an specific environment ...
code_fim
medium
{ "lang": "rust", "repo": "Daniel-del-Castillo/daap8", "path": "/src/problem_solver/local_search/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Performs a local search **only** in the environment of the actual solution. /// It can return a solution that **might** be a better one than the actual fn perform_search( &self, instance: &ProblemInstance, solution: ProblemSolution, ) -> ProblemSolution; }<|fim_...
code_fim
hard
{ "lang": "rust", "repo": "Daniel-del-Castillo/daap8", "path": "/src/problem_solver/local_search/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn add_one(x:i32) -> i32 { x + 1 }<|fim_prefix|>// repo: america/Rust path: /src/main.rs fn main() { print_number(5); print_number(add_one(6)); } <|fim_middle|>fn print_number(x: i32) { println!("x is: {}", x); }
code_fim
easy
{ "lang": "rust", "repo": "america/Rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: america/Rust path: /src/main.rs fn main() { print_number(5); print_number(add_one(6)); } <|fim_suffix|>fn add_one(x:i32) -> i32 { x + 1 }<|fim_middle|>fn print_number(x: i32) { println!("x is: {}", x); }
code_fim
easy
{ "lang": "rust", "repo": "america/Rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("x is: {}", x); } fn add_one(x:i32) -> i32 { x + 1 }<|fim_prefix|>// repo: america/Rust path: /src/main.rs fn main() { print_number(5); print_number(add_one(6)); } <|fim_middle|>fn print_number(x: i32) {
code_fim
easy
{ "lang": "rust", "repo": "america/Rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> tokio::spawn(future); } }<|fim_prefix|>// repo: communityvi/communityvi path: /communityvi-server/hyper-test/src/executor.rs use std::future::Future; <|fim_middle|>#[derive(Clone, Copy)] pub struct Executor; impl<T> hyper::rt::Executor<T> for Executor where T: Future + Send + 'static, T::Output: S...
code_fim
medium
{ "lang": "rust", "repo": "communityvi/communityvi", "path": "/communityvi-server/hyper-test/src/executor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: communityvi/communityvi path: /communityvi-server/hyper-test/src/executor.rs use std::future::Future; <|fim_suffix|> tokio::spawn(future); } }<|fim_middle|>#[derive(Clone, Copy)] pub struct Executor; impl<T> hyper::rt::Executor<T> for Executor where T: Future + Send + 'static, T::Output: S...
code_fim
medium
{ "lang": "rust", "repo": "communityvi/communityvi", "path": "/communityvi-server/hyper-test/src/executor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hooops/crypto-crawler-rs path: /crypto-ws-client/tests/bitz.rs #[macro_use] mod utils; #[cfg(test)] mod bitz_spot { use crypto_ws_client::{BitzSpotWSClient, WSClient}; use std::sync::mpsc::{Receiver, Sender}; use std::time::{SystemTime, UNIX_EPOCH}; #[test] #[ignore = "bitz...
code_fim
hard
{ "lang": "rust", "repo": "hooops/crypto-crawler-rs", "path": "/crypto-ws-client/tests/bitz.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] #[ignore = "bitz.com has shutdown since October 2021"] fn subscribe_ticker() { gen_test_code!( BitzSpotWSClient, subscribe_ticker, &vec!["btc_usdt".to_string()] ); } #[test] #[ignore = "bitz.com has shutdown since October...
code_fim
hard
{ "lang": "rust", "repo": "hooops/crypto-crawler-rs", "path": "/crypto-ws-client/tests/bitz.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let avg_throughput = crossbeam::scope(|scope| { let args = &args; let done = &done; let writes = &writes; let joins: Vec<_> = (0..args.handles).map(|i| { scope.spawn(move || write(writes, done, args, i)) }).collect();...
code_fim
hard
{ "lang": "rust", "repo": "JLockerman/FuzzyLog", "path": "/benchers/isolation/src/main.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let mut gen = rand::thread_rng(); while !done.load(Ordering::Relaxed) { let mut num_appends = 0; while let Ok((_, locs)) = log.try_wait_for_any_append() { if do_multis && locs.len() > 1 { used_window -= 1; } else { used_window...
code_fim
hard
{ "lang": "rust", "repo": "JLockerman/FuzzyLog", "path": "/benchers/isolation/src/main.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JLockerman/FuzzyLog path: /benchers/isolation/src/main.rs extern crate crossbeam; extern crate env_logger; extern crate fuzzy_log_client; extern crate rand; extern crate structopt; #[macro_use] extern crate structopt_derive; use std::net::SocketAddr; use std::str::FromStr; use std::sync::atom...
code_fim
hard
{ "lang": "rust", "repo": "JLockerman/FuzzyLog", "path": "/benchers/isolation/src/main.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> use PackageError::*; let xml_tree = roxmltree::Document::parse(&package_xml).map_err(ParsingError)?; let root = xml_tree.root(); let run_depend: Vec<Dependency> = root.get_tags("run_depend").map_err(InvalidDependency)?; Ok(Self { common: PackageCommon::...
code_fim
medium
{ "lang": "rust", "repo": "lelongg/ros_package_manifest", "path": "/src/package/package1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lelongg/ros_package_manifest path: /src/package/package1.rs use crate::{ package::common::{PackageCommon, PackageCommonMethods}, tags::{Dependency, GetTag}, PackageError, }; use std::convert::TryFrom; use std::str::FromStr; #[derive(Default, Debug, Clone, PartialEq)] pub struct Pack...
code_fim
hard
{ "lang": "rust", "repo": "lelongg/ros_package_manifest", "path": "/src/package/package1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] pub struct ZoteroData { pub collections: HashMap<String, Collection>, pub config: Config, pub items: Vec<Item>, } #[derive(Serialize, Deserialize, Debug)] pub struct Collection { collections: Vec<String>, items: Vec<i32>, key: String, ...
code_fim
hard
{ "lang": "rust", "repo": "lpartan/zotero-to-obsidian", "path": "/src/json_parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }