text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>] pub struct Client { pub id: Option<i32>, pub email: String, pub first_name: Option<String>, pub last_name: Option<String>, }<|fim_prefix|>// repo: tbounsiar/rust-rocket-serde-diesel-api path: /src/api/model/client.rs use crate::config::db::schema::clients; #[table_name = "clients"] #[d...
code_fim
medium
{ "lang": "rust", "repo": "tbounsiar/rust-rocket-serde-diesel-api", "path": "/src/api/model/client.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub first_name: Option<String>, pub last_name: Option<String>, }<|fim_prefix|>// repo: tbounsiar/rust-rocket-serde-diesel-api path: /src/api/model/client.rs use crate::config::db::schema::clients; #[table_name = "clients"] #[derive(Queryable, Insertable, AsChangeset, Debug, Serialize, Deserialize...
code_fim
medium
{ "lang": "rust", "repo": "tbounsiar/rust-rocket-serde-diesel-api", "path": "/src/api/model/client.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tbounsiar/rust-rocket-serde-diesel-api path: /src/api/model/client.rs use crate::config::db::schema::clients; #[table_name = "clients"] #[de<|fim_suffix|>] pub struct Client { pub id: Option<i32>, pub email: String, pub first_name: Option<String>, pub last_name: Option<String>, ...
code_fim
medium
{ "lang": "rust", "repo": "tbounsiar/rust-rocket-serde-diesel-api", "path": "/src/api/model/client.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mbenoukaiss/automate path: /src/gateway/models/payload.rs use crate::gateway::*; use crate::Snowflake; use std::collections::HashMap; use serde_json::Value; use std::ops::BitOr; use chrono::NaiveDateTime; /// A Discord Gateway API Payload. /// Contains the event data and the sequence /// number...
code_fim
hard
{ "lang": "rust", "repo": "mbenoukaiss/automate", "path": "/src/gateway/models/payload.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Subscribe to the [GuildIntegrationsUpdate](automate::gateway::GuildIntegrationsUpdateDispatch) event. GuildIntegrations = 1 << 4, /// Subscribe to the [WebhooksUpdate](automate::gateway::WebhooksUpdateDispatch) event. GuildWebhooks = 1 << 5, /// Subscribe to the following events:...
code_fim
hard
{ "lang": "rust", "repo": "mbenoukaiss/automate", "path": "/src/gateway/models/payload.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn it_works() { assert_eq!(add(2, 2), 4); } }<|fim_prefix|>// repo: pariz/advent-of-code-2020 path: /src/day00.rs pub fn add(a: usize, b: usize) -> usize { a + b } <|fim_middle|>#[cfg(test)] mod tests { use super::*;
code_fim
easy
{ "lang": "rust", "repo": "pariz/advent-of-code-2020", "path": "/src/day00.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pariz/advent-of-code-2020 path: /src/day00.rs pub fn add(a: usize, b: usize) -> usize { a + b } <|fim_suffix|> assert_eq!(add(2, 2), 4); } }<|fim_middle|>#[cfg(test)] mod tests { use super::*; #[test] fn it_works() {
code_fim
medium
{ "lang": "rust", "repo": "pariz/advent-of-code-2020", "path": "/src/day00.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: peaceman/aoc2020 path: /src/bin/day14a.rs use clap::Clap; use scan_fmt::scan_fmt; use std::collections::HashMap; use std::error::Error as StdError; use std::fs::File; use std::io::{BufRead, BufReader}; use std::str::FromStr; #[derive(Clap)] struct Opts { input: String, } fn main() -> Resu...
code_fim
hard
{ "lang": "rust", "repo": "peaceman/aoc2020", "path": "/src/bin/day14a.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let data = r#" mask = XXXXXXXXXXXXXXXXXXXXXXXXXXXXX1XXXX0X mem[8] = 11 mem[7] = 101 mem[8] = 0 "#; let result = execute(data.as_bytes()); assert_eq!(165, result); } }<|fim_prefix|>// repo: peaceman/aoc2020 path: /src/bin...
code_fim
hard
{ "lang": "rust", "repo": "peaceman/aoc2020", "path": "/src/bin/day14a.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matklad/config path: /xtool/src/amend.rs use xshell::{cmd, Shell}; pub(crate) fn run(sh: &Shell) -> anyhow::Result<()> { cmd!(sh, "git add .").run()?; cmd!(sh, "git --no-pager diff --cached --color=always").run()?; cmd!(sh, "git --no-pager show -s --oneline --abbrev-commit --color=a...
code_fim
medium
{ "lang": "rust", "repo": "matklad/config", "path": "/xtool/src/amend.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{msg}"); let mut buf = String::new(); match std::io::stdin().read_line(&mut buf) { Err(_) | Ok(0) => false, Ok(_) => { let resp = buf.trim(); matches!(resp, "" | "y" | "Y") } } }<|fim_prefix|>// repo: matklad/config path: /xtool/sr...
code_fim
medium
{ "lang": "rust", "repo": "matklad/config", "path": "/xtool/src/amend.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grogers0/sudoku path: /src/sudoku.rs use crate::{ pos::{Pos, PosIndexedSlice, PosBitSet}, value::{MaybeValue, Value, ValueIndexedSlice, ValueBitSet}, }; use std::{ cmp::max, fmt, }; #[derive(Clone, PartialEq, Eq)] pub struct Sudoku { values: PosIndexedSlice<MaybeValue>, ...
code_fim
hard
{ "lang": "rust", "repo": "grogers0/sudoku", "path": "/src/sudoku.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> f.write_str(&self.to_pencilmarks()) } } #[cfg(test)] mod tests { use super::*; #[test] fn test_from_to_line() { let line = "4...3.......6..8..........1....5..9..8....6...7.2........1.27..5.3....4.9........"; let sudoku = Sudoku::from_line(line).unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "grogers0/sudoku", "path": "/src/sudoku.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LinAGKar/advent-of-code-2018-rust path: /day14b/src/main.rs fn main() { let mut input = String::new(); std::io::stdin().read_line(&mut input).unwrap(); <|fim_suffix|> let mut recipes = vec![3, 7]; let mut elves = vec![0, 1]; let mut pos = 0; 'outer: loop { let ne...
code_fim
hard
{ "lang": "rust", "repo": "LinAGKar/advent-of-code-2018-rust", "path": "/day14b/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut recipes = vec![3, 7]; let mut elves = vec![0, 1]; let mut pos = 0; 'outer: loop { let new: u8 = elves.iter().map(|&elf| recipes[elf]).sum(); if new >= 10 { recipes.push(1); recipes.push(new - 10); } else { recipes.push(ne...
code_fim
hard
{ "lang": "rust", "repo": "LinAGKar/advent-of-code-2018-rust", "path": "/day14b/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Json(movies) } pub enum PathResp { File(PathBuf), Dir(PathBuf) } impl Responder<'static> for PathResp { fn respond_to(self, req: &Request) -> Result<Response<'static>, Status> { match self { PathResp::File(path) => NamedFile::open(path).ok().respond_to(req), PathR...
code_fim
hard
{ "lang": "rust", "repo": "Arcia125/media-finder", "path": "/src/routes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Arcia125/media-finder path: /src/routes.rs extern crate rocket_contrib; extern crate serde_json; extern crate reqwest; use std::result::Result; use std::path::{Path, PathBuf}; use rocket::response::{NamedFile, Responder}; use rocket::{Request, Response}; use rocket_contrib::json::{Json}; use r...
code_fim
hard
{ "lang": "rust", "repo": "Arcia125/media-finder", "path": "/src/routes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: teloxide/teloxide path: /crates/teloxide-core/src/types/inline_query_result.rs #![allow(clippy::large_enum_variant)] use derive_more::From; use serde::{Deserialize, Serialize}; use crate::types::{ InlineQueryResultArticle, InlineQueryResultAudio, InlineQueryResultCachedAudio, InlineQue...
code_fim
hard
{ "lang": "rust", "repo": "teloxide/teloxide", "path": "/crates/teloxide-core/src/types/inline_query_result.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn cached_audio_full_serialize() { let structure = InlineQueryResult::CachedAudio(InlineQueryResultCachedAudio { id: String::from("id"), audio_file_id: String::from("audio_file_id"), caption: Some(String::from("caption")), parse_mode:...
code_fim
hard
{ "lang": "rust", "repo": "teloxide/teloxide", "path": "/crates/teloxide-core/src/types/inline_query_result.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let expected_json = r#"{"type":"audio","id":"id","audio_file_id":"audio_file_id","caption":"caption","parse_mode":"HTML","reply_markup":{"inline_keyboard":[]},"input_message_content":{"message_text":"message_text","parse_mode":"MarkdownV2","disable_web_page_preview":true}}"#; let actual_js...
code_fim
hard
{ "lang": "rust", "repo": "teloxide/teloxide", "path": "/crates/teloxide-core/src/types/inline_query_result.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NamsooCho/Crawler_2 path: /src/agent/agent.rs use md5::Digest; use std::collections::HashSet; use std::net::IpAddr; use queues::Queue; use std::collections::HashMap; <|fim_suffix|>impl Agent { pub fn new() -> Self { Self { to_visit_queue: Queue::<IpAddr>::new(), ...
code_fim
hard
{ "lang": "rust", "repo": "NamsooCho/Crawler_2", "path": "/src/agent/agent.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Agent { pub fn new() -> Self { Self { to_visit_queue: Queue::<IpAddr>::new(), visited_queue : Queue::<IpAddr>::new(), to_send_queue : Queue::<String>::new(), contents_table : HashSet::<Digest>::new(), id_dic : HashMap::<Strin...
code_fim
hard
{ "lang": "rust", "repo": "NamsooCho/Crawler_2", "path": "/src/agent/agent.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ab2h/tomiko path: /src/auth/pkce.rs use super::{AccessTokenError, AccessTokenErrorKind}; #[derive(Debug, Clone)] #[derive(serde::Deserialize, serde::Serialize)] pub enum Transformation { #[serde(rename = "plain")] Plain, S256 } impl Default for Transformation { fn default() -> ...
code_fim
hard
{ "lang": "rust", "repo": "ab2h/tomiko", "path": "/src/auth/pkce.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn verify(challenge: &Challenge, verifier: Option<&Verifier>) -> Result<(), AccessTokenError> { use sha2::{Sha256, Digest}; if let Some(verifier) = verifier { use Transformation::*; let matches = match challenge.method { Plain => challenge.code == verifier.value, S256 => { l...
code_fim
hard
{ "lang": "rust", "repo": "ab2h/tomiko", "path": "/src/auth/pkce.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut renderer = window .into_canvas() .accelerated() .present_vsync() .build() .unwrap(); let creator = renderer.texture_creator(); renderer .set_logical_size(WINDOW_WIDTH, WINDOW_HEIGHT) .unwrap(); renderer.clear(); renderer....
code_fim
hard
{ "lang": "rust", "repo": "nrxus/duck_husky_wedding", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nrxus/duck_husky_wedding path: /src/main.rs #[macro_use] extern crate error_chain; extern crate glm; extern crate moho; extern crate sdl2; #[macro_use] extern crate serde_derive; extern crate serde_yaml; mod duck_husky_wedding; mod level_viewer; mod data; mod utils; use duck_husky_wedding::Duc...
code_fim
hard
{ "lang": "rust", "repo": "nrxus/duck_husky_wedding", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub mod errors { error_chain!{ links { Moho(::moho::errors::Error, ::moho::errors::ErrorKind); } foreign_links { Io(::std::io::Error); Yaml(::serde_yaml::Error); } } } fn main() { const WINDOW_WIDTH: u32 = 1280; const WIN...
code_fim
hard
{ "lang": "rust", "repo": "nrxus/duck_husky_wedding", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl FormatBogusNodeRule<JsonBogus> for FormatJsonBogus {}<|fim_prefix|>// repo: rome/tools path: /crates/rome_json_formatter/src/json/bogus/bogus.rs use crate::FormatBogusNodeRule; use rome_json_syntax::JsonBogus; <|fim_middle|>#[derive(Debug, Clone, Default)] pub(crate) struct FormatJsonBogus;
code_fim
medium
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_json_formatter/src/json/bogus/bogus.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rome/tools path: /crates/rome_json_formatter/src/json/bogus/bogus.rs use crate::FormatBogusNodeRule; use rome_json_syntax::JsonBogus; <|fim_suffix|>impl FormatBogusNodeRule<JsonBogus> for FormatJsonBogus {}<|fim_middle|>#[derive(Debug, Clone, Default)] pub(crate) struct FormatJsonBogus;
code_fim
medium
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_json_formatter/src/json/bogus/bogus.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn set_linear_goal(&mut self, goal: f32) { self.linear_control.set_goal(goal); } pub(crate) fn increment_linear_goal(&mut self, inc: f32) { self.linear_control.increment_goal(inc); } pub(crate) fn set_angular_goal(&mut self, goal: f32) { self.angula...
code_fim
hard
{ "lang": "rust", "repo": "ClubRobotInsat/librobot", "path": "/src/navigation/pid.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn pid_forward() { let mut motor_left = DummyMotor::new(); let mut motor_right = DummyMotor::new(); let mut qei_left = QeiManager::new(motor_left.clone()); let mut qei_right = QeiManager::new(motor_right.clone()); let mut pid = PolarController::new(1...
code_fim
hard
{ "lang": "rust", "repo": "ClubRobotInsat/librobot", "path": "/src/navigation/pid.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ClubRobotInsat/librobot path: /src/navigation/pid.rs //! Contiens les types permettant de manipuler un PID pour le déplacement du robot. use core::f32; use crate::navigation::motor::Command; #[allow(unused_imports)] use libm::F32Ext; #[allow(non_snake_case)] pub(crate) struct PID { kp: f...
code_fim
hard
{ "lang": "rust", "repo": "ClubRobotInsat/librobot", "path": "/src/navigation/pid.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if_expr: &If, globals: &mut HashMap<String, Variable>, program: &Program, locals: &mut HashMap<String, Variable>, buildins: &mut Buildins, position: usize, ) -> Result<VarVal, RuntimeError> { let predicate = eval(&if_expr.condition, globals, program, locals, buildins)?; mat...
code_fim
hard
{ "lang": "rust", "repo": "vojta7/pra-lang", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vojta7/pra-lang path: /src/lib.rs pub mod ast; mod lexer; pub use ast::{ ArgList, Block, Else, Expr, ExprType, Function, If, Opcode, Program, Stmt, VarVal, Variable, }; use lalrpop_util::{lalrpop_mod, ParseError}; pub use lexer::{Error as LexerError, Lexer, Token}; use serde::Serialize; use...
code_fim
hard
{ "lang": "rust", "repo": "vojta7/pra-lang", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn parsing_err(from: usize, to: usize, description: String) -> ParsingError { ParsingError { from, to, description, } } pub fn parse(input: &str) -> Result<Program, ParsingError> { let lexer = lexer::Lexer::new(input); parser::ProgramParser::new() .parse(&i...
code_fim
hard
{ "lang": "rust", "repo": "vojta7/pra-lang", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jt-l/stocks path: /src/lib.rs extern crate clap; use clap::{App, Arg, SubCommand}; use std::env; use std::error::Error; use std::process; mod api; mod db; mod formatter; use db::Queries; // valid commands #[derive(Clone)] pub enum Command { InsertStock { arg: String }, RemoveStock {...
code_fim
hard
{ "lang": "rust", "repo": "jt-l/stocks", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let api_key = env::var("WORLD_TRADING_DATA_API_KEY").unwrap_or_else(|err| { eprintln!("WORLD_TRADING_DATA_API_KEY is not set: {}", err); process::exit(1); }); Ok(Config { command, api_key }) } } pub fn run(config: Config) -> Result<(), Box<dyn Error>> ...
code_fim
hard
{ "lang": "rust", "repo": "jt-l/stocks", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Config { pub fn new() -> Result<Config, &'static str> { let mut args: Vec<String> = Vec::new(); let matches = App::new("stocks") .version(env!("CARGO_PKG_VERSION")) .author(env!("CARGO_PKG_AUTHORS")) .about(env!("CARGO_PKG_DESCRIPTION")) ...
code_fim
hard
{ "lang": "rust", "repo": "jt-l/stocks", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut tokens: VecDeque<Token> = VecDeque::new(); loop { match lexer.token { TokenType::End => break, TokenType::Error => { println!("Error while parsing! Unidentified token {}", lexer.slice()); break; ...
code_fim
hard
{ "lang": "rust", "repo": "SeppahBaws/rustycom", "path": "/src/rusty_lexer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SeppahBaws/rustycom path: /src/rusty_lexer.rs extern crate logos; use logos::Logos; use std::collections::VecDeque; use crate::token::{ Token, TokenType, }; <|fim_suffix|> let mut tokens: VecDeque<Token> = VecDeque::new(); loop { match lexer.token { ...
code_fim
hard
{ "lang": "rust", "repo": "SeppahBaws/rustycom", "path": "/src/rusty_lexer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-console/gba path: /src/builtin_art/mod.rs //! This module provides some basic art assets. //! <|fim_suffix|>ut you can use it yourself //! too if you find it pleasing. mod cga_8x8_thick; pub use cga_8x8_thick::*;<|fim_middle|>//! It's mostly intended for the crate's examples, b
code_fim
easy
{ "lang": "rust", "repo": "rust-console/gba", "path": "/src/builtin_art/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>easing. mod cga_8x8_thick; pub use cga_8x8_thick::*;<|fim_prefix|>// repo: rust-console/gba path: /src/builtin_art/mod.rs //! This module provides some basic art assets. //! //! It's mostly intended for the crate's examples, b<|fim_middle|>ut you can use it yourself //! too if you find it pl
code_fim
easy
{ "lang": "rust", "repo": "rust-console/gba", "path": "/src/builtin_art/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ut you can use it yourself //! too if you find it pleasing. mod cga_8x8_thick; pub use cga_8x8_thick::*;<|fim_prefix|>// repo: rust-console/gba path: /src/builtin_art/mod.rs //! This module provides some basic art assets. //! <|fim_middle|>//! It's mostly intended for the crate's examples, b
code_fim
easy
{ "lang": "rust", "repo": "rust-console/gba", "path": "/src/builtin_art/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(3.0, rustDouble(1.0, 2.0)); } #[test] fn test_rust_float() { assert_eq!(3.0, rustFloat(1.0, 2.0)); } #[test] fn test_rust_int() { assert_eq!(3, rustInt(1, 2)); } #[test] fn test_rust_long() { assert_eq!(3, rustLong(1, 2)); } #[test] fn test_rust_short() {...
code_fim
hard
{ "lang": "rust", "repo": "sudot/jna-rust-sample", "path": "/rust/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sudot/jna-rust-sample path: /rust/src/lib.rs /// cargo build --release && cp -f target/release/rust.dll ../java/src/main/resources/win32-x86-64/ /// cargo build --release && cp -f target/release/librust.dylib ../java/src/main/resources/darwin/ #[no_mangle] #[allow(non_snake_case)] pub fn rustBoo...
code_fim
hard
{ "lang": "rust", "repo": "sudot/jna-rust-sample", "path": "/rust/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(3, rustByte(1, 2)); } #[test] fn test_rust_char() { assert_eq!('1', rustChar('1', '1')); assert_eq!('2', rustChar('1', '2')); assert_eq!('2', rustChar('2', '1')); } #[test] fn test_rust_double() { assert_eq!(3.0, rustDouble(1.0, 2.0)); } #[test] fn test_rus...
code_fim
hard
{ "lang": "rust", "repo": "sudot/jna-rust-sample", "path": "/rust/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vernonrj/advent2020 path: /day-3/src/main.rs use std::error::Error; use std::io::{Read, BufRead, BufReader}; use std::fs::File; use std::ops::Index; use std::str::FromStr; use clap::{App, Arg}; fn main() -> Result<(), Box<dyn Error>> { let matches = App::new("day-3") .arg(Arg::with...
code_fim
hard
{ "lang": "rust", "repo": "vernonrj/advent2020", "path": "/day-3/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.rows.index(idx) } } impl IntoIterator for Field { type Item = Row; type IntoIter = std::vec::IntoIter<Self::Item>; fn into_iter(self) -> Self::IntoIter { self.rows.into_iter() } } impl<'a> IntoIterator for &'a Field { type Item = &'a Row; type IntoIter =...
code_fim
hard
{ "lang": "rust", "repo": "vernonrj/advent2020", "path": "/day-3/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isabella232/icu-sys path: /src/utrans.rs #![allow(unused_imports)] /* automatically generated by rust-bindgen */ #![allow(dead_code, non_camel_case_types, non_upper_case_globals, non_snake_case)] use libc; use libc::*; use utypes::*; use ustring::*; use utf8::*; use u...
code_fim
hard
{ "lang": "rust", "repo": "isabella232/icu-sys", "path": "/src/utrans.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>} #[link(name = "icuuc", kind = "static")] #[link(name = "icudata", kind = "static")] #[link(name = "icui18n", kind = "static")] #[link(name = "stdc++", kind = "dylib")] extern "C" { pub fn utrans_openU(id: *const UChar, idLength: int32_t, dir: UTransDirection, rules: *const ...
code_fim
hard
{ "lang": "rust", "repo": "isabella232/icu-sys", "path": "/src/utrans.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Initalize an owned signing transcript on a message provided as a byte array pub fn bytes(&self, bytes: &[u8]) -> Transcript { let mut t = self.0.clone(); t.append_message(b"sign-bytes", bytes); t } /// Initalize an owned signing transcript on a message provided...
code_fim
hard
{ "lang": "rust", "repo": "stichtingorganism/schnorr", "path": "/src/tools.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stichtingorganism/schnorr path: /src/tools.rs // Copyright 2019 Stichting Organism // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/...
code_fim
medium
{ "lang": "rust", "repo": "stichtingorganism/schnorr", "path": "/src/tools.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Initalize an owned signing transcript on a message provided as /// a hash function with 512 bit output, usually a gross over kill. pub fn from_hash512<D: FixedOutput<OutputSize = U64>>(&self, h: D) -> Transcript { let mut prehash = [0u8; 64]; prehash.copy_from_slice(h.fixed...
code_fim
hard
{ "lang": "rust", "repo": "stichtingorganism/schnorr", "path": "/src/tools.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GregBowyer/opentelemetry-rs path: /opentelemetry-api/src/metric/mod.rs use std::borrow::Cow; #[macro_use] mod macros; pub mod metric; pub use metric::{Metric, MetricBuilder, TimeSeries}; pub mod meter; pub use meter::Meter; <|fim_suffix|>pub mod gauge; pub use gauge::{Gauge, GaugeDouble, Gau...
code_fim
medium
{ "lang": "rust", "repo": "GregBowyer/opentelemetry-rs", "path": "/opentelemetry-api/src/metric/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// A human-readable description of what this label key represents. pub description: Cow<'a, str>, } pub struct LabelValue<'a> { /// The value for the label. pub value: Cow<'a, str>, /// If false the value field is ignored and considered not set. /// This is used to differentiate...
code_fim
medium
{ "lang": "rust", "repo": "GregBowyer/opentelemetry-rs", "path": "/opentelemetry-api/src/metric/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cryptape/bft-rs path: /src/params.rs use crate::Address; use std::cell::Cell; use std::time::Duration; /// BFT params. #[derive(Clone, Debug)] pub(crate) struct BftParams { /// The local address. pub(crate) address: Address, /// A set of BFT timer settings. pub(crate) timer: Bf...
code_fim
hard
{ "lang": "rust", "repo": "cryptape/bft-rs", "path": "/src/params.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> BftTimer { total_duration: Cell::new(3000), propose: (24, 30), prevote: (1, 30), precommit: (1, 30), } } } impl BftTimer { /// A function to set total interval. pub(crate) fn set_total_duration(&self, duration: u64) { sel...
code_fim
hard
{ "lang": "rust", "repo": "cryptape/bft-rs", "path": "/src/params.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// A function to get precommit wait duration. pub(crate) fn get_precommit(&self) -> Duration { Duration::from_millis(self.total_duration.get() * self.precommit.0 / self.precommit.1) } #[cfg(not(feature = "machine_gun"))] pub(crate) fn get_total_duration(&self) -> Duration { ...
code_fim
hard
{ "lang": "rust", "repo": "cryptape/bft-rs", "path": "/src/params.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> { use crate::generics::point::Point; let two_d = Point { x: 5, y: 8 }; let diff = Point { x: "just a test", y: 12 }; println!("The struct of point:{:?}, {:?}", two_d, diff); println!("Two dimision:{}, {}", two_d.x(), two_d.y()); let fpoint = Point{x: 3.0...
code_fim
hard
{ "lang": "rust", "repo": "kobeHub/Learning-notes", "path": "/RustInfo/projects/generics/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kobeHub/Learning-notes path: /RustInfo/projects/generics/src/main.rs mod generics; fn main() { { use crate::generics::largest; println!("The basic usage of generics:"); let number = vec![12, 33, 56, 88, 0, 2]; let result = largest::largest(&number); ...
code_fim
hard
{ "lang": "rust", "repo": "kobeHub/Learning-notes", "path": "/RustInfo/projects/generics/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let result; let str1 = String::from("A long string"); { let short = "live long enough, it's amazing"; result = largest::str_longest(str1.as_str(), short); } println!("&str lives long enough to a borrow, {}", result); println!("Now tr...
code_fim
medium
{ "lang": "rust", "repo": "kobeHub/Learning-notes", "path": "/RustInfo/projects/generics/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> f.read_to_end(&mut buffer)?; zip.write_all(&*buffer)?; buffer.clear(); } else if name.as_os_str().len() != 0 { // Only if not root! Avoids path spec / warning // and mapname conversion failed error on unzip println!("adding di...
code_fim
hard
{ "lang": "rust", "repo": "mitresthen/pregamejamgamejam2019", "path": "/final.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mitresthen/pregamejamgamejam2019 path: /final.rs // cargo-deps: fs_extra = "1.1.0", walkdir = "2.3.1", zip = "0.5.4" #![allow(warnings)] extern crate fs_extra; extern crate walkdir; extern crate zip; use std::io::prelude::*; use std::io::{Write, Seek}; use std::iter::Iterator; use std::path::Pa...
code_fim
hard
{ "lang": "rust", "repo": "mitresthen/pregamejamgamejam2019", "path": "/final.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Write file or directory explicitly // Some unzip tools unzip files with directory paths correctly, some do not! if path.is_file() { println!("adding file {:?} as {:?} ...", path, name); zip.start_file_from_path(name, options)?; let mut f = Fil...
code_fim
hard
{ "lang": "rust", "repo": "mitresthen/pregamejamgamejam2019", "path": "/final.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[doc(no_inline)] pub use crate::cast::traits::*; #[doc(no_inline)] pub use crate::class::*; #[doc(no_inline)] pub use crate::dir::{Direction, Directional}; #[doc(no_inline)] pub use crate::event::{ConfigCx, Event, EventCx, EventState, IsUsed, Unused, Used}; #[doc(no_inline)] pub use crate::geom::{Coord, ...
code_fim
medium
{ "lang": "rust", "repo": "kas-gui/kas", "path": "/crates/kas-core/src/prelude.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kas-gui/kas path: /crates/kas-core/src/prelude.rs // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License in the LICENSE-APACHE file or at: // https://www.apache.org/license...
code_fim
medium
{ "lang": "rust", "repo": "kas-gui/kas", "path": "/crates/kas-core/src/prelude.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[inline] fn next(&mut self) -> Option<Self::Item> { match self.0 { Ok(_) => None, Err(ref mut g) => match Pin::new(g).resume(()) { GeneratorState::Yielded(y) => Some(y), GeneratorState::Complete(r) => { sel...
code_fim
hard
{ "lang": "rust", "repo": "tinaun/gen-iter", "path": "/src/gen_iter_return.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tinaun/gen-iter path: /src/gen_iter_return.rs use core::ops::{Generator, GeneratorState}; use core::iter::{Iterator, FusedIterator}; use core::marker::Unpin; use core::pin::Pin; /// `GenIterReturn<G>` holds a generator `G` or the return value of `G`, /// `&mut GenIterReturn<G>` acts as an...
code_fim
hard
{ "lang": "rust", "repo": "tinaun/gen-iter", "path": "/src/gen_iter_return.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!((&mut g).next(), None); assert_eq!(g.is_done(), true); assert_eq!((&mut g).next(), None); // it won't panic when call `next()` even exhausted. assert_eq!(g.return_or_self().ok(), Some("done")); } #[test] fn from_generator() { let ...
code_fim
hard
{ "lang": "rust", "repo": "tinaun/gen-iter", "path": "/src/gen_iter_return.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut core = Core::new().unwrap(); let client = atcoder::create_client(&core.handle()).unwrap(); core.run( atcoder::login( &env::var("ATCODER_USERNAME").unwrap(), &env::var("ATCODER_PASSWORD").unwrap(), &client, ).and_then(|(auth, _)| { ...
code_fim
hard
{ "lang": "rust", "repo": "ishitatsuyuki/atcoder-rs", "path": "/tests/api.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ishitatsuyuki/atcoder-rs path: /tests/api.rs extern crate atcoder; extern crate tokio_core; extern crate futures; use std::env; use tokio_core::reactor::Core; use futures::Future; #[test] #[ignore] fn test_login_logout() { <|fim_suffix|>#[test] #[ignore] fn test_submit() { let mut core = C...
code_fim
hard
{ "lang": "rust", "repo": "ishitatsuyuki/atcoder-rs", "path": "/tests/api.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kroosec/aoc2018-rs path: /day2/src/main.rs use std::fs::read_to_string; type Result<T> = ::std::result::Result<T, Box<dyn ::std::error::Error>>; fn part1(input: &str) { let (mut two_total, mut three_total) = (0, 0); for value in input.lines() { let mut occurences = [0; 256]; ...
code_fim
hard
{ "lang": "rust", "repo": "kroosec/aoc2018-rs", "path": "/day2/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for value in input.lines() { for value2 in input.lines() { if count_differences(value, value2) == 1 { let common = common_letters(value, value2); assert_eq!(common, "cvgywxqubnuaefmsljdrpfzyi".to_string()); println!("Part2: {}", commo...
code_fim
hard
{ "lang": "rust", "repo": "kroosec/aoc2018-rs", "path": "/day2/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nalwayv/rust_snake path: /src/main.rs //! RUST SNAKE // IMPORTS use sfml::{graphics::*, system::*, window::*}; use std::collections::HashMap; use std::fs::File; use std::io::{BufRead, BufReader, Result}; // ----------------------------------- // CONSTS // ----------------------------------- co...
code_fim
hard
{ "lang": "rust", "repo": "nalwayv/rust_snake", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// get y screen position fn get_y(&self) -> f32 { self.rect_shape.position().y } fn draw(&mut self, win: &mut RenderWindow) { if !self.is_active { return; } win.draw(&self.rect_shape); } fn update(&mut self, px: f32, py: f32) { ...
code_fim
hard
{ "lang": "rust", "repo": "nalwayv/rust_snake", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_encoder_invalid() { let mut e = Windows949Encoding.encoder(); assert_result!(e.test_feed("\uffff"), (~[], Some(("", ~"\uffff")))); assert_result!(e.test_feed("?\uffff!"), (~[0x3f], Some(("!", ~"\uffff")))); assert_result!(e.test_flush(), (~[], None))...
code_fim
hard
{ "lang": "rust", "repo": "olsonjeffery/rust-encoding", "path": "/src/codec/korean.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: olsonjeffery/rust-encoding path: /src/codec/korean.rs // This is a part of rust-encoding. // Copyright (c) 2013, Kang Seonghoon. // See README.md and LICENSE.txt for details. //! Legacy Korean encodings based on KS X 1001. use std::str; use util::StrCharIndex; use index = index::euc_kr; use ty...
code_fim
hard
{ "lang": "rust", "repo": "olsonjeffery/rust-encoding", "path": "/src/codec/korean.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ivanceras/balisong path: /data/error_examples/test_bitset.rs extern crate balisong; extern crate time; use balisong::bitset; use time::PreciseTime; <|fim_suffix|> let powerof2 = bitset::is_power_of_2(n); println!("is {} power of 2 {}",n, powerof2); println!("it has {} set bits o...
code_fim
medium
{ "lang": "rust", "repo": "ivanceras/balisong", "path": "/data/error_examples/test_bitset.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("it has {} set bits or {}",bitset::fast_count(n), bitset::count(n)); }<|fim_prefix|>// repo: ivanceras/balisong path: /data/error_examples/test_bitset.rs extern crate balisong; extern crate time; use balisong::bitset; use time::PreciseTime; fn main(){ let n = 12345790; let bits = bi...
code_fim
medium
{ "lang": "rust", "repo": "ivanceras/balisong", "path": "/data/error_examples/test_bitset.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test() { let grid = [ "..##.......", "#...#...#..", ".#....#..#.", "..#.#...#.#", ".#...##..#.", "..#.##.....", ".#.#.#....#", ".#........#", "#.##...#...", "#...##....#", ".#..#...#.#", ]; asse...
code_fim
hard
{ "lang": "rust", "repo": "p2mate/aoc2020", "path": "/day3/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let grid = [ "..##.......", "#...#...#..", ".#....#..#.", "..#.#...#.#", ".#...##..#.", "..#.##.....", ".#.#.#....#", ".#........#", "#.##...#...", "#...##....#", ".#..#...#.#", ]; assert_eq!(find_slopes(&g...
code_fim
medium
{ "lang": "rust", "repo": "p2mate/aoc2020", "path": "/day3/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: p2mate/aoc2020 path: /day3/src/main.rs use std::io; use std::io::Read; fn find_slopes(grid: &[&str], x_inc: usize, y_inc: usize) -> usize { let mut posx = 0; let mut posy = 0; let mut trees = 0; while posy < grid.len() { if grid[posy].chars().nth(posx).unwrap() == '#' { ...
code_fim
hard
{ "lang": "rust", "repo": "p2mate/aoc2020", "path": "/day3/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Bitcoin-ABC/bitcoin-abc path: /chronik/chronik-indexer/src/pause.rs // Copyright (c) 2023 The Bitcoin developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. //! Module for [`Pause`] and [`PauseNotify`...
code_fim
hard
{ "lang": "rust", "repo": "Bitcoin-ABC/bitcoin-abc", "path": "/chronik/chronik-indexer/src/pause.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Handle to pause/resume indexing any updates from the node. /// This will fill up the validation interface queue, so use with caution. #[derive(Debug)] pub struct PauseNotify { pause_send: watch::Sender<PauseMsg>, is_pause_allowed: bool, } /// Enum to pause/resume Chronik indexing. #[derive(Cl...
code_fim
hard
{ "lang": "rust", "repo": "Bitcoin-ABC/bitcoin-abc", "path": "/chronik/chronik-indexer/src/pause.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn into_wrap_items(self: Box<Self>, wrap_items: &mut Vec<Box<dyn Content>>) { wrap_items.extend(self.items); // `items` are already subdivided } }<|fim_prefix|>// repo: lalrpop/lalrpop path: /lalrpop/src/message/wrap.rs use super::*; use ascii_canvas::AsciiView; use std::cmp; #[derive(De...
code_fim
hard
{ "lang": "rust", "repo": "lalrpop/lalrpop", "path": "/lalrpop/src/message/wrap.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (c_row, c_column) = item.emit_at(view, row, column); assert!(c_column >= column); column = c_column + 2; height = cmp::max(c_row - row + 1, height); } } fn into_wrap_items(self: Box<Self>, wrap_items: &mut Vec<Box<dyn Content>>) { ...
code_fim
hard
{ "lang": "rust", "repo": "lalrpop/lalrpop", "path": "/lalrpop/src/message/wrap.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lalrpop/lalrpop path: /lalrpop/src/message/wrap.rs use super::*; use ascii_canvas::AsciiView; use std::cmp; #[derive(Debug)] pub struct Wrap { items: Vec<Box<dyn Content>>, } impl Wrap { pub fn new(items: Vec<Box<dyn Content>>) -> Self { let mut wrap_items = vec![]; for...
code_fim
hard
{ "lang": "rust", "repo": "lalrpop/lalrpop", "path": "/lalrpop/src/message/wrap.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: theIDinside/cxg path: /src/debuginfo/process_info.rs use std::io::Read; #[derive(Debug)] pub struct ProcessInfo { // name pub name: String, // process id pub pid: usize, // virtual memory usage, peak pub virtual_mem_usage_peak: usize, // virtual memory usage pub ...
code_fim
hard
{ "lang": "rust", "repo": "theIDinside/cxg", "path": "/src/debuginfo/process_info.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(target_os = "windows")] pub fn new() -> std::io::Result<ProcessInfo> { println!("This is not yet implemented for windows. Will just show 0's"); Ok(ProcessInfo { name: 0, pid: 0, virtual_mem_usage_peak: 0, virtual_mem_usage: 0, rss: 0, shared_lib_code: 0 }) } }<|fim_prefix...
code_fim
hard
{ "lang": "rust", "repo": "theIDinside/cxg", "path": "/src/debuginfo/process_info.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maxmindlin/rabbitui path: /src/models.rs use crate::{client::Ackmode, Rowable}; use std::collections::HashMap; use serde::{Deserialize, Serialize}; trait ToRate { fn to_rate(&self) -> String; } impl ToRate for String { fn to_rate(&self) -> String { format!("{}/s", self) }...
code_fim
hard
{ "lang": "rust", "repo": "maxmindlin/rabbitui", "path": "/src/models.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Deserialize, Debug)] pub struct Overview { pub queue_totals: OverviewQueueTotals, pub message_stats: OverviewMessageRates, } #[derive(Deserialize, Debug)] pub struct OverviewQueueTotals { pub messages: f64, pub messages_ready: f64, #[serde(alias = "messages_unacknowledged")] ...
code_fim
hard
{ "lang": "rust", "repo": "maxmindlin/rabbitui", "path": "/src/models.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kezenator/adventofcode path: /2020/src/y2021/d11/mod.rs use crate::support::*; use std::collections::{ HashSet, VecDeque }; const EXAMPLE: &str = include_str!("example.txt"); const INPUT: &str = include_str!("input.txt"); struct OctoGrid { cells: CharGrid, num_flashes: usize, ...
code_fim
hard
{ "lang": "rust", "repo": "kezenator/adventofcode", "path": "/2020/src/y2021/d11/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> grid.get_num_flashes() } fn part_2(input: &str) -> usize { let mut grid = OctoGrid::new(input); let size = grid.get_num_octos(); let mut steps = 0; loop { steps += 1; if grid.step() == size { return steps; } } ...
code_fim
hard
{ "lang": "rust", "repo": "kezenator/adventofcode", "path": "/2020/src/y2021/d11/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> where Self: Sized, { let vec = self.to_vec_with_trailing_bit_len(); <Vec<u8> as ToSql>::to_sql(&vec, ty, out) } fn accepts(ty: &Type) -> bool where Self: Sized, { <Vec<u8> as ToSql>::accepts(ty) } fn to_sql_checked( &self, ...
code_fim
hard
{ "lang": "rust", "repo": "kellerkindt/asn1rs", "path": "/src/io/psql_shared/bit_vec_impl.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kellerkindt/asn1rs path: /src/io/psql_shared/bit_vec_impl.rs use crate::syn::bitstring::BitVec; use bytes::BytesMut; use std::error::Error; #[cfg(feature = "psql")] use postgres::types::{FromSql, IsNull, ToSql, Type}; #[cfg(all(feature = "async-psql", not(feature = "psql")))] use tokio_postgre...
code_fim
hard
{ "lang": "rust", "repo": "kellerkindt/asn1rs", "path": "/src/io/psql_shared/bit_vec_impl.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub const SERVER_GCC_CORE_BLOCK_BUFFER: [u8; gcc_block_size(SERVER_CORE_DATA_TO_REQUESTED_PROTOCOL_BUFFER)] = make_gcc_block_buffer( ServerGccType::CoreData as u16, &SERVER_CORE_DATA_TO_REQUESTED_PROTOCOL_BUFFER, ); pub const SERVER_GCC_NETWORK_BLOCK_BUFFER: [u8; gcc_block_size(SE...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/IronRDP", "path": "/crates/ironrdp-testsuite-core/src/gcc.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub const SERVER_GCC_WITHOUT_OPTIONAL_FIELDS_BUFFER: [u8; concat_arrays_size!( SERVER_GCC_CORE_BLOCK_BUFFER, SERVER_GCC_NETWORK_BLOCK_BUFFER, SERVER_GCC_SECURITY_BLOCK_BUFFER )] = concat_arrays!( SERVER_GCC_CORE_BLOCK_BUFFER, SERVER_GCC_NETWORK_BLOCK_BUFFER, SERVER_GCC_SECURITY_BLO...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/IronRDP", "path": "/crates/ironrdp-testsuite-core/src/gcc.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Devolutions/IronRDP path: /crates/ironrdp-testsuite-core/src/gcc.rs use ironrdp_pdu::gcc::*; use crate::cluster_data::{CLUSTER_DATA, CLUSTER_DATA_BUFFER}; use crate::core_data::{ CLIENT_OPTIONAL_CORE_DATA_TO_SERVER_SELECTED_PROTOCOL, CLIENT_OPTIONAL_CORE_DATA_TO_SERVER_SELECTED_PROTOCOL...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/IronRDP", "path": "/crates/ironrdp-testsuite-core/src/gcc.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut msg = Vec::new(); msg.push(1); let mut bs = [0u8; mem::size_of::<i32>()]; match bs.as_mut().write_i32::<LittleEndian>(x) { _ => (), }; msg.append(&mut bs.to_vec()); match bs.as_mut().write_i32::<LittleEndian>(y) { _ =>...
code_fim
hard
{ "lang": "rust", "repo": "pluxtore/maze-server", "path": "/maze_gameserver/src/gamelogic/packets.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pluxtore/maze-server path: /maze_gameserver/src/gamelogic/packets.rs e super::*; use super::map::{LocationType,Flag}; use super::types::*; use byteorder::{LittleEndian, WriteBytesExt}; use std::convert::TryInto; use super::score::Score; /* ######## packet types ######## */ #[derive(Clone)] pub...
code_fim
hard
{ "lang": "rust", "repo": "pluxtore/maze-server", "path": "/maze_gameserver/src/gamelogic/packets.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }