text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: Maix0/pixel_engine path: /pixel_engine_draw/examples/sub_sprite.rs extern crate pixel_engine_draw as px_draw; use px_draw::{graphics::{Color, Sprite}, vector2::Vu2d}; <|fim_suffix|>fn main() { let spr = Sprite::new_with_color(20, 20, Color::GREEN); let sub1 = spr.create_sub_sprite((0, 0...
code_fim
medium
{ "lang": "rust", "repo": "Maix0/pixel_engine", "path": "/pixel_engine_draw/examples/sub_sprite.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> use_default: bool, default_column_value: Arc<HashMap<String, String>>, } impl DefaultColumnStream { pub(crate) fn new_from_stream( stream: SendableRecordBatchStream, target_schema: SchemaRef, ) -> Self { DefaultColumnStream { schema: transf...
code_fim
hard
{ "lang": "rust", "repo": "alldatacenter/alldata", "path": "/lake/LakeSoul/native-io/lakesoul-io/src/default_column_stream/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alldatacenter/alldata path: /lake/LakeSoul/native-io/lakesoul-io/src/default_column_stream/mod.rs /* * Copyright [2022] [DMetaSoul Team] * * 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 ...
code_fim
hard
{ "lang": "rust", "repo": "alldatacenter/alldata", "path": "/lake/LakeSoul/native-io/lakesoul-io/src/default_column_stream/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> loop { if self.cur_stream_idx >= self.inner_stream.len() { return Poll::Ready(None); } let idx = self.cur_stream_idx; let stream = &mut self.inner_stream[idx].stream; return match futures::ready!(stream.poll_next_un...
code_fim
hard
{ "lang": "rust", "repo": "alldatacenter/alldata", "path": "/lake/LakeSoul/native-io/lakesoul-io/src/default_column_stream/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MatchaChoco010/vulkan-ash-tutorial-rust-memo path: /unknownue_vulkan-tutorial-rust/src/main.rs command_buffer, vk::PipelineStageFlags::TRANSFER, vk::PipelineStageFlags::TRANSFER, vk::DependencyFlags::empty(), &...
code_fim
hard
{ "lang": "rust", "repo": "MatchaChoco010/vulkan-ash-tutorial-rust-memo", "path": "/unknownue_vulkan-tutorial-rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (debug_utils_loader, util_messenger) } } // Surfaceを作成する fn create_surface(entry: &Entry, instance: &Instance, window: &Window) -> SurfaceStuff { let surface = unsafe { platforms::create_surface(entry, instance, window).expect("Failed to create surface"...
code_fim
hard
{ "lang": "rust", "repo": "MatchaChoco010/vulkan-ash-tutorial-rust-memo", "path": "/unknownue_vulkan-tutorial-rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MatchaChoco010/vulkan-ash-tutorial-rust-memo path: /unknownue_vulkan-tutorial-rust/src/main.rs vk::Format, swapchain_extent: vk::Extent2D, device_memory_properties: &vk::PhysicalDeviceMemoryProperties, msaa_samples: vk::SampleCountFlags, ) -> (vk::Image, vk::ImageView...
code_fim
hard
{ "lang": "rust", "repo": "MatchaChoco010/vulkan-ash-tutorial-rust-memo", "path": "/unknownue_vulkan-tutorial-rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thorhs/mk66f18 path: /src/sdhc/irqstat.rs #[inline(always)] pub fn bit(self, value: bool) -> &'a mut W { self.w.bits = (self.w.bits & !(0x01 << 4)) | (((value as u32) & 0x01) << 4); self.w } } #[doc = "Buffer Read Ready\n\nValue on reset: 0"] #[derive(Clone, Copy, Debug,...
code_fim
hard
{ "lang": "rust", "repo": "thorhs/mk66f18", "path": "/src/sdhc/irqstat.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thorhs/mk66f18 path: /src/sdhc/irqstat.rs } } } #[doc = "Reader of field `CTOE`"] pub type CTOE_R = crate::R<bool, CTOE_A>; impl CTOE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CTOE_A { match self.bits { fa...
code_fim
hard
{ "lang": "rust", "repo": "thorhs/mk66f18", "path": "/src/sdhc/irqstat.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match variant { CEBE_A::_0 => false, CEBE_A::_1 => true, } } } #[doc = "Reader of field `CEBE`"] pub type CEBE_R = crate::R<bool, CEBE_A>; impl CEBE_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> CEBE_A { ...
code_fim
hard
{ "lang": "rust", "repo": "thorhs/mk66f18", "path": "/src/sdhc/irqstat.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LDA111222/GraphScope path: /research/gaia/pegasus/server/src/config.rs // //! Copyright 2020 Alibaba Group Holding 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 th...
code_fim
hard
{ "lang": "rust", "repo": "LDA111222/GraphScope", "path": "/research/gaia/pegasus/server/src/config.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pub fn read_from<P: AsRef<Path>>(path: P) -> Result<CommonConfig, StartupError> { let config_str = std::fs::read_to_string(path)?; Ok(CommonConfig::parse(&config_str)?) } } pub fn combine_config( server_id: u64, host_config: Option<HostsConfig>, common_config: Option<CommonCon...
code_fim
hard
{ "lang": "rust", "repo": "LDA111222/GraphScope", "path": "/research/gaia/pegasus/server/src/config.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Deserialize)] pub struct HostsConfig { pub peers: Vec<PeerConfig>, } impl HostsConfig { pub fn parse(content: &str) -> Result<Self, toml::de::Error> { toml::from_str(&content) } pub fn read_from<P: AsRef<Path>>(path: P) -> Result<HostsConfig, StartupError> { ...
code_fim
hard
{ "lang": "rust", "repo": "LDA111222/GraphScope", "path": "/research/gaia/pegasus/server/src/config.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn returns_errno_when_present() { assert_eq!(get_errno(&Error::from_os_error(123)), Some(123)); } #[test] fn returns_nothing_when_no_errno() { assert_eq!(get_errno(&Error::new(ErrorKind::Other, "xxx", None)), None); } #[test] fn returns_nothing_when_no_errno_even_though_it_looks_like_err...
code_fim
hard
{ "lang": "rust", "repo": "jstasiak/rust-get_errno", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn returns_nothing_when_no_errno() { assert_eq!(get_errno(&Error::new(ErrorKind::Other, "xxx", None)), None); } #[test] fn returns_nothing_when_no_errno_even_though_it_looks_like_errno1() { assert_eq!(get_errno(&Error::new(ErrorKind::Other, "Os(321)", None)), None); } #[test] fn returns_...
code_fim
hard
{ "lang": "rust", "repo": "jstasiak/rust-get_errno", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jstasiak/rust-get_errno path: /src/lib.rs #![feature(core)] #![feature(io)] #![feature(plugin)] #![plugin(regex_macros)] use std::io::{Error, ErrorKind}; use std::option::Option; use std::str::FromStr; extern crate regex; use regex::Regex; static RE: Regex = regex!(r"repr: Os\((\d+)\)"); fn...
code_fim
medium
{ "lang": "rust", "repo": "jstasiak/rust-get_errno", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for c in box_id_char_vec { let new_no_of_c; { let current_no_of_char = char_hits.get(&c); if let Some(no_of_c) = current_no_of_char { // println!("XXX matched {:?} {:?} time", c, no_of_c); new_no_of_c =...
code_fim
hard
{ "lang": "rust", "repo": "twigoftilia/advent_of_code_2018_twigoftilia", "path": "/src/day_2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: twigoftilia/advent_of_code_2018_twigoftilia path: /src/day_2.rs use crate::util; use std::collections::HashMap; // Ok, pretty hackish and direct. Horrible, but its late... // Lots of known limitation, i.e. only works for ascii (one char / byte) input pub fn solve() { let input_file = "inpu...
code_fim
hard
{ "lang": "rust", "repo": "twigoftilia/advent_of_code_2018_twigoftilia", "path": "/src/day_2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// Some shortcuts as we know we're searcing two specific top matching boxes // XXXXfn solve_second(str_vector: Vec<String>) -> String { fn solve_second(str_vector: &[String]) -> String { let mut best_match = 0; let box_ids = str_vector.len(); let box_id_last_idx = box_ids - 1; let mut box_...
code_fim
hard
{ "lang": "rust", "repo": "twigoftilia/advent_of_code_2018_twigoftilia", "path": "/src/day_2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jonhoo/ureq path: /tests/https-agent.rs #[cfg(feature = "tls")] #[cfg(feature = "json")] #[test] fn agent_set_header() { use serde::Deserialize; use std::collections::HashMap; #[derive(Deserialize, Debug)] struct HttpBin { headers: HashMap<String, String>, } let...
code_fim
hard
{ "lang": "rust", "repo": "jonhoo/ureq", "path": "/tests/https-agent.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let certs = rustls::internal::pemfile::certs(&mut BADSSL_CLIENT_CERT_PEM.as_bytes()).unwrap(); let key = rustls::internal::pemfile::rsa_private_keys(&mut BADSSL_CLIENT_CERT_PEM.as_bytes()) .unwrap()[0] .clone(); tls_config.set_single_client_cert(certs, key).unwrap(); tls_c...
code_fim
hard
{ "lang": "rust", "repo": "jonhoo/ureq", "path": "/tests/https-agent.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if received_key == next_key { println!("Client key: {}, server key: {}", next_key, received_key); } else {break;} println!("Response: {}", response); }, ...
code_fim
hard
{ "lang": "rust", "repo": "aupoderni/client-server_messaging", "path": "/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aupoderni/client-server_messaging path: /main.rs extern crate rand; use std::env; use std::io::{Read, Write}; use std::io; use std::str::from_utf8; use std::thread; use std::net::{TcpListener, TcpStream, Shutdown}; mod funcs; use funcs::*; pub fn server() { let listener = TcpListener::bind(...
code_fim
hard
{ "lang": "rust", "repo": "aupoderni/client-server_messaging", "path": "/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ComponentRange ( original ) } } impl TryFrom < crate : : Error > for ComponentRange { type Error = error : : DifferentVariant ; fn try_from ( err : crate : : Error ) - > Result < Self Self : : Error > { match err { crate : : Error : : ComponentRange ( err ) = > Ok ( err ) _ = > Err ( error : : DifferentVa...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/time/src/error/component_range.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>: Formatter < ' _ > ) - > fmt : : Result { write ! ( f " a value in the range { } . . = { } " self . minimum self . maximum ) } } # [ cfg ( feature = " serde " ) ] impl ComponentRange { pub ( crate ) fn into_de_error < E : serde : : de : : Error > ( self ) - > E { E : : invalid_value ( serde : : de : : Un...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/time/src/error/component_range.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified-and-comments-removed path: /third_party/rust/time/src/error/component_range.rs use core : : fmt ; use crate : : error ; # [ derive ( Debug Clone Copy PartialEq Eq Hash ) ] pub struct ComponentRange { pub ( crate ) name : & ' static str pub ( crate ) minimum : i64 pub ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified-and-comments-removed", "path": "/third_party/rust/time/src/error/component_range.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zealsnes/zealc-rust path: /src/zeal/parser.rs g()), }); } ParseResult::Error => { return ParseResult::Error; } }; } } fn parse_immediate( &mut self, opcode_token: ...
code_fim
hard
{ "lang": "rust", "repo": "zealsnes/zealc-rust", "path": "/src/zeal/parser.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match lookahead.ttype { TokenType::Identifier(identifier) => { self.get_next_token(); // Eat literal match self.identifier_to_snesmap(&identifier) { Some(snes_map) => { return ParseResult::Some(ParseNode { ...
code_fim
hard
{ "lang": "rust", "repo": "zealsnes/zealc-rust", "path": "/src/zeal/parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zealsnes/zealc-rust path: /src/zeal/parser.rs result, second_result, ), }); } ...
code_fim
hard
{ "lang": "rust", "repo": "zealsnes/zealc-rust", "path": "/src/zeal/parser.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } else { if neighbours == 3 { 1 } else { 0 } }; } } for i in 0..m { for j in 0..n { board[i][j] = helper[i][j]; } } }<|fim_prefix|>// repo: owen8877/le...
code_fim
hard
{ "lang": "rust", "repo": "owen8877/leetcode-rs", "path": "/src/problem_289.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: owen8877/leetcode-rs path: /src/problem_289.rs pub fn game_of_life(board: &mut Vec<Vec<i32>>) { let m = board.len(); let n = board[0].len(); let mut helper = vec![vec![0; n]; m]; let ds = [[-1, 0], [-1, -1], [0, -1], [1, -1], [1, 0], [1, 1], [0, 1], [-1, 1]]; for i in 0..m {...
code_fim
hard
{ "lang": "rust", "repo": "owen8877/leetcode-rs", "path": "/src/problem_289.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: redsnapper2006/leetcode-cn path: /P/2294-partition-array-such-that-maximum-difference-is-k/main.rs struct Solution {} impl Solution { pub fn partition_array(nums: Vec<i3<|fim_suffix|>ase { base = v + k; ret += 1; } } ret } }<|fim_middle|>2>, k: i32) -> i32 { ...
code_fim
medium
{ "lang": "rust", "repo": "redsnapper2006/leetcode-cn", "path": "/P/2294-partition-array-such-that-maximum-difference-is-k/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ase { base = v + k; ret += 1; } } ret } }<|fim_prefix|>// repo: redsnapper2006/leetcode-cn path: /P/2294-partition-array-such-that-maximum-difference-is-k/main.rs struct Solution {} impl Solution { pub fn partition_array(nums: Vec<i3<|fim_middle|>2>, k: i32) -> i32 { ...
code_fim
medium
{ "lang": "rust", "repo": "redsnapper2006/leetcode-cn", "path": "/P/2294-partition-array-such-that-maximum-difference-is-k/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mystor/dist-xprs-example path: /rt/nsIPromptService.rs // // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIPromptService.idl // pub mod nsIPromptService_consts { pub const BUTTON_POS_0: i64 = 1; pub const BUTTON_POS_1: i64 = 256; pub const BUTTON_POS_2: i64 = 65536...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/rt/nsIPromptService.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /* boolean prompt (in mozIDOMWindowProxy aParent, in wstring aDialogTitle, in wstring aText, inout wstring aValue, in wstring aCheckMsg, inout boolean aCheckState); */ pub prompt: unsafe extern "C" fn (this: *const nsIPromptService, aParent: *const mozIDOMWindowProxy, aDialogTitle: *const libc::in...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/rt/nsIPromptService.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: johnmave126/symm_impl path: /tests/other_types.rs use symm_impl::symmetric; trait A<Other> { fn op(&self, other: &Other) -> i32; <|fim_suffix|> let a = [0; 5]; let b = "1"; assert_eq!(a.op(&b), 5); assert_eq!(b.op(&a), 5); }<|fim_middle|>} #[symmetric] impl<'a> A<&'a str> fo...
code_fim
medium
{ "lang": "rust", "repo": "johnmave126/symm_impl", "path": "/tests/other_types.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_str_array() { let a = [0; 5]; let b = "1"; assert_eq!(a.op(&b), 5); assert_eq!(b.op(&a), 5); }<|fim_prefix|>// repo: johnmave126/symm_impl path: /tests/other_types.rs use symm_impl::symmetric; trait A<Other> { fn op(&self, other: &Other) -> i32; <|fim_middle|>} #[sym...
code_fim
medium
{ "lang": "rust", "repo": "johnmave126/symm_impl", "path": "/tests/other_types.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<D> RenderProgram<D> where D: Device { fn new(device: &D, resources: &dyn ResourceLoader) -> RenderProgram<D> { let program = device.create_program(resources, "render"); let position_attribute = device.get_vertex_attr(&program, "Position").unwrap(); let tile_rect_uniform = ...
code_fim
hard
{ "lang": "rust", "repo": "pcwalton/virtex", "path": "/src/renderer_simple.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let program = device.create_program(resources, "render"); let position_attribute = device.get_vertex_attr(&program, "Position").unwrap(); let tile_rect_uniform = device.get_uniform(&program, "TileRect"); let tile_tex_rect_uniform = device.get_uniform(&program, "TileTexRect"...
code_fim
hard
{ "lang": "rust", "repo": "pcwalton/virtex", "path": "/src/renderer_simple.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pcwalton/virtex path: /src/renderer_simple.rs // virtex/src/render_simple.rs use crate::manager2d::VirtualTextureManager2D; use pathfinder_content::color::ColorF; use pathfinder_geometry::rect::{RectF, RectI}; use pathfinder_geometry::vector::{Vector2F, Vector2I}; use pathfinder_gpu::resources...
code_fim
hard
{ "lang": "rust", "repo": "pcwalton/virtex", "path": "/src/renderer_simple.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rror("The function {0} requires {1} arguments, but got {2}")] WrongNumberOfArgs(Expr, usize, usize), #[error("Fail with type {0}")] Fail(Expr), #[error("Unfilled hole in code")] UnfilledHole, #[error("{0} cannot be the type of a lambda")] InvalidLambdaType(Expr), #[error("N...
code_fim
hard
{ "lang": "rust", "repo": "alex-ozdemir/rlfsc", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alex-ozdemir/rlfsc path: /src/error.rs use crate::code::{MpBinOp, MpCond, Pattern}; use crate::expr::Expr; use crate::token::Token; use thiserror::Error; #[derive(Error, Debug)] pub enum LfscError { #[error("Got an unexpected EOF")] UnexpectedEof, #[error("Unknown identifier `{0}`"...
code_fim
hard
{ "lang": "rust", "repo": "alex-ozdemir/rlfsc", "path": "/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let saved_data = repo.get(&TokenId::from("T123")).await.unwrap(); assert!(saved_data.get("user_id").is_some()); assert_eq!(data.get("user_id"), saved_data.get("user_id")); assert!(repo.get(&TokenId::from("T777")).await.is_none()); assert!(repo.get(&TokenId::from("T...
code_fim
hard
{ "lang": "rust", "repo": "dorucioclea/omics", "path": "/identity/infrastructure/persistence/inmem/token_repository.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dorucioclea/omics path: /identity/infrastructure/persistence/inmem/token_repository.rs use async_trait::async_trait; use common::cache::Cache; use common::infrastructure::cache::InMemCache; use common::result::Result; use crate::domain::token::{Data, TokenId, TokenRepository}; #[derive(Defaul...
code_fim
hard
{ "lang": "rust", "repo": "dorucioclea/omics", "path": "/identity/infrastructure/persistence/inmem/token_repository.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Swatinem/rust-analyzer path: /crates/hir_ty/src/diagnostics/decl_check.rs tType::Argument, ident: AstPtr::new(&ast_ptr), expected_case: param_to_rename.expected_case, ident_text: param_to_rename.current_name.to_string(), suggested_t...
code_fim
hard
{ "lang": "rust", "repo": "Swatinem/rust-analyzer", "path": "/crates/hir_ty/src/diagnostics/decl_check.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let body = self.db.body(func.into()); // Recursively validate inner scope items, such as static variables and constants. for (_, block_def_map) in body.blocks(self.db.upcast()) { for (_, module) in block_def_map.modules() { for def_id in module.scope.de...
code_fim
hard
{ "lang": "rust", "repo": "Swatinem/rust-analyzer", "path": "/crates/hir_ty/src/diagnostics/decl_check.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Swatinem/rust-analyzer path: /crates/hir_ty/src/diagnostics/decl_check.rs tual variable declaration, e.g. `Some(val) => {..}` match arm. continue; } let diagnostic = IncorrectCase { file: sou...
code_fim
hard
{ "lang": "rust", "repo": "Swatinem/rust-analyzer", "path": "/crates/hir_ty/src/diagnostics/decl_check.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> println!("{}", game); loop { let str_in: String = read!(); for i in str_in.chars() { let dir = match i { 'w' => Some(Direction::UP), 'a' => Some(Direction::LEFT), 's' => Some(Direction::DOWN), 'd' => Some...
code_fim
medium
{ "lang": "rust", "repo": "thanadolps/rust_snake", "path": "/examples/console_play.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thanadolps/rust_snake path: /examples/console_play.rs use console::Term; use rust_snake::{Direction, SnakeGame}; use text_io::{read, try_read, try_scan}; fn main() { <|fim_suffix|> loop { let str_in: String = read!(); for i in str_in.chars() { let dir = match i ...
code_fim
medium
{ "lang": "rust", "repo": "thanadolps/rust_snake", "path": "/examples/console_play.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> loop { let str_in: String = read!(); for i in str_in.chars() { let dir = match i { 'w' => Some(Direction::UP), 'a' => Some(Direction::LEFT), 's' => Some(Direction::DOWN), 'd' => Some(Direction::RIGHT), ...
code_fim
medium
{ "lang": "rust", "repo": "thanadolps/rust_snake", "path": "/examples/console_play.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[rstest_parametrize(ser_method_int, case(0), case(1), case(2), case(3))] fn add_to_non_existent_list(ser_method_int: i32) { test_setup!("lget_corner_cases", ser_method_int, db_name); let mut db = PickleDb::new( &db_name, PickleDbDumpPolicy::DumpUponRequest, ser_method!(se...
code_fim
hard
{ "lang": "rust", "repo": "seladb/pickledb-rs", "path": "/tests/pickledb_list_tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_setup!("remove_values_from_list", ser_method_int, db_name); let mut db = PickleDb::new( &db_name, PickleDbDumpPolicy::AutoDump, ser_method!(ser_method_int), ); // add a struct to list1 #[derive(Serialize, Deserialize, Debug)] struct MySquare { ...
code_fim
hard
{ "lang": "rust", "repo": "seladb/pickledb-rs", "path": "/tests/pickledb_list_tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: seladb/pickledb-rs path: /tests/pickledb_list_tests.rs w(clippy::float_cmp)] use pickledb::{PickleDb, PickleDbDumpPolicy, SerializationMethod}; use serde::{Deserialize, Serialize}; mod common; #[cfg(test)] extern crate rstest; use rstest::rstest_parametrize; #[allow(clippy::cognitive_comple...
code_fim
hard
{ "lang": "rust", "repo": "seladb/pickledb-rs", "path": "/tests/pickledb_list_tests.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oxalica/onedrive-api path: /src/onedrive.rs Into<ItemLocation<'b>>, dest_name: Option<&FileName>, ) -> Result<DriveItem> { self.move_with_option(source_item, dest_folder, dest_name, Default::default()) .await } /// Delete a `DriveItem`. /// /// D...
code_fim
hard
{ "lang": "rust", "repo": "oxalica/onedrive-api", "path": "/src/onedrive.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Fetch the next page, or `None` if reaches the end. pub async fn fetch_next_page(&mut self, onedrive: &OneDrive) -> Result<Option<Vec<DriveItem>>> { self.fetcher.fetch_next_page(onedrive).await } /// Fetch all rest pages, collect all items, and also return `delta_url`. /// ...
code_fim
hard
{ "lang": "rust", "repo": "oxalica/onedrive-api", "path": "/src/onedrive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Fetch all rest pages, collect all items, and also return `delta_url`. /// /// # Errors /// /// Any error occurs when fetching will lead to an failure, and /// all progress will be lost. pub async fn fetch_all(self, onedrive: &OneDrive) -> Result<(Vec<DriveItem>, String)> { ...
code_fim
hard
{ "lang": "rust", "repo": "oxalica/onedrive-api", "path": "/src/onedrive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-num/num-rational path: /src/pow.rs use crate::Ratio; use core::cmp; use num_integer::Integer; use num_traits::{One, Pow}; macro_rules! pow_unsigned_impl { (@ $exp:ty) => { type Output = Ratio<T>; #[inline] fn pow(self, expon: $exp) -> Ratio<T> { Rat...
code_fim
hard
{ "lang": "rust", "repo": "rust-num/num-rational", "path": "/src/pow.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> Pow::pow(self, *expon) } } }; } pow_signed_impl!(i8, u8); pow_signed_impl!(i16, u16); pow_signed_impl!(i32, u32); pow_signed_impl!(i64, u64); pow_signed_impl!(i128, u128); pow_signed_impl!(isize, usize); #[cfg(feature = "num-bigint")] mod bigint { use super::*;...
code_fim
hard
{ "lang": "rust", "repo": "rust-num/num-rational", "path": "/src/pow.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> pub fn as_xcb(&self) -> &xcb::Connection { &self.conn } pub fn into_xcb(self) -> xcb::Connection { self.conn } }<|fim_prefix|>// repo: panicbit/lax path: /src/connection.rs use prelude::*; use std::cmp::max; use xcb; use xcb::ConnResult; use window::RevertFocus; pub str...
code_fim
hard
{ "lang": "rust", "repo": "panicbit/lax", "path": "/src/connection.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(WindowRef::from(self, reply.focus())) } pub fn flush(&self) -> bool { self.as_xcb().flush() } pub fn as_xcb(&self) -> &xcb::Connection { &self.conn } pub fn into_xcb(self) -> xcb::Connection { self.conn } }<|fim_prefix|>// repo: panicbit/la...
code_fim
hard
{ "lang": "rust", "repo": "panicbit/lax", "path": "/src/connection.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: panicbit/lax path: /src/connection.rs use prelude::*; use std::cmp::max; use xcb; use xcb::ConnResult; use window::RevertFocus; pub struct Connection { conn: xcb::Connection, preferred_screen: u8, } <|fim_suffix|> let (conn, preferred_screen) = try!(xcb::Connection::connect(dis...
code_fim
hard
{ "lang": "rust", "repo": "panicbit/lax", "path": "/src/connection.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> InputMode::Tmux => "Tmux", } } /// Creates an enum from field names used in the ProtoBuf definition. pub fn from_str_name(value: &str) -> ::core::option::Option<Self> { match value { "Normal" => Some(Self::Normal), "Locked" => Some(Self::Locked)...
code_fim
hard
{ "lang": "rust", "repo": "zellij-org/zellij", "path": "/zellij-utils/assets/prost/api.input_mode.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zellij-org/zellij path: /zellij-utils/assets/prost/api.input_mode.rs #[allow(clippy::derive_partial_eq_without_eq)] #[derive(Clone, PartialEq, ::prost::Message)] pub struct InputModeMessage { #[prost(enumeration = "InputMode", tag = "1")] pub input_mode: i32, } #[derive(Clone, Copy, Debu...
code_fim
hard
{ "lang": "rust", "repo": "zellij-org/zellij", "path": "/zellij-utils/assets/prost/api.input_mode.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tokio::time::pause(); log::error!("Clock stops at {:?}", Instant::now()); // The first head request is sent and this should be the only request that gets an Ok response. // This sets the last reset of the rate limiting to block height 1 (current block height). send_n_request_to_succee...
code_fim
hard
{ "lang": "rust", "repo": "nimiq/core-rs-albatross", "path": "/network-libp2p/tests/request_response.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Spawn the request listener future tokio::spawn(request_listener_future); tokio::time::sleep(Duration::from_secs(1)).await; log::info!("Sending requests"); for _ in 0..num_requests { // Send the request and get future for the response let response_future = net2.req...
code_fim
hard
{ "lang": "rust", "repo": "nimiq/core-rs-albatross", "path": "/network-libp2p/tests/request_response.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nimiq/core-rs-albatross path: /network-libp2p/tests/request_response.rs Serialize::serialize_to_writer(self, &mut data).unwrap(); data } fn deserialize_request(buffer: &[u8]) -> Result<Self, DeserializeError> { // Check for correct type. let (ty, message_...
code_fim
hard
{ "lang": "rust", "repo": "nimiq/core-rs-albatross", "path": "/network-libp2p/tests/request_response.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fbenkstein/advent-of-code path: /dima/src/day15.rs let npc = &self.npcs[*idx]; (npc.hit_points, npc.pos.1, npc.pos.0) }) } fn do_npc_move(&mut self, idx: usize) -> bool { let npc_pos = self.npcs[idx].pos; let npcs = self.alive_...
code_fim
hard
{ "lang": "rust", "repo": "fbenkstein/advent-of-code", "path": "/dima/src/day15.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn run(&mut self) -> usize { // println!("{}", self); let mut num_rounds = 0; while self.round() { num_rounds += 1; // println!("{}", self); // thread::sleep(time::Duration::from_millis(1000)); } let hit_points = self ...
code_fim
hard
{ "lang": "rust", "repo": "fbenkstein/advent-of-code", "path": "/dima/src/day15.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fbenkstein/advent-of-code path: /dima/src/day15.rs impl IndexMut<(usize, usize)> for Map { fn index_mut(&mut self, (x, y): (usize, usize)) -> &mut Self::Output { &mut self.fields[x + self.width * y] } } #[derive(Debug, PartialEq, Eq, Clone, Copy)] enum Race { Elf, Goblin...
code_fim
hard
{ "lang": "rust", "repo": "fbenkstein/advent-of-code", "path": "/dima/src/day15.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[non_exhaustive] #[derive(std::clone::Clone, std::cmp::PartialEq)] pub struct CreateSignalingChannelOutput { /// <p>The Amazon Resource Name (ARN) of the created channel.</p> pub channel_arn: std::option::Option<std::string::String>, } impl std::fmt::Debug for CreateSignalingChannelOutput { f...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/kinesisvideo/src/output.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/kinesisvideo/src/output.rs gs_for_resource_output { /// A builder for [`ListTagsForResourceOutput`](crate::output::ListTagsForResourceOutput) #[non_exhaustive] #[derive(std::default::Default, std::clone::Clone, std::cmp::PartialEq, std::fmt::Debug)] ...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/kinesisvideo/src/output.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut formatter = f.debug_struct("ListSignalingChannelsOutput"); formatter.field("channel_info_list", &self.channel_info_list); formatter.field("next_token", &self.next_token); formatter.finish() } } /// See [`ListSignalingChannelsOutput`](crate::output::ListSignaling...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/kinesisvideo/src/output.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>struct Grid { serial: i32, grid_size: usize, power: Vec<i32>, } impl Grid { pub fn new(serial: i32, grid_size: usize) -> Grid { let size = grid_size * grid_size; let mut grid = Grid{ serial, grid_size, power: vec![0; size] }; for x in 0..grid_size { for ...
code_fim
hard
{ "lang": "rust", "repo": "gonzus/AdventOfCode", "path": "/attic/rust/c11/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("info {:?}", info); let grid = Grid::new(info.serial, GRID_SIZE); let mut top_x: i32 = -1; let mut top_y: i32 = -1; let mut top_s: i32 = -1; let mut top_p: i32 = -1; let mut tot: Vec<i32> = vec![0; GRID_SIZE]; for s in 1..GRID_SIZE+1 { println!("size {}", s...
code_fim
hard
{ "lang": "rust", "repo": "gonzus/AdventOfCode", "path": "/attic/rust/c11/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gonzus/AdventOfCode path: /attic/rust/c11/src/main.rs use std::io::{self, BufRead}; const GRID_SIZE:usize = 300; // const GRID_SIZE:usize = 10; #[derive(Debug)] struct Info { serial: i32, power: i32, x: usize, y: usize, } impl Info { pub fn new(serial: i32, power: i32, x: u...
code_fim
hard
{ "lang": "rust", "repo": "gonzus/AdventOfCode", "path": "/attic/rust/c11/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: K0bin/SourceRenderer path: /graphics/vulkan/src/surface.rs use std::sync::atomic::{ AtomicBool, Ordering, }; use std::sync::{ Arc, Mutex, MutexGuard, }; use ash::extensions::khr::Surface as SurfaceLoader; use ash::prelude::VkResult; use ash::vk; use ash::vk::Handle; use sour...
code_fim
hard
{ "lang": "rust", "repo": "K0bin/SourceRenderer", "path": "/graphics/vulkan/src/surface.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl PartialEq for VkSurface { fn eq(&self, other: &Self) -> bool { let self_handle = self.surface.lock().unwrap().as_raw(); let other_handle = other.surface.lock().unwrap().as_raw(); self.instance.instance.handle() == other.instance.instance.handle() && self_handle...
code_fim
hard
{ "lang": "rust", "repo": "K0bin/SourceRenderer", "path": "/graphics/vulkan/src/surface.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn get_capabilities( &self, physical_device: &vk::PhysicalDevice, ) -> VkResult<vk::SurfaceCapabilitiesKHR> { let handle = self.surface_handle(); unsafe { self.surface_loader .get_physical_device_surface_capabilities(*physical_...
code_fim
hard
{ "lang": "rust", "repo": "K0bin/SourceRenderer", "path": "/graphics/vulkan/src/surface.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dohyeunglee/fup path: /src/message.rs use header::Header; use body::Body; use Serializable; pub struct Message { header: Header, body: Body } impl Message { pub fn new(header: Header, body: Body) -> Message { Message { header, body } } pub fn get_header(&self) -> &...
code_fim
medium
{ "lang": "rust", "repo": "dohyeunglee/fup", "path": "/src/message.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn get_size(&self) -> u32 { self.header.get_size() + self.body.get_size() } }<|fim_prefix|>// repo: dohyeunglee/fup path: /src/message.rs use header::Header; use body::Body; use Serializable; pub struct Message { header: Header, body: Body } impl Message { pub fn new(heade...
code_fim
hard
{ "lang": "rust", "repo": "dohyeunglee/fup", "path": "/src/message.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phucvin/tl_sync path: /src/lib.rs #![feature(box_into_raw_non_null)] #![feature(fnbox)] #![feature(drain_filter)] extern crate uuid; // extern crate rayon; mod rc; pub use rc::*; mod trust; pub use trust::*; mod cell; use cell::*; mod manual_copy; pub use manual_copy::*; mod tl; pub use tl...
code_fim
easy
{ "lang": "rust", "repo": "phucvin/tl_sync", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod manual_copy; pub use manual_copy::*; mod tl; pub use tl::*; mod sync; pub use sync::*; mod threads; pub use threads::*; mod runner; pub use runner::*; mod actions; pub use actions::*;<|fim_prefix|>// repo: phucvin/tl_sync path: /src/lib.rs #![feature(box_into_raw_non_null)] #![feature(fnbox)] #!...
code_fim
easy
{ "lang": "rust", "repo": "phucvin/tl_sync", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rethab/monkey-rs path: /src/x86/instructions.rs use std::fmt; #[derive(Clone, Debug, PartialEq)] pub enum Instruction { Move(AddressingMode, AddressingMode), Lea(AddressingMode, Register), Add(AddressingMode, Register), Sub(AddressingMode, Register), Mul(Register), Div(A...
code_fim
hard
{ "lang": "rust", "repo": "rethab/monkey-rs", "path": "/src/x86/instructions.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub const CALLEE_SAVED_REGISTERS: &[Register] = &[ Register::RBX, Register::R12, Register::R13, Register::R14, Register::R15, ]; pub const SCRATCH_REGISTERS: &[Register] = &[ Register::RBX, Register::R10, Register::R11, Register::R12, Register::R13, Register::R...
code_fim
hard
{ "lang": "rust", "repo": "rethab/monkey-rs", "path": "/src/x86/instructions.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alamont/maxwell path: /src/material/spectrum.rs use dyn_clone::DynClone; use crate::constants::{BOLTZMANNS_CONSTANT, SPEED_OF_LIGHT, PLANCKS_CONSTANT, WIENS_CONSTANT}; pub trait Spectrum: Sync + Send + DynClone { fn value(&self, wavelength: f32) -> f32 { 0.0 } } dyn_clon...
code_fim
hard
{ "lang": "rust", "repo": "alamont/maxwell", "path": "/src/material/spectrum.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Multiply by 1e-9 (nano), because the wavelength is specified in nm, // while m is the standard unit. let f = c / (wavelength * 1.0e-9); // Then evaluate the Boltzmann distribution. (2.0 * h * f * f * f) / (c * c * ((h * f / (k * temperature)).exp() - 1.0)) }<|fim_prefix|>// ...
code_fim
hard
{ "lang": "rust", "repo": "alamont/maxwell", "path": "/src/material/spectrum.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Zerss/osb path: /src/layer.rs // Copyright 2021 Thomas Ballasi // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://opensource.org/licenses/MIT>, at your // option. This file may not ...
code_fim
hard
{ "lang": "rust", "repo": "Zerss/osb", "path": "/src/layer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dvdsk/bluebus path: /src/lib.rs use std::time::Duration; pub use rustbus::client_conn::Timeout; use rustbus::{get_system_bus_path, standard_messages, Conn, RpcConn}; mod dbus_helpers; use dbus_helpers::*; mod error; pub use error::{Context, Error}; pub mod operations; pub mod util; // pub re-...
code_fim
hard
{ "lang": "rust", "repo": "dvdsk/bluebus", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut message = register_agent("/bluebus/agent", "KeyboardDisplay").unwrap(); let response_serial = connection.send_message(&mut message, self.timeout).unwrap(); let msg = connection .wait_response(response_serial, self.timeout) .unwrap() .unma...
code_fim
hard
{ "lang": "rust", "repo": "dvdsk/bluebus", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn build(self) -> Result<Ble, Error> { let session_path = get_system_bus_path()?; let con = Conn::connect_to_bus(session_path, true)?; let mut connection = RpcConn::new(con); // send the obligatory hello message let response_serial = connection.s...
code_fim
hard
{ "lang": "rust", "repo": "dvdsk/bluebus", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pac85/vulkano-events path: /vulkano/src/swapchain/capabilities.rs PresentMode { /// Immediately shows the image to the user. May result in visible tearing. Immediate = vk::PRESENT_MODE_IMMEDIATE_KHR, /// The action of presenting an image puts it in wait. When the next vertical blan...
code_fim
hard
{ "lang": "rust", "repo": "pac85/vulkano-events", "path": "/vulkano/src/swapchain/capabilities.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns true if the given present mode is in this list of supported modes. #[inline] pub fn supports(&self, mode: PresentMode) -> bool { match mode { PresentMode::Immediate => self.immediate, PresentMode::Mailbox => self.mailbox, PresentMode::Fif...
code_fim
hard
{ "lang": "rust", "repo": "pac85/vulkano-events", "path": "/vulkano/src/swapchain/capabilities.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for SurfaceTransform { #[inline] fn default() -> SurfaceTransform { SurfaceTransform::Identity } } /// How the presentation engine should interpret the data. /// /// # A quick lesson about color spaces /// /// ## What is a color space? /// /// Each pixel of a monitor is m...
code_fim
hard
{ "lang": "rust", "repo": "pac85/vulkano-events", "path": "/vulkano/src/swapchain/capabilities.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Kattis/problemtools path: /examples/different/submissions/accepted/different.rs use std::io::{self, BufRead}; fn main() { let stdin = io::stdin(); f<|fim_suffix|>4> = line.split_whitespace() .map(|num| num.parse().unwrap()) .collect(); println!("{}", (num...
code_fim
medium
{ "lang": "rust", "repo": "Kattis/problemtools", "path": "/examples/different/submissions/accepted/different.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>4> = line.split_whitespace() .map(|num| num.parse().unwrap()) .collect(); println!("{}", (nums[0] - nums[1]).abs()); } }<|fim_prefix|>// repo: Kattis/problemtools path: /examples/different/submissions/accepted/different.rs use std::io::{self, BufRead}; fn main() { ...
code_fim
medium
{ "lang": "rust", "repo": "Kattis/problemtools", "path": "/examples/different/submissions/accepted/different.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl RelativeEntry { pub fn new(entry: Entry, base_offset: Offset) -> RelativeEntry { RelativeEntry{ offset: (entry.offset - base_offset) as u32, position: entry.position as u32, } } pub fn fill(&mut self, entry: &mut Entry, base_offset: Offset) { ...
code_fim
medium
{ "lang": "rust", "repo": "fenimore/latka2", "path": "/src/partition/entry.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fenimore/latka2 path: /src/partition/entry.rs use crate::partition::{Offset}; pub const ENTRY_WIDTH: u32 = 8; #[derive(Debug, PartialEq, Clone, Copy)] pub struct Entry{ pub offset: Offset, pub position: Offset, } impl Entry { pub fn new(offset: Offset, position: u64) -> Entry { ...
code_fim
medium
{ "lang": "rust", "repo": "fenimore/latka2", "path": "/src/partition/entry.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> bool, pub starred_url: String, pub subscriptions_url: String, #[serde(rename = "type")] pub _type: String, pub url: String, }<|fim_prefix|>// repo: media-cloud-ai/mcai_workers path: /src/github/owner.rs #[derive(Debug, Deserialize)] pub struct Owner { pub avatar_url: String, pub events_url...
code_fim
hard
{ "lang": "rust", "repo": "media-cloud-ai/mcai_workers", "path": "/src/github/owner.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: media-cloud-ai/mcai_workers path: /src/github/owner.rs #[derive(Debug, Deserialize)] pub struct Owner { pub avatar_url: String, pub events_url: String, pub followers_url: String, pub<|fim_suffix|> bool, pub starred_url: String, pub subscriptions_url: String, #[serde(rename = "type"...
code_fim
hard
{ "lang": "rust", "repo": "media-cloud-ai/mcai_workers", "path": "/src/github/owner.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/lib/fdio/rust/test/spawn_builder_test_target.rs // Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. <|fim_suffix|> // Validate injected directory as...
code_fim
medium
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/fdio/rust/test/spawn_builder_test_target.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }