text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> pub fn with_position(mut self, x: f32, y: f32) -> Self { self.position = [x, y]; self } pub fn with_color(mut self, r: f32, g: f32, b: f32) -> Self { self.color = [r, g, b]; self } }<|fim_prefix|>// repo: twh2898/rs_ant path: /src/support/vertex.rs #[deri...
code_fim
hard
{ "lang": "rust", "repo": "twh2898/rs_ant", "path": "/src/support/vertex.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("Welcome to the Money languauge."); println!("feel free to typein in commands."); let mut Monkey_input = String::new(); loop{ io::stdin() .read_line(&mut Monkey_input) .expect("Failed to read line"); } let m = token::LET; let z = token::LET;...
code_fim
easy
{ "lang": "rust", "repo": "ropman76/RustParser", "path": "/RustParser/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let m = token::LET; let z = token::LET; println!("{}",z); }<|fim_prefix|>// repo: ropman76/RustParser path: /RustParser/src/main.rs use std::io; use std::io::prelude::*; mod token; mod Lexer; fn main() { <|fim_middle|> println!("Welcome to the Money languauge."); println!("feel fre...
code_fim
hard
{ "lang": "rust", "repo": "ropman76/RustParser", "path": "/RustParser/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ropman76/RustParser path: /RustParser/src/main.rs use std::io; use std::io::prelude::*; mod token; mod Lexer; <|fim_suffix|> let mut Monkey_input = String::new(); loop{ io::stdin() .read_line(&mut Monkey_input) .expect("Failed to read line"); } let m = tok...
code_fim
medium
{ "lang": "rust", "repo": "ropman76/RustParser", "path": "/RustParser/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if user.is_none() { return Ok(HttpResponse::NotFound().finish()); } let user = user.unwrap(); let valid = util::verify(&submission.password, user.password()).expect("pls hash"); if !valid { return Ok(HttpResponse::Unauthorized().finish()); } let (id, token) =...
code_fim
hard
{ "lang": "rust", "repo": "mbStavola/konabb", "path": "/backend/src/controllers/user.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mbStavola/konabb path: /backend/src/controllers/user.rs use actix_web::{ HttpResponse, web::{Data, Json, Path}, }; use chrono::Duration; use redis::Commands; use serde_derive::{Deserialize, Serialize}; use uuid::Uuid; use validator::Validate; use validator_derive::Validate; use crate::{...
code_fim
hard
{ "lang": "rust", "repo": "mbStavola/konabb", "path": "/backend/src/controllers/user.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let running = process::is_running(self.pid); if self.engine_state() == EngineState::Running && running == false { self.set_engine_state(EngineState::Staged); if self.save_to_disk().is_err() { tracing::warn!("Problem saving serialized emulator to disk...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/developer/ffx/plugins/emulator/engines/src/qemu_based/femu/mod.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> /// Get the AEMU binary path from the SDK manifest and verify it exists. async fn load_emulator_binary(&mut self) -> Result<()> { let sdk = ffx_config::global_env_context() .context("loading global environment context")? .get_sdk() .await?; self....
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/developer/ffx/plugins/emulator/engines/src/qemu_based/femu/mod.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/developer/ffx/plugins/emulator/engines/src/qemu_based/femu/mod.rs // Copyright 2021 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. //! The femu module encapsulates the ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/developer/ffx/plugins/emulator/engines/src/qemu_based/femu/mod.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PoorlyDefinedBehaviour/data-structures-and-algorithms path: /rust/algorithms/others/longest_happy_string/main.rs use std::collections::BinaryHeap; /// 1405. Longest Happy String /// /// s only contains the letters 'a', 'b', and 'c'. /// s does not contain any of "aaa", "bbb", or "ccc" as a subs...
code_fim
hard
{ "lang": "rust", "repo": "PoorlyDefinedBehaviour/data-structures-and-algorithms", "path": "/rust/algorithms/others/longest_happy_string/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn test_longest_diverse_string() { let tests = vec![(1, 1, 7, "ccbccacc"), (7, 1, 0, "aabaa")]; for (a, b, c, expected) in tests { assert_eq!(String::from(expected), longest_diverse_string(a, b, c)); } } }...
code_fim
hard
{ "lang": "rust", "repo": "PoorlyDefinedBehaviour/data-structures-and-algorithms", "path": "/rust/algorithms/others/longest_happy_string/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> priority_queue.push((times_we_can_use_this_character - 1, character)); previous_previous = previous; previous = Some(character); } buffer } fn main() {} #[cfg(test)] mod tests { use super::*; #[test] fn test_longest_diverse_string() { let tests = ve...
code_fim
hard
{ "lang": "rust", "repo": "PoorlyDefinedBehaviour/data-structures-and-algorithms", "path": "/rust/algorithms/others/longest_happy_string/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn dfs(i: usize, p: usize, g: &Vec<Vec<usize>>, ans: &mut Vec<usize>) { ans.push(i); for &j in &g[i] { if j != p { dfs(j, i, g, ans); } } if p != !0 { ans.push(p); } }<|fim_prefix|>// repo: ia7ck/competitive-programming path: /AtCoder/abc213/src/bin...
code_fim
hard
{ "lang": "rust", "repo": "ia7ck/competitive-programming", "path": "/AtCoder/abc213/src/bin/d/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ia7ck/competitive-programming path: /AtCoder/abc213/src/bin/d/main.rs use procon_reader::ProconReader; fn main() { let stdin = std::io::stdin(); let mut rd = ProconReader::new(stdin.lock()); <|fim_suffix|> ans.push(i); for &j in &g[i] { if j != p { dfs(j, i, ...
code_fim
hard
{ "lang": "rust", "repo": "ia7ck/competitive-programming", "path": "/AtCoder/abc213/src/bin/d/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.draw_map } #[inline] fn mut_draw_map(&mut self) -> &mut DrawMap { &mut self.draw_map } #[inline] fn opts(&self) -> &Options { &self.opts } #[inline] fn mut_opts(&mut self) -> &mut Options { &mut self.opts } fn map_switched(...
code_fim
hard
{ "lang": "rust", "repo": "timefly-1989/abstreet", "path": "/map_gui/src/simple_app.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> unreachable!() } #[inline] fn cs(&self) -> &ColorScheme { &self.cs } #[inline] fn mut_cs(&mut self) -> &mut ColorScheme { &mut self.cs } #[inline] fn draw_map(&self) -> &DrawMap { &self.draw_map } #[inline] fn mut_draw_map(&mu...
code_fim
hard
{ "lang": "rust", "repo": "timefly-1989/abstreet", "path": "/map_gui/src/simple_app.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: timefly-1989/abstreet path: /map_gui/src/simple_app.rs use abstio::MapName; use abstutil::{CmdArgs, Timer}; use geom::{Circle, Distance, Duration, Pt2D, Time}; use map_model::{IntersectionID, Map}; use sim::Sim; use widgetry::{Canvas, EventCtx, GfxCtx, SharedAppState, State, Transition, Warper};...
code_fim
hard
{ "lang": "rust", "repo": "timefly-1989/abstreet", "path": "/map_gui/src/simple_app.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>s[1].clone(); // cannot move, so use clone match command { _hello => println!("Hello there!"), } } }<|fim_prefix|>// repo: Gopikrishna19/learning-rust path: /src/cli_args.rs use std::env; pub fn run() { let args: Vec<String> = env::ar<|fim_middle|>gs().collect(); ...
code_fim
medium
{ "lang": "rust", "repo": "Gopikrishna19/learning-rust", "path": "/src/cli_args.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> _hello => println!("Hello there!"), } } }<|fim_prefix|>// repo: Gopikrishna19/learning-rust path: /src/cli_args.rs use std::env; pub fn run() { let args: Vec<String> = env::ar<|fim_middle|>gs().collect(); if args.len() > 2 { let command = args[1].clone(); // can...
code_fim
medium
{ "lang": "rust", "repo": "Gopikrishna19/learning-rust", "path": "/src/cli_args.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Gopikrishna19/learning-rust path: /src/cli_args.rs use std::env; pub fn run() { let args: Vec<String> = env::ar<|fim_suffix|>s[1].clone(); // cannot move, so use clone match command { _hello => println!("Hello there!"), } } }<|fim_middle|>gs().collect(); ...
code_fim
medium
{ "lang": "rust", "repo": "Gopikrishna19/learning-rust", "path": "/src/cli_args.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use sightglass_data::Phase; #[test] fn matching_fields() { let key = Key { arch: Some("x86".into()), engine: Some("wasmtime".into()), wasm: Some("bench.wasm".into()), phase: Some(Phase::Compilat...
code_fim
hard
{ "lang": "rust", "repo": "bytecodealliance/sightglass", "path": "/crates/analysis/src/keys.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bytecodealliance/sightglass path: /crates/analysis/src/keys.rs use sightglass_data::{Measurement, Phase}; use std::{borrow::Cow, collections::BTreeSet}; /// A builder for finding keys in a set of measurements. #[derive(Copy, Clone)] pub struct KeyBuilder { arch: bool, engine: bool, ...
code_fim
hard
{ "lang": "rust", "repo": "bytecodealliance/sightglass", "path": "/crates/analysis/src/keys.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ashleysmithgpu/rust_vulkan_api_generator path: /vkraw/examples/hello_triangle.rs winapi::shared::windef::RECT { left: 0, top: 0, right: width, bottom: height }; let style = winapi::um::winuser::WS_OVERLAPPEDWINDOW | winapi::um::winuser::WS_CLIPSIBLINGS | winapi::um::winuser::WS...
code_fim
hard
{ "lang": "rust", "repo": "ashleysmithgpu/rust_vulkan_api_generator", "path": "/vkraw/examples/hello_triangle.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Get a supported colour format and colour space let mut format_count = 0; assert!(vk.GetPhysicalDeviceSurfaceFormatsKHR.is_some()); vk.GetPhysicalDeviceSurfaceFormatsKHR.unwrap()(physical_device, wsi_info.2, &mut format_count, ptr::null_mut()); assert!(format_count > 0); println!("Foun...
code_fim
hard
{ "lang": "rust", "repo": "ashleysmithgpu/rust_vulkan_api_generator", "path": "/vkraw/examples/hello_triangle.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Create command buffers println!("Creating command buffers"); let mut command_buffers = Vec::<vkraw::VkCommandBuffer>::with_capacity(swapchain_image_count as usize); { let cmd_buf_create_info = vkraw::VkCommandBufferAllocateInfo { sType: vkraw::VkStructureType::VK_STRUCTURE_TYPE_COM...
code_fim
hard
{ "lang": "rust", "repo": "ashleysmithgpu/rust_vulkan_api_generator", "path": "/vkraw/examples/hello_triangle.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kata-containers/kata-containers path: /src/libs/kata-types/src/config/runtime.rs // Copyright (c) 2021 Alibaba Cloud // // SPDX-License-Identifier: Apache-2.0 // use std::io::Result; use std::path::Path; use super::default; use crate::config::{ConfigOps, TomlConfig}; use crate::{eother, resolv...
code_fim
hard
{ "lang": "rust", "repo": "kata-containers/kata-containers", "path": "/src/libs/kata-types/src/config/runtime.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(not(feature = "enable-vendor"))] mod vendor { use super::*; /// Vendor customization runtime configuration. #[derive(Debug, Default, Deserialize, Serialize)] pub struct RuntimeVendor {} impl ConfigOps for RuntimeVendor {} } #[cfg(feature = "enable-vendor")] #[path = "runtime_v...
code_fim
hard
{ "lang": "rust", "repo": "kata-containers/kata-containers", "path": "/src/libs/kata-types/src/config/runtime.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// If enabled, the runtime will add all the kata processes inside one dedicated cgroup. /// /// The container cgroups in the host are not created, just one single cgroup per sandbox. /// The runtime caller is free to restrict or collect cgroup stats of the overall Kata sandbox. /// Th...
code_fim
hard
{ "lang": "rust", "repo": "kata-containers/kata-containers", "path": "/src/libs/kata-types/src/config/runtime.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kohbis/leetcode path: /algorithms/1752.check-if-array-is-sorted-and-rotated/solution.rs impl Solution { pub fn check(nums: Vec<i32>) -> bool { let len: usize = nums.len(); let mut rotate: bool = false; let mut max: i32 = 0; <|fim_suffix|> if nums[i] >= lef...
code_fim
hard
{ "lang": "rust", "repo": "kohbis/leetcode", "path": "/algorithms/1752.check-if-array-is-sorted-and-rotated/solution.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if nums[i] >= left { if rotate && nums[i] > max { return false; } } else { if rotate { return false; } rotate = true; max = left } ...
code_fim
hard
{ "lang": "rust", "repo": "kohbis/leetcode", "path": "/algorithms/1752.check-if-array-is-sorted-and-rotated/solution.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hansl/refactory path: /src/virtualfs/src/path.rs use std::borrow::Borrow; use std::ops::Deref; pub const SEPARATOR: char = '/'; pub fn is_separator(c: char) -> bool { c == SEPARATOR } #[derive(Copy, Clone, Ord, PartialOrd, Eq, Hash)] pub enum Component<'a> { /// The root directory com...
code_fim
hard
{ "lang": "rust", "repo": "hansl/refactory", "path": "/src/virtualfs/src/path.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn components() { assert_eq!( Path::new("/").iter().collect::<Vec<Component>>(), [Component::RootDir] ); assert_eq!( Path::new("/a").iter().collect::<Vec<Component>>(), [Comp...
code_fim
hard
{ "lang": "rust", "repo": "hansl/refactory", "path": "/src/virtualfs/src/path.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #set_source } } impl #impl_generics Message for #name #ty_generics #where_clause { type Result = (); } }; TokenStream::from(expanded) } fn get_with_source_attr(ast: &DeriveInput) -> Result<Vec<Option<syn::Type>>> { let attr = a...
code_fim
hard
{ "lang": "rust", "repo": "wenig/actix-telepathy", "path": "/actix-telepathy-derive/src/remote_message.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wenig/actix-telepathy path: /actix-telepathy-derive/src/remote_message.rs use log::*; use proc_macro::TokenStream; use quote::quote; use serde_derive::{Deserialize, Serialize}; use std::fs::File; use syn::{parse_macro_input, DeriveInput, Result}; const TELEPATHY_CONFIG_FILE: &str = "telepathy.y...
code_fim
hard
{ "lang": "rust", "repo": "wenig/actix-telepathy", "path": "/actix-telepathy-derive/src/remote_message.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let f = File::open(TELEPATHY_CONFIG_FILE); match f { Ok(file_reader) => { serde_yaml::from_reader(file_reader).expect("Config file is no valid YAML") } Err(e) => { error!("{}, using default Config", e.to_string()); Config::default() ...
code_fim
hard
{ "lang": "rust", "repo": "wenig/actix-telepathy", "path": "/actix-telepathy-derive/src/remote_message.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // put key_a x -> none assert_eq!(store.execute(&key_a, KVOp::Put(x.clone())), None); // get key_a -> some(x) assert_eq!(store.execute(&key_a, KVOp::Get), Some(x.clone())); // put key_b y -> none assert_eq!(store.execute(&key_b, KVOp::Put(y.clone())), No...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/fantoch", "path": "/fantoch/src/kvs.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/fantoch path: /fantoch/src/kvs.rs use crate::id::Rifl; use crate::{executor::ExecutionOrderMonitor, HashMap}; use serde::{Deserialize, Serialize}; // Definition of `Key` and `Value` types. pub type Key = String; pub type Value = String; #[derive( Debug, Clone, PartialEq, Eq, Partia...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/fantoch", "path": "/fantoch/src/kvs.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ub aio_offset: ::sys::types::off_t, __pad: [u8, ..4], __glibc_reserved: [u8, ..32], } new!(aiocb); pub const AIO_CANCELED: ::uint_t = 0; pub const AIO_NOTCANCELED: ::uint_t = 1; pub const AIO_ALLDONE: ::uint_t = 2; pub const LIO_READ: ::uint_t = 0; pub const LIO_WRITE: ::uint_t = 1; pub const LIO_...
code_fim
medium
{ "lang": "rust", "repo": "lummax/posix.rs", "path": "/src/aio/linux/x86.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lummax/posix.rs path: /src/aio/linux/x86.rs #[repr(C)] #[deriving(Copy)] pub struct aiocb { pub aio_fildes: ::int_t, pub aio_lio_opcode: ::int_t, pub aio_reqprio: ::int_t, pub aio_buf: *mut ::void_t, pub aio_nbytes: ::size_t, pub aio_sigevent: ::signal::sigevent, __ne...
code_fim
medium
{ "lang": "rust", "repo": "lummax/posix.rs", "path": "/src/aio/linux/x86.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rincewound/novanes path: /src/log/mod.rs extern crate queues; use queues::*; pub struct logger{ buf: queues::CircularBuffer<String> } <|fim_suffix|> pub fn to_console(&mut self) { let mut done: bool = false; while !done{ let val = self.buf.remove(); ...
code_fim
hard
{ "lang": "rust", "repo": "rincewound/novanes", "path": "/src/log/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn to_console(&mut self) { let mut done: bool = false; while !done{ let val = self.buf.remove(); match val { Ok(txt) => println!("{}", txt), Err(_) => done = true } } } }<|fim_prefix|>//...
code_fim
hard
{ "lang": "rust", "repo": "rincewound/novanes", "path": "/src/log/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ruddle/oxidator path: /src/unit.rs use super::client::*; use crate::model::*; use crate::utils::FileTree; use crate::*; use gpu_obj::model_gpu::ModelGpu; use na::{Matrix4, Point3, Vector2, Vector3}; use serde::{Deserialize, Serialize}; use std::collections::{HashMap, HashSet}; use std::path::{Pa...
code_fim
hard
{ "lang": "rust", "repo": "Ruddle/oxidator", "path": "/src/unit.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone, typename::TypeName, PartialEq, Serialize, Deserialize)] pub struct PartTree { pub id: utils::Id<PartTree>, pub placed_mesh: Option<PlacedMesh>, pub placed_collider: Option<PlacedCollider>, pub parent_to_self: Matrix4<f32>, pub joint: Joint, pub children: Vec<...
code_fim
hard
{ "lang": "rust", "repo": "Ruddle/oxidator", "path": "/src/unit.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl PartTree { pub fn iter(&self) -> PartTreeIter { PartTreeIter { stack: vec![self] } } pub fn find_node_mut(&mut self, id: utils::Id<PartTree>) -> Option<&mut PartTree> { if self.id == id { Some(self) } else { for c in self.children.iter_mut(...
code_fim
hard
{ "lang": "rust", "repo": "Ruddle/oxidator", "path": "/src/unit.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: paritytech/ink path: /crates/ink/codegen/src/generator/as_dependency/call_builder.rs e"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or...
code_fim
hard
{ "lang": "rust", "repo": "paritytech/ink", "path": "/crates/ink/codegen/src/generator/as_dependency/call_builder.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> &self, impl_block: &ir::ItemImpl, ) -> TokenStream2 { let span = impl_block.span(); let cb_ident = Self::call_builder_ident(); let messages = impl_block .iter_messages() .map(|message| self.generate_call_builder_inherent_impl_for_message(...
code_fim
hard
{ "lang": "rust", "repo": "paritytech/ink", "path": "/crates/ink/codegen/src/generator/as_dependency/call_builder.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.contract .module() .impls() .filter_map(|impl_block| { // We are only interested in ink! trait implementation block. impl_block.trait_path().map(|trait_path| { self.generate_code_for_trait_impl(trait_path,...
code_fim
hard
{ "lang": "rust", "repo": "paritytech/ink", "path": "/crates/ink/codegen/src/generator/as_dependency/call_builder.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> use nwg::Event as E; // Resources nwg::Icon::builder() .source_file(Some("./test_rc/cog.ico")) .build(&mut data.icon)?; // Controls nwg::MessageWindow::builder() .build(&mut data.windo...
code_fim
hard
{ "lang": "rust", "repo": "gabdube/native-windows-gui", "path": "/native-windows-gui/examples/system_tray.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gabdube/native-windows-gui path: /native-windows-gui/examples/system_tray.rs /*! An application that runs in the system tray. Requires the following features: `cargo run --example system_tray --features "tray-notification message-window menu cursor"` */ extern crate native_windows_gui a...
code_fim
hard
{ "lang": "rust", "repo": "gabdube/native-windows-gui", "path": "/native-windows-gui/examples/system_tray.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut handlers = self.default_handler.borrow_mut(); for handler in handlers.drain(0..) { nwg::unbind_event_handler(&handler); } } } impl Deref for SystemTrayUi { type Target = SystemTray; fn deref(&self) -> &SystemTray...
code_fim
hard
{ "lang": "rust", "repo": "gabdube/native-windows-gui", "path": "/native-windows-gui/examples/system_tray.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jwuensche/openmensa-rs path: /src/canteen.rs use getset::{CopyGetters, Getters, Setters}; use serde::Deserialize; /// Representation for geographic location given to each canteen. #[derive(Deserialize, Getters, Setters, Debug, Clone, Copy)] pub struct CoordinatePair { #[getset(get = "pub", ...
code_fim
medium
{ "lang": "rust", "repo": "jwuensche/openmensa-rs", "path": "/src/canteen.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/// Representation of a canteen. #[derive(Deserialize, CopyGetters, Getters, Debug, Clone)] pub struct Canteen { #[getset(get_copy = "pub")] id: u16, #[getset(get = "pub")] name: String, #[getset(get = "pub")] city: String, #[getset(get = "pub")] address: String, #[gets...
code_fim
medium
{ "lang": "rust", "repo": "jwuensche/openmensa-rs", "path": "/src/canteen.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sgravrock/adventofcode path: /2020/rust/day11p2/src/main.rs mod input; mod grid; fn main() { println!("{}", solve(grid::parse(input::puzzle_input()))); // 2111 } #[derive(PartialEq, Clone, Copy)] enum Cell { Floor, Empty, Occupied } impl grid::FromChar for Cell { fn from_c(c: char) -> ...
code_fim
hard
{ "lang": "rust", "repo": "sgravrock/adventofcode", "path": "/2020/rust/day11p2/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while in_bounds(&grid, ci, cj) { match grid[ci as usize][cj as usize] { Cell::Occupied => return true, Cell::Empty => return false, Cell::Floor => {} } ci += dir.0; cj += dir.1; } false } fn in_bounds(grid: &Vec<Vec<Cell>>, i: isize, j: isize) -> bool { i >= 0 && j >= 0 && i < ...
code_fim
hard
{ "lang": "rust", "repo": "sgravrock/adventofcode", "path": "/2020/rust/day11p2/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dailypips/kernel path: /src/streams/network/udp.rs use std::io; use std::net::{self, SocketAddr, Ipv4Addr, Ipv6Addr}; use std::fmt; use abstractions::poll::Async; use mio; use reactors::sched::Handle; use reactors::poll_evented::PollEvented; pub struct UdpSocket { io: PollEvented<mio::udp...
code_fim
hard
{ "lang": "rust", "repo": "dailypips/kernel", "path": "/src/streams/network/udp.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn set_multicast_loop_v6(&self, on: bool) -> io::Result<()> { self.io.get_ref().set_multicast_loop_v6(on) } pub fn ttl(&self) -> io::Result<u32> { self.io.get_ref().ttl() } pub fn set_ttl(&self, ttl: u32) -> io::Result<()> { self.io.get_ref().set_ttl(ttl) ...
code_fim
hard
{ "lang": "rust", "repo": "dailypips/kernel", "path": "/src/streams/network/udp.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reinterpretcat/vrp path: /vrp-core/src/construction/heuristics/evaluators.rs insertion_ctx: &InsertionContext, eval_ctx: &EvaluationContext, route_ctx: &RouteContext, position: InsertionPosition, alternative: InsertionResult, ) -> InsertionResult { // NOTE do not evaluate...
code_fim
hard
{ "lang": "rust", "repo": "reinterpretcat/vrp", "path": "/vrp-core/src/construction/heuristics/evaluators.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> eval_ctx: &EvaluationContext, route_ctx: &RouteContext, multi: &Arc<Multi>, position: InsertionPosition, route_costs: InsertionCost, best_known_cost: Option<InsertionCost>, ) -> InsertionResult { let insertion_idx = get_insertion_index(route_ctx, position).unwrap_or(0); // ...
code_fim
hard
{ "lang": "rust", "repo": "reinterpretcat/vrp", "path": "/vrp-core/src/construction/heuristics/evaluators.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reinterpretcat/vrp path: /vrp-core/src/construction/heuristics/evaluators.rs /// A result selector. pub result_selector: &'a (dyn ResultSelector + Send + Sync), } /// Specifies allowed insertion position in route for the job. #[derive(Copy, Clone)] pub enum InsertionPosition { /// ...
code_fim
hard
{ "lang": "rust", "repo": "reinterpretcat/vrp", "path": "/vrp-core/src/construction/heuristics/evaluators.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct CpuException { pub injected: u8, pub nr: u8, pub has_error_code: u8, pub pending: u8, pub error_code: u32, } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct CpuInterrupt { pub injected: u8, pub nr: u8, pub soft: u8, ...
code_fim
hard
{ "lang": "rust", "repo": "mbestavros/ketuvim", "path": "/src/arch/x86_64.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct CpuEvents { pub exception: CpuException, pub interrupt: CpuInterrupt, pub nmi: CpuNmi, pub sipi_vector: u32, pub flags: u32, pub smi: CpuSmi, pub reserved: [u8; 27usize], pub exception_has_payload: u8, pub exception_pa...
code_fim
hard
{ "lang": "rust", "repo": "mbestavros/ketuvim", "path": "/src/arch/x86_64.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mbestavros/ketuvim path: /src/arch/x86_64.rs // Copyright 2019 Red Hat // // 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 // // http://www.apache.org/licenses/LI...
code_fim
hard
{ "lang": "rust", "repo": "mbestavros/ketuvim", "path": "/src/arch/x86_64.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kakoidb/kakoidb path: /src/api.rs use crate::database::Database; use crate::entities::point::{NewPoint, Point, QueryOptions}; use crate::entities::series::{NewSeries, Series}; use juniper::FieldResult; use std::net::IpAddr; use std::sync::{Arc, RwLock}; use warp::{http::Response, log, Filter}; ...
code_fim
hard
{ "lang": "rust", "repo": "kakoidb/kakoidb", "path": "/src/api.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> field series(&executor, name: String) -> FieldResult<Option<Series>> { let db = &executor.context().db; Ok(db.read().unwrap().get_series(&name)?) } field query(&executor, series_name: String, options: Option<QueryOptions>) -> FieldResult<Vec<Point>> { let db = &executo...
code_fim
hard
{ "lang": "rust", "repo": "kakoidb/kakoidb", "path": "/src/api.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ima9rd/carballrs path: /src/protos/mod.rs pub mod ball_stats; pub mod camera_settings; pub mod data_frame; pub mod ev<|fim_suffix|>out; pub mod player_stats; pub mod stats; pub mod team; pub mod team_stats;<|fim_middle|>ents; pub mod game; pub mod game_metadata; pub mod game_stats; pub mod mutat...
code_fim
medium
{ "lang": "rust", "repo": "ima9rd/carballrs", "path": "/src/protos/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>tors; pub mod party; pub mod player; pub mod player_id; pub mod player_loadout; pub mod player_stats; pub mod stats; pub mod team; pub mod team_stats;<|fim_prefix|>// repo: ima9rd/carballrs path: /src/protos/mod.rs pub mod ball_stats; pub mod camera_settings; pub mod data_frame; pub mod ev<|fim_middle|>e...
code_fim
medium
{ "lang": "rust", "repo": "ima9rd/carballrs", "path": "/src/protos/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZhangHanDong/rosrust path: /rosrust/tests/benchmarks.rs use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; use crossbeam::unbounded; use lazy_static::lazy_static; use rosrust; use std::process::Command; use std::sync::atomic::{AtomicUsize, Ordering}; use std::time; mod util...
code_fim
hard
{ "lang": "rust", "repo": "ZhangHanDong/rosrust", "path": "/rosrust/tests/benchmarks.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> setup(); let namespace = format!("/namespaceat{}", line!()); let _roscpp_service = util::ChildProcessTerminator::spawn( Command::new("rosrun") .arg("roscpp_tutorials") .arg("add_two_ints_server") .arg(format!("__ns:={}", namespace)) .ar...
code_fim
hard
{ "lang": "rust", "repo": "ZhangHanDong/rosrust", "path": "/rosrust/tests/benchmarks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yeastplume/Cursive path: /src/lib.rs //! # Cursive //! //! [Cursive] is a [TUI] library - it lets you easily build rich interfaces //! for use in a terminal. //! //! [Cursive]: https://github.com/gyscos/Cursive //! [TUI]: https://en.wikipedia.org/wiki/Text-based_user_interface //! //! ## Getting...
code_fim
hard
{ "lang": "rust", "repo": "yeastplume/Cursive", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub mod event; #[macro_use] pub mod view; pub mod views; pub mod vec; pub mod rect; pub mod theme; pub mod align; pub mod menu; pub mod direction; pub mod utils; // This probably doesn't need to be public? mod cursive; mod printer; mod xy; mod with; mod div; mod utf8; #[doc(hidden)] pub mod backend; ...
code_fim
hard
{ "lang": "rust", "repo": "yeastplume/Cursive", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> static SAMPLE_INPUT: &str = r#"[({(<(())[]>[[{[]{<()<>> [(()[<>])]({[<{<<[]>>( {([(<{}[<>[]}>{[]{[(<()> (((({<>}<{<{<>}{[]{[]{} [[<[([]))<([[{}[[()]]] [{[{({}]{}}([{[{{{}}([] {<[[]]>}<{[{[{[]{()[[[] [<(<(<(<{}))><([]([]() <{([([[(<>()){}]>(<<{{ <{([{{}}[<[[[<>{}]]]>[]]"#; #[test] fn sample_pa...
code_fim
hard
{ "lang": "rust", "repo": "mblonyox/adventofcode", "path": "/2021/src/day10.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mblonyox/adventofcode path: /2021/src/day10.rs fn get_pair(c: char) -> char { match c { ')' => '(', ']' => '[', '}' => '{', '>' => '<', _ => '?', } } #[aoc(day10, part1)] pub fn part1(input: &str) -> i32 { input .lines() .map(|...
code_fim
hard
{ "lang": "rust", "repo": "mblonyox/adventofcode", "path": "/2021/src/day10.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azriel91/autexousious path: /crate/game_mode_selection_ui/src/system/game_mode_selection_sfx_system.rs use amethyst::{ assets::AssetStorage, audio::{output::Output, Source}, ecs::{Read, System, SystemData, World}, shrev::{EventChannel, ReaderId}, }; use derive_new::new; use game_...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/game_mode_selection_ui/src/system/game_mode_selection_sfx_system.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(ui_sfx_id) = ui_sfx_id { let ui_sfx = ui_sfx_map .get(&ui_sfx_id) .and_then(|ui_sfx_handle| source_assets.get(ui_sfx_handle)); if let Some(ui_sfx) = ui_sfx { output....
code_fim
hard
{ "lang": "rust", "repo": "azriel91/autexousious", "path": "/crate/game_mode_selection_ui/src/system/game_mode_selection_sfx_system.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nertsal/ludumdare49 path: /src/game/effect.rs use super::*; #[derive(Clone)] pub enum Effect { HealReactor { heal: f32 }, ExplodeReactor, } <|fim_suffix|> Effect::ExplodeReactor => { self.explode_reactor(); } } } }<|fim_middle|> impl GameState...
code_fim
hard
{ "lang": "rust", "repo": "Nertsal/ludumdare49", "path": "/src/game/effect.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Effect::ExplodeReactor => { self.explode_reactor(); } } } }<|fim_prefix|>// repo: Nertsal/ludumdare49 path: /src/game/effect.rs use super::*; #[derive(Clone)] pub enum Effect { HealReactor { heal: f32 }, ExplodeReactor, } <|fim_middle|> impl GameState...
code_fim
hard
{ "lang": "rust", "repo": "Nertsal/ludumdare49", "path": "/src/game/effect.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lambdaxymox/fuchsia path: /src/ui/lib/input_pipeline/src/gestures/one_finger_drag.rs _contacts = event.contacts.len(); if num_contacts != 1 { return ExamineEventResult::Mismatch(Reason::DetailedUint(DetailedReasonUint { criterion: "num_contacts", ...
code_fim
hard
{ "lang": "rust", "repo": "lambdaxymox/fuchsia", "path": "/src/ui/lib/input_pipeline/src/gestures/one_finger_drag.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let contender: Box<dyn gesture_arena::MatchedContender> = Box::new(MatchedContender {}); let got = contender.process_buffered_events(vec![ TouchpadEvent { timestamp: zx::Time::from_nanos(1), pressed_buttons: vec![1], contacts: ve...
code_fim
hard
{ "lang": "rust", "repo": "lambdaxymox/fuchsia", "path": "/src/ui/lib/input_pipeline/src/gestures/one_finger_drag.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let got = contender.examine_event(&event); assert_matches!(got, ExamineEventResult::Contender(_)); } #[fuchsia::test] fn button_down_contender_examine_event_matched_contender() { let contender: Box<dyn gesture_arena::Contender> = Box::new(ButtonDownContender { ...
code_fim
hard
{ "lang": "rust", "repo": "lambdaxymox/fuchsia", "path": "/src/ui/lib/input_pipeline/src/gestures/one_finger_drag.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let mut line = lines.next().context(ExpectedMap)?; for &(chapter_name, maps) in &CHAPTERS { for &map in maps { { let mut splits = line.split(','); let map_name = splits.next().context(ExpectedMapName)?; if map_name != map { ...
code_fim
hard
{ "lang": "rust", "repo": "LiveSplit/livesplit-core", "path": "/src/run/parser/portal2_live_timer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LiveSplit/livesplit-core path: /src/run/parser/portal2_live_timer.rs //! Provides the parser for Portal 2 Live Timer splits files. use crate::{platform::prelude::*, GameTime, Run, Segment, TimeSpan}; use core::{num::ParseFloatError, result::Result as StdResult}; use snafu::{OptionExt, ResultExt...
code_fim
hard
{ "lang": "rust", "repo": "LiveSplit/livesplit-core", "path": "/src/run/parser/portal2_live_timer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Attempts to parse a Portal 2 Live Timer splits file. pub fn parse(source: &str) -> Result<Run> { let mut run = Run::new(); run.set_game_name("Portal 2"); run.set_category_name("Any%"); let mut lines = source.lines(); lines.next(); // Skip the header let mut aggregate_ticks =...
code_fim
hard
{ "lang": "rust", "repo": "LiveSplit/livesplit-core", "path": "/src/run/parser/portal2_live_timer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0..n { sv[i].sort(); } sv.reverse(); let mut cv = vec![0i64; n]; let mut map = HashMap::new(); for i in 0..n { let s = sv[i].iter().map(|&c| c).collect::<String>(); let count = match map.get(&s) { None => 0, Some(&c) => c, ...
code_fim
hard
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/before-cargo-atcoder/abc137_c/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bouzuya/rust-atcoder path: /before-cargo-atcoder/abc137_c/src/main.rs use std::collections::HashMap; fn read<T: std::str::FromStr>( stdin_lock: &mut std::io::StdinLock, buf: &mut Vec<u8>, delimiter: u8, ) -> T { buf.clear(); let l = std::io::BufRead::read_until(stdin_lock, d...
code_fim
medium
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/before-cargo-atcoder/abc137_c/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut cv = vec![0i64; n]; let mut map = HashMap::new(); for i in 0..n { let s = sv[i].iter().map(|&c| c).collect::<String>(); let count = match map.get(&s) { None => 0, Some(&c) => c, }; cv[i] = count; map.insert(s, count + 1); ...
code_fim
hard
{ "lang": "rust", "repo": "bouzuya/rust-atcoder", "path": "/before-cargo-atcoder/abc137_c/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: epfl-dias/ironsea_index_sfc_dbc path: /src/cell_space.rs use std::collections::HashSet; use std::fmt::Debug; use std::hash::Hash; use std::marker; use std::ops::Index; use ironsea_index::Record; use serde::Deserialize; use serde::Serialize; type Cell<T> = Vec<T>; #[derive(Clone, Debug, Deseri...
code_fim
hard
{ "lang": "rust", "repo": "epfl-dias/ironsea_index_sfc_dbc", "path": "/src/cell_space.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<K, V> CellSpace<K, V> where K: Debug + Index<usize, Output = V>, V: Clone + Debug + Hash + Ord, { pub fn new<I, R>(iter: I, dimensions: usize, cell_bits: usize) -> Self where I: Clone + Iterator<Item = R>, R: Debug + Record<K>, { let mut space = CellSpace {...
code_fim
hard
{ "lang": "rust", "repo": "epfl-dias/ironsea_index_sfc_dbc", "path": "/src/cell_space.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doytsujin/winrt-rs path: /crates/libs/sys/src/Windows/Win32/Graphics/Direct3D10/mod.rs D3DBlob) -> ::windows_sys::core::HRESULT; #[doc = "*Required features: `\"Win32_Graphics_Direct3D10\"`*"] pub fn D3D10GetPixelShaderProfile(pdevice: ID3D10Device) -> ::windows_sys::core::PSTR; #[do...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/winrt-rs", "path": "/crates/libs/sys/src/Windows/Win32/Graphics/Direct3D10/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: doytsujin/winrt-rs path: /crates/libs/sys/src/Windows/Win32/Graphics/Direct3D10/mod.rs tures: `\"Win32_Graphics_Direct3D10\"`*"] pub const D3D10_PS_OUTPUT_DEPTH_REGISTER_COMPONENTS: u32 = 1u32; #[doc = "*Required features: `\"Win32_Graphics_Direct3D10\"`*"] pub const D3D10_PS_OUTPUT_DEPTH_REGIST...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/winrt-rs", "path": "/crates/libs/sys/src/Windows/Win32/Graphics/Direct3D10/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>= "*Required features: `\"Win32_Graphics_Direct3D10\"`*"] pub const D3D10_MESSAGE_ID_CORRUPTED_THIS: D3D10_MESSAGE_ID = 12i32; #[doc = "*Required features: `\"Win32_Graphics_Direct3D10\"`*"] pub const D3D10_MESSAGE_ID_CORRUPTED_PARAMETER1: D3D10_MESSAGE_ID = 13i32; #[doc = "*Required features: `\"Win32_Gr...
code_fim
hard
{ "lang": "rust", "repo": "doytsujin/winrt-rs", "path": "/crates/libs/sys/src/Windows/Win32/Graphics/Direct3D10/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // bind the program options to arguments and then check // and set parameters in the program let matches = match getopts (args.as_slice(), opts.as_slice()) { Ok (m) => { if m.opt_present ("h") { print_usage (program, opts.as_slice() ); return; } else if !m.opt_present ("p") { // thi...
code_fim
hard
{ "lang": "rust", "repo": "deeso/fun-with-rust", "path": "/projects/network_server/src/server.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: deeso/fun-with-rust path: /projects/network_server/src/server.rs extern crate getopts; use getopts::{optflag,getopts,OptGroup, usage, reqopt, optopt}; use std::string::{String}; use std::os; use std::io::{TcpListener, TcpStream}; use std::io::{Acceptor, Listener}; fn parse_int (input: &Strin...
code_fim
hard
{ "lang": "rust", "repo": "deeso/fun-with-rust", "path": "/projects/network_server/src/server.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>fn stmt_precond(&crate_ctxt ccx, &stmt s) -> precond { ret (stmt_pp(ccx, s)).precondition; } fn stmt_postcond(&crate_ctxt ccx, &stmt s) -> postcond { ret (stmt_pp(ccx, s)).postcondition; } fn states_to_poststate(&pre_and_post_state ss) -> poststate { ret ss.poststate; } fn stmt_prestate(&crat...
code_fim
hard
{ "lang": "rust", "repo": "bendotc/rust", "path": "/src/comp/middle/tstate/auxiliary.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>fn num_locals(fn_info m) -> uint { ret m.vars.size(); } fn new_crate_ctxt(ty::ctxt cx) -> crate_ctxt { let vec[ts_ann] na = []; ret rec(tcx=cx, node_anns=@na, fm=@new_def_hash[fn_info]()); } fn controlflow_def_id(&crate_ctxt ccx, &def_id d) -> controlflow { alt (ccx.fm.find(d)) { c...
code_fim
hard
{ "lang": "rust", "repo": "bendotc/rust", "path": "/src/comp/middle/tstate/auxiliary.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bendotc/rust path: /src/comp/middle/tstate/auxiliary.rs import std::bitv; import std::vec; import std::vec::len; import std::vec::grow; import std::vec::pop; import std::option; import std::option::none; import std::option::some; import std::option::maybe; import front::ast; import front::ast::...
code_fim
hard
{ "lang": "rust", "repo": "bendotc/rust", "path": "/src/comp/middle/tstate/auxiliary.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Copy, Debug, PartialEq, Eq)] pub struct UserlogonRestriction(pub u32); #[allow(non_upper_case_globals)] impl UserlogonRestriction { pub const AnonymousUser: UserlogonRestriction = UserlogonRestriction(1); pub const AdminUser: UserlogonRestriction = UserlogonRestriction(2); } ...
code_fim
hard
{ "lang": "rust", "repo": "caputomarcos/radius-rs", "path": "/src/vendors/ntua.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: caputomarcos/radius-rs path: /src/vendors/ntua.rs /// Definitions for vendor NTUA, vendor value 969 use nom::IResult; #[allow(unused_imports)] use nom::number::streaming::{be_u64, be_u32, be_u16, be_u8}; #[allow(unused_imports)] use std::net::{Ipv4Addr, Ipv6Addr}; use crate::radius::*; ...
code_fim
medium
{ "lang": "rust", "repo": "caputomarcos/radius-rs", "path": "/src/vendors/ntua.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn parse(i: &[u8], typ: u8) -> IResult<&[u8], Attribute> { match typ { 10 => map!{i, be_u32, |v| Attribute::VsaUserlogonUid(v)}, 11 => map!{i, be_u32, |v| Attribute::VsaUserlogonGid(v)}, 12 => value!(i, Attribute::VsaUserlogonHomedir(i)), 13 => map! {i, be_u32, |v| Attribute::VsaUse...
code_fim
hard
{ "lang": "rust", "repo": "caputomarcos/radius-rs", "path": "/src/vendors/ntua.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use crate::physical_plan::aggregates::AggregateFunction; use crate::physical_plan::collect; use crate::physical_plan::csv::{CsvExec, CsvReadOptions}; use crate::physical_plan::expressions::col; use crate::test; use arrow::array::*; fn...
code_fim
hard
{ "lang": "rust", "repo": "kszucs/arrow-datafusion", "path": "/datafusion/src/physical_plan/windows.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kszucs/arrow-datafusion path: /datafusion/src/physical_plan/windows.rs ult<Arc<dyn BuiltInWindowFunctionExpr>> { match fun { BuiltInWindowFunction::RowNumber => Ok(Arc::new(RowNumber::new(name))), BuiltInWindowFunction::NthValue => { let coerced_args = coerce(args...
code_fim
hard
{ "lang": "rust", "repo": "kszucs/arrow-datafusion", "path": "/datafusion/src/physical_plan/windows.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }