text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: djustinf/gtrust path: /src/shapley.rs use std::collections::HashMap; pub struct Player { name: String, weight: f32 } impl Player { pub fn new(name: String, weight: f32) -> Self { Player { name, weight } } } pub struct Shapley { playe...
code_fim
hard
{ "lang": "rust", "repo": "djustinf/gtrust", "path": "/src/shapley.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'tcx> TyCtxt<'tcx> { pub fn note_and_explain_type_err( self, db: &mut DiagnosticBuilder<'_>, err: &TypeError<'tcx>, sp: Span, ) { use self::TypeError::*; match err { Sorts(values) => { let expected_str = values.expec...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/librustc/ty/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/librustc/ty/error.rs use syntax_pos::Span; use crate::hir; #[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct ExpectedFound<T> { pub expected: T, pub found: T, } // Data structures used in type unification #[derive(Clone, Debug)] pub en...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/librustc/ty/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/librustc/ty/error.rs ification #[derive(Clone, Debug)] pub enum TypeError<'tcx> { Mismatch, UnsafetyMismatch(ExpectedFound<hir::Unsafety>), AbiMismatch(ExpectedFound<abi::Abi>), Mutability, TupleSize(ExpectedFound<usize>), FixedA...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/librustc/ty/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for x in s.chars() { if x == '0' { if let Some(ref l) = nodeptr.left { nodeptr = l; } } else { if let Some(ref r) = nodeptr.right { nodeptr = r; } } if let Some(ch) = nodeptr.value { ...
code_fim
hard
{ "lang": "rust", "repo": "grzes5003/CPS", "path": "/lab11/hoffman_coder/src/coder/coder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grzes5003/CPS path: /lab11/hoffman_coder/src/coder/coder.rs use std::collections::HashMap; use super::generator::Node; pub fn encode(input: Vec<u8>, h: &HashMap<u8, String>) -> String { let mut effect= "".to_string(); let mut t : Option<&String>; for element in input { t = ...
code_fim
medium
{ "lang": "rust", "repo": "grzes5003/CPS", "path": "/lab11/hoffman_coder/src/coder/coder.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut decoded : Vec<u8> = Vec::new(); let mut nodeptr = root; for x in s.chars() { if x == '0' { if let Some(ref l) = nodeptr.left { nodeptr = l; } } else { if let Some(ref r) = nodeptr.right { nodeptr = r; ...
code_fim
medium
{ "lang": "rust", "repo": "grzes5003/CPS", "path": "/lab11/hoffman_coder/src/coder/coder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> window: &W, width: u16, height: u16, dpi: f32, renderer: &Self::Renderer, ) -> Self; /// Resizes the current [`Target`]. /// /// [`Target`]: trait.Target.html fn resize( &mut self, width: u16, height: u16, dpi: f3...
code_fim
hard
{ "lang": "rust", "repo": "artursapek/iced", "path": "/native/src/renderer/windowed.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: artursapek/iced path: /native/src/renderer/windowed.rs use crate::MouseCursor; use raw_window_handle::HasRawWindowHandle; /// A renderer that can target windows. pub trait Windowed: super::Renderer + Sized { /// The type of target. type Target: Target<Renderer = Self>; <|fim_suffix|>/...
code_fim
hard
{ "lang": "rust", "repo": "artursapek/iced", "path": "/native/src/renderer/windowed.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Resizes the current [`Target`]. /// /// [`Target`]: trait.Target.html fn resize( &mut self, width: u16, height: u16, dpi: f32, renderer: &Self::Renderer, ); }<|fim_prefix|>// repo: artursapek/iced path: /native/src/renderer/windowed.rs use c...
code_fim
hard
{ "lang": "rust", "repo": "artursapek/iced", "path": "/native/src/renderer/windowed.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_directory(true, &["definition"], &["definition", "target"], "function_with_nested_if") } #[test] fn function_with_match() -> OutTestRet { test_directory(true, &["definition"], &["definition", "target"], "function_with_match") } #[test] fn ternary() -> OutTestRet { test_directory(true, &...
code_fim
hard
{ "lang": "rust", "repo": "JSAbrahams/mamba", "path": "/tests/system/valid/definition.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JSAbrahams/mamba path: /tests/system/valid/definition.rs use crate::system::{OutTestRet, test_directory}; #[test] fn long_f_string() -> OutTestRet { test_directory(true, &["definition"], &["definition", "target"], "long_f_string") } #[test] fn assign_tuples() -> OutTestRet { test_direc...
code_fim
hard
{ "lang": "rust", "repo": "JSAbrahams/mamba", "path": "/tests/system/valid/definition.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn ternary() -> OutTestRet { test_directory(true, &["definition"], &["definition", "target"], "ternary") } #[test] fn function_ret_super() -> OutTestRet { test_directory(true, &["definition"], &["definition", "target"], "function_ret_super") } #[test] fn tuple_modify_mut() -> OutTestRet ...
code_fim
hard
{ "lang": "rust", "repo": "JSAbrahams/mamba", "path": "/tests/system/valid/definition.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>hieved via Box : : pin for pinning a / / / Future on the heap or the pin_mut ! macro for pinning a Future / / / on the stack . / / / / / / / / / # futures : : executor : : block_on ( async { / / / use futures : : future : : FutureExt ; / / / use futures : : select_biased ; / / / use futures : : pin_mut ; ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/futures-util/src/async_await/select_mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/futures-util/src/async_await/select_mod.rs / / ! The select macro . macro_rules ! document_select_macro { / / This branch is required for futures 0 . 3 . 1 from before select_biased was introduced ( select : item ) = > { / / / Polls multiple fu...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/futures-util/src/async_await/select_mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arita37/orkhon path: /tests/test_async_request_for_dummy_py_model.rs // #![feature(async_await)] // // use orkhon::orkhon::Orkhon; // use orkhon::config::OrkhonConfig; // use orkhon::reqrep::{ORequest, PyModelRequest}; // use std::collections::HashMap; // // #[runtime::test(runtime_tokio::Tokio)...
code_fim
hard
{ "lang": "rust", "repo": "arita37/orkhon", "path": "/tests/test_async_request_for_dummy_py_model.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>nc( // "model_which_will_be_tested", // ORequest::with_body( // PyModelRequest::new() // .with_args(request_args) // .with_kwargs(request_kwargs) // ) // ); // // handle.await.unwrap(); // }<|fim_prefix...
code_fim
hard
{ "lang": "rust", "repo": "arita37/orkhon", "path": "/tests/test_async_request_for_dummy_py_model.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: liam0215/catnip path: /src/protocols/tcp/established/background/retransmitter.rs // Copyright (c) Microsoft Corporation. // Licensed under the MIT license. use super::super::state::ControlBlock; use crate::{fail::Fail, runtime::Runtime}; use futures::{ future::{self, Either}, FutureExt,...
code_fim
hard
{ "lang": "rust", "repo": "liam0215/catnip", "path": "/src/protocols/tcp/established/background/retransmitter.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Unset the initial timestamp so we don't use this for RTT estimation. segment.initial_tx.take(); let mut header = cb.tcp_header(); header.seq_num = seq_no; cb.emit(header, segment.bytes.clone(), remote_link_addr); // Set new retransmit deadline let deadline = cb.rt.now() + ...
code_fim
hard
{ "lang": "rust", "repo": "liam0215/catnip", "path": "/src/protocols/tcp/established/background/retransmitter.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>extern crate edition_lint_paths; use edition_lint_paths::foo; fn main() { foo(); }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/rust-2018/extern-crate-idiomatic.rs // run-pass // aux-build:edition-lint-paths.rs // compile-flags:--extern edition_lint_paths // run-rustfix ...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/rust-2018/extern-crate-idiomatic.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>use edition_lint_paths::foo; fn main() { foo(); }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/rust-2018/extern-crate-idiomatic.rs // run-pass // aux-build:edition-lint-paths.rs // compile-flags:--extern edition_lint_paths // run-rustfix // The "normal case". Ideally we ...
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/rust-2018/extern-crate-idiomatic.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/rust-2018/extern-crate-idiomatic.rs // run-pass // aux-build:edition-lint-paths.rs // compile-flags:--extern edition_lint_paths // run-rustfix <|fim_suffix|>use edition_lint_paths::foo; fn main() { foo(); }<|fim_middle|>// The "normal case...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/rust-2018/extern-crate-idiomatic.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danhper/diem path: /config/management/operational/src/network_checker.rs // Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::{ json_rpc::JsonRpcClientWrapper, validator_set::{validator_set_full_node_addresses, validator_set_validator_addresses},...
code_fim
hard
{ "lang": "rust", "repo": "danhper/diem", "path": "/config/management/operational/src/network_checker.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn timeout_duration(maybe_secs: Option<u64>) -> Duration { Duration::from_secs(if let Some(secs) = maybe_secs { secs } else { DEFAULT_TIMEOUT_SECONDS }) } fn validate_address(address: &NetworkAddress) -> Result<(), Error> { if !address.is_diemnet_addr() { Err(Error...
code_fim
hard
{ "lang": "rust", "repo": "danhper/diem", "path": "/config/management/operational/src/network_checker.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dangduoc08/rust-concepts path: /src/lifetimes/src/three_rules.rs pub trait First { // Each parameter that is a reference gets its own lifetime parameter. // In other words, a function with one parameter gets one lifetime parameter fn bar<'a>(x: &'a i32); <|fim_suffix|>} pub trait T...
code_fim
hard
{ "lang": "rust", "repo": "dangduoc08/rust-concepts", "path": "/src/lifetimes/src/three_rules.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait Third { // The third rule is if there are multiple input lifetime parameters, // but one of them is &self or &mut self because this is a method, // the lifetime of self is assigned to all output lifetime parameters. // This third rule makes methods much nicer to read and write be...
code_fim
hard
{ "lang": "rust", "repo": "dangduoc08/rust-concepts", "path": "/src/lifetimes/src/three_rules.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: evernym/indy-sdk path: /vcx/dummy-cloud-agent/src/indy/pairwise.rs use futures::*; use utils::futures::*; use indyrs::{pairwise, IndyError}; #[derive(Deserialize, Debug)] pub struct Pairwise { pub my_did: String, pub their_did: String, pub metadata: String, } #[derive(Deserialize, ...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/vcx/dummy-cloud-agent/src/indy/pairwise.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn list_pairwise(wallet_handle: i32) -> Box<Future<Item=String, Error=IndyError>> { pairwise::list_pairwise(wallet_handle) .into_box() } pub fn set_pairwise_metadata(wallet_handle: i32, their_did: &str, metadata: &str) -> Box<Future<Item=(), Error=IndyError>> { pairwise::set_pairwise_...
code_fim
medium
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/vcx/dummy-cloud-agent/src/indy/pairwise.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn get_pairwise(wallet_handle: i32, their_did: &str) -> Box<Future<Item=String, Error=IndyError>> { pairwise::get_pairwise(wallet_handle, their_did) .into_box() } pub fn list_pairwise(wallet_handle: i32) -> Box<Future<Item=String, Error=IndyError>> { pairwise::list_pairwise(wallet_han...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/vcx/dummy-cloud-agent/src/indy/pairwise.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl RegisterMode { pub fn to_string(&self) -> String { match self { Self::Open => "Open", Self::Code => "Code", Self::Close => "Close" }.to_string() } pub fn from_string(s: &String) -> Option<Self> { Self::from(&s) } pub fn f...
code_fim
hard
{ "lang": "rust", "repo": "HeerKirov/BasicService", "path": "/src/model/global_setting.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HeerKirov/BasicService path: /src/model/global_setting.rs use serde::{Serialize, Deserialize}; #[derive(Serialize, Deserialize)] pub enum RegisterMode { Open, Code, Close } pub struct GlobalSetting { pub id: i32, pub register_mode: RegisterMode, pub effective_max: Optio...
code_fim
medium
{ "lang": "rust", "repo": "HeerKirov/BasicService", "path": "/src/model/global_setting.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /cargo-atcoder/contests/abc306/src/bin/a.rs use proconio::{input, marker::Chars}; <|fim_suffix|> input! { n: usize, s: Chars, }; let mut t = String::new(); for s_i in s { t.push(s_i); t.push(s_i); } let ans = t; ...
code_fim
easy
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc306/src/bin/a.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input! { n: usize, s: Chars, }; let mut t = String::new(); for s_i in s { t.push(s_i); t.push(s_i); } let ans = t; println!("{}", ans); }<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /cargo-atcoder/contests/abc306/src/bin/a.rs use proconio::...
code_fim
easy
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-atcoder/contests/abc306/src/bin/a.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hermitmotel/rust_parallel2019 path: /examples/nbody/src/nbody_soa.rs use rayon::iter::ParallelBridge; use rayon::prelude::*; use crate::soa::*; use crate::consts::*; use crate::vector::*; #[derive(Clone, Debug, PartialEq)] pub struct NBodySoA { position: StructOfArrays<PrecisionSoA>, velocity...
code_fim
hard
{ "lang": "rust", "repo": "hermitmotel/rust_parallel2019", "path": "/examples/nbody/src/nbody_soa.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fx += dx*power; fy += dy*power; fz += dz*power; }); *vix += fx * dt; *viy += fy * dt; *viz += fz * dt; }); } fn position_update(&mut self) { for i in 0..N_PARTICLES_SOA { self.position.x[i] += self.velocity.x[i] * DELTA_T; self.position.y[i] += self.velocity.y[i] * DE...
code_fim
hard
{ "lang": "rust", "repo": "hermitmotel/rust_parallel2019", "path": "/examples/nbody/src/nbody_soa.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemonrock/mlnx-ofed path: /workspace/mlnx-ofed-libibverbs-sys/bindgen-wrapper.conf.d/post-includes.rs use ::libc::__s32; use ::libc::__u8; use ::libc::__u16; use ::libc::__u32; <|fim_suffix|>d_mutex_t; use ::libc::pthread_cond_t;<|fim_middle|>use ::libc::__u64; use ::libc::pthrea
code_fim
easy
{ "lang": "rust", "repo": "lemonrock/mlnx-ofed", "path": "/workspace/mlnx-ofed-libibverbs-sys/bindgen-wrapper.conf.d/post-includes.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d_mutex_t; use ::libc::pthread_cond_t;<|fim_prefix|>// repo: lemonrock/mlnx-ofed path: /workspace/mlnx-ofed-libibverbs-sys/bindgen-wrapper.conf.d/post-includes.rs use ::libc::__s32; use ::libc::__u8; <|fim_middle|>use ::libc::__u16; use ::libc::__u32; use ::libc::__u64; use ::libc::pthrea
code_fim
medium
{ "lang": "rust", "repo": "lemonrock/mlnx-ofed", "path": "/workspace/mlnx-ofed-libibverbs-sys/bindgen-wrapper.conf.d/post-includes.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod definition; mod game; // Re-export all proto-definitions pub use self::definition::{Game, Player, ProtoItem};<|fim_prefix|>// repo: Bert-Proesmans/medici path: /game_system/src/prototype/mod.rs //! Specialized prototypes for our state machine. <|fim_middle|>use value_from_type_macros::value_from_ty...
code_fim
easy
{ "lang": "rust", "repo": "Bert-Proesmans/medici", "path": "/game_system/src/prototype/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// Re-export all proto-definitions pub use self::definition::{Game, Player, ProtoItem};<|fim_prefix|>// repo: Bert-Proesmans/medici path: /game_system/src/prototype/mod.rs //! Specialized prototypes for our state machine. use value_from_type_macros::value_from_type; <|fim_middle|>mod definition; mod ga...
code_fim
easy
{ "lang": "rust", "repo": "Bert-Proesmans/medici", "path": "/game_system/src/prototype/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Bert-Proesmans/medici path: /game_system/src/prototype/mod.rs //! Specialized prototypes for our state machine. <|fim_suffix|>mod definition; mod game; // Re-export all proto-definitions pub use self::definition::{Game, Player, ProtoItem};<|fim_middle|>use value_from_type_macros::value_from_ty...
code_fim
easy
{ "lang": "rust", "repo": "Bert-Proesmans/medici", "path": "/game_system/src/prototype/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fitzgen/what-the-ffi-snappy-example path: /build.rs extern crate bindgen; use std::env; use std::path::PathBuf; use std::process::Command; fn main() { println!("rerun-if-changed=build.rs"); println!("rerun-if-changed=snappy"); let root_dir = PathBuf::from( env::var("CARGO_...
code_fim
hard
{ "lang": "rust", "repo": "fitzgen/what-the-ffi-snappy-example", "path": "/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> bindings .write_to_file(root_dir.join("src/bindings.rs")) .expect("should write bindings!"); println!("cargo:rustc-link-lib=static=snappy"); println!("cargo:rustc-link-lib=c++abi"); println!("cargo:rustc-link-search={}", snappy_dir.to_str().expect("dir should...
code_fim
hard
{ "lang": "rust", "repo": "fitzgen/what-the-ffi-snappy-example", "path": "/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("cargo:rustc-link-lib=static=snappy"); println!("cargo:rustc-link-lib=c++abi"); println!("cargo:rustc-link-search={}", snappy_dir.to_str().expect("dir should be utf8")); }<|fim_prefix|>// repo: fitzgen/what-the-ffi-snappy-example path: /build.rs extern crate bindgen; u...
code_fim
hard
{ "lang": "rust", "repo": "fitzgen/what-the-ffi-snappy-example", "path": "/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Err(e) = server.write(&buf) { return Err(HttpError::gateway_timeout(e)); } } return Ok(()); } fn xfer_server_body_to_client<'a>(length: usize, server: &'a mut BufReader<TcpStream>, client: &'a ...
code_fim
hard
{ "lang": "rust", "repo": "grahamc/code-solving-problem-application-for-social-media-site-with-blogs", "path": "/http-proxy/src/proxy.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grahamc/code-solving-problem-application-for-social-media-site-with-blogs path: /http-proxy/src/proxy.rs use std::io::{BufReader, Read, Write}; use std::net::TcpStream; use httpresponse::HttpResponseParser; use httprequest::HttpRequestParser; use httpheader::Header; use httperrors::HttpError; ...
code_fim
hard
{ "lang": "rust", "repo": "grahamc/code-solving-problem-application-for-social-media-site-with-blogs", "path": "/http-proxy/src/proxy.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>hecker::DoubleLockChecker; use super::config;<|fim_prefix|>// repo: behzadnouri/rust-lock-bug-detector path: /src/double_lock_checker/mod.rs mod callgraph; mod checker; mod collector; m<|fim_middle|>od dataflow; mod genkill; mod lock; mod tracker; mod report; mod def_use; pub use self::c
code_fim
medium
{ "lang": "rust", "repo": "behzadnouri/rust-lock-bug-detector", "path": "/src/double_lock_checker/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: behzadnouri/rust-lock-bug-detector path: /src/double_lock_checker/mod.rs mod callgraph; mod checker; mod collector; m<|fim_suffix|>er; mod report; mod def_use; pub use self::checker::DoubleLockChecker; use super::config;<|fim_middle|>od dataflow; mod genkill; mod lock; mod track
code_fim
easy
{ "lang": "rust", "repo": "behzadnouri/rust-lock-bug-detector", "path": "/src/double_lock_checker/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub async fn health(data: web::Data<AppState>) -> impl Responder { let App { version, environment, .. } = &data.settings.app; HttpResponse::Ok().json(HealthResponse { version: version.to_string(), environment: environment.to_string(), }) } pub async fn config(data: web::Data<A...
code_fim
medium
{ "lang": "rust", "repo": "BGerard/rust-api-template", "path": "/src/handlers/root_handlers.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BGerard/rust-api-template path: /src/handlers/root_handlers.rs use crate::settings::App; use crate::AppState; use actix_web::{Responder, HttpResponse, web}; use serde::{Deserialize, Serialize}; pub async fn root() -> HttpResponse { HttpResponse::Ok().body("/") } <|fim_suffix|>pub async fn...
code_fim
medium
{ "lang": "rust", "repo": "BGerard/rust-api-template", "path": "/src/handlers/root_handlers.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub async fn config(data: web::Data<AppState>) -> impl Responder { HttpResponse::Ok().json(&data.settings) }<|fim_prefix|>// repo: BGerard/rust-api-template path: /src/handlers/root_handlers.rs use crate::settings::App; use crate::AppState; use actix_web::{Responder, HttpResponse, web}; use serde::{...
code_fim
hard
{ "lang": "rust", "repo": "BGerard/rust-api-template", "path": "/src/handlers/root_handlers.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dvlden/rustlings path: /exercises/quiz1.rs fn calculate_apple_price(order_amount: i32) -> i32 { if order_amount > 40 { order_amount * 1 } else { order_amount * 2 } } <|fim_suffix|> let price1 = calculate_apple_price(35); let price2 = calculate_apple_price(65);...
code_fim
easy
{ "lang": "rust", "repo": "dvlden/rustlings", "path": "/exercises/quiz1.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(70, price1); assert_eq!(65, price2); }<|fim_prefix|>// repo: dvlden/rustlings path: /exercises/quiz1.rs fn calculate_apple_price(order_amount: i32) -> i32 { if order_amount > 40 { order_amount * 1 } else { order_amount * 2 } } <|fim_middle|>#[test] fn verif...
code_fim
medium
{ "lang": "rust", "repo": "dvlden/rustlings", "path": "/exercises/quiz1.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ethan826/connect-four path: /src/lib.rs use std::{error::Error, fmt}; mod dimensions; mod game; mod space; pub use self::dimensions::Dimensions; pub use self::game::Game; pub use self::space::Space; <|fim_suffix|>impl fmt::Display for GameError { fn fmt(&self, f: &mut fmt::Formatter) -> f...
code_fim
medium
{ "lang": "rust", "repo": "Ethan826/connect-four", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Error for GameError {} impl fmt::Display for GameError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { GameError::InvalidGameDefinition => write!(f, "Invalid game definition."), GameError::InvalidGameState => write!(f, "Invalid game state."),...
code_fim
medium
{ "lang": "rust", "repo": "Ethan826/connect-four", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl fmt::Display for GameError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match self { GameError::InvalidGameDefinition => write!(f, "Invalid game definition."), GameError::InvalidGameState => write!(f, "Invalid game state."), } } }<|fim_prefi...
code_fim
medium
{ "lang": "rust", "repo": "Ethan826/connect-four", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(src & STREAM_ID_MASK, 0, "invalid stream ID -- MSB is set"); StreamId(src) } } impl From<StreamId> for u32 { fn from(src: StreamId) -> Self { src.0 } } impl PartialEq<u32> for StreamId { fn eq(&self, other: &u32) -> bool { self.0 == *other }...
code_fim
hard
{ "lang": "rust", "repo": "hyperium/h2", "path": "/src/frame/stream_id.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hyperium/h2 path: /src/frame/stream_id.rs use std::u32; /// A stream identifier, as described in [Section 5.1.1] of RFC 7540. /// /// Streams are identified with an unsigned 31-bit integer. Streams /// initiated by a client MUST use odd-numbered stream identifiers; those /// initiated by the se...
code_fim
hard
{ "lang": "rust", "repo": "hyperium/h2", "path": "/src/frame/stream_id.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: torresng/Codewars-Rust path: /Fundamentals/alternating_case_alternating_case/src/lib.rs pub fn to_alternating_case(s: &str) -> String { let mut result = String::with_capacity(s.len()); for c in s.chars() { if c.is_lowercase() { result.extend(c.to_uppercase()); } else { result.extend(...
code_fim
medium
{ "lang": "rust", "repo": "torresng/Codewars-Rust", "path": "/Fundamentals/alternating_case_alternating_case/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!("HELLO WORLD", to_alternating_case("hello world")); assert_eq!("hello world", to_alternating_case("HELLO WORLD")); assert_eq!("HELLO world", to_alternating_case("hello WORLD")); assert_eq!("hEllO wOrld", to_alternating_case("HeLLo WoRLD")); assert_eq!( ...
code_fim
hard
{ "lang": "rust", "repo": "torresng/Codewars-Rust", "path": "/Fundamentals/alternating_case_alternating_case/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for _ in 0..50 { let mut rng = thread_rng(); let l = rng.gen_range(5, 50); let s: String = rng.sample_iter(&Alphanumeric).take(l).collect(); assert_eq!(test_solution(&s[..]), to_alternating_case(&s[..])); } } }<|fim_prefix|>// repo: torr...
code_fim
medium
{ "lang": "rust", "repo": "torresng/Codewars-Rust", "path": "/Fundamentals/alternating_case_alternating_case/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GGalizzi/galaxy path: /src/game.rs use std::collections::HashMap; use ::nalgebra::Pnt2; use ::galaxy::Star; #[derive(PartialEq,Eq,Hash)] pub enum Movement { Up, Down, Left, Right } pub struct Game<'a> { pub camera: Camera, pub hovered: Option<&'a Star>, pub select...
code_fim
hard
{ "lang": "rust", "repo": "GGalizzi/galaxy", "path": "/src/game.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut a = 4.0; if self.camera.shift { a += 4.5; } a / self.camera.zoom_factor } } pub enum Zooming { In, Out, No, } pub struct Camera { pub zoom_factor: f64, pub padding: Pnt2<f64>, pub panning: HashMap<Movement, bool>, pub shift: bool, pub zo...
code_fim
hard
{ "lang": "rust", "repo": "GGalizzi/galaxy", "path": "/src/game.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn vcvttps2qq_5() { run_test(&Instruction { mnemonic: Mnemonic::VCVTTPS2QQ, operand1: Some(Direct(YMM3)), operand2: Some(Direct(XMM3)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: Some(MergeMode::Zero), sae: false, mask: Some(MaskReg::K2), broadcast: None }, &...
code_fim
hard
{ "lang": "rust", "repo": "purpleposeidon/rust-x86asm", "path": "/src/test/instruction_tests/instr_vcvttps2qq.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn vcvttps2qq_11() { run_test(&Instruction { mnemonic: Mnemonic::VCVTTPS2QQ, operand1: Some(Direct(ZMM27)), operand2: Some(Direct(YMM10)), operand3: None, operand4: None, lock: false, rounding_mode: None, merge_mode: Some(MergeMode::Zero), sae: true, mask: Some(MaskReg::K6), broadcast: None },...
code_fim
hard
{ "lang": "rust", "repo": "purpleposeidon/rust-x86asm", "path": "/src/test/instruction_tests/instr_vcvttps2qq.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: purpleposeidon/rust-x86asm path: /src/test/instruction_tests/instr_vcvttps2qq.rs use ::{BroadcastMode, Instruction, MaskReg, MergeMode, Mnemonic, OperandSize, Reg, RoundingMode}; use ::RegType::*; use ::instruction_def::*; use ::Operand::*; use ::Reg::*; use ::RegScale::*; use ::test::run_test; ...
code_fim
hard
{ "lang": "rust", "repo": "purpleposeidon/rust-x86asm", "path": "/src/test/instruction_tests/instr_vcvttps2qq.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nolik/CodeSignal path: /src/task/sort_by_height.rs //Task is to rearrange the people by their heights in a non-descending order without moving the trees. //For a = [-1, 150, 190, 170, -1, -1, 160, 180], the output should be //sortByHeight(a) = [-1, 150, 160, 170, -1, -1, 180, 190]. pub fn sort_b...
code_fim
hard
{ "lang": "rust", "repo": "nolik/CodeSignal", "path": "/src/task/sort_by_height.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for prev_value in (0..index).rev() { if list[prev_value] != -1 { println!("prev_value {:?}", list[prev_value]); return prev_value; } } println!("prev_value in the end of iter {:?}", list[index]); return index; }<|fim_prefix|>// repo: nolik/CodeSignal...
code_fim
hard
{ "lang": "rust", "repo": "nolik/CodeSignal", "path": "/src/task/sort_by_height.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LYP951018/Rrt path: /src/vertices.rs use math::{Vector2, Vector3}; pub trait Vertex { fn get_pos(&self) -> &Vector3; } macro_rules! impl_vertex { ($type: ty) => { impl Vertex for $type { fn get_pos(&self) -> &Vector3 { &self.pos } ...
code_fim
medium
{ "lang": "rust", "repo": "LYP951018/Rrt", "path": "/src/vertices.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct VertexUvn { pos: Vector3, normal: Vector3, uv: Vector2, } impl_vertex!(VertexUvn);<|fim_prefix|>// repo: LYP951018/Rrt path: /src/vertices.rs use math::{Vector2, Vector3}; pub trait Vertex { fn get_pos(&self) -> &Vector3; } macro_rules! impl_vertex { ($type: ty) => { ...
code_fim
medium
{ "lang": "rust", "repo": "LYP951018/Rrt", "path": "/src/vertices.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl CastFuncDecl { pub fn new(FuncName: &str, FuncArgs: HashMap<String, CType>, FuncCode: Box<CastStmt>, FuncRetType: CType) -> Self { CastFuncDecl { FuncName: FuncName.to_string(), FuncArgs: FuncArgs, FuncCode: ...
code_fim
hard
{ "lang": "rust", "repo": "nintenddd/carbon", "path": "/src/ast.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nintenddd/carbon path: /src/ast.rs use std::collections::HashMap; #[derive(Debug,Clone)] pub enum StorageClass { Typedef, Extern, Static, Auto, Register } #[derive(Debug,Eq,PartialEq,Clone)] pub struct TypeQualifier { pub q_const: bool, pub q_restrict: bool, pub q_volatile: boo...
code_fim
hard
{ "lang": "rust", "repo": "nintenddd/carbon", "path": "/src/ast.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pepsighan/workie path: /src/result.rs use actix_web::{http::StatusCode, HttpResponse, ResponseError, Body}; use diesel::result::{DatabaseErrorKind, Error as DieselError}; use failure::Fail; use validator::ValidationErrors; pub(crate) type WResult<T> = Result<T, Error>; #[derive(Debug, Fail)] p...
code_fim
hard
{ "lang": "rust", "repo": "pepsighan/workie", "path": "/src/result.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match kind { DatabaseErrorKind::UniqueViolation => message( StatusCode::BAD_REQUEST, r#"{ "kind": "NOT_UNIQUE", "message": "One/more fields of the record are not unique." }"# ), DatabaseErrorKind::ForeignKeyViolation => message( StatusCode::...
code_fim
hard
{ "lang": "rust", "repo": "pepsighan/workie", "path": "/src/result.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let push_object: Object = match obj { Object::Integer(_) => obj, Object::Boolean(_) => obj, Object::Float(float) => { if float.value.fract() == 0.0 { Object::Integer(float.to_integer()) } else { obj } }...
code_fim
hard
{ "lang": "rust", "repo": "shinglyu/loop", "path": "/src/vm/suffix.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shinglyu/loop path: /src/vm/suffix.rs use crate::lib::object::boolean::Boolean; use crate::lib::object::float::Float; use crate::lib::object::Object; use crate::vm::VM; use std::rc::Rc; pub fn run_suffix_expression(vm: &mut VM, operator: &str) -> Option<String> { let right = &*vm.pop(); ...
code_fim
hard
{ "lang": "rust", "repo": "shinglyu/loop", "path": "/src/vm/suffix.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // TODO: Clean this up a little let obj = match operator { ">" => Object::Boolean(Boolean { value: left_obj.value > right_obj.value, }), "+" => Object::Float(Float { value: left_obj.value + right_obj.value, }), "-" => Object::Float(Fl...
code_fim
hard
{ "lang": "rust", "repo": "shinglyu/loop", "path": "/src/vm/suffix.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> writeln!(AUDIT.write(), "{} ({:?}) cleared credentials", user, self.creds.get(&user).unwrap().username ).unwrap(); let username = &self.creds.get(&user).unwrap().username; if username != "" { Self::delete_apache_user(username); } ...
code_fim
hard
{ "lang": "rust", "repo": "Nopey/ofsvn", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let username = &self.creds.get(&user).unwrap().username; writeln!(AUDIT.write(), "{} ({:?}) set password", user, username ).unwrap(); Self::set_apache_password(username, password); } fn set_user_username(&mut self, user: UserId, username: St...
code_fim
hard
{ "lang": "rust", "repo": "Nopey/ofsvn", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nopey/ofsvn path: /src/main.rs use serenity::{ model::{channel::Message, gateway::Ready, guild::Member}, model::id::{GuildId, RoleId, UserId}, prelude::*, }; use serde_derive::*; use std::collections::HashMap; use std::fs::{File, OpenOptions}; use std::io::Write; use lazy_static::*...
code_fim
hard
{ "lang": "rust", "repo": "Nopey/ofsvn", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xing/recrep path: /src/main.rs use clap::{crate_authors, crate_version}; use clap::{App, Arg, ArgMatches}; use recrep::CrashReporter; fn main() { let app = app(); let matches = matches_for_app(app); let token = matches.value_of("token").expect("Token is required."); let version ...
code_fim
hard
{ "lang": "rust", "repo": "xing/recrep", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app.args(&[ Arg::with_name("token") .help("The AppCenter API token") .takes_value(true) .short("t") .long("token") .env("RECREP_APPCENTER_API_TOKEN") .required(true), Arg::with_name("version") .help("Th...
code_fim
hard
{ "lang": "rust", "repo": "xing/recrep", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn matches_for_app<'a>(app: App<'a, '_>) -> ArgMatches<'a> { app.args(&[ Arg::with_name("token") .help("The AppCenter API token") .takes_value(true) .short("t") .long("token") .env("RECREP_APPCENTER_API_TOKEN") .required(t...
code_fim
hard
{ "lang": "rust", "repo": "xing/recrep", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: michbuett/arena-rl path: /src/core/map.rs oU8; use crate::core::model::*; #[derive(Debug, Clone, Copy)] pub enum TileType { Floor, Void, } #[derive(Debug, Clone, Copy)] pub struct Tile(u32, u32, TileType); impl Tile { pub fn column(self: &Self) -> u32 { self.0 } ...
code_fim
hard
{ "lang": "rust", "repo": "michbuett/arena-rl", "path": "/src/core/map.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn distance(self, other: MapPos) -> usize { let dx = i32::abs(other.0 - self.0) as usize; let dy = i32::abs(other.1 - self.1) as usize; usize::max(dx, dy) } pub fn lerp(Self(x1, y1): &Self, Self(x2, y2): &Self, t: f32) -> Self { let xn = *x1 as f32 + t * (x...
code_fim
hard
{ "lang": "rust", "repo": "michbuett/arena-rl", "path": "/src/core/map.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: michbuett/arena-rl path: /src/core/map.rs ashMap}; use std::hash::{Hash, Hasher}; use std::iter::FromIterator; use std::num::NonZeroU8; use crate::core::model::*; #[derive(Debug, Clone, Copy)] pub enum TileType { Floor, Void, } #[derive(Debug, Clone, Copy)] pub struct Tile(u32, u32, T...
code_fim
hard
{ "lang": "rust", "repo": "michbuett/arena-rl", "path": "/src/core/map.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "http-client")] pub mod http; #[cfg(feature = "websocket-client")] pub mod websocket;<|fim_prefix|>// repo: melekes/tendermint-rs path: /rpc/src/client/transport.rs //! Tendermint RPC client implementations for different transports. <|fim_middle|>pub mod mock; mod router; mod utils;
code_fim
easy
{ "lang": "rust", "repo": "melekes/tendermint-rs", "path": "/rpc/src/client/transport.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: melekes/tendermint-rs path: /rpc/src/client/transport.rs //! Tendermint RPC client implementations for different transports. <|fim_suffix|>#[cfg(feature = "http-client")] pub mod http; #[cfg(feature = "websocket-client")] pub mod websocket;<|fim_middle|>pub mod mock; mod router; mod utils;
code_fim
easy
{ "lang": "rust", "repo": "melekes/tendermint-rs", "path": "/rpc/src/client/transport.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alsuren/jsonapis.rs path: /src/entities/link.rs use super::*; impl Entity for Link {} #[derive(Clone, Debug, Eq, PartialEq)] pub enum Link { String(String), Object(LinkObject), } impl Serialize for Link { fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where ...
code_fim
hard
{ "lang": "rust", "repo": "alsuren/jsonapis.rs", "path": "/src/entities/link.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: derek-mallon/rust-experiment path: /physics.rs use pool::Handle; use pool::Pool; use utils::*; use position::PositionSystem; basic_pub_all!{ pub struct PhysicsObject{ pub pos_handle:Handle, pub x_speed:f32, pub y_speed:f32, } } pub struct PhysicsSystem{ phy...
code_fim
hard
{ "lang": "rust", "repo": "derek-mallon/rust-experiment", "path": "/physics.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn update(&self,pos_system:&mut PositionSystem){ for object in &self.physics_objects.items{ pos_system.get_mut(object.pos_handle).unwrap().vec4.translate(object.x_speed,object.y_speed) } } pub fn add_physics_object(&mut self,physics_object:PhysicsObject)->Handl...
code_fim
medium
{ "lang": "rust", "repo": "derek-mallon/rust-experiment", "path": "/physics.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "fuse_lowlevel")] pub mod fuse_lowlevel { use super::*; include!(concat!(env!("OUT_DIR"), "/fuse_lowlevel.rs")); } #[cfg(feature = "cuse_lowlevel")] pub mod cuse_lowlevel { use super::*; use fuse_lowlevel::{ fuse_args, fuse_conn_info, fuse_file_info, fuse_pollhandl...
code_fim
hard
{ "lang": "rust", "repo": "Richard-W/libfuse-sys", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "cuse_lowlevel")] pub mod cuse_lowlevel { use super::*; use fuse_lowlevel::{ fuse_args, fuse_conn_info, fuse_file_info, fuse_pollhandle, fuse_req_t, fuse_session, }; include!(concat!(env!("OUT_DIR"), "/cuse_lowlevel.rs")); }<|fim_prefix|>// repo: Richard-W/libfuse-s...
code_fim
hard
{ "lang": "rust", "repo": "Richard-W/libfuse-sys", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Richard-W/libfuse-sys path: /src/lib.rs #![allow(non_snake_case)] #![allow(non_camel_case_types)] #![allow(non_upper_case_globals)] #![allow(clippy::useless_transmute)] #![allow(clippy::cognitive_complexity)] #![allow(clippy::missing_safety_doc)] use libc::*; #[cfg(feature = "fuse_highlevel")]...
code_fim
medium
{ "lang": "rust", "repo": "Richard-W/libfuse-sys", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hitallow/tic-tac-toe-ia path: /src/game/models.rs #[derive(Copy, Clone, Debug)] pub struct Move { row: i8, column: i8, } impl Move { pub fn new(row: i8, column: i8) -> Move { return Move { row, column }; } pub fn set_column(&mut self, column: i8) { self.colum...
code_fim
medium
{ "lang": "rust", "repo": "hitallow/tic-tac-toe-ia", "path": "/src/game/models.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_row(&self) -> i8 { return self.row; } }<|fim_prefix|>// repo: hitallow/tic-tac-toe-ia path: /src/game/models.rs #[derive(Copy, Clone, Debug)] pub struct Move { row: i8, column: i8, } impl Move { pub fn new(row: i8, column: i8) -> Move { return Move { row, c...
code_fim
medium
{ "lang": "rust", "repo": "hitallow/tic-tac-toe-ia", "path": "/src/game/models.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn create_decoding(&self) -> Box<dyn FnMut(&[f64]) -> Vec<u8> + Send> { let new_freq_mod = self.clone(); Box::new(move |data| { data.chunks(new_freq_mod.sample_count) .map(|x| new_freq_mod.estimator.estimate_freq(x)) .map(|x| new_freq_mod.con...
code_fim
hard
{ "lang": "rust", "repo": "saresend/bird.io", "path": "/src/frequency_modulation.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saresend/bird.io path: /src/frequency_modulation.rs use crate::traits::Strategy; use dasp::{signal, Signal}; use yin::Yin; #[derive(Clone)] pub struct NaiveFrequencyModulation { estimator: Yin, low_bit_frequency: f64, high_bit_frequency: f64, sample_count: usize, } impl NaiveFr...
code_fim
hard
{ "lang": "rust", "repo": "saresend/bird.io", "path": "/src/frequency_modulation.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Widget for TermTooSmall { fn render(self, area: Rect, buf: &mut Buffer) { let text = [ "Terminal window is too small ¯\\_(ツ)_/¯", "Window too small ¯\\_(ツ)_/¯", "too small ¯\\_(ツ)_/¯", "¯\\_(ツ)_/¯", "!!!", ]; ...
code_fim
hard
{ "lang": "rust", "repo": "imsnif/diskonaut", "path": "/src/ui/term_too_small.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let text = [ "Terminal window is too small ¯\\_(ツ)_/¯", "Window too small ¯\\_(ツ)_/¯", "too small ¯\\_(ツ)_/¯", "¯\\_(ツ)_/¯", "!!!", ]; for line in text.iter() { if area.width >= line.chars().count() as u16 { ...
code_fim
hard
{ "lang": "rust", "repo": "imsnif/diskonaut", "path": "/src/ui/term_too_small.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: imsnif/diskonaut path: /src/ui/term_too_small.rs use ::tui::buffer::Buffer; use ::tui::layout::Rect; use ::tui::style::{Modifier, Style}; use ::tui::widgets::Widget; pub struct TermTooSmall {} <|fim_suffix|>impl<'a> Widget for TermTooSmall { fn render(self, area: Rect, buf: &mut Buffer) { ...
code_fim
hard
{ "lang": "rust", "repo": "imsnif/diskonaut", "path": "/src/ui/term_too_small.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }