text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>pub extern "x86-interrupt" fn handler(_stack_frame: &mut InterruptStackFrame) { let mut keyboard = KEYBOARD.lock(); let mut port = Port::new(PS2_IO_PORT); let scancode: u8 = unsafe { port.read() }; if let Ok(Some(key_event)) = keyboard.add_byte(scancode) { if let Some(key) = key...
code_fim
hard
{ "lang": "rust", "repo": "jfredett/os", "path": "/src/interrupt/keyboard.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rome/tools path: /crates/rome_json_formatter/tests/spec_tests.rs mod quick_test; mod spec_test; <|fim_suffix|> mod json_module { tests_macros::gen_tests! {"tests/specs/json/**/*.json", crate::spec_test::run, ""} } }<|fim_middle|>mod formatter {
code_fim
easy
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_json_formatter/tests/spec_tests.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> mod json_module { tests_macros::gen_tests! {"tests/specs/json/**/*.json", crate::spec_test::run, ""} } }<|fim_prefix|>// repo: rome/tools path: /crates/rome_json_formatter/tests/spec_tests.rs mod quick_test; mod spec_test; <|fim_middle|>mod formatter {
code_fim
easy
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_json_formatter/tests/spec_tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Yizhou150/connector-x path: /connectorx/src/macros.rs /// A macro to implement `TypeAssoc` and `Realize` which saves repetitive code. /// /// # Example Usage /// `impl_typesystem!(DataType, [DataType::F64] => f64, [DataType::I64] => i64);` /// This means for the type system `DataType`, it's vari...
code_fim
hard
{ "lang": "rust", "repo": "Yizhou150/connector-x", "path": "/connectorx/src/macros.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> } }; (@processor [$TSS:tt, $TSD:tt] $([ $V1:tt [$T1:ty] => $V2:tt [$T2:ty] | conversion $HOW:ident ])*, $([ $($TOKENS:tt)+ ])*) => { fn processor<'s, 'd>( ts1: Self::TSS, ts2: Self::TSD, ) -> $crate::Result< fn( src: &mut...
code_fim
hard
{ "lang": "rust", "repo": "Yizhou150/connector-x", "path": "/connectorx/src/macros.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rcsv/rrrp path: /src/util/os/windows_macos.rs use std::fs::{FileType, Metadata} ; use std::path::Path ; <|fim_suffix|>/// Check file length responsibly pub fn file_length<P: AsRef<Path>>(meta: &Metadata, _: &P) -> u64 { meta.len() ; } // 正直このファイルが何をしているのかよくわかりません。<|fim_middle|>/// OS-speci...
code_fim
medium
{ "lang": "rust", "repo": "rcsv/rrrp", "path": "/src/util/os/windows_macos.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Check file length responsibly pub fn file_length<P: AsRef<Path>>(meta: &Metadata, _: &P) -> u64 { meta.len() ; } // 正直このファイルが何をしているのかよくわかりません。<|fim_prefix|>// repo: rcsv/rrrp path: /src/util/os/windows_macos.rs use std::fs::{FileType, Metadata} ; use std::path::Path ; <|fim_middle|>/// OS-speci...
code_fim
medium
{ "lang": "rust", "repo": "rcsv/rrrp", "path": "/src/util/os/windows_macos.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zane-programs/librespot path: /playback/src/lib.rs #[macro_use] extern crate log; extern crate byteorder; extern crate futures; <|fim_suffix|>extern crate librespot_audio as audio; extern crate librespot_core; extern crate librespot_metadata as metadata; extern crate cmd_lib; pub mod audio_b...
code_fim
hard
{ "lang": "rust", "repo": "zane-programs/librespot", "path": "/playback/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>extern crate cmd_lib; pub mod audio_backend; pub mod config; pub mod mixer; pub mod player;<|fim_prefix|>// repo: zane-programs/librespot path: /playback/src/lib.rs #[macro_use] extern crate log; extern crate byteorder; extern crate futures; #[cfg(feature = "alsa-backend")] extern crate alsa; <|fim_m...
code_fim
hard
{ "lang": "rust", "repo": "zane-programs/librespot", "path": "/playback/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> W(writer) } } ///Field `TM` reader - Time Mark pub struct TM_R(crate::FieldReader<u16, u16>); impl TM_R { pub(crate) fn new(bits: u16) -> Self { TM_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for TM_R { type Target = crate::FieldReader<u16, u16>; #[inline...
code_fim
hard
{ "lang": "rust", "repo": "romixlab/stcan", "path": "/src/pac/h7/fdcan/tttmk.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: romixlab/stcan path: /src/pac/h7/fdcan/tttmk.rs ///Register `TTTMK` reader pub struct R(crate::R<TTTMK_SPEC>); impl core::ops::Deref for R { type Target = crate::R<TTTMK_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<TTTMK_SPEC>...
code_fim
hard
{ "lang": "rust", "repo": "romixlab/stcan", "path": "/src/pac/h7/fdcan/tttmk.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: k4t0mono/serpentile path: /keeper/src/main.rs #[macro_use] extern crate log; extern crate simplelog; extern crate serpentine; mod config; mod keeper; use std::{env, process}; use std::net::{SocketAddr, TcpListener, TcpStream, IpAddr}; use std::io::Read; use serpentine::*; use keeper::*; use co...
code_fim
hard
{ "lang": "rust", "repo": "k4t0mono/serpentile", "path": "/keeper/src/main.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let addr = SocketAddr::from(([0, 0, 0, 0], config.port)); let listener = TcpListener::bind(addr).unwrap(); let mut keeper = Keeper::new(); for stream in listener.incoming() { handle_client(stream.unwrap(), &mut keeper); } }<|fim_prefix|>// repo: k4t0mono/serpentile path: /ke...
code_fim
hard
{ "lang": "rust", "repo": "k4t0mono/serpentile", "path": "/keeper/src/main.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>eld 42").unwrap(); /// ``` #[derive(Debug, Clone, ToTokens, Parse, Spanned)] pub struct ExprYield { /// The return token. pub yield_: ast::Yield, /// An optional expression to yield. #[rune(iter)] pub expr: Option<Box<ast::Expr>>, }<|fim_prefix|>// repo: seanchen1991/rune path: /crate...
code_fim
medium
{ "lang": "rust", "repo": "seanchen1991/rune", "path": "/crates/rune/src/ast/expr_yield.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: seanchen1991/rune path: /crates/rune/src/ast/expr_yield.rs use crate::ast; use crate::{Parse, Spanned, ToTokens}; /// A return statement `break [expr]`. /// /// # Examples /// /// ```rust /// use rune::{parse_all, ast}; /// /// parse_all::<ast::ExprYield>("yield").unwrap(); /// parse_all::<ast:...
code_fim
medium
{ "lang": "rust", "repo": "seanchen1991/rune", "path": "/crates/rune/src/ast/expr_yield.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub yield_: ast::Yield, /// An optional expression to yield. #[rune(iter)] pub expr: Option<Box<ast::Expr>>, }<|fim_prefix|>// repo: seanchen1991/rune path: /crates/rune/src/ast/expr_yield.rs use crate::ast; use crate::{Parse, Spanned, ToTokens}; /// A return statement `break [expr]`. //...
code_fim
medium
{ "lang": "rust", "repo": "seanchen1991/rune", "path": "/crates/rune/src/ast/expr_yield.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let empty_array: Vec<i32> = vec![]; assert_eq!(get_first_element_in_array(&empty_array), None); }<|fim_prefix|>// repo: egorgrachev/rust_exercises path: /rust_exercises/tests/integration_test.rs use rust_exercises::get_first_element_in_array; use rust_exercises::get_last_element_in_array; #[test...
code_fim
hard
{ "lang": "rust", "repo": "egorgrachev/rust_exercises", "path": "/rust_exercises/tests/integration_test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: egorgrachev/rust_exercises path: /rust_exercises/tests/integration_test.rs use rust_exercises::get_first_element_in_array; use rust_exercises::get_last_element_in_array; #[test] fn it_adds_two() { <|fim_suffix|>#[test] fn test_first_element_in_array() { let array = [1, 2, 3]; assert_eq!...
code_fim
hard
{ "lang": "rust", "repo": "egorgrachev/rust_exercises", "path": "/rust_exercises/tests/integration_test.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_last_element_in_array() { let array = [1, 2, 3]; assert_eq!(get_last_element_in_array(&array), Some(3)); let empty_array:[i32; 0] = []; assert_eq!(get_last_element_in_array(&empty_array), None); } #[test] fn test_first_element_in_array() { let array = [1, 2, 3]; a...
code_fim
medium
{ "lang": "rust", "repo": "egorgrachev/rust_exercises", "path": "/rust_exercises/tests/integration_test.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pendulum-project/statime path: /statime/src/config/port.rs use rand::Rng; use crate::{time::Interval, Duration}; /// Which delay mechanism a port is using. /// /// Currently, statime only supports the end to end (E2E) delay mechanism. #[derive(Copy, Clone, Debug, Eq, PartialEq, Hash)] pub enum...
code_fim
hard
{ "lang": "rust", "repo": "pendulum-project/statime", "path": "/statime/src/config/port.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl PortConfig { pub fn min_delay_req_interval(&self) -> Interval { match self.delay_mechanism { DelayMechanism::E2E { interval } => interval, } } // section 9.2.6.12 pub fn announce_duration(&self, rng: &mut impl Rng) -> core::time::Duration { // add ...
code_fim
hard
{ "lang": "rust", "repo": "pendulum-project/statime", "path": "/statime/src/config/port.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl <T,M> MarkedRangeSet<T,M> where T: Int, M: Ord + Copy + Clone { pub fn new() -> MarkedRangeSet<T,M> { let mut set = MarkedRangeSet { ranges: BTreeMap::new() }; set.ranges.insert(<T as Int>::min_value(), BTreeSet::new()); set } pub fn add_range(&mut self, lo: T, hi: T, mark: M) { { let...
code_fim
hard
{ "lang": "rust", "repo": "kazagistar/regexgen", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kazagistar/regexgen path: /src/main.rs #![feature(collections)] #![feature(core)] #![feature(custom_attribute)] #![feature(plugin)] #![plugin(quickcheck_macros)] extern crate quickcheck; use std::collections::BTreeMap; use std::collections::BTreeSet; use std::num::Int; use std::collections::Bo...
code_fim
hard
{ "lang": "rust", "repo": "kazagistar/regexgen", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nst OP_CLOSE: u8 = ']' as u8; /// Vertual operator. #[derive(Copy, Clone)] pub enum Op { Plus(u8), Minus(u8), Left(usize), Right(usize), Out, In, /// Open which knows corresponding pc. Open(usize), /// Close which knows corresponding pc. Close(usize), }<|fim_prefix|>// repo: uhyo/bf-g...
code_fim
medium
{ "lang": "rust", "repo": "uhyo/bf-gen", "path": "/packages/bf-gen-interpreter/src/program.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: uhyo/bf-gen path: /packages/bf-gen-interpreter/src/program.rs /// AST of BF source. pub const OP_PLUS: u8 = '+' as u8; pub const OP_MINUS: u8 = '-' as u8; pub const OP_LEFT: u8 = '<' as u8; pub con<|fim_suffix|>nst OP_CLOSE: u8 = ']' as u8; /// Vertual operator. #[derive(Copy, Clone)] pub enum...
code_fim
medium
{ "lang": "rust", "repo": "uhyo/bf-gen", "path": "/packages/bf-gen-interpreter/src/program.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>(usize), Out, In, /// Open which knows corresponding pc. Open(usize), /// Close which knows corresponding pc. Close(usize), }<|fim_prefix|>// repo: uhyo/bf-gen path: /packages/bf-gen-interpreter/src/program.rs /// AST of BF source. pub const OP_PLUS: u8 = '+' as u8; pub const OP_MINUS: u8 = ...
code_fim
medium
{ "lang": "rust", "repo": "uhyo/bf-gen", "path": "/packages/bf-gen-interpreter/src/program.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn to_hartley(trit: f64) -> f64{ bit::to_hartley(to_bit(trit)) } pub fn to_nat(trit: f64) -> f64{ bit::to_nat(to_bit(trit)) } } pub mod bit { pub fn to_trit(bit: f64) -> f64{ let two: f64 = 2.0; bit * two.log(3.0) } pub const fn to_hartley...
code_fim
hard
{ "lang": "rust", "repo": "Scarjit/UoI", "path": "/src/conversion.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Scarjit/UoI path: /src/conversion.rs pub mod hartley{ use crate::conversion::bit; #[inline] pub const fn to_bit(hartleys: f64) -> f64{ std::f64::consts::LOG2_10 * hartleys } #[inline] pub const fn to_nat(hartleys: f64) -> f64{ std::f64::consts::LN_10 * ha...
code_fim
hard
{ "lang": "rust", "repo": "Scarjit/UoI", "path": "/src/conversion.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rbatis/rbatis path: /rbdc-pg/src/types/decimal.rs use crate::arguments::PgArgumentBuffer; use crate::types::decode::Decode; use crate::types::encode::{Encode, IsNull}; use crate::value::{PgValue, PgValueFormat}; use bigdecimal::BigDecimal; use rbdc::decimal::Decimal; use rbdc::Error; impl Encod...
code_fim
medium
{ "lang": "rust", "repo": "rbatis/rbatis", "path": "/rbdc-pg/src/types/decimal.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl Decode for Decimal { fn decode(value: PgValue) -> Result<Self, Error> { match value.format() { PgValueFormat::Binary => Ok(Self(BigDecimal::decode(value)?)), PgValueFormat::Text => Ok(Self(BigDecimal::decode(value)?)), } } }<|fim_prefix|>// repo: rbatis...
code_fim
medium
{ "lang": "rust", "repo": "rbatis/rbatis", "path": "/rbdc-pg/src/types/decimal.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.0.encode(buf)?; Ok(IsNull::No) } } impl Decode for Decimal { fn decode(value: PgValue) -> Result<Self, Error> { match value.format() { PgValueFormat::Binary => Ok(Self(BigDecimal::decode(value)?)), PgValueFormat::Text => Ok(Self(BigDecimal::dec...
code_fim
medium
{ "lang": "rust", "repo": "rbatis/rbatis", "path": "/rbdc-pg/src/types/decimal.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) } pub fn delete_client_nat_rules(&self, lan_nic: &str) -> Result<(), Error> { self.add_iptables_rule( "iptables", &[ "-t", "nat", "-D", "POSTROUTING", "-o", ...
code_fim
hard
{ "lang": "rust", "repo": "patchedsoul/althea_rs", "path": "/althea_kernel_interface/src/exit_client_tunnel.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: patchedsoul/althea_rs path: /althea_kernel_interface/src/exit_client_tunnel.rs use super::{KernelInterface, KernelInterfaceError}; use failure::Error; use std::net::{IpAddr, Ipv4Addr, SocketAddr}; use althea_types::WgKey; impl dyn KernelInterface { pub fn set_client_exit_tunnel_config( ...
code_fim
hard
{ "lang": "rust", "repo": "patchedsoul/althea_rs", "path": "/althea_kernel_interface/src/exit_client_tunnel.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) } pub fn set_route_to_tunnel(&self, gateway: &IpAddr) -> Result<(), Error> { match self.run_command("ip", &["route", "del", "default"]) { Err(e) => warn!("Failed to delete default route {:?}", e), _ => (), }; let output = self.run_co...
code_fim
hard
{ "lang": "rust", "repo": "patchedsoul/althea_rs", "path": "/althea_kernel_interface/src/exit_client_tunnel.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EdGavin98/PNG-Decoder path: /src/chunk_type.rs use std::convert::{TryFrom}; use std::fmt::{Display, Formatter}; use std::str::FromStr; use anyhow::anyhow; use crate::{Error, Result}; #[derive(Eq, PartialEq, Debug)] pub struct ChunkType([u8; 4]); impl ChunkType { pub fn bytes(&self) -> [u8...
code_fim
hard
{ "lang": "rust", "repo": "EdGavin98/PNG-Decoder", "path": "/src/chunk_type.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(opc3) = OpCode3::decode_option(spine) { guts.split3_decode().map(|(a, b, c)| Trinary(opc3, a, b, c)) } else { match u32::from(spine) { 0 => Ok(Data(guts)), 1 => OpCode0::decode(guts).map(Nullary), 2 => guts...
code_fim
hard
{ "lang": "rust", "repo": "nathan-at-least/wormcode", "path": "/wormcode_inst/src/instruction/intermediate.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nathan-at-least/wormcode path: /wormcode_inst/src/instruction/intermediate.rs mod opcode0; mod opcode1; mod opcode2; mod opcode3; #[cfg(test)] mod tests; use self::{opcode0::OpCode0, opcode1::OpCode1, opcode2::OpCode2, opcode3::OpCode3}; use crate::{Instruction, Operand}; use wormcode_bits::{D...
code_fim
hard
{ "lang": "rust", "repo": "nathan-at-least/wormcode", "path": "/wormcode_inst/src/instruction/intermediate.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Termination for () { fn report(self) -> i32 { 0 } }<|fim_prefix|>// repo: sordfish/tms570ls3137 path: /src/lang_items.rs /// Lang item required to make the normal `main` work in applications /// Called by TMS570 crate #[lang = "start"] extern "C" fn start<T>(main: fn() -> T, _argc: ...
code_fim
medium
{ "lang": "rust", "repo": "sordfish/tms570ls3137", "path": "/src/lang_items.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sordfish/tms570ls3137 path: /src/lang_items.rs /// Lang item required to make the normal `main` work in applications /// Called by TMS570 crate #[lang = "start"] extern "C" fn start<T>(main: fn() -> T, _argc: isize, _argv: *const *const u8) -> isize where T: Termination, { main(); <|fi...
code_fim
medium
{ "lang": "rust", "repo": "sordfish/tms570ls3137", "path": "/src/lang_items.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match r#type { "method_call" => Ok(MessageType::MethodCall), "method_return" => Ok(MessageType::MethodReturn), "error" => Ok(MessageType::Error), "signal" => Ok(MessageType::Signal), _ => Err(MatchRuleError::TypeUnknown), } } ...
code_fim
medium
{ "lang": "rust", "repo": "LinkTed/dbus-message-parser", "path": "/src/message/types.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LinkTed/dbus-message-parser path: /src/message/types.rs use crate::match_rule::MatchRuleError; use std::{ convert::TryFrom, fmt::{Display, Formatter, Result as FmtResult}, }; /// An enum representing the [message type]. /// /// [message type]: https://dbus.freedesktop.org/doc/dbus-speci...
code_fim
hard
{ "lang": "rust", "repo": "LinkTed/dbus-message-parser", "path": "/src/message/types.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> collector } .collect(); } fn tracing_comparison(c: &mut Criterion) { init_opentelemetry(); let mut bgroup = c.benchmark_group("tracing_comparison"); bgroup.bench_function("Tokio Tracing", |b| b.iter(opentelemetry_harness)); bgroup.bench_function("Rustracing", |b| b.iter(...
code_fim
hard
{ "lang": "rust", "repo": "jarvis657/minitrace-rust", "path": "/benches/compare.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut bgroup = c.benchmark_group("tracing_comparison"); bgroup.bench_function("Tokio Tracing", |b| b.iter(opentelemetry_harness)); bgroup.bench_function("Rustracing", |b| b.iter(rustracing_harness)); bgroup.bench_function("Minitrace", |b| b.iter(minitrace_harness)); bgroup.finish()...
code_fim
hard
{ "lang": "rust", "repo": "jarvis657/minitrace-rust", "path": "/benches/compare.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jarvis657/minitrace-rust path: /benches/compare.rs // Copyright 2020 TiKV Project Authors. Licensed under Apache-2.0. use criterion::{criterion_group, criterion_main, Criterion}; fn rustracing_harness() { fn dummy_rustracing(span: &rustracing::span::Span<()>) { for _ in 0..99 { ...
code_fim
hard
{ "lang": "rust", "repo": "jarvis657/minitrace-rust", "path": "/benches/compare.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tauri-apps/tauri path: /tooling/cli/templates/app/src-tauri/src/lib.rs #[cfg_attr(mobile, tauri::mobile_entry_point)<|fim_suffix|> .run(tauri::generate_context!()) .expect("error while running tauri application"); }<|fim_middle|>] pub fn run() { tauri::Builder::default()
code_fim
easy
{ "lang": "rust", "repo": "tauri-apps/tauri", "path": "/tooling/cli/templates/app/src-tauri/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ct("error while running tauri application"); }<|fim_prefix|>// repo: tauri-apps/tauri path: /tooling/cli/templates/app/src-tauri/src/lib.rs #[cfg_attr(mobile, tauri::mobile_entry_point)] pub fn run() { tauri::Builder::default() <|fim_middle|> .run(tauri::generate_context!()) .expe
code_fim
easy
{ "lang": "rust", "repo": "tauri-apps/tauri", "path": "/tooling/cli/templates/app/src-tauri/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> .run(tauri::generate_context!()) .expect("error while running tauri application"); }<|fim_prefix|>// repo: tauri-apps/tauri path: /tooling/cli/templates/app/src-tauri/src/lib.rs #[cfg_attr(mobile, tauri::mobile_entry_point)<|fim_middle|>] pub fn run() { tauri::Builder::default()
code_fim
easy
{ "lang": "rust", "repo": "tauri-apps/tauri", "path": "/tooling/cli/templates/app/src-tauri/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( <Uint<$n>>::tokenize(&uint), WordToken::new(hex_literal::hex!($l)) ); assert_eq!( <Int<$n>>::tokenize(&int), WordToken::new(hex_literal::hex!($l)) ); ...
code_fim
hard
{ "lang": "rust", "repo": "roynalnaruto/core", "path": "/crates/sol-types/src/types/data_type.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: roynalnaruto/core path: /crates/sol-types/src/types/data_type.rs zes a signed integer. fn detokenize_int(token: WordToken) -> Self::Int; /// ABI-encode a signed integer in packed mode. fn encode_packed_to_int(int: Self::Int, out: &mut Vec<u8>); /// Tokenizes an unsigned integer....
code_fim
hard
{ "lang": "rust", "repo": "roynalnaruto/core", "path": "/crates/sol-types/src/types/data_type.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> format!("{}[{}]", T::sol_type_name(), N).into() } #[inline] fn type_check(token: &Self::TokenType<'_>) -> Result<()> { for token in token.as_array().iter() { T::type_check(token)?; } Ok(()) } #[inline] fn detokenize(token: Self::TokenTy...
code_fim
hard
{ "lang": "rust", "repo": "roynalnaruto/core", "path": "/crates/sol-types/src/types/data_type.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lpc-rs/lpc-pac path: /lpc54608/src/gpio.rs #[doc = r"Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00..0xc0 - no description available"] pub b: [B; 6], _reserved1: [u8; 0x0f40], #[doc = "0x1000..0x1300 - no description available"] pub w: [W; 6], _reser...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc54608/src/gpio.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rate::Reg<set::SET_SPEC>; #[doc = "Write: Set register for port Read: output bits for port"] pub mod set; #[doc = "CLR register accessor: an alias for `Reg<CLR_SPEC>`"] pub type CLR = crate::Reg<clr::CLR_SPEC>; #[doc = "Clear port"] pub mod clr; #[doc = "NOT register accessor: an alias for `Reg<NOT_SPEC>`...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc54608/src/gpio.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{:?}", line_search(&[1, 2, 3, 4], &4)); println!("{:?}", line_search(&[1, 2, 3, 4], &1)); println!("{:?}", line_search_v2(&[1, 2, 3, 4], &2)); }<|fim_prefix|>// repo: kaidiren/learn-rust path: /algorithm/search/linear_search/src/main.rs pub fn line_search<T>(arr: &[T], target: &T) -...
code_fim
medium
{ "lang": "rust", "repo": "kaidiren/learn-rust", "path": "/algorithm/search/linear_search/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaidiren/learn-rust path: /algorithm/search/linear_search/src/main.rs pub fn line_search<T>(arr: &[T], target: &T) -> Option<usize> where T: PartialOrd, { for (index, item) in arr.iter().enumerate() { if item == target { return Some(index); } } None } ...
code_fim
medium
{ "lang": "rust", "repo": "kaidiren/learn-rust", "path": "/algorithm/search/linear_search/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Y0h4n3s/tools path: /rust/webpasteplus/reciever/src/paster.rs use std::collections::HashMap; use std::fs::OpenOptions; use std::io::Write; pub fn paste_to_file( data: HashMap<String, HashMap<String, HashMap<String, Vec<String>>>>, file_path: &String) -> bool { let save_check = fals...
code_fim
medium
{ "lang": "rust", "repo": "Y0h4n3s/tools", "path": "/rust/webpasteplus/reciever/src/paster.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut data_holder = String::with_capacity(1024); for d in data.iter() { data_holder.push_str(d); data_holder.push('\n') }; data_holder }<|fim_prefix|>// repo: Y0h4n3s/tools path: /rust/webpasteplus/reciever/src/paster.rs use std::collections::HashMap; use std::fs::OpenOp...
code_fim
medium
{ "lang": "rust", "repo": "Y0h4n3s/tools", "path": "/rust/webpasteplus/reciever/src/paster.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Stmt::If(cond, main_block, else_block, assert) } Token::VarIdent => { let lval = self.parse_lval()?; match self.peek().ok_or("modifying operator")? { Token::Assign => { self.next(); let expr = self.parse_expr()?; Stmt::Xor(lval, expr) } Token:...
code_fim
hard
{ "lang": "rust", "repo": "1011X/rever", "path": "/src/ast/statement.rs", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 1011X/rever path: /src/ast/statement.rs use super::*; #[derive(Debug, Clone)] pub enum Stmt { Skip, //Not(LValue), //Neg(LValue), RotLeft(LValue, Expr), RotRight(LValue, Expr), Xor(LValue, Expr), Add(LValue, Expr), Sub(LValue, Expr), Swap(LValue, LValue), //CSwap(Factor, LValu...
code_fim
hard
{ "lang": "rust", "repo": "1011X/rever", "path": "/src/ast/statement.rs", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_suffix|> // if procedure name found, call it. otherwise panic. let results = match (kw, proc) { (Stmt::Do(..), Some(pr)) => pr.call(ctx.items.clone(), vals)?, (Stmt::Undo(..), Some(pr)) => pr.uncall(ctx.items.clone(), vals)?, _ => panic!("could not (un)call procedure {}: not found", callee_n...
code_fim
hard
{ "lang": "rust", "repo": "1011X/rever", "path": "/src/ast/statement.rs", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_suffix|>impl CStringCache { pub fn new() -> CStringCache { CStringCache { cache: HashMap::new() } } pub fn intern(&mut self, string: &str) -> &CStr { self.cache.entry(string.to_owned()).or_insert_with(|| { CString::new(string).unwrap() }) } ...
code_fim
medium
{ "lang": "rust", "repo": "ferm10n/dansible-rust", "path": "/capi/src/cstring_cache.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn intern(&mut self, string: &str) -> &CStr { self.cache.entry(string.to_owned()).or_insert_with(|| { CString::new(string).unwrap() }) } }<|fim_prefix|>// repo: ferm10n/dansible-rust path: /capi/src/cstring_cache.rs use std::collections::HashMap; use std::ffi::{CSt...
code_fim
medium
{ "lang": "rust", "repo": "ferm10n/dansible-rust", "path": "/capi/src/cstring_cache.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ferm10n/dansible-rust path: /capi/src/cstring_cache.rs use std::collections::HashMap; use std::ffi::{CString, CStr}; pub struct CStringCache { cache: HashMap<String, CString> } <|fim_suffix|> pub fn intern(&mut self, string: &str) -> &CStr { self.cache.entry(string.to_owned()).o...
code_fim
medium
{ "lang": "rust", "repo": "ferm10n/dansible-rust", "path": "/capi/src/cstring_cache.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jiegec/rcore_plus path: /kernel/src/net/test.rs use crate::drivers::NET_DRIVERS; use crate::net::SOCKETS; use alloc::vec; use core::fmt::Write; use smoltcp::socket::*; pub extern "C" fn server(_arg: usize) -> ! { if NET_DRIVERS.read().len() < 1 { loop { //thread::yield_n...
code_fim
hard
{ "lang": "rust", "repo": "jiegec/rcore_plus", "path": "/kernel/src/net/test.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if socket.can_send() { write!(socket, "HTTP/1.1 200 OK\r\nServer: rCore\r\nContent-Length: 13\r\nContent-Type: text/html\r\nConnection: Closed\r\n\r\nHello, world!\r\n").unwrap(); socket.close(); } } // simple...
code_fim
hard
{ "lang": "rust", "repo": "jiegec/rcore_plus", "path": "/kernel/src/net/test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let client = match socket.recv() { Ok((_, endpoint)) => Some(endpoint), Err(_) => None, }; if let Some(endpoint) = client { let hello = b"hello\n"; socket.send_slice(hello, endpo...
code_fim
hard
{ "lang": "rust", "repo": "jiegec/rcore_plus", "path": "/kernel/src/net/test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shepmaster/fuzzy-pickles path: /src/ast.rs tent, ExtentIndex, Visit)] pub struct ExpressionBox { pub extent: Extent, pub target: Box<Attributed<Expression>>, pub whitespace: Vec<Whitespace>, } /// Inline type conversion /// /// ### Example Source /// /// ```rust,ignore /// fn a() { ...
code_fim
hard
{ "lang": "rust", "repo": "shepmaster/fuzzy-pickles", "path": "/src/ast.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Type disambiguation /// /// ### Example Source /// /// ```rust,ignore /// fn a() { <Vec<u8> as IntoIterator>::into_iter(scores); } /// // ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ /// ``` #[derive(Debug, HasExtent, ExtentIndex, Visit)] pub struct Disambiguation { pub extent: Extent, pub from_...
code_fim
hard
{ "lang": "rust", "repo": "shepmaster/fuzzy-pickles", "path": "/src/ast.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shepmaster/fuzzy-pickles path: /src/ast.rs / ``` #[derive(Debug, HasExtent, ExtentIndex, Visit)] pub struct TypeGenericsAngle { pub extent: Extent, pub members: Vec<TypeGenericsAngleMember>, pub whitespace: Vec<Whitespace>, } #[derive(Debug, HasExtent, ExtentIndex, Visit, Decompose)...
code_fim
hard
{ "lang": "rust", "repo": "shepmaster/fuzzy-pickles", "path": "/src/ast.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: imoegirl/rust-by-example path: /src/p051_lifetime.rs fn print_ref<'a, 'b>(x: &'a i32, y: &'b i32) { println!("x is {} and y is {}", x, y); } fn faild_borrow<'a>(){ let _x = 12; } fn print_one<'a>(x: &'a i32){ println!("print_ont: x is {}", x); } fn add_one<'a>(x: &'a mut i32){ ...
code_fim
hard
{ "lang": "rust", "repo": "imoegirl/rust-by-example", "path": "/src/p051_lifetime.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn run(){ println!("p051_lifetime >>>>>>>>"); let (four, nine) = (4, 9); print_ref(&four, &nine); faild_borrow(); //-------------------------- let x = 7; let y = 9; print_one(&x); print_multi(&x, &y); let z = pass_x(&x, &y); print_one(z); let mut t = 3...
code_fim
hard
{ "lang": "rust", "repo": "imoegirl/rust-by-example", "path": "/src/p051_lifetime.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn annotated_pass<'a>(x: &'a i32) -> &'a i32 { x } pub fn run(){ println!("p051_lifetime >>>>>>>>"); let (four, nine) = (4, 9); print_ref(&four, &nine); faild_borrow(); //-------------------------- let x = 7; let y = 9; print_one(&x); print_multi(&x, &y); let z = ...
code_fim
hard
{ "lang": "rust", "repo": "imoegirl/rust-by-example", "path": "/src/p051_lifetime.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[inline(always)] pub fn gpio(&self) -> GPIO_R { GPIO_R::new((self.bits & 0xff) as u8) } #[doc = "Bit 8 - GPIO uDMA Done Interrupt Raw Status"] #[inline(always)] pub fn dmaris(&self) -> DMARIS_R { DMARIS_R::new(((self.bits >> 8) & 0x01) != 0) } }<|fim_prefix|>// re...
code_fim
medium
{ "lang": "rust", "repo": "m-labs/dslite2svd", "path": "/crates/tm4c129x/src/gpio_porta_ahb/ris.rs", "mode": "spm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: m-labs/dslite2svd path: /crates/tm4c129x/src/gpio_porta_ahb/ris.rs #[doc = "Reader of register RIS"] pub type R = crate::R<u32, super::RIS>; #[doc = "Reader of field `GPIO`"] pub type GPIO_R = crate::R<u8, u8>;<|fim_suffix|> #[inline(always)] pub fn gpio(&self) -> GPIO_R { GPIO_R::ne...
code_fim
medium
{ "lang": "rust", "repo": "m-labs/dslite2svd", "path": "/crates/tm4c129x/src/gpio_porta_ahb/ris.rs", "mode": "psm", "license": "0BSD", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ttys3/bunyan path: /tests/all/levels.rs use crate::helpers::command; use predicates::prelude::*; #[test] fn invalid_levels() { for invalid_level in &[ "not-a-real-level", "'-1-", // Only positive values are allowed "256", // Out of bounds for u8 ] { let ...
code_fim
medium
{ "lang": "rust", "repo": "ttys3/bunyan", "path": "/tests/all/levels.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> cmd.arg("-l").arg(valid_level); cmd.assert().success(); } }<|fim_prefix|>// repo: ttys3/bunyan path: /tests/all/levels.rs use crate::helpers::command; use predicates::prelude::*; #[test] fn invalid_levels() { for invalid_level in &[ "not-a-real-level", "'-1-", // ...
code_fim
hard
{ "lang": "rust", "repo": "ttys3/bunyan", "path": "/tests/all/levels.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let copy_arg = CppFunctionArgument { argument_type: CppType::new_reference(true, CppType::Class(class_path.clone())), name: "other".to_string(), has_default_value: false, }; let copy_constructor = CppFunction { ...
code_fim
hard
{ "lang": "rust", "repo": "csnover/ritual", "path": "/ritual/src/cpp_implicit_methods.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: csnover/ritual path: /ritual/src/cpp_implicit_methods.rs use crate::cpp_data::{CppItem, CppPathItem, CppVisibility}; use crate::cpp_function::{ CppFunction, CppFunctionArgument, CppFunctionKind, CppFunctionMemberData, }; use crate::cpp_operator::CppOperator; use crate::cpp_type::CppType; use...
code_fim
hard
{ "lang": "rust", "repo": "csnover/ritual", "path": "/ritual/src/cpp_implicit_methods.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let assignment_operator = CppFunction { path: type1 .item .path .join(CppPathItem::from_good_str("operator=")), member: Some(CppFunctionMemberData { is_virtual: false, ...
code_fim
hard
{ "lang": "rust", "repo": "csnover/ritual", "path": "/ritual/src/cpp_implicit_methods.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>28 => value!(i, Attribute::VsaAlvarionVsa128(i)), 129 => value!(i, Attribute::VsaAlvarionVsa129(i)), 130 => value!(i, Attribute::VsaAlvarionVsa130(i)), 131 => value!(i, Attribute::VsaAlvarionVsa131(i)), 132 => value!(i, Attribute::VsaAlvarionVsa132(i)), 133 => value!(i, Attribute::VsaAlvari...
code_fim
hard
{ "lang": "rust", "repo": "caputomarcos/radius-rs", "path": "/src/vendors/alvarion.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: caputomarcos/radius-rs path: /src/vendors/alvarion.rs /// Definitions for vendor Alvarion, vendor value 12394 use nom::IResult; #[allow(unused_imports)] use nom::number::streaming::{be_u64, be_u32, be_u16, be_u8}; #[allow(unused_imports)] use std::net::{Ipv4Addr, Ipv6Addr}; use crate::radi...
code_fim
hard
{ "lang": "rust", "repo": "caputomarcos/radius-rs", "path": "/src/vendors/alvarion.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dbist/cockroach-docker path: /pgcat/src/query_router.rs ic.data.id (len == 3) } _ => (), }; match op { BinaryOperator::Eq => (), BinaryOperator::Or => (), BinaryOperator::And => (), ...
code_fim
hard
{ "lang": "rust", "repo": "dbist/cockroach-docker", "path": "/pgcat/src/query_router.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dbist/cockroach-docker path: /pgcat/src/query_router.rs f.primary_reads_enabled { None => self.pool_settings.primary_reads_enabled, Some(value) => value, } } } #[cfg(test)] mod test { use super::*; use crate::config::PoolMode; use crate::messages:...
code_fim
hard
{ "lang": "rust", "repo": "dbist/cockroach-docker", "path": "/pgcat/src/query_router.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Expr::CompoundIdentifier(idents) => { // The key is fully qualified in the query, // it will exist or Postgres will throw an error. if idents.len() == 2 { found = &sharding_key[0].value == &idents[0].value ...
code_fim
hard
{ "lang": "rust", "repo": "dbist/cockroach-docker", "path": "/pgcat/src/query_router.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>to returning the relative path. pub fn display_absolute_path(path: &Path) -> PathBuf { std::env::current_dir().map(|d| { d.join(path) }).unwrap_or(path.to_path_buf()) }<|fim_prefix|>// repo: doytsujin/dimooper path: /src/path.rs use std; use std::path::{Path, PathBuf}; /// Converts Path ...
code_fim
medium
{ "lang": "rust", "repo": "doytsujin/dimooper", "path": "/src/path.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doytsujin/dimooper path: /src/path.rs use std; use std::path::{Path, PathBuf}; /// Converts Path into absolute PathBuf. Should be<|fim_suffix|>to returning the relative path. pub fn display_absolute_path(path: &Path) -> PathBuf { std::env::current_dir().map(|d| { d.join(path) })...
code_fim
medium
{ "lang": "rust", "repo": "doytsujin/dimooper", "path": "/src/path.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rowhit/scirust path: /srlinalg/src/singularity.rs #![doc="Methods for checking singularity or invertibility of matrices. "] // std imports // external imports // local imports use sralgebra::{CommutativeMonoidAddPartial, CommutativeMonoidMulPartial}; use srmatrix::api::*; /// Indicates if a...
code_fim
hard
{ "lang": "rust", "repo": "rowhit/scirust", "path": "/srlinalg/src/singularity.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert!(is_singular_triangular(&l)); assert!(is_singular_triangular(&u)); let mut d = m.diagonal_matrix(); assert!(!is_singular_diagonal(&d)); assert!(d.det().unwrap() != 0.); d.set(3, 3, 0.); assert!(is_singular_diagonal(&d)); assert_eq!(d....
code_fim
hard
{ "lang": "rust", "repo": "rowhit/scirust", "path": "/srlinalg/src/singularity.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut u = m.ut(); assert!(!is_singular_ut(&u)); assert!(u.det().unwrap() != 0.); u.set(4, 4, 0.); assert!(is_singular_ut(&u)); assert_eq!(u.det().unwrap(), 0.); assert!(is_singular_triangular(&l)); assert!(is_singular_triangular(&u)); ...
code_fim
hard
{ "lang": "rust", "repo": "rowhit/scirust", "path": "/srlinalg/src/singularity.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> println!(" drop {:?}", &self); unsafe { z3_sys::Z3_dec_ref(self.ctx.z3_ctx, self.z3_ast) } } }<|fim_prefix|>// repo: hrkzmnm/rust_z3prover path: /z3prover/src/ast.rs use super::{Context, Symbol, Sort, Ast}; #[macro_export] macro_rules! ast_assert { ($x:expr) =...
code_fim
hard
{ "lang": "rust", "repo": "hrkzmnm/rust_z3prover", "path": "/z3prover/src/ast.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hrkzmnm/rust_z3prover path: /z3prover/src/ast.rs use super::{Context, Symbol, Sort, Ast}; #[macro_export] macro_rules! ast_assert { ($x:expr) => { println!("{}", $x); } } <|fim_suffix|>impl <'ctx> Drop for Ast<'ctx> { fn drop(&mut self) { println!(" drop {:?}", &self); ...
code_fim
hard
{ "lang": "rust", "repo": "hrkzmnm/rust_z3prover", "path": "/z3prover/src/ast.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kekonen/playground path: /src/main.rs use std::cell::RefCell; use std::rc::Rc; #[derive(Debug, Eq, Ord, PartialEq, PartialOrd, Clone)] struct Reservation { name: String, min: i32, max: i32, weight: i32, } #[derive(Debug, Eq, Ord, PartialEq, PartialOrd, Clone)] struct Unit { ...
code_fim
hard
{ "lang": "rust", "repo": "kekonen/playground", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Rule 1 if self.further_overlapping_have_same() { continue } // Rule 2 if self.any_further_similar_xs_state_is_higher_than_current() { continue } self.cursor = 0; return fal...
code_fim
hard
{ "lang": "rust", "repo": "kekonen/playground", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: acottis/azphelos path: /src/efi.rs use crate::print; use core::sync::atomic::{AtomicPtr, Ordering}; static EFI_SYSTEM_TABLE: AtomicPtr<EfiSystemTable> = AtomicPtr::new(core::ptr::null_mut()); pub unsafe fn register_efi_system_table(system_table: *mut EfiSystemTable) { EFI_SYSTEM_TABLE.comp...
code_fim
hard
{ "lang": "rust", "repo": "acottis/azphelos", "path": "/src/efi.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] struct EfiSimpleTextOutputProtocol { reset: unsafe fn( this: *const EfiSimpleTextOutputProtocol, extended_verification: bool, ) -> EfiStatus, output_string: unsafe fn(this: *const EfiSimpleTextOutputProtocol, string: *const u16) -> EfiStatus, test_string:...
code_fim
hard
{ "lang": "rust", "repo": "acottis/azphelos", "path": "/src/efi.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match self { EfiMemoryType::BootServicesCode | EfiMemoryType::BootServicesData | EfiMemoryType::ConventionalMemory | EfiMemoryType::PersistentMemory => true, _ => false, } } } // This allows me to use Deafult wi...
code_fim
hard
{ "lang": "rust", "repo": "acottis/azphelos", "path": "/src/efi.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: likr/atcoder path: /arc014/src/bin/d.rs use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; #[allow(unused)] const INF: usize = std::u...
code_fim
medium
{ "lang": "rust", "repo": "likr/atcoder", "path": "/arc014/src/bin/d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { input! { all: isize, n: usize, m: usize, l: [isize; n], xy: [(isize, isize); m], } let mut xy = xy .into_iter() .enumerate() .collect::<Vec<(usize, (isize, isize))>>(); xy.sort_by_key(|(_, (x, y))| x + y); for...
code_fim
medium
{ "lang": "rust", "repo": "likr/atcoder", "path": "/arc014/src/bin/d.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> input! { all: isize, n: usize, m: usize, l: [isize; n], xy: [(isize, isize); m], } let mut xy = xy .into_iter() .enumerate() .collect::<Vec<(usize, (isize, isize))>>(); xy.sort_by_key(|(_, (x, y))| x + y); for &(_, (x, y)...
code_fim
medium
{ "lang": "rust", "repo": "likr/atcoder", "path": "/arc014/src/bin/d.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IntrepidPig/potatowm path: /src/wm/view.rs use px::conn::Connection; use px::event::ConfReq; use px::win::Window; use wm::node::Node; pub struct View { pub mode: ViewMode, pub nodes: Vec<Node>, pub x: i16, pub y: i16, pub width: u16, pub height: u16, pub padding: u16, } pub enum ViewMo...
code_fim
medium
{ "lang": "rust", "repo": "IntrepidPig/potatowm", "path": "/src/wm/view.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub enum ViewMode { Floating, Tiling, Tabbed, Fullscreen, } impl View { pub fn add(&mut self, conn: &Connection, win: Window) { self.nodes.push(Node::Window(win)); } pub fn layout(&self, conn: &Connection) { match &self.mode { Foating => { for (i, node) in self.nodes.iter().enumer...
code_fim
medium
{ "lang": "rust", "repo": "IntrepidPig/potatowm", "path": "/src/wm/view.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }