text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>fn solve() { let n = get(); let m = get(); let mut edges = vec![Vec::new(); n]; for _ in 0 .. m { let u = get::<usize>() - 1; let v = get::<usize>() - 1; edges[u].push(v); edges[v].push(u); } let (bip, odd, single) = bipartite(&edges); let bip = ...
code_fim
hard
{ "lang": "rust", "repo": "sogapalag/contest", "path": "/atcoder/agc011/c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sogapalag/contest path: /atcoder/agc011/c.rs #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; use std::io::Read; #[allow(dead_code)] fn getline() -> String { let mut ret = String::new(); std::io::stdin().read_line(&mut ret).ok().unwrap(); re...
code_fim
hard
{ "lang": "rust", "repo": "sogapalag/contest", "path": "/atcoder/agc011/c.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let n = get(); let m = get(); let mut edges = vec![Vec::new(); n]; for _ in 0 .. m { let u = get::<usize>() - 1; let v = get::<usize>() - 1; edges[u].push(v); edges[v].push(u); } let (bip, odd, single) = bipartite(&edges); let bip = bip as i64; ...
code_fim
hard
{ "lang": "rust", "repo": "sogapalag/contest", "path": "/atcoder/agc011/c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match content_type { ContentType::Html => self.render_html(&mut result), ContentType::Svg => self.render_svg(&mut result), ContentType::Other => {} } Some(result) } fn render_html(&self, result: &mut String) { // Allow loading a...
code_fim
hard
{ "lang": "rust", "repo": "Byron/docs.rs", "path": "/src/web/csp.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub(super) struct CspMiddleware; impl BeforeMiddleware for CspMiddleware { fn before(&self, req: &mut Request) -> IronResult<()> { req.extensions.insert::<Csp>(Csp::new()); Ok(()) } } impl AfterMiddleware for CspMiddleware { fn after(&self, req: &mut Request, mut res: Respons...
code_fim
hard
{ "lang": "rust", "repo": "Byron/docs.rs", "path": "/src/web/csp.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Byron/docs.rs path: /src/web/csp.rs use crate::config::Config; use iron::{AfterMiddleware, BeforeMiddleware, IronResult, Request, Response}; use std::fmt::Write; pub(super) struct Csp { nonce: String, suppress: bool, } impl Csp { fn new() -> Self { // Nonces need to be diff...
code_fim
hard
{ "lang": "rust", "repo": "Byron/docs.rs", "path": "/src/web/csp.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: darobs/iotedge path: /edgelet/edgelet-hsm/src/lib.rs // Copyright (c) Microsoft. All rights reserved. #![deny(rust_2018_idioms, warnings)] #![deny(clippy::all, clippy::pedantic)] #![allow( clippy::missing_errors_doc, clippy::module_name_repetitions, clippy::must_use_candidate, c...
code_fim
hard
{ "lang": "rust", "repo": "darobs/iotedge", "path": "/edgelet/edgelet-hsm/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod certificate_properties; mod crypto; mod error; pub mod tpm; pub mod x509; pub use crypto::{Certificate, Crypto}; pub use error::{Error, ErrorKind}; pub use tpm::{TpmKey, TpmKeyStore}; pub use x509::X509; #[derive(Debug)] pub struct HsmLock(Mutex<()>); impl HsmLock { /// Use this instance of `Ar...
code_fim
medium
{ "lang": "rust", "repo": "darobs/iotedge", "path": "/edgelet/edgelet-hsm/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32mp1/src/stm32mp157/cryp1/cryp_misr.rs #[doc = "Register `CRYP_MISR` reader"] pub type R = crate::R<CRYP_MISR_SPEC>; #[doc = "Field `INMIS` reader - INMIS"] pub type INMIS_R = crate::BitReader; #[doc = "Field `OUTMIS` reader - OUTMIS"] pub type OUTMIS_R = c...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/cryp1/cryp_misr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>register gives the current masked status of the corresponding interrupt, i.e. the interrupt information taking CRYP_IMSCR mask into account. Write operations have no effect.\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`cryp_misr::R`](R). See [API](https://docs.rs/svd2rust/#read-...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/cryp1/cryp_misr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub struct Protocol { pub name: AsciiString, pub version: Option<AsciiString>, }<|fim_prefix|>// repo: dennisss/dacha path: /pkg/http/src/headers/upgrade.rs // Code related to the 'Upgrade' HTTP header. <|fim_middle|>use parsing::ascii::AsciiString;
code_fim
easy
{ "lang": "rust", "repo": "dennisss/dacha", "path": "/pkg/http/src/headers/upgrade.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dennisss/dacha path: /pkg/http/src/headers/upgrade.rs // Code related to the 'Upgrade' HTTP header. <|fim_suffix|>#[derive(Debug)] pub struct Protocol { pub name: AsciiString, pub version: Option<AsciiString>, }<|fim_middle|>use parsing::ascii::AsciiString;
code_fim
easy
{ "lang": "rust", "repo": "dennisss/dacha", "path": "/pkg/http/src/headers/upgrade.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> todo!() } fn nb_recv(&self, badge: Option<&mut Badge>) -> message::Info { todo!() } fn reply_recv(&self, msg: message::Info, badge: Option<&mut Badge>) -> message::Info { todo!() } } impl SeL4SendRecv for Notification { fn call(&self, msg: message::Info) ->...
code_fim
hard
{ "lang": "rust", "repo": "Ben-PH/seL4_rust-doc", "path": "/src/kernel_api/object_interfaces/notifications/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ben-PH/seL4_rust-doc path: /src/kernel_api/object_interfaces/notifications/mod.rs //! A simple, non-blocking signalling mechanism that logically represents a set of binary semaphores. //! //! Can be [`Badge`]ed on creation to provide the reciever with an identity. pub mod interrupts; use crate:...
code_fim
hard
{ "lang": "rust", "repo": "Ben-PH/seL4_rust-doc", "path": "/src/kernel_api/object_interfaces/notifications/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> todo!() } fn nb_send(&self, msg: message::Info) { todo!() } } impl SeL4Recv for Notification { fn recv(&self, badge: Option<&mut Badge>) -> message::Info { todo!() } fn nb_recv(&self, badge: Option<&mut Badge>) -> message::Info { todo!() } fn...
code_fim
hard
{ "lang": "rust", "repo": "Ben-PH/seL4_rust-doc", "path": "/src/kernel_api/object_interfaces/notifications/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hppRC/RustAtCoder path: /abc149/src/bin/a.rs #![allow(non_snake_case)] use competitive_hpp::prelude::*; <|fim_suffix|> echo!(T + &S); }<|fim_middle|>#[fastout] fn main() { input! { S: String, T: String, }
code_fim
medium
{ "lang": "rust", "repo": "hppRC/RustAtCoder", "path": "/abc149/src/bin/a.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> echo!(T + &S); }<|fim_prefix|>// repo: hppRC/RustAtCoder path: /abc149/src/bin/a.rs #![allow(non_snake_case)] use competitive_hpp::prelude::*; #[fastout] fn main() { <|fim_middle|> input! { S: String, T: String, }
code_fim
easy
{ "lang": "rust", "repo": "hppRC/RustAtCoder", "path": "/abc149/src/bin/a.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jolestar/libra path: /config/generate-key/src/lib.rs // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 #![forbid(unsafe_code)] use libra_crypto::{ed25519::Ed25519PrivateKey, Uniform}; use rand::{rngs::OsRng, Rng, SeedableRng}; use std::{ fs::{self, File}, ...
code_fim
hard
{ "lang": "rust", "repo": "jolestar/libra", "path": "/config/generate-key/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn verify_test_create_and_load_key() { let path = TempPath::new(); path.create_as_file().unwrap(); let out_key = generate_and_save_key(path.path()); let in_key = load_key(path.path()); assert_eq!(out_key, in_key); } }<|fim_prefix|>// repo: jolest...
code_fim
hard
{ "lang": "rust", "repo": "jolestar/libra", "path": "/config/generate-key/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> prop_compose! { pub fn handle_payment_costs_arb()( get_payment_purse in num::u32::ANY, set_refund_purse in num::u32::ANY, get_refund_purse in num::u32::ANY, finalize_payment in num::u32::ANY, ) -> HandlePaymentCosts { HandlePa...
code_fim
hard
{ "lang": "rust", "repo": "nguyenminhhieu12041996/casper-node", "path": "/execution_engine/src/shared/system_config/handle_payment_costs.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nguyenminhhieu12041996/casper-node path: /execution_engine/src/shared/system_config/handle_payment_costs.rs use casper_types::bytesrepr::{self, FromBytes, ToBytes}; use datasize::DataSize; use rand::{distributions::Standard, prelude::*, Rng}; use serde::{Deserialize, Serialize}; pub const DEFAU...
code_fim
hard
{ "lang": "rust", "repo": "nguyenminhhieu12041996/casper-node", "path": "/execution_engine/src/shared/system_config/handle_payment_costs.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> HandlePaymentCosts { get_payment_purse: rng.gen(), set_refund_purse: rng.gen(), get_refund_purse: rng.gen(), finalize_payment: rng.gen(), } } } #[cfg(any(feature = "gens", test))] pub mod gens { use proptest::{num, prop_compose}; ...
code_fim
hard
{ "lang": "rust", "repo": "nguyenminhhieu12041996/casper-node", "path": "/execution_engine/src/shared/system_config/handle_payment_costs.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn read_exports(data: &[u8], atoms: &[Atom]) -> Vec<Export> { let mut reader = Cursor::new(data); let num_exports = reader.read_u32::<BigEndian>().unwrap(); let mut exports = Vec::with_capacity(num_exports as usize); for export_id in 0..num_exports { let function_atom = reader.re...
code_fim
hard
{ "lang": "rust", "repo": "hansihe/beam_code", "path": "/src/beam_module.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hansihe/beam_code path: /src/beam_module.rs use std::str::from_utf8; use std::rc::Rc; use std::io::Cursor; use std::io::Read; use std::str::FromStr; use ::beam_file::RawBeamFile; use ::raw_op::RawOp; use ::gen_op::GenOpTable; use ::Atom; use ::byteorder::{ ReadBytesExt, BigEndian }; #[derive(...
code_fim
hard
{ "lang": "rust", "repo": "hansihe/beam_code", "path": "/src/beam_module.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let num_exports = reader.read_u32::<BigEndian>().unwrap(); let mut exports = Vec::with_capacity(num_exports as usize); for export_id in 0..num_exports { let function_atom = reader.read_u32::<BigEndian>().unwrap(); let arity = reader.read_u32::<BigEndian>().unwrap(); le...
code_fim
hard
{ "lang": "rust", "repo": "hansihe/beam_code", "path": "/src/beam_module.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vladinator1000/rust-gpu path: /crates/spirv-std/src/sampler.rs /// An opaque reference to settings that de<|fim_suffix|> Clone)] pub struct Sampler { _x: u32, }<|fim_middle|>scribe how to access, filter, or /// sample an image. #[spirv(sampler)] #[derive(Copy,
code_fim
medium
{ "lang": "rust", "repo": "vladinator1000/rust-gpu", "path": "/crates/spirv-std/src/sampler.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Clone)] pub struct Sampler { _x: u32, }<|fim_prefix|>// repo: vladinator1000/rust-gpu path: /crates/spirv-std/src/sampler.rs /// An opaque reference to settings that de<|fim_middle|>scribe how to access, filter, or /// sample an image. #[spirv(sampler)] #[derive(Copy,
code_fim
medium
{ "lang": "rust", "repo": "vladinator1000/rust-gpu", "path": "/crates/spirv-std/src/sampler.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> an image. #[spirv(sampler)] #[derive(Copy, Clone)] pub struct Sampler { _x: u32, }<|fim_prefix|>// repo: vladinator1000/rust-gpu path: /crates/spirv-std/src/sampler.rs /// An opaque reference to settings that de<|fim_middle|>scribe how to access, filter, or /// sample
code_fim
easy
{ "lang": "rust", "repo": "vladinator1000/rust-gpu", "path": "/crates/spirv-std/src/sampler.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] pub struct UserToken { pub token_id: String, pub token: String, pub user: HelloUser, }<|fim_prefix|>// repo: feuyeux/kio path: /rust/kio-requester/src/common/mod.rs use std::str; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, D...
code_fim
medium
{ "lang": "rust", "repo": "feuyeux/kio", "path": "/rust/kio-requester/src/common/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: feuyeux/kio path: /rust/kio-requester/src/common/mod.rs use std::str; use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] pub struct HelloRequest { pub id: i64, pub value: String, } <|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] pub struct HelloToken ...
code_fim
medium
{ "lang": "rust", "repo": "feuyeux/kio", "path": "/rust/kio-requester/src/common/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] pub struct HelloUser { pub user_id: String, pub password: String, pub role: Option<String>, } #[derive(Serialize, Deserialize, Debug)] pub struct UserToken { pub token_id: String, pub token: String, pub user: HelloUser, }<|fim_prefix|>// re...
code_fim
medium
{ "lang": "rust", "repo": "feuyeux/kio", "path": "/rust/kio-requester/src/common/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait Renderer { type Output; fn render(&self, editor: &Editor, opts: RenderOpts) -> Self::Output; } /// renders an editor state to a string pub struct StringRenderer { // only render a particular line in the editor pub line_hint: Option<i32>, pub break_on_line_end: bool, } impl ...
code_fim
hard
{ "lang": "rust", "repo": "rosenjcb/rust-ed", "path": "/src/renderer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // draw the rectangle let mut screen: String = String::with_capacity(opts.view.area() as usize); let width = opts.view.width; let height = if let Some(_) = self.line_hint { 1 } else { opts.view.height }; let y2 = if let Som...
code_fim
hard
{ "lang": "rust", "repo": "rosenjcb/rust-ed", "path": "/src/renderer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rosenjcb/rust-ed path: /src/renderer.rs //! handles rendering an editor state use crate::editor::{Editor, Vector2}; /// contains parameters for rendering #[derive(Clone, Copy, Debug)] pub struct RenderOpts { pub view: Rect, } impl Default for RenderOpts { fn default() -> Self { ...
code_fim
hard
{ "lang": "rust", "repo": "rosenjcb/rust-ed", "path": "/src/renderer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fallenwood/fectl path: /src/utils.rs use std::env; use std::ffi::CString; use std::path::Path; use nix::unistd::Pid; /// find file in `PATH` environ pub(crate) fn find_path(name: &str) -> Option<String> { let path = Path::new(name); if path.is_file() { return Some(path.to_strin...
code_fim
hard
{ "lang": "rust", "repo": "fallenwood/fectl", "path": "/src/utils.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn get_env_vars(all: bool) -> Vec<CString> { let mut env = Vec::new(); for (k, v) in env::vars() { if (all && !k.starts_with('_')) || (k.starts_with("FECTL_FD") || k.starts_with("LANG") || k.starts_with("LC_")) { env.push(...
code_fim
hard
{ "lang": "rust", "repo": "fallenwood/fectl", "path": "/src/utils.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vtavernier/hyperion.rs path: /src/image.rs use std::convert::TryFrom; use thiserror::Error; use crate::models::Color; mod reducer; pub use reducer::*; pub trait Image: Sized { /// Get the width of the image, in pixels fn width(&self) -> u16; /// Get the height of the image, in p...
code_fim
hard
{ "lang": "rust", "repo": "vtavernier/hyperion.rs", "path": "/src/image.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Self { data, width: width as _, height: height as _, }) } } pub struct ImageView<'i, T: Image> { inner: &'i T, xmin: u16, xmax: u16, ymin: u16, ymax: u16, } impl<'i, T: Image> Image for ImageView<'i, T> { fn width(&self) ...
code_fim
hard
{ "lang": "rust", "repo": "vtavernier/hyperion.rs", "path": "/src/image.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl fmt::Display for CerbesError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{} - {}", self.code, self.msg) } }<|fim_prefix|>// repo: yo-main/akingbee path: /cerbes/src/domain/errors.rs use std::error::Error; use std::fmt; #[derive(Debug)] pub struct CerbesError ...
code_fim
hard
{ "lang": "rust", "repo": "yo-main/akingbee", "path": "/cerbes/src/domain/errors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn cant_publish_message() -> Self { CerbesError { msg: String::from("Cant publish message"), code: 400, } } } impl fmt::Display for CerbesError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{} - {}", self.code, self.msg...
code_fim
hard
{ "lang": "rust", "repo": "yo-main/akingbee", "path": "/cerbes/src/domain/errors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yo-main/akingbee path: /cerbes/src/domain/errors.rs use std::error::Error; use std::fmt; #[derive(Debug)] pub struct CerbesError { pub msg: String, pub code: u16, } impl Error for CerbesError {} <|fim_suffix|> pub fn invalid_jwt() -> Self { CerbesError { msg: St...
code_fim
hard
{ "lang": "rust", "repo": "yo-main/akingbee", "path": "/cerbes/src/domain/errors.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ields see [dcdcen](dcdcen) module"] pub type DCDCEN = crate::Reg<u32, _DCDCEN>; #[allow(missing_docs)] #[doc(hidden)] pub struct _DCDCEN; #[doc = "`read()` method returns [dcdcen::R](dcdcen::R) reader structure"] impl crate::Readable for DCDCEN {} #[doc = "`write(|w| ..)` method takes [dcdcen::W](dcdcen::...
code_fim
hard
{ "lang": "rust", "repo": "nrf-rs/nrf9160-pac", "path": "/src/regulators_ns.rs", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nrf-rs/nrf9160-pac path: /src/regulators_ns.rs #[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 1280usize], #[doc = "0x500 - System OFF register"] pub systemoff: SYSTEMOFF, _reserved1: [u8; 116usize], #[doc = "0x578 - Enable DC/DC mode of the ...
code_fim
hard
{ "lang": "rust", "repo": "nrf-rs/nrf9160-pac", "path": "/src/regulators_ns.rs", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: feifeivv/zebra path: /zebrad/src/components/tracing/component.rs use abscissa_core::{Component, FrameworkError, FrameworkErrorKind, Shutdown}; use tracing_error::ErrorLayer; use tracing_subscriber::{ fmt::Formatter, layer::SubscriberExt, reload::Handle, util::SubscriberInitExt, EnvFilter, ...
code_fim
hard
{ "lang": "rust", "repo": "feifeivv/zebra", "path": "/zebrad/src/components/tracing/component.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl std::fmt::Debug for Tracing { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Tracing").finish() } } impl<A: abscissa_core::Application> Component<A> for Tracing { fn id(&self) -> abscissa_core::component::Id { abscissa_core::component...
code_fim
hard
{ "lang": "rust", "repo": "feifeivv/zebra", "path": "/zebrad/src/components/tracing/component.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Scan)] struct Test6 { i: u32, j: u32, #[shredder(unsafe_skip)] k: NotScan, } #[derive(Scan)] struct Test7(#[shredder(unsafe_skip)] NotGcSafe); #[derive(Scan)] struct Test8<'a> { r: R<'a, str> } #[derive(Scan)] struct Test9<'a, T> { r: R<'a, T> } #[derive(Scan)] struct ...
code_fim
hard
{ "lang": "rust", "repo": "DrGabble/shredder", "path": "/tests/derive_compile/basic_scanables.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DrGabble/shredder path: /tests/derive_compile/basic_scanables.rs extern crate shredder; use std::fmt::Debug; use shredder::GcSafe; use shredder::R; use shredder::Scan; struct NotScan {} unsafe impl GcSafe for NotScan {} struct NotGcSafe {} <|fim_suffix|>#[derive(Scan)] struct Test6 { i:...
code_fim
hard
{ "lang": "rust", "repo": "DrGabble/shredder", "path": "/tests/derive_compile/basic_scanables.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Scan)] struct Test0 {} #[derive(Scan)] struct Test1(); #[derive(Scan)] struct Test2 { i: u32, } #[derive(Scan)] struct Test3 { i: u32, j: u32, k: u32, } #[derive(Scan)] struct Test4(u32, u32, u32); #[derive(Scan)] struct Test5 { i: u32, j: u32, #[shredder(skip)] ...
code_fim
medium
{ "lang": "rust", "repo": "DrGabble/shredder", "path": "/tests/derive_compile/basic_scanables.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zyxw59/conlang_fmt path: /src/blocks/control.rs use std::io::{Result as IoResult, Write}; use crate::blocks::{BlockCommon, BlockType}; use crate::document::Document; use crate::text::Text; <|fim_suffix|> fn as_control(&self) -> Option<&DocumentControl> { Some(self) } }<|fim_midd...
code_fim
hard
{ "lang": "rust", "repo": "zyxw59/conlang_fmt", "path": "/src/blocks/control.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn as_control(&self) -> Option<&DocumentControl> { Some(self) } }<|fim_prefix|>// repo: zyxw59/conlang_fmt path: /src/blocks/control.rs use std::io::{Result as IoResult, Write}; use crate::blocks::{BlockCommon, BlockType}; use crate::document::Document; use crate::text::Text; <|fim_midd...
code_fim
hard
{ "lang": "rust", "repo": "zyxw59/conlang_fmt", "path": "/src/blocks/control.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jusso-dev/RustyPhishingHook path: /api/src/main.rs use rocket::{ response::status::{Created, NoContent, NotFound}, serde::json::Json, }; use diesel::prelude::*; use rest_api::{ models::{Artist, NewArtist, UpdatedArtist}, schema::artists, ApiError, PgConnection, }; #[rocket...
code_fim
hard
{ "lang": "rust", "repo": "jusso-dev/RustyPhishingHook", "path": "/api/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[rocket::delete("/<id>")] async fn destroy(connection: PgConnection, id: i32) -> Result<NoContent, NotFound<Json<ApiError>>> { connection .run(move |c| { let affected = diesel::delete(artists::table.filter(artists::id.eq(id))) .execute(c) .expect("C...
code_fim
hard
{ "lang": "rust", "repo": "jusso-dev/RustyPhishingHook", "path": "/api/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Print text to the console println!("Hello World!"); }<|fim_prefix|>// repo: wangchenxi7/System-Dev-Testcase path: /Rust/HelloWorld.rs /** * Compile by rustc, * rustc HelloWorld.rs * ./HelloWorld * print information: * "Hello World!" * */ fn main() { <|fim_middle|> // Statements her...
code_fim
medium
{ "lang": "rust", "repo": "wangchenxi7/System-Dev-Testcase", "path": "/Rust/HelloWorld.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wangchenxi7/System-Dev-Testcase path: /Rust/HelloWorld.rs /** * Compile by rustc, * rustc HelloWorld.rs * ./HelloWorld * print information: * "Hello World!" * */ <|fim_suffix|> // Statements here are executed when the compiled binary is called // Print text to the console pr...
code_fim
easy
{ "lang": "rust", "repo": "wangchenxi7/System-Dev-Testcase", "path": "/Rust/HelloWorld.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ipetkov/conch-parser path: /tests/brace.rs #![deny(rust_2018_idioms)] use conch_parser::ast::builder::*; use conch_parser::parse::ParseError::*; use conch_parser::token::Token; mod parse_support; use crate::parse_support::*; #[test] fn test_brace_group_valid() { let mut p = make_parser("{ ...
code_fim
hard
{ "lang": "rust", "repo": "ipetkov/conch-parser", "path": "/tests/brace.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let cmds = [ ( "'{' foo\nbar; baz; }", Unexpected(Token::SingleQuote, src(0, 1, 1)), ), ( "{ foo\nbar; baz; '}'", Unmatched(Token::CurlyOpen, src(0, 1, 1)), ), ( "\"{\" foo\nbar; baz; }", Un...
code_fim
hard
{ "lang": "rust", "repo": "ipetkov/conch-parser", "path": "/tests/brace.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: olsner/rust-core path: /core/iter.rs // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org...
code_fim
hard
{ "lang": "rust", "repo": "olsner/rust-core", "path": "/core/iter.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>} impl<A, T: DoubleEndedIterator<A>> DoubleEndedIterator<A> for Invert<T> { #[inline(always)] fn next_back(&mut self) -> Option<A> { self.iter.next() } } #[inline(always)] pub fn range<A: Add<A, A> + Ord + Clone + One>(start: A, stop: A) -> Range<A> { range_step(start, stop, One::one()) } #...
code_fim
hard
{ "lang": "rust", "repo": "olsner/rust-core", "path": "/core/iter.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sfackler/rust-native-tls path: /examples/simple-server.rs extern crate native_tls; use native_tls::{Identity, TlsAcceptor, TlsStream}; use std::fs::File; use std::io::Read; use std::net::{TcpListener, TcpStream}; use std::sync::Arc; use std::thread; fn main() { let mut file = File::open("i...
code_fim
hard
{ "lang": "rust", "repo": "sfackler/rust-native-tls", "path": "/examples/simple-server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // ... } for stream in listener.incoming() { match stream { Ok(stream) => { let acceptor = acceptor.clone(); thread::spawn(move || { let stream = acceptor.accept(stream).unwrap(); handle_client(str...
code_fim
hard
{ "lang": "rust", "repo": "sfackler/rust-native-tls", "path": "/examples/simple-server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl WidthOrNumber { pub fn is_automatic(width: &WidthOrNumber) -> bool { match width { WidthOrNumber::Width(Width::Automatic) => true, _ => false, } } pub fn is_stretch(width: &WidthOrNumber) -> bool { match width { WidthOrNumber::W...
code_fim
medium
{ "lang": "rust", "repo": "Peternator7/botframework-rs", "path": "/adaptive_cards/src/props/width.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Peternator7/botframework-rs path: /adaptive_cards/src/props/width.rs use std::default::Default; use serde_derive::{Serialize,Deserialize}; #[derive(Serialize, Deserialize, Copy, Clone, Eq, PartialEq, Debug)] #[serde(rename_all = "camelCase")] pub enum Width { Automatic, Stretch, } impl...
code_fim
hard
{ "lang": "rust", "repo": "Peternator7/botframework-rs", "path": "/adaptive_cards/src/props/width.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn is_number(width: &WidthOrNumber) -> bool { match width { WidthOrNumber::Number(_) => true, _ => false, } } }<|fim_prefix|>// repo: Peternator7/botframework-rs path: /adaptive_cards/src/props/width.rs use std::default::Default; use serde_derive::{Seri...
code_fim
hard
{ "lang": "rust", "repo": "Peternator7/botframework-rs", "path": "/adaptive_cards/src/props/width.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sgaflv/euler path: /src/helpers/prime.rs pub fn is_prime(num: u64) -> bool { if num == 2 { return true; } if num % 2 == 0 { return false; } let mut i = 3; let max = (num as f64).sqrt() as u64; while i <= max { if num % i == 0 { r...
code_fim
hard
{ "lang": "rust", "repo": "sgaflv/euler", "path": "/src/helpers/prime.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Iterator for PrimeIterator { type Item = u64; fn next(&mut self) -> Option<Self::Item> { if self.last_prime < 2 { self.last_prime = 2; return Some(2) } if self.last_prime < 3 { self.last_prime = 3; return Some(3) ...
code_fim
hard
{ "lang": "rust", "repo": "sgaflv/euler", "path": "/src/helpers/prime.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl PrimeIterator { pub fn new() -> PrimeIterator { PrimeIterator { last_prime: 0 } } } impl Iterator for PrimeIterator { type Item = u64; fn next(&mut self) -> Option<Self::Item> { if self.last_prime < 2 { self.last_prime = 2; ...
code_fim
hard
{ "lang": "rust", "repo": "sgaflv/euler", "path": "/src/helpers/prime.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { TASK_NEW = task_new as _; TASK_RUN = task_run as _; TASK_WAKE = task_wake as _; TASK_DATA = task_data as _; } } /// Task poll function which should be called to resume task #[export_name = "rust_async_executor_poll"] pub extern "C" fn task_poll(data: Inter...
code_fim
hard
{ "lang": "rust", "repo": "katyo/extern_executor", "path": "/src/ffi.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// C function which can run created tasks pub type TaskRun = extern "C" fn(ExternTask, InternTask); /// C function which can wake created task /// /// This function will be called when pending future need to be polled again pub type TaskWake = extern "C" fn(ExternTask); /// Initialize async executor by...
code_fim
medium
{ "lang": "rust", "repo": "katyo/extern_executor", "path": "/src/ffi.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: katyo/extern_executor path: /src/ffi.rs use crate::{UserData, BoxedPoll, Box, global}; /// Raw external task handle pub type ExternTask = UserData; /// Raw external data pub type ExternData = UserData; /// Rust internal task handle pub type InternTask = UserData; <|fim_suffix|>/// C function...
code_fim
hard
{ "lang": "rust", "repo": "katyo/extern_executor", "path": "/src/ffi.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Garvys/tensorflow-deploy-rust path: /tfdeploy-tf/src/ops/nn/mod.rs use tfdeploy::analyser::rules::prelude::*; use tfdeploy::ops::prelude::*; use ops::OpRegister; use tfpb::node_def::NodeDef; pub mod conv2d; pub mod local_patch; pub mod pools; pub mod space_to_batch; <|fim_suffix|>impl Softmax...
code_fim
hard
{ "lang": "rust", "repo": "Garvys/tensorflow-deploy-rust", "path": "/tfdeploy-tf/src/ops/nn/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl InferenceRulesOp for Softmax { /// Registers the inference rules of the operator. fn rules<'r, 'p: 'r, 's: 'r>( &'s self, solver: &mut Solver<'r>, inputs: &'p TensorsProxy, outputs: &'p TensorsProxy, ) { solver .equals(&inputs.len, 1) ...
code_fim
hard
{ "lang": "rust", "repo": "Garvys/tensorflow-deploy-rust", "path": "/tfdeploy-tf/src/ops/nn/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lukaslueg/dumpcap-rust path: /examples/capture/main.rs extern crate dumpcap; fn main() { let d = dumpcap::Dumpcap::default(); println!("{}", d.version_string().unwrap()); let (mut child, handler) = d.capture(dumpcap::Arguments::default().stop_on_dur<|fim_suffix|> .unwrap();...
code_fim
hard
{ "lang": "rust", "repo": "lukaslueg/dumpcap-rust", "path": "/examples/capture/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> .unwrap(); assert!(child.wait().unwrap().success()); assert!(handler.join().is_ok()); }<|fim_prefix|>// repo: lukaslueg/dumpcap-rust path: /examples/capture/main.rs extern crate dumpcap; fn main() { let d = dumpcap::Dumpcap::default(); println!("{}", d.version_string().unwrap())...
code_fim
hard
{ "lang": "rust", "repo": "lukaslueg/dumpcap-rust", "path": "/examples/capture/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JamesLinus/titanium-draft path: /src/arch/aarch64/pagetable.rs use core::iter::range; use titanium::io::{VolatileAccess, Default}; use titanium::consts::*; use titanium::arch::consts::*; use arch::{PTE_ATTRS_MMIO, PTE_ATTRS_RAM, PAGE_SIZE}; use mm::PageArena; pub struct PageTable<A = Default> ...
code_fim
hard
{ "lang": "rust", "repo": "JamesLinus/titanium-draft", "path": "/src/arch/aarch64/pagetable.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // invalidate all to PoU reg32_write!(iciallu, 0); dsb!(); // TODO: invalidate i- and c- cache by set-way // TODO: move to head? reg32_write!(tlbiall, 0); dsb!(); } }<|fim_prefix|>// repo: JamesLinus/titanium-draft path: /src/arch/aarch64/paget...
code_fim
hard
{ "lang": "rust", "repo": "JamesLinus/titanium-draft", "path": "/src/arch/aarch64/pagetable.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn run() -> Result<()> { { let data = get_data("data/18.txt")?; let outcome = duet(data); println!("v1: {}", outcome); } { let data = get_data("data/18.txt")?; let outcome = duet2(data); println!("v2: {}", outcome); } Ok(()) } fn main()...
code_fim
hard
{ "lang": "rust", "repo": "adwhit/advent-of-code-2017", "path": "/src/bin/18_duet.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adwhit/advent-of-code-2017 path: /src/bin/18_duet.rs #![feature(entry_or_default)] extern crate advent_of_code; #[macro_use] extern crate failure; #[macro_use] extern crate nom; use advent_of_code::Result; use std::fs; use std::io::prelude::*; use std::collections::HashMap; use std::sync::mps...
code_fim
hard
{ "lang": "rust", "repo": "adwhit/advent-of-code-2017", "path": "/src/bin/18_duet.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn duet2(code: Vec<Instruction>) -> i64 { let (tx0, rx1) = mpsc::channel(); let (tx1, rx0) = mpsc::channel(); let mut state0 = State::new2(code.clone(), 0, tx0, rx0); let mut state1 = State::new2(code, 1, tx1, rx1); std::thread::spawn(move || state0.run2()); state1.run2() } fn run...
code_fim
hard
{ "lang": "rust", "repo": "adwhit/advent-of-code-2017", "path": "/src/bin/18_duet.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/crypto-crawler-rs path: /crypto-crawler/src/crawlers/bithumb.rs use std::sync::{ atomic::{AtomicBool, AtomicUsize, Ordering}, Arc, Mutex, }; use std::{collections::HashMap, time::Duration}; use super::utils::{check_args, fetch_symbols_retry}; use crate::{msg::Message, MessageTy...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/crypto-crawler-rs", "path": "/crypto-crawler/src/crawlers/bithumb.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[rustfmt::skip] gen_crawl_event!(crawl_trade, BithumbWSClient, MessageType::Trade, subscribe_trade); #[rustfmt::skip] gen_crawl_event!(crawl_l2_event, BithumbWSClient, MessageType::L2Event, subscribe_orderbook);<|fim_prefix|>// repo: isgasho/crypto-crawler-rs path: /crypto-crawler/src/crawlers/bithumb.r...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/crypto-crawler-rs", "path": "/crypto-crawler/src/crawlers/bithumb.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // parse program several namespaces let raw_program = parser.program( ".command1 first_subj .also .command2 second_subj" ).unwrap(); // convert program let grammar_program = grammar_converter.to_program( raw_program ).unwrap(); a_true!( grammar_program.namespaces.len() == 2 ); a_t...
code_fim
hard
{ "lang": "rust", "repo": "dmvict/wTools", "path": "/rust/test/ca/inc/grammar/from_program.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dmvict/wTools path: /rust/test/ca/inc/grammar/from_program.rs use super::*; // tests_impls! { fn basic() { let parser = Parser::former().form(); // init converter let grammar_converter = GrammarConverter::former() .command ( wca::Command::former() .hint( "h...
code_fim
hard
{ "lang": "rust", "repo": "dmvict/wTools", "path": "/rust/test/ca/inc/grammar/from_program.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub mod destination_to_velocity; pub use destination_to_velocity::*; pub mod remove_destination_on_arrival; pub use remove_destination_on_arrival::*;<|fim_prefix|>// repo: TopSwagCode/Codename.TheBsGame path: /server/src/game/systems/mod.rs pub mod velocity_to_position; pub use velocity_to_position::*; ...
code_fim
easy
{ "lang": "rust", "repo": "TopSwagCode/Codename.TheBsGame", "path": "/server/src/game/systems/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TopSwagCode/Codename.TheBsGame path: /server/src/game/systems/mod.rs pub mod velocity_to_position; pub use velocity_to_position::*; <|fim_suffix|>pub mod remove_destination_on_arrival; pub use remove_destination_on_arrival::*;<|fim_middle|>pub mod handle_commands; pub use handle_commands::*; p...
code_fim
medium
{ "lang": "rust", "repo": "TopSwagCode/Codename.TheBsGame", "path": "/server/src/game/systems/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (tx, rx) = mpsc::channel(100); test_interface.rpc_service_state.set_utxos_by_block_trigger_channel(rx); tokio::spawn(test_interface.scanner_service.take().unwrap().run()); tx.send(usize::try_from(SYNC_INTERRUPT).unwrap()).await.unwrap(); let _result = test_interface .rpc...
code_fim
hard
{ "lang": "rust", "repo": "tari-project/tari", "path": "/base_layer/wallet/tests/utxo_scanner/mod.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tari-project/tari path: /base_layer/wallet/tests/utxo_scanner/mod.rs final_height, num_recovered, value_recovered, time_taken: _, } = event.unwrap() { assert_eq!(final_height, NUM_BLOCKS - 1); ...
code_fim
hard
{ "lang": "rust", "repo": "tari-project/tari", "path": "/base_layer/wallet/tests/utxo_scanner/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tari-project/tari path: /base_layer/wallet/tests/utxo_scanner/mod.rs ync fn generate_block_headers_and_utxos( start_height: u64, num_blocks: u64, birthday_epoch_time: u64, birthday_offset: u64, only_coinbase: bool, key_manager: &TestKeyManager, ) -> TestBlockData { le...
code_fim
hard
{ "lang": "rust", "repo": "tari-project/tari", "path": "/base_layer/wallet/tests/utxo_scanner/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn gsw_keygen_pk() { let gsw = create_gsw(); let pk = &gsw.public_key; let B = pk.B.to_owned(); let B_vec = B.clone().into_raw_vec(); let e = pk.e.to_owned(); let e_vec = e.to_vec(); let b = pk.b.to_owned(); let b_vec = b.to_...
code_fim
hard
{ "lang": "rust", "repo": "pmuens/haven", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pmuens/haven path: /src/lib.rs //! `haven` is a modern lattice cryptography library. //! //! It aims to provide safe, ergonomic and fast cryptographic building blocks. //! //! The focus right now is on (Fully) Homomorphic Encryption schemes, however the overall goal is //! to support various lat...
code_fim
hard
{ "lang": "rust", "repo": "pmuens/haven", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let pair = (0..num_element) .map(|_| { let mut elements_str = String::new(); io::stdin() .read_line(&mut elements_str) .ok() .expect("read error"); let row: Vec<i32> = elemen...
code_fim
hard
{ "lang": "rust", "repo": "hrektts/piece-of-code", "path": "/hackerrank/algorithms/warmup/diagonal-difference/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hrektts/piece-of-code path: /hackerrank/algorithms/warmup/diagonal-difference/src/main.rs use std::io; fn main() { let mut num_element_str = String::new(); io::stdin() .read_line(&mut num_element_str) .ok() .expect("read error"); <|fim_suffix|> let pair = ...
code_fim
hard
{ "lang": "rust", "repo": "hrektts/piece-of-code", "path": "/hackerrank/algorithms/warmup/diagonal-difference/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jakobhartmann/tensat path: /taso_bindings.rs N4taso9Pool2DKey10KEY_LENGTHE"] pub static Pool2DKey_KEY_LENGTH: ::std::os::raw::c_int; } #[test] fn bindgen_test_layout_Pool2DKey() { assert_eq!( ::std::mem::size_of::<Pool2DKey>(), ...
code_fim
hard
{ "lang": "rust", "repo": "jakobhartmann/tensat", "path": "/taso_bindings.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>1}_ZN4taso5Graph13reduce_argminEPNS_6TensorERKSt6vectorIiSaIiEEb"] pub fn Graph_reduce_argmin( this: *mut root::taso::Graph, _input: root::taso::TensorHandle, axes: *const [u64; 3usize], keepdims: bool, ) -> root::taso...
code_fim
hard
{ "lang": "rust", "repo": "jakobhartmann/tensat", "path": "/taso_bindings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>rg1: *mut root::taso::Reduce) { Model_measure_reduce_cost(self, arg1) } #[inline] pub unsafe fn measure_reshape_cost(&mut self, arg1: *mut root::taso::Reshape) { Model_measure_reshape_cost(self, arg1) } #[inline] ...
code_fim
hard
{ "lang": "rust", "repo": "jakobhartmann/tensat", "path": "/taso_bindings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: linkerd/linkerd2-proxy path: /linkerd/router/src/cache.rs use crate::NewService; use ahash::AHashMap; use parking_lot::Mutex; use std::{fmt::Debug, hash::Hash, marker::PhantomData, sync::Arc}; /// A [`NewService`] that produces [`Cache`]s. #[derive(Debug)] pub struct NewCache<K, N> { inner:...
code_fim
hard
{ "lang": "rust", "repo": "linkerd/linkerd2-proxy", "path": "/linkerd/router/src/cache.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<K, N> NewService<K> for Cache<K, N, N::Service> where K: Eq + Hash + Clone, N: NewService<K>, N::Service: Clone, { type Service = N::Service; fn new_service(&self, key: K) -> Self::Service { self.services .lock() .entry(key.clone()) .or...
code_fim
hard
{ "lang": "rust", "repo": "linkerd/linkerd2-proxy", "path": "/linkerd/router/src/cache.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>// === impl NewCache === impl<K, N> NewCache<K, N> { pub fn new(inner: N) -> Self { Self { inner, _marker: PhantomData, } } } impl<T, K, N, M> NewService<T> for NewCache<K, N> where T: Clone, N: NewService<T, Service = M>, M: NewService<K>, { ...
code_fim
hard
{ "lang": "rust", "repo": "linkerd/linkerd2-proxy", "path": "/linkerd/router/src/cache.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) trait SinkUntyped { fn poll(&mut self) -> Poll<(), httpbis::StreamDead>; fn send_data(&mut self, message: Bytes) -> result::Result<()>; } pub(crate) struct SinkCommonUntyped<T: Types> { pub(crate) http: T::HttpSink, } impl<T: Types> SinkCommonUntyped<T> { pub fn send_data(&mut...
code_fim
medium
{ "lang": "rust", "repo": "pha2miki/grpc-rust", "path": "/grpc/src/common/sink.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pha2miki/grpc-rust path: /grpc/src/common/sink.rs use bytes::Bytes; use client::types::ClientTypes; use common::http_sink::HttpSink; use common::types::Types; use error; use futures::Poll; use httpbis; use marshall::Marshaller; use or_static::arc::ArcOrStatic; use proto::grpc_frame::write_grpc_f...
code_fim
medium
{ "lang": "rust", "repo": "pha2miki/grpc-rust", "path": "/grpc/src/common/sink.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>} pub(crate) struct SinkCommonUntyped<T: Types> { pub(crate) http: T::HttpSink, } impl<T: Types> SinkCommonUntyped<T> { pub fn send_data(&mut self, message: Bytes) -> result::Result<()> { // TODO: allocation self.http .send_data(Bytes::from(write_grpc_frame_to_vec(&me...
code_fim
medium
{ "lang": "rust", "repo": "pha2miki/grpc-rust", "path": "/grpc/src/common/sink.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }