text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>use varuint::*; use std::collections::*; pub fn vb_encode(v:HashSet<u32>) -> std::io::Cursor<std::vec::Vec<u8>> { let mut v:Vec<&u32> = v.iter().collect(); let mut cursor = Cursor::new(vec![]); v.sort(); cursor.write_varint(v[0].clone()).unwrap(); for i in 1..v.len() { let _ =...
code_fim
medium
{ "lang": "rust", "repo": "b-voilov/info_retrieval", "path": "/lib/src/main/collections/ondisk_index/vec_utils.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: b-voilov/info_retrieval path: /lib/src/main/collections/ondisk_index/vec_utils.rs pub fn chunkinfy(vec_len: usize, chunk_num: usize) -> Vec<usize> { let chunk_size: usize = vec_len / chunk_num; let mut res_vec: Vec<usize> = (vec![chunk_size]) .iter() ...
code_fim
medium
{ "lang": "rust", "repo": "b-voilov/info_retrieval", "path": "/lib/src/main/collections/ondisk_index/vec_utils.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut expected = HashMap::new(); expected.insert("events".to_owned(), vec!["event_types".to_owned()]); expected.insert("team".to_owned(), vec![]); expected.insert("dev".to_owned(), vec!["team".to_owned()]); expected.insert("event_types".to_owned(), vec![]); ...
code_fim
hard
{ "lang": "rust", "repo": "wayofthepie/sqlsense", "path": "/src/sql.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wayofthepie/sqlsense path: /src/sql.rs use sqlparser::{ ast::{ColumnDef, ColumnOption::ForeignKey, Ident, ObjectName, Statement::CreateTable}, dialect::GenericDialect, parser::Parser, }; use std::collections::HashMap; pub fn map_relationships(sql: &str) -> HashMap<String, Vec<String...
code_fim
hard
{ "lang": "rust", "repo": "wayofthepie/sqlsense", "path": "/src/sql.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn should_return_event_types_as_foreign_key() { let sql = r#" create table event_types(id serial primary key, event_type text); create table events (id serial primary key, event_type integer references event_types); create table team (id serial primary key);...
code_fim
hard
{ "lang": "rust", "repo": "wayofthepie/sqlsense", "path": "/src/sql.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sdbondi/tari path: /dan_layer/core/src/models/view_id.rs // Copyright 2021. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // // 1. Redistributions of source code must retain...
code_fim
hard
{ "lang": "rust", "repo": "sdbondi/tari", "path": "/dan_layer/core/src/models/view_id.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl PartialOrd for ViewId { fn partial_cmp(&self, other: &Self) -> Option<Ordering> { self.0.partial_cmp(&other.0) } } impl From<u64> for ViewId { fn from(v: u64) -> Self { Self(v) } } impl Display for ViewId { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result...
code_fim
hard
{ "lang": "rust", "repo": "sdbondi/tari", "path": "/dan_layer/core/src/models/view_id.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> match response { Response::Ok => Ok(()), Response::NotFound => Err(Error::KeyNotFound), response => Err(Error::ProtocolError(request, response)), } } }<|fim_prefix|>// repo: connec/kvs path: /src/client.rs use rmp_serde::decode::from_read as read_mp...
code_fim
hard
{ "lang": "rust", "repo": "connec/kvs", "path": "/src/client.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: connec/kvs path: /src/client.rs use rmp_serde::decode::from_read as read_mp; use rmp_serde::encode::write as write_mp; use std::net::{TcpStream, ToSocketAddrs}; use crate::error::{Error, Result}; use crate::protocol::{Request, Response}; /// Implements a client for a key-value server. pub stru...
code_fim
hard
{ "lang": "rust", "repo": "connec/kvs", "path": "/src/client.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Remove a key. pub fn remove(&mut self, key: String) -> Result<()> { let request = Request::Remove { key }; write_mp(&mut self.stream, &request)?; let response = read_mp(&self.stream)?; match response { Response::Ok => Ok(()), Response::N...
code_fim
hard
{ "lang": "rust", "repo": "connec/kvs", "path": "/src/client.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: makeapp007/OS2 path: /hw2/src/lib.rs use std::{sync, thread}; use std::cmp::PartialEq; use std::cmp::Ordering; use std::ops::Deref; use std::ops::DerefMut; use std::sync::{Mutex,Condvar}; use std::cell::UnsafeCell; /// Provides a reader-writer lock to protect data of type `T` pub struct RwLock...
code_fim
hard
{ "lang": "rust", "repo": "makeapp007/OS2", "path": "/hw2/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { &*self.__lock.data.get() } } } /// Releases the read lock impl<'a, T> Drop for RwLockReadGuard<'a, T> { // ... fn drop(&mut self) { // println!("------------" ); // unsafe { self.__lock.inner.read_unlock(); } // finish this reader // check Pre...
code_fim
hard
{ "lang": "rust", "repo": "makeapp007/OS2", "path": "/hw2/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn same_type<A,B:Eq<A>>(a: A, b: B) { } fn test<'a,'b>() { // Parens are equivalent to omitting default in angle. eq::< Foo<(isize,),Output=()>, Foo(isize) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up g...
code_fim
hard
{ "lang": "rust", "repo": "delewit/rust", "path": "/src/test/compile-fail/unboxed-closure-sugar-region.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: delewit/rust path: /src/test/compile-fail/unboxed-closure-sugar-region.rs // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICEN...
code_fim
hard
{ "lang": "rust", "repo": "delewit/rust", "path": "/src/test/compile-fail/unboxed-closure-sugar-region.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Parens are equivalent to omitting default in angle. eq::< Foo<(isize,),Output=()>, Foo(isize) >(); // Here we specify 'static explicitly in angle-bracket version. // Parenthesized winds up getting inferred. eq::< Foo<'static, (isize,),Output=()>, ...
code_fim
medium
{ "lang": "rust", "repo": "delewit/rust", "path": "/src/test/compile-fail/unboxed-closure-sugar-region.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MindFlavor/azure-sdk-for-rust path: /services/svc/storagedatalake/src/package_2020_06/operations.rs ttp_client(); let url_str = &format!("{}/{}/{}", operation_config.base_path(), filesystem, path); let mut url = url::Url::parse(url_str).map_err(update::Error::ParseUrlError)?; ...
code_fim
hard
{ "lang": "rust", "repo": "MindFlavor/azure-sdk-for-rust", "path": "/services/svc/storagedatalake/src/package_2020_06/operations.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>Error::ExecuteRequestError)?; match rsp.status() { http::StatusCode::OK => { let rsp_body = rsp.body(); let rsp_value: serde_json::Value = serde_json::from_slice(rsp_body).map_err(|source| read::Error::DeserializeError(source, rsp_bod...
code_fim
hard
{ "lang": "rust", "repo": "MindFlavor/azure-sdk-for-rust", "path": "/services/svc/storagedatalake/src/package_2020_06/operations.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let req_body = bytes::Bytes::from_static(azure_core::EMPTY_BODY); req_builder = req_builder.uri(url.as_str()); let req = req_builder.body(req_body).map_err(create::Error::BuildRequestError)?; let rsp = http_client.execute_request(req).await.map_err(create::Error::ExecuteReq...
code_fim
hard
{ "lang": "rust", "repo": "MindFlavor/azure-sdk-for-rust", "path": "/services/svc/storagedatalake/src/package_2020_06/operations.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kazatsuyu/sulafat path: /macros-impl/src/derive_partial_eq/mod.rs mod r#enum; mod r#struct; use proc_macro2::{Span, TokenStream}; use r#enum::Enum; use r#struct::Struct; use syn::{parse2, Item}; pub fn derive_partial_eq_impl(items: TokenStream) -> syn::Result<TokenStream> { let item = pars...
code_fim
hard
{ "lang": "rust", "repo": "kazatsuyu/sulafat", "path": "/macros-impl/src/derive_partial_eq/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ::std::cmp::PartialEq::eq(&self.a, &other.a) && ::std::cmp::PartialEq::eq(&self.b, &other.b) && true } } } .to_string() ) } }<|fim_prefix|>// repo: kazats...
code_fim
hard
{ "lang": "rust", "repo": "kazatsuyu/sulafat", "path": "/macros-impl/src/derive_partial_eq/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lafolle/Agastya path: /aoc/day5/src/lib.rs // https://adventofcode.com/2017/day/5 // part1: 372139 // part2: 29629538 use std::io::prelude::*; use std::fs::File; #[cfg(test)] mod tests { use super::*; #[test] fn test_part1() { assert_eq!(part1("sample.input"), 5); ...
code_fim
hard
{ "lang": "rust", "repo": "lafolle/Agastya", "path": "/aoc/day5/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut i: usize = 0; let mut steps = 0; loop { let cur = v[i]; steps += 1; if cur > 2 { v[i] = cur - 1; } else { v[i] = cur + 1; } if (i as i32 + cur < 0) || (i as i32 + cur >= v.len() as i32) { break; ...
code_fim
hard
{ "lang": "rust", "repo": "lafolle/Agastya", "path": "/aoc/day5/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> d.padding.left = padding_left.to_px(); d.padding.right = padding_right.to_px(); d.border.left = border_left.to_px(); d.border.right = border_right.to_px(); d.margin.left = margin_left.to_px(); d.margin.right = margin_right.to_px(); } fn calculate_...
code_fim
hard
{ "lang": "rust", "repo": "mi-nakano/toy-browser", "path": "/src/layout.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mi-nakano/toy-browser path: /src/layout.rs struct Dimensions { // Position of the content area relative to the document origin: content: Rect, // Surrounding edges: padding: EdgeSizes, border: EdgeSizes, margin: EdgeSizes, } struct Rect { x: f32, y: f32, wid...
code_fim
hard
{ "lang": "rust", "repo": "mi-nakano/toy-browser", "path": "/src/layout.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HarrisonMc555/adventofcode path: /2022/src/days/day23.rs use std::collections::HashSet; use std::str::FromStr; use counter::Counter; use itertools::Itertools; use crate::days::{Day, Debug, Example, Part}; use crate::{debug_print, debug_println}; const DEBUG: bool = false; pub struct Day23; ...
code_fim
hard
{ "lang": "rust", "repo": "HarrisonMc555/adventofcode", "path": "/2022/src/days/day23.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn get_bounding_box(&self) -> (Position, Position) { let (min_row, max_row) = self .elf_positions .iter() .map(|p| p.row) .minmax() .into_option() .unwrap_or((0, 0)); let (min_col, max_col) = self .elf_...
code_fim
hard
{ "lang": "rust", "repo": "HarrisonMc555/adventofcode", "path": "/2022/src/days/day23.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yopox/LD49 path: /src/title.rs use bevy::prelude::*; use bevy_kira_audio::{Audio, AudioChannel}; use rand::Rng; use rand::distributions::Standard; use crate::{AppState, GlobalData, HEIGHT, MySelf, PlayerData, WIDTH}; use crate::fight::fight_screen::MyFoe; use crate::data::font::TextStyles; use ...
code_fim
hard
{ "lang": "rust", "repo": "yopox/LD49", "path": "/src/title.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>fn setup_data( mut commands: Commands, ) { let mut global_data = GlobalData { next_card_id: 0, // WARNING: the number of cards created before in this function ..Default::default() }; commands.spawn().insert( PlayerData { id: 0, name: "YOU".to...
code_fim
hard
{ "lang": "rust", "repo": "yopox/LD49", "path": "/src/title.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>impl Plugin for TitlePlugin { fn build(&self, app: &mut AppBuilder) { app .add_system_set( SystemSet::on_enter(AppState::Title) .with_system(display_title.system()) .with_system(setup_data.system()) ) ....
code_fim
hard
{ "lang": "rust", "repo": "yopox/LD49", "path": "/src/title.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> let x: &dyn Foo = todo!(); //~^ ERROR the trait `Foo` cannot be made into an object }<|fim_prefix|>// repo: rylev/rust path: /tests/ui/async-await/in-trait/object-safety.rs // edition:2021 // [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty // revisions: current next #![feature(asyn...
code_fim
easy
{ "lang": "rust", "repo": "rylev/rust", "path": "/tests/ui/async-await/in-trait/object-safety.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rylev/rust path: /tests/ui/async-await/in-trait/object-safety.rs // edition:2021 // [next] compile-flags: -Zlower-impl-trait-in-trait-to-assoc-ty // revisions: current next #![feature(async_fn_in_trait)] //~^ WARN the feature `async_fn_in_trait` is incomplete and may not be safe to use and/or c...
code_fim
easy
{ "lang": "rust", "repo": "rylev/rust", "path": "/tests/ui/async-await/in-trait/object-safety.rs", "mode": "psm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Matthias-Fauconneau/iced path: /native/src/widget/pane_grid/title_bar.rs use crate::layout; use crate::pane_grid; use crate::{ Clipboard, Element, Event, Hasher, Layout, Point, Rectangle, Size, }; /// The title bar of a [`Pane`]. /// /// [`Pane`]: struct.Pane.html #[allow(missing_debug_impl...
code_fim
hard
{ "lang": "rust", "repo": "Matthias-Fauconneau/iced", "path": "/native/src/widget/pane_grid/title_bar.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.title.hash(hasher); self.title_size.hash(hasher); self.padding.hash(hasher); } pub(crate) fn layout( &self, renderer: &Renderer, limits: &layout::Limits, ) -> layout::Node { let padding = f32::from(self.padding); let limits ...
code_fim
hard
{ "lang": "rust", "repo": "Matthias-Fauconneau/iced", "path": "/native/src/widget/pane_grid/title_bar.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let title_size = title_layout.size(); let height = title_size.height.max(controls_size.height); title_layout .move_to(Point::new(0.0, (height - title_size.height) / 2.0)); controls_layout.move_to(Point::new(space_before_controls, 0.0)); ...
code_fim
hard
{ "lang": "rust", "repo": "Matthias-Fauconneau/iced", "path": "/native/src/widget/pane_grid/title_bar.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // 다음 라인의 주석을 해제하면 컴파일되지 않습니다; 식사와 함께 // 제공되는 계절 과일은 조회나 수정이 허용되지 않습니다 // meal.seasonal_fruit = String::from("blueberries"); }<|fim_prefix|>// repo: rust-kr/doc.rust-kr.org path: /listings/ch07-managing-growing-projects/listing-07-09/src/lib.rs mod back_of_house { pub struct Breakfast { ...
code_fim
hard
{ "lang": "rust", "repo": "rust-kr/doc.rust-kr.org", "path": "/listings/ch07-managing-growing-projects/listing-07-09/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-kr/doc.rust-kr.org path: /listings/ch07-managing-growing-projects/listing-07-09/src/lib.rs mod back_of_house { pub struct Breakfast { pub toast: String, seasonal_fruit: String, } <|fim_suffix|>pub fn eat_at_restaurant() { // 호밀 (Rye) 토스트를 곁들인 여름철 조식 주문하기 let...
code_fim
hard
{ "lang": "rust", "repo": "rust-kr/doc.rust-kr.org", "path": "/listings/ch07-managing-growing-projects/listing-07-09/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn draw(&mut self, _state: &mut GlobalState, ctx: &mut Context) -> GameResult<()> { let (w,h) = (self.background.width(), self.background.height()); let screen = ggez::graphics::screen_coordinates(ctx); let scale = [screen.w/w as f32, screen.h/h as f32]; ggez::grap...
code_fim
hard
{ "lang": "rust", "repo": "Maix31/rust-platformer", "path": "/src/game_scene.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Maix31/rust-platformer path: /src/game_scene.rs use ggez::{ Context, GameResult, nalgebra as na, graphics::{ DrawParam, Rect, Image, }, input::keyboard::KeyCode, }; use crate::global_state::GlobalState; use crate::scene::{SceneSwitch, Scene}; use...
code_fim
hard
{ "lang": "rust", "repo": "Maix31/rust-platformer", "path": "/src/game_scene.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &mut self, state: &mut GlobalState, ctx: &mut Context, ) -> GameResult<Option<SceneSwitch>> { if state.input.key_released(KeyCode::Escape) { Ok(Some(SceneSwitch::Pop)) } else { Ok(None) } } fn draw(&mut self, _state: ...
code_fim
hard
{ "lang": "rust", "repo": "Maix31/rust-platformer", "path": "/src/game_scene.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: draftedus/tangram path: /app/layouts/document.rs use html::{component, html, raw}; #[derive(Clone)] pub struct PageInfo { pub client_wasm_js_src: Option<String>, } #[component] pub fn Document(page_info: PageInfo) { html! { <> {raw!("<!doctype html>")} <html lang="en"> <head> ...
code_fim
hard
{ "lang": "rust", "repo": "draftedus/tangram", "path": "/app/layouts/document.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>esite=lax`"} </script> {page_info.client_wasm_js_src.map(|client_wasm_js_src| html! { <script type="module"> {raw!(format!(r#"import init from "{}"; init()"#, client_wasm_js_src))} </script> })} </body> </html> </> } }<|fim_prefix|>// repo: draftedus/tangram pa...
code_fim
hard
{ "lang": "rust", "repo": "draftedus/tangram", "path": "/app/layouts/document.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> i = 0; while i < q { let first: usize = read!(); let last: usize = first; println!("{} {}", first_i[first - 1] + 1, last_i[last - 1] + 1); i += 1; } } fn update_arr(arr: &mut [i32], a: usize, b: usize, k: i32) -> () { arr[a] += k; arr[b + 1] -= k; }<|fi...
code_fim
hard
{ "lang": "rust", "repo": "mkadit/rust_test", "path": "/src/Java_Rework/lab1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mkadit/rust_test path: /src/Java_Rework/lab1.rs use text_io::read; pub fn run() { main_function(); } fn main_function() { // Creating the inputs let l: usize = read!(); let n: i32 = read!(); let q: i32 = read!(); let mut i = 0; <|fim_suffix|> // Creating the answers ...
code_fim
hard
{ "lang": "rust", "repo": "mkadit/rust_test", "path": "/src/Java_Rework/lab1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Creating the answers for both beginning and ending flags for i in 1..l as usize { if temp[i] >= 0 { first_i[i] = first; } else { first = i as i32; first_i[i] = i as i32; } } for i in (0..=l - 2).rev() { if -temp[i + 1] ...
code_fim
hard
{ "lang": "rust", "repo": "mkadit/rust_test", "path": "/src/Java_Rework/lab1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } impl R { #[doc = "Bits 0:15 - MirrorCounterCurrent. In full duplex mode this register represents the current value of the datapath's mirror counter which counts up to the value specified by the MirrorCounter field in the FlowControlCounter register. In half duplex mode the regi...
code_fim
hard
{ "lang": "rust", "repo": "rcls/svd2rust-example", "path": "/lpc408x/src/ethernet/flowcontrolstatus.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rcls/svd2rust-example path: /lpc408x/src/ethernet/flowcontrolstatus.rs #[doc = "Register `FLOWCONTROLSTATUS` reader"] pub struct R(crate::R<FLOWCONTROLSTATUS_SPEC>); impl core::ops::Deref for R { type Target = crate::R<FLOWCONTROLSTATUS_SPEC>; #[inline(always)] fn deref(&self) -> &Se...
code_fim
hard
{ "lang": "rust", "repo": "rcls/svd2rust-example", "path": "/lpc408x/src/ethernet/flowcontrolstatus.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // sound (0x0A, 0x00, Some(&Value(v0)), None, None) => EventAst::SoundEffect1 (v0), (0x0A, 0x01, Some(&Value(v0)), None, None) => EventAst::SoundEffect2 (v0), (0x0A, 0x02, Some(&Value(v0)), None, None) => EventAst::SoundEffectTransient (v0), (0x0...
code_fim
hard
{ "lang": "rust", "repo": "fudgepop01/brawllib_rs", "path": "/src/script_ast/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fudgepop01/brawllib_rs path: /src/script_ast/mod.rs None) => EventAst::FrameSpeedModifier { multiplier: v0, unk: 0 }, (0x04, 0x07, Some(&Scalar(v0)), Some(&Value(v1)), None) => EventAst::FrameSpeedModifier { multiplier: v0, unk: v1 }, (0x04, 0x14, Some(&Scalar(...
code_fim
hard
{ "lang": "rust", "repo": "fudgepop01/brawllib_rs", "path": "/src/script_ast/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fudgepop01/brawllib_rs path: /src/script_ast/mod.rs ent::Comparison => Expression::Binary (BinaryExpression { left, right, operator: ComparisonOperator::from_arg(v2) }), // Seems to be just modders using this as a quick hack. script::Requirement::Always =>...
code_fim
hard
{ "lang": "rust", "repo": "fudgepop01/brawllib_rs", "path": "/src/script_ast/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sminez/proc-macro-workshop path: /builder/src/lib.rs use proc_macro::TokenStream; use quote::{format_ident, quote, ToTokens}; use syn::{ parse_macro_input, Attribute, Data::Struct, DataStruct, DeriveInput, Field, Fields::Named, GenericArgument, Ident, Lit, Meta, NestedMeta, PathArguments...
code_fim
hard
{ "lang": "rust", "repo": "sminez/proc-macro-workshop", "path": "/builder/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Corresponding fields on the builder let builder_fields = fields.iter().map(|f| { let name = &f.ident; let ty = &f.ty; // Option types don't get double wrapped and Vecs start empty if wrapped_type("Option", &f.ty).is_some() || push_method(&f).is_some() { ...
code_fim
hard
{ "lang": "rust", "repo": "sminez/proc-macro-workshop", "path": "/builder/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: i39/capsule path: /ffi/src/bindings_rustdoc.rs fy!(rte_xmm), "::", stringify!(u64_) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<rte_xmm>())).pd as *const _ as usize }, 0usize, concat!( "Offset of field: ", ...
code_fim
hard
{ "lang": "rust", "repo": "i39/capsule", "path": "/ffi/src/bindings_rustdoc.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: i39/capsule path: /ffi/src/bindings_rustdoc.rs dgen_ty_1) ) ); assert_eq!( unsafe { &(*(::std::ptr::null::<rte_eth_fdir_filter_info__bindgen_ty_1>())).input_set_conf as *const _ as usize }, 0usize, concat!( "...
code_fim
hard
{ "lang": "rust", "repo": "i39/capsule", "path": "/ffi/src/bindings_rustdoc.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: smallB007/FileManager path: /src/internals/literals/main_ui.rs pub mod widget_names { pub static LEFT_PANEL_ID: &str = "LeftPanel"; pub static RIGHT_PANEL_ID:<|fim_suffix|>anelInfoItem"; pub static RIGHT_PANEL_INFO_ITEM_ID: &str = "RightPanelInfoItem"; } pub mod labels {}<|fim_middle...
code_fim
hard
{ "lang": "rust", "repo": "smallB007/FileManager", "path": "/src/internals/literals/main_ui.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>anelInfoItem"; pub static RIGHT_PANEL_INFO_ITEM_ID: &str = "RightPanelInfoItem"; } pub mod labels {}<|fim_prefix|>// repo: smallB007/FileManager path: /src/internals/literals/main_ui.rs pub mod widget_names { pub static LEFT_PANEL_ID: &str = "LeftPanel"; pub static RIGHT_PANEL_ID:<|fim_middle...
code_fim
hard
{ "lang": "rust", "repo": "smallB007/FileManager", "path": "/src/internals/literals/main_ui.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>sciiPunctuations§ensuhatheasunteahsuneathusneathuasnuhaesnuhaesnuaethusnaetuheasnuth"); println!("ThisIsASampleOfCJKString.祇園精舍の鐘の声、諸行無常の響きあり。娑羅双樹の花の色、盛者必衰の理をあらはす。奢れる人も久しからず、ただ春の夜の夢のごとし。猛き者もつひにはほろびぬ、ひとへに風の前の塵に同じ。"); }<|fim_prefix|>// repo: rust-lang/rustfmt path: /tests/source/string_punctuation.rs /...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustfmt", "path": "/tests/source/string_punctuation.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rustfmt path: /tests/source/string_punctuation.rs // rustfmt-format_strings: true fn main() { println!("ThisIsAReallyLongStringWithNoSpaces.It_should_prefer_to_break_onpunctuation:Likethisssssssssssss"); format!("{}__{}__{}ItShouldOnlyyyyyyyyyyyyyyyyyyyyyyyyyyy<|fim_suffix|>qe...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustfmt", "path": "/tests/source/string_punctuation.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>qeoihapethae8t0aet8haetadbjtaeg;ooeouthaoeutgadlgajduabgoiuadogabudogubaodugbadgadgadga;adoughaoeugbaouea"); println!("sentuhaesnuthaesnutheasunteahusnaethuseantuihaesntdiastnidaetnuhaideuhsenathe。WeShouldSupportNonAsciiPunctuations§ensuhatheasunteahsuneathusneathuasnuhaesnuhaesnuaethusnaetuheasnuth")...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustfmt", "path": "/tests/source/string_punctuation.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] unsafe fn mul_vec_dot_unchecked(&self, v_in: &[T], v_out: &mut [T]) -> T { self.view().mul_vec_dot_unchecked(v_in, v_out) } } macro_rules! to_usize { ($ty:ty) => { impl AsUsize for $ty { #[inline(always)] fn as_usize(&self) -> usize { ...
code_fim
hard
{ "lang": "rust", "repo": "cxzheng/sprsolve", "path": "/src/mat.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cxzheng/sprsolve path: /src/mat.rs use cauchy::Scalar; #[cfg(feature = "parallel")] use rayon::prelude::*; use sprs::{CompressedStorage, CsMatI, CsMatViewI, SpIndex}; use std::{intrinsics::likely, slice::from_raw_parts}; /// An interface for the sparse matrix and dense vector multiplication. //...
code_fim
hard
{ "lang": "rust", "repo": "cxzheng/sprsolve", "path": "/src/mat.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nushell/nushell path: /crates/nu-command/src/strings/str_/join.rs use nu_engine::CallExt; use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{ Category, Example, IntoPipelineData, PipelineData, ShellError, Signature, SyntaxShape, Type, Va...
code_fim
hard
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu-command/src/strings/str_/join.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CodeChain-io/intertrait path: /macros/src/gen_caster.rs use std::str::from_utf8_unchecked; use proc_macro2::TokenStream; use uuid::adapter::Simple; use uuid::Uuid; use quote::format_ident; use quote::quote; use quote::ToTokens; pub fn generate_caster(ty: &impl ToTokens, trait_: &impl ToTokens...
code_fim
medium
{ "lang": "rust", "repo": "CodeChain-io/intertrait", "path": "/macros/src/gen_caster.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> (::std::any::TypeId::of::<#ty>(), Box::new(#new_caster)) } } } const FN_PREFIX: &[u8] = b"__"; const FN_BUF_LEN: usize = FN_PREFIX.len() + Simple::LENGTH; fn new_fn_name(buf: &mut [u8]) -> &str { buf[..FN_PREFIX.len()].copy_from_slice(FN_PREFIX); Uuid::new_v4() .t...
code_fim
hard
{ "lang": "rust", "repo": "CodeChain-io/intertrait", "path": "/macros/src/gen_caster.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_stack_basic_myvec(data: Vec<i64>) { let mut stack = MyVec::new(); for elem in data.iter() { stack.push(*elem); } for elem in data.iter().rev() { prop_assert_eq!(stack.pop(), Some(*elem)); ...
code_fim
hard
{ "lang": "rust", "repo": "Nouzan/my-algo-rs", "path": "/src/ch3/stack.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nouzan/my-algo-rs path: /src/ch3/stack.rs dequeue(&mut self) -> Option<Self::Elem> { if self.as_right_stack().is_empty() { while let Some(elem) = self.as_left_stack().pop() { self.as_right_stack().push(elem); } } if self.as_right_st...
code_fim
hard
{ "lang": "rust", "repo": "Nouzan/my-algo-rs", "path": "/src/ch3/stack.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nouzan/my-algo-rs path: /src/ch3/stack.rs if SinglyLinkedList::is_empty(self) { None } else { self.pop_front() } } fn top(&self) -> Option<&Self::Elem> { self.cursor_front().into_ref() } } /// 共享栈. pub struct SharedStack<T> { ...
code_fim
hard
{ "lang": "rust", "repo": "Nouzan/my-algo-rs", "path": "/src/ch3/stack.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> TestRunner::new() .push(Push::new( BigInt::from(255), zinc_types::IntegerType::U8.into(), )) .push(Push::new( BigInt::from(255), zinc_types::IntegerType::U8.into(), )) .push(Sub) .test(&[0]) } #[test] fn s...
code_fim
hard
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-vm/src/instructions/operators/tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prz23/zinc path: /zinc-vm/src/instructions/operators/tests.rs //! //! The operator instructions overflow tests. //! use num::BigInt; use num::One; use zinc_types::Add; use zinc_types::Push; use zinc_types::Sub; use crate::error::Error; use crate::tests::TestRunner; use crate::tests::TestingEr...
code_fim
hard
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-vm/src/instructions/operators/tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn is_custom_token(&self) -> bool { match self { TokenType::NativeToken { .. } => false, TokenType::CustomToken { .. } => true, } } pub fn query_balance( &self, querier: &impl Querier, exchange_addr: HumanAddr, viewin...
code_fim
hard
{ "lang": "rust", "repo": "hackbg/sienna-amm-shared", "path": "/src/data.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hackbg/sienna-amm-shared path: /src/data.rs use std::fmt; use cosmwasm_std::{ Api, CanonicalAddr, HumanAddr, Querier, StdResult, Env, Uint128, CosmosMsg, WasmMsg, BankMsg, Coin, to_binary, StdError }; use cosmwasm_utils::{ContractInfo, ContractInfoStored}; use schemars::JsonSchema; use ...
code_fim
hard
{ "lang": "rust", "repo": "hackbg/sienna-amm-shared", "path": "/src/data.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ret = unsafe { Esys_HMAC( self.mut_context(), handle.into(), self.required_session_1()?, self.optional_session_2(), self.optional_session_3(), &buffer.clone().into(), alg...
code_fim
hard
{ "lang": "rust", "repo": "eclipseo/rust-tss-esapi", "path": "/tss-esapi/src/context/tpm_commands/symmetric_primitives.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: eclipseo/rust-tss-esapi path: /tss-esapi/src/context/tpm_commands/symmetric_primitives.rs // Copyright 2021 Contributors to the Parsec project. // SPDX-License-Identifier: Apache-2.0 use crate::{ handles::{ObjectHandle, TpmHandle}, interface_types::{algorithm::HashingAlgorithm, resource_...
code_fim
hard
{ "lang": "rust", "repo": "eclipseo/rust-tss-esapi", "path": "/tss-esapi/src/context/tpm_commands/symmetric_primitives.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Converts from an [`&Expr<E>`](Expr) to an [`Option`]`<`[`&E::Group`](Expression::Group)`>`. #[must_use] #[inline] pub fn group_ref(&self) -> Option<&E::Group> { match self { Expr::Group(group) => Some(group), _ => None, } } /// Returns t...
code_fim
hard
{ "lang": "rust", "repo": "qdeduction/exprz", "path": "/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qdeduction/exprz path: /src/lib.rs , { /// Indexed Parallel Iterator over [`GroupReference::Item`] type IndexedParIter<'e>: IndexedParallelIterator<Item = <Self as GroupReference<E>>::Item<'e>> where E: 'e; /// Returns an indexed parallel group reference iterator. fn...
code_fim
hard
{ "lang": "rust", "repo": "qdeduction/exprz", "path": "/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qdeduction/exprz path: /src/lib.rs F: FnMut(&E::Atom) -> E, { ExprRef::substitute_ref(&self.cases(), f) } } impl<'e, E> Reference<'e, E> for &'e E where E: Expression, { #[inline] fn cases(self) -> ExprRef<'e, E> { self.cases() } } impl<'e, E> Referen...
code_fim
hard
{ "lang": "rust", "repo": "qdeduction/exprz", "path": "/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/ant-colony-optimization path: /src/bin/aco_using_ram.rs extern crate aco_rust; //mod aco_no_mem; use aco_rust::*; use std::collections::HashMap; use std::fs::File; use std::io::BufRead; use std::io::BufReader; use std::f64::INFINITY; <|fim_suffix|> //println!("{:?}", distance); ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/ant-colony-optimization", "path": "/src/bin/aco_using_ram.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HectorIGH/Competitive-Programming path: /Leetcode Challenge/06_June_2020/Rust/Week 4/2_Count Complete Tree Nodes.rs //Given a complete binary tree, count the number of nodes. // //Note: // //Definition of a complete binary tree from Wikipedia: //In a complete binary tree every level, except poss...
code_fim
hard
{ "lang": "rust", "repo": "HectorIGH/Competitive-Programming", "path": "/Leetcode Challenge/06_June_2020/Rust/Week 4/2_Count Complete Tree Nodes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>w().left.clone(); } node = v.borrow().right.clone(); while let Some(n) = node { r += 1; node = n.borrow().right.clone(); } if l == r { 2i32.pow(l) - 1 } else { 1 + Soluti...
code_fim
hard
{ "lang": "rust", "repo": "HectorIGH/Competitive-Programming", "path": "/Leetcode Challenge/06_June_2020/Rust/Week 4/2_Count Complete Tree Nodes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut result = vec![0; n]; for k in 1..segments.len() { let left = segments[k - 1]; let right = segments[k]; let mut odd = 0; let mut even = 0; for i in left..right { if i % 2 == 0 { even += 1; } else { ...
code_fim
hard
{ "lang": "rust", "repo": "likr/atcoder", "path": "/abc136/src/bin/d.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: likr/atcoder path: /abc136/src/bin/d.rs use proconio::input; #[allow(unused_imports)] use proconio::marker::*; #[allow(unused_imports)] use std::cmp::*; #[allow(unused_imports)] use std::collections::*; #[allow(unused_imports)] use std::f64::consts::*; <|fim_suffix|>#[allow(unused_macros)] macr...
code_fim
medium
{ "lang": "rust", "repo": "likr/atcoder", "path": "/abc136/src/bin/d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in 1..=7 { buf.add(i); assert!(buf.size() == i as usize); } if let Some(val) = buf.peek() { assert!(val == 1); } assert!(buf.size() == 7); for i in 1..=7 { if let Some(val) = buf.remove() { ...
code_fim
hard
{ "lang": "rust", "repo": "shpun817/Ring-Buffer", "path": "/src/ring_buffer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shpun817/Ring-Buffer path: /src/ring_buffer.rs pub struct RingBuffer<T> { data: Vec<T>, front: usize, // First to remove end: usize, // Last to remove capacity: usize, // Fixed is_empty: bool, // To distinguish 1 element and none } impl<T> RingBuffer<T> where T: Copy + Defau...
code_fim
hard
{ "lang": "rust", "repo": "shpun817/Ring-Buffer", "path": "/src/ring_buffer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arcnmx/rust-crowbar path: /src/lib.rs //! crowbar makes it easy to write AWS Lambda functions in Rust. It wraps native Rust functions //! into CPython modules that handle converting Python objects into Rust objects and back again. //! //! # Usage //! //! Add both crowbar and cpython to your `Car...
code_fim
hard
{ "lang": "rust", "repo": "arcnmx/rust-crowbar", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns the remaining execution time, in milliseconds, until AWS Lambda terminates the /// function. /// /// This returns `ContextError::GetRemainingTimeFailed` if crowbar is unable to call the method /// or cast it to a `u64` from the Python object. This should generally never hap...
code_fim
hard
{ "lang": "rust", "repo": "arcnmx/rust-crowbar", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.state.mapped_files = vec![]; self.state.save()?; let mut op = |dir: &Path| { for entry in fs::read_dir(dir)? { let path = entry?.path(); if path.is_file() { if let Some(path) = path.to_str() { ...
code_fim
hard
{ "lang": "rust", "repo": "Lyr-7D1h/dotfiles_importer_revamped", "path": "/dimportd/src/importer/link.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Lyr-7D1h/dotfiles_importer_revamped path: /dimportd/src/importer/link.rs use crate::util::find_equal_dir; use crate::REPOSITORY_DIR; use log::{debug, info}; use crate::{util::find_equal_files, Importer, BACKUP_DIR}; use std::fs; use std::io; use std::io::Error; use std::os::unix::fs::symlink; u...
code_fim
hard
{ "lang": "rust", "repo": "Lyr-7D1h/dotfiles_importer_revamped", "path": "/dimportd/src/importer/link.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.recurse_with_config(&link) } pub fn restore(&self) -> Result<(), Error> { info!("Restoring from backup"); let op = |_from: &Path, to: &Path, _cur: &Path| { // Remove all symbolic links made if let Ok(meta) = to.symlink_metadata() { ...
code_fim
hard
{ "lang": "rust", "repo": "Lyr-7D1h/dotfiles_importer_revamped", "path": "/dimportd/src/importer/link.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn decompress(&mut self, v: &[u8]) -> io::Result<Vec<u8>>; }<|fim_prefix|>// repo: zBaitu/cql-protocol path: /src/compression.rs use std::io; #[derive(Clone, Copy, Debug, Display, EnumString, PartialEq)] pub enum Compression { #[strum(serialize = "lz4")] Lz4, #[strum(serialize = "snappy"...
code_fim
medium
{ "lang": "rust", "repo": "zBaitu/cql-protocol", "path": "/src/compression.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zBaitu/cql-protocol path: /src/compression.rs use std::io; #[derive(Clone, Copy, Debug, Display, EnumString, PartialEq)] pub enum Compression { #[strum(serialize = "lz4")] Lz4, #[strum(serialize = "snappy")] Snappy, } <|fim_suffix|> fn decompress(&mut self, v: &[u8]) -> io::...
code_fim
medium
{ "lang": "rust", "repo": "zBaitu/cql-protocol", "path": "/src/compression.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: breezewish/trace2 path: /trace2_macro/lib.rs #![recursion_limit = "128"] extern crate proc_macro; extern crate proc_macro2; #[macro_use] extern crate syn; #[macro_use] extern crate quote; <|fim_suffix|>#[proc_macro_attribute] pub fn trace2( args: proc_macro::TokenStream, input: proc_ma...
code_fim
easy
{ "lang": "rust", "repo": "breezewish/trace2", "path": "/trace2_macro/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[proc_macro_attribute] pub fn trace2( args: proc_macro::TokenStream, input: proc_macro::TokenStream, ) -> proc_macro::TokenStream { folder::Folder::fold(args.into(), input.into()).into() }<|fim_prefix|>// repo: breezewish/trace2 path: /trace2_macro/lib.rs #![recursion_limit = "128"] extern ...
code_fim
easy
{ "lang": "rust", "repo": "breezewish/trace2", "path": "/trace2_macro/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: coltonhurst/tinymd path: /src/main.rs use std::fs::File; use std::io::Write; use std::io::{BufRead, BufReader}; use std::path::Path; fn parse_markdown_file(_filename: &str) { print_short_banner(); println!("[ INFO ] Starting parser!"); // Create a path variable from the filename ...
code_fim
hard
{ "lang": "rust", "repo": "coltonhurst/tinymd", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Create an output file based on the input file, minus ".md" let _output_filename = &_filename[.._filename.len() - 3]; let mut output_filename = String::from(_output_filename); output_filename.push_str(".html"); let mut outfile = File::create(output_filename.to_string()).expe...
code_fim
hard
{ "lang": "rust", "repo": "coltonhurst/tinymd", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> print_short_banner(); println!( "Written by: {}\nHomepage: {}\nUsage: tinymd <somefile>.md\n", env!("CARGO_PKG_AUTHORS"), env!("CARGO_PKG_HOMEPAGE") ); } fn usage() { print_long_banner(); } fn main() { let args: Vec<String> = std::env::args().collect(); m...
code_fim
hard
{ "lang": "rust", "repo": "coltonhurst/tinymd", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn hb(&self, ctx: &mut <Self as Actor>::Context) { ctx.run_interval(HEARTBEAT_INTERVAL, |act, ctx| { if Instant::now().duration_since(act.hb) > CLIENT_TIMEOUT { ctx.stop(); } else { ctx.ping(""); let load_avg = match act.s...
code_fim
hard
{ "lang": "rust", "repo": "g-s-k/gsk-space", "path": "/server/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: g-s-k/gsk-space path: /server/src/main.rs extern crate actix; extern crate actix_web; extern crate env_logger; extern crate sha2; extern crate systemstat; use std::{env, time}; use time::{Duration, Instant}; use actix::prelude::*; use actix_web::{http, middleware, server, ws, App, Error, HttpR...
code_fim
hard
{ "lang": "rust", "repo": "g-s-k/gsk-space", "path": "/server/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct LapInfo<'a> { pub position: u8, pub name: &'a str, pub team: Team, pub current_lap_time: f32, pub last_lap_time: f32, pub best_lap_time: f32, pub status: ResultStatus, pub in_pit: bool, pub lap_invalid: bool, }<|fim_prefix|>// repo: hortonhearsadan/f1-telemet...
code_fim
medium
{ "lang": "rust", "repo": "hortonhearsadan/f1-telemetry-rs", "path": "/f1-telemetry-display/src/models.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hortonhearsadan/f1-telemetry-rs path: /f1-telemetry-display/src/models.rs use f1_telemetry::packet::lap::ResultStatus; use f1_telemetry::packet::participants::Team; <|fim_suffix|>pub struct LapInfo<'a> { pub position: u8, pub name: &'a str, pub team: Team, pub current_lap_time: ...
code_fim
medium
{ "lang": "rust", "repo": "hortonhearsadan/f1-telemetry-rs", "path": "/f1-telemetry-display/src/models.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Deref for Serializer { type Target = SyntaxOption; fn deref(&self) -> &Self::Target { &self.syntax } } impl AbstractSerializer for Serializer { fn serialize( &self, obj: &dyn erased_serde::Serialize, sink: &mut dyn io::Write, ) -> Result<(), Error...
code_fim
hard
{ "lang": "rust", "repo": "fabura/icu4x", "path": "/provider/fs/src/export/serializers/json.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if buf.contains(&b'\n') { for b in buf.iter() { if *b == b'\n' { // Note: Since we need to emit the \r, we are adding extra bytes than were in // the input buffer. BufWriter helps because short writes (less than 4096 B) ...
code_fim
hard
{ "lang": "rust", "repo": "fabura/icu4x", "path": "/provider/fs/src/export/serializers/json.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }