text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> // Validate injected directory assert_eq!(std::fs::read_to_string("/injected-dir/injected-file").unwrap(), "some-contents"); }<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/lib/fdio/rust/test/spawn_builder_test_target.rs // Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of th...
code_fim
medium
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/fdio/rust/test/spawn_builder_test_target.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>pub mod h5; pub mod h5a; pub mod h5ac; pub mod h5c; pub mod h5d; pub mod h5e; pub mod h5f; pub mod h5fd; pub mod h5g; pub mod h5i; pub mod h5l; pub mod h5mm; pub mod h5o; pub mod h5p; pub mod h5r; pub mod h5s; pub mod h5t; pub mod h5z; #[cfg(hdf5_1_8_15)] pub mod h5pl; #[allow(non_camel_case_types)] mod...
code_fim
hard
{ "lang": "rust", "repo": "vaskomitanov/hdf5-rust", "path": "/hdf5-sys/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] pub fn test_smoke() { unsafe { H5open(); let mut majnum:c_uint = 0; let mut minnum:c_uint = 0; let mut relnum:c_uint = 0; let result = H5get_libversion(&mut majnum, &mut minnum, &mut relnum); println!("Call to:...
code_fim
hard
{ "lang": "rust", "repo": "vaskomitanov/hdf5-rust", "path": "/hdf5-sys/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vaskomitanov/hdf5-rust path: /hdf5-sys/src/lib.rs #![allow(non_camel_case_types, non_snake_case, dead_code, deprecated)] #![cfg_attr(feature = "cargo-clippy", allow(clippy::unreadable_literal))] #![cfg_attr(feature = "cargo-clippy", allow(clippy::missing_safety_doc))] #![cfg_attr(feature = "carg...
code_fim
hard
{ "lang": "rust", "repo": "vaskomitanov/hdf5-rust", "path": "/hdf5-sys/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yewenhui/apicula path: /src/util/first_if_only.rs /// If `it` yields a single value, return that value. Otherwise, return `None`. pub<|fim_suffix|> match it.next() { Some(_) => None, None => Some(first), } }<|fim_middle|> fn first_if_only<I: Iterator>(mut it: I) -> Option...
code_fim
medium
{ "lang": "rust", "repo": "yewenhui/apicula", "path": "/src/util/first_if_only.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> match it.next() { Some(_) => None, None => Some(first), } }<|fim_prefix|>// repo: yewenhui/apicula path: /src/util/first_if_only.rs /// If `it` yields a single value, return that value. Otherwise, return `None`. pub<|fim_middle|> fn first_if_only<I: Iterator>(mut it: I) -> Option...
code_fim
medium
{ "lang": "rust", "repo": "yewenhui/apicula", "path": "/src/util/first_if_only.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wolf4ood/gremlin-rs path: /gremlin-client/src/structure/value.rs GremlinResult}; use std::collections::{BTreeMap, HashMap, HashSet, VecDeque}; pub type Date = chrono::DateTime<chrono::offset::Utc>; use std::convert::TryInto; use std::hash::Hash; /// Represent possible values coming from the [Gre...
code_fim
hard
{ "lang": "rust", "repo": "wolf4ood/gremlin-rs", "path": "/gremlin-client/src/structure/value.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl From<Cardinality> for GValue { fn from(val: Cardinality) -> GValue { GValue::Cardinality(val) } } impl From<uuid::Uuid> for GValue { fn from(val: uuid::Uuid) -> GValue { GValue::Uuid(val) } } impl std::convert::TryFrom<GValue> for String { type Error = crate::Gre...
code_fim
hard
{ "lang": "rust", "repo": "wolf4ood/gremlin-rs", "path": "/gremlin-client/src/structure/value.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wolf4ood/gremlin-rs path: /gremlin-client/src/structure/value.rs Map, Metric, Path, Property, Set, Token, TraversalExplanation, TraversalMetrics, Vertex, VertexProperty, }; use crate::structure::{Pop, TextP, P, T}; use crate::{GremlinError, GremlinResult}; use std::collections::{BTreeMap, Ha...
code_fim
hard
{ "lang": "rust", "repo": "wolf4ood/gremlin-rs", "path": "/gremlin-client/src/structure/value.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joshatron/AdventOfCode-2020 path: /src/days/day_25.rs use crate::days; use crate::days::Day; pub struct Day25 {} impl Day25 { pub fn new() -> Day25 { Day25 {} } } impl Day for Day25 { fn day_num(&self) -> usize { 25 } fn puzzle_1(&self, input: &Vec<String>) -> String { ...
code_fim
hard
{ "lang": "rust", "repo": "joshatron/AdventOfCode-2020", "path": "/src/days/day_25.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> vec![String::from("5764801"), String::from("17807724")] } #[test] fn test_puzzle_1() { assert_eq!(Day25::new().puzzle_1(&sample_input()), "14897079"); } #[test] fn test_puzzle_2() { assert_eq!(Day25::new().puzzle_2(&sample_input()), "Merry Christmas!"); } }<|fim_prefix|>// repo...
code_fim
hard
{ "lang": "rust", "repo": "joshatron/AdventOfCode-2020", "path": "/src/days/day_25.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rehanhaider/minify-html path: /rust/common/tests/mod.rs ce() { eval(b"<a> \n&#32; </a>", b"<a> </a>"); // Tag names should be case insensitive. eval(b"<A> \n&#32; </a>", b"<a> </a>"); eval(b"<a> \n&#32; </A>", b"<a> </a>"); } #[test] fn test_collapse_and_trim_whitesp...
code_fim
hard
{ "lang": "rust", "repo": "rehanhaider/minify-html", "path": "/rust/common/tests/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> eval(b"&#48", b"0"); eval(b"&#0048", b"0"); eval(b"&#000000000000000000000000000000000000000000048", b"0"); eval(b"&#48;", b"0"); eval(b"&#0048;", b"0"); eval(b"&#000000000000000000000000000000000000000000048;", b"0"); eval(b"&#4433;", b"\xe1\x85\x91"); eval(b"&#1114112;", ...
code_fim
hard
{ "lang": "rust", "repo": "rehanhaider/minify-html", "path": "/rust/common/tests/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rehanhaider/minify-html path: /rust/common/tests/mod.rs lapse_whitespace() { eval(b"<a> \n&#32; </a>", b"<a> </a>"); // Tag names should be case insensitive. eval(b"<A> \n&#32; </a>", b"<a> </a>"); eval(b"<a> \n&#32; </A>", b"<a> </a>"); } #[test] fn test_collapse_an...
code_fim
hard
{ "lang": "rust", "repo": "rehanhaider/minify-html", "path": "/rust/common/tests/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dylanmckay/parapet path: /src/interactive.rs use {Parapet, Error}; use ci; use network::local; use std::{io, thread}; use std::sync::mpsc::channel; use std::io::Write; use std::sync::mpsc::TryRecvError; use uuid::Uuid; pub struct Interactive(pub Parapet); #[derive(Clone, Debug)] pub enum Mes...
code_fim
hard
{ "lang": "rust", "repo": "dylanmckay/parapet", "path": "/src/interactive.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for network_node in network.nodes() { print!("{} - ({} siblings)", network_node.uuid, network.siblings(&network_node.uuid).len()); if network_node.uuid == node.uuid { println!(" (current)"); } else { printl...
code_fim
hard
{ "lang": "rust", "repo": "dylanmckay/parapet", "path": "/src/interactive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dahliaOS/fuchsia-pi4 path: /garnet/bin/setui/src/tests/environment_tests.rs // Copyright 2021 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. use { crate::agent::{ AgentError, Context, ...
code_fim
hard
{ "lang": "rust", "repo": "dahliaOS/fuchsia-pi4", "path": "/garnet/bin/setui/src/tests/environment_tests.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>// Ensure that the messenger factory returned from environment creation is able // to send events to the test agent. #[fuchsia_async::run_until_stalled(test)] async fn test_message_hub() { let service_registry = ServiceRegistry::create(); let input_device_registry_service_handle = Arc::new...
code_fim
hard
{ "lang": "rust", "repo": "dahliaOS/fuchsia-pi4", "path": "/garnet/bin/setui/src/tests/environment_tests.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let vtf_image = vtf_file.image.expose(); let rgb = vtf_image.to_rgba8_raw(); println!("Image converted to RGB888"); let mut png_file = File::create("target/bgrtest.png").unwrap(); PNGEncoder::new(&mut png_file).encode(&rgb[..], vtf_image.get_width() as u32, vtf_image.get_height() as u...
code_fim
medium
{ "lang": "rust", "repo": "Osspial/sorcent-rs", "path": "/examples/topng.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Osspial/sorcent-rs path: /examples/topng.rs extern crate sorcent; extern crate image; use std::fs::File; use sorcent::vtf::VTFFile; use sorcent::vtf::image::VTFImage; use image::png::PNGEncoder; fn main() { let mut file = File::open("target/bgrtest.vtf").unwrap(); let vtf_file = VTFFil...
code_fim
medium
{ "lang": "rust", "repo": "Osspial/sorcent-rs", "path": "/examples/topng.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>static INIT: Once = ONCE_INIT; /// Read config file 'log4rs.yml' pub fn setup(path: &str) { INIT.call_once(|| { log4rs::init_file(path, Default::default()).expect("log4rs.yml not found"); }); }<|fim_prefix|>// repo: gfreezy/bitcask-rs path: /src/lib.rs #![feature(nll)] #![feature(test)] ...
code_fim
medium
{ "lang": "rust", "repo": "gfreezy/bitcask-rs", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gfreezy/bitcask-rs path: /src/lib.rs #![feature(nll)] #![feature(test)] #[macro_use] extern crate derive_builder; extern crate failure; extern crate itertools; #[macro_use] extern crate log; extern crate integer_encoding; extern crate io_at; extern crate log4rs; extern crate regex; #[macro_use]...
code_fim
medium
{ "lang": "rust", "repo": "gfreezy/bitcask-rs", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use core::Bitcask; pub use core::{Config, ConfigBuilder}; pub use keys_iterator::StoreKeys; use std::sync::{Once, ONCE_INIT}; static INIT: Once = ONCE_INIT; /// Read config file 'log4rs.yml' pub fn setup(path: &str) { INIT.call_once(|| { log4rs::init_file(path, Default::default()).expe...
code_fim
medium
{ "lang": "rust", "repo": "gfreezy/bitcask-rs", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let with_link = raw & 0x0100_0000 != 0; if with_link { Opcode::BL } else { Opcode::B } } pub fn decode(raw: Word) -> Box<Decoder> { let cond = raw & COND_FIELD; let cond = match cond { COND_AL => Condition::AL, _ => panic!("Unknowm condition {}", co...
code_fim
hard
{ "lang": "rust", "repo": "bokuweb/armv4-emu-rs", "path": "/src/decoder/arm.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bokuweb/armv4-emu-rs path: /src/decoder/arm.rs use constants::COND_FIELD; use types::{Shift, Word}; #[derive(Debug, PartialEq, Clone)] pub enum Category { Undefined, Multiple, Memory, ExtraMemory, DataProcessing, Branch, MultiLoadAndStore, } #[derive(Debug, PartialE...
code_fim
hard
{ "lang": "rust", "repo": "bokuweb/armv4-emu-rs", "path": "/src/decoder/arm.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let op2 = (raw >> 5) & 0b11; let l = is_load(raw); match op2 { 0b01 if !l => Opcode::STRH, 0b01 if l => Opcode::LDRH, 0b10 if l => Opcode::LDRSB, 0b11 if l => Opcode::LDRSH, _ => panic!("undefined instruction detected"), } } fn decode_data_processin...
code_fim
hard
{ "lang": "rust", "repo": "bokuweb/armv4-emu-rs", "path": "/src/decoder/arm.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chiamtc/rust-journey path: /office_playground7_lifetime/src/main.rs fn main() { let x; //think of 'a { let y = 10; //think of 'b x = &y; } println!("Hello, world!"); let a = A{x:"hello"}; //static lfietime let s:&'static str = "The string"; } <|fim...
code_fim
hard
{ "lang": "rust", "repo": "chiamtc/rust-journey", "path": "/office_playground7_lifetime/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>//if struct holds a reference, it needs a lifetime annotation //every reference behind the scene of rust has lifetime annotation aka lifetime illusion/inference // but it doesn't last long enough struct A<'a>{ x:&'a str }<|fim_prefix|>// repo: chiamtc/rust-journey path: /office_playground7_lifetime/...
code_fim
medium
{ "lang": "rust", "repo": "chiamtc/rust-journey", "path": "/office_playground7_lifetime/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if x.len() == y.len(){ x }else{ y } } //if struct holds a reference, it needs a lifetime annotation //every reference behind the scene of rust has lifetime annotation aka lifetime illusion/inference // but it doesn't last long enough struct A<'a>{ x:&'a str }<|fim_prefi...
code_fim
hard
{ "lang": "rust", "repo": "chiamtc/rust-journey", "path": "/office_playground7_lifetime/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> TempChannelStore { temp_chans: chans } } Err(e) => { // FIXME What if FileNotFound != e.kind() { error!("Failed to open channel file: {}", e); } TempChannelStore { ...
code_fim
hard
{ "lang": "rust", "repo": "Mavulp/hivecom-discord-bot", "path": "/src/commands/general.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mavulp/hivecom-discord-bot path: /src/commands/general.rs use std::collections::HashMap; use std::fs::OpenOptions; use std::io::ErrorKind::NotFound as FileNotFound; use serenity::framework::standard::{macros::command, Args, CommandResult}; use serenity::model::channel::Message; use serenity::mo...
code_fim
hard
{ "lang": "rust", "repo": "Mavulp/hivecom-discord-bot", "path": "/src/commands/general.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JesseWright/aws-sdk-rust path: /sdk/appmesh/src/operation_ser.rs // Code generated by software.amazon.smithy.rust.codegen.smithy-rs. DO NOT EDIT. pub fn serialize_operation_create_gateway_route( input: &crate::input::CreateGatewayRouteInput, ) -> Result<smithy_http::body::SdkBody, smithy_typ...
code_fim
hard
{ "lang": "rust", "repo": "JesseWright/aws-sdk-rust", "path": "/sdk/appmesh/src/operation_ser.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn serialize_operation_update_mesh( input: &crate::input::UpdateMeshInput, ) -> Result<smithy_http::body::SdkBody, smithy_types::Error> { let mut out = String::new(); let mut object = smithy_json::serialize::JsonObjectWriter::new(&mut out); crate::json_ser::serialize_structure_update_m...
code_fim
hard
{ "lang": "rust", "repo": "JesseWright/aws-sdk-rust", "path": "/sdk/appmesh/src/operation_ser.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hudson-ayers/tock path: /capsules/src/kv_driver.rs t static_buffer_len = buf.len().min(unhashed_key.len()); // Copy the data into the static buffer ...
code_fim
hard
{ "lang": "rust", "repo": "hudson-ayers/tock", "path": "/capsules/src/kv_driver.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) }) .unwrap_or_else(|err| Err(err.into())) }) } fn check_queue(&self) { for appiter in self.apps.iter() { let started_command = appiter.enter(|app, _| { // If an app is already running let it com...
code_fim
hard
{ "lang": "rust", "repo": "hudson-ayers/tock", "path": "/capsules/src/kv_driver.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.data_buffer.replace(key); self.appid.map(move |id| { self.apps.enter(*id, move |app, upcalls| { if app.op.get().map(|op| op == UserSpaceOp::Delete).is_some() { if let Err(e) = result { upcalls ...
code_fim
hard
{ "lang": "rust", "repo": "hudson-ayers/tock", "path": "/capsules/src/kv_driver.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Identifies the version of the MPI standard implemented by the library. /// /// Returns a tuple of `(version, subversion)`, e.g. `(3, 0)`. /// /// Can be called without initializing MPI. pub fn get_version() -> (c_int, c_int) { let mut version: c_int = unsafe { mem::uninitialized() }; let mut s...
code_fim
hard
{ "lang": "rust", "repo": "hestela/rsmpi", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hestela/rsmpi path: /src/lib.rs // #![feature(plugin, custom_attribute)] // #![plugin(c_import)] #![deny(missing_docs)] //! Message Passing Interface bindings for Rust //! //! The [Message Passing Interface][MPI] (MPI) is a specification for a //! message-passing style concurrency library. Impl...
code_fim
hard
{ "lang": "rust", "repo": "hestela/rsmpi", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn get_color_clear_value(x: f32, y: f32, z: f32, w: f32) -> vk::ClearValue { vk::ClearValue { color: vk::ClearColorValue { float32: [x, y, z, w] } } } pub fn create_viewport(x: u32, y: u32, width: u32, height: u32, min_depth: f32, max_depth: f32) -> vk::Viewport { ...
code_fim
hard
{ "lang": "rust", "repo": "ubuntunux/RustEngine3D", "path": "/src/vulkan_context/vulkan_context.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ubuntunux/RustEngine3D path: /src/vulkan_context/vulkan_context.rs use std::cmp::min; use std::default::Default; use std::vec::Vec; use ash; use ash::{ vk, Device, }; pub type CubeMapArray<T> = Vec<T>; // equivalent to [T; constants::CUBE_LAYER_COUNT as usize] pub type SwapchainArray<T...
code_fim
hard
{ "lang": "rust", "repo": "ubuntunux/RustEngine3D", "path": "/src/vulkan_context/vulkan_context.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>pub fn record_submit_commandbuffer<F: FnOnce(&Device, vk::CommandBuffer)>( device: &Device, command_buffer: vk::CommandBuffer, submit_queue: vk::Queue, wait_mask: &[vk::PipelineStageFlags], wait_semaphores: &[vk::Semaphore], signal_semaphores: &[vk::Semaphore], func: F, ) { ...
code_fim
hard
{ "lang": "rust", "repo": "ubuntunux/RustEngine3D", "path": "/src/vulkan_context/vulkan_context.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TianTianForever/Rust-Tutorial path: /test42/rary.rs // rary.rs // This crate is library #![crate_type = "lib"] // When the crate_type attribute is used,we no longer need to pass the --crate-type flag to rustc. // // $rustc rary.rs // $ls lib* // library.rlib <|fim_suffix|> println!("call...
code_fim
medium
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/test42/rary.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("called rary's 'private_function()'"); } pub fn indirect_access() { print!("called rary's 'private_function()', that \n"); private_function(); }<|fim_prefix|>// repo: TianTianForever/Rust-Tutorial path: /test42/rary.rs // rary.rs // This crate is library #![crate_type = "lib"] // Whe...
code_fim
medium
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/test42/rary.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> 0xE0, trans: 0x34, pnwc: 0x0F00, pos: 0x00000036, lemma: 0x23E2 }, AVXWrit { strongs: [ 6310, 0, 0, 0, ], b: 19, c: 49, v: 3, wc: 16, word: 0x801B, punc: 0x00, trans: 0x20, pnwc: 0x4028, pos: 0x00083F9C, lemma: 0x001B }, AVXWrit { strongs: [ 6310, 0, 0, 0, ], b: 19, c: 49, v: 3, wc: 15,...
code_fim
hard
{ "lang": "rust", "repo": "kwonus/Digital-AV", "path": "/omega/foundations/rust/src/avx/written/written_19.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pnwc: 0x4030, pos: 0x000001DC, lemma: 0x0098 }, AVXWrit { strongs: [ 0, 0, 0, 0, ], b: 19, c: 50, v: 7, wc: 3, word: 0x028B, punc: 0x02, trans: 0x00, pnwc: 0x0F00, pos: 0x00000036, lemma: 0x028B }, AVXWrit { strongs: [ 430, 0, 0, 0, ], b: 19, c: 50, v: 7, wc: 2, word: 0x0137, punc:...
code_fim
hard
{ "lang": "rust", "repo": "kwonus/Digital-AV", "path": "/omega/foundations/rust/src/avx/written/written_19.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kwonus/Digital-AV path: /omega/foundations/rust/src/avx/written/written_19.rs 0x0100, pos: 0x00005AC9, lemma: 0x0070 }, AVXWrit { strongs: [ 8034, 0, 0, 0, ], b: 19, c: 41, v: 5, wc: 4, word: 0x0038, punc: 0x00, trans: 0x00, pnwc: 0x0C00, pos: 0x00000063, lemma: 0x0038 }, AVXWrit { ...
code_fim
hard
{ "lang": "rust", "repo": "kwonus/Digital-AV", "path": "/omega/foundations/rust/src/avx/written/written_19.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: umatbro/p-tutorials path: /rust/rust-book/ownership/src/main.rs fn main() { let mut s = String::from("Hello"); // s comes into scope s.push_str(", world"); println!("{}", s); takes_ownership(s); // s's value moves into the function... // ... and so is no l...
code_fim
hard
{ "lang": "rust", "repo": "umatbro/p-tutorials", "path": "/rust/rust-book/ownership/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> text.push_str("I change you"); text } fn slice_type() { let str = String::from("Hello world"); let hello = &str[0..5]; let world = &str[6..]; println!("{}, {}", hello, world); println!("First word: {}", first_word(&str)); } fn first_word(text: &String) -> &str { let bytes...
code_fim
hard
{ "lang": "rust", "repo": "umatbro/p-tutorials", "path": "/rust/rust-book/ownership/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/em-refactor path: /em-refactor-lib/src/refactorings/box_field/mod.rs use rustc_hir::HirId; use rustc_span::Span; use crate::refactoring_invocation::{AstDiff, QueryResult, TyContext}; use super::{box_named_field, box_tuple_field}; use super::visitors::collect_field; pub struct StructPat...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/em-refactor", "path": "/em-refactor-lib/src/refactorings/box_field/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if field.is_positional() { box_tuple_field::do_refactoring(tcx, struct_hir_id, index, field.ty.span) } else { box_named_field::do_refactoring(tcx, struct_hir_id, &field.ident.to_string(), field.ty.span) } } else { Err(tcx.source().span_e...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/em-refactor", "path": "/em-refactor-lib/src/refactorings/box_field/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dollarkillerx/RUST-Newcomer-Development-Program path: /s04/s04_1/src/main.rs use std::error::Error; use sqlx::postgres::PgPoolOptions; use async_std::prelude::*; <|fim_suffix|>#[async_std::main] async fn main() -> Result<()> { // Create a connection pool let pool = PgPoolOptions::new() ...
code_fim
medium
{ "lang": "rust", "repo": "dollarkillerx/RUST-Newcomer-Development-Program", "path": "/s04/s04_1/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: taskie/rust-script-binders-exercise path: /src/util.rs use std::{error::Error, fmt}; #[derive(Debug)] pub struct SimpleError(pub String); impl fmt::Display for SimpleError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> { <|fim_suffix|>impl Error for SimpleError {}<|f...
code_fim
easy
{ "lang": "rust", "repo": "taskie/rust-script-binders-exercise", "path": "/src/util.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>impl Error for SimpleError {}<|fim_prefix|>// repo: taskie/rust-script-binders-exercise path: /src/util.rs use std::{error::Error, fmt}; #[derive(Debug)] pub struct SimpleError(pub String); <|fim_middle|>impl fmt::Display for SimpleError { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> Result<(), fmt...
code_fim
medium
{ "lang": "rust", "repo": "taskie/rust-script-binders-exercise", "path": "/src/util.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>/// A compressed bitmap with u64 values. Implemented as a `BTreeMap` of `RoaringBitmap`s. pub mod treemap; pub use bitmap::RoaringBitmap; pub use treemap::RoaringTreemap;<|fim_prefix|>// repo: josephglanville/roaring-rs path: /src/lib.rs //! This is a [Rust][] port of the [Roaring bitmap][] data struct...
code_fim
medium
{ "lang": "rust", "repo": "josephglanville/roaring-rs", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: josephglanville/roaring-rs path: /src/lib.rs //! This is a [Rust][] port of the [Roaring bitmap][] data structure, initially //! defined as a [Java library][roaring-java] and described in [_Better bitmap //! performance with Roaring bitmaps_][roaring-paper]. //! //! [Rust]: https://rust-lang.org...
code_fim
medium
{ "lang": "rust", "repo": "josephglanville/roaring-rs", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gcharnock/rafter path: /src/config.rs use std::time::Duration; pub struct RaftConfig<NodeId> { min_election_timeout: Duration, max_election_timeout: Duration, peer_ids: Vec<NodeId>, } impl<NodeId> RaftConfig<NodeId> { pub fn new(peer_ids: Vec<NodeId>, min_electio...
code_fim
medium
{ "lang": "rust", "repo": "gcharnock/rafter", "path": "/src/config.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_peer_ids(&self) -> &Vec<NodeId> { return &self.peer_ids; } pub fn get_peer_count(&self) -> usize { self.peer_ids.len() } }<|fim_prefix|>// repo: gcharnock/rafter path: /src/config.rs use std::time::Duration; pub struct RaftConfig<NodeId> { min_election_tim...
code_fim
medium
{ "lang": "rust", "repo": "gcharnock/rafter", "path": "/src/config.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: centum/exercism-rust path: /reverse-string/tests/reverse-string.rs //! Tests for reverse-string //! //! Generated by [script][script] using [canonical data][canonical-data] //! //! [script]: https://github.com/exercism/rust/blob/b829ce2/bin/init_exercise.py //! [canonical-data]: https://raw.gith...
code_fim
hard
{ "lang": "rust", "repo": "centum/exercism-rust", "path": "/reverse-string/tests/reverse-string.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] /// empty string fn test_an_empty_string() { process_reverse_case("", ""); } #[test] //#[ignore] /// a word fn test_a_word() { process_reverse_case("robot", "tobor"); } #[test] //#[ignore] //#[cfg(feature = "grapheme")] /// grapheme clusters fn test_grapheme_clusters() { process_reve...
code_fim
medium
{ "lang": "rust", "repo": "centum/exercism-rust", "path": "/reverse-string/tests/reverse-string.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // TODO: nested block, which is not supported at the moment. let cond_s = self.cond_str(ctx); let mut block_ctx = ctx.with_block_condition(cond_s); for attr in self.content.iter() { attr.write_style(w, &mut block_ctx); } block_ctx.finish(w); ...
code_fim
hard
{ "lang": "rust", "repo": "00mjk/stylist-rs", "path": "/packages/stylist-core/src/ast/block.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 00mjk/stylist-rs path: /packages/stylist-core/src/ast/block.rs use std::borrow::Cow; use super::{RuleBlockContent, Selector, StyleContext, ToStyleStr}; /// A block is a set of css properties that apply to elements that /// match the condition. The CSS standard calls these "Qualified rules". //...
code_fim
hard
{ "lang": "rust", "repo": "00mjk/stylist-rs", "path": "/packages/stylist-core/src/ast/block.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Context for applying a list of `FieldRefMutation` instances. pub struct ApplySignatureFieldRefContext<'a> { module: &'a mut CompiledModuleMut, mutations: Vec<FieldRefMutation>, } impl<'a> ApplySignatureFieldRefContext<'a> { pub fn new(module: &'a mut CompiledModuleMut, mutations: Vec<Fiel...
code_fim
hard
{ "lang": "rust", "repo": "xpeerchain/xpeerchain", "path": "/language/bytecode_verifier/invalid_mutations/src/signature.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> ApplySignatureDoubleRefContext<'a> { pub fn new(module: &'a mut CompiledModuleMut, mutations: Vec<DoubleRefMutation>) -> Self { Self { module, mutations } } pub fn apply(self) -> Vec<VerificationError> { // Apply double refs before field refs -- XXX is this correct? ...
code_fim
hard
{ "lang": "rust", "repo": "xpeerchain/xpeerchain", "path": "/language/bytecode_verifier/invalid_mutations/src/signature.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xpeerchain/xpeerchain path: /language/bytecode_verifier/invalid_mutations/src/signature.rs // Copyright (c) The XPeer Core Contributors // SPDX-License-Identifier: Apache-2.0 use proptest::{ prelude::*, sample::{select, Index as PropIndex}, }; use proptest_helpers::{pick_slice_idxs, Rep...
code_fim
hard
{ "lang": "rust", "repo": "xpeerchain/xpeerchain", "path": "/language/bytecode_verifier/invalid_mutations/src/signature.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>st_line_indent = Some(line.detect_indent()); } else { let detected_indent = line.detect_indent(); if !line[detected_indent.len..].trim_start().is_empty() { if let Some(common_indent) = common_indent.as_mut() { *common_indent = (*common_indent).min(detected_indent); } else { commo...
code_fim
hard
{ "lang": "rust", "repo": "twistedfall/opencv-rust", "path": "/binding-generator/src/comment.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: twistedfall/opencv-rust path: /binding-generator/src/comment.rs use crate::string_ext::Indent; use crate::StrExt; pub fn strip_comment_markers(comment: &str) -> String { const MULTILINE_PREFIX: &str = "/*"; const MULTILINE_CONT: &str = "*"; const MULTILINE_SUFFIX: &str = "*/"; const SINGLEL...
code_fim
hard
{ "lang": "rust", "repo": "twistedfall/opencv-rust", "path": "/binding-generator/src/comment.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> let mut child = cmd.spawn()?; self.connection = Some(git::Connection::new_for_spawned_process( child.stdout.take().expect("stdout configured"), child.stdin.take().expect("stdin configured"), self.desired_version, self.path.clone(), ))...
code_fim
hard
{ "lang": "rust", "repo": "happyborg/gitoxide", "path": "/git-transport/src/client/file.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: happyborg/gitoxide path: /git-transport/src/client/file.rs use crate::{ client::{self, git, MessageKind, RequestWriter, SetServiceResponse, WriteMode}, Protocol, Service, }; use bstr::{BString, ByteSlice}; use std::process::{self, Command, Stdio}; // from https://github.com/git/git/blob...
code_fim
hard
{ "lang": "rust", "repo": "happyborg/gitoxide", "path": "/git-transport/src/client/file.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ier: PacketIdentifier, payload: (), }<|fim_prefix|>// repo: chenenjie/mqtt path: /src/packet/puback.rs use super::FixHeader; use super::Packet<|fim_middle|>Identifier; struct PubackPacket { fix_header: FixHeader, packet_identif
code_fim
medium
{ "lang": "rust", "repo": "chenenjie/mqtt", "path": "/src/packet/puback.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chenenjie/mqtt path: /src/packet/puback.rs use super::FixHeader; use super::Packet<|fim_suffix|>ix_header: FixHeader, packet_identifier: PacketIdentifier, payload: (), }<|fim_middle|>Identifier; struct PubackPacket { f
code_fim
easy
{ "lang": "rust", "repo": "chenenjie/mqtt", "path": "/src/packet/puback.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Riduidel/codingame path: /multiplayer/spring-challenge-2021/tests/in_game_tests.rs use std::time::Instant; use spring_challenge_2021::*; extern crate spectral; use spectral::prelude::*; /* #[test] fn test_actions_at_1620540281() { let day = 0; let sun = 2; let gro...
code_fim
hard
{ "lang": "rust", "repo": "Riduidel/codingame", "path": "/multiplayer/spring-challenge-2021/tests/in_game_tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let day = 14; let sun = 6; let nutrients = 14; let ground = VecGround::<Cell>::parse(&mut vec![Some(Cell { richness: 3 }), Some(Cell { richness: 3 }), Some(Cell { richness: 3 }), Some(Cell { richness: 3 }), Some(Cell { richness: 3 }), Some(Cell { richness: 3 }), Some(Cell {...
code_fim
hard
{ "lang": "rust", "repo": "Riduidel/codingame", "path": "/multiplayer/spring-challenge-2021/tests/in_game_tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: COLDTURNIP/raphanus_leetcode path: /rust/src/p119.rs /* Problem 119. Pascal's Triangle II ================================= https://leetcode.com/problems/pascals-triangle-ii/ Given an integer rowIndex, return the rowIndexth row of the Pascal's triangle. Notice that the row index starts from 0...
code_fim
hard
{ "lang": "rust", "repo": "COLDTURNIP/raphanus_leetcode", "path": "/rust/src/p119.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Constraints: 0 <= rowIndex <= 40 */ impl Solution { pub fn get_row(row_index: i32) -> Vec<i32> { let mut ans = Vec::new(); if row_index < 0 { return ans; } ans.push(1); let m = row_index as usize; // C(m, n+1) = C(m, n) * (m-n+1) / (n+1...
code_fim
hard
{ "lang": "rust", "repo": "COLDTURNIP/raphanus_leetcode", "path": "/rust/src/p119.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lpc-rs/lpc-pac path: /lpc54608/src/emc/static_/staticwaitturn.rs #[doc = "Register `STATICWAITTURN` reader"] pub struct R(crate::R<STATICWAITTURN_SPEC>); impl core::ops::Deref for R { type Target = crate::R<STATICWAITTURN_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { ...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc54608/src/emc/static_/staticwaitturn.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> W(writer) } } #[doc = "Field `WAITTURN` reader - Bus turn-around cycles."] pub struct WAITTURN_R(crate::FieldReader<u8, u8>); impl WAITTURN_R { pub(crate) fn new(bits: u8) -> Self { WAITTURN_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for WAITTURN_R { type Ta...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc54608/src/emc/static_/staticwaitturn.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let point = Point::new(3.0, 4.0); }<|fim_prefix|>// repo: NaokiM03/pub_impl path: /examples/simple_pub.rs mod fake_module { use pub_impl::pub_impl; pub struct Point{ x: f32, y: f32, } #[pub_impl] impl Point { pub fn new(x: f32, y: f32) -> Self { ...
code_fim
easy
{ "lang": "rust", "repo": "NaokiM03/pub_impl", "path": "/examples/simple_pub.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NaokiM03/pub_impl path: /examples/simple_pub.rs mod fake_module { use pub_impl::pub_impl; pub struct Point{ x: f32, y: f32, } <|fim_suffix|> let point = Point::new(3.0, 4.0); }<|fim_middle|> #[pub_impl] impl Point { pub fn new(x: f32, y: f32) -> Se...
code_fim
medium
{ "lang": "rust", "repo": "NaokiM03/pub_impl", "path": "/examples/simple_pub.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let nl = read_vec::<i64>(); let (n, l) = (nl[0], nl[1]); let mut sn: Vec<String> = Vec::new(); for _ in 0..n { sn.push(read::<String>()); } sn.sort(); for s in &sn { print!("{}", s); } }<|fim_prefix|>// repo: helloooooo/prac-algo path: /atcoder/src/abc042b....
code_fim
hard
{ "lang": "rust", "repo": "helloooooo/prac-algo", "path": "/atcoder/src/abc042b.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: helloooooo/prac-algo path: /atcoder/src/abc042b.rs fn read<T: std::str::FromStr>() -> T { let mut s = String::new(); std::io::stdin().read_line(&mut s).ok(); s.trim().parse().ok().unwrap() } <|fim_suffix|>fn read_vec2<T: std::str::FromStr>(n: u32) -> Vec<Vec<T>> { (0..n).map(|_|...
code_fim
medium
{ "lang": "rust", "repo": "helloooooo/prac-algo", "path": "/atcoder/src/abc042b.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wizzk42/rsa-crypt path: /src/crypt/decrypter/aes.rs /// /// /// extern crate openssl; use openssl::{ symm::{decrypt, decrypt_aead}, }; use crate::crypt::{ CryptOpts, CryptParams, api::{ aes::{ AesCipherMode, AesSymmetricKey, AesVaria...
code_fim
hard
{ "lang": "rust", "repo": "wizzk42/rsa-crypt", "path": "/src/crypt/decrypter/aes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut _effective_ciphertext = splitted_ciphertext.next().unwrap(); let mut _effective_tagbuffer = splitted_ciphertext.next().unwrap_or(&[0]); //let mut tag_buffer = ; _plaintext.clear(); _plaintext.append( match self.aead { Some(_) => ...
code_fim
hard
{ "lang": "rust", "repo": "wizzk42/rsa-crypt", "path": "/src/crypt/decrypter/aes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lucab/data-encoding path: /bin/src/io.rs use base::Base; use data_encoding::DecodeError; use error::Error; use std::io::{Read, Write}; use std::ops::Deref; pub trait ReadDelta: Read { fn delta(&self, pos: usize) -> usize; fn length(&self) -> usize; } impl ReadDelta for ::std::fs::File ...
code_fim
hard
{ "lang": "rust", "repo": "lucab/data-encoding", "path": "/bin/src/io.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn length(&self) -> usize { self.removed.len() } } pub struct Wrap<W: Write> { inner: W, pos: usize, max: usize, } impl<W: Write> Wrap<W> { pub fn new(inner: W, max: usize) -> Self { Wrap { inner: inner, pos: 0, max: max } } } impl<W: Write> Write for Wrap<W> { fn wr...
code_fim
hard
{ "lang": "rust", "repo": "lucab/data-encoding", "path": "/bin/src/io.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>implement_vertex!(Vertex, position); #[derive(Copy, Clone)] struct TargetData { matrix: Matrix3, color: [f32; 4], } implement_vertex!(TargetData, matrix, color); pub struct Window { display: glium::Display, program: glium::Program, closed: bool, mouse_down: bool, mouse_posi...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/boomshine_rust", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/boomshine_rust path: /src/main.rs #[macro_use] extern crate glium; extern crate rand; extern crate rayon; use rand::{Rng, thread_rng as rng}; use rayon::prelude::*; use std::ops::{Add, Mul, Sub}; use std::time::Instant; fn main() { let mut game = Game::new(); game.do_loop(); }...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/boomshine_rust", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self { active_quizzes: old_contract.active_quizzes, quizzes: quizzes_new, questions: old_contract.questions, question_options: old_contract.question_options, rewards: old_contract.rewards, games: old_contract.games, ...
code_fim
hard
{ "lang": "rust", "repo": "ilyar/quizchain", "path": "/contract/src/migrate.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilyar/quizchain path: /contract/src/migrate.rs use crate::*; #[near_bindgen] impl QuizChain { #[private] #[init(ignore_state)] #[allow(dead_code)] pub fn migrate_1() -> Self { #[derive(BorshSerialize, BorshDeserialize, Serialize, Deserialize, Copy, Clone, Debug, PartialE...
code_fim
hard
{ "lang": "rust", "repo": "ilyar/quizchain", "path": "/contract/src/migrate.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Bryce-MW/SMTA path: /src/platform/macos/frameworks/mod.rs pub mod adapters; pub mod blocks; mod network; mod system; pub mod object { use core::ffi::c_void; use std::marker::PhantomData; use std::ptr::NonNull; use super::*; use network::nw_object::*; <|fim_suffix|> pub ...
code_fim
hard
{ "lang": "rust", "repo": "Bryce-MW/SMTA", "path": "/src/platform/macos/frameworks/mod.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> match self.0 { None => Object(None, PhantomData), Some(ptr) => unsafe { D::retain(ptr.cast()); Object(Some(ptr), PhantomData) } } } } pub trait RetainRelease { unsafe fn...
code_fim
hard
{ "lang": "rust", "repo": "Bryce-MW/SMTA", "path": "/src/platform/macos/frameworks/mod.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let env = Environment::default(); assert!(env.get_by_name("a").is_none()); } #[test] fn from() { let name = ExternalName::testcase("test"); let signature = Signature::new(CallConv::Fast); let func = Function::with_name_signature(name, signature); ...
code_fim
hard
{ "lang": "rust", "repo": "mashtizadeh/wasmtime", "path": "/cranelift/interpreter/src/environment.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mashtizadeh/wasmtime path: /cranelift/interpreter/src/environment.rs //! Implements the function environment (e.g. a name-to-function mapping) for interpretation. use cranelift_codegen::ir::{FuncRef, Function}; use std::collections::HashMap; #[derive(Default)] pub struct Environment { func...
code_fim
hard
{ "lang": "rust", "repo": "mashtizadeh/wasmtime", "path": "/cranelift/interpreter/src/environment.rs", "mode": "psm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kubkon/wiggle path: /crates/runtime/src/guest_type.rs use crate::{GuestError, GuestPtr}; use std::mem; pub trait GuestErrorType<'a> { type Context; fn success() -> Self; fn from_error(e: GuestError, ctx: &Self::Context) -> Self; } /// A trait for types that are intended to be point...
code_fim
hard
{ "lang": "rust", "repo": "kubkon/wiggle", "path": "/crates/runtime/src/guest_type.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // All bit patterns are safe, nothing to do here Ok(()) } } )*) } primitives! { // signed i8 i16 i32 i64 i128 isize // unsigned u8 u16 u32 u64 u128 usize // floats f32 f64 } // Support pointers-to-pointers where pointers ar...
code_fim
hard
{ "lang": "rust", "repo": "kubkon/wiggle", "path": "/crates/runtime/src/guest_type.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn render() { match unsafe { warp_menu_state } { WarpMenu::RoomSelection => room_selection::render(), WarpMenu::StageSelection => stage_selection::render(), WarpMenu::BrowseTop => browse_top::render(), WarpMenu::Main => main::render(), } } #[derive(Copy, Clone)...
code_fim
hard
{ "lang": "rust", "repo": "MichaelK-UnderscoreUnderscore/WindWakerDebugMenu", "path": "/src/warp_menu/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MichaelK-UnderscoreUnderscore/WindWakerDebugMenu path: /src/warp_menu/mod.rs mod browse_top; mod consts; mod main; mod room_selection; mod stage_selection; pub static mut warp_menu_state: WarpMenu = WarpMenu::Main; <|fim_suffix|>#[derive(Copy, Clone)] pub enum WarpMenu { RoomSelection, ...
code_fim
hard
{ "lang": "rust", "repo": "MichaelK-UnderscoreUnderscore/WindWakerDebugMenu", "path": "/src/warp_menu/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let processed = unsafe { GFp_aesni_gcm_decrypt( in_out[src.clone()].as_ptr(), in_out.as_mut_ptr(), in_out.len() - src.start, aes_key.inner_less_safe(), &mut ctr, ...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/phala-blockchain", "path": "/vendor/ring/src/aead/aes_gcm.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Phala-Network/phala-blockchain path: /vendor/ring/src/aead/aes_gcm.rs // Copyright 2015-2016 Brian Smith. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permissi...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/phala-blockchain", "path": "/vendor/ring/src/aead/aes_gcm.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> input: *const u8, output: *mut u8, len: c::size_t, key: &aes::AES_KEY, ivec: &mut Counter, gcm: &mut gcm::ContextInner, ) -> c::size_t; } let pro...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/phala-blockchain", "path": "/vendor/ring/src/aead/aes_gcm.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: clucompany/Goto path: /examples/gtree_logics.rs #[macro_use] extern crate goto; use std::borrow::Cow; use std::io::Read; use std::io::Write; use std::path::Path; use std::io::Error; use std::io::ErrorKind; fn main() { let file_path = Path::new("./gblock_logic"); let file_data: Cow<str>; gt...
code_fim
medium
{ "lang": "rust", "repo": "clucompany/Goto", "path": "/examples/gtree_logics.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }