text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>or("No matching entry name found")] ErrorNoEntryNameMatch, #[error("Could not encrypt data")] ErrorEncryptionError, #[error("Store does not have any data!")] ErrorStoreNoData, #[error("Could not delete RSA Private Key!")] ErrorRSAKeyDelete, #[error("Entry already exists!")]...
code_fim
hard
{ "lang": "rust", "repo": "CS410-510Rust-Password-Manager-CLI/CS510-password-manager-", "path": "/src/generic/errors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>("Could not encrypt data")] ErrorDataEncryption, #[error("Entry does not exist")] ErrorStoreEntryDoesNotExist, #[error("Store does not exist")] ErrorStoreDoesNotExist, #[error("Entered store names do not match! Store names must match to delete an entry")] ErrorMisMatchStoreName...
code_fim
hard
{ "lang": "rust", "repo": "CS410-510Rust-Password-Manager-CLI/CS510-password-manager-", "path": "/src/generic/errors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: image-rs/image path: /src/codecs/ico/mod.rs //! Decoding and Encoding of ICO files //! //! A decoder and encoder for ICO (Windows Icon) image<|fim_suffix|>8.aspx> //! * <https://en.wikipedia.org/wiki/ICO_%28file_format%29> pub use self::decoder::IcoDecoder; #[allow(deprecated)] pub use self:...
code_fim
medium
{ "lang": "rust", "repo": "image-rs/image", "path": "/src/codecs/ico/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>oder; #[allow(deprecated)] pub use self::encoder::{IcoEncoder, IcoFrame}; mod decoder; mod encoder;<|fim_prefix|>// repo: image-rs/image path: /src/codecs/ico/mod.rs //! Decoding and Encoding of ICO files //! //! A decoder and encoder for ICO (Windows Icon) image container files. //! //! # Related Li...
code_fim
medium
{ "lang": "rust", "repo": "image-rs/image", "path": "/src/codecs/ico/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn push_pop_strings() { let mut context = ok!(hiredis::connect("127.0.0.1", 6379)); match ok!(context.command(&["RPUSH", "hiredis-baz", "Good news, everyone!"])) { Reply::Integer(integer) => assert!(integer > 0), _ => assert!(false), } match ok!(context.command(&["B...
code_fim
hard
{ "lang": "rust", "repo": "wangkang/hiredis", "path": "/tests/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut context = ok!(hiredis::connect("127.0.0.1", 6379)); match ok!(context.command(&["RPUSH", "hiredis-baz", "Good news, everyone!"])) { Reply::Integer(integer) => assert!(integer > 0), _ => assert!(false), } match ok!(context.command(&["BLPOP", "hiredis-baz", "10"])) { ...
code_fim
hard
{ "lang": "rust", "repo": "wangkang/hiredis", "path": "/tests/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wangkang/hiredis path: /tests/lib.rs extern crate hiredis; use hiredis::Reply; macro_rules! ok( ($result:expr) => ($result.unwrap()); ); #[test] fn set_get_strings() { let mut context = ok!(hiredis::connect("127.0.0.1", 6379)); match ok!(context.command(&["SET", "hiredis-foo", "Hi...
code_fim
hard
{ "lang": "rust", "repo": "wangkang/hiredis", "path": "/tests/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mdalbello/seqkit path: /src/fasta_mask_by_quality.rs use crate::common::{parse_args, FileReader}; use std::str; use std::fmt::Write; const USAGE: &str = " Usage: fasta mask by quality <fastq_file> <min_baseq> "; pub fn main() { let args = parse_args(USAGE); let mut fasta_file = FileReader...
code_fim
hard
{ "lang": "rust", "repo": "mdalbello/seqkit", "path": "/src/fasta_mask_by_quality.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> output.clear(); output.push_str(&line); fasta_file.read_line(&mut seq); fasta_file.read_line(&mut line); fasta_file.read_line(&mut base_qualities); if seq.ends_with('\n') { seq.pop(); } if base_qualities.ends_with('\n') { base_qualities.pop(); } if seq.len() != base_qualities.len() { ...
code_fim
hard
{ "lang": "rust", "repo": "mdalbello/seqkit", "path": "/src/fasta_mask_by_quality.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn move_south_east_tests() { assert_eq!(move_se(Bitboard::from_square(A1)), 0x0000000000000000); assert_eq!(move_se(Bitboard::from_square(H1)), 0x0000000000000000); assert_eq!(move_se(Bitboard::from_square(A8)), 0x0002000000000000); assert_eq!(move_se(B...
code_fim
hard
{ "lang": "rust", "repo": "niconicoj/Knightime", "path": "/src/mov.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: niconicoj/Knightime path: /src/mov.rs use crate::{bitboard::Bitboard, constants::*}; pub fn move_n(bitboard: Bitboard) -> Bitboard { bitboard << 8u32 } pub fn move_s(bitboard: Bitboard) -> Bitboard { bitboard >> 8u32 } pub fn move_e(bitboard: Bitboard) -> Bitboard { (bi...
code_fim
hard
{ "lang": "rust", "repo": "niconicoj/Knightime", "path": "/src/mov.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gancherj/ethabi path: /src/spec/constructor.rs //! Contract constructor specification. use super::{Param, ParamType}; <|fim_suffix|>impl Constructor { /// Returns all input params of given constructor. pub fn param_types(&self) -> Vec<ParamType> { self.inputs.iter() .map(|p| p.kind.clon...
code_fim
medium
{ "lang": "rust", "repo": "gancherj/ethabi", "path": "/src/spec/constructor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Constructor { /// Returns all input params of given constructor. pub fn param_types(&self) -> Vec<ParamType> { self.inputs.iter() .map(|p| p.kind.clone()) .collect() } }<|fim_prefix|>// repo: gancherj/ethabi path: /src/spec/constructor.rs //! Contract constructor specification. use super...
code_fim
medium
{ "lang": "rust", "repo": "gancherj/ethabi", "path": "/src/spec/constructor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn poll(&mut self, task: &mut Task) -> Poll<Self::Item, Self::Error> { loop { match self.cur { Some(ref mut cur) => { match try_poll!(cur.poll(task)) { Ok(e) => self.result.push(e), // If we hit a...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustc-perf", "path": "/collector/compile-benchmarks/futures/src/collect.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rustc-perf path: /collector/compile-benchmarks/futures/src/collect.rs use std::mem; use {Future, IntoFuture, Task, Poll}; use util::Collapsed; /// A future which takes a list of futures and resolves with a vector of the /// completed values. /// /// This future is created with the `c...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustc-perf", "path": "/collector/compile-benchmarks/futures/src/collect.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (key, &value) in random_map.iter() { assert_eq!(new_tree.get(&key.as_bytes()), Some(&value)) } } #[test] fn remove_test() { let mut new_tree = MerklePatriciaTree::new(); new_tree.insert(b"q", Some(1)); new_tree.insert(b"qw", Some(2)); ...
code_fim
hard
{ "lang": "rust", "repo": "lilans/Merkle-Patricia-Tree-Rust", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(new_tree.remove(b"q"), None); assert_eq!(new_tree.remove(b"qw"), None); assert_eq!(new_tree.remove(b"qwe"), None); assert_eq!(new_tree.remove(b"qwer"), None); assert_eq!(new_tree.remove(b"qwert"), None); assert_eq!(new_tree.remove(b"qwerty"), None...
code_fim
hard
{ "lang": "rust", "repo": "lilans/Merkle-Patricia-Tree-Rust", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lilans/Merkle-Patricia-Tree-Rust path: /src/lib.rs #![feature(test)] #![cfg_attr(feature = "dev", allow(unstable_features))] #![cfg_attr(feature = "dev", feature(plugin))] #![cfg_attr(feature = "dev", plugin(clippy))] extern crate bincode; extern crate rustc_serialize; extern crate crypto; pub...
code_fim
hard
{ "lang": "rust", "repo": "lilans/Merkle-Patricia-Tree-Rust", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Listening to: {}", addr); let url = format!("http://127.0.0.1:{}/hello/Martin", addr.port()); let response = http::Request::get(url) .call() .block() .expect("Failed to call"); let body = response .into_body() .read_to_string() ....
code_fim
medium
{ "lang": "rust", "repo": "lolgesten/hreq", "path": "/examples/server_path_arg.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lolgesten/hreq path: /examples/server_path_arg.rs use hreq::prelude::*; fn main() { // use std::sync::Once; // static START: Once = Once::new(); // START.call_once(|| { // let level = log::LevelFilter::Info; // pretty_env_logger::formatted_builder() // .f...
code_fim
hard
{ "lang": "rust", "repo": "lolgesten/hreq", "path": "/examples/server_path_arg.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let response = http::Request::get(url) .call() .block() .expect("Failed to call"); let body = response .into_body() .read_to_string() .block() .expect("Failed to read body"); println!("Response body:\n{}", body); shut.shutdown().bl...
code_fim
medium
{ "lang": "rust", "repo": "lolgesten/hreq", "path": "/examples/server_path_arg.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wackywendell/rust-protobuf path: /examples/basicproto/mod.rs // This file is generated. Do not edit // @generated #![allow(dead_code)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] #![allow(non_upper_case_globals)] #![allow(unused_imports)] use protobuf::Message as Message_imported...
code_fim
hard
{ "lang": "rust", "repo": "wackywendell/rust-protobuf", "path": "/examples/basicproto/mod.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl ::std::fmt::Debug for BasicMessage { fn fmt(&self, f: &mut ::std::fmt::Formatter) -> ::std::fmt::Result { ::protobuf::text_format::fmt(self, f) } } static file_descriptor_proto_data: &'static [u8] = &[ 0x0a, 0x0b, 0x62, 0x61, 0x73, 0x69, 0x63, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, ...
code_fim
hard
{ "lang": "rust", "repo": "wackywendell/rust-protobuf", "path": "/examples/basicproto/mod.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let ls_pt = m.inverse_transform(pt) + (-*self.center().as_vector()); Ball::new(self.radius()).contains_point(&Identity::new(), &ls_pt) } }<|fim_prefix|>// repo: acmcarther/next_space_coop path: /cargo/vendor/ncollide_geometry-0.2.0/query/point_internal/point_bounding_sphere.rs use na...
code_fim
hard
{ "lang": "rust", "repo": "acmcarther/next_space_coop", "path": "/cargo/vendor/ncollide_geometry-0.2.0/query/point_internal/point_bounding_sphere.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Adds a float as additional header parameter. /// /// This additional header parameter may be either public or private. pub fn add_additional_parameter_string(&mut self, name: &str, value: &str) { let parameter = serde_json::Value::String(value.to_owned()); self.0.additi...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/picky-rs", "path": "/ffi/wasm/src/jwt.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Devolutions/picky-rs path: /ffi/wasm/src/jwt.rs // Deprecation attribute on `JwsAlg::ED25519` causes rustc to emit a warning even if this enum // variant is not used. This is because #[wasm_bindgen] generates `impl` block without // #[allow(deprecated)] attribute. This is a workaround to suppres...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/picky-rs", "path": "/ffi/wasm/src/jwt.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(p) = path { s.merge(File::with_name(&p))?; } // Add in settings from the environment (with a prefix of APP) // Eg.. `APP_DEBUG=1 ./target/app` would set the `debug` key s.merge(Environment::new())?; s.try_into().map_err(|e| e.into())...
code_fim
hard
{ "lang": "rust", "repo": "Miaxos/stripe-integration", "path": "/src/config.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Sentry pub sentry_dsn: String, } impl Config { pub fn load(path: Option<String>) -> Result<Config, AppError> { let mut s = config::Config::new(); //s.merge(File::with_name("config/default"))?; if let Some(p) = path { s.merge(File::with_name(&p))?; ...
code_fim
hard
{ "lang": "rust", "repo": "Miaxos/stripe-integration", "path": "/src/config.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Miaxos/stripe-integration path: /src/config.rs use config::{self, Environment, File}; use serde::Deserialize; use crate::errors::AppError; #[derive(Clone, Deserialize)] pub struct Config { // App ip and port pub port: String, pub ip: String, // Stripe API pub stripe_api_se...
code_fim
hard
{ "lang": "rust", "repo": "Miaxos/stripe-integration", "path": "/src/config.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let idx = { let idx = self .floor(t) .unwrap_or_else(|| self.floor(self[0]).unwrap()); if idx == n { n - self.multiplicity(n) } else { idx } }; let mut res = vec![0.0; n]...
code_fim
hard
{ "lang": "rust", "repo": "khachaturh/truck", "path": "/truck-geometry/src/nurbs/knot_vec.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: khachaturh/truck path: /truck-geometry/src/nurbs/knot_vec.rs /// let knot_vec0 = KnotVec::new(); // empty knot vector /// let knot_vec1 = KnotVec::from(vec![0.0, 0.0, 1.0, 1.0]); /// let knot_vec2 = KnotVec::from(vec![0.0, 0.5, 1.0]); /// let knot_vec3 = KnotVec::from(vec![0.0, 0.0...
code_fim
hard
{ "lang": "rust", "repo": "khachaturh/truck", "path": "/truck-geometry/src/nurbs/knot_vec.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Normalizes the knot vector i.e. makes the first value 0 and the last value 1. /// # Failures /// Returns [`Error::ZeroRange`] if the range of the knot vector is so small. /// /// [`Error::ZeroRange`]: errors/enum.Error.html#variant.ZeroRange /// # Examples /// ``` /// u...
code_fim
hard
{ "lang": "rust", "repo": "khachaturh/truck", "path": "/truck-geometry/src/nurbs/knot_vec.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut a: AST; let mut op_is_plus: Option<bool>; let (input, first) = add_part(input)?; a = first; let (input, b) = opt(value(false, tag(" * ")))(input)?; op_is_plus = b; let mut in_mut = input; while let Some(_) = op_is_plus { let (input, second) = add_part(in_mut...
code_fim
hard
{ "lang": "rust", "repo": "alexarice/aoc2020", "path": "/day18/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexarice/aoc2020 path: /day18/main.rs use nom::{ branch::*, bytes::complete::*, character::complete::*, combinator::*, sequence::*, IResult, }; use std::fs; enum AST { Num(u64), Add(Box<AST>, Box<AST>), Mul(Box<AST>, Box<AST>), } use AST::*; impl AST { fn eval(&self) -> u6...
code_fim
hard
{ "lang": "rust", "repo": "alexarice/aoc2020", "path": "/day18/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Ventmere/walmart-partner-api path: /walmart-partner-api/src/xml.rs use crate::result::*; use reqwest::Response; pub use xmltree::Element; pub trait FromXmlElement: Sized { fn from_xml_element(elem: Element) -> WalmartResult<Self>; } pub struct Xml<T> { inner: T, text: String, } impl<T> ...
code_fim
hard
{ "lang": "rust", "repo": "Ventmere/walmart-partner-api", "path": "/walmart-partner-api/src/xml.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.get_child_text(name).unwrap_or_default() } } impl GetChildText for Element { fn get_child_text(&self, name: &str) -> Option<String> { self.get_child(name).and_then(|c| c.text.clone()) } }<|fim_prefix|>// repo: Ventmere/walmart-partner-api path: /walmart-partner-api/src/xml.rs use crat...
code_fim
hard
{ "lang": "rust", "repo": "Ventmere/walmart-partner-api", "path": "/walmart-partner-api/src/xml.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl GetChildText for Element { fn get_child_text(&self, name: &str) -> Option<String> { self.get_child(name).and_then(|c| c.text.clone()) } }<|fim_prefix|>// repo: Ventmere/walmart-partner-api path: /walmart-partner-api/src/xml.rs use crate::result::*; use reqwest::Response; pub use xmltree::Ele...
code_fim
hard
{ "lang": "rust", "repo": "Ventmere/walmart-partner-api", "path": "/walmart-partner-api/src/xml.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neilbalch/Rust-Book-Notes path: /struct_example/src/main.rs #[derive(Debug)] struct Rectangle { width: u32, height: u32, } <|fim_suffix|>fn area(rectangle: &Rectangle) -> u32 { rectangle.width * rectangle.height }<|fim_middle|>impl Rectangle { fn area(&self) -> u32 { sel...
code_fim
hard
{ "lang": "rust", "repo": "neilbalch/Rust-Book-Notes", "path": "/struct_example/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Rectangle {width: size, height: size} } } fn main() { let rect1 = Rectangle {width: 10, height: 50}; let square1 = Rectangle::square(5); // Use debug trait to print out the struct. println!("rect1 is {:?}", rect1); println!("rect1 is {:#?}", rect1); println!("The area ...
code_fim
medium
{ "lang": "rust", "repo": "neilbalch/Rust-Book-Notes", "path": "/struct_example/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MR2011/Advent-of-Code path: /2019/aoc/src/day13.rs use crate::intcode::VM; use crate::intcode::State; use std::cmp::Ordering; fn move_paddle(x1: i64, x2: i64) -> i64 { match x1.cmp(&x2) { Less => -1, Greater => 1, Equal => 0, } } <|fim_suffix|> if output....
code_fim
hard
{ "lang": "rust", "repo": "MR2011/Advent-of-Code", "path": "/2019/aoc/src/day13.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[aoc(day13, part2)] pub fn solve_part2(input: &Vec<i64>) -> i64 { let mut vm = VM::new(input.clone(), vec![]); vm.set(0, 2); let mut output = Vec::new(); let mut ball = (0, 0); let mut paddle = (0, 0); let mut score = 0; loop { match vm.run_until_new_state() { ...
code_fim
hard
{ "lang": "rust", "repo": "MR2011/Advent-of-Code", "path": "/2019/aoc/src/day13.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if output.len() == 3 { if output[0] == -1 && output[1] == 0 { score = output[2]; }else if output[2] == 4 { ball = (output[0], output[1]); }else if output[2] == 3 { paddle = (output[0], output[1]); } ...
code_fim
hard
{ "lang": "rust", "repo": "MR2011/Advent-of-Code", "path": "/2019/aoc/src/day13.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DoumanAsh/toa-static-server path: /src/utils.rs #[macro_export] macro_rules! error_println { ($($tt:tt)*) => {{ use ::s<|fim_suffix|>ut ::std::io::stderr(), $($tt)*); }} }<|fim_middle|>td::io::Write; let _ = writeln!(&m
code_fim
easy
{ "lang": "rust", "repo": "DoumanAsh/toa-static-server", "path": "/src/utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ut ::std::io::stderr(), $($tt)*); }} }<|fim_prefix|>// repo: DoumanAsh/toa-static-server path: /src/utils.rs #[macro_export] macro_rules! error_println { ($($tt:tt)*) => {{ use ::s<|fim_middle|>td::io::Write; let _ = writeln!(&m
code_fim
easy
{ "lang": "rust", "repo": "DoumanAsh/toa-static-server", "path": "/src/utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn id(&self) -> &str { &self.id } fn merge(&mut self, mut _other: FakeRumor) -> bool { false } } impl protocol::FromProto<newscast::Rumor> for FakeRumor { fn from_proto(_other: newscast::Rumor) -> Result<Self> { Ok(FakeRumor::default()) } } impl From<FakeRumor> ...
code_fim
hard
{ "lang": "rust", "repo": "habitat-sh/habitat", "path": "/components/butterfly/src/rumor/heat.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: habitat-sh/habitat path: /components/butterfly/src/rumor/heat.rs ) -> Self { Self(lock.read()) } /// Return a list of currently "hot" rumors for the specified /// member. This will be the subset of all rumors being tracked /// which have not already been sent to the memb...
code_fim
hard
{ "lang": "rust", "repo": "habitat-sh/habitat", "path": "/components/butterfly/src/rumor/heat.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> heat.lock_rhw().start_hot_rumor(&rumor); // Simulate going through the requisite number of gossip // cycles to cool the rumor down // // Not using the helper function here, as this function is // what this test is actually testing. for _ in 0..Rumor...
code_fim
hard
{ "lang": "rust", "repo": "habitat-sh/habitat", "path": "/components/butterfly/src/rumor/heat.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: silvanshade/quatronaut2020 path: /src/systems/attacked.rs use amethyst::{ core::Transform, derive::SystemDesc, ecs::{Entities, Join, ReadStorage, System, SystemData, WriteStorage}, }; use crate::{ components::{collider::Collider, launcher::Projectile}, entities::{enemy::Enem...
code_fim
hard
{ "lang": "rust", "repo": "silvanshade/quatronaut2020", "path": "/src/systems/attacked.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // we don't need `player` here, though if we add health it'd be useful. keeping for now // until deciding fn run(&mut self, (transforms, players, projectiles, colliders, entities): Self::SystemData) { for (player_entity, _player, player_transform, player_collider) in (&enti...
code_fim
hard
{ "lang": "rust", "repo": "silvanshade/quatronaut2020", "path": "/src/systems/attacked.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// Name of the directory item with the logging endpoint for the worker const SERVICE_LOGS_ENDPOINT: &str = "service-logs-endpoint"; #[derive(Debug)] pub struct Config { pub primary_host: String, pub fallback_host: String, pub static_ttl: u32, pub cloudfront_url: String, pub request_lo...
code_fim
medium
{ "lang": "rust", "repo": "rust-lang/simpleinfra", "path": "/terragrunt/modules/crates-io/compute-static/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/simpleinfra path: /terragrunt/modules/crates-io/compute-static/src/config.rs use fastly::ConfigStore; // Name of the dictionary. Must match the dictionary in `fastly-static.tf`. const DICTIONARY_NAME: &str = "compute_static"; // Name of the dictionary item with the CloudFront URL con...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/simpleinfra", "path": "/terragrunt/modules/crates-io/compute-static/src/config.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lanink/video_serve path: /src/controller/detail.rs use crate::model::Video; use actix_web::{get, web, HttpRequest, HttpResponse, Responder}; use sqlx::mysql::MySqlPool; #[get("/video/{id}")] pub async fn video(req: HttpRequest, pool: web::Data<MySqlPool>) -> impl Responder { let id: u32 = ...
code_fim
medium
{ "lang": "rust", "repo": "lanink/video_serve", "path": "/src/controller/detail.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match result { Ok(data) => HttpResponse::Ok().json(data), _ => HttpResponse::BadRequest().body("Error trying to read all viodes from database"), } }<|fim_prefix|>// repo: lanink/video_serve path: /src/controller/detail.rs use crate::model::Video; use actix_web::{get, web, HttpReq...
code_fim
hard
{ "lang": "rust", "repo": "lanink/video_serve", "path": "/src/controller/detail.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bastiendavid/speedrun-kata path: /rust/src/org/training/speedrun/stage2.rs /** * Refactor until there is no else, you think the code is clean, and all the tests pass. */ pub fn compute_score(dice1: isize, dice2: isize, dice3: isize) -> isize { let mut score: isize = dice1 + dice2 + dice3;...
code_fim
hard
{ "lang": "rust", "repo": "bastiendavid/speedrun-kata", "path": "/rust/src/org/training/speedrun/stage2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn score_is_100_if_dice_are_1_2_3() { assert_eq!(compute_score(1, 2, 3), 100); assert_eq!(compute_score(1, 3, 2), 100); assert_eq!(compute_score(2, 1, 3), 100); assert_eq!(compute_score(2, 3, 1), 100); assert_eq!(compute_score(3, 1, 2), 100); assert_eq!(compute_score(3, 2, ...
code_fim
hard
{ "lang": "rust", "repo": "bastiendavid/speedrun-kata", "path": "/rust/src/org/training/speedrun/stage2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jgbyrne/orbtk path: /src/structs/mod.rs //! This module contains non visual structures like point, rectangle, color and thickness. <|fim_suffix|>mod constraint; mod label; mod offset; mod padding; mod point; mod rect; mod thickness; mod water_mark; #[cfg(test)] mod tests; // pub use self::col...
code_fim
hard
{ "lang": "rust", "repo": "jgbyrne/orbtk", "path": "/src/structs/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests; // pub use self::color::Color; // pub mod color;<|fim_prefix|>// repo: jgbyrne/orbtk path: /src/structs/mod.rs //! This module contains non visual structures like point, rectangle, color and thickness. pub use self::constraint::Constraint; pub use self::label::Label; pub use sel...
code_fim
medium
{ "lang": "rust", "repo": "jgbyrne/orbtk", "path": "/src/structs/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MabezDev/stm32f4xx-hal path: /src/i2c.rs use stm32::{I2C1, RCC}; use hal::blocking::i2c::{Read, Write, WriteRead}; use gpio::gpiob::{PB6, PB7, PB8, PB9}; use gpio::{Alternate, AF4}; use rcc::Clocks; use time::{Hertz, KiloHertz, U32Ext}; /// I2C abstraction pub struct I2c<I2C, PINS> { i2c:...
code_fim
hard
{ "lang": "rust", "repo": "MabezDev/stm32f4xx-hal", "path": "/src/i2c.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> fn recv_byte(&self) -> Result<u8, Error> { while self.i2c.sr1.read().rx_ne().bit_is_clear() {} let value = self.i2c.dr.read().bits() as u8; Ok(value) } } impl<PINS> WriteRead for I2c<I2C1, PINS> { type Error = Error; fn write_read(&mut self, addr: u8, bytes: &[u8]...
code_fim
hard
{ "lang": "rust", "repo": "MabezDev/stm32f4xx-hal", "path": "/src/i2c.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> // Configure correct rise times i2c.trise.write(|w| w.trise().bits(trise as u8)); // I2C clock control calculation if speed <= 100.khz().into() { let ccr = { let ccr = clock / (speed.0 * 2); if ccr < 4 { 4 ...
code_fim
hard
{ "lang": "rust", "repo": "MabezDev/stm32f4xx-hal", "path": "/src/i2c.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lnds/exercism_rust_track path: /perfect-numbers/src/lib.rs use std::cmp::Ordering; #[derive(Debug, PartialEq, Eq)] pub enum Classification { Abundant, Perfect, Deficient, } fn factors_sum(num: u64) -> u64 { <|fim_suffix|>pub fn classify(num: u64) -> Option<Classification> { mat...
code_fim
medium
{ "lang": "rust", "repo": "lnds/exercism_rust_track", "path": "/perfect-numbers/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (1u64..num).filter(|x| num % x == 0).sum() } pub fn classify(num: u64) -> Option<Classification> { match num { 0 => None, _ => match factors_sum(num).cmp(&num) { Ordering::Equal => Some(Classification::Perfect), Ordering::Less => Some(Classification::Defici...
code_fim
medium
{ "lang": "rust", "repo": "lnds/exercism_rust_track", "path": "/perfect-numbers/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn classify(num: u64) -> Option<Classification> { match num { 0 => None, _ => match factors_sum(num).cmp(&num) { Ordering::Equal => Some(Classification::Perfect), Ordering::Less => Some(Classification::Deficient), _ => Some(Classification::Abunda...
code_fim
medium
{ "lang": "rust", "repo": "lnds/exercism_rust_track", "path": "/perfect-numbers/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tyler-ball/habitat path: /components/common/src/lib.rs // Copyright (c) 2016-2017 Chef Software Inc. and/or applicable contributors // // 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 o...
code_fim
hard
{ "lang": "rust", "repo": "tyler-ball/habitat", "path": "/components/common/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // TODO (CM): Once the other TODOs above are done (especially the // documentation bits), it would be nice to extract this logic // into an actual discoverable CLI subcommand; it's a little weird // that you have to know how to enable a feature flag before you // ca...
code_fim
hard
{ "lang": "rust", "repo": "tyler-ball/habitat", "path": "/components/common/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Event { inner: self.inner.clone() } } } impl<T> Drop for Event<T> { fn drop(&mut self) { let f = self.inner.0.lock().unwrap(); // notify other clone, so that it won't hung for ever. self.inner.1.notify_all(); drop(f); } } #[cfg(test)] mod test { u...
code_fim
hard
{ "lang": "rust", "repo": "stormgbs/tikv", "path": "/src/util/event.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stormgbs/tikv path: /src/util/event.rs use std::sync::{Arc, Mutex, Condvar}; use std::time::{Duration, Instant}; /// This is a simple mechanism to synchronize between threads with timeout support. pub struct Event<T> { inner: Arc<(Mutex<Option<T>>, Condvar)>, } impl<T> !Sync for Event<T> {...
code_fim
hard
{ "lang": "rust", "repo": "stormgbs/tikv", "path": "/src/util/event.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert!(!e.wait_clear(Some(Duration::from_millis(100)))); assert!(start_time.elapsed() - past_time >= Duration::from_millis(100)); let v = e.apply(|s| *s); assert_eq!(e.take(), v); assert!(!e.is_set()); assert!(!e.wait_timeout(Some(Duration::from_millis(10...
code_fim
hard
{ "lang": "rust", "repo": "stormgbs/tikv", "path": "/src/util/event.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jbradberry/advent-of-code path: /2022/day03-1/src/main.rs use std::collections::HashSet; use std::io; use std::io::prelude::*; fn read() -> Vec<Vec<String>> { let stdin = io::stdin(); stdin.lock().lines() .map(|line| line.unwrap()) .map(|s| { let (x, y) = s...
code_fim
hard
{ "lang": "rust", "repo": "jbradberry/advent-of-code", "path": "/2022/day03-1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let double_items = backpacks.iter().map(|b| double_packed(b)).collect::<Vec<HashSet<char>>>(); let total_priority = double_items.iter().map(|s| s.iter().cloned().map(priority).sum::<u32>()).sum::<u32>(); println!("total priority: {}", total_priority); }<|fim_prefix|>// repo: jbradberry/advent-...
code_fim
hard
{ "lang": "rust", "repo": "jbradberry/advent-of-code", "path": "/2022/day03-1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rust-bindgen path: /bindgen-tests/tests/expectations/tests/crtp.rs #![allow(dead_code, non_snake_case, non_camel_case_types, non_upper_case_globals)] #[repr(C)] #[derive(Debug, Default, Copy, Clone)] pub struct Base { pub _address: u8, } #[repr(C)] #[derive(Debug, Default, Copy, Cl...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust-bindgen", "path": "/bindgen-tests/tests/expectations/tests/crtp.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( ::std::mem::size_of::<DerivedFromBaseWithDestructor>(), 1usize, concat!("Size of: ", stringify!(DerivedFromBaseWithDestructor)), ); assert_eq!( ::std::mem::align_of::<DerivedFromBaseWithDestructor>(), 1usize, concat!("Alignment of ", ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust-bindgen", "path": "/bindgen-tests/tests/expectations/tests/crtp.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let mut writer = ReversedPacketWriter::new(&mut buffer); writer.write_variable_length_integer(129).unwrap(); let result = writer.finish(); assert_eq!(result, [0x81, 0x01]); let mut writer = ReversedPacketWriter::new(&mut buffer); writer.write_variable_lengt...
code_fim
hard
{ "lang": "rust", "repo": "chrysn-pull-requests/minimq", "path": "/src/ser/packet_writer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chrysn-pull-requests/minimq path: /src/ser/packet_writer.rs /// Provides a means of serializing an MQTT control packet. use crate::{MessageType, Property, ProtocolError as Error}; use bit_field::BitField; /// Structure for writing a packet. /// /// /// # Note /// Serialization is performed tai...
code_fim
hard
{ "lang": "rust", "repo": "chrysn-pull-requests/minimq", "path": "/src/ser/packet_writer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mmmpa/treeer path: /src/treeer/child_receiver.rs use modifier::Modifier; use crate::treeer::element::{SelfContainedElement, OpeningElement, TextNode}; use crate::treeer::state::{StateChild, State}; use crate::treeer::tag_new::TagNew; macro_rules! define_opening_elements { ( $($element:tt),...
code_fim
hard
{ "lang": "rust", "repo": "mmmpa/treeer", "path": "/src/treeer/child_receiver.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ChildReceiver { pub fn new() -> Self { Self::default() } fn push(&mut self, child: StateChild) { self.0.push(child); } pub fn text(&mut self, s: String) { self.0.push(StateChild::TextNode(TextNode::new(s))); } define_opening_elements!( a,...
code_fim
hard
{ "lang": "rust", "repo": "mmmpa/treeer", "path": "/src/treeer/child_receiver.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.0.push(child); } pub fn text(&mut self, s: String) { self.0.push(StateChild::TextNode(TextNode::new(s))); } define_opening_elements!( a, abbr, acronym, address, applet, b, bdo, big, blockquote, ...
code_fim
hard
{ "lang": "rust", "repo": "mmmpa/treeer", "path": "/src/treeer/child_receiver.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} impl<O: IsA<GutterRendererPixbuf>> GutterRendererPixbufExt for O { //fn get_gicon(&self) -> /*Ignored*/Option<gio::Icon> { // unsafe { TODO: call ffi::gtk_source_gutter_renderer_pixbuf_get_gicon() } //} fn get_icon_name(&self) -> Option<String> { unsafe { from_gl...
code_fim
hard
{ "lang": "rust", "repo": "antoyo/gtksourceview-rs", "path": "/src/auto/gutter_renderer_pixbuf.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: antoyo/gtksourceview-rs path: /src/auto/gutter_renderer_pixbuf.rs // This file was generated by gir (b010d34) from gir-files (71d73f0) // DO NOT EDIT use GutterRenderer; use ffi; use glib::object::Downcast; use glib::object::IsA; use glib::translate::*; glib_wrapper! { pub struct GutterRen...
code_fim
hard
{ "lang": "rust", "repo": "antoyo/gtksourceview-rs", "path": "/src/auto/gutter_renderer_pixbuf.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { from_glib_none(ffi::gtk_source_gutter_renderer_pixbuf_get_icon_name(self.to_glib_none().0)) } } //fn get_pixbuf(&self) -> /*Ignored*/Option<gdk_pixbuf::Pixbuf> { // unsafe { TODO: call ffi::gtk_source_gutter_renderer_pixbuf_get_pixbuf() } //} f...
code_fim
hard
{ "lang": "rust", "repo": "antoyo/gtksourceview-rs", "path": "/src/auto/gutter_renderer_pixbuf.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mehak-Mehta/Rust-lang path: /src/pointer_refs.rs pub fn run() { // primative array let arr1 = [1,2,3]; let arr2 = arr1; <|fim_suffix|> let arr1 = vec![1,2,3]; let arr2 = &arr1; println!("{:?}", (&arr1, &arr2)) }<|fim_middle|> println!("{:?}", (&arr1, &arr2));
code_fim
easy
{ "lang": "rust", "repo": "Mehak-Mehta/Rust-lang", "path": "/src/pointer_refs.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{:?}", (&arr1, &arr2)) }<|fim_prefix|>// repo: Mehak-Mehta/Rust-lang path: /src/pointer_refs.rs pub fn run() { // primative array let arr1 = [1,2,3]; let arr2 = arr1; println!("{:?}", (&arr1, &arr2)); <|fim_middle|> let arr1 = vec![1,2,3]; let arr2 = &arr1;
code_fim
easy
{ "lang": "rust", "repo": "Mehak-Mehta/Rust-lang", "path": "/src/pointer_refs.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> log::trace!("Setup BodyUpdatePropertiesSystem"); <BodyUpdatePropertiesSystem as System<'_>>::SystemData::setup(world); let body_event_reader_id = WriteStorage::<BodyComponent>::fetch(world).register_reader(); BodyUpdatePropertiesSystem { body_event_reader_id, ...
code_fim
hard
{ "lang": "rust", "repo": "jaynus/survival", "path": "/body/src/systems/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> log::trace!("Final: {:?}", props_container); }); } } #[derive(Default)] pub struct BodyUpdatePropertiesSystemDesc; impl<'a, 'b> SystemDesc<'a, 'b, BodyUpdatePropertiesSystem> for BodyUpdatePropertiesSystemDesc { fn build(self, world: &mut World) -> BodyUpdateProperties...
code_fim
hard
{ "lang": "rust", "repo": "jaynus/survival", "path": "/body/src/systems/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jaynus/survival path: /body/src/systems/mod.rs use crate::components::*; use core::{ amethyst::{ core::{shrev::ReaderId, SystemDesc}, ecs::{ storage::ComponentEvent, BitSet, ParJoin, Read, ReadStorage, System, SystemData, World, WriteStorage, }...
code_fim
hard
{ "lang": "rust", "repo": "jaynus/survival", "path": "/body/src/systems/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: paritytech/substrate path: /primitives/consensus/beefy/src/commitment.rs ned commitments /// (see [SignedCommitment]) forms the BEEFY protocol. #[derive(Clone, Debug, PartialEq, Eq, Encode, Decode, TypeInfo)] pub struct Commitment<TBlockNumber> { /// A collection of payloads to be signed, see ...
code_fim
hard
{ "lang": "rust", "repo": "paritytech/substrate", "path": "/primitives/consensus/beefy/src/commitment.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: paritytech/substrate path: /primitives/consensus/beefy/src/commitment.rs }; use crate::{Payload, ValidatorSetId}; /// A commitment signed by GRANDPA validators as part of BEEFY protocol. /// /// The commitment contains a [payload](Commitment::payload) extracted from the finalized block at /// ...
code_fim
hard
{ "lang": "rust", "repo": "paritytech/substrate", "path": "/primitives/consensus/beefy/src/commitment.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let msg = b"This is the first message"; let sig1 = alice.sign(msg); let msg = b"This is the second message"; let sig2 = alice.sign(msg); (sig1.into(), sig2.into()) } #[test] fn commitment_encode_decode() { // given let payload = Payload::from_single_entry(known_payloads::MMR_ROOT_ID...
code_fim
hard
{ "lang": "rust", "repo": "paritytech/substrate", "path": "/primitives/consensus/beefy/src/commitment.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> quicksilver::lifecycle::run::<game::Game>( "NKd", quicksilver::geom::Vector::new(800, 600), //set size... 60fps settings, ); }<|fim_prefix|>// repo: igaul/NKd path: /src/main.rs //main //calls game from game/mod.rs extern crate quicksilver; pub mod game; fn main() { <|f...
code_fim
hard
{ "lang": "rust", "repo": "igaul/NKd", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: igaul/NKd path: /src/main.rs //main //calls game from game/mod.rs extern crate quicksilver; pub mod game; fn main() { // call copied from qs: // NOTE: Set HIDPI to 1.0 to get pixel-perfect rendering. // Otherwise the window resizes to whatever value the OS sets and // scales t...
code_fim
hard
{ "lang": "rust", "repo": "igaul/NKd", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let settings = quicksilver::lifecycle::Settings { // If the graphics do need to be scaled (e.g. using // `with_center`), blur them. This looks better with fonts. scale: quicksilver::graphics::ImageScaleStrategy::Blur, ..Default::default() }; quicksilver::lifecy...
code_fim
hard
{ "lang": "rust", "repo": "igaul/NKd", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gluxon/wireguard-uapi-rs path: /src/linux/mod.rs mod attr; mod cmd; mod consts; pub mod e<|fim_suffix|>et; pub use interface::DeviceInterface; pub use socket::{RouteSocket, WgSocket};<|fim_middle|>rr; mod interface; pub mod set; mod sock
code_fim
easy
{ "lang": "rust", "repo": "gluxon/wireguard-uapi-rs", "path": "/src/linux/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub use socket::{RouteSocket, WgSocket};<|fim_prefix|>// repo: gluxon/wireguard-uapi-rs path: /src/linux/mod.rs mod attr; mod cmd; mod consts; pub mod e<|fim_middle|>rr; mod interface; pub mod set; mod socket; pub use interface::DeviceInterface;
code_fim
medium
{ "lang": "rust", "repo": "gluxon/wireguard-uapi-rs", "path": "/src/linux/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gluxon/wireguard-uapi-rs path: /src/linux/mod.rs mod attr; mod cmd; mod consts; pub mod err; mod interface; pub mod set; mod sock<|fim_suffix|> pub use socket::{RouteSocket, WgSocket};<|fim_middle|>et; pub use interface::DeviceInterface;
code_fim
easy
{ "lang": "rust", "repo": "gluxon/wireguard-uapi-rs", "path": "/src/linux/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cryspen/hacl-packages path: /rust/src/hazmat/hmac.rs use hacl_sys::{ Hacl_HMAC_compute_sha2_256, Hacl_HMAC_compute_sha2_384, Hacl_HMAC_compute_sha2_512, Hacl_HMAC_legacy_compute_sha1, }; <|fim_suffix|>impl_hmac!(sha1, Hacl_HMAC_legacy_compute_sha1, 20); impl_hmac!(sha2_256, Hacl_HMAC_co...
code_fim
hard
{ "lang": "rust", "repo": "cryspen/hacl-packages", "path": "/rust/src/hazmat/hmac.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl_hmac!(sha1, Hacl_HMAC_legacy_compute_sha1, 20); impl_hmac!(sha2_256, Hacl_HMAC_compute_sha2_256, 32); impl_hmac!(sha2_384, Hacl_HMAC_compute_sha2_384, 48); impl_hmac!(sha2_512, Hacl_HMAC_compute_sha2_512, 64);<|fim_prefix|>// repo: cryspen/hacl-packages path: /rust/src/hazmat/hmac.rs use hacl_sys::{...
code_fim
hard
{ "lang": "rust", "repo": "cryspen/hacl-packages", "path": "/rust/src/hazmat/hmac.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nymtech/nym path: /contracts/name-service/src/state/admin.rs use cosmwasm_std::{Addr, Deps, DepsMut}; use cw_controllers::Admin; <|fim_suffix|>pub(crate) fn set_admin(deps: DepsMut<'_>, admin: Addr) -> Result<()> { Ok(ADMIN.set(deps, Some(admin))?) } pub(crate) fn assert_admin(deps: Deps, ...
code_fim
medium
{ "lang": "rust", "repo": "nymtech/nym", "path": "/contracts/name-service/src/state/admin.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) fn set_admin(deps: DepsMut<'_>, admin: Addr) -> Result<()> { Ok(ADMIN.set(deps, Some(admin))?) } pub(crate) fn assert_admin(deps: Deps, sender: &Addr) -> Result<()> { Ok(ADMIN.assert_admin(deps, sender)?) }<|fim_prefix|>// repo: nymtech/nym path: /contracts/name-service/src/state/admi...
code_fim
medium
{ "lang": "rust", "repo": "nymtech/nym", "path": "/contracts/name-service/src/state/admin.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) fn assert_admin(deps: Deps, sender: &Addr) -> Result<()> { Ok(ADMIN.assert_admin(deps, sender)?) }<|fim_prefix|>// repo: nymtech/nym path: /contracts/name-service/src/state/admin.rs use cosmwasm_std::{Addr, Deps, DepsMut}; use cw_controllers::Admin; use crate::{constants::ADMIN_KEY, Resul...
code_fim
medium
{ "lang": "rust", "repo": "nymtech/nym", "path": "/contracts/name-service/src/state/admin.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> for (sub, col) in subs { let mut sub = sub.unwrap(); for y in 0..10u32 { for x in 0..10u32 { sub.set_pixel(Vu2d { x, y }, col); } } } print_sprite(&spr); }<|fim_prefix|>// repo: Maix0/pixel_engine path: /pixel_engine_draw/exampl...
code_fim
hard
{ "lang": "rust", "repo": "Maix0/pixel_engine", "path": "/pixel_engine_draw/examples/sub_sprite.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }