text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> #[test] fn examples_pt2() { let test = |input: &str, result: u64| assert_eq!(solve_pt2(input), result); test("2 * 3 + (4 * 5)", 46); test("1 + (2 * 3) + (4 * (5 + 6))", 51); test("5 + (8 * 3 + 9 + 3 * 4 * 3)", 1445); test("5 * 9 * (7 * 3 * 3 + 9 * 3 + (8 + ...
code_fim
hard
{ "lang": "rust", "repo": "Yantrio/advent-of-code-2020", "path": "/day18/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Yantrio/advent-of-code-2020 path: /day18/src/main.rs use nom::{ bytes::complete::{tag, take_while1}, character::complete::{char, one_of}, combinator::{eof, map_res}, multi::fold_many0, sequence::{delimited, pair, preceded, terminated}, IResult, Parser, }; // AMAZING !!! ...
code_fim
hard
{ "lang": "rust", "repo": "Yantrio/advent-of-code-2020", "path": "/day18/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mr-beerkiss/samples path: /books/the-rust-programming-language/13-functional-language-features/closures/src/main.rs use std::thread; use std::time::Duration; use std::collections::HashMap; use std::cmp::Eq; use std::hash::Hash; fn main() { let simulated_user_specified_value = 16; let s...
code_fim
hard
{ "lang": "rust", "repo": "mr-beerkiss/samples", "path": "/books/the-rust-programming-language/13-functional-language-features/closures/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match self.values.get(&arg) { Some(v) => *v, None => { let value = (self.calculation)(arg); self.values.insert(arg, value); value } } } } #[test] fn call_with_different_values() { let mut c = Cache...
code_fim
hard
{ "lang": "rust", "repo": "mr-beerkiss/samples", "path": "/books/the-rust-programming-language/13-functional-language-features/closures/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tiger1710/didactic-octo-funicular path: /source/rust-code/acmicpc/2400/2485.rs // 2485 가로수 use std::collections::HashSet; use std::io::{self, Read}; fn gcd(a: usize, b: usize) -> usize { if b == 0 { a } else { gcd(b, a % b) } } fn main() { <|fim_suffix|> let mut ...
code_fim
hard
{ "lang": "rust", "repo": "tiger1710/didactic-octo-funicular", "path": "/source/rust-code/acmicpc/2400/2485.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let diff_set: HashSet<usize> = location.windows(2).map(|w| w[1] - w[0]).collect(); let mut total_gcd: usize = *diff_set.iter().next().unwrap(); diff_set.iter().skip(1).for_each(|&d| { total_gcd = gcd(total_gcd, d); }); let n = location .windows(2) .map(|w| w[1...
code_fim
hard
{ "lang": "rust", "repo": "tiger1710/didactic-octo-funicular", "path": "/source/rust-code/acmicpc/2400/2485.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let n = location .windows(2) .map(|w| w[1] - w[0]) .fold(0, |acc, diff| acc + (diff / total_gcd) - 1); println!("{n}"); }<|fim_prefix|>// repo: tiger1710/didactic-octo-funicular path: /source/rust-code/acmicpc/2400/2485.rs // 2485 가로수 use std::collections::HashSet; use st...
code_fim
hard
{ "lang": "rust", "repo": "tiger1710/didactic-octo-funicular", "path": "/source/rust-code/acmicpc/2400/2485.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: woboq/qmetaobject-rs path: /examples/graph/src/nodes.rs use qmetaobject::scenegraph::SGNode; use qmetaobject::{qrc, QQuickItem}; use qttypes::{QColor, QRectF}; #[cfg(not(no_qt))] use cpp::cpp; qrc! { pub init_resources, "scenegraph/graph" { "shaders/noisy.vsh", "shaders...
code_fim
hard
{ "lang": "rust", "repo": "woboq/qmetaobject-rs", "path": "/examples/graph/src/nodes.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub enum GridNode {} pub fn update_grid_node(s: &mut SGNode<GridNode>, rect: QRectF) { cpp!(unsafe [s as "GridNode**", rect as "QRectF"] { if (!*s) *s = new GridNode; (*s)->setRect(rect); }); } pub enum LineNode {} pub fn create_line_node(s: &mut SGNode<LineNode>, size: f32, sprea...
code_fim
hard
{ "lang": "rust", "repo": "woboq/qmetaobject-rs", "path": "/examples/graph/src/nodes.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub async fn find_world_by_id(db: Database, id: i32) -> Result<World, MongoError> { let world_collection = db.collection::<RawDocumentBuf>("world"); let filter = doc! { "_id": id as f32 }; let raw: RawDocumentBuf = world_collection .find_one(Some(filter), None) .await ...
code_fim
hard
{ "lang": "rust", "repo": "joanhey/FrameworkBenchmarks", "path": "/frameworks/Rust/axum/src/database_mongo_raw.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joanhey/FrameworkBenchmarks path: /frameworks/Rust/axum/src/database_mongo_raw.rs use std::{convert::Infallible, io}; use axum::{async_trait, extract::FromRequestParts, http::request::Parts}; use futures_util::{stream::FuturesUnordered, TryStreamExt}; use mongodb::{ bson::{doc, RawDocumentB...
code_fim
hard
{ "lang": "rust", "repo": "joanhey/FrameworkBenchmarks", "path": "/frameworks/Rust/axum/src/database_mongo_raw.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|> pub fn internal<I: Into<String>>(message: I) -> GameError { GameError::Internal { message: message.into(), } } } fn parse_error_message(message: &Option<String>) -> String { message .as_ref() .map(|m| format!("{}, ", m)) .unwrap_or_else(|| "...
code_fim
medium
{ "lang": "rust", "repo": "brdgme/brdgme", "path": "/rust/lib/game/src/errors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brdgme/brdgme path: /rust/lib/game/src/errors.rs use thiserror::Error; use crate::command::parser::comma_list_or; #[derive(Debug, Error)] pub enum GameError { #[error("invalid player count, expected {}, got {given}", player_range_output(.min, .max))] PlayerCount { min: usize, ...
code_fim
medium
{ "lang": "rust", "repo": "brdgme/brdgme", "path": "/rust/lib/game/src/errors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn player_range_output(min: &usize, max: &usize) -> String { if min == max { format!("{}", min) } else { format!("{} to {}", min, max) } }<|fim_prefix|>// repo: brdgme/brdgme path: /rust/lib/game/src/errors.rs use thiserror::Error; use crate::command::parser::comma_list_or; ...
code_fim
hard
{ "lang": "rust", "repo": "brdgme/brdgme", "path": "/rust/lib/game/src/errors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let candidates = get_candidates_by_political_party(&pool, political_party).await; let mut candidate_ids = vec![]; for c in &candidates { candidate_ids.push(c.id); } let keywords = get_voice_of_supporter(&pool, &candidate_ids).await; let data = PoliticalPartyTmplContext { ...
code_fim
hard
{ "lang": "rust", "repo": "hiratasa/ishocon2-rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> HttpResponse::Ok().body(hb.render("vote", &data).unwrap()) } async fn initialize(pool: web::Data<MySqlPool>) -> impl Responder { sqlx::query!("DELETE FROM votes") .execute(pool.get_ref()) .await .expect("failed to initialize."); HttpResponse::Ok().body("Finish") } fn...
code_fim
hard
{ "lang": "rust", "repo": "hiratasa/ishocon2-rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hiratasa/ishocon2-rust path: /src/main.rs mod candidate; mod helpers; mod user; mod vote; use std::cmp::Reverse; use std::collections::HashMap; use std::env; use actix_files::Files; use actix_web::{http::header, web, App, HttpResponse, HttpServer, Responder}; use handlebars::Handlebars; use se...
code_fim
hard
{ "lang": "rust", "repo": "hiratasa/ishocon2-rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mattnenterprise/rust-box2d path: /src/collision/polygon_polygon_collider.rs use super::super::shape::shape::Shape::PolygonShape; use super::super::body::Body; use super::super::common::Vec2; use super::super::manifold::Manifold; use super::collider::Collider; use super::collider_result::Collider...
code_fim
hard
{ "lang": "rust", "repo": "mattnenterprise/rust-box2d", "path": "/src/collision/polygon_polygon_collider.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for axis in axes_one { let min1: f32 = get_min(&points_a, axis, self.pair().0.position); let max1: f32 = get_max(&points_a, axis, self.pair().0.position); let min2: f32 = get_min(&points_b, axis, self.pair().1.position); let max2: f32 = get_max(&...
code_fim
hard
{ "lang": "rust", "repo": "mattnenterprise/rust-box2d", "path": "/src/collision/polygon_polygon_collider.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut max: f32 = Vec2::dot((points[0] + position), axis); for point in points.iter() { let new_point = point.clone() + position; if Vec2::dot(new_point, axis) > max { max = Vec2::dot(new_point, axis); } } return max; } fn get_lines(points: Vec<Vec2>, ...
code_fim
hard
{ "lang": "rust", "repo": "mattnenterprise/rust-box2d", "path": "/src/collision/polygon_polygon_collider.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: juzi5201314/deno path: /runtime/ops/file.rs // Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. use deno_core::url::Url; use deno_file::op_file_create_object_url; use deno_file::op_file_revoke_object_ur<|fim_suffix|>t op_state = rt.op_state(); let mut op_state = op_sta...
code_fim
medium
{ "lang": "rust", "repo": "juzi5201314/deno", "path": "/runtime/ops/file.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>location)); } } super::reg_sync(rt, "op_file_create_object_url", op_file_create_object_url); super::reg_sync(rt, "op_file_revoke_object_url", op_file_revoke_object_url); }<|fim_prefix|>// repo: juzi5201314/deno path: /runtime/ops/file.rs // Copyright 2018-2021 the Deno authors. All rights reser...
code_fim
medium
{ "lang": "rust", "repo": "juzi5201314/deno", "path": "/runtime/ops/file.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use update::update; mod command;<|fim_prefix|>// repo: Byron/gitoxide path: /gitoxide-core/src/query/engine/mod.rs pub enum Command { TracePath { /// The repo-relative path to the file to trace spec: gix::pathspec::Pattern, }, } <|fim_middle|>pub(crate) mod update;
code_fim
easy
{ "lang": "rust", "repo": "Byron/gitoxide", "path": "/gitoxide-core/src/query/engine/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Byron/gitoxide path: /gitoxide-core/src/query/engine/mod.rs pub enum Command { TracePath { /// The repo-relative path to the file to trace spec: gix::pathspec::Pattern, }, } <|fim_suffix|>pub use update::update; mod command;<|fim_middle|>pub(crate) mod update;
code_fim
easy
{ "lang": "rust", "repo": "Byron/gitoxide", "path": "/gitoxide-core/src/query/engine/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Move the shared resources to Mutex free(|cs| { BUTTON.borrow(cs).replace(Some(user_button)); LED.borrow(cs).replace(Some(led)); }); // Enable interrupt stm32::NVIC::unpend(stm32::interrupt::EXTI15_10); unsafe { stm32::NVIC::unmask(stm32::interrupt::EXTI1...
code_fim
hard
{ "lang": "rust", "repo": "xieren58/stm32f4xx-examples", "path": "/examples/gpio_interrupt_1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xieren58/stm32f4xx-examples path: /examples/gpio_interrupt_1.rs #![no_main] #![no_std] extern crate panic_halt; use core::cell::RefCell; use core::ops::DerefMut; use cortex_m; use cortex_m::interrupt::{free, Mutex}; use cortex_m_rt::entry; use stm32f4xx_hal::{ gpio::gpiob::PB7, gpio::g...
code_fim
hard
{ "lang": "rust", "repo": "xieren58/stm32f4xx-examples", "path": "/examples/gpio_interrupt_1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[tracing::instrument(skip(cancel))] pub(crate) async fn create_server( cancel: tokio_util::sync::CancellationToken, ) -> anyhow::Result<Client> { // TODO provide way to customize port or port range tracing::info!("launching embedded server"); let mut last_error = None; for _ in 0..BIN...
code_fim
hard
{ "lang": "rust", "repo": "MikailBag/jjs-pps", "path": "/cli/src/client.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MikailBag/jjs-pps path: /cli/src/client.rs use anyhow::Context; use futures::{ stream::{StreamExt, TryStreamExt}, FutureExt, }; use serde::{de::DeserializeOwned, Serialize}; use uuid::Uuid; // To start server, we need to know some free port. // Even if there is a way to get this informa...
code_fim
hard
{ "lang": "rust", "repo": "MikailBag/jjs-pps", "path": "/cli/src/client.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> any = true; if p.effect == Effect::Deny { return Effect::Deny; } for con in &p.conditions { if !con.allow(p, req) { return Effect::Deny; } } } return if any {...
code_fim
hard
{ "lang": "rust", "repo": "omeid/warden", "path": "/src/warden.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait PolicyProvider<C, CS> where C: Context, CS: Conditions<C> { fn add_policy(&self, policy: Policy<C, CS>) -> Result; fn subject_policies<'a>(&self, subject: &String, action: &String) -> &Itera...
code_fim
hard
{ "lang": "rust", "repo": "omeid/warden", "path": "/src/warden.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: omeid/warden path: /src/warden.rs use std::marker::PhantomData; use std; extern crate erased_serde; extern crate serde; use erased_serde as ede; use serde::de; use serde::ser; extern crate uuid; use uuid::Uuid; pub trait Context: ede::Serialize + de::Deserialize {} impl<C: ede::Serialize + de...
code_fim
hard
{ "lang": "rust", "repo": "omeid/warden", "path": "/src/warden.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tbremer/adventofcode path: /2022/03/src/lib.rs use std::collections::HashSet; pub fn str_val(str: &str) -> u32 { let b = str.as_bytes().get(0).unwrap(); if b > &96 { (b - 96).into() } else { (b - 38).into() } } pub fn string_to_hashset(s: &String) -> HashSet<St...
code_fim
hard
{ "lang": "rust", "repo": "tbremer/adventofcode", "path": "/2022/03/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Input { pub pt1: Vec<(String, String)>, pub pt2: Vec<(String, String, String)>, } pub fn parse_input(input: &str) -> Input { Input { pt1: parse_pt_1(input), pt2: parse_pt_2(input), } } pub fn parse_pt_1(input: &str) -> Vec<(String, String)> { input ...
code_fim
medium
{ "lang": "rust", "repo": "tbremer/adventofcode", "path": "/2022/03/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn parse_pt_2(input: &str) -> Vec<(String, String, String)> { let lines: Vec<&str> = input.lines().collect(); lines .chunks(3) .map(|c| match c[..] { [x, y, z] => (x.to_string(), y.to_string(), z.to_string()), _ => panic!("Nope"), }) .co...
code_fim
hard
{ "lang": "rust", "repo": "tbremer/adventofcode", "path": "/2022/03/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Flex::column() .cross_axis_alignment(CrossAxisAlignment::Start) .with_child( Button::new("New Command") .on_click(|_ctx, app_data: &mut AppData, _env| { app_data.edit_entry = EditState::New(EntryData::default()) }) ...
code_fim
hard
{ "lang": "rust", "repo": "yiransheng/topspin", "path": "/src/ui/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yiransheng/topspin path: /src/ui/mod.rs use druid::lens::LensExt; use druid::widget::{Button, CrossAxisAlignment, Flex, List, Scroll, ViewSwitcher}; use druid::{AppDelegate, Command, DelegateCtx, Env, Target, Widget, WidgetExt}; pub mod app_data; mod edit; mod entry; mod response_handler; use...
code_fim
hard
{ "lang": "rust", "repo": "yiransheng/topspin", "path": "/src/ui/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let cx = unwrap(zmq::init(1)); { let pubs = unwrap(cx.socket(zmq::PUB)); unwrap(pubs.bind("inproc://foo")); let subs = unwrap(cx.socket(zmq::SUB)); unwrap(subs.connect("inproc://foo")); // subscribe to everything subs.set_subscribe([]); //...
code_fim
medium
{ "lang": "rust", "repo": "dolphorama/rust-sandbox", "path": "/zmq-example.rs", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dolphorama/rust-sandbox path: /zmq-example.rs extern mod zmq; use result::{Result, get, unwrap}; use task::{spawn}; use to_str::{ToStr}; use to_bytes::{ToBytes}; use zmq::{Context, Socket, Error}; fn main() { <|fim_suffix|> { let pubs = unwrap(cx.socket(zmq::PUB)); unwrap(p...
code_fim
medium
{ "lang": "rust", "repo": "dolphorama/rust-sandbox", "path": "/zmq-example.rs", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/healthlake/src/error_meta.rs Error::AccessDeniedException(inner) => inner.fmt(f), Error::ConflictException(inner) => inner.fmt(f), Error::InternalServerException(inner) => inner.fmt(f), Error::ResourceNotFoundExceptio...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/healthlake/src/error_meta.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/healthlake/src/error_meta.rs nternalServerException(inner) => inner.fmt(f), Error::ResourceNotFoundException(inner) => inner.fmt(f), Error::ThrottlingException(inner) => inner.fmt(f), Error::ValidationException(inner) => inner.fm...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/healthlake/src/error_meta.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn free(page: usize, num_pages: usize) { }<|fim_prefix|>// repo: egergo/kermit-kernel-first path: /src/pages.rs use spin::Mutex; static FIRST_PAGE: Mutex<u64> = Mutex::new(0); <|fim_middle|>pub fn init_first_page(page: u64) { let mut first_page = FIRST_PAGE.lock(); *first_page = page; } pub ...
code_fim
hard
{ "lang": "rust", "repo": "egergo/kermit-kernel-first", "path": "/src/pages.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: egergo/kermit-kernel-first path: /src/pages.rs use spin::Mutex; static FIRST_PAGE: Mutex<u64> = Mutex::new(0); pub fn init_first_page(page: u64) { let mut first_page = FIRST_PAGE.lock(); *first_page = page; } <|fim_suffix|>pub fn free(page: usize, num_pages: usize) { }<|fim_middle|>pub ...
code_fim
medium
{ "lang": "rust", "repo": "egergo/kermit-kernel-first", "path": "/src/pages.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: knokko/griphin-rs path: /src/vertex/store.rs log_id, "An IntTexCoords attribute is not of type INT", ); } for coordinate in int_values ...
code_fim
hard
{ "lang": "rust", "repo": "knokko/griphin-rs", "path": "/src/vertex/store.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_basic_put_ats() { let mut store = VertexStoreBuilder { raw_buffer: vec![2; 17], current_offset: 30, }; store.put_bool_at(1, true); store.put_int_at(6, -1234567890); store.put_float_at(12, 4.89176); test_basic...
code_fim
hard
{ "lang": "rust", "repo": "knokko/griphin-rs", "path": "/src/vertex/store.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut many_equals = false; for position in &positions { let mut equal_counter = 0; for other_position in &positions { if position == other_position ...
code_fim
hard
{ "lang": "rust", "repo": "knokko/griphin-rs", "path": "/src/vertex/store.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: paulewarner/clank path: /src/graphics/tilemap.rs use image::GenericImage; use std::collections::HashMap; use crate::graphics::imagewrapper; #[derive(Deserialize)] struct TileLayer { // id: i32, // height: u32, // width: u32, // name: String, // #[serde(rename = "type")] ...
code_fim
hard
{ "lang": "rust", "repo": "paulewarner/clank", "path": "/src/graphics/tilemap.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // #[serde(rename = "nextlayerid")] // next_layer_id: i32, // #[serde(rename = "nextobjectid")] // next_object_id: i32, // #[serde(rename = "renderorder")] // render_order: String, // TODO: enum? // orientation: String, // TODO: enum? // #[serde(rename = "tiledversion")...
code_fim
hard
{ "lang": "rust", "repo": "paulewarner/clank", "path": "/src/graphics/tilemap.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kb10uy/s3wf2-rs path: /src/emitter.rs pub mod html; #[cfg(feature = "cli")] pub mod console; use crate::document::Document; use std::io::{prelude::*, Result}; /// The trait which converts `Document` into other formats. pub trait Emit<'a> { /// Emits formatted document. /// /// # P...
code_fim
hard
{ "lang": "rust", "repo": "kb10uy/s3wf2-rs", "path": "/src/emitter.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// The Iterator type which iterates IndexItem. type IndexItemIter: Iterator<Item = Self::IndexItem>; /// Returns an iterator which lists the index items. fn indices(&self, document: &'d Document<'s>) -> Self::IndexItemIter; }<|fim_prefix|>// repo: kb10uy/s3wf2-rs path: /src/emitter.rs p...
code_fim
hard
{ "lang": "rust", "repo": "kb10uy/s3wf2-rs", "path": "/src/emitter.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CurryPseudo/curry-pbrt path: /src/scene/texture_map.rs use crate::def::Float; use crate::scene_file_parser::PropertySet; use crate::spectrum::Spectrum; use crate::texture; use crate::texture::ImageTexture; use crate::utility::AnyHashMap; use std::path::Path; use std::path::PathBuf; use std::sync...
code_fim
hard
{ "lang": "rust", "repo": "CurryPseudo/curry-pbrt", "path": "/src/scene/texture_map.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl TextureMap { pub fn add_texture(&mut self, property_set: &PropertySet) { let file_name: PathBuf = property_set.get_value("filename").unwrap(); let mut property_set = property_set.clone(); let name = String::from( property_set .as_one_basic_types...
code_fim
hard
{ "lang": "rust", "repo": "CurryPseudo/curry-pbrt", "path": "/src/scene/texture_map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/piano_roll path: /src/audio/audio_emitter.rs use std::sync::{Arc, atomic::{AtomicUsize, Ordering}}; use cpal::traits::{DeviceTrait, HostTrait, StreamTrait}; use super::source::Source; pub struct AudioEmitter { stream: Option<cpal::Stream>, counter: Arc<AtomicUsize>, config...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/piano_roll", "path": "/src/audio/audio_emitter.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut counter = 0usize; let ch = config.channels as usize; let mut buffer = Vec::new(); let stream = device .build_output_stream( config, move |data: &mut [f32], _: &cpal::OutputCallbackInfo| { buffer.resiz...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/piano_roll", "path": "/src/audio/audio_emitter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> device: cpal::Device, config: &cpal::StreamConfig, mut source: Box<dyn Source>, counter_atomic: Arc<AtomicUsize>, ) -> cpal::Stream { let err_fn = |err| eprintln!("an error occurred on stream: {}", err); let mut counter = 0usize; let ch = config...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/piano_roll", "path": "/src/audio/audio_emitter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lillanes/gridist path: /src/instance.rs use std::mem::replace; use std::ops::Index; use rand::{SeedableRng, StdRng}; use rand::distributions::{IndependentSample, Range}; use agent::Agent; use experiment::Verbosity; use grid::{Distance, Grid, Point}; #[derive(Debug, Default)] pub struct Datum ...
code_fim
hard
{ "lang": "rust", "repo": "lillanes/gridist", "path": "/src/instance.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn repeated_astar_trials() { let mut grid = grid_from_str("type octile height 4 width 4 map .... .TT. .TT. ...."); let agent = RepeatedAstar::new(Distance::octile_heuristic); let mut instance = Instance::new(&mut grid, agent, Verbosity::Two); let results =...
code_fim
hard
{ "lang": "rust", "repo": "lillanes/gridist", "path": "/src/instance.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // user pressed CTRL-C (initiate a close handshake) if !running.load(Ordering::SeqCst) { running.store(true, Ordering::SeqCst); // ensure that we don't run this again websocket.close(WebSocketCloseStatusCode::NormalClosure, None)?; println!("Close handsh...
code_fim
hard
{ "lang": "rust", "repo": "ninjasource/wstest", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // let url = Url::parse("wss://ws-feed-public.sandbox.pro.coinbase.com").unwrap(); // let url = Url::parse("wss://ws-feed.pro.coinbase.com").unwrap(); let address = "ws-feed.pro.coinbase.com:443"; println!("Connecting to: {}", address); let connector = TlsConnector::new().unwrap...
code_fim
hard
{ "lang": "rust", "repo": "ninjasource/wstest", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ninjasource/wstest path: /src/main.rs use embedded_websocket::{ framer::{Framer, FramerError}, WebSocketCloseStatusCode, WebSocketOptions, WebSocketSendMessageType, }; use std::net::TcpStream; use thiserror::Error; extern crate native_tls; use native_tls::TlsConnector; extern crate ctr...
code_fim
hard
{ "lang": "rust", "repo": "ninjasource/wstest", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Velrok/dnd-token-pusher path: /src/game.rs use crate::commands; use crate::domain; use std::fs; use std::io; use std::sync::mpsc::channel; use std::thread; use tetra::graphics::scaling::{ScalingMode, ScreenScaler}; use tetra::graphics::text::Font; use tetra::graphics::text::Text; use tetra::gra...
code_fim
hard
{ "lang": "rust", "repo": "Velrok/dnd-token-pusher", "path": "/src/game.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if input::is_key_down(ctx, Key::F) || input::is_mouse_scrolled_down(ctx) { self.camera.zoom -= ZOOM_SPEED; } self.camera.update(); Ok(()) } fn draw(&mut self, ctx: &mut Context) -> tetra::Result { graphics::set_canvas(ctx, self.scaler.canvas()...
code_fim
hard
{ "lang": "rust", "repo": "Velrok/dnd-token-pusher", "path": "/src/game.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.camera.update(); Ok(()) } fn draw(&mut self, ctx: &mut Context) -> tetra::Result { graphics::set_canvas(ctx, self.scaler.canvas()); graphics::clear(ctx, BACKGROUND_COLOR); // To 'look through' the camera, we pass the calculated transform matrix ...
code_fim
hard
{ "lang": "rust", "repo": "Velrok/dnd-token-pusher", "path": "/src/game.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn full_lines(&self) -> Vec<i64> { let mut full_lines = Vec::new(); for y in 0..(self.height as i64) { let is_full = (0..(self.width as i64 / 2)).all(|x| self.bottom.contains(&Point(x, y))); if is_full { full_lines.push(y); } ...
code_fim
hard
{ "lang": "rust", "repo": "yykkxk/piston-rust-games", "path": "/src/tetris.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn down_immediately(&mut self) { // loop { // if self.move_collides(Direction::Down) { // break; // } // self.offset += Point(0, 1); // } while !self.move_collides(Direction::Down) { self.offset += Point(0, 1)...
code_fim
hard
{ "lang": "rust", "repo": "yykkxk/piston-rust-games", "path": "/src/tetris.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yykkxk/piston-rust-games path: /src/tetris.rs extern crate rand; use rand::Rng; use std::ops::{Add, AddAssign}; #[derive(Debug, PartialEq, Eq, Clone, Copy)] pub struct Point(pub i64, pub i64); impl Add<Point> for Point { type Output = Point; fn add(self, rhs: Point) -> Point { ...
code_fim
hard
{ "lang": "rust", "repo": "yykkxk/piston-rust-games", "path": "/src/tetris.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn main() { WasmLoggerBuilder::new() .with_log_level(log::LevelFilter::Info) .build() .unwrap(); }<|fim_prefix|>// repo: cooz2/fluent-pad path: /services/history-inmemory/src/main.rs /* * Copyright 2020 Fluence Labs Limited * * Licensed under the Apache License, Version...
code_fim
medium
{ "lang": "rust", "repo": "cooz2/fluent-pad", "path": "/services/history-inmemory/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) type Result<T> = std::result::Result<T, errors::HistoryError>; pub fn main() { WasmLoggerBuilder::new() .with_log_level(log::LevelFilter::Info) .build() .unwrap(); }<|fim_prefix|>// repo: cooz2/fluent-pad path: /services/history-inmemory/src/main.rs /* * Copyright...
code_fim
medium
{ "lang": "rust", "repo": "cooz2/fluent-pad", "path": "/services/history-inmemory/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cooz2/fluent-pad path: /services/history-inmemory/src/main.rs /* * Copyright 2020 Fluence Labs Limited * * 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 at * * h...
code_fim
medium
{ "lang": "rust", "repo": "cooz2/fluent-pad", "path": "/services/history-inmemory/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.inner } } impl<'a, TagKind, T, E> TaggedParser<'a, TagKind, T, E> where Self: FromBer<'a, E>, E: From<Error>, { pub fn parse_ber(class: Class, tag: Tag, bytes: &'a [u8]) -> ParseResult<'a, Self, E> { let (rem, t) = TaggedParser::<TagKind, T, E>::from_ber(bytes)?; ...
code_fim
hard
{ "lang": "rust", "repo": "rusticata/asn1-rs", "path": "/src/asn1_types/tagged/parser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rusticata/asn1-rs path: /src/asn1_types/tagged/parser.rs use crate::*; use core::marker::PhantomData; #[derive(Debug, PartialEq, Eq)] pub struct TaggedParser<'a, TagKind, T, E = Error> { pub header: Header<'a>, pub inner: T, pub(crate) tag_kind: PhantomData<TagKind>, pub(crate)...
code_fim
medium
{ "lang": "rust", "repo": "rusticata/asn1-rs", "path": "/src/asn1_types/tagged/parser.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) .force_build(false) .process_current_dir() .unwrap(); }<|fim_prefix|>// repo: andreasots/eris path: /build.rs fn main() { lalrpop::Configuration::<|fim_middle|>new() .emit_rerun_directives(true
code_fim
easy
{ "lang": "rust", "repo": "andreasots/eris", "path": "/build.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andreasots/eris path: /build.rs fn main() { lalrpop::Configuration::<|fim_suffix|>rocess_current_dir() .unwrap(); }<|fim_middle|>new() .emit_rerun_directives(true) .force_build(false) .p
code_fim
medium
{ "lang": "rust", "repo": "andreasots/eris", "path": "/build.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CeciliaZ030/CSC200H-PawlikiBox path: /pawliki/src/database.rs use serde_derive::{Serialize, Deserialize}; use serde::de::Deserialize; use serde_json; use rand::seq::SliceRandom; use std::error::Error; use std::fs::File; use std::path::Path; #[derive(Serialize, Deserialize, Debug, Clone)] pub s...
code_fim
hard
{ "lang": "rust", "repo": "CeciliaZ030/CSC200H-PawlikiBox", "path": "/pawliki/src/database.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn query_executor(&self, fun_name: &str, args: &Vec<String>, printoption : bool) -> Data { let ret: Data; match fun_name.as_ref() { "get_instructor" => { if let Some(s) = self.get_instructor(&args[0]) { ret = Data::Instructor(s); ...
code_fim
hard
{ "lang": "rust", "repo": "CeciliaZ030/CSC200H-PawlikiBox", "path": "/pawliki/src/database.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_course_by_id(&self, id: &str) -> Option<Course> { let mut temp_id: &str = &["csc" , id].concat(); if id.contains("csc") { temp_id = id; } Some(self.courses.iter().find(|ref c| c.id == temp_id)?.clone()) } pub fn get_courses_by_prof(&self,...
code_fim
hard
{ "lang": "rust", "repo": "CeciliaZ030/CSC200H-PawlikiBox", "path": "/pawliki/src/database.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pola-rs/polars path: /examples/read_csv/src/main.rs use polars::io::mmap::MmapBytesReader; use polars::prelude::*; fn main() -> PolarsResult<()> { let file = std::fs::File::open("/home/ritchie46/Downloads/tpch/tables_scale_100/lineitem.tbl") .unwrap(); let file = Box::new(file) ...
code_fim
medium
{ "lang": "rust", "repo": "pola-rs/polars", "path": "/examples/read_csv/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let parquet_out = "../datasets/foods1.parquet"; if std::fs::metadata(parquet_out).is_err() { let f = std::fs::File::create(parquet_out).unwrap(); ParquetWriter::new(f).with_statistics(true).finish(df)?; } let ipc_out = "../datasets/foods1.ipc"; if std::fs::metadata(ipc_...
code_fim
medium
{ "lang": "rust", "repo": "pola-rs/polars", "path": "/examples/read_csv/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shaneutt/wasm-pack path: /src/test/webdriver/chromedriver.rs use super::{get_and_notify, Collector}; use crate::install::InstallMode; use crate::stamps; use crate::target; use anyhow::{bail, Context, Result}; use binary_install::Cache; use chrono::DateTime; use std::path::PathBuf; // Keep it up...
code_fim
hard
{ "lang": "rust", "repo": "shaneutt/wasm-pack", "path": "/src/test/webdriver/chromedriver.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok(version) } fn should_load_chromedriver_version_from_stamp(json: &serde_json::Value) -> bool { let last_updated = stamps::get_stamp_value(CHROMEDRIVER_LAST_UPDATED_STAMP, json) .ok() .and_then(|last_updated| DateTime::parse_from_rfc3339(&last_updated).ok()); match last_upda...
code_fim
hard
{ "lang": "rust", "repo": "shaneutt/wasm-pack", "path": "/src/test/webdriver/chromedriver.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> stamps::save_stamp_value(CHROMEDRIVER_VERSION_STAMP, &version)?; let current_time = chrono::offset::Local::now().to_rfc3339(); stamps::save_stamp_value(CHROMEDRIVER_LAST_UPDATED_STAMP, current_time)?; Ok(version) } fn should_load_chromedriver_version_from_stamp(json: &serde_json::Value)...
code_fim
hard
{ "lang": "rust", "repo": "shaneutt/wasm-pack", "path": "/src/test/webdriver/chromedriver.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: google/tock-on-titan path: /third_party/futures-util/benches_disabled/bilock.rs #![feature(test)] #[cfg(feature = "bilock")] mod bench { use futures::task::{Context, Waker}; use futures::executor::LocalPool; use futures_util::lock::BiLock; use futures_util::lock::BiLockAcquire; use futures_util...
code_fim
hard
{ "lang": "rust", "repo": "google/tock-on-titan", "path": "/third_party/futures-util/benches_disabled/bilock.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl LockStream { fn new(lock: BiLock<u32>) -> LockStream { LockStream { lock: lock.lock() } } /// Release a lock after it was acquired in `poll`, /// so `poll` could be called again. fn release_lock(&mut self, guard: BiLockAcquired<u32>) { self.loc...
code_fim
hard
{ "lang": "rust", "repo": "google/tock-on-titan", "path": "/third_party/futures-util/benches_disabled/bilock.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kamilpitula/RustPlatformer path: /src/colors.rs pub static GRAY: [f32; 4] = [0.9, 0.9, 0.9, 1.0]; pub static DA<|fim_suffix|>; 4] = [0.0, 0.0, 0.0, 1.0]; pub static RED: [f32; 4] = [1.0, 0.0, 0.0, 1.0]; pub static BLUE: [f32; 4] = [0.0, 0.0, 1.0, 1.0];<|fim_middle|>RK_GRAY: [f32; 4] = [0.7, 0.7,...
code_fim
medium
{ "lang": "rust", "repo": "kamilpitula/RustPlatformer", "path": "/src/colors.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>.0, 0.0, 1.0]; pub static BLUE: [f32; 4] = [0.0, 0.0, 1.0, 1.0];<|fim_prefix|>// repo: kamilpitula/RustPlatformer path: /src/colors.rs pub static GRAY: [f32; 4] = [0.9, 0.9, 0.9, 1.0]; pub static DARK_GRAY: [f32; 4] = [0.7, 0.7, 0.7, 1.0]; pub static BLACK: [f32<|fim_middle|>; 4] = [0.0, 0.0, 0.0, 1.0]; ...
code_fim
medium
{ "lang": "rust", "repo": "kamilpitula/RustPlatformer", "path": "/src/colors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Veetaha/db-labs path: /term3_1/lab3/src/controllers/cli/delete.rs use structopt::StructOpt; use super::enums::EntityType; <|fim_suffix|> /// Unique identifier of the entity to delete pub id: i32 }<|fim_middle|>#[derive(StructOpt, Debug)] pub struct Delete { #[structopt( case...
code_fim
medium
{ "lang": "rust", "repo": "Veetaha/db-labs", "path": "/term3_1/lab3/src/controllers/cli/delete.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Unique identifier of the entity to delete pub id: i32 }<|fim_prefix|>// repo: Veetaha/db-labs path: /term3_1/lab3/src/controllers/cli/delete.rs use structopt::StructOpt; use super::enums::EntityType; <|fim_middle|>#[derive(StructOpt, Debug)] pub struct Delete { #[structopt( case...
code_fim
medium
{ "lang": "rust", "repo": "Veetaha/db-labs", "path": "/term3_1/lab3/src/controllers/cli/delete.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: daniel5151/aoc19 path: /src/day13.rs use crate::prelude::*; struct GameState { tiles: HashMap<(isize, isize), isize>, score: isize, } fn run_game(intcode: &mut Intcode, delay: u64) -> DynResult<GameState> { let input = &mut VecDeque::new(); let mut tiles = HashMap::new(); ...
code_fim
hard
{ "lang": "rust", "repo": "daniel5151/aoc19", "path": "/src/day13.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // move cursor print!("\x1b[{};{}H", 1, 1); print!("Score: {:<10}", score); } else { tiles.insert((x, y), kind); // AI match kind { 3 => paddle_x = x, 4 => ball_x = x, _ => {} ...
code_fim
hard
{ "lang": "rust", "repo": "daniel5151/aoc19", "path": "/src/day13.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ans = run_game(intcode, 0)? .tiles .iter() .filter(|(_, kind)| **kind == 2) .count(); Ok(ans) } pub fn q2(input: String, args: &[String]) -> DynResult<isize> { let delay = match args.get(0) { None => 0, Some(v) => v.parse::<u64>()?, }; ...
code_fim
hard
{ "lang": "rust", "repo": "daniel5151/aoc19", "path": "/src/day13.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: x1-/rust_web_service path: /actix/src/main.rs extern crate actix; extern crate actix_web; extern crate futures; extern crate serde; extern crate serde_json; #[macro_use] extern crate serde_derive; // use actix; use actix_web::{http, server, App, AsyncResponder, Either, Error, HttpRequest, Http...
code_fim
hard
{ "lang": "rust", "repo": "x1-/rust_web_service", "path": "/actix/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let sys = actix::System::new("my example"); let app_state = Arc::new(MyState { share_info : String::from("my example server"), access_count: AtomicUsize::new(0) }); server::HttpServer::new(move || App::with_state(app_state.clone()) .route("/hc", http::...
code_fim
hard
{ "lang": "rust", "repo": "x1-/rust_web_service", "path": "/actix/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> { N: i32, M: usize, XY: [(u32, u32); M] }; debug!(N, M, XY); }<|fim_prefix|>// repo: hideki-okada/atcoder-rust path: /abc001/src/bin/d.rs use proconio::{fastout, input}; #[allow(unused_macros)] macro_rules! debug { <|fim_middle|> ($($a:expr),*) => { eprintln!(concat!($...
code_fim
medium
{ "lang": "rust", "repo": "hideki-okada/atcoder-rust", "path": "/abc001/src/bin/d.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hideki-okada/atcoder-rust path: /abc001/src/bin/d.rs use proconio::{fastout, input}; #[allow(unused_macros)] macro_rules! debug { ($($a:expr),*) => { eprintln!(concat!($(stringify!($a), " = {:?}, "),*)<|fim_suffix|> { N: i32, M: usize, XY: [(u32, u32); M] }; d...
code_fim
medium
{ "lang": "rust", "repo": "hideki-okada/atcoder-rust", "path": "/abc001/src/bin/d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ProbeCmd { /// Runs the `drone probe` command. #[allow(clippy::too_many_lines)] pub fn run(&self, shell: &mut StandardStream) -> Result<()> { let Self { probe_sub_cmd } = self; let signals = register_signals()?; let registry = Registry::new()?; let config =...
code_fim
hard
{ "lang": "rust", "repo": "dflemstr/drone", "path": "/src/probe/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns default UART endpoint value for the given debug probe. pub fn itm_external_endpoint(&self) -> &str { match self { Self::Bmp => "/dev/ttyBmpTarg", Self::Openocd => "/dev/ttyUSB0", } } } impl ProbeCmd { /// Runs the `drone probe` command. ...
code_fim
hard
{ "lang": "rust", "repo": "dflemstr/drone", "path": "/src/probe/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dflemstr/drone path: /src/probe/mod.rs //! Debug probe interface. pub mod bmp; pub mod openocd; use crate::{ cli::{ProbeCmd, ProbeSubCmd}, templates::Registry, utils::{block_with_signals, register_signals, run_command}, }; use anyhow::{anyhow, bail, Result}; use drone_config as con...
code_fim
hard
{ "lang": "rust", "repo": "dflemstr/drone", "path": "/src/probe/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rivy/crossterm path: /src/style/mod.rs //! This module is used for styling the terminal text. //! Under styling we can think of coloring the font and applying attributes to it. mod color; mod styles; pub use self::color::color::{color, TerminalColor}; pub use self::styles::objectstyle::ObjectS...
code_fim
hard
{ "lang": "rust", "repo": "rivy/crossterm", "path": "/src/style/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Magenta, DarkMagenta, Cyan, DarkCyan, Grey, White, #[cfg(unix)] Rgb { r: u8, g: u8, b: u8, }, #[cfg(unix)] AnsiValue(u8), } /// Color types that can be used to determine if the Color enum is an Fore- or Background Color #[derive(Debug...
code_fim
hard
{ "lang": "rust", "repo": "rivy/crossterm", "path": "/src/style/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Spazzy757/comtrya path: /src/atoms/file/chmod.rs use super::super::Atom; use super::FileAtom; use std::path::PathBuf; pub struct Chmod { pub path: PathBuf, pub mode: u32, } impl FileAtom for Chmod { fn get_path(&self) -> &PathBuf { &self.path } } impl std::fmt::Display...
code_fim
hard
{ "lang": "rust", "repo": "Spazzy757/comtrya", "path": "/src/atoms/file/chmod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match std::fs::File::create(temp_dir.path().join("644")) { std::result::Result::Ok(file) => file, std::result::Result::Err(_) => { assert_eq!(false, true); return; } }; assert_eq!( true, st...
code_fim
hard
{ "lang": "rust", "repo": "Spazzy757/comtrya", "path": "/src/atoms/file/chmod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }