text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> let input: Vec<&str> = split_input(include_str!("../input.txt"), "\n\n"); run("part1", || day6::part1(&input)); run("part2", || day6::part2(&input)); }<|fim_prefix|>// repo: mariomka/AdventOfCode2020 path: /day6/src/main.rs use helpers::{run, split_input}; <|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "mariomka/AdventOfCode2020", "path": "/day6/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dennisss/dacha path: /pkg/crypto/src/bin/secure_pipe.rs #[macro_use] extern crate common; extern crate crypto; #[macro_use] extern crate macros; extern crate alloc; use alloc::boxed::Box; use std::string::String; use common::async_std::fs; use common::async_std::net::TcpStream; use common::asy...
code_fim
hard
{ "lang": "rust", "repo": "dennisss/dacha", "path": "/pkg/crypto/src/bin/secure_pipe.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match args.command { Command::Client(cmd) => { let raw_stream = TcpStream::connect(&cmd.addr).await?; let reader = Box::new(raw_stream.clone()); let writer = Box::new(raw_stream); let mut client_options = crypto::tls::ClientOptions::recommended(...
code_fim
hard
{ "lang": "rust", "repo": "dennisss/dacha", "path": "/pkg/crypto/src/bin/secure_pipe.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub struct PolarIterator(pub Box<dyn PolarResultIter>); impl PolarIterator { pub fn new<I: PolarResultIter + 'static>(iter: I) -> Self { Self(Box::new(iter)) } } impl Iterator for PolarIterator { type Item = crate::Result<PolarValue>; fn next(&mut self) -> Option<Self::Item> { ...
code_fim
hard
{ "lang": "rust", "repo": "osohq/oso", "path": "/languages/rust/oso/src/host/to_polar.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: osohq/oso path: /languages/rust/oso/src/host/to_polar.rs #![allow(clippy::wrong_self_convention)] //! Trait and implementations of `ToPolar` for converting from //! Rust types back to Polar types. use impl_trait_for_tuples::*; use std::collections::{BTreeMap, BTreeSet, BinaryHeap, HashMap, Ha...
code_fim
hard
{ "lang": "rust", "repo": "osohq/oso", "path": "/languages/rust/oso/src/host/to_polar.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub async fn send(self) -> Result<MigrationStepsResultOutput, anyhow::Error> { let migration_id = self.migration_id.unwrap_or_else(unique_migration_id); let input = InferMigrationStepsInput { assume_to_be_applied: Some(self.assume_to_be_applied.unwrap_or_else(Vec::new)), ...
code_fim
hard
{ "lang": "rust", "repo": "cjjenkinson/prisma-engines", "path": "/migration-engine/migration-engine-tests/src/test_api/infer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cjjenkinson/prisma-engines path: /migration-engine/migration-engine-tests/src/test_api/infer.rs use super::super::unique_migration_id; use migration_connector::MigrationStep; use migration_core::{ api::GenericApi, commands::{AppliedMigration, InferMigrationStepsInput, MigrationStepsResul...
code_fim
hard
{ "lang": "rust", "repo": "cjjenkinson/prisma-engines", "path": "/migration-engine/migration-engine-tests/src/test_api/infer.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn migration_id(mut self, migration_id: Option<impl Into<String>>) -> Self { self.migration_id = migration_id.map(Into::into); self } pub fn assume_to_be_applied(mut self, assume_to_be_applied: Option<Vec<MigrationStep>>) -> Self { self.assume_to_be_applied = assum...
code_fim
hard
{ "lang": "rust", "repo": "cjjenkinson/prisma-engines", "path": "/migration-engine/migration-engine-tests/src/test_api/infer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let filename = "input"; let file = File::open(filename).unwrap(); let readers= io::BufReader::new(file); let mut hash_set: HashSet<i64> = HashSet::new(); for line in readers.lines() { hash_set.insert(line.unwrap().parse::<i64>().unwrap()); } for num in &hash_set { ...
code_fim
medium
{ "lang": "rust", "repo": "w93163red/adventofcode", "path": "/2020/day1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: w93163red/adventofcode path: /2020/day1/src/main.rs use std::{collections::HashSet, io::prelude::*, ptr::hash}; use std::{fs::File, io}; <|fim_suffix|> let filename = "input"; let file = File::open(filename).unwrap(); let readers= io::BufReader::new(file); let mut hash_set: HashS...
code_fim
medium
{ "lang": "rust", "repo": "w93163red/adventofcode", "path": "/2020/day1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> paths .into_iter() .filter(|(_, item)| matches!(item.kind, Struct | Union | Enum | Function | Trait | Method)) .collect() }<|fim_prefix|>// repo: roogle-rs/roogle path: /roogle-util/src/lib.rs use std::collections::HashMap; use rustdoc_types::{Crate, Id, Item, ItemSummary}; ...
code_fim
medium
{ "lang": "rust", "repo": "roogle-rs/roogle", "path": "/roogle-util/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: roogle-rs/roogle path: /roogle-util/src/lib.rs use std::collections::HashMap; use rustdoc_types::{Crate, Id, Item, ItemSummary}; /// Perform a tree shaking to reduce the size of given `krate`. pub fn shake(krate: Crate) -> Crate { let Crate { root, crate_version, in...
code_fim
hard
{ "lang": "rust", "repo": "roogle-rs/roogle", "path": "/roogle-util/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> use rustdoc_types::ItemEnum::*; index .into_iter() .filter(|(_, item)| { matches!( item.inner, Function(_) | Method(_) | Trait(_) | Impl(_) | Typedef(_) | AssocConst { .. } ) }) .collect() } fn shake_paths(pa...
code_fim
hard
{ "lang": "rust", "repo": "roogle-rs/roogle", "path": "/roogle-util/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CPerezz/Corretto path: /benchmarks/dusk_benchmarks.rs #![allow(non_snake_case)] #[macro_use] extern crate criterion; use criterion::{Criterion, Benchmark}; use zerocaf::backend::u64::{scalar, field}; use zerocaf::edwards::EdwardsPoint; use zerocaf::traits::ops::*; #[allow(unused_imports)] ...
code_fim
hard
{ "lang": "rust", "repo": "CPerezz/Corretto", "path": "/benchmarks/dusk_benchmarks.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> use super::*; use zerocaf::edwards::{EdwardsPoint, ProjectivePoint}; use zerocaf::scalar::Scalar; use zerocaf::field::FieldElement; pub static P1_EXTENDED: EdwardsPoint = EdwardsPoint { X: FieldElement([23, 0, 0, 0, 0]), Y: FieldElement([1664892896009688, 1325838192448...
code_fim
hard
{ "lang": "rust", "repo": "CPerezz/Corretto", "path": "/benchmarks/dusk_benchmarks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let prompt_j = PromptView::new(&mut gamedata.overlay_prompt, promptsender) .color(color::LIGHT_GREY) .wh_of(ids.master) .middle_of(ids.master); prompt_j.set(ids.promptview, ui); } }<|fim_prefix|>// repo: alanpoon/hardback_conrod path: /src/l...
code_fim
hard
{ "lang": "rust", "repo": "alanpoon/hardback_conrod", "path": "/src/logic/overlay_prompt/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alanpoon/hardback_conrod path: /src/logic/overlay_prompt/mod.rs use conrod_core::{self, color, widget, Colorable, Positionable, Widget, Sizeable, image, Labelable, Rect}; use cardgame_widgets::custom_widget::animated_canvas; use cardgame_widgets::sprite::{SpriteInfo, spriteable_rect}; use cardga...
code_fim
hard
{ "lang": "rust", "repo": "alanpoon/hardback_conrod", "path": "/src/logic/overlay_prompt/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let repo = git2::Repository::init_opts(format!("{}.git", repo_name), &opts)?; let public_user = env::var("USER")?; let public_name = env::var("PUBLIC")?; let public_path = env::var("PATH")?; repo.remote( "public", &format!( "{user}@{public}:{path}/{repo}.gi...
code_fim
hard
{ "lang": "rust", "repo": "jtcasper/sockgit", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jtcasper/sockgit path: /src/main.rs use git2; use std::env; use std::error; use std::io; use std::path; fn check_ip() -> Result<(), Box<dyn error::Error>> { let remote_ip = env::var("REMOTE_ADDR")?; let whitelist_ip = env::var("WHITELIST_IP")?; if remote_ip == whitelist_ip { ...
code_fim
hard
{ "lang": "rust", "repo": "jtcasper/sockgit", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut inv_s = BigNum::new().unwrap(); inv_s.mod_inverse(&s, &n, &mut bnctx).unwrap(); let mut pt = BigNum::new().unwrap(); // I FORGOT TO DO MODULAR MULTIPLICATION! BAD ME. pt.mod_mul(&inv_s, &BigNum::from_slice(&semi_decryption).unwrap(), &n, &mut bnctx).unwrap(); println!("Decryption??? => {:...
code_fim
hard
{ "lang": "rust", "repo": "bollo35/cryptopals", "path": "/src/bin/p041.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bollo35/cryptopals path: /src/bin/p041.rs extern crate ooga; use ooga::rsa::Rsa; extern crate openssl; use openssl::bn::{BigNum, BigNumContext}; use std::ops::Sub; use std::collections::HashSet; struct DecServer { rsa: Rsa, queries: HashSet<Vec<u8>>, } impl DecServer { pub fn new() -> Dec...
code_fim
hard
{ "lang": "rust", "repo": "bollo35/cryptopals", "path": "/src/bin/p041.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Otohito-Fuse/ecdh-demo-in-rust path: /src/complexification.rs use crate::characteristic::Characteristic; use crate::identities::{Identity, Zero}; use crate::inverse::Inverse; use std::fmt; use std::ops::{Add, AddAssign, Mul, MulAssign, Neg, Sub, SubAssign}; /// Elements in ```R\[x\]/(x^2 + 1)``...
code_fim
hard
{ "lang": "rust", "repo": "Otohito-Fuse/ecdh-demo-in-rust", "path": "/src/complexification.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Implementation of ```Mul```. impl<T: Copy + Add<Output = T> + Mul<Output = T> + Sub<Output = T> + Eq> Mul for Complex<T> { type Output = Self; /// Overloading the operator ```*```. fn mul(self, rhs: Self) -> Self { Self { real: self.real * rhs.real - self.imaginary * rh...
code_fim
hard
{ "lang": "rust", "repo": "Otohito-Fuse/ecdh-demo-in-rust", "path": "/src/complexification.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> 1 } impl<T> LuaPush for Vec<T> where T: LuaPush { fn push_to_lua(self, lua: *mut lua_State) -> i32 { push_iter(lua, self.into_iter()) } } impl<'a, T> LuaPush for &'a [T] where T: Clone + LuaPush { fn push_to_lua(self, lua: *mut lua_State) -> i32 { push_iter(lua, self.iter...
code_fim
hard
{ "lang": "rust", "repo": "tickbh/td_rlua", "path": "/td_rlua/src/rust_tables.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tickbh/td_rlua path: /td_rlua/src/rust_tables.rs use td_clua; use td_clua::lua_State; use LuaPush; use LuaRead; use LuaTable; use std::collections::{HashMap, HashSet}; use std::hash::Hash; fn push_iter<V, I>(lua: *mut lua_State, iterator: I) -> i32 where V: LuaPush, I: I...
code_fim
hard
{ "lang": "rust", "repo": "tickbh/td_rlua", "path": "/td_rlua/src/rust_tables.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> use std::iter; push_rec_iter(lua, self.into_iter().zip(iter::repeat(true))) } } impl<T> LuaRead for Vec<T> where T : LuaRead { fn lua_read_with_pop_impl(lua: *mut lua_State, index: i32, _pop : i32) -> Option<Vec<T>> { let mut lua_table : LuaTable = unwrap_or!(LuaRead::lua_...
code_fim
hard
{ "lang": "rust", "repo": "tickbh/td_rlua", "path": "/td_rlua/src/rust_tables.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>table! { roles (id) { id -> Integer, name -> Nullable<Text>, permission_level -> Integer, } } table! { users (id) { id -> Integer, username -> Text, password_hash -> Text, password_salt -> Text, invite_code_used -> Nullable<Integ...
code_fim
hard
{ "lang": "rust", "repo": "erdwolfapp/Erdwolf", "path": "/src/schema.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: erdwolfapp/Erdwolf path: /src/schema.rs table! { containers (id) { id -> Integer, owner -> Integer, name -> Text, path -> Text, subdomain -> Nullable<Text>, } } table! { groups (id) { id -> Integer, group_name -> Text, } } ...
code_fim
hard
{ "lang": "rust", "repo": "erdwolfapp/Erdwolf", "path": "/src/schema.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>); let href = format!("{}/export/{}", base_href, filename); let content = html! { p { "Download entries in CSV format: " a href=(href) { (filename) } } }; tmpl_base("Export", content) }<|fim_prefix|>// repo: mpietrzak/cash...
code_fim
medium
{ "lang": "rust", "repo": "mpietrzak/cashlog", "path": "/src/tmpl/export.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> CSV format: " a href=(href) { (filename) } } }; tmpl_base("Export", content) }<|fim_prefix|>// repo: mpietrzak/cashlog path: /src/tmpl/export.rs use chrono; use maud; use maud::html; use crate::tmpl::common::tmpl_base; pub fn tmpl_export(base_hre...
code_fim
hard
{ "lang": "rust", "repo": "mpietrzak/cashlog", "path": "/src/tmpl/export.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mpietrzak/cashlog path: /src/tmpl/export.rs use chrono; use maud; use maud::html; use crate::tmpl::common::tmpl_base; pub fn tmpl_export(base_href: &str) -> maud::Markup { let now = chrono::Utc::now(); let now_str = now.format("%Y%m%d%H%M%S"); let filename = format!("cashlog-export...
code_fim
medium
{ "lang": "rust", "repo": "mpietrzak/cashlog", "path": "/src/tmpl/export.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(PipelineData::Value(Value::string(uuid_4, span), None)) } #[cfg(test)] mod test { use super::*; #[test] fn test_examples() { use crate::test_examples; test_examples(SubCommand {}) } }<|fim_prefix|>// repo: nushell/nushell path: /crates/nu-command/src/random/uuid....
code_fim
hard
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu-command/src/random/uuid.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nushell/nushell path: /crates/nu-command/src/random/uuid.rs use nu_protocol::ast::Call; use nu_protocol::engine::{Command, EngineState, Stack}; use nu_protocol::{Category, Example, PipelineData, ShellError, Signature, Type, Value}; use uuid::Uuid; #[derive(Clone)] pub struct SubCommand; impl C...
code_fim
hard
{ "lang": "rust", "repo": "nushell/nushell", "path": "/crates/nu-command/src/random/uuid.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> by the master and received by the slave. Corresponds to the signal WS in the I2S-bus specification."] #[inline(always)] pub fn i2s_tx_ws(self) -> &'a mut W { self.variant(FUNC_A::I2S_TX_WS) } #[doc = "LCD data."] #[inline(always)] pub fn lcd_vd_4(self) -> &'a mut W { ...
code_fim
hard
{ "lang": "rust", "repo": "fuchsch1234/lpc178x_7x", "path": "/src/iocon/p2_12.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fuchsch1234/lpc178x_7x path: /src/iocon/p2_12.rs #[doc = "Reader of register P2_12"] pub type R = crate::R<u32, super::P2_12>; #[doc = "Writer for register P2_12"] pub type W = crate::W<u32, super::P2_12>; #[doc = "Selects pin function for pin P2\\[12\\]"] #[derive(Clone, Copy, Debug, PartialEq)...
code_fim
hard
{ "lang": "rust", "repo": "fuchsch1234/lpc178x_7x", "path": "/src/iocon/p2_12.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: azriel91/hull path: /src/command/each.rs use std::path::{Path, PathBuf}; use cargo_metadata; use duct::cmd; use which::which; use command; #[derive(Debug)] pub struct Each<'c> { /// Path to the crate manifest pub manifest_path: &'c PathBuf, /// Command to execute pub command: ...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/hull", "path": "/src/command/each.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> metadata .packages .iter() .filter_map(|package| Path::new(&package.manifest_path).parent()) .for_each(|crate_dir| self.run_command_in(&crate_dir)); Ok(()) } }<|fim_prefix|>// repo: azriel91/hull path: /src/command/each.rs use std::path...
code_fim
hard
{ "lang": "rust", "repo": "azriel91/hull", "path": "/src/command/each.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AustinHaugerud/oxidsys path: /src/language/operations/scenes_and_missions/set_shader_param_float.rs use language::operations::{make_param_doc, Operation, ParamInfo}; pub struct SetShaderParamFloatOp; const DOC : &str = "Version 1.153+. Allows direct manupulation of shader parameters. Operation...
code_fim
medium
{ "lang": "rust", "repo": "AustinHaugerud/oxidsys", "path": "/src/language/operations/scenes_and_missions/set_shader_param_float.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wezm/cc2650 path: /src/aux_anaif/adcfifostat.rs #[doc = r" Value read from the register"] pub struct R { bits: u32, } impl super::ADCFIFOSTAT { #[doc = r" Reads the contents of the register"] #[inline] pub fn read(&self) -> R { R { bits: self.register.get() } } } #[do...
code_fim
hard
{ "lang": "rust", "repo": "wezm/cc2650", "path": "/src/aux_anaif/adcfifostat.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> UNDERFLOWR { bits } } #[doc = "Bit 2 - FIFO full flag. 0: FIFO is not full, there is less than 4 samples in the FIFO. 1: FIFO is full, there are 4 samples in the FIFO. When the flag is set, it is not possible to add more samples to the ADC FIFO. An attempt to add samples sets the OVERFLOW...
code_fim
hard
{ "lang": "rust", "repo": "wezm/cc2650", "path": "/src/aux_anaif/adcfifostat.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let result = Some(self.next); self.next = unsafe { pmemobj_next(self.next) }; result } } impl PMEMoidIterator { /// Create a new iterator starting at the specific PMEMoid. #[inline(always)] pub fn from(starts_at: PMEMoid) -> Self { Self { next: starts_at } } }<|fim_prefix|>// repo: l...
code_fim
medium
{ "lang": "rust", "repo": "lemonrock/nvml", "path": "/workspace/nvml/src/object_pool/PMEMoidIterator.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemonrock/nvml path: /workspace/nvml/src/object_pool/PMEMoidIterator.rs // This file is part of dpdk. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/dpdk/master/COPYRIGHT. No part o...
code_fim
medium
{ "lang": "rust", "repo": "lemonrock/nvml", "path": "/workspace/nvml/src/object_pool/PMEMoidIterator.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mfkiwl/ft60x-rs path: /src/ft60x.rs use rusb::{ request_type, AsyncGroup, Context, DeviceHandle, Direction, Recipient, RequestType, Transfer, }; use std::time::Duration; use crate::ft60x_config::FT60xConfig; use crate::ringbuf::{RingBuf, RingBufConsumer}; use crate::Result; use owning_ref::...
code_fim
hard
{ "lang": "rust", "repo": "mfkiwl/ft60x-rs", "path": "/src/ft60x.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ctrlreq = [ 0x00, 0x00, 0x00, 0x00, 0x82, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, ]; self.device .write_bulk(0x01, &ctrlreq, Duration::new(1, 0))?; self.st...
code_fim
hard
{ "lang": "rust", "repo": "mfkiwl/ft60x-rs", "path": "/src/ft60x.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CGMossa/learn-rust path: /src/ref_spec.rs // This file is part of https://github.com/alexsednz/learn-rust. // // learn-rust is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either vers...
code_fim
hard
{ "lang": "rust", "repo": "CGMossa/learn-rust", "path": "/src/ref_spec.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let p3 = &mut p1; p3.x = -1; // We can do this, as p3 is a mutable ref of p1 and p1 is mutable. let mut p4 = p2.clone(); // If we had ```p4 = p2;``` in the previous line, we couldn't use p2 below p4.x = p2.x + 2; assert_eq!(sqr_distance(p3, &p4), 25); // p...
code_fim
medium
{ "lang": "rust", "repo": "CGMossa/learn-rust", "path": "/src/ref_spec.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( ::std::mem::size_of::<_CRT_DOUBLE>(), 8usize, concat!("Size of: ", stringify!(_CRT_DOUBLE)) ); assert_eq!( ::std::mem::align_of::<_CRT_DOUBLE>(), 8usize, concat!("Alignment of ", stringify!(_CRT_DOUBLE)) ); assert_eq!( ...
code_fim
hard
{ "lang": "rust", "repo": "mosmeh/maguro", "path": "/ksw2/src/bindings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( ::std::mem::size_of::<_LDBL12>(), 12usize, concat!("Size of: ", stringify!(_LDBL12)) ); assert_eq!( ::std::mem::align_of::<_LDBL12>(), 1usize, concat!("Alignment of ", stringify!(_LDBL12)) ); assert_eq!( unsafe { &(*(:...
code_fim
hard
{ "lang": "rust", "repo": "mosmeh/maguro", "path": "/ksw2/src/bindings.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mosmeh/maguro path: /ksw2/src/bindings.rs os::raw::c_int, ) -> ::std::os::raw::c_int; } extern "C" { pub fn _isctype_l( _C: ::std::os::raw::c_int, _Type: ::std::os::raw::c_int, _Locale: _locale_t, ) -> ::std::os::raw::c_int; } extern "C" { pub fn isalpha(_...
code_fim
hard
{ "lang": "rust", "repo": "mosmeh/maguro", "path": "/ksw2/src/bindings.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ktfleming/rhc path: /src/config.rs use serde::Deserialize; use std::fs; use std::path::Path; #[derive(Deserialize, Debug)] pub struct Config { pub request_definition_directory: String, pub environment_directory: String, pub history_file: String, pub theme: Option<String>, pu...
code_fim
hard
{ "lang": "rust", "repo": "ktfleming/rhc", "path": "/src/config.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Config { request_definition_directory: "~/rhc/definitions".to_string(), environment_directory: "~/rhc/environments".to_string(), history_file: "~/.rhc_history".to_string(), theme: None, connect_timeout_seconds: None, read_time...
code_fim
medium
{ "lang": "rust", "repo": "ktfleming/rhc", "path": "/src/config.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if !self.opts.ignore_unknown_authors || self.config.config.is_github_login_known(&pr.user.login) { let analyzer = PullRequestAnalyzer::new(&self.repo, pr, &self.config, &self.logger); ...
code_fim
hard
{ "lang": "rust", "repo": "joshuadmasterson/codealong", "path": "/codealong-github/src/pull_requests_analyzer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let url = format!( "https://api.github.com/repos/{}/pulls?state=all", self.config.repo.github_name.as_ref().unwrap() ); Cursor::new(&self.client, &url, &self.logger) } } struct PullRequestsCursor<'client> { repo: &'client Repository, config: &'c...
code_fim
hard
{ "lang": "rust", "repo": "joshuadmasterson/codealong", "path": "/codealong-github/src/pull_requests_analyzer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joshuadmasterson/codealong path: /codealong-github/src/pull_requests_analyzer.rs use git2::Repository; use slog::Logger; use codealong::{AnalyzeOpts, Repo, RepoConfig}; use crate::client::Client; use crate::cursor::Cursor; use crate::error::*; use crate::pull_request::PullRequest; use crate::p...
code_fim
hard
{ "lang": "rust", "repo": "joshuadmasterson/codealong", "path": "/codealong-github/src/pull_requests_analyzer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: supcmd/identity.rs path: /identity-iota/src/chain/diff.rs // Copyright 2020-2021 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 use core::fmt::Display; use core::fmt::Error as FmtError; use core::fmt::Formatter; use core::fmt::Result as FmtResult; use core::slice::Iter; use identity_core:...
code_fim
hard
{ "lang": "rust", "repo": "supcmd/identity.rs", "path": "/identity-iota/src/chain/diff.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Creates a new `DiffChain`. pub fn new() -> Self { Self { inner: Vec::new() } } /// Returns the total number of diffs in the chain. pub fn len(&self) -> usize { self.inner.len() } /// Returns `true` if the diff chain is empty. pub fn is_empty(&self) -> bool { self.inner.is...
code_fim
hard
{ "lang": "rust", "repo": "supcmd/identity.rs", "path": "/identity-iota/src/chain/diff.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Adds a new diff to the diff chain. /// /// # Errors /// /// Fails if the diff signature is invalid or the Tangle message /// references within the diff are invalid. pub fn try_push(&mut self, auth: &AuthChain, diff: DocumentDiff) -> Result<()> { self.check_validity(auth, &diff)?; ...
code_fim
hard
{ "lang": "rust", "repo": "supcmd/identity.rs", "path": "/identity-iota/src/chain/diff.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Azure/iotedge path: /edgelet/iotedge/src/check/checks/storage_mounted_from_host.rs //! Note: Keep in sync with Microsoft.Azure.Devices.Edge.Agent.Service.Program.GetStoragePath and Microsoft.Azure.Devices.Edge.Hub.Service.DependencyManager.GetStoragePath use std::path::{Path, PathBuf}; use any...
code_fim
hard
{ "lang": "rust", "repo": "Azure/iotedge", "path": "/edgelet/iotedge/src/check/checks/storage_mounted_from_host.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(CheckResult::Ok) } async fn inspect_container( docker_host_arg: &str, name: &str, ) -> anyhow::Result<docker::models::InlineResponse200> { super::docker(docker_host_arg, &["inspect", name]) .await .map_err(|(_, err)| err) .and_then(|output| { let (in...
code_fim
hard
{ "lang": "rust", "repo": "Azure/iotedge", "path": "/edgelet/iotedge/src/check/checks/storage_mounted_from_host.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let user_id = req.user().id; let db = try!( req.stuff().get_current_db_conn() ); let is_need_vote = try!( db.is_need_user_vote( body.scheduled_id, user_id ) ); let answer = if is_need_vote { Answer::good( OkInfo::new( "need_some_voting" ) ) } els...
code_fim
hard
{ "lang": "rust", "repo": "derevnja/photometer", "path": "/src/events/group_voting.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let answer = Answer::good( GroupVoitingInfo { event_obj: event_obj_as_string, all_count: votes.all_count, yes: votes.yes.len(), no: votes.no.len() } ); Ok( answer ) } /// проверка на возможное досрочное завершение fn is_co...
code_fim
hard
{ "lang": "rust", "repo": "derevnja/photometer", "path": "/src/events/group_voting.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: derevnja/photometer path: /src/events/group_voting.rs /// Событие которое агрегирует в себя другое событие и выполняет его только если /// за него проголосовало необходимое кол-во членов группы use super::{ Event, ScheduledEventInfo, FullEventInfo, events_collection }; use types::{ Id, EmptyRes...
code_fim
hard
{ "lang": "rust", "repo": "derevnja/photometer", "path": "/src/events/group_voting.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!(""); let title = "Today's news in Korea "; println!("{:-^38}", title); let bar = "|"; println!("{: <10}{: >12} {: >15}", bar, bar, bar); // no variable name, pad with space 15 characters each let a = "SEOUL"; let b= "TOKYO"; let c = "Tashkent"; println!("{city...
code_fim
hard
{ "lang": "rust", "repo": "Urunov/Rust-Awesome-Projects", "path": "/Part-1. Fundamentals/007.stack_heap_pointers/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Urunov/Rust-Awesome-Projects path: /Part-1. Fundamentals/007.stack_heap_pointers/src/main.rs fn main() { println!("Pointer"); let number = 15; let single_reference = &number; let double_reference = &single_reference; let five_reference = &&&&&number; <|fim_suffix|> print...
code_fim
hard
{ "lang": "rust", "repo": "Urunov/Rust-Awesome-Projects", "path": "/Part-1. Fundamentals/007.stack_heap_pointers/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("--- Line of ----"); println!("\t Start with a tab, as book and youtube \n course new progress."); println!("Here is more information \\n one and two \\t processing "); // just cancel of the /n and /t println!("-------------------------------------"); println!(" ------- El...
code_fim
medium
{ "lang": "rust", "repo": "Urunov/Rust-Awesome-Projects", "path": "/Part-1. Fundamentals/007.stack_heap_pointers/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match self.eat_curr()? { TokenTree { kind: TokenNode::Group(delim, ts), span } => { Ok((delim, Spanned::new(ts, span))) } other => err!(other.span, "expected block (delimited token stream), found '{}'", other), } } /// Consumes a...
code_fim
hard
{ "lang": "rust", "repo": "LukasKalbertodt/mauzi", "path": "/mauzi_macros/src/parse.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LukasKalbertodt/mauzi path: /mauzi_macros/src/parse.rs `mauzi!` was called at the top level. let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); let src_dir = Path::new(&manifest_dir).join("src"); let mut iter = Iter::new(input); let locale_def = parse_locale_def(&mut i...
code_fim
hard
{ "lang": "rust", "repo": "LukasKalbertodt/mauzi", "path": "/mauzi_macros/src/parse.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Next, there could be a group to specify a region. if !iter.peek_curr()?.kind.is_group() { // Simple case: only a language is given. Ok(ast::ArmPattern::Lang(lang)) } else { // More complex case: language and region are given. let r...
code_fim
hard
{ "lang": "rust", "repo": "LukasKalbertodt/mauzi", "path": "/mauzi_macros/src/parse.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[aoc(day21, part2)] fn solver2(program: &[i64]) -> i64 { // Now, we need to be lazy with our jumps if possible. // Only jump if from the landing spot, you can safely continue. // If D is ground, and (H is ground, or (I and E are ground), or // E and F are ground), jump. let springcode...
code_fim
hard
{ "lang": "rust", "repo": "grebnetiew/aoc2019", "path": "/src/day21.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grebnetiew/aoc2019 path: /src/day21.rs use crate::intcode::Computer; use aoc_runner_derive::{aoc, aoc_generator}; use std::num::ParseIntError; #[aoc_generator(day21)] fn one_line_many_numbers(input: &str) -> Result<Vec<i64>, ParseIntError> { input.split(',').map(str::parse).collect() } #[a...
code_fim
hard
{ "lang": "rust", "repo": "grebnetiew/aoc2019", "path": "/src/day21.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kbz/beatmap-repo path: /datafiles/m_036_hard.rs position":1},{"timing_sec":14.159,"effect":8,"effect_value":2.0,"position":4},{"timing_sec":15.313,"effect":1,"effect_value":2.0,"position":7},{"timing_sec":15.602,"effect":1,"effect_value":2.0,"position":6},{"timing_sec":15.89,"effect":17,"effect_...
code_fim
hard
{ "lang": "rust", "repo": "kbz/beatmap-repo", "path": "/datafiles/m_036_hard.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>36,"effect":17,"effect_value":2.0,"position":2},{"timing_sec":90.313,"effect":1,"effect_value":2.0,"position":9},{"timing_sec":90.602,"effect":1,"effect_value":2.0,"position":8},{"timing_sec":90.89,"effect":1,"effect_value":2.0,"position":7},{"timing_sec":91.467,"effect":8,"effect_value":2.0,"position":4}...
code_fim
hard
{ "lang": "rust", "repo": "kbz/beatmap-repo", "path": "/datafiles/m_036_hard.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kbz/beatmap-repo path: /datafiles/m_036_hard.rs ect":24,"effect_value":2.0,"position":3},{"timing_sec":18.775,"effect":24,"effect_value":2.0,"position":9},{"timing_sec":18.775,"effect":17,"effect_value":2.0,"position":1},{"timing_sec":19.063,"effect":1,"effect_value":2.0,"position":2},{"timing_s...
code_fim
hard
{ "lang": "rust", "repo": "kbz/beatmap-repo", "path": "/datafiles/m_036_hard.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FilonenkoM/infosearch-algorithms path: /multi_index/src/main.rs use multi_index; fn main() { let args: Vec<String> = std::env::args().collect(); if args.len() < 3 { println!("--- CREATE A VOCABULA<|fim_suffix|>use documentation"); } else { let vocabulary = multi_ind...
code_fim
hard
{ "lang": "rust", "repo": "FilonenkoM/infosearch-algorithms", "path": "/multi_index/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use documentation"); } else { let vocabulary = multi_index::build(&args[1]); multi_index::save(&args[2], &vocabulary); } }<|fim_prefix|>// repo: FilonenkoM/infosearch-algorithms path: /multi_index/src/main.rs use multi_index; fn main() { let args: Vec<String> = std::env::ar...
code_fim
hard
{ "lang": "rust", "repo": "FilonenkoM/infosearch-algorithms", "path": "/multi_index/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>gorithm that you would like to choose (--greedy, --greedy_mltrd or --quick). The default is quick Only UTF-8 TXT files accepte For more information use documentation"); } else { let vocabulary = multi_index::build(&args[1]); multi_index::save(&args[2], &vocabulary); } }<|fim_pre...
code_fim
medium
{ "lang": "rust", "repo": "FilonenkoM/infosearch-algorithms", "path": "/multi_index/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dsnam/LocustDB path: /src/mem_store/mod.rs pub mod column; pub mod batch; pub mod value; pub mod c<|fim_suffix|>elf::column::{ColumnCodec, Column, PlainColumn, Codec};<|fim_middle|>olumn_builder; pub mod table; pub mod raw_col; pub mod integers; pub mod strings; mod mixed_column; pub use s
code_fim
medium
{ "lang": "rust", "repo": "dsnam/LocustDB", "path": "/src/mem_store/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>elf::column::{ColumnCodec, Column, PlainColumn, Codec};<|fim_prefix|>// repo: dsnam/LocustDB path: /src/mem_store/mod.rs pub mod column; pub mod batch; pub mod value; pub mod column_builder; pub mod table; pub mod raw_col; pub mod <|fim_middle|>integers; pub mod strings; mod mixed_column; pub use s
code_fim
easy
{ "lang": "rust", "repo": "dsnam/LocustDB", "path": "/src/mem_store/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/lib/fuchsia-async/src/runtime/fuchsia/timer.rs // Copyright 2018 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. //! Support for creating futures that represent timers. ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/fuchsia-async/src/runtime/fuchsia/timer.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl PartialOrd for TimeWaker { fn partial_cmp(&self, other: &Self) -> Option<cmp::Ordering> { Some(self.cmp(other)) } } impl PartialEq for TimeWaker { /// BinaryHeap requires `TimeWaker: Ord` above so that there's a total ordering between /// elements, and `T: Ord` requires `T: E...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/fuchsia-async/src/runtime/fuchsia/timer.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HeadBeeGuy/Advent-of-Code-2019 path: /day09/rust/day09pt1/src/main.rs // Advent of Code Day 9 parts 1 and 2 // Fortunately isize on a 64-bit system (that is to say, i64) seems to be large // enough to contain the numbers this puzzle uses. // I refactored my Intcode processor to use a hash map ...
code_fim
hard
{ "lang": "rust", "repo": "HeadBeeGuy/Advent-of-Code-2019", "path": "/day09/rust/day09pt1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: naamancurtis/suaide path: /src/subcommands/stand_up.rs use chrono::Local; use clap::{App, Arg, ArgMatches}; use colored::Colorize; use std::io; use diesel::prelude::*; use crate::common::time::calculate_duration_from_timeframe; use crate::domain::{Status, SuaideError, Task, Timeframe}; use cra...
code_fim
hard
{ "lang": "rust", "repo": "naamancurtis/suaide", "path": "/src/subcommands/stand_up.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut yesterday = suaide .filter(status.eq(Status::Closed as i16)) .filter(closed.between(yesterday_start, yesterday_end)) .or_filter(status.eq(Status::InProgress as i16)) .filter(opened.lt(yesterday_end)) .load::<Task>(state.get_conn())?; yesterday.sort(...
code_fim
hard
{ "lang": "rust", "repo": "naamancurtis/suaide", "path": "/src/subcommands/stand_up.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ygyzys/bzip2-rs path: /src/threadpool.rs use std::num::NonZeroUsize; /// A generic threadpool implementation pub trait ThreadPool: Send { /// Spawn `func` as a task into this threadpool fn spawn<F>(&self, func: F) <|fim_suffix|> where F: FnOnce() + Send + 'static, { ...
code_fim
hard
{ "lang": "rust", "repo": "ygyzys/bzip2-rs", "path": "/src/threadpool.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>} /// A [`ThreadPool`] implementation using the rayon global threadpool #[cfg(feature = "rayon")] #[cfg_attr(docsrs, doc(cfg(feature = "rayon")))] #[derive(Debug)] pub struct RayonThreadPool; #[cfg(feature = "rayon")] impl ThreadPool for RayonThreadPool { #[inline] fn spawn<F>(&self, func: F) ...
code_fim
medium
{ "lang": "rust", "repo": "ygyzys/bzip2-rs", "path": "/src/threadpool.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl GetQueueServiceStatsResponse { async fn try_from(response: AzureResponse) -> azure_core::Result<Self> { let (_, headers, body) = response.deconstruct(); let body = body.collect().await?; let response: GetQueueServiceStatsResponseInternal = read_xml(&body)?; Ok(Ge...
code_fim
hard
{ "lang": "rust", "repo": "Azure/azure-sdk-for-rust", "path": "/sdk/storage_queues/src/operations/get_queue_service_stats.rs", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone, Deserialize)] #[serde(rename_all = "PascalCase")] struct GeoReplication { pub status: Status, pub last_sync_time: Option<String>, } impl GetQueueServiceStatsResponse { async fn try_from(response: AzureResponse) -> azure_core::Result<Self> { let (_, headers, body...
code_fim
hard
{ "lang": "rust", "repo": "Azure/azure-sdk-for-rust", "path": "/sdk/storage_queues/src/operations/get_queue_service_stats.rs", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Azure/azure-sdk-for-rust path: /sdk/storage_queues/src/operations/get_queue_service_stats.rs use crate::QueueServiceClient; use azure_core::{ date, error::{ErrorKind, ResultExt}, headers::Headers, xml::read_xml, Method, Response as AzureResponse, }; use azure_storage::headers...
code_fim
hard
{ "lang": "rust", "repo": "Azure/azure-sdk-for-rust", "path": "/sdk/storage_queues/src/operations/get_queue_service_stats.rs", "mode": "psm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|> /// This feature is currently unsupported pub fn subrange(&self, _start: usize, _size: usize) -> MonitoredSharedMemorySharedPtr { assert!( false, "Subranges in monitored shared memory not supported yet!" ); unimplemented!() } fn check_for_c...
code_fim
hard
{ "lang": "rust", "repo": "willfindlay/rd", "path": "/src/monitored_shared_memory.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: willfindlay/rd path: /src/monitored_shared_memory.rs //! Support tracees that share memory read-only with a non-tracee that //! writes to the memory. Currently this just supports limited cases that //! suffice for dconf: no remapping, coalescing or splitting of the memory is //! allowed (`subran...
code_fim
hard
{ "lang": "rust", "repo": "willfindlay/rd", "path": "/src/monitored_shared_memory.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let fd: ScopedFd = remote.retrieve_fd(tracee_fd); let real_mem_ptr = unsafe { mmap( ptr::null_mut(), m.map.size(), ProtFlags::PROT_READ, MapFlags::MAP_SHARED, fd.as_raw(), offset.try...
code_fim
hard
{ "lang": "rust", "repo": "willfindlay/rd", "path": "/src/monitored_shared_memory.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub struct D { pub qux: C, } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub struct B { pub bar: *mut A, } #[repr(C)] #[derive(Copy, Clone, Debug, PartialEq)] pub struct A { pub foo: *mut B, } #[repr(C)] #[derive(Copy, Clone, Debug...
code_fim
medium
{ "lang": "rust", "repo": "lambdaxymox/fuchsia", "path": "/src/devices/tools/fidlgen_banjo/tests/rust/tables.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lambdaxymox/fuchsia path: /src/devices/tools/fidlgen_banjo/tests/rust/tables.rs // Copyright 2018 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. // WARNING: THIS FILE IS MACHINE GENERATED. DO NOT ...
code_fim
medium
{ "lang": "rust", "repo": "lambdaxymox/fuchsia", "path": "/src/devices/tools/fidlgen_banjo/tests/rust/tables.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: staticgc/taproot path: /vst/src/main.rs mod util; mod init; mod get; mod put; mod commit; mod head; mod diff; mod delete; use util::*; use structopt::StructOpt; use anyhow::Error; #[derive(Debug, StructOpt)] #[structopt(about = "Cli for vstore")] enum Cli { Init { path: String, ...
code_fim
medium
{ "lang": "rust", "repo": "staticgc/taproot", "path": "/vst/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> env_logger::Builder::from_env("VST_LOG").init(); let opt = Cli::from_args(); match opt { Cli::Init{path} => { init::cmd_init(path)?; }, Cli::Get(args) => { get::cmd_get(args)?; }, Cli::Put(args) => { put::cmd_put(args...
code_fim
hard
{ "lang": "rust", "repo": "staticgc/taproot", "path": "/vst/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kanerogers/a-quest-for-a-triangle path: /src/vulkan_context.rs use crate::{ debug_messenger::{get_debug_messenger_create_info, setup_debug_messenger}, device::create_logical_device, physical_device::get_physical_device, util::cstrings_to_raw, vulkan_renderer::COLOUR_FORMAT, }...
code_fim
hard
{ "lang": "rust", "repo": "kanerogers/a-quest-for-a-triangle", "path": "/src/vulkan_context.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn get_components(format: vk::Format) -> vk::ComponentMapping { if format == COLOUR_FORMAT { vk::ComponentMapping::builder() .r(vk::ComponentSwizzle::R) .g(vk::ComponentSwizzle::G) .b(vk::ComponentSwizzle::B) .a(vk::ComponentSwizzle::A) ...
code_fim
hard
{ "lang": "rust", "repo": "kanerogers/a-quest-for-a-triangle", "path": "/src/vulkan_context.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rnbguy/uosql-server path: /server/examples/query.rs extern crate server; use server::auth; use server::net; use server::net::types::DataSet; use server::parse; use server::query; use server::storage::SqlType; use std::cmp::{max, min}; use std::io::{self, stdout, Write}; fn main() { print!("...
code_fim
hard
{ "lang": "rust", "repo": "rnbguy/uosql-server", "path": "/server/examples/query.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> print!("| {1: <0$} ", col_name.len(), "Primary"); for i in 0..(cols.len()) { match table.get_is_primary_key_by_idx(i) { Some(t) => print!("| {1: ^0$} ", min(30, cols[i]), format!("{:?}", t)), None => print!("| {1: ^0$} ", min(30, cols[i]), "none"), } } ...
code_fim
hard
{ "lang": "rust", "repo": "rnbguy/uosql-server", "path": "/server/examples/query.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: creativcoder/forest path: /ipld/graphsync/src/response_manager/response_builder.rs // Copyright 2020 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use crate::{ ExtensionData, Extensions, GraphSyncResponse, MetadataItem, RequestID, ResponseStatusCode, EXTENSION_METADATA, ...
code_fim
hard
{ "lang": "rust", "repo": "creativcoder/forest", "path": "/ipld/graphsync/src/response_manager/response_builder.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }