text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>fn from_class_elt_constants<'a, 'arena, 'decl>( emitter: &mut Emitter<'arena, 'decl>, env: &Env<'a, 'arena>, class_: &'a ast::Class_, ) -> Result<Vec<(Constant<'arena>, Option<InstrSeq<'arena>>)>> { use oxidized::aast::ClassConstKind; class_ .consts .iter() .map...
code_fim
hard
{ "lang": "rust", "repo": "facebook/hhvm", "path": "/hphp/hack/src/hackc/emitter/emit_class.rs", "mode": "spm", "license": "PHP-3.01", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mschmo/rust-csv path: /src/lib.rs //! This crate provides a streaming CSV (comma separated values) writer and //! reader that works with the `serialize` crate to do type based encoding //! and decoding. There are two primary goals of this project: //! //! 1. The default mode of parsing should *j...
code_fim
hard
{ "lang": "rust", "repo": "mschmo/rust-csv", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// An error produced by an operation on CSV data. #[derive(Debug)] pub enum Error { /// An error reported by the type-based encoder. Encode(String), /// An error reported by the type-based decoder. Decode(String), /// An error reported by the CSV parser. Parse(LocatableError<Parse...
code_fim
hard
{ "lang": "rust", "repo": "mschmo/rust-csv", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: OAyomide/paystack-rs path: /src/paystack/transactions.rs use crate::utils::*; use chrono::{prelude::DateTime, Utc}; use reqwest::blocking::Response; use serde::Serialize; use serde_json::Value; use std::fmt::Debug; #[derive(Default)] /// The Transactions API allows you create and manage payment...
code_fim
hard
{ "lang": "rust", "repo": "OAyomide/paystack-rs", "path": "/src/paystack/transactions.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Serialize)] pub struct ExportTransactionsBody { // FIXME: at this moment, I dont know if this will work but rust-analyzer isnt throwing an error so... 🤷🏾‍♂️ #[serde(rename = "perPage")] /// Specify how many records you want to retrieve per page. If not specify we use a defaul...
code_fim
hard
{ "lang": "rust", "repo": "OAyomide/paystack-rs", "path": "/src/paystack/transactions.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stackcats/leetcode path: /algorithms/medium/furthest_building_you_can_reach.rs use std::collections::BinaryHeap; use std::cmp::Reverse; impl Solution { pub fn furthest_building(heights: Vec<i32>, bricks: i32, ladders: i32) -> i32 { let mut pq = BinaryHeap::new(); let mut use...
code_fim
hard
{ "lang": "rust", "repo": "stackcats/leetcode", "path": "/algorithms/medium/furthest_building_you_can_reach.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>).0; if usedBricks > bricks { return (i - 1) as i32; } } } (heights.len() - 1) as i32 } }<|fim_prefix|>// repo: stackcats/leetcode path: /algorithms/medium/furthest_building_you_can_reach.rs use std::collections::BinaryH...
code_fim
hard
{ "lang": "rust", "repo": "stackcats/leetcode", "path": "/algorithms/medium/furthest_building_you_can_reach.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: luyikk/kcp_server_echo path: /src/kcp_server/kcp_peer.rs use tokio::sync::Mutex; use udp_server:: TokenStore; use crate::kcp::{Kcp, KcpResult}; use std::sync::atomic::AtomicI64; use std::sync::Arc; use std::net::SocketAddr; /// KCP LOCK /// 将KCP 对象操作完全上锁,以保证内存安全 通知简化调用 pub struct KcpLock(Arc<Mu...
code_fim
hard
{ "lang": "rust", "repo": "luyikk/kcp_server_echo", "path": "/src/kcp_server/kcp_peer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub async fn input(&self, buf: &[u8]) -> KcpResult<usize>{ self.kcp.input(buf).await } pub async fn recv(&self, buf: &mut [u8]) -> KcpResult<usize>{ self.kcp.recv(buf).await } pub async fn send(&self, buf: &[u8]) -> KcpResult<usize>{ self.kcp.send(buf).await ...
code_fim
hard
{ "lang": "rust", "repo": "luyikk/kcp_server_echo", "path": "/src/kcp_server/kcp_peer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn cudaDeviceEnablePeerAccess(peerDevice: ::std::os::raw::c_int, flags: ::std::os::raw::c_uint) -> cudaError_t; pub fn cudaDeviceDisablePeerAccess(peerDevice: ::std::os::raw::c_int) -> cudaError_t; pub fn cudaGraphicsUnregisterResource(resource: cudaGraphicsResource_t) -> cudaError_t; ...
code_fim
hard
{ "lang": "rust", "repo": "king6cong/accel", "path": "/cuda-sys/src/cudart.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: king6cong/accel path: /cuda-sys/src/cudart.rs Symbol = 13, MapBufferObjectFailed = 14, UnmapBufferObjectFailed = 15, InvalidHostPointer = 16, InvalidDevicePointer = 17, InvalidTexture = 18, InvalidTextureBinding = 19, InvalidChannelDescriptor = 20, InvalidMemcpyDi...
code_fim
hard
{ "lang": "rust", "repo": "king6cong/accel", "path": "/cuda-sys/src/cudart.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub const cudaLimit_cudaLimitStackSize: cudaLimit = 0; pub const cudaLimit_cudaLimitPrintfFifoSize: cudaLimit = 1; pub const cudaLimit_cudaLimitMallocHeapSize: cudaLimit = 2; pub const cudaLimit_cudaLimitDevRuntimeSyncDepth: cudaLimit = 3; pub const cudaLimit_cudaLimitDevRuntimePendingLaunchCount: cudaLim...
code_fim
hard
{ "lang": "rust", "repo": "king6cong/accel", "path": "/cuda-sys/src/cudart.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // collect artists let mut artist = String::new(); for (i, artist_json) in json["item"]["artists"] .as_array() .unwrap() .iter() .enumerate() { artist.push_str(artist_json["name"].as_str().unwrap()); if i + 1 != json["item"]["artists"].as_arr...
code_fim
hard
{ "lang": "rust", "repo": "zphixon/snipsnap", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zphixon/snipsnap path: /src/main.rs mod auth; mod error; mod resource; #[cfg(target_os = "windows")] mod win_ui; #[cfg(target_os = "windows")] use win_ui as ui; use error::MyError; static mut CURRENT_TRACK: String = String::new(); fn main() { // TODO: add customization // * port numb...
code_fim
hard
{ "lang": "rust", "repo": "zphixon/snipsnap", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn get_currently_playing(access_token: &str) -> Result<String, MyError> { let response = ureq::get("https://api.spotify.com/v1/me/player/currently-playing") .set("Authorization", &format!("Bearer {}", access_token)) .send_string(""); if response.status() == 204 { // 204: N...
code_fim
hard
{ "lang": "rust", "repo": "zphixon/snipsnap", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let tail_tokens = ts.range_from(i + 1); let tail = parse_expr(tail_tokens)?; return Ok((head_elems, Some(tail))); }, _ => (), } } // Didn't find a semicolon. There is no tail elem. let head_tokens = ts.range_from(e...
code_fim
hard
{ "lang": "rust", "repo": "canndrew/malk-rs", "path": "/src/parse.old/struct_term.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: canndrew/malk-rs path: /src/parse.old/struct_term.rs use std::fmt; use lexer::{Span, TokenKind, TokensRef}; use parse::{ParseError, CompositeTermElem, parse_maybe_composite_term_elem, parse_composite_term_elem, Expr, parse_expr}; #[derive(Debug, Clone, PartialEq)] pub s...
code_fim
medium
{ "lang": "rust", "repo": "canndrew/malk-rs", "path": "/src/parse.old/struct_term.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fs::remove_file(path)?; Ok(()) } /// Attempt to generate a font sheet from a file that does not exist. #[test] fn generate_a_font_sheet_that_does_not_exist() -> Result<(), Box<std::error::Error>> { let mut cmd = Command::cargo_bin("fontgen")?; cmd.arg("--input") .arg("assets/Does...
code_fim
hard
{ "lang": "rust", "repo": "lambdaxymox/fontgen", "path": "/tests/fontgen.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// The application should reject any padding that's larger than the slot glyph size. #[test] fn fontgen_should_reject_padding_larger_than_slot_glyph_size() -> Result<(), Box<std::error::Error>> { let mut cmd = Command::cargo_bin("fontgen")?; cmd.arg("--input") .arg("assets/FreeMono.ttf") ...
code_fim
hard
{ "lang": "rust", "repo": "lambdaxymox/fontgen", "path": "/tests/fontgen.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lambdaxymox/fontgen path: /tests/fontgen.rs use assert_cmd::prelude::*; use std::fs; use std::process::Command; use std::path::Path; /// Generate a font sheet from a TrueType font. The font sheet and its /// corresponding metadata file should appear in the root directory of the source tree. #[...
code_fim
hard
{ "lang": "rust", "repo": "lambdaxymox/fontgen", "path": "/tests/fontgen.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// /// Returns a random localized street address, use_full_address adds `secondary_address` /// /// e.g. "26432 Corey Rapids Apt. 074" pub fn street_address(&self, use_full_address: bool) -> String { // if (use_full_address == undefined) { use_full_address = false; } l...
code_fim
hard
{ "lang": "rust", "repo": "PSeitz/f4ker-rs", "path": "/src/address.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// e.g. "N" pub fn ordinal_direction_abbr(&self) -> &'static str { self.faker.address_direction_abbr.rand() } /// e.g. [49.240253, 8.360744] pub fn nearby_gps_coordinate(&self, coordinate: [f32; 2], min_distance: f32, max_distance: f32) -> [f32; 2] { fn degrees_to_rad...
code_fim
hard
{ "lang": "rust", "repo": "PSeitz/f4ker-rs", "path": "/src/address.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PSeitz/f4ker-rs path: /src/address.rs use crate::faker::Faker; use crate::*; use rand::{thread_rng, Rng}; #[derive(Debug, Clone)] pub struct Address<'a> { faker: &'a Faker, } fn to_precision(val: f32, precision: u8) -> String { match precision { 0 => format!("{:.0}", val), ...
code_fim
hard
{ "lang": "rust", "repo": "PSeitz/f4ker-rs", "path": "/src/address.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wezm/cc2650 path: /src/flash/singlebit.rs #[doc = r" Value read from the register"] pub struct R { bits: u32, } impl super::SINGLEBIT { #[doc = r" Reads the contents of the register"] #[inline] pub fn read(&self) -> R { R { bits: self.register.get() } } } #[doc = r" V...
code_fim
hard
{ "lang": "rust", "repo": "wezm/cc2650", "path": "/src/flash/singlebit.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[inline] pub fn bit_is_set(&self) -> bool { self.bit() } } impl R { #[doc = r" Value of the register as raw bits"] #[inline] pub fn bits(&self) -> u32 { self.bits } #[doc = "Bits 1:31 - Internal. Only to be used through TI provided API."] #[inline] pub ...
code_fim
hard
{ "lang": "rust", "repo": "wezm/cc2650", "path": "/src/flash/singlebit.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>: u8 = 1; ((self.bits >> OFFSET) & MASK as u32) as u32 }; FROMNR { bits } } #[doc = "Bit 0 - Internal. Only to be used through TI provided API."] #[inline] pub fn from0(&self) -> FROM0R { let bits = { const MASK: bool = true; cons...
code_fim
hard
{ "lang": "rust", "repo": "wezm/cc2650", "path": "/src/flash/singlebit.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn unwrap_to_data(&self) -> Rc<Vec<u8>> { Rc::new(self.0.transaction.data.clone().into()) } pub fn unwrap_to_context(&self) -> evm::Context { evm::Context { address: self.0.transaction.address.clone().into(), caller: self.0.transaction.sender.clone().into(), apparent_value: self.0.tra...
code_fim
hard
{ "lang": "rust", "repo": "input-output-hk/laika-tests", "path": "/jsontests/src/vm.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: input-output-hk/laika-tests path: /jsontests/src/vm.rs use std::collections::BTreeMap; use std::rc::Rc; use serde::Deserialize; use primitive_types::{H160, U256}; use evm::Config; use evm::backend::{ApplyBackend, MemoryBackend, MemoryVicinity, MemoryAccount}; use evm::executor::{StackExecutor, S...
code_fim
hard
{ "lang": "rust", "repo": "input-output-hk/laika-tests", "path": "/jsontests/src/vm.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: imkgerC/rust-socha2020 path: /player/src/mcts/mod.rs mod graph; mod playout; use crate::search::Searcher; use crate::timecontrol::Timecontrol; use game_sdk::{Action, ActionList, ClientListener, GameState}; use graph::Node; use rand::{rngs::SmallRng, SeedableRng}; use std::time::Instant; pub st...
code_fim
hard
{ "lang": "rust", "repo": "imkgerC/rust-socha2020", "path": "/player/src/mcts/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn set_root(&mut self, state: &GameState) { // assumes that next state is always exactly two ply away let mut first_index = None; let mut second_index = None; for (edge_idx, edge) in self.root.children.iter().enumerate() { self.initial_state.make_action(edge...
code_fim
hard
{ "lang": "rust", "repo": "imkgerC/rust-socha2020", "path": "/player/src/mcts/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // tree reuse if possible self.set_root(state); let mut rng = SmallRng::from_entropy(); let mut samples = 0; let mut elapsed = 0; self.iterations_per_ms = 1.; let mut pv = ActionList::default(); loop { let time_left = self.tc.tim...
code_fim
hard
{ "lang": "rust", "repo": "imkgerC/rust-socha2020", "path": "/player/src/mcts/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut i = 0.0; while i < s { context.move_to(x_min + xs * i, y_max); context.line_to(x_max, y_max - ys * i); context.move_to(x_max - xs * i, y_min); context.line_to(x_max, y_max - ys * i); context.move_to(x_max - xs * i, y_min); context.line_to(x...
code_fim
medium
{ "lang": "rust", "repo": "planet0104/art_pattern", "path": "/src/chapter1/sample5.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: planet0104/art_pattern path: /src/chapter1/sample5.rs use stdweb::web::CanvasRenderingContext2d; pub fn draw(context: &CanvasRenderingContext2d) { context.set_stroke_style_color("#000"); context.set_line_width(1.0); context.begin_path(); <|fim_suffix|> let s = 20.0; let xs =...
code_fim
medium
{ "lang": "rust", "repo": "planet0104/art_pattern", "path": "/src/chapter1/sample5.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cuklev/huffman-archiver-rust path: /src/commands/compress.rs use std::io::{BufReader, BufWriter, Read, Write}; use std::fs::File; use huffman::compress::{compress, read_freq_table}; use binary::binary_writer::BinaryWriter; <|fim_suffix|> if let Ok(f) = File::open(input_file) { let m...
code_fim
hard
{ "lang": "rust", "repo": "cuklev/huffman-archiver-rust", "path": "/src/commands/compress.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn compress_file_to_stream<W: Write>(input_file: &str, output_stream: &mut W) { let freq_table = { if let Ok(f) = File::open(input_file) { let mut input_stream = BufReader::new(f).bytes(); read_freq_table(&mut input_stream) } else { [0; 256] ...
code_fim
hard
{ "lang": "rust", "repo": "cuklev/huffman-archiver-rust", "path": "/src/commands/compress.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Err(CmdError::NotImplemented(args.to_string())) } fn real_exec(&mut self, context: &mut Context) -> Result<(), CmdError> { // let mut point = &mut let i = self.point; context.geometry.points[i] += &self.nudge; // point += self.nudge; Ok(()) } ...
code_fim
hard
{ "lang": "rust", "repo": "maxdee/freeliner-rs", "path": "/src/cmd.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maxdee/freeliner-rs path: /src/cmd.rs str) -> Result<Box<Command>, CmdError> { let mut split = args.split_whitespace(); let context_name = split .next() .ok_or_else(|| CmdError::Malformed(format!("missing context name : {}", args)))? .to_string...
code_fim
hard
{ "lang": "rust", "repo": "maxdee/freeliner-rs", "path": "/src/cmd.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maxdee/freeliner-rs path: /src/cmd.rs sub commands?? pub struct CommandFactory { cmd_map: HashMap<&'static str, Box<Command>>, } impl Default for CommandFactory { fn default() -> Self { let mut cmd_map: HashMap<&'static str, Box<Command>> = HashMap::new(); Self { cmd_ma...
code_fim
hard
{ "lang": "rust", "repo": "maxdee/freeliner-rs", "path": "/src/cmd.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: forkkit/tapdance path: /tapdance-rust-logic/src/tapdance_session.rs r::ClientStream); } } // If not called from (ultimately) within a driver, you must follow it up // with your own self.some_driver.sessions_to_drop.push_back(td.session_id). pub fn end_whole_session_error...
code_fim
hard
{ "lang": "rust", "repo": "forkkit/tapdance", "path": "/tapdance-rust-logic/src/tapdance_session.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: forkkit/tapdance path: /tapdance-rust-logic/src/tapdance_session.rs } pub fn send_reconnect_to_client(&mut self) { let data = protocol_sta2cli::make_confirm_reconnect_msg(); if self.cli_pair.write_skipping_buffer(data.as_slice()) == WriteStat:...
code_fim
hard
{ "lang": "rust", "repo": "forkkit/tapdance", "path": "/tapdance-rust-logic/src/tapdance_session.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(test)] mod tests { use protobuf; use signalling::ClientToStation; use session_id::SessionId; #[test] fn format_failed_decoys() { let session_id = SessionId::new(&[255,255,255,255,255,255,255,255, 255,255,255,255,255,255,255,255]); let mut msg1 ...
code_fim
hard
{ "lang": "rust", "repo": "forkkit/tapdance", "path": "/tapdance-rust-logic/src/tapdance_session.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AlecGoncharow/i3blocks-cmus path: /src/main.rs use std::process::{Command, exit}; use std::str; use std::env; fn main() { let cmus_call = Command::new("cmus-remote") .arg("-Q") .output() .expect("Failed to query cmus-remote"); let output = match str::from_utf8(&...
code_fim
hard
{ "lang": "rust", "repo": "AlecGoncharow/i3blocks-cmus", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match artist { Some(a) => { match title { Some(t) => println!("{} - {}", a, t), None => println!("{}", a) } } None => { match title { Some(t) => println!("{}", t), None => () ...
code_fim
hard
{ "lang": "rust", "repo": "AlecGoncharow/i3blocks-cmus", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let object = Box::from_raw(object as *mut ScopeMeasure); object.stopover(stopover_name); // Don't destroy the object when the function finishes mem::forget(object); }) }<|fim_prefix|>// repo: rvasin/newsboat path: /rust/libnewsboat-ffi/src/scopemeasure.rs use crate::a...
code_fim
hard
{ "lang": "rust", "repo": "rvasin/newsboat", "path": "/rust/libnewsboat-ffi/src/scopemeasure.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rvasin/newsboat path: /rust/libnewsboat-ffi/src/scopemeasure.rs use crate::abort_on_panic; use libc::{c_char, c_void}; use libnewsboat::scopemeasure::ScopeMeasure; use std::ffi::CStr; use std::mem; #[no_mangle] pub unsafe extern "C" fn create_rs_scopemeasure(scope_name: *const c_char) -> *mut c...
code_fim
hard
{ "lang": "rust", "repo": "rvasin/newsboat", "path": "/rust/libnewsboat-ffi/src/scopemeasure.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dragonrider7225/java_class_manipulation path: /src/lib.rs rror> for CrateError { fn from(cpe: ClassParseError) -> Self { match cpe { ClassParseError::IoError(e) => e.into(), ClassParseError::NomError(e) => e.into(), ClassParseError::CPAccessError(e...
code_fim
hard
{ "lang": "rust", "repo": "dragonrider7225/java_class_manipulation", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dragonrider7225/java_class_manipulation path: /src/lib.rs Either<L, O> where F: FnOnce(R) -> O, { match self { Self::Left(l) => Either::Left(l), Self::Right(r) => Either::Right(f(r)), } } } impl<T> Either<T, T> { /// Return the inn...
code_fim
hard
{ "lang": "rust", "repo": "dragonrider7225/java_class_manipulation", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// The class, method, or field is not present in the associated source. fn is_synthetic(&self) -> bool; // 0x1000 /// The class is an annotation type: declared as "@interface". fn is_annotation(&self) -> bool; // 0x2000 /// The class or field is an enum or enum constant. fn is_enu...
code_fim
hard
{ "lang": "rust", "repo": "dragonrider7225/java_class_manipulation", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lpc55/lpc55-pac path: /src/dma0/intstat.rs #[doc = "Register `INTSTAT` reader"] pub struct R(crate::R<INTSTAT_SPEC>); impl core::ops::Deref for R { type Target = crate::R<INTSTAT_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl From<crate::R<IN...
code_fim
hard
{ "lang": "rust", "repo": "lpc55/lpc55-pac", "path": "/src/dma0/intstat.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Summarizes whether any error interrupts are pending.\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug, PartialEq)] pub enum ACTIVEERRINT_A { #[doc = "0: Not pending. No error interrupts are pending."] NOT_PENDING = 0, #[doc = "1: Pending. At least one error i...
code_fim
hard
{ "lang": "rust", "repo": "lpc55/lpc55-pac", "path": "/src/dma0/intstat.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/lumol-python path: /src/sys/cell.rs use cpython::{PyObject, PyResult, ToPyObject, PythonObject}; use std::cell::RefCell; use lumol; use cpython::py_class::CompareOp; use traits::Callback; register!(|py, m| { try!(m.add_class::<CellShape>(py)); try!(m.add_class::<UnitCell>(py))...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/lumol-python", "path": "/src/sys/cell.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> def __richcmp__(&self, other: &PyObject, op: CompareOp) -> PyResult<PyObject> { let other = match other.extract::<CellShape>(py) { Ok(other) => other, Err(_) => return Ok(py.NotImplemented()) }; match op { CompareOp::Eq => { l...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/lumol-python", "path": "/src/sys/cell.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let UnitCell = py.get_type::<UnitCell>(); let CellShape = py.get_type::<CellShape>(); py_run_with!(py, UnitCell, CellShape; "cell = UnitCell(3, 4, 5)", "assert cell.a() == 3.0", "assert cell.b() == 4.0", "...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/lumol-python", "path": "/src/sys/cell.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shulhi/wakelan path: /src/main.rs use std::env; use std::fmt; use std::net; use std::num::ParseIntError; use std::str::FromStr; fn main() { let mac_addr: String = env::args().nth(1).expect("wakelan <MAC>"); let mac_addr: MacAddr = (&mac_addr).parse().expect("Invalid MAC address"); ...
code_fim
hard
{ "lang": "rust", "repo": "shulhi/wakelan", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Broadcast magic packet to `255:255:255:255:9` pub fn send(&self) -> std::io::Result<()> { let socket = net::UdpSocket::bind((net::Ipv4Addr::new(0, 0, 0, 0), 0))?; socket.set_broadcast(true)?; socket.send_to(&self.packet, (net::Ipv4Addr::new(255, 255, 255, 255), 9))?; ...
code_fim
hard
{ "lang": "rust", "repo": "shulhi/wakelan", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let parsed = value.split(|c| c == ':' || c == '-').enumerate().fold( [0; 6], |mut acc, (idx, byte)| match u8::from_str_radix(byte, 16) { Err(_err) => acc, Ok(v) => { acc[idx] = v; acc } ...
code_fim
hard
{ "lang": "rust", "repo": "shulhi/wakelan", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: forkkit/semaphore path: /general/src/store/geo.rs use std::fmt; use std::path::Path; use crate::protocol::Geo; use crate::types::Annotated; /// A geo ip lookup helper based on maxmind db files. pub struct GeoIpLookup(maxminddb::Reader<Vec<u8>>); impl GeoIpLookup { /// Opens a maxminddb fi...
code_fim
hard
{ "lang": "rust", "repo": "forkkit/semaphore", "path": "/general/src/store/geo.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Some(Geo { country_code: Annotated( city.country .as_ref() .and_then(|country| Some(country.iso_code.as_ref()?.to_string())), Default::default(), ), city: Annotated( city....
code_fim
hard
{ "lang": "rust", "repo": "forkkit/semaphore", "path": "/general/src/store/geo.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emk/jit.rs path: /tests/pi.rs /* #![feature(plugin)] #![plugin(jit_macros)] #[no_link] #[macro_use] extern crate jit_macros; extern crate jit; use jit::*; use std::num::Float; use std::iter::IteratorExt; #[jit] fn pi() -> f64 { <|fim_suffix|> let mut ctx = Context::new(); jit_pi(ctx).with...
code_fim
hard
{ "lang": "rust", "repo": "emk/jit.rs", "path": "/tests/pi.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut ctx = Context::new(); jit_pi(ctx).with(|&:pi| { let pi = pi(()); assert!((pi - 3.1415).abs() < 0.01); }); } */<|fim_prefix|>// repo: emk/jit.rs path: /tests/pi.rs /* #![feature(plugin)] #![plugin(jit_macros)] #[no_link] #[macro_use] extern crate jit_macros; extern crat...
code_fim
hard
{ "lang": "rust", "repo": "emk/jit.rs", "path": "/tests/pi.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> app: &mut debugger::Debugger, builder: &std::sync::Arc<std::sync::Mutex<gtk::Builder>>, ) { let builder = builder.lock().unwrap(); let ax_value: gtk::Label = builder.get_object("ax_value").unwrap(); let bx_value: gtk::Label = builder.get_object("bx_value").unwrap(); let cx_value: ...
code_fim
hard
{ "lang": "rust", "repo": "nicklaswj/dustbox-rs", "path": "/src/interface.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let ds_value: gtk::Label = builder.get_object("ds_value").unwrap(); let cs_value: gtk::Label = builder.get_object("cs_value").unwrap(); let es_value: gtk::Label = builder.get_object("es_value").unwrap(); let fs_value: gtk::Label = builder.get_object("fs_value").unwrap(); ds_value.set_...
code_fim
hard
{ "lang": "rust", "repo": "nicklaswj/dustbox-rs", "path": "/src/interface.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nicklaswj/dustbox-rs path: /src/interface.rs #![allow(unused_imports)] use std; use std::sync::{Arc, Mutex}; use std::rc::Rc; use std::cell::RefCell; use std::io::prelude::*; use gtk; use gtk::prelude::*; use gtk::{Button, Image, Label, Window, WindowType}; use gdk::enums::key; use gdk::RGBA;...
code_fim
hard
{ "lang": "rust", "repo": "nicklaswj/dustbox-rs", "path": "/src/interface.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32h5/src/stm32h573/i2c1/timingr.rs #[doc = "Register `TIMINGR` reader"] pub type R = crate::R<TIMINGR_SPEC>; #[doc = "Register `TIMINGR` writer"] pub type W = crate::W<TIMINGR_SPEC>; #[doc = "Field `SCLL` reader - SCL low period (master mode) This field is u...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32h5/src/stm32h573/i2c1/timingr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_use] pub fn sdadel(&mut self) -> SDADEL_W<TIMINGR_SPEC, 16> { SDADEL_W::new(self) } #[doc = "Bits 20:23 - Data setup time This field is used to generate a delay tSCLDEL between SDA edge and SCL rising edge. In master mode and in slave mode with NOSTRETCH = 0, the SCL line is stretched...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32h5/src/stm32h573/i2c1/timingr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( Config { sandbox: SandboxConfig { user: Some(String::from("foo")), chroot: Some(String::from("/var/empty")), }, }, config ); } }<|fim_prefix|>// repo: code-developers...
code_fim
hard
{ "lang": "rust", "repo": "code-developers/packetkit", "path": "/src/sandbox/config.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: code-developers/packetkit path: /src/sandbox/config.rs use crate::errors::*; use serde::Deserialize; use std::fs; use std::path::Path; #[derive(Debug, Default, Deserialize, PartialEq)] pub struct Config { pub sandbox: SandboxConfig, } #[derive(Debug, Default, Deserialize, PartialEq)] pub s...
code_fim
hard
{ "lang": "rust", "repo": "code-developers/packetkit", "path": "/src/sandbox/config.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zebp/clircle path: /src/lib.rs //! The `clircle` crate helps you detect IO circles in your CLI applications. //! //! Imagine you want to read data from a couple of files and output something according to the //! contents of these files. If the user redirects the output of your program to one of ...
code_fim
hard
{ "lang": "rust", "repo": "zebp/clircle", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self::try_from(Stdio::Stdout).ok() } #[must_use] /// Shorthand for `try_from(Stdio::Stderr)`. fn stderr() -> Option<Self> { Self::try_from(Stdio::Stderr).ok() } } /// The three stdio streams. #[derive(Clone, Copy, Debug, PartialEq, Eq)] #[cfg_attr(feature = "serde", d...
code_fim
hard
{ "lang": "rust", "repo": "zebp/clircle", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn contains_duplicates<T>(items: Vec<T>) -> bool where T: Eq + Hash, { let mut set = HashSet::new(); items.into_iter().any(|item| !set.insert(item)) } #[test] fn test_basic_comparisons() -> Result<(), &'static str> { let dir = tempfile::tempdir().ex...
code_fim
hard
{ "lang": "rust", "repo": "zebp/clircle", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let input = "\ # ls\n\ ```\n\ ls -l\n\ ```\n\ \n\ This is the about section\n\ \n\ ## some section\n\ This is some section\n"; assert_eq!(parse_about(input), "This is the about sect...
code_fim
hard
{ "lang": "rust", "repo": "uutils/coreutils", "path": "/src/uuhelp_parser/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: uutils/coreutils path: /src/uuhelp_parser/src/lib.rs // This file is part of the uutils coreutils package. // // For the full copyright and license information, please view the LICENSE // file that was distributed with this source code. //! A collection of functions to parse the markdown code o...
code_fim
hard
{ "lang": "rust", "repo": "uutils/coreutils", "path": "/src/uuhelp_parser/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mjkoo/rtxon path: /src/camera.rs use rand::random; use crate::types::{Point3, Ray, Scalar, Vector3}; /// Sample a random point in the unit disk via rejection fn random_in_unit_disk() -> Vector3 { let offset = Vector3::new(1.0, 1.0, 0.0); let mut p: Vector3; while { p = 2.0 ...
code_fim
hard
{ "lang": "rust", "repo": "mjkoo/rtxon", "path": "/src/camera.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Self { origin, lower_left_corner: origin - half_width * focal_length * u - half_height * focal_length * v - focal_length * w, horizontal: 2.0 * half_width * focal_length * u, vertical: 2.0 * half_height...
code_fim
hard
{ "lang": "rust", "repo": "mjkoo/rtxon", "path": "/src/camera.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Valentine-Mario/Spacies path: /server/src/controllers/user_chat_controller.rs use crate::auth; use crate::diesel::QueryDsl; use crate::diesel::RunQueryDsl; use crate::handlers::paginate::*; use crate::handlers::types::*; use crate::model::{ChatList, User, UserChat}; use crate::schema::unread_use...
code_fim
hard
{ "lang": "rust", "repo": "Valentine-Mario/Spacies", "path": "/server/src/controllers/user_chat_controller.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let all_chats: (Vec<(UserChat, User)>, i64) = UserChat::belonging_to(&user) .inner_join(users) .filter(user_id.eq_any(vec![&user.id, &other_user_id.id])) .filter(reciever.eq_any(vec![&user.id, &other_user_id.id])) .order(user_chat_id.desc()) .paginate(item.page)...
code_fim
hard
{ "lang": "rust", "repo": "Valentine-Mario/Spacies", "path": "/server/src/controllers/user_chat_controller.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let me = &mut *self; let mut read_buf = ReadBuf::uninit(&mut me.buf[..]); match Pin::new(&mut me.file).poll_read(cx, &mut read_buf) { Poll::Ready(Ok(())) => { let filled = read_buf.filled(); if filled.is_empty() { Poll...
code_fim
hard
{ "lang": "rust", "repo": "sk4zuzu/rust-rsrch", "path": "/hyper/serve-static/src/stream.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sk4zuzu/rust-rsrch path: /hyper/serve-static/src/stream.rs use futures_util::stream::Stream; use futures_util::task::{Context, Poll}; use hyper::body::Bytes; use std::mem::MaybeUninit; use std::pin::Pin; use tokio::fs::File; use tokio::io::{AsyncRead, ReadBuf}; const BUF_SIZE: usize = 8*1024; ...
code_fim
hard
{ "lang": "rust", "repo": "sk4zuzu/rust-rsrch", "path": "/hyper/serve-static/src/stream.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>#[inline] pub(crate) fn _waitpid( pid: RawPid, waitopts: WaitOptions, ) -> io::Result<Option<(Pid, WaitStatus)>> { unsafe { let mut status = MaybeUninit::<u32>::uninit(); let pid = ret_c_int(syscall!( __NR_wait4, c_int(pid as _), &mut status,...
code_fim
hard
{ "lang": "rust", "repo": "giodamelio/little_boxes", "path": "/vendor/rustix/src/backend/linux_raw/process/syscalls.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: giodamelio/little_boxes path: /vendor/rustix/src/backend/linux_raw/process/syscalls.rs NFINITY, RLIM_INFINITY, }; use linux_raw_sys::ioctl::TIOCSCTTY; #[cfg(feature = "fs")] use {crate::backend::conv::ret_c_uint_infallible, crate::fs::Mode}; #[cfg(feature = "fs")] #[inline] pub(crate) fn chdir(...
code_fim
hard
{ "lang": "rust", "repo": "giodamelio/little_boxes", "path": "/vendor/rustix/src/backend/linux_raw/process/syscalls.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // `waitid` can return successfully without initializing the struct (no // children found when using `WNOHANG`) let mut status = MaybeUninit::<c::siginfo_t>::zeroed(); unsafe { ret(syscall!( __NR_waitid, c_uint(c::P_ALL), c_uint(0), b...
code_fim
hard
{ "lang": "rust", "repo": "giodamelio/little_boxes", "path": "/vendor/rustix/src/backend/linux_raw/process/syscalls.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: open-telemetry/opentelemetry-rust path: /opentelemetry-sdk/src/testing/metrics/metric_reader.rs use std::sync::Weak; use crate::metrics::{ aggregation::Aggregation, data::{ResourceMetrics, Temporality}, instrument::InstrumentKind, pipeline::Pipeline, reader::{AggregationSele...
code_fim
medium
{ "lang": "rust", "repo": "open-telemetry/opentelemetry-rust", "path": "/opentelemetry-sdk/src/testing/metrics/metric_reader.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn shutdown(&self) -> Result<()> { self.force_flush() } } impl AggregationSelector for TestMetricReader { fn aggregation(&self, _kind: InstrumentKind) -> Aggregation { Aggregation::Drop } } impl TemporalitySelector for TestMetricReader { fn temporality(&self, _kind: I...
code_fim
hard
{ "lang": "rust", "repo": "open-telemetry/opentelemetry-rust", "path": "/opentelemetry-sdk/src/testing/metrics/metric_reader.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> thread_list.push(thread::Builder::new().name("Exporter".to_string()).spawn(move || { threads::exporter::exporte(receiver); })); if opts.exporter != None { let prometheus_listener = opts.exporter.unwrap().clone(); thread_list.push(thread::Builder::new().name("Prometheus...
code_fim
hard
{ "lang": "rust", "repo": "cdeconinck/ipfix", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // init the app logger env_logger::Builder::new().format_timestamp_millis().filter(None, opts.log_level).init(); info!("Starting App"); let mut thread_list = vec![]; let (sender, receiver) = channel(); let listener_url = opts.listener.clone(); thread_list.push(thread::Builde...
code_fim
hard
{ "lang": "rust", "repo": "cdeconinck/ipfix", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cdeconinck/ipfix path: /src/main.rs use log::info; use log::LevelFilter; use std::net::SocketAddr; use std::sync::mpsc::channel; use std::thread; use structopt::StructOpt; #[cfg(test)] #[macro_use] extern crate pretty_assertions; #[macro_use] extern crate num_derive; mod flow; mod threads; #...
code_fim
medium
{ "lang": "rust", "repo": "cdeconinck/ipfix", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FroVolod/cli_dialoguer_strum path: /src/cli_command/on_off_line_mode/server/mod.rs use structopt::StructOpt; use strum_macros::{ Display, EnumString, EnumVariantNames, }; use strum::VariantNames; use dialoguer::{ Select, Input, theme::ColorfulTheme, console::Term }; ...
code_fim
hard
{ "lang": "rust", "repo": "FroVolod/cli_dialoguer_strum", "path": "/src/cli_command/on_off_line_mode/server/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ActionSubcommand { pub fn choose_action_command() -> Self { let action_subcommands= ActionSubcommand::VARIANTS; let select_action_subcommand = Select::with_theme(&ColorfulTheme::default()) .with_prompt("Select an action that you want to add to the action:") ...
code_fim
hard
{ "lang": "rust", "repo": "FroVolod/cli_dialoguer_strum", "path": "/src/cli_command/on_off_line_mode/server/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: atarv/audioprogramming path: /chapter6/filter/src/main.rs //! Small application to test applying various types of filters to a saw wave use clap::{App, Arg}; use hound; use std::f32::consts::PI; const SAMPLE_RATE: u32 = 44100; // TODO: Let user choose sample rate const WAVETABLE_LENGTH: usize ...
code_fim
hard
{ "lang": "rust", "repo": "atarv/audioprogramming", "path": "/chapter6/filter/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Simple first order lowpass filter fn lowpass<'a>( signal: &'a mut [i16], cutoff_freq: f32, delay: &mut i16, sample_rate: u32, ) -> &'a mut [i16] { let cos_theta = 2. - f32::cos(2. * PI * cutoff_freq / sample_rate as f32); let coefficient = (cos_theta.powf(2.) - 1.).sqrt() - cos...
code_fim
hard
{ "lang": "rust", "repo": "atarv/audioprogramming", "path": "/chapter6/filter/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Zalasus/adventofcode2020 path: /day11/src/main.rs #[derive(PartialEq, Clone, Copy, Debug)] enum Cell { Floor, Seat, OccupiedSeat } type Coord = (isize, isize); const MOORE_NEIGHBOURHOOD : &[Coord] = &[(1,0), (1,-1), (0,-1), (-1,-1), (-1,0), (-1,1), (0,1), (1,1)]; struct Automa...
code_fim
hard
{ "lang": "rust", "repo": "Zalasus/adventofcode2020", "path": "/day11/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl SightlineRuleset { pub fn new(automaton: &Automaton) -> Self { // by precomputing the visibility for each seat, we can improve performance by quite a bit let mut visibility = Vec::new(); visibility.resize(automaton.width*automaton.height, [None; 8]); for y in 0..au...
code_fim
hard
{ "lang": "rust", "repo": "Zalasus/adventofcode2020", "path": "/day11/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(automaton.count_total_occupied_seats(), 37); } #[test] fn simulate_sightlines() { let mut automaton = Automaton::new("L.LL.LL.LL LLLLLLL.LL L.L.L..L.. ...
code_fim
hard
{ "lang": "rust", "repo": "Zalasus/adventofcode2020", "path": "/day11/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Printable for Person { fn print(&self) { println!("Person Print {}", self.name); } } pub struct Demographics { // Cannot make this private and not require initialization age: i32, pub date_of_birth: chrono::DateTime<chrono::offset::Utc> } impl Demographics { pub fn ...
code_fim
hard
{ "lang": "rust", "repo": "mmierke/d-go-rust", "path": "/Rust/oop/app.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> p.print(); } fn poly(e: &Employee) { e.print(); } fn poly_prt<T>(thing: &T) where T: Printable { thing.print(); } pub trait Printable { fn print(&self); } pub struct Person { pub name: String } impl Printable for Person { fn print(&self) { println!("Person Print {}", s...
code_fim
hard
{ "lang": "rust", "repo": "mmierke/d-go-rust", "path": "/Rust/oop/app.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mmierke/d-go-rust path: /Rust/oop/app.rs extern crate chrono; use std::io; use chrono::prelude::*; fn main() { println!("OOP in Rust!\n"); let mut a = Employee { demo: Demographics { age: 0, date_of_birth: Utc.ymd(1970, 5, 8).and_hms(12,0,9) }, ...
code_fim
hard
{ "lang": "rust", "repo": "mmierke/d-go-rust", "path": "/Rust/oop/app.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// @p procedure delete_token_ref(@!p:pointer); {|p| points to the reference count // of a token list that is losing one reference} // begin if token_ref_count(p)=null then flush_list(p) // else decr(token_ref_count(p)); // end; //<|fim_prefix|>// repo: bpzj/tex-rs path: /src/section_0200.rs //! @ First...
code_fim
hard
{ "lang": "rust", "repo": "bpzj/tex-rs", "path": "/src/section_0200.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bpzj/tex-rs path: /src/section_0200.rs //! @ First, however, we shall consider two non-recursive procedures that do //! simpler tasks. The first of these, |delete_token_ref|, is called when //! a pointer to a token list's reference count is being removed. This means //! that the token list shoul...
code_fim
hard
{ "lang": "rust", "repo": "bpzj/tex-rs", "path": "/src/section_0200.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: riscv-rust/gd32vf103-pac path: /src/usbfs_global/diep3tflen.rs #[doc = "Register `DIEP3TFLEN` reader"] pub struct R(crate::R<DIEP3TFLEN_SPEC>); impl core::ops::Deref for R { type Target = crate::R<DIEP3TFLEN_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 ...
code_fim
hard
{ "lang": "rust", "repo": "riscv-rust/gd32vf103-pac", "path": "/src/usbfs_global/diep3tflen.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> &mut self.0 } } impl From<crate::W<DIEP3TFLEN_SPEC>> for W { #[inline(always)] fn from(writer: crate::W<DIEP3TFLEN_SPEC>) -> Self { W(writer) } } #[doc = "Field `IEPTXRSAR` reader - IN endpoint FIFO4 transmit RAM start address"] pub type IEPTXRSAR_R = crate::FieldReader<u16...
code_fim
hard
{ "lang": "rust", "repo": "riscv-rust/gd32vf103-pac", "path": "/src/usbfs_global/diep3tflen.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }