text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: Isaac-Lozano/simpsynth path: /src/module/mod.rs pub mod sine; pub mod square; pub mod mult; pub mod add; pub mod envelope; pub mod sample; <|fim_suffix|>} impl Module for f32 { fn generate(&mut self, _step: f32) -> Option<f32> { Some(*self) } }<|fim_middle|>pub use module::...
code_fim
hard
{ "lang": "rust", "repo": "Isaac-Lozano/simpsynth", "path": "/src/module/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Module for f32 { fn generate(&mut self, _step: f32) -> Option<f32> { Some(*self) } }<|fim_prefix|>// repo: Isaac-Lozano/simpsynth path: /src/module/mod.rs pub mod sine; pub mod square; pub mod mult; pub mod add; pub mod envelope; pub mod sample; pub use module::sine::Sine; pub u...
code_fim
medium
{ "lang": "rust", "repo": "Isaac-Lozano/simpsynth", "path": "/src/module/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kevinastone/httpbox path: /src/service/method/mod.rs mod body; use self::body::body; use crate::http::{bad_request, ok, Request, Result}; use itertools::Itertools; pub async fn get(req: Request) -> Result { let body = { req.query::<Vec<(String, String)>>() .map_err(|_| b...
code_fim
hard
{ "lang": "rust", "repo": "kevinastone/httpbox", "path": "/src/service/method/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod poll_evented; pub use poll_evented::*;<|fim_prefix|>// repo: vavrusa/romio path: /src/raw/mod.rs //! Raw poll APIs //! //! This module exposes raw Poll APIs. <|fim_middle|>#[doc(inline)] pub use async_datagram::*; #[doc(inline)] pub use async_ready::*;
code_fim
medium
{ "lang": "rust", "repo": "vavrusa/romio", "path": "/src/raw/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vavrusa/romio path: /src/raw/mod.rs //! Raw poll APIs //! //! This module exposes raw Poll APIs. <|fim_suffix|>mod poll_evented; pub use poll_evented::*;<|fim_middle|>#[doc(inline)] pub use async_datagram::*; #[doc(inline)] pub use async_ready::*;
code_fim
medium
{ "lang": "rust", "repo": "vavrusa/romio", "path": "/src/raw/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // benchmark with 10 items let v: Vec<i32> = vec![1, 2, 3, 4, 56, 7, 8, 9, 10]; b.iter(|| chunk(v.clone(), 2)); } }<|fim_prefix|>// repo: russellwmy/colon path: /src/chunk.rs extern crate test; pub fn chunk<T: Clone>(v: Vec<T>, n: usize) -> Vec<Vec<T>> { v.chunks(n).map(|x| x.to_vec())....
code_fim
hard
{ "lang": "rust", "repo": "russellwmy/colon", "path": "/src/chunk.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: russellwmy/colon path: /src/chunk.rs extern crate test; pub fn chunk<T: Clone>(v: Vec<T>, n: usize) -> Vec<Vec<T>> { v.chunks(n).map(|x| x.to_vec()).collect::<Vec<Vec<T>>>() } #[cfg(test)] mod tests { use super::*; use test::Bencher; #[test] fn it_works() { <|fim_suffix|> #[bench] ...
code_fim
medium
{ "lang": "rust", "repo": "russellwmy/colon", "path": "/src/chunk.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sammyne/encoding-rs path: /crates/ascii85/tests/ascii85.rs use std::io::{Read, Write}; #[test] fn big() { const N: usize = 3 * 1000 + 1; const ALPHA: &[u8] = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ".as_bytes(); <|fim_suffix|> let mut decoded = vec![];...
code_fim
hard
{ "lang": "rust", "repo": "sammyne/encoding-rs", "path": "/crates/ascii85/tests/ascii85.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if raw != decoded.as_slice() { let mut i = 0usize; while i < decoded.len() && i < raw.len() { if decoded[i] != raw[i] { break; } i += 1; } panic!("Decode(Encode({}-byte string)) failed at offset {}", N, i); } } mo...
code_fim
hard
{ "lang": "rust", "repo": "sammyne/encoding-rs", "path": "/crates/ascii85/tests/ascii85.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajkachnic/bliss path: /lib/src/style.rs extern crate termion; use termion::{color, style}; pub fn bold(text: &str) -> String { format!("{}{}{}", style::Bold, text, style::R<|fim_suffix|>et = color::Fg(color::Reset); format!("{}{}{}", red, text, reset) } pub fn emphasize(text: &str) ->...
code_fim
hard
{ "lang": "rust", "repo": "ajkachnic/bliss", "path": "/lib/src/style.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>et = color::Fg(color::Reset); format!("{}{}{}", red, text, reset) } pub fn emphasize(text: &str) -> String { bold(&yellow(text)) }<|fim_prefix|>// repo: ajkachnic/bliss path: /lib/src/style.rs extern crate termion; use termion::{color, style}; pub fn bold(text: &str) -> String { format!("{...
code_fim
hard
{ "lang": "rust", "repo": "ajkachnic/bliss", "path": "/lib/src/style.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use crate::lz77; use alloc::vec::Vec; use core2::io::{Read, Write}; #[test] fn encode_and_decode_works() { let plain = (0..lz77::MAX_DISTANCE as u32 * 32) .map(|i| i as u8) .collect::<Vec<_>>(); let bu...
code_fim
medium
{ "lang": "rust", "repo": "sile/libflate", "path": "/src/deflate/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn encode_and_decode_works() { let plain = (0..lz77::MAX_DISTANCE as u32 * 32) .map(|i| i as u8) .collect::<Vec<_>>(); let buffer = Vec::new(); let mut encoder = Encoder::new(buffer); encoder.write_all(&plain[..]).expect("encode"); ...
code_fim
hard
{ "lang": "rust", "repo": "sile/libflate", "path": "/src/deflate/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sile/libflate path: /src/deflate/mod.rs //! The encoder and decoder of the DEFLATE format and algorithm. //! //! The DEFLATE is defined in [RFC-1951](https://tools.ietf.org/html/rfc1951). //! //! # Examples //! ``` //! use core2::io::{Read, Write}; //! use libflate::deflate::{Encoder, Decoder}; ...
code_fim
hard
{ "lang": "rust", "repo": "sile/libflate", "path": "/src/deflate/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Status { // new gets a copy of the current raft status. pub fn new<T: Storage>(raft: &Raft<T>) -> Status { let mut s = Status { id: raft.id, ..Default::default() }; s.hs = raft.hard_state(); s.ss = raft.soft_state(); s.applied = raft.raft_log.get_applied(); ...
code_fim
medium
{ "lang": "rust", "repo": "cosim/tikv", "path": "/src/raft/status.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cosim/tikv path: /src/raft/status.rs #![allow(dead_code)] use kvproto::raftpb::HardState; use raft::raft::{Raft, SoftState, StateRole}; use raft::storage::Storage; use raft::progress::Progress; use std::collections::HashMap; <|fim_suffix|>impl Status { // new gets a copy of the current raft...
code_fim
medium
{ "lang": "rust", "repo": "cosim/tikv", "path": "/src/raft/status.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for orig_line in orig.lines() { if let Some(comment_start) = orig_line.find("//") { let (before, after) = orig_line.split_at(comment_start); write!(out, "{:80}{}\n", before.trim_end(), after)?; } else { write!(out, "{}\n", orig_line)?; } ...
code_fim
hard
{ "lang": "rust", "repo": "ingolia-lab/trimrs", "path": "/src/commentfmt.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ingolia-lab/trimrs path: /src/commentfmt.rs use std::env; use std::fs; use std::io; use std::io::Write; use std::path::{PathBuf}; fn main() -> io::Result<()> { <|fim_suffix|> let orig_filename = &args[1]; let mut bak_filename = PathBuf::from(orig_filename); bak_filename.set_extension...
code_fim
medium
{ "lang": "rust", "repo": "ingolia-lab/trimrs", "path": "/src/commentfmt.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hkbudb/slimchain path: /slimchain-chain/src/consensus.rs use serde::Deserialize; <|fim_suffix|>#[derive(Debug, Copy, Clone, Eq, PartialEq, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Consensus { PoW, Raft, }<|fim_middle|>pub mod pow; pub mod raft;
code_fim
easy
{ "lang": "rust", "repo": "hkbudb/slimchain", "path": "/slimchain-chain/src/consensus.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Copy, Clone, Eq, PartialEq, Deserialize)] #[serde(rename_all = "lowercase")] pub enum Consensus { PoW, Raft, }<|fim_prefix|>// repo: hkbudb/slimchain path: /slimchain-chain/src/consensus.rs use serde::Deserialize; <|fim_middle|>pub mod pow; pub mod raft;
code_fim
easy
{ "lang": "rust", "repo": "hkbudb/slimchain", "path": "/slimchain-chain/src/consensus.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn hill_climb(original_point: Point3d, nanobots: &[Nanobot]) -> Point3d { let mut point = original_point; let mut score = decaying_score_for_pos(point, nanobots); // Find best point through hill-climbing. loop { let points = vec![Point3d { x: point.x + 1, y: point.y, z: point.z }, ...
code_fim
hard
{ "lang": "rust", "repo": "joelarmstrong/aoc18", "path": "/src/aoc23.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut num = 0; for nanobot in nanobots.iter() { if manhattan_distance(ref_nanobot.pos, nanobot.pos) <= ref_nanobot.radius { num += 1; } } num } fn strongest_nanobot<'a>(nanobots: &'a [Nanobot]) -> &'a Nanobot { nanobots.iter().max_by_key(|n| n.radius).unw...
code_fim
hard
{ "lang": "rust", "repo": "joelarmstrong/aoc18", "path": "/src/aoc23.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joelarmstrong/aoc18 path: /src/aoc23.rs use std::collections::HashSet; use std::io; use std::io::BufRead; use std::ops::RangeInclusive; use regex::Regex; use rayon::prelude::*; use failure::{Error, ensure, format_err}; use rand::{thread_rng, seq::IteratorRandom}; pub fn aoc23(part2: bool) -> Res...
code_fim
hard
{ "lang": "rust", "repo": "joelarmstrong/aoc18", "path": "/src/aoc23.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: slc4ga/ps1 path: /joiner.rs use std::os; use std::io::File; fn main() { let args: ~[~str] = os::args(); if args.len() != 3 { println!("Usage: {:s} <inputfile> <inputfile>", args[0]); } else { let fname = args[1].clone(); let path = Path::new(fname.clone()); ...
code_fim
hard
{ "lang": "rust", "repo": "slc4ga/ps1", "path": "/joiner.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut ret = ~[]; for i in range(0, a.len()) { ret.push(a[i] ^ b[i]); } ret } fn split(msg_bytes: &[u8], msg_bytes2: &[u8], mut share: File) { let unencrypted_bytes = xor(msg_bytes, msg_bytes2); share.write(unencrypted_bytes); }<|fim_prefix|>// repo: slc4ga/ps1 path: /join...
code_fim
hard
{ "lang": "rust", "repo": "slc4ga/ps1", "path": "/joiner.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match (share_file) { Some(share) => { split(msg_bytes, msg_bytes2, share); } , _c => fail!("Error opening output files!"), } } , (Some(msg_file), _) => { fail!(...
code_fim
hard
{ "lang": "rust", "repo": "slc4ga/ps1", "path": "/joiner.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> input! { s: Chars, k: usize, } let one_count = s.iter().take_while(|&&c| c == '1').count(); if one_count < k { println!("{}", s[one_count]); } else { println!("1"); } }<|fim_prefix|>// repo: likr/atcoder path: /abc106/src/bin/c.rs use proconio::inpu...
code_fim
medium
{ "lang": "rust", "repo": "likr/atcoder", "path": "/abc106/src/bin/c.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: likr/atcoder path: /abc106/src/bin/c.rs use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::{max, min}; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; <|fim_suffix|> input! { ...
code_fim
medium
{ "lang": "rust", "repo": "likr/atcoder", "path": "/abc106/src/bin/c.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: open-telemetry/opentelemetry-rust path: /opentelemetry-sdk/src/trace/evicted_queue.rs //! # Evicted Queue use std::collections::VecDeque; /// This queue maintains an ordered list of elements, and a count of /// dropped elements. Elements are removed from the queue in a first /// in first out f...
code_fim
hard
{ "lang": "rust", "repo": "open-telemetry/opentelemetry-rust", "path": "/opentelemetry-sdk/src/trace/evicted_queue.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> iter.into_iter().for_each(move |elt| self.push_back(elt)); } } #[cfg(test)] mod tests { use super::EvictedQueue; use std::collections::VecDeque; #[test] fn insert_over_capacity_test() { let capacity = 10; let mut queue = EvictedQueue::new(capacity); f...
code_fim
hard
{ "lang": "rust", "repo": "open-telemetry/opentelemetry-rust", "path": "/opentelemetry-sdk/src/trace/evicted_queue.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // delete from list let curr = curr.borrow_mut().levels[0 as usize].as_ref().unwrap().clone(); if curr.borrow_mut().current.is_none() { return None; } let level = curr.borrow_mut().levels.len(); for i in 0..level { let prev = prev_nod...
code_fim
hard
{ "lang": "rust", "repo": "zfbt/rustcode", "path": "/dart/art/skiplist.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // insert to list node.current = Some(Rc::new(RefCell::new(ele))); let mut curr = Rc::new(RefCell::new(node)); for i in 0..level { let prev = prev_nodes[i as usize].as_ref().unwrap().clone(); let next = prev.borrow_mut().levels[i as usize].as_ref().u...
code_fim
hard
{ "lang": "rust", "repo": "zfbt/rustcode", "path": "/dart/art/skiplist.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zfbt/rustcode path: /dart/art/skiplist.rs extern crate rand; use std::rc::Rc; use std::cell::RefCell; use std::cmp::Ordering; use std::fmt; use rand::Rng; const SKIPLIST_MAXLEVEL: i32 = 32; const SKIPLIST_P: i32 = 0; pub trait Value { fn value(&self) -> u16; } pub struct SkipList<T> { ...
code_fim
hard
{ "lang": "rust", "repo": "zfbt/rustcode", "path": "/dart/art/skiplist.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl SystemCallData { #[inline(always)] pub(crate) fn new(ssi: &signalfd_siginfo) -> Self { Self { system_call_number: ssi.ssi_syscall, address: ssi.ssi_call_addr, architecture: ssi.ssi_arch, } } }<|fim_prefix|>// repo: lemonrock/file-descriptors path: /src/signalfd/SystemCallData.rs /...
code_fim
medium
{ "lang": "rust", "repo": "lemonrock/file-descriptors", "path": "/src/signalfd/SystemCallData.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemonrock/file-descriptors path: /src/signalfd/SystemCallData.rs // This file is part of file-descriptors. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/file-descriptors/master/COP...
code_fim
medium
{ "lang": "rust", "repo": "lemonrock/file-descriptors", "path": "/src/signalfd/SystemCallData.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// The system call architecture. /// /// Where not supported the value is zero. pub architecture: u32, } impl SystemCallData { #[inline(always)] pub(crate) fn new(ssi: &signalfd_siginfo) -> Self { Self { system_call_number: ssi.ssi_syscall, address: ssi.ssi_call_addr, architecture: s...
code_fim
hard
{ "lang": "rust", "repo": "lemonrock/file-descriptors", "path": "/src/signalfd/SystemCallData.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.balances.insert( _beneficiary_account, beneficiary_current + _amount, ); }, None => {} }; } }; self } } //...
code_fim
hard
{ "lang": "rust", "repo": "SharonU/test-app", "path": "/processor/src/state/aggregator.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SharonU/test-app path: /processor/src/state/aggregator.rs extern crate test_shared; use test_shared::*; use std::collections::HashMap; pub trait State { type Item; fn generation(&self) -> u64; fn apply(self, evt: &Self::Item) -> Self where Self:Sized; } #[derive(Debug)] pub struct...
code_fim
hard
{ "lang": "rust", "repo": "SharonU/test-app", "path": "/processor/src/state/aggregator.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> out } #[no_mangle] fn run(variance: usize, get: fn() -> *const [u16], backspace: fn(), write: fn(*const [u16])) { let mut key = None; loop { let s = String::from_utf16_lossy(unsafe { get().as_ref().unwrap() }); if s.len() > 0 { let c = s.chars().next().unwrap(); encode_char(variance, &mut...
code_fim
hard
{ "lang": "rust", "repo": "canislupaster/eggs-dee", "path": "/eggs_dee/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: canislupaster/eggs-dee path: /eggs_dee/src/lib.rs const ENCODE_PATTERN: &str = " 1234567890qwertyuiopasdfghjklzxcvbnm,<.>/?"; const DECODE_PATTERN: &str = " QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjkl1234567890-_=+;:'\"zxcvbnm,<.>/?"; // https://stackoverflow.com/questions/14997165/fastest-wa...
code_fim
hard
{ "lang": "rust", "repo": "canislupaster/eggs-dee", "path": "/eggs_dee/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if k > key+variance || (k > ((key+variance)%ENCODE_PATTERN.len()) && k < key) { let i = compress_base(variance, chunk.clone()); s.push_str(&DECODE_PATTERN[i..i+1]); chunk.clear(); } else { let x = modulo(k as i32-key as i32, ENCODE_PATTERN.len() as i32) as usize; chunk.push(x);...
code_fim
hard
{ "lang": "rust", "repo": "canislupaster/eggs-dee", "path": "/eggs_dee/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn main() { let payload = &[1u8, 2, 3, 4, 5]; let packet = Packet { sequence_number: packet::SequenceNumber(42), command: Command::EchoReply, handle: Handle(43), data: payload }; let wrapper = Wrapper { sequence_number: wrapper::SequenceNumber(44...
code_fim
hard
{ "lang": "rust", "repo": "XOSplicer/es_uebung05_rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XOSplicer/es_uebung05_rust path: /src/main.rs #[macro_use] extern crate nom; extern crate failure; mod packet; mod wrapper; mod fletcher_16; mod ser; mod de; mod cast; use packet::*; use wrapper::*; use ser::Serialize; use std::io::Cursor; <|fim_suffix|>pub fn main() { let payload = &[1u8...
code_fim
hard
{ "lang": "rust", "repo": "XOSplicer/es_uebung05_rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TeamLe-Shop/BoncaRobot path: /plugins/w/src/lib.rs extern crate http_request_common; extern crate json; #[macro_use] extern crate plugin_api; use http_request_common::fetch_string_on_success; use plugin_api::prelude::*; use std::error::Error; // Encode query into URL format acceptable by wikip...
code_fim
hard
{ "lang": "rust", "repo": "TeamLe-Shop/BoncaRobot", "path": "/plugins/w/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>struct WPlugin; impl WPlugin { fn w(_this: &mut Plugin, opts: ParsedOpts, ctx: Context) { let arg = &opts.free.join(" "); if arg.is_empty() { ctx.send_channel("You need to search for something bro."); return; } match query_opensearch(arg) { ...
code_fim
hard
{ "lang": "rust", "repo": "TeamLe-Shop/BoncaRobot", "path": "/plugins/w/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut board: life::Board; match sel.trim() { "g" | "G" => { 'gen: loop { let mut x_str = String::new(); print!("X dim: "); std::io::stdout().flush() .expect("FLUSH ATE IT >:C"); std::io::stdin().read_line(&mut x_str) .expect("READLINE ATE IT >:C"); ...
code_fim
hard
{ "lang": "rust", "repo": "vilhelmen/rusty-life", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print!("(I)terate, (S)ave, (B)ack: "); std::io::stdout().flush() .expect("FLUSH ATE IT >:C"); // UGH SHADOWING I KNOW let mut sel = String::new(); std::io::stdin().read_line(&mut sel) .expect("READLINE FUKKIN ATE IT >:C"); match sel.trim() { "i" | "I" => { board.itera...
code_fim
hard
{ "lang": "rust", "repo": "vilhelmen/rusty-life", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vilhelmen/rusty-life path: /src/main.rs use std::io::Write; mod life { extern crate std; extern crate rand; use self::rand::Rng; // ??? use std::io::{Write,Read}; use std::error::Error; pub struct Board { // row-major, idx = y_i * COL + x_i data: Vec<bool>, x: usize, y: usize, ...
code_fim
hard
{ "lang": "rust", "repo": "vilhelmen/rusty-life", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Generate rules for content surrounded by this frame /// /// It is assumed that the content's margins apply inside this frame, and /// that the margin is at least as large as self's `inner_margin`. /// /// Returns the tuple `(rules, offset, size)`: /// /// - the genera...
code_fim
hard
{ "lang": "rust", "repo": "wiltonlazary/kas", "path": "/src/layout/size_types.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wiltonlazary/kas path: /src/layout/size_types.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/licenses...
code_fim
hard
{ "lang": "rust", "repo": "wiltonlazary/kas", "path": "/src/layout/size_types.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: graphprotocol/graph-node path: /graph/src/data/store/ethereum.rs use super::scalar; use crate::prelude::*; use web3::types::{Address, Bytes, H2048, H256, H64, U64}; <|fim_suffix|>impl From<H256> for Value { fn from(hash: H256) -> Value { Value::Bytes(scalar::Bytes::from(hash.as_ref(...
code_fim
hard
{ "lang": "rust", "repo": "graphprotocol/graph-node", "path": "/graph/src/data/store/ethereum.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Value::Bytes(scalar::Bytes::from(hash.as_ref())) } } impl From<H256> for Value { fn from(hash: H256) -> Value { Value::Bytes(scalar::Bytes::from(hash.as_ref())) } } impl From<H2048> for Value { fn from(hash: H2048) -> Value { Value::Bytes(scalar::Bytes::from(hash....
code_fim
medium
{ "lang": "rust", "repo": "graphprotocol/graph-node", "path": "/graph/src/data/store/ethereum.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // server rejects the request (500) let find_object = FindObject { sources: Arc::new([server.reject_source.clone()]), ..find_object }; let result = objects_actor.find(find_object.clone()).await.unwrap(); assert_eq!( result.meta.cl...
code_fim
hard
{ "lang": "rust", "repo": "benlau/symbolicator", "path": "/crates/symbolicator/src/services/objects/data_cache.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let server = test::FailingSymbolServer::new(); let cachedir = tempdir(); let objects_actor = objects_actor(&cachedir); let find_object = FindObject { // A request for a bcsymbolmap will expand to only one file that is being looked up. // Other filet...
code_fim
hard
{ "lang": "rust", "repo": "benlau/symbolicator", "path": "/crates/symbolicator/src/services/objects/data_cache.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benlau/symbolicator path: /crates/symbolicator/src/services/objects/data_cache.rs for a [`FetchFileDataRequest`] which can be //! used with a [`Cacher`] to make a filesystem based cache. //! //! [`Cacher`]: crate::services::cacher::Cacher use std::cmp; use std::fmt; use std::fs; use std::io::{s...
code_fim
hard
{ "lang": "rust", "repo": "benlau/symbolicator", "path": "/crates/symbolicator/src/services/objects/data_cache.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>R => { return "-"; }, _x => { return "?"; } } }<|fim_prefix|>// repo: tsoj/hactar path: /src/position/player.rs pub type Player = usize; pub const WHITE: Player = 0; pub const BLACK: Player = 1; pub const NO_PLAYER: Player = <|fim_middl...
code_fim
hard
{ "lang": "rust", "repo": "tsoj/hactar", "path": "/src/position/player.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return "White"; }, BLACK => { return "Black"; }, NO_PLAYER => { return "-"; }, _x => { return "?"; } } }<|fim_prefix|>// repo: tsoj/hactar path: /src/position/player.rs pub type Pl...
code_fim
medium
{ "lang": "rust", "repo": "tsoj/hactar", "path": "/src/position/player.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tsoj/hactar path: /src/position/player.rs pub type Player = usize; pub const WHITE: Player = 0; pub const BLACK: Player = 1; pub const NO_PLAYER: Player = <|fim_suffix|> return "White"; }, BLACK => { return "Black"; }, NO_PLAYER => ...
code_fim
medium
{ "lang": "rust", "repo": "tsoj/hactar", "path": "/src/position/player.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: asanza/mkm34z7 path: /src/lcd/wf18.rs PALCD18_W<'a> { w: &'a mut W, } impl<'a> BPALCD18_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: BPALCD18_A) -> &'a mut W { { self.bit(variant.into()) } } ...
code_fim
hard
{ "lang": "rust", "repo": "asanza/mkm34z7", "path": "/src/lcd/wf18.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: asanza/mkm34z7 path: /src/lcd/wf18.rs iant: BPALCD18_A) -> Self { variant as u8 != 0 } } #[doc = "Reader of field `BPALCD18`"] pub type BPALCD18_R = crate::R<bool, BPALCD18_A>; impl BPALCD18_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&s...
code_fim
hard
{ "lang": "rust", "repo": "asanza/mkm34z7", "path": "/src/lcd/wf18.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> variant as u8 != 0 } } #[doc = "Reader of field `BPHLCD18`"] pub type BPHLCD18_R = crate::R<bool, BPHLCD18_A>; impl BPHLCD18_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> BPHLCD18_A { match self.bits { false => BPHLCD18...
code_fim
hard
{ "lang": "rust", "repo": "asanza/mkm34z7", "path": "/src/lcd/wf18.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>, 0x00, 0x51, 0x00, 0x06, 0x00, 0x39, 0x00, 0x06, 0x00, 0x3b, 0x00, 0x02, 0x00, 0xc9, 0x00, 0x04, 0x00, 0x30, 0x00, 0x01, 0x00, 0x01, 0x00, 0x1a, 0x10, 0x00, 0x00, 0x04, 0x00, 0x0c, 0x00, 0x01, 0x00, 0x04, 0x00, 0x30, 0x00, 0x01, 0x00, 0x31, 0x00, 0x01, 0x00, 0x32, 0x00, 0x04, 0x10, 0x00, ...
code_fim
hard
{ "lang": "rust", "repo": "Alphalink/rust-netflow", "path": "/src/netflow/test_data.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>0, 0x01, 0x00, 0x03, 0x00, 0x04, 0x00, 0x1b, 0x00, 0x10, 0x00, 0x1c, 0x00, 0x10, 0x00, 0x05, 0x00, 0x01, 0x00, 0x07, 0x00, 0x02, 0x00, 0x0b, 0x00, 0x02, 0x00, 0x06, 0x00, 0x01, 0x00, 0x04, 0x00, 0x01, 0x00, 0x38, 0x00, 0x06, 0x00, 0x50, 0x00, 0x06, 0x00, 0x3a, 0x00, 0x02, 0x00, 0xc9, 0x00, 0x0...
code_fim
hard
{ "lang": "rust", "repo": "Alphalink/rust-netflow", "path": "/src/netflow/test_data.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alphalink/rust-netflow path: /src/netflow/test_data.rs pub const NETFLOWV9_DATA: [u8; 492] = [ 0x00, 0x09, 0x00, 0x07, 0x00, 0x53, 0xf4, 0x93, 0x5a, 0xd5, 0x6d, 0x6a, 0x00, 0x00, 0x03, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x04, 0x00, 0x00, 0x15, 0x00, 0x15, 0x00, 0x04, ...
code_fim
hard
{ "lang": "rust", "repo": "Alphalink/rust-netflow", "path": "/src/netflow/test_data.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let v = loops[index as usize].get_i32("v"); let co = mverts[v as usize].get_f32_vec("co"); verts[index_count as usize] = [co[0], co[1], co[2]]; max_x = max_x.max(co[0]); min_x = min_x.min(co[0]); max_y = max_...
code_fim
hard
{ "lang": "rust", "repo": "JoNil/loka-n64", "path": "/game-pipeline/src/models.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JoNil/loka-n64 path: /game-pipeline/src/models.rs use crate::utils::{write_binary_file_if_changed, write_file_if_changed}; use assert_into::AssertInto; use blend::{Blend, Instance}; use meshopt::{generate_vertex_remap, remap_index_buffer, remap_vertex_buffer}; use n64_math::{vec2, Vec2}; use std...
code_fim
hard
{ "lang": "rust", "repo": "JoNil/loka-n64", "path": "/game-pipeline/src/models.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(file_name) = path.file_stem().map(|n| n.to_string_lossy()) { let blend = Blend::from_path(&path).unwrap(); for obj in blend.instances_with_code(*b"OB") { if obj.is_valid("data") && obj.get("data").code()[0..=1] == *b"ME" { le...
code_fim
hard
{ "lang": "rust", "repo": "JoNil/loka-n64", "path": "/game-pipeline/src/models.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: silvioiannone/rustier path: /src/terminal/mod.rs //! //! Terminal interface. //! use std::io::{stdout, Write}; use crossterm::{event, execute, terminal, cursor}; pub struct Terminal; /// Terminal. impl Terminal { /// Clear the terminal. pub fn clear() { execute!(stdout(), termi...
code_fim
hard
{ "lang": "rust", "repo": "silvioiannone/rustier", "path": "/src/terminal/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Hide the cursor. pub fn hide_cursor() { execute!(stdout(), cursor::Hide).unwrap(); } /// Move the cursor to the given position. pub fn move_cursor(x: u16, y: u16) { execute!(stdout(), cursor::MoveTo(x, y)).unwrap(); } /// Show the cursor. pub fn show_c...
code_fim
hard
{ "lang": "rust", "repo": "silvioiannone/rustier", "path": "/src/terminal/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod pd_page; pub use self::pd_page::*;<|fim_prefix|>// repo: manuel-woelker/rust-pdf path: /src/pd/mod.rs mod pd_document; pub use self::pd_document::*; mod pd_document_information; pub use self::pd_document_information::*; <|fim_middle|>mod pd_rectangle; pub use self::pd_rectangle::*;
code_fim
easy
{ "lang": "rust", "repo": "manuel-woelker/rust-pdf", "path": "/src/pd/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod pd_rectangle; pub use self::pd_rectangle::*; mod pd_page; pub use self::pd_page::*;<|fim_prefix|>// repo: manuel-woelker/rust-pdf path: /src/pd/mod.rs mod pd_document; pub use self::pd_document::*; <|fim_middle|>mod pd_document_information; pub use self::pd_document_information::*;
code_fim
medium
{ "lang": "rust", "repo": "manuel-woelker/rust-pdf", "path": "/src/pd/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: manuel-woelker/rust-pdf path: /src/pd/mod.rs mod pd_document; pub use self::pd_document::*; mod pd_document_information; pub use self::pd_document_information::*; <|fim_suffix|>mod pd_page; pub use self::pd_page::*;<|fim_middle|>mod pd_rectangle; pub use self::pd_rectangle::*;
code_fim
easy
{ "lang": "rust", "repo": "manuel-woelker/rust-pdf", "path": "/src/pd/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub const AHB_DMA: u32 = 1 << 0; pub const AHB_SRAM: u32 = 1 << 2; pub const AHB_FLITF: u32 = 1 << 4; pub const AHB_CRC: u32 = 1 << 6; pub const AHB_IOPA: u32 = 1 << 17; pub const AHB_IOPB: u32 = 1 << 18; pub const AHB_IOPC: u32 = 1 << 19; pub const AHB_IOPD: u32 = 1 << 20; pub const AHB_IOPF: u32 = 1 << ...
code_fim
hard
{ "lang": "rust", "repo": "starblue/dust", "path": "/dust-stm32f0/src/rcc.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: starblue/dust path: /dust-stm32f0/src/rcc.rs //! Reset and Clock Control (RCC) use volatile_register::RW; #[repr(C)] pub struct Rcc { pub cr: RW<u32>, pub cfgr: RW<u32>, pub cir: RW<u32>, pub apb2rstr: RW<u32>, pub apb1rstr: RW<u32>, pub ahbenr: RW<u32>, pub apb2en...
code_fim
medium
{ "lang": "rust", "repo": "starblue/dust", "path": "/dust-stm32f0/src/rcc.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>pub const APB1_TIM3: u32 = 1 << 1; pub const APB1_TIM6: u32 = 1 << 4; pub const APB1_TIM7: u32 = 1 << 5; pub const APB1_TIM14: u32 = 1 << 8; pub const APB1_WWDG: u32 = 1 << 11; pub const APB1_SPI2: u32 = 1 << 14; pub const APB1_USART2: u32 = 1 << 17; pub const APB1_USART3: u32 = 1 << 18; pub const APB1_US...
code_fim
hard
{ "lang": "rust", "repo": "starblue/dust", "path": "/dust-stm32f0/src/rcc.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: msfwaifu/RainStorm path: /src/cheats/crithack.rs use Cheat; use GamePointers; use sdk; use core::prelude::*; use sdk::Entity; use sdk::utils; use libc; pub struct Crithack { enabled: bool, } <|fim_suffix|> let wep: sdk::BaseCombatWeapon = unsafe { match ptrs.icliententitylist.get_client...
code_fim
hard
{ "lang": "rust", "repo": "msfwaifu/RainStorm", "path": "/src/cheats/crithack.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let critbucket = unsafe { *wep.ptr_offset::<f32>(0x09D8 - 12) }; //log!("crit bucket: {}\n", critbucket); if (critbucket < 500.0) { //log!("crit bucket too low!\n"); return } if sdk::utils::is_commandnum_critical(ptrs, wep, cmd.command_number) { cmd.buttons &= !sdk::IN_ATTACK; }...
code_fim
hard
{ "lang": "rust", "repo": "msfwaifu/RainStorm", "path": "/src/cheats/crithack.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if (critbucket < 500.0) { //log!("crit bucket too low!\n"); return } if sdk::utils::is_commandnum_critical(ptrs, wep, cmd.command_number) { cmd.buttons &= !sdk::IN_ATTACK; } }*/ fn enable(&mut self) { self.enabled = true; } fn disable(&mut self) { self.enabled = false; } ...
code_fim
hard
{ "lang": "rust", "repo": "msfwaifu/RainStorm", "path": "/src/cheats/crithack.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ousttrue/frame_factory path: /gltf2/src/generated/mod.rs use serde::{Deserialize, Serialize}; use std::collections::HashMap; /// Accessor Sparse Indices /// Index array of size `count` that points to those accessor attributes that deviate from their initialization value. Indices must strictly ...
code_fim
hard
{ "lang": "rust", "repo": "ousttrue/frame_factory", "path": "/gltf2/src/generated/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Skin /// Joints and matrices defining a skin. #[derive(Serialize, Deserialize, Debug)] #[allow(non_snake_case, non_camel_case_types)] pub struct Skin { pub extensions: Option<serde_json::Value>, pub extras: Option<serde_json::Value>, pub inverseBindMatrices: Option<i32>, #[serde(defaul...
code_fim
hard
{ "lang": "rust", "repo": "ousttrue/frame_factory", "path": "/gltf2/src/generated/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Scene /// The root nodes of a scene. #[derive(Serialize, Deserialize, Debug)] #[allow(non_snake_case, non_camel_case_types)] pub struct Scene { pub extensions: Option<serde_json::Value>, pub extras: Option<serde_json::Value>, #[serde(default)] pub name: String, #[serde(default)] ...
code_fim
hard
{ "lang": "rust", "repo": "ousttrue/frame_factory", "path": "/gltf2/src/generated/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: awfeequdng/logstore path: /src/index_file.rs extern crate byteorder; extern crate multimap; extern crate rmp_serde as rmps; extern crate itertools; use rmps::encode::to_vec; use rmps::decode::{from_slice, from_read}; //use self::byteorder::{LE, ReadBytesExt, WriteBytesExt}; use self::multimap:...
code_fim
hard
{ "lang": "rust", "repo": "awfeequdng/logstore", "path": "/src/index_file.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let buff = to_vec(&self.term_map).unwrap(); if let Err(e) = self.rec_file.fd.seek(SeekFrom::Start(self.rec_file.end_of_file)) { error!("Unable to seek to the end of the RecordFile: {}", e.to_string()); return; } if let Err(e) = self.rec_file.fd.wri...
code_fim
hard
{ "lang": "rust", "repo": "awfeequdng/logstore", "path": "/src/index_file.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() -> anyhow::Result<()> { let opt = Opt::from_args(); stderrlog::new() .verbosity(opt.verbose) .show_level(false) .timestamp(stderrlog::Timestamp::Off) .init()?; let mut options = EnvOpenOptions::new(); options.map_size(opt.database_size.get_bytes(...
code_fim
hard
{ "lang": "rust", "repo": "yanns/milli", "path": "/infos/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let faceted_fields = index.faceted_fields_ids(rtxn)?; let fields_ids_map = index.fields_ids_map(rtxn)?; for (field_id, field_type) in faceted_fields { let facet_name = fields_ids_map.name(field_id).unwrap(); let db = facet_field_id_value_docids.remap_data_t...
code_fim
hard
{ "lang": "rust", "repo": "yanns/milli", "path": "/infos/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yanns/milli path: /infos/src/main.rs tring()])?; } Ok(wtr.flush()?) } /// Helper function that converts the facet value key to a unique type /// that can be used to log or display purposes. fn facet_values_iter<'txn, DC: 'txn, T>( rtxn: &'txn heed::RoTxn, db: heed::Database<hee...
code_fim
hard
{ "lang": "rust", "repo": "yanns/milli", "path": "/infos/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kennytm/borsholder path: /src/render.rs //! Utilities for rendering the page via Tera. use chrono::{DateTime, Local, Utc}; use github::graphql::{Label, MergeableState, PullRequest, StatusContext}; use homu::{Entry, Status}; use reqwest::Url; use std::collections::HashMap; use std::fmt::Display;...
code_fim
hard
{ "lang": "rust", "repo": "kennytm/borsholder", "path": "/src/render.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Parses a Tera value into a value. fn parse<T: FromStr>(filter: &str, input: &Value) -> ::tera::Result<T> where T::Err: Display, { let value = try_get_value!(filter, "value", String, input).parse(); map_err_to_string(value) } /// If the result is an error, converts it to a string so that i...
code_fim
hard
{ "lang": "rust", "repo": "kennytm/borsholder", "path": "/src/render.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for partition_req in &topic_request.fetch_partitions { let partition = &partition_req.partition_index; debug!( "fetch log: {}-{}, max_bytes: {}", topic, partition, fetch_request.max_bytes ); let fetch_offset = partitio...
code_fim
hard
{ "lang": "rust", "repo": "vijaylaxmid/fluvio", "path": "/src/spu/src/services/public/fetch_handler.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vijaylaxmid/fluvio path: /src/spu/src/services/public/fetch_handler.rs use tracing::trace; use tracing::debug; use futures_util::io::AsyncRead; use futures_util::io::AsyncWrite; use fluvio_socket::InnerFlvSink; use fluvio_socket::InnerExclusiveFlvSink; use fluvio_socket::FlvSocketError; use dat...
code_fim
hard
{ "lang": "rust", "repo": "vijaylaxmid/fluvio", "path": "/src/spu/src/services/public/fetch_handler.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brace-rs/brace-web path: /crates/brace-web-form/src/form.rs use std::fmt::{self, Debug, Display}; use std::ops::{Deref, DerefMut}; use std::rc::Rc; use actix_http::{Error, Payload, Response}; use brace_web_core::http::header::ContentType; use brace_web_core::http::StatusCode; use brace_web_core...
code_fim
hard
{ "lang": "rust", "repo": "brace-rs/brace-web", "path": "/crates/brace-web-form/src/form.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn respond_to(self, _: &HttpRequest) -> Self::Future { let body = match serde_qs::to_string(&self.0) { Ok(body) => body, Err(_) => return err(UrlEncodedError::Parse.into()), }; ok(Response::build(StatusCode::OK) .set(ContentType::form_url_en...
code_fim
hard
{ "lang": "rust", "repo": "brace-rs/brace-web", "path": "/crates/brace-web-form/src/form.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl GameAssets { pub fn entity_sprite(&self, sprite_number: usize) -> SpriteRender { SpriteRender { sprite_sheet: self.entities_spritesheet.clone(), sprite_number, } } }<|fim_prefix|>// repo: Hugal31/bobo-is-you path: /src/assets/mod.rs use amethyst::rende...
code_fim
medium
{ "lang": "rust", "repo": "Hugal31/bobo-is-you", "path": "/src/assets/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Hugal31/bobo-is-you path: /src/assets/mod.rs use amethyst::renderer::{SpriteRender, SpriteSheetHandle}; pub const ENTITY_SPRITE_BOBO: usize = 0; pub const ENTITY_SPRITE_WALL: usize = 1; pub const ENTITY_SPRITE_FLAG: usize = 10; pub const ENTITY_SPRITE_INST_IS: usize = 2; pub const ENTITY_SPRITE...
code_fim
medium
{ "lang": "rust", "repo": "Hugal31/bobo-is-you", "path": "/src/assets/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rongfengliang/rust-mod-workspace path: /lib/users/src/lib.rs #[cfg(test)] mod tests { #[test] fn it_works() { <|fim_suffix|>pub mod aaa { const X: i32 = 10; pub fn print_aaa() { println!("{}", 42); } }<|fim_middle|> assert_eq!(2 + 2, 4); } } pub mod user ...
code_fim
medium
{ "lang": "rust", "repo": "rongfengliang/rust-mod-workspace", "path": "/lib/users/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn print_aaa() { println!("{}", 42); } }<|fim_prefix|>// repo: rongfengliang/rust-mod-workspace path: /lib/users/src/lib.rs #[cfg(test)] mod tests { #[test] fn it_works() { assert_eq!(2 + 2, 4); } } pub mod user { #[derive(Debug)] pub struct User { pu...
code_fim
easy
{ "lang": "rust", "repo": "rongfengliang/rust-mod-workspace", "path": "/lib/users/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shayne-fletcher/zen path: /rust/visitor/src/main.rs extern crate visitor; use visitor::expr::*; /////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 // struct Harvest<'a> { pub acc: Vec<&'a Term>, } fn harvest(t: &Term) -> Vec<&Term> { <|fim_suffix|> self...
code_fim
hard
{ "lang": "rust", "repo": "shayne-fletcher/zen", "path": "/rust/visitor/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self } fn visit_term(&mut self, t: &'a Term) { self.acc.push(t); t.recurse(self.object()) } } pub fn main() { println!("{:?}", harvest(&(parse("1 + 2 + (3 +(-8))").unwrap()))) }<|fim_prefix|>// repo: shayne-fletcher/zen path: /rust/visitor/src/main.rs extern crate...
code_fim
hard
{ "lang": "rust", "repo": "shayne-fletcher/zen", "path": "/rust/visitor/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.acc.push(t); t.recurse(self.object()) } } pub fn main() { println!("{:?}", harvest(&(parse("1 + 2 + (3 +(-8))").unwrap()))) }<|fim_prefix|>// repo: shayne-fletcher/zen path: /rust/visitor/src/main.rs extern crate visitor; use visitor::expr::*; /////////1/////////2/////////3...
code_fim
hard
{ "lang": "rust", "repo": "shayne-fletcher/zen", "path": "/rust/visitor/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<S, Q, W, PB> OnlineLearner<S, PB::Action> for GreedyGQ<Q, W, PB> where Q: EnumerableStateActionFunction<S> + LinearStateActionFunction<S, usize>, W: StateFunction<S, Output = f64> + LinearStateFunction<S>, PB: EnumerablePolicy<S>, { fn handle_transition(&mut self, t: &Transition<S, PB...
code_fim
hard
{ "lang": "rust", "repo": "clumsy/rsrl", "path": "/rsrl/src/control/gtd/greedy_gq.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }