text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: NyxCode/Ketamine path: /interpreter/src/interpreter/mod.rs use crate::scope::ScopeStack; use crate::values::Object; use crate::values::{Dictionary, HasPrototype, NativeFunction, Value}; use crate::{Evaluate, HasTypeName, ObjectConversion}; use parser::ast::Statement; use parser::{Parse, Pos}; m...
code_fim
hard
{ "lang": "rust", "repo": "NyxCode/Ketamine", "path": "/interpreter/src/interpreter/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Payload(vec)) } } impl TryFrom<Payload> for Bytes { type Error = Error; /// Encodes a payload. Payload in the `engine.io` context means a chain of /// normal `packets` separated by a SEPARATOR, in this case the delimiter /// `\x30`. fn try_from(packets: Payload) -> Resu...
code_fim
hard
{ "lang": "rust", "repo": "kappa/rust-socketio", "path": "/engineio/src/packet.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kappa/rust-socketio path: /engineio/src/packet.rs extern crate base64; use base64::{decode, encode}; use bytes::{BufMut, Bytes, BytesMut}; use serde::{Deserialize, Serialize}; use std::char; use std::convert::TryFrom; use std::convert::TryInto; use std::ops::Index; use crate::error::{Error, Res...
code_fim
hard
{ "lang": "rust", "repo": "kappa/rust-socketio", "path": "/engineio/src/packet.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let sut = PacketId::try_from(b'0'); assert!(sut.is_ok()); assert_eq!(sut.unwrap(), PacketId::Open); let sut = PacketId::try_from(b'1'); assert!(sut.is_ok()); assert_eq!(sut.unwrap(), PacketId::Close); let sut = PacketId::try_from(b'2'); ass...
code_fim
hard
{ "lang": "rust", "repo": "kappa/rust-socketio", "path": "/engineio/src/packet.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaj/rsass path: /rsass/tests/spec/libsass_closed_issues/issue_1415/variable.rs //! Tests auto-converted from "sass-spec/spec/libsass-closed-issues/issue_1415/variable.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { super::runner().with_cwd("variable") } <|fim_suffix|> assert_eq...
code_fim
easy
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/libsass_closed_issues/issue_1415/variable.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( runner().ok("$parent: &;\n\ \n@if $parent {\ \n foo {\ \n foo: bar;\ \n }\ \n}\n"), "" ); }<|fim_prefix|>// repo: kaj/rsass path: /rsass/tests/spec/libsass_closed_issues/issue_1415/variable.rs //! Te...
code_fim
easy
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/libsass_closed_issues/issue_1415/variable.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KieronJ/rpsx path: /src/psx/cpu/dmac.rs to(port: usize) -> DmacPort { use self::DmacPort::*; match port { 0 => MDECIn, 1 => MDECOut, 2 => GPU, 3 => CDROM, 4 => SPU, 5 => PIO, 6 => OTC, ...
code_fim
hard
{ "lang": "rust", "repo": "KieronJ/rpsx", "path": "/src/psx/cpu/dmac.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KieronJ/rpsx path: /src/psx/cpu/dmac.rs OTC, 7 => Control, _ => panic!("[ERROR] [DMAC] Invalid port {}", port), } } pub fn from(port: DmacPort) -> usize { use self::DmacPort::*; match port { MDECIn => 0, MDECOut =>...
code_fim
hard
{ "lang": "rust", "repo": "KieronJ/rpsx", "path": "/src/psx/cpu/dmac.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bus.gpu_mut().gp0_write(data); self.active_address = match step { Step::Forward => self.active_address.wrapping_add(4), Step::Backward => self.active_address.wrapping_sub(4), } ...
code_fim
hard
{ "lang": "rust", "repo": "KieronJ/rpsx", "path": "/src/psx/cpu/dmac.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(config) } #[allow(dead_code)] pub fn init_or_die() -> Self { match Self::init() { Ok(config) => config, Err(err) => { eprintln!("{}", err); ::std:...
code_fim
hard
{ "lang": "rust", "repo": "greyblake/envconfig-rs-old", "path": "/src/envconfig_macro.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: greyblake/envconfig-rs-old path: /src/envconfig_macro.rs #[macro_export] macro_rules! envconfig { ($type:ident {$($field_name:ident : $field_type:ty = $var_name:expr), *}) => { #[derive(Debug)] pub struct $type { $( pub $field_name: $field_type, ...
code_fim
hard
{ "lang": "rust", "repo": "greyblake/envconfig-rs-old", "path": "/src/envconfig_macro.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(dead_code)] pub fn init_or_die() -> Self { match Self::init() { Ok(config) => config, Err(err) => { eprintln!("{}", err); ::std::process::exit(1); } ...
code_fim
hard
{ "lang": "rust", "repo": "greyblake/envconfig-rs-old", "path": "/src/envconfig_macro.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: patrickbiel01/libra path: /ol/zero_knowledge/move_zk_native_function_linker/src/cairo_sharp.rs use std::process::Command; use std::process::Output; use std::fs; pub fn send_program(name_input: &String, val_input: u128) -> Output { const CAIRO_INPUT_PATH: &str = "cairo-prove-input.json"; // ...
code_fim
hard
{ "lang": "rust", "repo": "patrickbiel01/libra", "path": "/ol/zero_knowledge/move_zk_native_function_linker/src/cairo_sharp.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if job_key.len() == 0 || fact.len() == 0 { let mut err = String::from(""); for i in 0..output.stderr.len() { if output.stderr[i] as char == '\n' { break; } err.push(output.stderr[i] as char); } println!("Error Message: {}", err); //The value < x, it did not pass the Cairo assert ...
code_fim
hard
{ "lang": "rust", "repo": "patrickbiel01/libra", "path": "/ol/zero_knowledge/move_zk_native_function_linker/src/cairo_sharp.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kitech/qt.rs path: /src/widgets/qmenubar.rs r::super::core::qpoint::*; // 771 use super::super::core::qobjectdefs::*; // 771 use super::super::gui::qicon::*; // 771 use super::super::core::qrect::*; // 771 use super::super::core::qobject::*; // 771 // <= use block end // ext block begin => // #...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/widgets/qmenubar.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kitech/qt.rs path: /src/widgets/qmenubar.rs QMenuBar { pub fn platformMenuBar<RetType, T: QMenuBar_platformMenuBar<RetType>>(& self, overload_args: T) -> RetType { return overload_args.platformMenuBar(self); // return 1; } } pub trait QMenuBar_platformMenuBar<RetType> { fn platfo...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/widgets/qmenubar.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // proto: QAction * QMenuBar::activeAction(); impl /*struct*/ QMenuBar { pub fn activeAction<RetType, T: QMenuBar_activeAction<RetType>>(& self, overload_args: T) -> RetType { return overload_args.activeAction(self); // return 1; } } pub trait QMenuBar_activeAction<RetType> { fn activeA...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/widgets/qmenubar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: transparencies/cqlite path: /src/planner/build.rs { let next_name = self.next_name(); self.names.insert(name, NamedEntity::Node(next_name)); Ok(next_name) } } } fn create_edge(&mut self, name: &'src str) -> Result<usiz...
code_fim
hard
{ "lang": "rust", "repo": "transparencies/cqlite", "path": "/src/planner/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (edge, node) in &clause.edges { let edge_name = if let Some(name) = edge.annotation.name { if let Some(name) = self.get_edge(name)? { match edge.direction { ast::Direction::Left => steps.push(MatchStep::Filter(Filter::IsTa...
code_fim
hard
{ "lang": "rust", "repo": "transparencies/cqlite", "path": "/src/planner/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn build_create_update( &mut self, clause: &'src ast::CreateClause<'src>, ) -> Result<UpdateStep<'src>, Error> { match clause { ast::CreateClause::CreateNode { name, label, properties, } => Ok(UpdateSte...
code_fim
hard
{ "lang": "rust", "repo": "transparencies/cqlite", "path": "/src/planner/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let number_of_entries = r.read_u32::<BigEndian>()?; let mut sample_description_table = Vec::new(); for _ in 0..number_of_entries { let sample_description_size = r.read_u32::<BigEndian>()?; let data_format = r.read_u32::<BigEndian>()?; let mut reserved = [0_u8; 6]; ...
code_fim
hard
{ "lang": "rust", "repo": "rarewin/atom-analyzer", "path": "/src/atom/stsd.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rarewin/atom-analyzer path: /src/atom/stsd.rs use std::fmt::Debug; use std::io::{Read, Seek, SeekFrom}; use byteorder::{BigEndian, ReadBytesExt}; use crate::atom::{Atom, AtomHead, AtomParseError}; use atom_derive::atom; pub const ATOM_ID: u32 = 0x7374_7364; // 'stsd' #[derive(Debug, PartialE...
code_fim
hard
{ "lang": "rust", "repo": "rarewin/atom-analyzer", "path": "/src/atom/stsd.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'i, 'w, D: typos::Dictionary> typos::Dictionary for Override<'i, 'w, D> { fn correct_ident<'s>(&'s self, ident: typos::tokens::Identifier<'_>) -> Option<Status<'s>> { for ignored in &self.ignored_identifiers { if ignored.is_match(ident.token()) { return Some(St...
code_fim
hard
{ "lang": "rust", "repo": "crate-ci/typos", "path": "/crates/typos-cli/src/dict.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: crate-ci/typos path: /crates/typos-cli/src/dict.rs use std::borrow::Cow; use std::collections::HashMap; use unicase::UniCase; use typos::tokens::Case; use typos::Status; #[derive(Default)] pub struct BuiltIn { locale: Option<varcon_core::Category>, } impl BuiltIn { pub const fn new(l...
code_fim
hard
{ "lang": "rust", "repo": "crate-ci/typos", "path": "/crates/typos-cli/src/dict.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl typos::Dictionary for BuiltIn { fn correct_ident<'s>(&'s self, ident: typos::tokens::Identifier<'_>) -> Option<Status<'s>> { BuiltIn::correct_ident(self, ident) } fn correct_word<'s>(&'s self, word: typos::tokens::Word<'_>) -> Option<Status<'s>> { BuiltIn::correct_word(se...
code_fim
hard
{ "lang": "rust", "repo": "crate-ci/typos", "path": "/crates/typos-cli/src/dict.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>sername: String, pub phone: i64, pub wallet: i32, pub game_id: String, pub verification: i8, }<|fim_prefix|>// repo: harshitchaudhary/events path: /src/data/user.rs #[derive(Queryable)] pub struct User { pub id: i64<|fim_middle|>, pub uuid: String, pub name: String, pub u
code_fim
easy
{ "lang": "rust", "repo": "harshitchaudhary/events", "path": "/src/data/user.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>2, pub game_id: String, pub verification: i8, }<|fim_prefix|>// repo: harshitchaudhary/events path: /src/data/user.rs #[derive(Queryable)] pub struct User { pub id: i64<|fim_middle|>, pub uuid: String, pub name: String, pub username: String, pub phone: i64, pub wallet: i3
code_fim
medium
{ "lang": "rust", "repo": "harshitchaudhary/events", "path": "/src/data/user.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: harshitchaudhary/events path: /src/data/user.rs #[derive(Queryable)] pub struct User { pub id: i64<|fim_suffix|>sername: String, pub phone: i64, pub wallet: i32, pub game_id: String, pub verification: i8, }<|fim_middle|>, pub uuid: String, pub name: String, pub u
code_fim
easy
{ "lang": "rust", "repo": "harshitchaudhary/events", "path": "/src/data/user.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> '&' => Ok(TokenType::Borrow), '=' => Ok(TokenType::Equals), '!' => Ok(TokenType::Not), '+' => Ok(TokenType::Plus), '-' => Ok(TokenType::Minus), '/' => Ok(TokenType::ForwardSlash), '*' => Ok(TokenType::Star), '%' => Ok(TokenType::Modilus), ...
code_fim
hard
{ "lang": "rust", "repo": "Blinningjr/rubigo-lang", "path": "/src/lexer/reserved.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Blinningjr/rubigo-lang path: /src/lexer/reserved.rs use super::TokenType; /** * Checks if ident equals to one of the reserved ident:s. * Returns a reserved token type or the ident token type. */ pub fn check_reserved_idents(ident: &str) -> TokenType { match ident { "fn" => Token...
code_fim
hard
{ "lang": "rust", "repo": "Blinningjr/rubigo-lang", "path": "/src/lexer/reserved.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>try_from ( 123 ) } # [ test ] fn test_ret_and_ok ( ) { let span = span : : mock ( ) . named ( " ret_and_ok " ) ; let ( subscriber handle ) = subscriber : : mock ( ) . new_span ( span . clone ( ) ) . enter ( span . clone ( ) ) . event ( event : : mock ( ) . with_fields ( field : : mock ( " return " ) . wit...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/tracing-attributes/tests/ret.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/tracing-attributes/tests/ret.rs use std : : convert : : TryFrom ; use std : : num : : TryFromIntError ; use tracing_mock : : * ; use tracing : : { subscriber : : with_default Level } ; use tracing_attributes : : instrument ; use tracing_subscri...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/tracing-attributes/tests/ret.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Determinant/lcd1602 path: /examples/hello.rs //! Prints "Hello, world!" on the host console using semihosting #![no_main] #![no_std] extern crate panic_halt; extern crate stm32f1; #[macro_export] extern crate lcd1602; use stm32f1::stm32f103::{Interrupt, Peripherals, CorePeripherals, gpioa}; us...
code_fim
medium
{ "lang": "rust", "repo": "Determinant/lcd1602", "path": "/examples/hello.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[entry] fn main() -> ! { let p = Peripherals::take().unwrap(); let lcd = driver::LCD1602::new(&p); lcd.init(driver::LCD16X2_DISPLAY_ON_CURSOR_OFF_BLINK_OFF); lcd.set_backlight(true); lcd.puts("Hello, world!"); //hprintln!("Hello world!").unwrap(); let custom_char: [u8; 8] = [0...
code_fim
medium
{ "lang": "rust", "repo": "Determinant/lcd1602", "path": "/examples/hello.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: psoc-rs/psoc6-pac path: /src/usbfs0/usbdev/dma_thres_msb.rs #[doc = "Register `DMA_THRES_MSB` reader"] pub struct R(crate::R<DMA_THRES_MSB_SPEC>); impl core::ops::Deref for R { type Target = crate::R<DMA_THRES_MSB_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { ...
code_fim
hard
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/usbfs0/usbdev/dma_thres_msb.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> W(writer) } } #[doc = "Field `DMA_THS_MSB` reader - DMA Threshold count"] pub type DMA_THS_MSB_R = crate::BitReader<bool>; #[doc = "Field `DMA_THS_MSB` writer - DMA Threshold count"] pub type DMA_THS_MSB_W<'a, const O: u8> = crate::BitWriter<'a, u32, DMA_THRES_MSB_SPEC, bool, O>; impl R...
code_fim
medium
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/usbfs0/usbdev/dma_thres_msb.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> date: opt!(complete!(parse_date)) >> char!(',') >> magnetic_variation: opt!(map_res!(take_until!(","), parse_num::<f32>)) >> char!(',') >> magnetic_direction: opt!(one_of!("EW")) >> char!('*') >> (time, status, position, speed,...
code_fim
hard
{ "lang": "rust", "repo": "hargoniX/yanp", "path": "/src/parsers/rmc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>_utc_stamp)) >> char!(',') >> status: opt!(one_of!("AVP")) >> char!(',') >> position: complete!(parse_gps_position) >> char!(',') >> speed: opt!(map_res!(take_until!(","), parse_num::<f32>)) >> char!(',') >> he...
code_fim
hard
{ "lang": "rust", "repo": "hargoniX/yanp", "path": "/src/parsers/rmc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hargoniX/yanp path: /src/parsers/rmc.rs use super::utils::*; use crate::errors::NmeaSentenceError; use crate::parse::*; fn build_rmc<'a>( sentence: ( Option<GpsTime>, Option<char>, GpsPosition, Option<f32>, Option<f32>, Option<GpsDate>, ...
code_fim
hard
{ "lang": "rust", "repo": "hargoniX/yanp", "path": "/src/parsers/rmc.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let pos = ChunkPosition::new(0, 0); let mut chunk = Chunk::new(pos); let block = Block::Stone; for x in 0..16 { for y in 0..256 { for z in 0..16 { chunk.set_block_at(x, y, z, block); assert_eq!(chunk.bloc...
code_fim
hard
{ "lang": "rust", "repo": "Koalab99/feather", "path": "/core/src/world/chunk.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Koalab99/feather path: /core/src/world/chunk.rs tte if not using the global palette if let Some(palette) = palette.as_mut() { Self::correct_data_and_palette(&mut data, palette); } // Count solid blocks let mut solid_block_count = 0; for x in 0...
code_fim
hard
{ "lang": "rust", "repo": "Koalab99/feather", "path": "/core/src/world/chunk.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Koalab99/feather path: /core/src/world/chunk.rs e number of bits used for each block /// in the global palette. const GLOBAL_BITS_PER_BLOCK: u8 = 14; /// The minimum bits per block allowed when /// using a section palette. /// Bits per block values lower than this /// value will be offsetted to...
code_fim
hard
{ "lang": "rust", "repo": "Koalab99/feather", "path": "/core/src/world/chunk.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: swissvoc/rust-follow-along path: /ch08_collections/src/vector.rs pub fn demo_all() { demo_init(); demo_multitype_vector(); } fn demo_init() { let v_generic_new: Vec<i32> = Vec::new(); let v_turbo_fish = Vec::<i32>::new(); let v_macro = vec![1, 2, 3]; println!( ...
code_fim
hard
{ "lang": "rust", "repo": "swissvoc/rust-follow-along", "path": "/ch08_collections/src/vector.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for cell in &row { match cell { Int(v) => println!("Int Cell: {}", v), Text(v) => println!("Text Cell: {}", v), Float(v) => println!("Float Cell: {}", v), } } }<|fim_prefix|>// repo: swissvoc/rust-follow-along path: /ch08_collections/src/...
code_fim
medium
{ "lang": "rust", "repo": "swissvoc/rust-follow-along", "path": "/ch08_collections/src/vector.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn withdrawal(&mut self, transaction: Transaction) { let client_account = self.db_adapter.get_account(transaction.client); match client_account { None => {} Some(mut client_account) => { if !client_account.locked && client_account.available >= tr...
code_fim
hard
{ "lang": "rust", "repo": "petrusbatalha/rust-toy-finance", "path": "/src/transaction_service.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: petrusbatalha/rust-toy-finance path: /src/transaction_service.rs use crate::traits::{AccountDB, TransactionDB, TransactionHandler}; use crate::types::{Action, ClientAccount, Transaction, TransactionType}; use std::option::Option::Some; use tokio::sync::mpsc::{Receiver, Sender}; pub struct Trans...
code_fim
hard
{ "lang": "rust", "repo": "petrusbatalha/rust-toy-finance", "path": "/src/transaction_service.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let client_account = self.db_adapter.get_account(transaction.client); match client_account { None => { self.db_adapter.add_account( transaction.client, ClientAccount { client: transaction.client, ...
code_fim
hard
{ "lang": "rust", "repo": "petrusbatalha/rust-toy-finance", "path": "/src/transaction_service.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> writelnf!( "{:d}", if com == 0 { it.min().unwrap() } else if com == 1 { it.max().unwrap() } else { panic!(); } ) } }<|fim_prefix|>// repo: sherry255/porus path: /solutions/judge...
code_fim
medium
{ "lang": "rust", "repo": "sherry255/porus", "path": "/solutions/judge.u-aizu.ac.jp/ITP2/ITP2_3_B.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sherry255/porus path: /solutions/judge.u-aizu.ac.jp/ITP2/ITP2_3_B.rs #[macro_use] extern crate porus; prelude!(); fn main() { let n: usize = read!(); let a: &Vec<isize> = &(0..n).map(|_| read!()).collect(); let q: usize = read!(); <|fim_suffix|> writelnf!( "{:d}"...
code_fim
medium
{ "lang": "rust", "repo": "sherry255/porus", "path": "/solutions/judge.u-aizu.ac.jp/ITP2/ITP2_3_B.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut new_list = Self::new(); for room in self.get_list().iter() { new_list.add(room); } return new_list.rooms; } pub fn get_index_of_room(&self, id: &u32) -> usize { let index = self.get_list().iter().position(|ref i| i.get_id() ==...
code_fim
hard
{ "lang": "rust", "repo": "misterindie/rusty-adventure", "path": "/src/roomlist.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: misterindie/rusty-adventure path: /src/roomlist.rs use room::Room; pub struct RoomList { rooms: Vec<Room> } impl RoomList { pub fn new() -> RoomList { RoomList{rooms: vec![]} } pub fn add(&mut self, room: &Room) { self.rooms.push(Room::from(room)); ...
code_fim
hard
{ "lang": "rust", "repo": "misterindie/rusty-adventure", "path": "/src/roomlist.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for room in self.get_list().iter() { new_list.add(room); } return new_list.rooms; } pub fn get_index_of_room(&self, id: &u32) -> usize { let index = self.get_list().iter().position(|ref i| i.get_id() == id).unwrap(); return index; ...
code_fim
hard
{ "lang": "rust", "repo": "misterindie/rusty-adventure", "path": "/src/roomlist.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mariiillo/btree path: /src/binary_tree/node.rs #[derive(Debug, Default)] pub struct Node { pub value: i32, pub left: Option<Box<Node>>, pub right: Option<Box<Node>>, } <|fim_suffix|> pub fn read(&mut self) { match self.left { Some(ref mut left) => { ...
code_fim
hard
{ "lang": "rust", "repo": "mariiillo/btree", "path": "/src/binary_tree/node.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn read(&mut self) { match self.left { Some(ref mut left) => { left.read(); } None => {} } print!("{} ", self.value); match self.right { Some(ref mut right) => { right.read(); ...
code_fim
hard
{ "lang": "rust", "repo": "mariiillo/btree", "path": "/src/binary_tree/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prataprc/rplay path: /sudoku/src/tests.rs #![cfg(test)] use rand::{XorShiftRng,SeedableRng,Rng}; use std::time::{UNIX_EPOCH}; <|fim_suffix|> let seed = UNIX_EPOCH.elapsed().unwrap().subsec_nanos(); let mut r = XorShiftRng::from_seed([seed, seed+1, seed+2, seed+3]); let mut distribut...
code_fim
medium
{ "lang": "rust", "repo": "prataprc/rplay", "path": "/sudoku/src/tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let seed = UNIX_EPOCH.elapsed().unwrap().subsec_nanos(); let mut r = XorShiftRng::from_seed([seed, seed+1, seed+2, seed+3]); let mut distribution = [0; 256]; for (i, n) in r.gen_iter::<u8>().enumerate() { distribution[(n as usize)] += 1; if i > 256 { break } } let z...
code_fim
medium
{ "lang": "rust", "repo": "prataprc/rplay", "path": "/sudoku/src/tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let event = Event::new( "test", "test desc", "test", Local::now() .checked_sub_signed(Duration::minutes(3)) .unwrap(), None, ); let event1 = Event::new( "test", "test...
code_fim
hard
{ "lang": "rust", "repo": "akane10/ingetin", "path": "/src/event.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akane10/ingetin path: /src/event.rs use crate::HasId; use chrono::{DateTime, Duration, Local, TimeZone}; use serde::{Deserialize, Serialize}; use uuid::Uuid; pub type Events = Vec<Event>; #[derive(Debug, Clone, Serialize, Deserialize)] pub struct Event { pub id: Uuid, pub title: String...
code_fim
hard
{ "lang": "rust", "repo": "akane10/ingetin", "path": "/src/event.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut b = BytesMut::new(); "testing".pack(&mut b); assert_eq!( &*b, &[0, 0, 0, 7, b't', b'e', b's', b't', b'i', b'n', b'g'][..] ); let r = String::unpack(&mut b.freeze()).unwrap(); assert_eq!(r, "testing"); } #[test] f...
code_fim
hard
{ "lang": "rust", "repo": "yskszk63/ssssh", "path": "/src/pack.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yskszk63/ssssh path: /src/pack.rs use std::iter::FromIterator; use std::string::FromUtf8Error; use bytes::buf::Buf; use bytes::{Bytes, BytesMut}; use thiserror::Error; #[derive(Debug, Error, PartialEq, Eq)] pub enum UnpackError { #[error("unexpected eof")] UnexpectedEof, #[error(t...
code_fim
hard
{ "lang": "rust", "repo": "yskszk63/ssssh", "path": "/src/pack.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let r = NameList::unpack(&mut b.freeze()).unwrap(); assert_eq!(r, NameList(vec!["a".into()])); let mut b = BytesMut::new(); vec!["a", "b"] .into_iter() .collect::<NameList>() .pack(&mut b); assert_eq!(&*b, &[0, 0, 0, 3, b'a', b',...
code_fim
hard
{ "lang": "rust", "repo": "yskszk63/ssssh", "path": "/src/pack.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hfcredidio/aoc_2020 path: /src/day6.rs use std::collections::HashSet; use std::fs::File; use std::io::Read; use std::path::Path; fn unique_chars(s: &str) -> HashSet<char> { s.chars().filter(|c| *c != '\n').collect() } fn unique_intersection(s: &str) -> HashSet<char> { <|fim_suffix|> let...
code_fim
hard
{ "lang": "rust", "repo": "hfcredidio/aoc_2020", "path": "/src/day6.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn unique_intersection(s: &str) -> HashSet<char> { s.lines() .map(unique_chars) .fold_first(|acc, x| acc.intersection(&x).copied().collect()) .unwrap() } pub fn day6(path: &Path) { let mut data = Vec::new(); let mut file = File::open(path).unwrap(); file.read_to_en...
code_fim
medium
{ "lang": "rust", "repo": "hfcredidio/aoc_2020", "path": "/src/day6.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rwcrosby/cofc_csis616_f20 path: /Ch2Part2/results/src/lib.rs //! CSIS-616 - Results //! //! Ralph W. Crosby PhD. //! //! //! # Usage //! //! ```shell //! cargo test //! ``` //! #[allow(dead_code)] /// Return a result based on the input parameter /// either Ok or Err /// /// The ...
code_fim
medium
{ "lang": "rust", "repo": "rwcrosby/cofc_csis616_f20", "path": "/Ch2Part2/results/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Get an Ok return code from the test function assert!(match return_result(true) { Ok(msg) => { println!("Ok: {}", msg); true } Err(_) => false }); } #[te...
code_fim
medium
{ "lang": "rust", "repo": "rwcrosby/cofc_csis616_f20", "path": "/Ch2Part2/results/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let output = include_bytes!("data/one_million_a.output.bin"); crypto_tests::hash::one_million_a::<pruefung::sysv::SysV>(output); }<|fim_prefix|>// repo: fmckeogh/pruefung path: /tests/sysv/mod.rs extern crate pruefung; use crypto_tests; use crypto_tests::hash::Test; #[test] fn main() { let ...
code_fim
easy
{ "lang": "rust", "repo": "fmckeogh/pruefung", "path": "/tests/sysv/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let tests = new_tests!("1", "2", "3", "4", "5", "6"); crypto_tests::hash::main_test::<pruefung::sysv::SysV>(&tests); } #[test] fn one_million_a() { let output = include_bytes!("data/one_million_a.output.bin"); crypto_tests::hash::one_million_a::<pruefung::sysv::SysV>(output); }<|fim_prefi...
code_fim
easy
{ "lang": "rust", "repo": "fmckeogh/pruefung", "path": "/tests/sysv/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fmckeogh/pruefung path: /tests/sysv/mod.rs extern crate pruefung; use crypto_tests; use crypto_tests::hash::Test; #[test] fn main() { <|fim_suffix|>#[test] fn one_million_a() { let output = include_bytes!("data/one_million_a.output.bin"); crypto_tests::hash::one_million_a::<pruefung::s...
code_fim
medium
{ "lang": "rust", "repo": "fmckeogh/pruefung", "path": "/tests/sysv/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cargo-generate/cargo-generate path: /src/git/identity_path.rs use crate::git::utils::{canonicalize_path, home}; use std::fmt::{Display, Formatter}; use anyhow::{anyhow, bail, Result}; use std::path::{Path, PathBuf}; #[derive(Debug)] pub struct IdentityPath(PathBuf); impl TryFrom<PathBuf> for ...
code_fim
hard
{ "lang": "rust", "repo": "cargo-generate/cargo-generate", "path": "/src/git/identity_path.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn should_pretty_path() { let p = pretty_path(home().unwrap().as_path().join(".cargo").as_path()).unwrap(); #[cfg(not(windows))] assert_eq!(p, "$HOME/.cargo"); #[cfg(windows)] assert_eq!(p, "$home\\.cargo"); } }<|fim_prefix|>// repo: cargo-genera...
code_fim
medium
{ "lang": "rust", "repo": "cargo-generate/cargo-generate", "path": "/src/git/identity_path.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bobbin-rs/bobbin-sdk path: /lib/bobbin-hal/src/i2c.rs //! Traits for using the I2C protocol. //! //! TODO: Add Error results to trait /// Abstracts basic blocking I2C reads and writes of type `T` to a device at address `addr`. pub trait I2cTransfer<T> { /// A blocking write of `tx_data` to...
code_fim
medium
{ "lang": "rust", "repo": "bobbin-rs/bobbin-sdk", "path": "/lib/bobbin-hal/src/i2c.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.write(addr, &[reg, value]) } /// A blocking write of `reg` to `addr` followed by a blocking read of one byte from `addr`. fn read_reg(&self, addr: T, reg: u8) -> u8 { let mut buf = [0u8]; self.transfer(addr, &[reg], &mut buf); buf[0] } } /// Abstracts...
code_fim
hard
{ "lang": "rust", "repo": "bobbin-rs/bobbin-sdk", "path": "/lib/bobbin-hal/src/i2c.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jsalzbergedu/orbtk path: /src/traits/mod.rs pub use self::border::Border; pub use self::click::Click; pub use self::enter::Enter; pub use <|fim_suffix|>use self::text::Text; pub use self::container::Container; pub use self::container::Side; mod border; mod click; mod enter; mod event_filter; mo...
code_fim
medium
{ "lang": "rust", "repo": "jsalzbergedu/orbtk", "path": "/src/traits/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>use self::text::Text; pub use self::container::Container; pub use self::container::Side; mod border; mod click; mod enter; mod event_filter; mod place; mod resize; mod text; mod container;<|fim_prefix|>// repo: jsalzbergedu/orbtk path: /src/traits/mod.rs pub use self::border::Border; pub use self::click...
code_fim
medium
{ "lang": "rust", "repo": "jsalzbergedu/orbtk", "path": "/src/traits/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: beykansen/todo-rs path: /src/dto.rs use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] pub struct TodoResponse { pub id: String, pub name: String, pub done: bool, pub added_at: String, pub tags: Vec<String>, } #[derive(Serialize, Deserialize, Debu...
code_fim
medium
{ "lang": "rust", "repo": "beykansen/todo-rs", "path": "/src/dto.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] pub struct GetAllResponse { pub todos: Vec<TodoResponse>, }<|fim_prefix|>// repo: beykansen/todo-rs path: /src/dto.rs use serde::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, Debug)] pub struct TodoResponse { pub id: String, pub name: Str...
code_fim
hard
{ "lang": "rust", "repo": "beykansen/todo-rs", "path": "/src/dto.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> reg.insert("Exp", |_| Ok(Box::new(tfdops::math::Exp::default()))); reg.insert("Ln", |_| Ok(Box::new(tfdops::math::Ln::default()))); reg.insert("Sqrt", |_| Ok(Box::new(tfdops::math::Sqrt::default()))); reg.insert("Rsqrt", |_| Ok(Box::new(tfdops::math::Rsqrt::default()))); reg.insert("N...
code_fim
hard
{ "lang": "rust", "repo": "Garvys/tensorflow-deploy-rust", "path": "/tfdeploy-onnx/src/ops/math.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Garvys/tensorflow-deploy-rust path: /tfdeploy-onnx/src/ops/math.rs use tfdeploy::ops as tfdops; use ops::OpRegister; pub fn register_all_ops(reg: &mut OpRegister) { reg.insert("Add", |_| Ok(Box::new(tfdops::math::Add::default()))); reg.insert("Sub", |_| Ok(Box::new(tfdops::math::Sub::d...
code_fim
hard
{ "lang": "rust", "repo": "Garvys/tensorflow-deploy-rust", "path": "/tfdeploy-onnx/src/ops/math.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>opencv_type_boxed! { BarcodeDetector } impl Drop for BarcodeDetector { fn drop(&mut self) { extern "C" { fn cv_BarcodeDetector_delete(instance: *mut c_void); } unsafe { cv_BarcodeDetector_delete(self.as_raw_mut_BarcodeDetector()) }; } } unsafe impl Send for BarcodeDetector {} impl crate::barcode:...
code_fim
hard
{ "lang": "rust", "repo": "deeprnd/opencv-rust", "path": "/src/opencv/hub/barcode.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: deeprnd/opencv-rust path: /src/opencv/hub/barcode.rs #![allow( unused_parens, clippy::excessive_precision, clippy::missing_safety_doc, clippy::not_unsafe_ptr_arg_deref, clippy::should_implement_trait, clippy::too_many_arguments, clippy::unused_unit, )] //! # Barcode detecting and decoding...
code_fim
hard
{ "lang": "rust", "repo": "deeprnd/opencv-rust", "path": "/src/opencv/hub/barcode.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> } pub struct BarcodeDetector { ptr: *mut c_void } opencv_type_boxed! { BarcodeDetector } impl Drop for BarcodeDetector { fn drop(&mut self) { extern "C" { fn cv_BarcodeDetector_delete(instance: *mut c_void); } unsafe { cv_BarcodeDetector_delete(self.as_raw_mut_BarcodeDetector()) }; } } unsafe ...
code_fim
hard
{ "lang": "rust", "repo": "deeprnd/opencv-rust", "path": "/src/opencv/hub/barcode.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> let height: Vec<&str> = parts[3].split("x").collect(); let height = height[1].parse().unwrap(); Claim { id, x, y, width, height, } } fn part_one() { let f = File::open("input.txt").unwrap(); let f = BufReader::new(f); let mut board = ve...
code_fim
hard
{ "lang": "rust", "repo": "epequeno/advent_of_code", "path": "/2018/day03/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: epequeno/advent_of_code path: /2018/day03/src/main.rs use std::fs::File; use std::io::prelude::*; use std::io::BufReader; #[derive(Debug)] struct Claim { id: u64, x: u64, y: u64, width: u64, height: u64, } fn parse_line(line: &str) -> Claim { let parts: Vec<&str> = line...
code_fim
hard
{ "lang": "rust", "repo": "epequeno/advent_of_code", "path": "/2018/day03/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> 0x27 => Ok(Instruction::RlaZeroPage(next_byte(iter))), 0x37 => Ok(Instruction::RlaXZeroPage(next_byte(iter))), 0x23 => Ok(Instruction::RlaXIndexedIndirect(next_byte(iter))), 0x33 => Ok(Instruction::RlaYIndirectIndexed(next_byte(iter))), 0x2f => O...
code_fim
hard
{ "lang": "rust", "repo": "esam091/mad-nes", "path": "/src/instruction.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: esam091/mad-nes path: /src/instruction.rs struction::SloZeroPage(next_byte(iter))), 0x17 => Ok(Instruction::SloXZeroPage(next_byte(iter))), 0x03 => Ok(Instruction::SloXIndexedIndirect(next_byte(iter))), 0x13 => Ok(Instruction::SloYIndirectIndexed(next_byte(ite...
code_fim
hard
{ "lang": "rust", "repo": "esam091/mad-nes", "path": "/src/instruction.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> 0xc7 => Ok(Instruction::DcpZeroPage(next_byte(iter))), 0xd7 => Ok(Instruction::DcpXZeroPage(next_byte(iter))), 0xc3 => Ok(Instruction::DcpXIndexedIndirect(next_byte(iter))), 0xd3 => Ok(Instruction::DcpYIndirectIndexed(next_byte(iter))), 0xcf => O...
code_fim
hard
{ "lang": "rust", "repo": "esam091/mad-nes", "path": "/src/instruction.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ipfs-rust/libpacket path: /fuzz/fuzzers/udp.rs #![no_main] use libfuzzer_sys::fuzz_target; use libpacket::udp:<|fim_suffix|> if let Some(udp) = UdpPacket::new(data) { for b in udp.payload().iter() { drop(*b); } } });<|fim_middle|>:UdpPacket; use libpacket::Pa...
code_fim
medium
{ "lang": "rust", "repo": "ipfs-rust/libpacket", "path": "/fuzz/fuzzers/udp.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>udp.payload().iter() { drop(*b); } } });<|fim_prefix|>// repo: ipfs-rust/libpacket path: /fuzz/fuzzers/udp.rs #![no_main] use libfuzzer_sys::fuzz_target; use libpacket::udp::UdpPacket; use libpacket::Packet; fuzz_target!(|data: &[u8]| {<|fim_middle|> if let Some(udp) = UdpPa...
code_fim
medium
{ "lang": "rust", "repo": "ipfs-rust/libpacket", "path": "/fuzz/fuzzers/udp.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let s = Storage::migrate(PathBuf::from(db_file.path()), JournalMode::WAL) .unwrap() .create_pool(NonZeroU32::new(1).unwrap()) .unwrap(); let mut conn = s.connection().unwrap(); let tx = conn.transaction().unwrap(); let account_contract...
code_fim
hard
{ "lang": "rust", "repo": "eqlabs/pathfinder", "path": "/crates/rpc/src/cairo/ext_py.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: eqlabs/pathfinder path: /crates/rpc/src/cairo/ext_py.rs PathBuf; use tokio::sync::oneshot; #[test_log::test(tokio::test)] async fn call_like_in_python_ten_times() { use futures::stream::StreamExt; let db_file = tempfile::NamedTempFile::new().unwrap(); let s...
code_fim
hard
{ "lang": "rust", "repo": "eqlabs/pathfinder", "path": "/crates/rpc/src/cairo/ext_py.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let transactions = vec![valid_invoke_v1(account_address)]; const EXPECTED_GAS_CONSUMED: u64 = 4938; for (gas_price_u64, block, use_past_block) in [ (1, latest_block_number.into(), true), (10, latest_block_hash.into(), false), (123, BlockHashNum...
code_fim
hard
{ "lang": "rust", "repo": "eqlabs/pathfinder", "path": "/crates/rpc/src/cairo/ext_py.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>esent when the command is used in a guild. #[serde(skip_serializing_if = "Option::is_none")] pub member: Option<PartialMember>, /// Token of the interaction. pub token: String, /// User that triggered the interaction. /// /// Present when the command is used in a direct message...
code_fim
hard
{ "lang": "rust", "repo": "SuperiorJT/twilight", "path": "/model/src/application/interaction/application_command/mod.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SuperiorJT/twilight path: /model/src/application/interaction/application_command/mod.rs mod data; pub use self::data::{ CommandData, CommandDataOption, CommandInteractionDataResolved, InteractionChannel, InteractionMember, }; use super::InteractionType; use crate::{ guild::PartialM...
code_fim
hard
{ "lang": "rust", "repo": "SuperiorJT/twilight", "path": "/model/src/application/interaction/application_command/mod.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> ChannelId, /// Data from the invoked command. pub data: CommandData, /// ID of the guild the interaction was triggered from. pub guild_id: Option<GuildId>, /// ID of the interaction. pub id: InteractionId, /// Kind of the interaction. #[serde(rename = "type")] pub kind...
code_fim
hard
{ "lang": "rust", "repo": "SuperiorJT/twilight", "path": "/model/src/application/interaction/application_command/mod.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>} impl<W: Widget + Sized> Boxed<dyn Widget<Msg = W::Msg>> for W { fn boxed(self) -> Box<dyn Widget<Msg = W::Msg>> { Box::new(self) } }<|fim_prefix|>// repo: forkkit/kas path: /crates/kas-core/src/core/mod.rs // Licensed under the Apache License, Version 2.0 (the "License"); // you may no...
code_fim
medium
{ "lang": "rust", "repo": "forkkit/kas", "path": "/crates/kas-core/src/core/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl<W: Widget + Sized> Boxed<dyn Widget<Msg = W::Msg>> for W { fn boxed(self) -> Box<dyn Widget<Msg = W::Msg>> { Box::new(self) } }<|fim_prefix|>// repo: forkkit/kas path: /crates/kas-core/src/core/mod.rs // Licensed under the Apache License, Version 2.0 (the "License"); // you may not u...
code_fim
hard
{ "lang": "rust", "repo": "forkkit/kas", "path": "/crates/kas-core/src/core/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: forkkit/kas path: /crates/kas-core/src/core/mod.rs // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License in the LICENSE-APACHE file or at: // https://www.apache.org/licens...
code_fim
medium
{ "lang": "rust", "repo": "forkkit/kas", "path": "/crates/kas-core/src/core/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut key = $crate::folding_set::FoldKey::default(); $(key.add($field);)* key } } impl$(<$($life),*>)? Foldable for $s$(<$($life),*>)? { fn fold(&self, key: &mut $crate::folding_set::FoldKey) { $(self...
code_fim
hard
{ "lang": "rust", "repo": "Tyg13/tylang", "path": "/crates/utils/src/folding_set.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tyg13/tylang path: /crates/utils/src/folding_set.rs // Sketch: // - Folding keys are bytestrings of arbitrary length // => Select which bytes of data structure should be considered for folding // // i.e. FnTy(TyID, [TyID]) -> Fold(TyID) + Fold([TyID]) use smallvec::SmallVec; use std::collect...
code_fim
hard
{ "lang": "rust", "repo": "Tyg13/tylang", "path": "/crates/utils/src/folding_set.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xentrick/gssapi-rs path: /src/lib/gssapi/mechglue/g_mechname.rs include/gssapi/gssapi.h:9"] pub mod gssapi_h { /* * The following type must be defined as the smallest natural unsigned integer * supported by the platform that has at least 32 bits of precision. */ /* OM_STRING */ /*...
code_fim
hard
{ "lang": "rust", "repo": "xentrick/gssapi-rs", "path": "/src/lib/gssapi/mechglue/g_mechname.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }