text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: Istar-Eldritch/biot path: /src/biot/frequent_words.rs use biot::{pattern_count, approx_pattern_count, neighbors}; pub fn frequent_words(text: &str, k: usize) -> Vec<String> { let mut frequents = vec!(); if k > 0 && text.len() > k { let mut count = vec!(); for i in 0..(text.len() -...
code_fim
hard
{ "lang": "rust", "repo": "Istar-Eldritch/biot", "path": "/src/biot/frequent_words.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } } #[cfg(test)] mod symbol_to_number_test { use super::symbol_to_number; #[test] fn it_maps_uppercase() { assert!(symbol_to_number('A') == 0); assert!(symbol_to_number('C') == 1); assert!(symbol_to_number('G') == 2); assert!(symbol_to_number('T') == 3); } } #[cfg(test)] mod ...
code_fim
hard
{ "lang": "rust", "repo": "Istar-Eldritch/biot", "path": "/src/biot/frequent_words.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: winnsterx/usrsctp path: /usrsctplib/programs/chargen_server_upcall.rs ibc::c_void; #[no_mangle] fn free(__ptr: *mut libc::c_void); #[no_mangle] fn memset(_: *mut libc::c_void, _: libc::c_int, _: libc::c_ulong) -> *mut libc::c_void; #[no_mangle] fn strlen(_: *const li...
code_fim
hard
{ "lang": "rust", "repo": "winnsterx/usrsctp", "path": "/usrsctplib/programs/chargen_server_upcall.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #[no_mangle] fn debug_printf_stack(format: *const libc::c_char, _: ...); } pub type size_t = libc::c_ulong; pub type __uint8_t = libc::c_uchar; pub type __uint16_t = libc::c_ushort; pub type __uint32_t = libc::c_uint; pub type __ssize_t = libc::c_long; pub type __socklen_t = libc::c_uint; pub type...
code_fim
hard
{ "lang": "rust", "repo": "winnsterx/usrsctp", "path": "/usrsctplib/programs/chargen_server_upcall.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: winnsterx/usrsctp path: /usrsctplib/programs/chargen_server_upcall.rs : uint8_t, _: uint8_t) -> libc::c_int>, _: Option<unsafe extern "C" fn(_: *const libc::c_char, ...
code_fim
hard
{ "lang": "rust", "repo": "winnsterx/usrsctp", "path": "/usrsctplib/programs/chargen_server_upcall.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZcashFoundation/zebra path: /zebra-chain/src/block/arbitrary.rs nbase tx is always generated, so if // `transaction_count` is zero, the block will contain only the coinbase tx. (0..MAX_ARBITRARY_ITEMS).prop_flat_map(move |transaction_count| { Transaction::...
code_fim
hard
{ "lang": "rust", "repo": "ZcashFoundation/zebra", "path": "/zebra-chain/src/block/arbitrary.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> // now that we've made all the changes, calculate our block hash, // so the next block can use it previous_block_hash = Some(block.hash()); } SummaryDebug( vec.into_iter() .map(|(_height, block)| Ar...
code_fim
hard
{ "lang": "rust", "repo": "ZcashFoundation/zebra", "path": "/zebra-chain/src/block/arbitrary.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZcashFoundation/zebra path: /zebra-chain/src/block/arbitrary.rs rns a strategy for creating vectors of blocks with increasing height. /// /// Each vector is `count` blocks long. /// /// `check_transparent_coinbase_spend` is used to check if /// transparent coinbase UTXOs are ...
code_fim
hard
{ "lang": "rust", "repo": "ZcashFoundation/zebra", "path": "/zebra-chain/src/block/arbitrary.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> assert!(input.supports_passthrough()); let mut opus_buf = [0u8; 10_000]; let mut signal_buf = [0i16; 1920]; let opus_len = input.read_opus_frame(&mut opus_buf[..]).unwrap(); let mut decoder = Decoder::new(SampleRate::Hz48000, Channels::Stereo).unwrap(); decoder .decode(S...
code_fim
hard
{ "lang": "rust", "repo": "peppizza/songbird-yt-dlp", "path": "/src/input/cached/tests.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> let data = make_sine(50 * MONO_FRAME_SIZE, stereo); let input = Input::new(stereo, data.into(), Codec::FloatPcm, Container::Raw, None); Compressed::new(input, Bitrate::BitsPerSecond(128_000)).unwrap() } fn run_through_dca(mut src: impl Read) { let mut decoder = Decoder::new(SampleRate::...
code_fim
hard
{ "lang": "rust", "repo": "peppizza/songbird-yt-dlp", "path": "/src/input/cached/tests.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: peppizza/songbird-yt-dlp path: /src/input/cached/tests.rs use super::*; use crate::{ constants::*, input::{error::Error, Codec, Container, Input}, test_utils::*, }; use audiopus::{coder::Decoder, Bitrate, Channels, SampleRate}; use byteorder::{LittleEndian, ReadBytesExt}; use std::io...
code_fim
hard
{ "lang": "rust", "repo": "peppizza/songbird-yt-dlp", "path": "/src/input/cached/tests.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dgreid/crosvm path: /hypervisor/src/lib.rs ::*; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub use crate::x86_64::*; /// An index in the list of guest-mapped memory regions. pub type MemSlot = u32; /// A trait for checking hypervisor capabilities. pub trait Hypervisor: Send { ...
code_fim
hard
{ "lang": "rust", "repo": "dgreid/crosvm", "path": "/hypervisor/src/lib.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dgreid/crosvm path: /hypervisor/src/lib.rs 64::*; pub use crate::caps::*; #[cfg(any(target_arch = "x86", target_arch = "x86_64"))] pub use crate::x86_64::*; /// An index in the list of guest-mapped memory regions. pub type MemSlot = u32; /// A trait for checking hypervisor capabilities. pub tr...
code_fim
hard
{ "lang": "rust", "repo": "dgreid/crosvm", "path": "/hypervisor/src/lib.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/// Used in `Vm::register_ioevent` to indicate a size and optionally value to match. #[derive(PartialEq, Eq)] pub enum Datamatch { AnyLength, U8(Option<u8>), U16(Option<u16>), U32(Option<u32>), U64(Option<u64>), } /// A reason why a VCPU exited. One of these returns every time `Vcpu::...
code_fim
hard
{ "lang": "rust", "repo": "dgreid/crosvm", "path": "/hypervisor/src/lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#[test] pub fn validate_when_depth_in_range_should_not_err() { let mut options = StarMapOptions::defaults(); options.depth = ZERO; assert_eq!(Ok(()), options.validate()); options.depth = ONE; assert_eq!(Ok(()), options.validate()); } // Depth #[test] pub fn validate_when_depth_distrib...
code_fim
hard
{ "lang": "rust", "repo": "Sibz/star_map_generator", "path": "/src/tests/options.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// Depth #[test] pub fn validate_when_depth_greater_than_one_should_err() { let mut options = StarMapOptions::defaults(); options.depth = JUST_OVER_ONE; assert_ne!(Ok(()), options.validate()); } #[test] pub fn validate_when_depth_less_than_zero_should_err() { let mut options = StarMapOpti...
code_fim
hard
{ "lang": "rust", "repo": "Sibz/star_map_generator", "path": "/src/tests/options.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Sibz/star_map_generator path: /src/tests/options.rs use crate::options::StarMapOptions; //use crate::generate::generate_into_slice; //use crate::generate; //use crate::StarMapEntry; const JUST_OVER_ONE: f32 = 1f32 + std::f32::EPSILON; const JUST_UNDER_ZERO: f32 = -std::f32::EPSILON; const ONE:...
code_fim
hard
{ "lang": "rust", "repo": "Sibz/star_map_generator", "path": "/src/tests/options.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: staaas/meteostation-pi path: /src/closures.rs use core::Metrics; use sensors::{DataPoint, Sensor}; pub struct UpdateClosure<S> { sensor: S, metrics: Metrics, } impl<S> UpdateClosure<S> where S: Sensor, { pub fn new(sensor: S, metrics: Metrics) -> Self { UpdateClosure { ...
code_fim
hard
{ "lang": "rust", "repo": "staaas/meteostation-pi", "path": "/src/closures.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // then temperature and humidity have default value 0.0 assert_eq!(metrics2.get_temperature(), 0.0); assert_eq!(metrics2.get_humidity(), 0.0); // and no successful observations were registered assert_eq!(metrics2.get_ok_count(), 0.0); // and error count equa...
code_fim
hard
{ "lang": "rust", "repo": "staaas/meteostation-pi", "path": "/src/closures.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn add32(opcd: u32, dst: Var, x: Var, y: Var) -> Self { Instruction { lh: Some(dst), lh_c: None, lh_v: None, rh: Operation::Arith(ArithOp::Add32(x, y)), guest_op: opcd, } } pub fn sub32(opcd: u32, dst: Var, x: Var, y: Var) -> Self { ...
code_fim
hard
{ "lang": "rust", "repo": "eigenform/nil", "path": "/src/ir/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: eigenform/nil path: /src/ir/mod.rs mod fmt; use crate::guest; /// Type used to identify a variable in the IR. pub type VarId = usize; /// Representing a particular kind of variable in the IR. #[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] pub enum VarKind { /// Typic...
code_fim
hard
{ "lang": "rust", "repo": "eigenform/nil", "path": "/src/ir/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tatetian/ngo2 path: /src/libos/src/fs/file_ops/lseek.rs use super::*; pub fn do_lseek(fd: FileDesc, offset: SeekFrom) -> Result<usize> { debug!("lseek: fd: {:?}, offset: {:?}", fd, offset); let file_ref = cu<|fim_suffix|> .ok_or_else(|| errno!(EINVAL, "not an inode"))?; inode_file...
code_fim
medium
{ "lang": "rust", "repo": "tatetian/ngo2", "path": "/src/libos/src/fs/file_ops/lseek.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> .ok_or_else(|| errno!(EINVAL, "not an inode"))?; inode_file.seek(offset) }<|fim_prefix|>// repo: tatetian/ngo2 path: /src/libos/src/fs/file_ops/lseek.rs use super::*; pub fn do_lseek(fd: FileDesc, offset: SeekFrom) -> Result<usize> <|fim_middle|>{ debug!("lseek: fd: {:?}, offset: {:?}", fd, o...
code_fim
medium
{ "lang": "rust", "repo": "tatetian/ngo2", "path": "/src/libos/src/fs/file_ops/lseek.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>rrent!().file(fd)?; let inode_file = file_ref .as_inode_file() .ok_or_else(|| errno!(EINVAL, "not an inode"))?; inode_file.seek(offset) }<|fim_prefix|>// repo: tatetian/ngo2 path: /src/libos/src/fs/file_ops/lseek.rs use super::*; pub fn do_lseek(fd: FileDesc, offset: SeekFrom) ->...
code_fim
medium
{ "lang": "rust", "repo": "tatetian/ngo2", "path": "/src/libos/src/fs/file_ops/lseek.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let id_string = std::string::String::from(#id_string); let this_namespace = parent_namespace.as_ref().map_or(id_string.clone(), |ns| std::format!("{}.{}", ns, &id_string)); #body } } ).into() }<|fim_prefix|>// repo: bzm3r/avro-schema-...
code_fim
hard
{ "lang": "rust", "repo": "bzm3r/avro-schema-derive", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bzm3r/avro-schema-derive path: /src/lib.rs mod error; mod maps; use crate::maps::{extract_named_fields, map_enum, map_struct, map_union, marked_skip}; use quote::quote; use std::error::Error as ErrorTrait; use std::iter::Iterator; use syn::{ parse_macro_input, Data, DataEnum, DataStruct, De...
code_fim
medium
{ "lang": "rust", "repo": "bzm3r/avro-schema-derive", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Kind of a Register. #[derive(Clone, Copy, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize, Debug)] pub enum Kind { /// Public sequence. Public, /// Private sequence. Private, } impl Kind { /// Returns true if public. pub fn is_public(self) -> bool { self =...
code_fim
hard
{ "lang": "rust", "repo": "ajunlonglive/sn_data_types", "path": "/src/register/metadata.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajunlonglive/sn_data_types path: /src/register/metadata.rs // Copyright 2021 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // https://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/lic...
code_fim
hard
{ "lang": "rust", "repo": "ajunlonglive/sn_data_types", "path": "/src/register/metadata.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns true if public. pub fn is_public(&self) -> bool { self.kind().is_public() } /// Returns true if private. pub fn is_private(&self) -> bool { self.kind().is_private() } /// Returns the `Address` serialised and encoded in z-base-32. pub fn encode_...
code_fim
hard
{ "lang": "rust", "repo": "ajunlonglive/sn_data_types", "path": "/src/register/metadata.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let mut ans = 0_usize; for (sum, c1) in count1 { let c2 = match x.cmp(&sum) { std::cmp::Ordering::Less => 0_usize, std::cmp::Ordering::Equal => 1_usize, std::cmp::Ordering::Greater => *count2.get(&(x - sum)).unwrap_or(&0), }; ans += c1 * ...
code_fim
hard
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-compete/pastbook1/src/bin/223.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /cargo-compete/pastbook1/src/bin/223.rs use std::collections::HashMap; use proconio::input; fn main() { input! { n: usize, x: usize, w: [usize; n], } <|fim_suffix|> let mut ans = 0_usize; for (sum, c1) in count1 { let c...
code_fim
hard
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/cargo-compete/pastbook1/src/bin/223.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert!(!smaller.can_hold(&larger)) } #[test] #[should_panic(expected = "Negative values")] // Parts of the panic message is enough fn negtive_attributes_are_not_allowed() { Rectangle::new(-3, 2); } #[test] // TODO: this might not be the proper way to test Resu...
code_fim
hard
{ "lang": "rust", "repo": "ucyo/tdd-rust", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn can_hold(&self, other: &Rectangle) -> bool { self.length >= other.length && self.width >= other.width } pub fn packing(&self, other: &Rectangle) -> Result<bool, String> { if self.can_hold(other){ Ok(true) } else { Err(String::from("If I c...
code_fim
hard
{ "lang": "rust", "repo": "ucyo/tdd-rust", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ucyo/tdd-rust path: /src/lib.rs /* * Unit tests: Unit tests are small and more focused, testing one module in isolation at a time, and can test private interfaces - "unit tests go in the same files as the code" * Integration tests: Integration tests are entirely external to your library a...
code_fim
hard
{ "lang": "rust", "repo": "ucyo/tdd-rust", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azriel91/autexousious path: /crate/object_status_play/src/lib.rs #![deny(missing_debug_implementations, missing_docs)] // kcov-ignore <|fim_suffix|>pub use crate::system::StunPointsReductionSystem; mod system;<|fim_middle|>//! Provides logic used during game play.
code_fim
easy
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/object_status_play/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use crate::system::StunPointsReductionSystem; mod system;<|fim_prefix|>// repo: azriel91/autexousious path: /crate/object_status_play/src/lib.rs #![deny(missing_debug_implementations, missing_docs)] // kcov-ignore <|fim_middle|>//! Provides logic used during game play.
code_fim
easy
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/object_status_play/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pimox/proxmox path: /proxmox-api-macro/tests/types.rs //! This should test the usage of "external" types. For any unrecognized schema type we expect the //! type's impl to provide an `pub const API_SCHEMA: &Schema`. #![allow(dead_code)] use proxmox::api::schema::{self, EnumEntry}; use proxmox_...
code_fim
hard
{ "lang": "rust", "repo": "pimox/proxmox", "path": "/proxmox-api-macro/tests/types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn string_check_schema_test() { const TEST_METHOD: ::proxmox::api::ApiMethod = ::proxmox::api::ApiMethod::new( &::proxmox::api::ApiHandler::Sync(&api_function_string_check), &::proxmox::api::schema::ObjectSchema::new( "Check a string.", &[ ...
code_fim
hard
{ "lang": "rust", "repo": "pimox/proxmox", "path": "/proxmox-api-macro/tests/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> use MetricStatus::*; if !measurement.metrics.contains_key(THD_KEY) { return MetricStatus::Empty } let metric = measurement.metrics.get(THD_KEY).unwrap(); let box_id = measurement.box_id; let alpha = self.alpha; self .boxes ...
code_fim
hard
{ "lang": "rust", "repo": "openpowerquality/opq", "path": "/makai/TriggeringService/plugins/napali_trigger/src/thd_metric.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct THDMetric { boxes: HashMap<u32, MetricBuffer>, limit: f32, alpha: f32, } impl THDMetric { pub fn new(set: &NapaliPluginSettings) -> THDMetric { THDMetric { boxes: HashMap::new(), limit: set.thd_max, alpha: set.alpha, } } }...
code_fim
medium
{ "lang": "rust", "repo": "openpowerquality/opq", "path": "/makai/TriggeringService/plugins/napali_trigger/src/thd_metric.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: openpowerquality/opq path: /makai/TriggeringService/plugins/napali_trigger/src/thd_metric.rs use metric_buffer::MetricBuffer; use std::collections::HashMap; use std::sync::Arc; use triggering_service::proto::opqbox3::Measurement; use types::{BoxMetric, MetricStatus, NapaliPluginSettings}; stati...
code_fim
medium
{ "lang": "rust", "repo": "openpowerquality/opq", "path": "/makai/TriggeringService/plugins/napali_trigger/src/thd_metric.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mich101mich/aoc-2018 path: /src/days/day_06.rs use crate::utils::*; #[allow(unused)] pub fn run() { #[allow(unused_variables)] let input = include_str!("../input/06.txt"); let parsed = input .lines() .map(|l| scanf!(l, "{}, {}", usize, usize).unwrap()) .to_ve...
code_fim
hard
{ "lang": "rust", "repo": "mich101mich/aoc-2018", "path": "/src/days/day_06.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, serde::Deserialize)] struct SensorDataRaw { version: u8, humidity: u8, unknown1: u8, unknown2: u8, radon_short_term: u16, radon_long_term: u16, temperature: u16, atmospheric_pressure: u16, co2: u16, voc: u16, } impl From<SensorDataRaw> for SensorDat...
code_fim
hard
{ "lang": "rust", "repo": "debuglines/nordic_air_quality", "path": "/crates/naq_device_connector/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: debuglines/nordic_air_quality path: /crates/naq_device_connector/src/lib.rs #![doc = include_str!("../README.md")] use btleplug::api::{BDAddr, Central, Characteristic, Manager as _, Peripheral as _}; use btleplug::platform::{Adapter, Manager, Peripheral}; use lazy_static::lazy_static; use naq_d...
code_fim
hard
{ "lang": "rust", "repo": "debuglines/nordic_air_quality", "path": "/crates/naq_device_connector/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JP-Ellis/coding-problems path: /src/daily_coding_problem/p094.rs use crate::{Error, Problem}; use std::io::prelude::*; pub struct P; const STATEMENT: &str = r#"Given a binary tree of integers, find the maximum path sum between two nodes. The path must go through at least one node, and does not...
code_fim
medium
{ "lang": "rust", "repo": "JP-Ellis/coding-problems", "path": "/src/daily_coding_problem/p094.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(all(target_os="ios", not(test)))] pub fn d(message: &str) { eprintln!("{}", message); } #[cfg(all(target_os="android", not(test)))] pub fn d(message: &str) { let message = CString::new(message).unwrap(); let message = message.as_ptr(); let tag = C...
code_fim
hard
{ "lang": "rust", "repo": "RDR8/sync-storage-prototype", "path": "/rust/toodle_ffi/src/utils.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RDR8/sync-storage-prototype path: /rust/toodle_ffi/src/utils.rs // Copyright 2016 Mozilla // // Licensed under the Apache License, Version 2.0 (the "License"); you may not use // this file except in compliance with the License. You may obtain a copy of the // License at http://www.apache.org/lic...
code_fim
hard
{ "lang": "rust", "repo": "RDR8/sync-storage-prototype", "path": "/rust/toodle_ffi/src/utils.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod indexing_tests { use super::*; use crate::tape::*; use crate::tensor_backends::NdArray; #[test] fn index_test() { let k: &[usize] = &[2, 3]; let mut indexer: Indexer = Indexer::from(k); assert_eq!(indexer.next(), Some([0usize,0].as_ref())); ...
code_fim
hard
{ "lang": "rust", "repo": "tiberiusferreira/Autograd-Experiments", "path": "/src/tensor_backends/indexing.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tiberiusferreira/Autograd-Experiments path: /src/tensor_backends/indexing.rs #[derive(Debug)] pub struct Indexer{ original_shape: Vec<usize>, current_index: Vec<usize>, max_index: Vec<usize>, dims: usize, } impl From<&[usize]> for Indexer{ fn from(shape: &[usize]) -> Self { ...
code_fim
hard
{ "lang": "rust", "repo": "tiberiusferreira/Autograd-Experiments", "path": "/src/tensor_backends/indexing.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// # Subscribe to a listener /// /// ## Listen for activities /// ``` /// # use active_sse::{Config, ActiveSSE}; /// let config = Config::activity("http://localhost:5260"); /// /// let listener = ActiveSSE::new(config); /// /// let receiver = listener.subscribe().u...
code_fim
hard
{ "lang": "rust", "repo": "activeledger/SDK-Rust-Events", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: activeledger/SDK-Rust-Events path: /src/lib.rs /* * MIT License (MIT) * Copyright (c) 2019 Activeledger * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without...
code_fim
hard
{ "lang": "rust", "repo": "activeledger/SDK-Rust-Events", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Check that a contract has been set if self.contract.is_none() { return Err(SSEError::ContractNotSet); } self.event = Some(event.to_owned()); self.url = format!("{}{}", self.url, event); Ok(self) } /// Used to get the URL from the co...
code_fim
hard
{ "lang": "rust", "repo": "activeledger/SDK-Rust-Events", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stone-zeng/rustotf path: /src/tables/layout/jstf.rs use crate::font::Font; use crate::types::Tag; use crate::util::{Buffer, ReadBuffer}; /// ## `JSTF` &mdash; Justification Table /// /// Specification: <https://docs.microsoft.com/en-us/typography/opentype/spec/jstf>. /// /// The Justification t...
code_fim
hard
{ "lang": "rust", "repo": "stone-zeng/rustotf", "path": "/src/tables/layout/jstf.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self { extender_glyphs, default_jstf_lang_sys, jstf_lang_sys_records, } } } #[derive(Debug, Default)] pub struct JstfLangSysRecord { pub jstf_lang_sys_tag: Tag, pub jstf_lang_sys: JstfLangSys, jstf_lang_sys_offset: u16, } impl ReadBuffe...
code_fim
hard
{ "lang": "rust", "repo": "stone-zeng/rustotf", "path": "/src/tables/layout/jstf.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub struct JstfPriority { pub gsub_shrinkage_enable: Option<JstfGsubModList>, pub gsub_shrinkage_disable: Option<JstfGsubModList>, pub gpos_shrinkage_enable: Option<JstfGposModList>, pub gpos_shrinkage_disable: Option<JstfGposModList>, pub shrinkage_jstf_max: Option<Js...
code_fim
hard
{ "lang": "rust", "repo": "stone-zeng/rustotf", "path": "/src/tables/layout/jstf.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: galibey/xsd-parser-rs path: /wsdl-parser-cli/src/main.rs use clap::{App, Arg}; use anyhow::Context; use roxmltree::{Document, Node}; use std::fs; use std::io::{prelude::*, Read}; use std::path::{Path, PathBuf}; use wsdl_parser::generator::generate; use wsdl_parser::parser::definitions::Definit...
code_fim
hard
{ "lang": "rust", "repo": "galibey/xsd-parser-rs", "path": "/wsdl-parser-cli/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> code.push(generate(&definitions)); let code = code.join(""); if let Some(output_filename) = output_path { write_to_file(output_filename, &code).context("Error writing file")?; } else { println!("{}", code); } Ok(()) } fn load_file(path: &Path) -> std::io::Result<St...
code_fim
hard
{ "lang": "rust", "repo": "galibey/xsd-parser-rs", "path": "/wsdl-parser-cli/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn process_single_file(input_path: &Path, output_path: Option<&str>) -> anyhow::Result<()> { let text = load_file(input_path)?; let doc = Document::parse(text.as_str()).context("Failed to parse input document")?; let definitions = Definitions::new(&doc.root_element()); let gen = GeneratorB...
code_fim
hard
{ "lang": "rust", "repo": "galibey/xsd-parser-rs", "path": "/wsdl-parser-cli/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilumsden/rust-serialization-benchmark path: /src/record.rs use serde::{Deserialize, Serialize}; use crate::types::{Integers, Strings}; <|fim_suffix|>impl Record { pub fn new() -> Self { Record { ids: Vec::<i64>::new(), strings: Vec::<String>::new() } } }<|fim_middle|>#[derive(Se...
code_fim
medium
{ "lang": "rust", "repo": "ilumsden/rust-serialization-benchmark", "path": "/src/record.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Record { pub fn new() -> Self { Record { ids: Vec::<i64>::new(), strings: Vec::<String>::new() } } }<|fim_prefix|>// repo: ilumsden/rust-serialization-benchmark path: /src/record.rs use serde::{Deserialize, Serialize}; use crate::types::{Integers, Strings}; <|fim_middle|>#[derive(Se...
code_fim
medium
{ "lang": "rust", "repo": "ilumsden/rust-serialization-benchmark", "path": "/src/record.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let graph: Vec<Vec<i32>> = vec![vec![1,0,0], vec![0,1,0], vec![0,0,1]]; let initial: Vec<i32> = vec![0,2]; assert_eq!(0, min_malware_spread(graph, initial)); let graph: Vec<Vec<i32>> = vec![vec![1,1,0], vec![1,1,0]...
code_fim
hard
{ "lang": "rust", "repo": "gevorgyana/rust-problem-solving", "path": "/minimize-malware-spread/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let graph: Vec<Vec<i32>> = vec![vec![1, 0, 0], vec![0, 1, 1], vec![0, 1, 1]]; let initial: Vec<i32> = vec![1]; assert_eq!(1, min_malware_spread(graph, initial)); let graph: Vec<Vec<i32>> = vec![vec![1, 1, 0], vec![...
code_fim
hard
{ "lang": "rust", "repo": "gevorgyana/rust-problem-solving", "path": "/minimize-malware-spread/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gevorgyana/rust-problem-solving path: /minimize-malware-spread/src/main.rs use std::{thread, time}; pub fn min_malware_spread(mut graph: Vec<Vec<i32>>, initial: Vec<i32>) -> i32 { // let debug_time = time::Duration::from_secs(0); // First, convert the graph l...
code_fim
hard
{ "lang": "rust", "repo": "gevorgyana/rust-problem-solving", "path": "/minimize-malware-spread/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Epsylon42/Chip8 path: /src/keys.rs use glium::glutin as g; pub type Key = u8; pub type Pressed = bool; pub enum MapKeyResult { None, Exit, Event { key: u8, pressed: bool, } } <|fim_suffix|> _ => return MapKeyResult::None, }; return M...
code_fim
hard
{ "lang": "rust", "repo": "Epsylon42/Chip8", "path": "/src/keys.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> g::VirtualKeyCode::A => 0x7, g::VirtualKeyCode::S => 0x8, g::VirtualKeyCode::D => 0x9, g::VirtualKeyCode::F => 0xE, g::VirtualKeyCode::Z => 0xA, g::VirtualKeyCode::X => 0x0, g::VirtualKeyCode::C => 0xB, g::Vir...
code_fim
hard
{ "lang": "rust", "repo": "Epsylon42/Chip8", "path": "/src/keys.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while let Some(line_res) = lines.next() { let line = line_res.unwrap(); if line == "" { if sum > max_cal { max_cal = sum; } sum = 0; continue; } sum += line.parse::<i32>().unwrap(); } println!("{...
code_fim
easy
{ "lang": "rust", "repo": "lucianoq/adventofcode", "path": "/2022/1/rust_day1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lucianoq/adventofcode path: /2022/1/rust_day1/src/main.rs use std::io; use std::io::BufRead; fn main() { <|fim_suffix|> let mut max_cal = 0; let mut sum = 0; while let Some(line_res) = lines.next() { let line = line_res.unwrap(); if line == "" { if sum >...
code_fim
easy
{ "lang": "rust", "repo": "lucianoq/adventofcode", "path": "/2022/1/rust_day1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } } // TEST/VERIFY ENDS match cond_to_set { Conds_init_ping_sorry::Cnd_init_ping_sorry_1 => { match self.the_prodmsgobj.prod_nooutput( &OutMsg_nooutput::Cnd_init_ping_sorry_1, busines...
code_fim
hard
{ "lang": "rust", "repo": "willy610/fsm2fsm-main", "path": "/examples/rust/projects/src/client_folder/guardclass.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: willy610/fsm2fsm-main path: /examples/rust/projects/src/client_folder/guardclass.rs Conds_init_hello_alice_dontdisturb::Cnd_init_hello_alice_dontdisturb_1; } _ => { return Result::Err( "Could not make a proper decision i...
code_fim
hard
{ "lang": "rust", "repo": "willy610/fsm2fsm-main", "path": "/examples/rust/projects/src/client_folder/guardclass.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/////////// normal_hm_or ///////// pub fn normal_hm_or( &mut self, _inmsg: &EnumRealInMessagesType, business_object: &mut BusinessObject, ) -> Result<(Conds_normal_hm_or, EnumRealOutMessagesType), String> { if let EnumRealInMessagesType::Msg_or(ref _real_msg_or_ty...
code_fim
hard
{ "lang": "rust", "repo": "willy610/fsm2fsm-main", "path": "/examples/rust/projects/src/client_folder/guardclass.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Eissen/fuchsia path: /src/developer/ffx/src/args.rs // Copyright 2020 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|> #[argh(switch, short = 'v')] /// use verbose output p...
code_fim
hard
{ "lang": "rust", "repo": "Eissen/fuchsia", "path": "/src/developer/ffx/src/args.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #[argh(switch, short = 'v')] /// use verbose output pub verbose: bool, #[argh(subcommand)] pub subcommand: Option<Subcommand>, }<|fim_prefix|>// repo: Eissen/fuchsia path: /src/developer/ffx/src/args.rs // Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source...
code_fim
hard
{ "lang": "rust", "repo": "Eissen/fuchsia", "path": "/src/developer/ffx/src/args.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> // This should cause a bounds-check panic, but may not if we do our // bounds checking by truncating the index value to the size of the // machine word, losing relevant bits of the index value. // This test is only meaningful on 32-bit hosts. let idx = u64::MAX & !(u64::MAX >> 1_usiz...
code_fim
medium
{ "lang": "rust", "repo": "bombless/rustc-chinese", "path": "/src/test/run-fail/bug-2470-bounds-check-overflow-3.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bombless/rustc-chinese path: /src/test/run-fail/bug-2470-bounds-check-overflow-3.rs // Copyright 2012-2015 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, Ver...
code_fim
medium
{ "lang": "rust", "repo": "bombless/rustc-chinese", "path": "/src/test/run-fail/bug-2470-bounds-check-overflow-3.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Commander-lol/rust-oauth2-traits path: /src/authorization_server/auth_server_tests.rs use super::*; use client::Client; use oauth2_traits_macros; scopes!(TestScopes [ReadPosts, WritePosts]); simple_generator!(TestGen String::from("foo")); #[derive(Clone, Eq, PartialEq, Debug)] struct TestClien...
code_fim
hard
{ "lang": "rust", "repo": "Commander-lol/rust-oauth2-traits", "path": "/src/authorization_server/auth_server_tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> AuthorizationServer::new( "https://localhost", TestGen::instance(), TestClientRepo::instance() ) } #[test] fn creates_client_type() { let mut server = new_test_server(); let client = server.create_client("https://myservice.com"); assert_eq!(client.get_client_i...
code_fim
hard
{ "lang": "rust", "repo": "Commander-lol/rust-oauth2-traits", "path": "/src/authorization_server/auth_server_tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danielgallagher0/bluetooth-hci path: /tests/host.rs 0x04, 0x08, 0x10, 0x20])) .unwrap(); assert_eq!( sink.written_data, [1, 0x05, 0x20, 6, 0x01, 0x02, 0x04, 0x08, 0x10, 0x20] ); } #[test] fn le_set_random_address_invalid_addr_type() { let mut sink = Recordin...
code_fim
hard
{ "lang": "rust", "repo": "danielgallagher0/bluetooth-hci", "path": "/tests/host.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danielgallagher0/bluetooth-hci path: /tests/host.rs 0x04, 0x08, 0x10, 0b01000000]), // The random part of a static address must contain at least one 0. hci::BdAddr([0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF]), // The random part of a static address must contain at least one 1. ...
code_fim
hard
{ "lang": "rust", "repo": "danielgallagher0/bluetooth-hci", "path": "/tests/host.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn le_set_advertising_data_full() { let mut sink = RecordingSink::new(); sink.as_controller() .le_set_advertising_data(&[ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, ]) .u...
code_fim
hard
{ "lang": "rust", "repo": "danielgallagher0/bluetooth-hci", "path": "/tests/host.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> loop { let mut img = [[0; 5]; 5]; if cx.resources.btn_a.is_low().unwrap() { img[1][1] = 9; } if cx.resources.btn_b.is_low().unwrap() { img[1][3] = 9; } if cx.resources.btn_a.is_low().unwrap() &&...
code_fim
hard
{ "lang": "rust", "repo": "Liamolucko/microbit-serial", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Liamolucko/microbit-serial path: /src/main.rs #![no_std] #![no_main] extern crate panic_semihosting; mod display; mod timer; use display::DisplayPins; use display::GreyscaleImage; use display::MicrobitDisplayTimer; use display::MicrobitFrame; use nrf52833_hal::gpio::p0; use nrf52833_hal::gpio...
code_fim
hard
{ "lang": "rust", "repo": "Liamolucko/microbit-serial", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let materials = obj_materials .into_iter() .map(|obj_material| { Ok(Material { diffuse: load_texture(&obj_material.diffuse_texture)?, specular: load_texture(&obj_material.specular_texture)?, shininess: obj_material.shininess, }) }) ...
code_fim
hard
{ "lang": "rust", "repo": "willcrichton/learn-opengl-rust", "path": "/src/model.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: willcrichton/learn-opengl-rust path: /src/model.rs use crate::{ io, material::Material, mesh::{Mesh, Vertex}, prelude::*, shader::ActiveShader, texture::TextureBuilder, }; use futures::future::try_join_all; use image::DynamicImage; use std::{cell::RefCell, collections::HashMap, io::B...
code_fim
hard
{ "lang": "rust", "repo": "willcrichton/learn-opengl-rust", "path": "/src/model.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Read obj and mtl files let obj_file = if let BytesOrImage::Bytes(bytes) = file_map .borrow_mut() .remove(&(model_name + ".obj")) .context("obj file missing")? { bytes } else { bail!("obj file is an image") }; let mut obj_reader = BufReader::new(obj_...
code_fim
hard
{ "lang": "rust", "repo": "willcrichton/learn-opengl-rust", "path": "/src/model.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>type Sender = websocket::sender::Writer<std::net::TcpStream>; fn handle_status(playlist: Arc<Mutex<PlayList>>, connections_map: Arc<Mutex<Slab<Sender>>>, connections: Arc<Mutex<HashSet<usize>>>) { thread::spawn(move || { let rx = { let playlist = playlist.lock().unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "burjee/mock-yo-stream", "path": "/src/chat.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: burjee/mock-yo-stream path: /src/chat.rs use slab::Slab; use std::collections::HashSet; use std::sync::{mpsc, Arc, Mutex}; use std::thread; use websocket::sync::Server; use websocket::OwnedMessage; use super::playlist::PlayList; pub enum ServerMessage { Off, Live, } struct ClientMessag...
code_fim
hard
{ "lang": "rust", "repo": "burjee/mock-yo-stream", "path": "/src/chat.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: flying7eleven/sakerhet path: /src/subcommands/rebuild/mod.rs use crate::configuration::Configuration; use sha2::{Digest, Sha512}; use std::fs::{read_dir, DirEntry, File}; use std::intrinsics::copy; use std::io; use std::path::Path; fn visit_dirs(dir: &Path, cb: &dyn Fn(&DirEntry)) -> io::Result...
code_fim
hard
{ "lang": "rust", "repo": "flying7eleven/sakerhet", "path": "/src/subcommands/rebuild/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn run_subcommand(config: &Configuration) { let directories = config.observed_directories.clone(); for directory in directories { visit_dirs(Path::new(&directory), &handle_file); } }<|fim_prefix|>// repo: flying7eleven/sakerhet path: /src/subcommands/rebuild/mod.rs use crate::conf...
code_fim
medium
{ "lang": "rust", "repo": "flying7eleven/sakerhet", "path": "/src/subcommands/rebuild/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let n = io::copy(&mut file, &mut hasher).unwrap(); let hash = hasher.result(); println!("{} -> {:x}", dir_entry.path().to_str().unwrap(), hash); } pub fn run_subcommand(config: &Configuration) { let directories = config.observed_directories.clone(); for directory in directories { ...
code_fim
medium
{ "lang": "rust", "repo": "flying7eleven/sakerhet", "path": "/src/subcommands/rebuild/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ApiCall::StoreNew => { assert!(store.is_none()); store = Some(Store::new(engine.as_ref().unwrap())); } ApiCall::ModuleNew { id, wasm } => { let module = match Module::new(store.as_ref().unwrap(), &wasm.wasm) { ...
code_fim
hard
{ "lang": "rust", "repo": "jfoote/wasmtime", "path": "/crates/fuzzing/src/oracles.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|> ApiCall::ConfigDebugInfo(b) => { config.as_mut().unwrap().debug_info(b); } ApiCall::EngineNew => { assert!(engine.is_none()); engine = Some(Engine::new(config.as_ref().unwrap())); } ApiCall::Store...
code_fim
hard
{ "lang": "rust", "repo": "jfoote/wasmtime", "path": "/crates/fuzzing/src/oracles.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jfoote/wasmtime path: /crates/fuzzing/src/oracles.rs //! Oracles. //! //! Oracles take a test case and determine whether we have a bug. For example, //! one of the simplest oracles is to take a Wasm binary as our input test case, //! validate and instantiate it, and (implicitly) check that no as...
code_fim
hard
{ "lang": "rust", "repo": "jfoote/wasmtime", "path": "/crates/fuzzing/src/oracles.rs", "mode": "psm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|>MysqlRequestExtensions }; mod middleware;<|fim_prefix|>// repo: zither/nickel-mysql path: /src/lib.rs extern crate nickel; extern crate mysql; extern crate plugin; extern crate typemap;<|fim_middle|> pub use middleware::{ MysqlMiddleware,
code_fim
easy
{ "lang": "rust", "repo": "zither/nickel-mysql", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zither/nickel-mysql path: /src/lib.rs extern crate nickel; extern crate mysql; extern crate plugin; extern crate typemap;<|fim_suffix|>MysqlRequestExtensions }; mod middleware;<|fim_middle|> pub use middleware::{ MysqlMiddleware,
code_fim
easy
{ "lang": "rust", "repo": "zither/nickel-mysql", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zither/nickel-mysql path: /src/lib.rs extern crate nickel; extern crate mysql; <|fim_suffix|>MysqlRequestExtensions }; mod middleware;<|fim_middle|>extern crate plugin; extern crate typemap; pub use middleware::{ MysqlMiddleware,
code_fim
medium
{ "lang": "rust", "repo": "zither/nickel-mysql", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ub boundary: bool, children: Vec<Trie>, }<|fim_prefix|>// repo: iH8c0ff33/rust-trie path: /src/lib.rs pub mod trie_node; pub mod trie_traversal; p<|fim_middle|>ub mod trie_iter; #[derive(Debug,PartialEq)] pub struct Trie { pub key: char, p
code_fim
medium
{ "lang": "rust", "repo": "iH8c0ff33/rust-trie", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>] pub struct Trie { pub key: char, pub boundary: bool, children: Vec<Trie>, }<|fim_prefix|>// repo: iH8c0ff33/rust-trie path: /src/lib.rs pub mod trie_node; pub mod trie_traversal; p<|fim_middle|>ub mod trie_iter; #[derive(Debug,PartialEq)
code_fim
easy
{ "lang": "rust", "repo": "iH8c0ff33/rust-trie", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iH8c0ff33/rust-trie path: /src/lib.rs pub mod trie_node; pub mod trie_traversal; p<|fim_suffix|>ub boundary: bool, children: Vec<Trie>, }<|fim_middle|>ub mod trie_iter; #[derive(Debug,PartialEq)] pub struct Trie { pub key: char, p
code_fim
medium
{ "lang": "rust", "repo": "iH8c0ff33/rust-trie", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // We can also if statements to assign values to variables, this way let x = 5; let mut y = if x == 5 { 10 } else { 15 }; // y: i32 println!("The value of y is {}", y); // shortcut to do the same in a single line y = if x == 5 { 10 } else { 15 }; // y: i32 ...
code_fim
hard
{ "lang": "rust", "repo": "crodnun/rust", "path": "/conditional/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if counter == 1 { println!("counter is 1!"); } else if counter > 5 { println!("counter is higher than 5!"); } else { println!("counter is in [2-5] range!"); } // We can also if statements to assign values to variables, this way let x = 5; let mut y = if x == 5 { ...
code_fim
medium
{ "lang": "rust", "repo": "crodnun/rust", "path": "/conditional/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }