text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> let path = Path::new("priv/training/imdb_titles.tsv").to_path_buf(); let mut hash: HashMap<String, Vec<String>> = HashMap::new(); let reader = BufReader::new(File::open(path).unwrap()); let mut skip_header = true; for line in reader.lines() { if skip_header { skip_header = false; }...
code_fim
medium
{ "lang": "rust", "repo": "mmmries/bayesic_rs", "path": "/benches/training.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn parsed_data_set() -> HashMap<String, Vec<String>> { let path = Path::new("priv/training/imdb_titles.tsv").to_path_buf(); let mut hash: HashMap<String, Vec<String>> = HashMap::new(); let reader = BufReader::new(File::open(path).unwrap()); let mut skip_header = true; for line in reader.lines() ...
code_fim
hard
{ "lang": "rust", "repo": "mmmries/bayesic_rs", "path": "/benches/training.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pr) => { assert_eq!(Solution::broken_calc($x, $y), $ans) }; } test!(2, 3, 2); test!(5, 8, 2); test!(3, 10, 3); test!(1024, 1, 1023); }<|fim_prefix|>// repo: gwy15/leetcode path: /src/991.坏了的计算器.rs /* * @lc app=leetcode.cn id=991 lang=rust * * [991] 坏了的计算器 */ st...
code_fim
medium
{ "lang": "rust", "repo": "gwy15/leetcode", "path": "/src/991.坏了的计算器.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gwy15/leetcode path: /src/991.坏了的计算器.rs /* * @lc app=leetcode.cn id=991 lang=rust * * [991] 坏了的计算器 */ struct Solution; // @lc code=start impl Solution { pub fn broken_calc(x: i32, mut y: i32) -> i32 { <|fim_suffix|> cnt += 1; } } cnt + x - y } }...
code_fim
medium
{ "lang": "rust", "repo": "gwy15/leetcode", "path": "/src/991.坏了的计算器.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: darrenhdc/Address-based-Signatures path: /src/protocols/schnorr.rs use curv::arithmetic::traits::Samplable; use curv::arithmetic::traits::Modulo; use curv::cryptographic_primitives::hashing::traits::Hash; use curv::cryptographic_primitives::hashing::hash_sha256::HSha256; use curv::elliptic::curv...
code_fim
medium
{ "lang": "rust", "repo": "darrenhdc/Address-based-Signatures", "path": "/src/protocols/schnorr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Original_Schnorr_Setup { pub fn keygen() -> Self { let x_fe: FE = FE::new_random(); let x: BigInt = x_fe.to_big_int(); let X: GE = GE::generator() * x_fe; Self { x, // sk X, // pk } } pub fn sign( &self, m: &...
code_fim
hard
{ "lang": "rust", "repo": "darrenhdc/Address-based-Signatures", "path": "/src/protocols/schnorr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mitsuhiko/rust-game path: /game/shader.rs use gl; use gl::types::*; use std::io; use std::vec; use std::ptr::null; use std::path::Path; use game::utils::charbuf_to_str; pub struct ShaderError { msg: ~str, } impl ShaderError { fn new(msg: ~str) -> ~ShaderError { ~ShaderError ...
code_fim
hard
{ "lang": "rust", "repo": "mitsuhiko/rust-game", "path": "/game/shader.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> do src.with_c_str |ptr| { gl::ShaderSource(id, 1, &ptr, null()); } gl::CompileShader(id); gl::GetShaderiv(id, gl::COMPILE_STATUS, &status); if status != (gl::TRUE as GLint) { let len = 0; gl::GetS...
code_fim
hard
{ "lang": "rust", "repo": "mitsuhiko/rust-game", "path": "/game/shader.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> gl::CompileShader(id); gl::GetShaderiv(id, gl::COMPILE_STATUS, &status); if status != (gl::TRUE as GLint) { let len = 0; gl::GetShaderiv(id, gl::INFO_LOG_LENGTH, &len); let buf = vec::from_elem(len as uint, 0u8); ...
code_fim
hard
{ "lang": "rust", "repo": "mitsuhiko/rust-game", "path": "/game/shader.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let height = clap::value_t!(args.value_of("height"), f64) .expect("You need to enter your height for the IMC calculation"); let message = match imc_calculation(weight, height) { x if x > 25.0 => "You are overweight", x if x < 18.0 => "You are underweight", _ => "Yo...
code_fim
hard
{ "lang": "rust", "repo": "patrickelectric/unigran", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: patrickelectric/unigran path: /src/main.rs extern crate clap; fn imc_calculation(mass: f64, height: f64) -> f64 { let result = mass / f64::powf(height, 2.0); return result; } fn main() { <|fim_suffix|> let height = clap::value_t!(args.value_of("height"), f64) .expect("You ne...
code_fim
hard
{ "lang": "rust", "repo": "patrickelectric/unigran", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fimbault/promi path: /src/stream/xes.rs ult<Self> { Ok(Classifier { name: intermediate.get_attr("name")?.clone(), scope: Scope::try_from(intermediate.attributes.get("scope").cloned())?, keys: intermediate.get_attr("keys")?.clone(), }) } } ...
code_fim
hard
{ "lang": "rust", "repo": "fimbault/promi", "path": "/src/stream/xes.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Trace { fn write_xes<W: io::Write>(&self, writer: &mut QxWriter<W>) -> Result<usize> { let tag = b"trace"; let mut bytes: usize = 0; let event = QxBytesStart::owned(tag.to_vec(), tag.len()); bytes += writer.write_event(QxEvent::Start(event))?; for attribu...
code_fim
hard
{ "lang": "rust", "repo": "fimbault/promi", "path": "/src/stream/xes.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fimbault/promi path: /src/stream/xes.rs // standard library use std::collections::HashMap; use std::convert::{From, TryFrom}; use std::fmt::Debug; use std::io; // third party use quick_xml::events::{ BytesDecl as QxBytesDecl, BytesEnd as QxBytesEnd, BytesStart as QxBytesStart, BytesText...
code_fim
hard
{ "lang": "rust", "repo": "fimbault/promi", "path": "/src/stream/xes.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/tin path: /src/ir/component/constexpr/mod.rs use specs::Component; use specs::VecStorage; <|fim_suffix|>pub mod error; #[derive(Component, Clone, Debug)] #[storage(VecStorage)] pub struct Constexpr { pub value: value::Value, }<|fim_middle|>use crate::value;
code_fim
easy
{ "lang": "rust", "repo": "isgasho/tin", "path": "/src/ir/component/constexpr/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub mod error; #[derive(Component, Clone, Debug)] #[storage(VecStorage)] pub struct Constexpr { pub value: value::Value, }<|fim_prefix|>// repo: isgasho/tin path: /src/ir/component/constexpr/mod.rs use specs::Component; use specs::VecStorage; <|fim_middle|>use crate::value;
code_fim
easy
{ "lang": "rust", "repo": "isgasho/tin", "path": "/src/ir/component/constexpr/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zexho994/Zex path: /semantic/src/visitor/visit_statements.rs use crate::visitor::visit_statement::visit_statement; use crate::scope_stack::ScopeStack; use crate::visitor::visit_block_statement::visit_block_statement; use crate::visitor::visitor::print_info; use crate::visitor::visitor::print_pan...
code_fim
medium
{ "lang": "rust", "repo": "zexho994/Zex", "path": "/semantic/src/visitor/visit_statements.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for child in ast_node.get_child_vec_mut().iter_mut() { match child.get_type() { AstNodeType::BlockStmt => { visit_block_statement(child, scope_stack); } AstNodeType::Statement => { visit_statement(child, scope_stack); } _ => print_panic_more("visit statements children, child node...
code_fim
medium
{ "lang": "rust", "repo": "zexho994/Zex", "path": "/semantic/src/visitor/visit_statements.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>lazy_static! { /// Cbor bytes of an empty array serialized. pub static ref EMPTY_ARR_BYTES: Vec<u8> = to_vec::<[(); 0]>(&[]).unwrap(); /// Cid of the empty array Cbor bytes (`EMPTY_ARR_BYTES`). pub static ref EMPTY_ARR_CID: Cid = cid::new_from_cbor(&EMPTY_ARR_BYTES, Blake2b256); } #[cfg(...
code_fim
hard
{ "lang": "rust", "repo": "creativcoder/forest", "path": "/vm/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Cid of the empty array Cbor bytes (`EMPTY_ARR_BYTES`). pub static ref EMPTY_ARR_CID: Cid = cid::new_from_cbor(&EMPTY_ARR_BYTES, Blake2b256); } #[cfg(test)] mod tests { use super::*; #[test] fn empty_object_checks() { assert_eq!(&*EMPTY_ARR_BYTES, &[128u8]); assert...
code_fim
hard
{ "lang": "rust", "repo": "creativcoder/forest", "path": "/vm/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: creativcoder/forest path: /vm/src/lib.rs // Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT // workaround for a compiler bug, see https://github.com/rust-lang/rust/issues/55779 extern crate serde; <|fim_suffix|> assert_eq!(&*EMPTY_ARR_BYTES, &[128u8]); ...
code_fim
hard
{ "lang": "rust", "repo": "creativcoder/forest", "path": "/vm/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for Ship { fn default() -> Self { Self { facing: Vector2::x_axis(), position: Point2::new(0, 0), } } } impl Ship { fn execute(&mut self, instruction: &Instruction) { let Instruction { control, amount } = *instruction; match ...
code_fim
hard
{ "lang": "rust", "repo": "barskern/advent-of-code", "path": "/2020/src/day12.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for _ in 0..amount / 90 { self.waypoint = rot * self.waypoint; } } Control::Direction(Direction::Forward) => { self.position += amount as i32 * self.waypoint; } } } fn manhatten_distanc...
code_fim
hard
{ "lang": "rust", "repo": "barskern/advent-of-code", "path": "/2020/src/day12.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: barskern/advent-of-code path: /2020/src/day12.rs use aoc_runner_derive::*; use anyhow::{anyhow, Context, Result}; use nalgebra::{Matrix2, Point2, Rotation2, Unit, Vector2}; #[derive(Copy, Clone, PartialEq, serde::Deserialize, Debug)] enum Compass { #[serde(rename = "N")] North, #[s...
code_fim
hard
{ "lang": "rust", "repo": "barskern/advent-of-code", "path": "/2020/src/day12.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub const DONT_CARE: c_int = -1; //negative one is the correct value pub const JOYSTICK_HAT_BUTTONS: c_int = 0x00050001; pub const COCOA_CHDIR_RESOURCES: c_int = 0x00051001; pub const COCOA_MENUBAR: c_int = 0x00051002; pub type GLFWglproc = *const c_void; #[cfg(feature = "vulkan")] pub type GLFWvkproc ...
code_fim
hard
{ "lang": "rust", "repo": "PistonDevelopers/glfw-rs", "path": "/src/ffi/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PistonDevelopers/glfw-rs path: /src/ffi/mod.rs pub const KEY_W: c_int = 87; pub const KEY_X: c_int = 88; pub const KEY_Y: c_int = 89; pub const KEY_Z: c_int = 90; pub const KEY_LEFT_BRACKET: c_int = 91; pub const KEY_BACKSLASH: c_int = 92; pub const KEY_RIGHT_BRACKET: c_int = 93; pub const KEY_...
code_fim
hard
{ "lang": "rust", "repo": "PistonDevelopers/glfw-rs", "path": "/src/ffi/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PistonDevelopers/glfw-rs path: /src/ffi/mod.rs b const STICKY_MOUSE_BUTTONS: c_int = 0x00033003; pub const LOCK_KEY_MODS: c_int = 0x00033004; pub const RAW_MOUSE_MOTION: c_int = 0x00033005; pub const CURSOR_NORMAL: c_int = 0x00034001; pub const CURSOR_HIDDEN: c_int = 0x00034002; pub const CURSO...
code_fim
hard
{ "lang": "rust", "repo": "PistonDevelopers/glfw-rs", "path": "/src/ffi/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(2 + 2, 4); }<|fim_prefix|>// repo: sify21/xdom path: /src/tests.rs mod minidom_tests; mod sxd_tests; mod xmltree_tests; const POM: &'static str = include_str!("tests/pom.xml"); <|fim_middle|>#[test] fn it_works() {
code_fim
easy
{ "lang": "rust", "repo": "sify21/xdom", "path": "/src/tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sify21/xdom path: /src/tests.rs mod minidom_tests; mod sxd_tests; mod xmltree_tests; <|fim_suffix|>#[test] fn it_works() { assert_eq!(2 + 2, 4); }<|fim_middle|>const POM: &'static str = include_str!("tests/pom.xml");
code_fim
easy
{ "lang": "rust", "repo": "sify21/xdom", "path": "/src/tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sify21/xdom path: /src/tests.rs mod minidom_tests; mod sxd_tests; mod xmltree_tests; const POM: &'static str = include_str!("tests/pom.xml"); <|fim_suffix|> assert_eq!(2 + 2, 4); }<|fim_middle|>#[test] fn it_works() {
code_fim
easy
{ "lang": "rust", "repo": "sify21/xdom", "path": "/src/tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // proto: void QTextEncoder::QTextEncoder(const QTextCodec * codec); impl /*struct*/ QTextEncoder { pub fn new<T: QTextEncoder_new>(value: T) -> QTextEncoder { let rsthis = value.new(); return rsthis; // return 1; } } pub trait QTextEncoder_new { fn new(self) -> QTextEncoder; } //...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/core/qtextcodec.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} // proto: int QTextCodec::mibEnum(); impl<'a> /*trait*/ QTextCodec_mibEnum<i32> for () { fn mibEnum(self , rsthis: & QTextCodec) -> i32 { // let qthis: *mut c_void = unsafe{calloc(1, 32)}; // unsafe{_ZNK10QTextCodec7mibEnumEv()}; let mut ret = unsafe {C_ZNK10QTextCodec7mibEnumEv(rsthis...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/core/qtextcodec.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kitech/qt.rs path: /src/core/qtextcodec.rs asFailureEv()}; let mut ret = unsafe {C_ZNK12QTextEncoder10hasFailureEv(rsthis.qclsinst)}; return ret as i8; // 1 // return 1; } } // proto: void QTextEncoder::QTextEncoder(const QTextCodec * codec); impl /*struct*/ QTextEncoder { pu...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/core/qtextcodec.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GitBolt/discord-slash-guide path: /rust/src/get_commands.rs /* This is to get all commands, not to be confused with `get_command.rs` which returns details of a particular command. */ use reqwest; use serde_json; use std::env; use lazy_static::lazy_static; use std::collections::HashMap; lazy_...
code_fim
hard
{ "lang": "rust", "repo": "GitBolt/discord-slash-guide", "path": "/rust/src/get_commands.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let url: String = format!("https://discord.com/api/v9/applications/{}/commands", application_id); let res = reqwest::Client::new() .get(url) .header("Authorization", format!("Bot {}", *TOKEN)) .send() .await? .text() .aw...
code_fim
hard
{ "lang": "rust", "repo": "GitBolt/discord-slash-guide", "path": "/rust/src/get_commands.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> msg: Self::Msg, model: Self::Model, ) -> Result<(Self::Model, Option<Self::Msg>), anyhow::Error>; fn view(model: Self::Model) -> (Self::View, Option<Self::Msg>); }<|fim_prefix|>// repo: sj4nes/ifnotnow path: /src/larch.rs /// Every subcommand may be a minimal Larch application. La...
code_fim
medium
{ "lang": "rust", "repo": "sj4nes/ifnotnow", "path": "/src/larch.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sj4nes/ifnotnow path: /src/larch.rs /// Every subcommand may be a minimal Larch application. Larch being /// my flavor of the Elm Architecture for CLI/TUI pub trait LarchMinimal { /// The initial configuration for the application, perhaps to load the persisted state. type Flags; /// ...
code_fim
medium
{ "lang": "rust", "repo": "sj4nes/ifnotnow", "path": "/src/larch.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e [`csr`] module"] pub type CSR = crate::Reg<csr::CSR_SPEC>; #[doc = "CEC control and status register"] pub mod csr; #[doc = "TXD (rw) register accessor: CEC Tx data register\n\nYou can [`read`](crate::generic::Reg::read) this register and get [`txd::R`]. You can [`reset`](crate::generic::Reg::reset), [`...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32f1/src/stm32f100/cec.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32f1/src/stm32f100/cec.rs #[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - configuration register"] pub cfgr: CFGR, #[doc = "0x04 - CEC own address register"] pub oar: OAR, #[doc = "0x08 - Rx Data Register"...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32f1/src/stm32f100/cec.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn verify_all_configs() { // This test verifies that all configs in data/config are valid let paths = fs::read_dir("data/configs").expect("cannot read config dir"); for path in paths { let config_path = path.unwrap().path(); let config_path_str = config_path.to_str().u...
code_fim
hard
{ "lang": "rust", "repo": "todun/libra", "path": "/config/src/unit_tests/config_test.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(actual.networks.len(), expected.networks.len()); for x in 0..actual.networks.len() { expected.networks[x].advertised_address = actual.networks[x].advertised_address.clone(); expected.networks[x].listen_address = actual.networks[x].listen_address.clone(); expected...
code_fim
hard
{ "lang": "rust", "repo": "todun/libra", "path": "/config/src/unit_tests/config_test.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: todun/libra path: /config/src/unit_tests/config_test.rs // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use super::*; use std::fs; static EXPECTED_SINGLE_NODE_CONFIG: &[u8] = include_bytes!("../../data/configs/single.node.config.toml"); #[test] fn verif...
code_fim
hard
{ "lang": "rust", "repo": "todun/libra", "path": "/config/src/unit_tests/config_test.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LDA111222/GraphScope path: /research/gaia/gremlin/gremlin_core/src/structure/filter/traverser/by_path.rs // //! Copyright 2020 Alibaba Group Holding Limited. //! //! Licensed under the Apache License, Version 2.0 (the "License"); //! you may not use this file except in compliance with the Licen...
code_fim
hard
{ "lang": "rust", "repo": "LDA111222/GraphScope", "path": "/research/gaia/gremlin/gremlin_core/src/structure/filter/traverser/by_path.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl Predicate<Traverser> for IsSimple { fn test(&self, entry: &Traverser) -> Option<bool> { Some(match self { IsSimple::Simple => !entry.has_cyclic_path(), IsSimple::Cyclic => entry.has_cyclic_path(), }) } }<|fim_prefix|>// repo: LDA111222/GraphScope path:...
code_fim
medium
{ "lang": "rust", "repo": "LDA111222/GraphScope", "path": "/research/gaia/gremlin/gremlin_core/src/structure/filter/traverser/by_path.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Some(match self { IsSimple::Simple => !entry.has_cyclic_path(), IsSimple::Cyclic => entry.has_cyclic_path(), }) } }<|fim_prefix|>// repo: LDA111222/GraphScope path: /research/gaia/gremlin/gremlin_core/src/structure/filter/traverser/by_path.rs // //! Copyright 2...
code_fim
hard
{ "lang": "rust", "repo": "LDA111222/GraphScope", "path": "/research/gaia/gremlin/gremlin_core/src/structure/filter/traverser/by_path.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let clargs = CLArgs::parse(args_os()); if clargs.list { // FIXME: panics for result in find_all(current_dir().unwrap()) { match result { Ok(generator) => println!("{}", generator.name), Err(err) => eprintln!("{}", err), } ...
code_fim
easy
{ "lang": "rust", "repo": "kaukas/cargo-gen", "path": "/src/bin/cargo-gen.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaukas/cargo-gen path: /src/bin/cargo-gen.rs extern crate cargo_gen; use cargo_gen::cmd_args::CLArgs; use cargo_gen::gen::find_all; use std::env::args_os; use std::env::current_dir; <|fim_suffix|> let clargs = CLArgs::parse(args_os()); if clargs.list { // FIXME: panics f...
code_fim
easy
{ "lang": "rust", "repo": "kaukas/cargo-gen", "path": "/src/bin/cargo-gen.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /third_party/rust_crates/vendor/gpt-3.0.0/src/lib.rs self, device: DiskDeviceObject, guid: Option<uuid::Uuid> ) -> io::Result<GptDisk> { if self.initialized { Err(io::Error::new( io::ErrorKind::Other, ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/gpt-3.0.0/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Open the GPT disk at the given path and inspect it according /// to configuration options. pub fn open(self, diskpath: impl AsRef<path::Path>) -> io::Result<GptDisk<'static>> { let file = Box::new(fs::OpenOptions::new() .write(self.writable) .read(true)...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/gpt-3.0.0/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /third_party/rust_crates/vendor/gpt-3.0.0/src/lib.rs } /// Open the GPT disk at the given path and inspect it according /// to configuration options. pub fn open(self, diskpath: impl AsRef<path::Path>) -> io::Result<GptDisk<'static>> { let fi...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/gpt-3.0.0/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: krishnajain/NumberofDaysBetweenTwoDates path: /NumberofDaysBetweenTwoDates.rs pub fn days_between_dates(date1: String, date2: String) -> i32 { let date1 = from_1971_01_01(date1); let date2 = from_1971_01_01(date2); <|fim_suffix|> let x = days_between_dates("2020-06-29".to_string(...
code_fim
hard
{ "lang": "rust", "repo": "krishnajain/NumberofDaysBetweenTwoDates", "path": "/NumberofDaysBetweenTwoDates.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let x = days_between_dates("2019-06-29".to_string(), "2019-06-30".to_string()); println!("{}", x); let x = days_between_dates("2019-05-29".to_string(), "2019-06-30".to_string()); println!("{}", x); let x = days_between_dates("2020-06-29".to_string(), "2020-06-15".t...
code_fim
hard
{ "lang": "rust", "repo": "krishnajain/NumberofDaysBetweenTwoDates", "path": "/NumberofDaysBetweenTwoDates.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: killercup/rune path: /crates/rune/src/ast/lit_byte.rs use crate::ast; use crate::{IntoTokens, Parse, ParseError, Parser, Resolve, Storage}; use runestick::{Source, Span}; /// A byte literal. #[derive(Debug, Clone)] pub struct LitByte { /// The token corresponding to the literal. pub tok...
code_fim
hard
{ "lang": "rust", "repo": "killercup/rune", "path": "/crates/rune/src/ast/lit_byte.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let span = self.token.span; let string = source .source(span.trim_start(2).trim_end(1)) .ok_or_else(|| ParseError::BadSlice { span })?; let mut it = string .char_indices() .map(|(n, c)| (span.start + n, c)) .peekable(); ...
code_fim
hard
{ "lang": "rust", "repo": "killercup/rune", "path": "/crates/rune/src/ast/lit_byte.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] pub unsafe fn data(&self) -> Option<&[u8]> { let md = self.0.as_ref(); if md.data != 0 && md.data < md.data_end { Some(slice::from_raw_parts( md.data as *const u8, (md.data_end - md.data) as usize, )) } else...
code_fim
hard
{ "lang": "rust", "repo": "flier/rust-ebpf", "path": "/xdp-runtime/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: flier/rust-ebpf path: /xdp-runtime/src/lib.rs #![cfg_attr(not(feature = "std"), no_std)] pub mod net; mod kernel; pub use kernel::*; use core::ops::Deref; use core::ptr::NonNull; use core::slice; use ebpf_runtime::{ ffi, helpers, kernel::fib, untrusted::{self, Input}, MapSpec...
code_fim
hard
{ "lang": "rust", "repo": "flier/rust-ebpf", "path": "/xdp-runtime/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] pub fn input(&self) -> Option<Input> { unsafe { self.data().map(Input::from) } } #[inline] pub unsafe fn data(&self) -> Option<&[u8]> { let md = self.0.as_ref(); if md.data != 0 && md.data < md.data_end { Some(slice::from_raw_parts( ...
code_fim
hard
{ "lang": "rust", "repo": "flier/rust-ebpf", "path": "/xdp-runtime/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joseluis/dami path: /src/core/series/generic.rs ndarray does not support extending arrays at the moment /// /// See [this issue](https://github.com/rust-ndarray/ndarray/issues/433) so what internally happens is /// that we create a whole new array and overwrite the existing one with...
code_fim
hard
{ "lang": "rust", "repo": "joseluis/dami", "path": "/src/core/series/generic.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Indicate duplicated values in series /// /// Duplicated values are indicated as true in the resulting Series /// # Returns /// [`Series`] made of `bool` values indicating whether the item at `I` in the old series is /// a duplicate or not /// # Example /// ``` /// ...
code_fim
hard
{ "lang": "rust", "repo": "joseluis/dami", "path": "/src/core/series/generic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Set a global name for the series which is used as a row identifier in the DataFrame pub fn set_name(&mut self, name: &str) { self.name = name.to_string() } /// Set a new indexerfot the series pub fn set_index(&mut self, index: Vec<String>) { self.reindex(index, fals...
code_fim
hard
{ "lang": "rust", "repo": "joseluis/dami", "path": "/src/core/series/generic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tensorbase/tensorbase path: /crates/meta/src/store/sys.rs s).into_ref::<u64>()) } #[inline] fn _name(&self, id: Id) -> Option<IVec> { self.tree1.get(id.to_be_bytes()).unwrap_or(None) } pub fn dbname(&self, id: Id) -> Option<IVec> { self._name(id) } ...
code_fim
hard
{ "lang": "rust", "repo": "tensorbase/tensorbase", "path": "/crates/meta/src/store/sys.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut key: Vec<u8> = Vec::with_capacity(16); key.extend_from_slice(to_key_id_order(tid).as_bytes()); key.extend_from_slice(k.as_bytes()); let r = self.tree_tabs.get(key).map_err(|_e| MetaError::GetError)?; if let Some(iv) = r { let bs = &*iv; ...
code_fim
hard
{ "lang": "rust", "repo": "tensorbase/tensorbase", "path": "/crates/meta/src/store/sys.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tensorbase/tensorbase path: /crates/meta/src/store/sys.rs )) .map_err(|_e| MetaError::InsertError)?; debug_assert!(_old.is_none()); //tree1 let _old = self .tree1 .insert(id.to_be_bytes(),...
code_fim
hard
{ "lang": "rust", "repo": "tensorbase/tensorbase", "path": "/crates/meta/src/store/sys.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaivol/drone-stm32f4-hal path: /src/dma/drv.rs use self::config::*; use core::marker::PhantomData; use drone_cortexm::{reg::prelude::*, thr::prelude::*}; use drone_stm32_map::periph::dma::{ ch::{DmaChMap, DmaChPeriph}, DmaMap, DmaPeriph, }; pub struct DmaStCh0; pub struct DmaStCh1; pub ...
code_fim
hard
{ "lang": "rust", "repo": "kaivol/drone-stm32f4-hal", "path": "/src/dma/drv.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<Dma: DmaMap> DmaCfg<Dma> { /// Initialize a dma controller and enable its clock. pub fn with_enabled_clock(dma: DmaPeriph<Dma>) -> DmaCfg<Dma> { dma.rcc_busenr_dmaen.set_bit(); Self { dma: PhantomData } } /// Initialize a dma channel. pub fn ch<DmaCh: DmaChMap, St...
code_fim
hard
{ "lang": "rust", "repo": "kaivol/drone-stm32f4-hal", "path": "/src/dma/drv.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // wait and verify completed work count for h in t_handles { h.join().unwrap(); } assert_eq!( work_completed_count.load(Ordering::SeqCst), work_assigned_count ); } #[allow(dead_code)] pub fn do_some_thread_work_using_rayon() { let rng = thread_rng(); l...
code_fim
hard
{ "lang": "rust", "repo": "sectorzero/grrs", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sectorzero/grrs path: /src/lib.rs use std::io::BufRead; use failure::Error; use log::{info}; use indicatif::{ProgressBar, ProgressStyle}; use rand::distributions::{Distribution, Uniform}; use rand::thread_rng; use std::sync::atomic::{AtomicUsize, Ordering}; use std::sync::Arc; use std::thread:...
code_fim
hard
{ "lang": "rust", "repo": "sectorzero/grrs", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //let t_work_count: usize = work_counts.next().unwrap(); let t_work_count = work_assigned_count / num_threads; //work_assigned_count += t_work_count; t_handles.push(spawn(move || { info!("starting thread"); let t_rng = threa...
code_fim
hard
{ "lang": "rust", "repo": "sectorzero/grrs", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn write(&self, bus: BusKind, system: &System, state: &mut SystemState, addr: u16, value: u8); fn get_irq(&mut self) -> bool { false } fn tick(&self, _system: &System, _state: &mut SystemState) {} fn nt_peek(&self, system: &System, state: &SystemState, addr: u16) -> u8 { ...
code_fim
medium
{ "lang": "rust", "repo": "nickmass/mass-nes", "path": "/nes/src/mapper/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nickmass/mass-nes path: /nes/src/mapper/mod.rs mod action53; mod axrom; mod bf909x; mod cnrom; mod fme7; mod nrom; mod sxrom; mod txrom; mod uxrom; use crate::bus::{AddressBus, BusKind}; use crate::cartridge::Cartridge; use crate::ppu::Ppu; use crate::system::{System, SystemState}; pub trait M...
code_fim
hard
{ "lang": "rust", "repo": "nickmass/mass-nes", "path": "/nes/src/mapper/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let _ = match (&mut input_name, &mut output_name, &mut fun_name) { (Some(i), Some(o), Some(f)) => { let package_list = vec!["gr", "base/float"]; let svg = svg::open(i).unwrap(); let body = body::main(svg); let s = make_satysfi_file_text::make_satysfi_file_text(package_list, f...
code_fim
hard
{ "lang": "rust", "repo": "puripuri2100/svg2saty", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: puripuri2100/svg2saty path: /src/main.rs extern crate clap; use clap::{App, Arg}; use std::fs::File; use std::io::Write; use svg; pub mod body; pub mod make_satysfi_file_text; fn write_file(file_name: String, text: String) -> () { <|fim_suffix|> if let Some(output) = matches.value_of("output...
code_fim
hard
{ "lang": "rust", "repo": "puripuri2100/svg2saty", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "F#"]; for it in v { println!("{}", it ); } }<|fim_prefix|>// repo: moonmile/gyakubiki-rust path: /ch02/grm024/src/main.rs fn main() { // 文字列の配列 let v = ["Rust", "C++", "Scala",<|fim_middle|> "F#"]; for it in v.iter() { println!("{}", it ); } // 文字列のベクター l...
code_fim
medium
{ "lang": "rust", "repo": "moonmile/gyakubiki-rust", "path": "/ch02/grm024/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: moonmile/gyakubiki-rust path: /ch02/grm024/src/main.rs fn main() { // 文字列の配列 let v = ["Rust", "C++", "Scala", "F#"]; for it in v.iter() { println!("{}", it ); <|fim_suffix|> "F#"]; for it in v { println!("{}", it ); } }<|fim_middle|> } // 文字列のベクター l...
code_fim
medium
{ "lang": "rust", "repo": "moonmile/gyakubiki-rust", "path": "/ch02/grm024/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Deserialize, Debug)] pub struct EstimateResults { pub status: String, pub results: Option<Estimates>, }<|fim_prefix|>// repo: amPerl/wolt-rs path: /src/model/estimate.rs use serde::Deserialize; #[derive(Deserialize, Debug)] pub struct EstimateBounds { pub mean: i32, pub max: Opt...
code_fim
medium
{ "lang": "rust", "repo": "amPerl/wolt-rs", "path": "/src/model/estimate.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: amPerl/wolt-rs path: /src/model/estimate.rs use serde::Deserialize; #[derive(Deserialize, Debug)] pub struct EstimateBounds { pub mean: i32, pub max: Option<i32>, pub min: Option<i32>, } <|fim_suffix|>#[derive(Deserialize, Debug)] pub struct EstimateResults { pub status: String...
code_fim
medium
{ "lang": "rust", "repo": "amPerl/wolt-rs", "path": "/src/model/estimate.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { total_count: 0, total_sent: 0, total_delivered: 0, total_delivery_failed: 0, items: Vec::new(), } } } impl Recipients { pub fn count(&self) -> (u32, u32, u32) { ( self.total_sent, se...
code_fim
medium
{ "lang": "rust", "repo": "drahnr/messagebird-async", "path": "/src/sms/recipients.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: drahnr/messagebird-async path: /src/sms/recipients.rs use super::*; /// List of Recipients /// /// As returned by a query to the MessageBird API. /// // requires manual Serialize/Deserialize implementation #[derive(Debug, Serialize, Deserialize, Eq, PartialEq)] pub struct Recipients { #[ser...
code_fim
hard
{ "lang": "rust", "repo": "drahnr/messagebird-async", "path": "/src/sms/recipients.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sky0621/book_rust path: /src/main.rs use std::io::stdin; use crate::commands::run; use crate::store_info::StoreInfo; mod clear; mod command; mod commands; mod end; mod get; mod help; mod list; mod remove; mod save; mod store_info; fn main() { <|fim_suffix|> loop { // 標準入力の受け皿 ...
code_fim
medium
{ "lang": "rust", "repo": "sky0621/book_rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 半角スペースで分割 let seps: Vec<&str> = input.split_ascii_whitespace().collect(); run(seps, &mut si); } }<|fim_prefix|>// repo: sky0621/book_rust path: /src/main.rs use std::io::stdin; use crate::commands::run; use crate::store_info::StoreInfo; mod clear; mod command; mod comman...
code_fim
hard
{ "lang": "rust", "repo": "sky0621/book_rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: solana-labs/solana path: /core/src/drop_bank_service.rs use { crossbeam_channel::Receiver, solana_measure::measure::Measure, solana_runtime::bank::Bank, std::{ sync::Arc, thread::{self, Builder, JoinHandle}, }, }; <|fim_suffix|>impl DropBankService { pub ...
code_fim
hard
{ "lang": "rust", "repo": "solana-labs/solana", "path": "/core/src/drop_bank_service.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl DropBankService { pub fn new(bank_receiver: Receiver<Vec<Arc<Bank>>>) -> Self { let thread_hdl = Builder::new() .name("solDropBankSrvc".to_string()) .spawn(move || { for banks in bank_receiver.iter() { let len = banks.len(); ...
code_fim
hard
{ "lang": "rust", "repo": "solana-labs/solana", "path": "/core/src/drop_bank_service.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>} pub trait AsRawPtr<T> { fn as_mut_ptr(&mut self) -> *mut T; }<|fim_prefix|>// repo: lummax/wayland-client-rs path: /src/client/base/mod.rs // Copyright (c) <2015> <lummax> // Licensed under MIT (http://opensource.org/licenses/MIT) <|fim_middle|>mod event_queue; mod proxy; mod display; pub use se...
code_fim
hard
{ "lang": "rust", "repo": "lummax/wayland-client-rs", "path": "/src/client/base/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lummax/wayland-client-rs path: /src/client/base/mod.rs // Copyright (c) <2015> <lummax> // Licensed under MIT (http://opensource.org/licenses/MIT) <|fim_suffix|>pub trait FromRawPtr<T> { fn from_mut_ptr(ptr: *mut T) -> Result<Self, &'static str>; } pub trait AsRawPtr<T> { fn as_mut_ptr...
code_fim
medium
{ "lang": "rust", "repo": "lummax/wayland-client-rs", "path": "/src/client/base/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let operations = compiler.db.operations(document_id); let fields = operations .iter() .find(|op| op.name() == Some("ExampleQuery")) .unwrap() .fields(&compiler.db); let interface_field = fields.iter().find(|f| f.name() == "interface"...
code_fim
hard
{ "lang": "rust", "repo": "briancabbott/GitHub-Repository-Downloader", "path": "/TypeScript/resources/code/ts_lib/Apollo-Latest/apollographql/apollo-rs/crates/apollo-compiler/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn it_accesses_object_field_types_directive_name() { let input = r#" type Person { name: String picture(size: Number): Url } enum Number { INT FLOAT } scalar Url @specifiedBy(url: "https://tools.ietf.org/html/rfc3986") "#; let mut compiler = ApolloCompiler::n...
code_fim
hard
{ "lang": "rust", "repo": "briancabbott/GitHub-Repository-Downloader", "path": "/TypeScript/resources/code/ts_lib/Apollo-Latest/apollographql/apollo-rs/crates/apollo-compiler/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Result<HashMap<[String; 2], u32>, std::io::Error> { let contents = fs::read_to_string(filename)?; let mut distances = HashMap::new(); contents.lines() .for_each(|line| { let mut cities_distance = line.split(" = "); let cities: Vec<&str> = ...
code_fim
hard
{ "lang": "rust", "repo": "ocstl/advent_of_code_2015", "path": "/src/bin/day9.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ocstl/advent_of_code_2015 path: /src/bin/day9.rs extern crate permutohedron; use permutohedron::Heap; use std::collections::{HashSet, HashMap}; use std::fs; fn main() -> std::result::Result<(), std::io::Error> { let filename = "inputs/day9.txt"; let distances = read_input(&filename)?;...
code_fim
hard
{ "lang": "rust", "repo": "ocstl/advent_of_code_2015", "path": "/src/bin/day9.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> heap.map(|path| { path.as_slice() .windows(2) .fold(0, |acc, p| acc + distances.get(p).unwrap()) }) .min() .unwrap() } fn part2(cities: &HashSet<String>, distances: &HashMap<[String; 2], u32>) -> u32 { let mut v: Vec<...
code_fim
hard
{ "lang": "rust", "repo": "ocstl/advent_of_code_2015", "path": "/src/bin/day9.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rcore-os-infohub/ossoc2020-nlxxh-daily path: /rust-code/rust-python/ex38/ex38.rs fn main(){ let ten_things = String::from("Apples Oranges Crows Telephone Light Sugar"); println!("Wait there are not 10 things in that list. Let's fix that."); let mut stuff : Vec<_>= ten_things.split(' ...
code_fim
medium
{ "lang": "rust", "repo": "rcore-os-infohub/ossoc2020-nlxxh-daily", "path": "/rust-code/rust-python/ex38/ex38.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{:?}",stuff[3..5].join("#")); println!("{}",stuff[1]); println!("{}",stuff[9]); if let Some(thing)=stuff.pop(){ println!("{}",thing); } println!("{}",stuff.join(" ")); }<|fim_prefix|>// repo: rcore-os-infohub/ossoc2020-nlxxh-daily path: /rust-code/rust-pyt...
code_fim
medium
{ "lang": "rust", "repo": "rcore-os-infohub/ossoc2020-nlxxh-daily", "path": "/rust-code/rust-python/ex38/ex38.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: annaholmes/Redox_Paint path: /rpaint/src/paintStruct.rs // pulled from https://github.com/redox-os/orbtk/blob/master/src/widgets/image.rs extern crate orbtk; extern crate orbclient; extern crate orbimage; use std::rc::Rc; use orbtk::{Color, Window, Image, Button, Enter, Rect, List, Text, TextBo...
code_fim
hard
{ "lang": "rust", "repo": "annaholmes/Redox_Paint", "path": "/rpaint/src/paintStruct.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> *self.click_callback.borrow_mut() = Some(Arc::new(func)); self } } impl Place for PaintCanvas {} impl Widget for PaintCanvas { fn rect(&self) -> &Cell<Rect> { &self.rect } fn draw(&self, renderer: &mut Renderer, _focused: bool) { let rect = self.rect.get(...
code_fim
hard
{ "lang": "rust", "repo": "annaholmes/Redox_Paint", "path": "/rpaint/src/paintStruct.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn is_up(&self) -> bool { unimplemented!() } pub fn is_running(&self) -> bool { unimplemented!() } pub fn is_broadcast(&self) -> bool { unimplemented!() } pub fn is_loopback(&self) -> bool { unimplemented!() } pub fn is_point_to_p...
code_fim
hard
{ "lang": "rust", "repo": "vittoriovaselli/heim", "path": "/heim-net/src/sys/windows/nic.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vittoriovaselli/heim path: /heim-net/src/sys/windows/nic.rs use heim_common::prelude::*; use crate::Address; #[derive(Debug)] pub struct Nic; impl Nic { pub fn name(&self) -> &str { unimplemented!() } pub fn address(&self) -> Address { unimplemented!() } ...
code_fim
hard
{ "lang": "rust", "repo": "vittoriovaselli/heim", "path": "/heim-net/src/sys/windows/nic.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mredlek/rs-opentherm path: /src/application/flags8.rs use ::std::fmt::{Binary, Debug, Formatter}; use ::std::fmt::Result as FmtResult; /// This struct represent 8 bits where the content is dependend on other information. /// Usually, this a flags depending on the dataid. #[derive(Copy, Clone, S...
code_fim
hard
{ "lang": "rust", "repo": "mredlek/rs-opentherm", "path": "/src/application/flags8.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> { Flags8 { bits: input } } } impl Into<u8> for Flags8 { fn into(self) -> u8 { self.bits } } impl Binary for Flags8 { fn fmt(&self, f: &mut Formatter) -> FmtResult { write!(f, "{:b}", self.bits) } } impl Debug for Flags8 { fn fmt(&self, f: &mut For...
code_fim
hard
{ "lang": "rust", "repo": "mredlek/rs-opentherm", "path": "/src/application/flags8.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: regonn/AOJ path: /ALDS1/8/D.rs use std::io::*; use std::str::FromStr; type NodeId = usize; struct Node { id: NodeId, parent: Option<NodeId>, left: Option<NodeId>, right: Option<NodeId>, key: u64, priority: u64, } struct Tree { root: Option<NodeId>, nodes: Vec<N...
code_fim
hard
{ "lang": "rust", "repo": "regonn/AOJ", "path": "/ALDS1/8/D.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let current_node_id: NodeId = node_id.unwrap(); if key < self.nodes[current_node_id].key { let left_node_id: Option<NodeId> = self.nodes[current_node_id].left; self.nodes[current_node_id].left = self._delete(left_node_id, key); } else if key > self.nodes[cu...
code_fim
hard
{ "lang": "rust", "repo": "regonn/AOJ", "path": "/ALDS1/8/D.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: baka233/firecracker path: /src/devices/src/virtio/fpga/fpga_map_region.rs use crate::virtio::fpga::utils::generate_pfn; use logger::{debug, error}; use mem_control::address_allocator::Alloc; use mem_control::{MemRequest, VmMemError, VmMemRequest, VmMemResponse}; use serde::__private::Formatter; ...
code_fim
hard
{ "lang": "rust", "repo": "baka233/firecracker", "path": "/src/devices/src/virtio/fpga/fpga_map_region.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }