text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: sumeet/aoc2020 path: /day19_rs/src/main.rs Arc::clone(&all_rules), Arc::clone(&inner_rule), string_to_match.substr(..), ) }) .filter_map(|result| match result { MatchResult::R...
code_fim
hard
{ "lang": "rust", "repo": "sumeet/aoc2020", "path": "/day19_rs/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[inline] pub fn parse_identifier(input: &[u8], c_src: &mut usize) -> Token { let mut it = 0; for i in 0..input.len() - *c_src { if !unsafe { is_identifier_part(*input.get_unchecked(*c_src + i)) } { it = i; break; } } let ident = &input[*c_src - 1..*...
code_fim
hard
{ "lang": "rust", "repo": "perdumonocle/c-lexer-stable", "path": "/src/identifier.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> should!( parsing_after_token, "*=a ", vec![ Token::MulAssign, Token::Identifier(IStr::new("a")), Token::EOF ] ); should!( parsing_after_token_2, "a( a1 ", vec![ Token::Identifier(IStr::new(...
code_fim
hard
{ "lang": "rust", "repo": "perdumonocle/c-lexer-stable", "path": "/src/identifier.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: perdumonocle/c-lexer-stable path: /src/identifier.rs use crate::token::Token; use internship::IStr; use std::str; const KEYWORDS: phf::Map<&'static str, Token> = phf_map! { "auto" => Token::AUTO, "break" => Token::BREAK, "case" => Token::CASE, "char" => Token::CHAR, "const" ...
code_fim
hard
{ "lang": "rust", "repo": "perdumonocle/c-lexer-stable", "path": "/src/identifier.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: carterisonline/tide-webserver path: /src/main.rs use tide::{http::mime, Request, Response, Result, StatusCode}; use tide_rustls::TlsListener; use colored::Colorize; use preloader::{ADDR, INDEX, WORKDIR, SSL}; mod preloader; mod compiler; mod console; async fn index(req: Request<()>) -> Result<...
code_fim
medium
{ "lang": "rust", "repo": "carterisonline/tide-webserver", "path": "/src/main.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Response::builder(StatusCode::Ok) .body(INDEX.as_str()) .content_type(mime::HTML) .build()) } #[async_std::main] async fn main() -> Result<()> { console::spawn(); let mut app = tide::new(); app.at("/").get(index); if *SSL { app.listen( ...
code_fim
hard
{ "lang": "rust", "repo": "carterisonline/tide-webserver", "path": "/src/main.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> println!("Do you {} your {} {} {}? That's hilarious!", verb.trim_end(), adjective.trim_end(), noun.trim_end(),adverb.trim_end()); }<|fim_prefix|>// repo: chadbrewbaker/57exercises path: /rust/examples/four.rs //Four.rs // fn main() { println!("Enter a noun:"); l...
code_fim
hard
{ "lang": "rust", "repo": "chadbrewbaker/57exercises", "path": "/rust/examples/four.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chadbrewbaker/57exercises path: /rust/examples/four.rs //Four.rs // fn main() { println!("Enter a noun:"); let mut noun = String::new(); <|fim_suffix|> println!("Enter a verb:"); let mut verb = String::new(); std::io::stdin().read_line(&mut verb) .expect("Failed to r...
code_fim
medium
{ "lang": "rust", "repo": "chadbrewbaker/57exercises", "path": "/rust/examples/four.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brochington/halcyon path: /src/internal_actions/mod.rs use crate::internal_state::InternalState; #[derive(Debug)] pub enum InternalActions { Stop, CursorMoved {x: f64, y: f64}, ResizeWindow { width: f64, height: f64} } fn stop(state: &InternalState) -> InternalState { let mut new_state...
code_fim
hard
{ "lang": "rust", "repo": "brochington/halcyon", "path": "/src/internal_actions/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> new_state.width = new_width; new_state.height = new_height; new_state } // Not used yet fn cursor_moved(state: &InternalState, _x: f64, _y: f64) -> InternalState{ state.clone() } pub fn root_reducer(state: &InternalState, action: InternalActions) -> InternalState { match action { Internal...
code_fim
medium
{ "lang": "rust", "repo": "brochington/halcyon", "path": "/src/internal_actions/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// Not used yet fn cursor_moved(state: &InternalState, _x: f64, _y: f64) -> InternalState{ state.clone() } pub fn root_reducer(state: &InternalState, action: InternalActions) -> InternalState { match action { InternalActions::Stop => stop(&state), InternalActions::CursorMoved{ x, y } => curso...
code_fim
medium
{ "lang": "rust", "repo": "brochington/halcyon", "path": "/src/internal_actions/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub const FA001_MULTIBOT_NBT: &'static [u8] = &[ 0x14, 0x11, 0xB5, 0x26, 0xFE, 0x14, 0x11, 0xFE, 0xB5, 0x25, 0xFE, 0xFE, 0x14, 0x11, 0xFE, 0xFE, 0xB5, 0x24, 0xFE, 0xFE, 0xFE, 0x14, 0x11, 0xFE, 0xFE, 0xFE, 0xB5, 0x23, 0xFE, 0xFE, 0xFE, 0xFE, 0x14, 0x11, 0xFE, 0xFE, 0xFE, 0xFE, 0xB5, 0x22, 0xFE,...
code_fim
hard
{ "lang": "rust", "repo": "turtle-bazon/icfpc-2018", "path": "/rust/icfpc2018_lib/src/junk.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: turtle-bazon/icfpc-2018 path: /rust/icfpc2018_lib/src/junk.rs 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x70, 0x00, 0x80, 0x0F, 0x00, 0xFC, 0x01, 0xE0, 0x3F, 0x00, 0xFF, 0x07, 0xF8, 0xFF, 0x00, 0xFF, 0x07, 0xE0, 0x3F, 0x00, 0xFC, 0x01, 0x80, 0x0F, 0x00, 0x7...
code_fim
hard
{ "lang": "rust", "repo": "turtle-bazon/icfpc-2018", "path": "/rust/icfpc2018_lib/src/junk.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: standardgalactic/millet path: /crates/ls/src/main.rs //! A language server for Standard ML. mod comm; mod headers; mod io; mod state; fn main() { let (s_inc, r_inc) = crossbeam_channel::unbounded(); let (s_out, r_out) = crossbeam_channel::unbounded(); let read_stdin = std::thread::Builde...
code_fim
hard
{ "lang": "rust", "repo": "standardgalactic/millet", "path": "/crates/ls/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>action { state::Action::Exit(x) => break x, state::Action::Respond(x) => s_out.send(*x).unwrap(), }, }, } }; drop(r_inc); drop(s_out); read_stdin.join().unwrap(); write_stdout.join().unwrap(); if !exit_ok { std::process::exit(1); } }<|fim_prefix|>// ...
code_fim
hard
{ "lang": "rust", "repo": "standardgalactic/millet", "path": "/crates/ls/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mateusfg7/rust-lang-study path: /rust-programmin-tutorial/38/http-get/src/main.rs #[tokio::main] async fn main() -> Result<(), Box<dyn<|fim_suffix|> .await?; println!("{}", resp); Ok(()) }<|fim_middle|> std::error::Error>> { let resp = reqwest::get("http://0.0.0.0:4507/") ...
code_fim
medium
{ "lang": "rust", "repo": "mateusfg7/rust-lang-study", "path": "/rust-programmin-tutorial/38/http-get/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> .await?; println!("{}", resp); Ok(()) }<|fim_prefix|>// repo: mateusfg7/rust-lang-study path: /rust-programmin-tutorial/38/http-get/src/main.rs #[tokio::main] async fn main() -> Result<(), Box<dyn<|fim_middle|> std::error::Error>> { let resp = reqwest::get("http://0.0.0.0:4507/") ...
code_fim
medium
{ "lang": "rust", "repo": "mateusfg7/rust-lang-study", "path": "/rust-programmin-tutorial/38/http-get/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod cli; mod futures; mod midi; mod sample; mod ui; mod wav; mod workspace; fn main() -> Result<()> { if env::args().len() <= 1 { ui::main(); Ok(()) } else { cli::main() } }<|fim_prefix|>// repo: typon/smplinfo path: /src/main.rs #![allow(dead_code)] #![windows_subsys...
code_fim
easy
{ "lang": "rust", "repo": "typon/smplinfo", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: typon/smplinfo path: /src/main.rs #![allow(dead_code)] #![windows_subsystem = "windows"] use std::env; use anyhow::Result; <|fim_suffix|>fn main() -> Result<()> { if env::args().len() <= 1 { ui::main(); Ok(()) } else { cli::main() } }<|fim_middle|>mod cli; ...
code_fim
medium
{ "lang": "rust", "repo": "typon/smplinfo", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: typon/smplinfo path: /src/main.rs #![allow(dead_code)] #![windows_subsystem = "windows"] <|fim_suffix|>use anyhow::Result; mod cli; mod futures; mod midi; mod sample; mod ui; mod wav; mod workspace; fn main() -> Result<()> { if env::args().len() <= 1 { ui::main(); Ok(()) ...
code_fim
easy
{ "lang": "rust", "repo": "typon/smplinfo", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let dest_buf1 = build_destination_buffer(); let vadd = pro_que.kernel_builder("vadd") .arg(&a_buf) .arg(&b_buf) .arg(&dest_buf0) .build().expect("Failed to compile OpenCL kernel"); unsafe { vadd.enq().expect("Failed to execute OpenCL kernel"); } ...
code_fim
hard
{ "lang": "rust", "repo": "GabrielMajeri/ocl-exercises-rs", "path": "/src/ex4.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GabrielMajeri/ocl-exercises-rs path: /src/ex4.rs //! # Exercise 2 //! //! Run a simple kernel which adds two vector, and stores the result in a third one. //! //! # Exercise 4 //! //! Same as exercise 2, but using multiple vectors. //! //! This solves both exercise 2 and exercise 4. use ocl::{P...
code_fim
hard
{ "lang": "rust", "repo": "GabrielMajeri/ocl-exercises-rs", "path": "/src/ex4.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> let board = Board::decode(board).unwrap(); b.iter(|| solve(&board.clone()).expect("solve failed")) } c.bench_function("board 0", |b| { bench_solve(b, ";;;;;;;b1b2r9g9g2;rDrDg7b8g3;r5g6ffb3rD;b9g5r2b7b4;r1g1r3gDrD;r8r7g4bDbD;b6gDgDbDb5;g8bDgDr6r4"); }); ...
code_fim
medium
{ "lang": "rust", "repo": "dten/shzhrs", "path": "/benches/criterion_benchmark.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dten/shzhrs path: /benches/criterion_benchmark.rs #[macro_use] extern crate criterion; extern crate shzhrs; use criterion::{Bencher, Criterion}; use shzhrs::*; <|fim_suffix|> fn bench_solve(b: &mut Bencher, board: &str) { let board = Board::decode(board).unwrap(); b.iter(|| ...
code_fim
medium
{ "lang": "rust", "repo": "dten/shzhrs", "path": "/benches/criterion_benchmark.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let bytes = vec![0x40u8, 0x00]; let i = vint(&bytes).unwrap().1; assert_eq!(i, 0u64); let bytes = vec![0x40u8, 0x00]; let i = vint(&bytes).unwrap().1; assert_eq!(i, 0u64); let bytes = vec![0x4fu8, 0x88]; let i = vint(&bytes).unwrap().1; ...
code_fim
hard
{ "lang": "rust", "repo": "p47t/rust-52-projects", "path": "/ebml/src/ebml.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: p47t/rust-52-projects path: /ebml/src/ebml.rs #![macro_use] use nom::{IResult, Needed}; pub fn vint(input: &[u8]) -> IResult<&[u8], u64> { if input.is_empty() { return Err(nom::Err::Incomplete(Needed::Size(1))); } let v = input[0]; let lz = v.leading_zeros(); if lz...
code_fim
hard
{ "lang": "rust", "repo": "p47t/rust-52-projects", "path": "/ebml/src/ebml.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let bytes = vec![0x0u8]; let i = vint(&bytes); assert!(i.is_err()); let bytes = vec![0x40u8]; let i = vint(&bytes); assert!(i.is_err()); let bytes = vec![0x80u8]; let i = vint(&bytes).unwrap().1; assert_eq!(i, 0u64); let by...
code_fim
hard
{ "lang": "rust", "repo": "p47t/rust-52-projects", "path": "/ebml/src/ebml.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: guyoung/CaptfEncoder path: /CaptfEncoder-V3/misc/src/image/internal/mod.rs pub extern crate image; pub extern crate num_complex; pub e<|fim_suffix|> pub extern crate base64; pub extern crate rustc_serialize;<|fim_middle|>xtern crate gif; pub extern crate qrcode; pub extern crate bardecoder...
code_fim
medium
{ "lang": "rust", "repo": "guyoung/CaptfEncoder", "path": "/CaptfEncoder-V3/misc/src/image/internal/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub extern crate base64; pub extern crate rustc_serialize;<|fim_prefix|>// repo: guyoung/CaptfEncoder path: /CaptfEncoder-V3/misc/src/image/internal/mod.rs pub extern crate image; pub extern crate num_complex; pub extern crate gif; pub extern crate qrcode; pub extern crate <|fim_middle|>bardecoder...
code_fim
medium
{ "lang": "rust", "repo": "guyoung/CaptfEncoder", "path": "/CaptfEncoder-V3/misc/src/image/internal/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: neildanson/bob_ross_game path: /src/engine/vertex.rs #[derive(Copy, Clone)] pub struct Vertex { <|fim_suffix|> [f32; 2], } //TODO Implement in renderer implement_vertex!(Vertex, position, tex_coord);<|fim_middle|> pub position: [i32; 2], pub tex_coord:
code_fim
easy
{ "lang": "rust", "repo": "neildanson/bob_ross_game", "path": "/src/engine/vertex.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>plement_vertex!(Vertex, position, tex_coord);<|fim_prefix|>// repo: neildanson/bob_ross_game path: /src/engine/vertex.rs #[derive(Copy, Clone)] pub struct Vertex { <|fim_middle|> pub position: [i32; 2], pub tex_coord: [f32; 2], } //TODO Implement in renderer im
code_fim
medium
{ "lang": "rust", "repo": "neildanson/bob_ross_game", "path": "/src/engine/vertex.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `EPINT4` reader - Pipe 4 Interrupt"] pub struct EPINT4_R(crate::FieldReader<bool, bool>); impl EPINT4_R { #[inline(always)] pub(crate) fn new(bits: bool) -> Self { EPINT4_R(crate::FieldReader::new(bits)) } } impl core::ops::Deref for EPINT4_R { ...
code_fim
hard
{ "lang": "rust", "repo": "atsamd-rs/atsamd", "path": "/pac/atsamd21j/src/usb/host/pintsmry.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: atsamd-rs/atsamd path: /pac/atsamd21j/src/usb/host/pintsmry.rs #[doc = "Register `PINTSMRY` reader"] pub struct R(crate::R<PINTSMRY_SPEC>); impl core::ops::Deref for R { type Target = crate::R<PINTSMRY_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } ...
code_fim
hard
{ "lang": "rust", "repo": "atsamd-rs/atsamd", "path": "/pac/atsamd21j/src/usb/host/pintsmry.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn is_installed(&self) -> Fallible<bool>; fn install(&self) -> Fallible<()>; fn update(&self) -> Fallible<()>; } pub(crate) fn install() -> Fallible<()> { for tool in INSTALLABLE_TOOLS { if tool.is_installed()? { info!("tool {} is installed, trying to update it", tool....
code_fim
medium
{ "lang": "rust", "repo": "gbuglione/crater", "path": "/src/tools/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gbuglione/crater path: /src/tools/mod.rs mod binary_crates; mod rustup; use crate::dirs::CARGO_HOME; use crate::prelude::*; use crate::toolchain::MAIN_TOOLCHAIN; use crate::tools::binary_crates::BinaryCrate; use crate::tools::rustup::{Cargo, Rustup}; use std::env::consts::EXE_SUFFIX; use std::p...
code_fim
hard
{ "lang": "rust", "repo": "gbuglione/crater", "path": "/src/tools/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kellerkindt/asn1rs path: /asn1rs-model/src/model/sql/mod.rs pe::BigInt => "BIGINT".into(), SqlType::Serial => "SERIAL".into(), SqlType::Boolean => "BOOLEAN".into(), SqlType::Text => "TEXT".into(), SqlType::Array(inner) => format!("{}[]", inner.to_s...
code_fim
hard
{ "lang": "rust", "repo": "kellerkindt/asn1rs", "path": "/asn1rs-model/src/model/sql/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kellerkindt/asn1rs path: /asn1rs-model/src/model/sql/mod.rs m(Vec<String>), Index(String, Vec<String>), /// Table being affected to -> AbandonChildrenFunction(String, Vec<(String, String, String)>), SilentlyPreventAnyDelete(String), } impl Target for Sql { type DefinitionTyp...
code_fim
hard
{ "lang": "rust", "repo": "kellerkindt/asn1rs", "path": "/asn1rs-model/src/model/sql/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(clippy::module_name_repetitions)] pub trait ToSql { fn to_sql(&self) -> SqlType; } impl ToSql for RustType { fn to_sql(&self) -> SqlType { SqlType::NotNull(Box::new(match self { RustType::Bool => SqlType::Boolean, RustType::Null => return SqlType::NullByteA...
code_fim
hard
{ "lang": "rust", "repo": "kellerkindt/asn1rs", "path": "/asn1rs-model/src/model/sql/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wasanx25/sosaiaty path: /src/cards/magic.rs use cards::card::Card; pub struct Magic { pub name: String, pub spell: MagicSpell, pub effect: String, } <|fim_suffix|> return self.name.to_owned(); } fn get_effect(&self) -> String { return self.effect.to_owned(); ...
code_fim
hard
{ "lang": "rust", "repo": "wasanx25/sosaiaty", "path": "/src/cards/magic.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Card for Magic { fn get_name(&self) -> String { return self.name.to_owned(); } fn get_effect(&self) -> String { return self.effect.to_owned(); } }<|fim_prefix|>// repo: wasanx25/sosaiaty path: /src/cards/magic.rs use cards::card::Card; pub struct Magic { pub name...
code_fim
hard
{ "lang": "rust", "repo": "wasanx25/sosaiaty", "path": "/src/cards/magic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn chars() { let c = 'z'; println!("{}", c); let z = 'ℤ'; println!("{}", z); let heart_eyed_cat = '😻'; println!("{}", heart_eyed_cat); } fn compound() { let tup: (i32, f64, u8) = (500, 6.4, 1); // indices let five_hundred = tup.0; let six_point_four = tup.1; ...
code_fim
hard
{ "lang": "rust", "repo": "Thewessen/hello-world", "path": "/Rust/data_types/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn compound() { let tup: (i32, f64, u8) = (500, 6.4, 1); // indices let five_hundred = tup.0; let six_point_four = tup.1; let one = tup.2; println!("Tupple is: ({}, {}, {})", five_hundred, six_point_four, one); let array: [i32; 3] = [1, 2, 3]; let one = array[0]; let ...
code_fim
hard
{ "lang": "rust", "repo": "Thewessen/hello-world", "path": "/Rust/data_types/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Thewessen/hello-world path: /Rust/data_types/src/main.rs #![allow(unused_variables)] fn integers() { // note the different ways of writing numbers let x: u32 = 5; // 32-bit unsigned integer (default) let x: u64 = 0xffffff; // 64-bit unsigned integer let x: i64 = -198_000; /...
code_fim
medium
{ "lang": "rust", "repo": "Thewessen/hello-world", "path": "/Rust/data_types/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn parse_included_file(input: Span) -> IResult<Span, IncludedProgram> { map( all_consuming(many0(alt(( map(parse_extern, Preamble::Extern), map(parse_fn_definition, Preamble::Definition), )))), |preambles| { let (externs, preambles) = pre...
code_fim
hard
{ "lang": "rust", "repo": "AngelOfSol/weiss-schwarz-dsl", "path": "/rules/src/parsing.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AngelOfSol/weiss-schwarz-dsl path: /rules/src/parsing.rs IResult<Span, Sexpr> { map( consumed(delimited( lexing::open, cut(many1(parse_sexpr_value)), lexing::close, )), |(span, arguments)| Sexpr::Eval { arguments, span }, )(inp...
code_fim
hard
{ "lang": "rust", "repo": "AngelOfSol/weiss-schwarz-dsl", "path": "/rules/src/parsing.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AngelOfSol/weiss-schwarz-dsl path: /rules/src/parsing.rs parated_list0}, sequence::{delimited, pair, preceded, tuple}, IResult as NomResult, }; use nom_locate::LocatedSpan; use crate::{ executor::semantic_analysis::hm::types::TypeVariable, model::ZoneId, parsing::input_type::Input, ...
code_fim
hard
{ "lang": "rust", "repo": "AngelOfSol/weiss-schwarz-dsl", "path": "/rules/src/parsing.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alexander89/awesome-home path: /src/launchpad/src/twins/drone_twin/mod.rs } fn id(&self) -> String { self.id.clone() } fn query(&self) -> actyx_sdk::language::Query { format!("FROM 'drone:{}'", self.id) .parse() .expect("DroneTwin: AQL query ...
code_fim
hard
{ "lang": "rust", "repo": "Alexander89/awesome-home", "path": "/src/launchpad/src/twins/drone_twin/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> states::DroneTwinState::Launched(s) } states::DroneTwinState::Used(s) => { states::DroneTwinState::Launched(states::LaunchedState { id: e.id, ip: s.ip, ssid: s.ssid, batt...
code_fim
hard
{ "lang": "rust", "repo": "Alexander89/awesome-home", "path": "/src/launchpad/src/twins/drone_twin/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(dead_code)] pub async fn emit_drone_connected( service: impl EventService, id: String, ) -> Result<PublishResponse, anyhow::Error> { service .publish(mk_publish_request( tag_drone_id(&id), &ev::DroneEvent::DroneConnect...
code_fim
hard
{ "lang": "rust", "repo": "Alexander89/awesome-home", "path": "/src/launchpad/src/twins/drone_twin/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matter-labs/eip1962 path: /src/public_interface/sane_limits.rs pub const MAX_BLS12_X_BIT_LENGTH: usize = 128; pub const MAX_BN_U_BIT_LENGTH: usize = 128; pub const MAX_BLS12_X_HAMMING: u32 = 128u32; pub const MAX_BN_SIX_U_PLUS_TWO_HAMMING: u32 = 128u32; pub const MAX_ATE_PAIRING_ATE_LOOP_COUNT...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/eip1962", "path": "/src/public_interface/sane_limits.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub const MAX_ATE_PAIRING_FINAL_EXP_W0_BIT_LENGTH: usize = 2032; pub const MAX_ATE_PAIRING_FINAL_EXP_W1_BIT_LENGTH: usize = 2032; pub const MAX_LOOP_PARAMETERS_BYTE_LEN: usize = MAX_ATE_PAIRING_FINAL_EXP_W0_BIT_LENGTH / 8; use static_assertions::const_assert; use crate::integers::*; const_assert!(std::...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/eip1962", "path": "/src/public_interface/sane_limits.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn fid(&self) -> &str { "24592" } fn fid_org(&self) -> &str { "USAA" } fn broker_id(&self) -> &str { "USAA.COM" } });<|fim_prefix|>// repo: jackpot51/puccinia path: /src/bank/usaa_inv.rs use bank_ofx; bank_ofx!("usaa_inv", UsaaInv, { fn url(&self) ->...
code_fim
easy
{ "lang": "rust", "repo": "jackpot51/puccinia", "path": "/src/bank/usaa_inv.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jackpot51/puccinia path: /src/bank/usaa_inv.rs use bank_ofx; bank_ofx!("usaa_inv", UsaaInv, { fn url(&self) -> &str { "https://service2.usaa.com/ofx/OFXServlet" } fn fid(&self) -> &str { "24592" } <|fim_suffix|> fn broker_id(&self) -> &str { "USAA.CO...
code_fim
easy
{ "lang": "rust", "repo": "jackpot51/puccinia", "path": "/src/bank/usaa_inv.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl BuildDependency { pub fn get_root_dir(&self) -> Option<&str> { Some(self.rootpath.as_str()) } pub fn get_library_dir(&self) -> Option<&str> { self.lib_paths.get(0).map(|x| &**x) } pub fn get_include_dir(&self) -> Option<&str> { self.include_paths.get(0).m...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/conan-rs", "path": "/src/build_info/build_dependency.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Devolutions/conan-rs path: /src/build_info/build_dependency.rs extern crate serde; extern crate serde_json; use serde::de::{SeqAccess, Visitor}; use serde::{Deserialize, Deserializer, Serialize}; use std::fmt; fn deserialize_optional_string_or_string_vec<'de, D>(deserializer: D) -> Result<Opti...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/conan-rs", "path": "/src/build_info/build_dependency.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(token) = self.const_token() { tokens.push(formatter.format_token(&token)); } else if let Some(token) = self.let_token() { tokens.push(formatter.format_token(&token)); } else if let Some(token) = self.var_token() { tokens.push(formatter.format_token(&token)); } else { // TOD...
code_fim
medium
{ "lang": "rust", "repo": "xiaohanxu-nick/tools", "path": "/crates/formatter/src/ts/declarators/var_decl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xiaohanxu-nick/tools path: /crates/formatter/src/ts/declarators/var_decl.rs use crate::{concat_elements, space_token, token, FormatElement, Formatter, ToFormatElement}; use rslint_parser::ast::VarDecl; impl ToFormatElement for VarDecl { fn to_format_element(&self, formatter: &Formatter) -> For...
code_fim
hard
{ "lang": "rust", "repo": "xiaohanxu-nick/tools", "path": "/crates/formatter/src/ts/declarators/var_decl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alienzj/fastqc-rs path: /src/process.rs use chrono::{DateTime, Local}; use itertools::Itertools; use needletail::{parse_fastx_file, Sequence}; use plotters::prelude::*; use serde_json::json; use serde_json::Value; use std::collections::HashMap; use std::error::Error; use std::ffi::OsStr; use std...
code_fim
hard
{ "lang": "rust", "repo": "alienzj/fastqc-rs", "path": "/src/process.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let file = Path::new(&filename).file_name().unwrap().to_str().unwrap(); let meta = json!({ "file name": {"name": "file name", "value": file}, "canonical": {"name": "canonical", "value": "True"}, "k": {"name": "k", "value": k}, "total reads": {"name": "total reads", ...
code_fim
hard
{ "lang": "rust", "repo": "alienzj/fastqc-rs", "path": "/src/process.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut overly_represented = Vec::new(); let mut overly_represented_warn = "pass"; let total_kmers = kmers.iter().map(|(_, count)| count).sum::<u64>(); for (km, occ) in kmers .iter() .sorted_by(|(_, a), (_, b)| Ord::cmp(&b, &a)) .take(5) { let percentage...
code_fim
hard
{ "lang": "rust", "repo": "alienzj/fastqc-rs", "path": "/src/process.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("Slices: {:?} - {:?}", sla, slb); }<|fim_prefix|>// repo: dougtq/rust-lang path: /slices-strs/src/main.rs fn main() { let a = vec![555, 3 , 278, 774]; let sla = &a[1..3]; <|fim_middle|> let b = String::from("Hello World!"); let slb = &b[6..11];
code_fim
medium
{ "lang": "rust", "repo": "dougtq/rust-lang", "path": "/slices-strs/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dougtq/rust-lang path: /slices-strs/src/main.rs fn main() { let a = vec![555, 3 , 278, 774]; let sla = &a[1..3]; <|fim_suffix|> println!("Slices: {:?} - {:?}", sla, slb); }<|fim_middle|> let b = String::from("Hello World!"); let slb = &b[6..11];
code_fim
medium
{ "lang": "rust", "repo": "dougtq/rust-lang", "path": "/slices-strs/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: InterestingBrainPoops/battlesnake-rs path: /src/devious_devin.rs use rocket_contrib::json::Json; use super::*; #[post("/start")] pub fn start() -> Status { Status::NoContent } #[post("/end")] pub fn end() -> Status { Status::NoContent } #[get("/")] pub fn me() -> Json<AboutMe> { ...
code_fim
hard
{ "lang": "rust", "repo": "InterestingBrainPoops/battlesnake-rs", "path": "/src/devious_devin.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> node: &'a GameState, turn_snake_id: &'a str, ) -> impl Iterator<Item = (Direction, GameState)> + 'a { let you: &Battlesnake = node .board .snakes .iter() .find(|s| s.id == turn_snake_id) .expect("We didn't find that snake"); you.body[0] .poss...
code_fim
hard
{ "lang": "rust", "repo": "InterestingBrainPoops/battlesnake-rs", "path": "/src/devious_devin.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JARVIS-AI/war path: /crates/war-cli/src/command/crc64.rs use failure::Error; use structopt::StructOpt; <|fim_suffix|>impl Command { pub fn run(self) -> Result<(), Error> { let hash = war::HString::calculate_hash(self.input.as_bytes()); for byte in &hash.to_le_bytes() { ...
code_fim
medium
{ "lang": "rust", "repo": "JARVIS-AI/war", "path": "/crates/war-cli/src/command/crc64.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Command { pub fn run(self) -> Result<(), Error> { let hash = war::HString::calculate_hash(self.input.as_bytes()); for byte in &hash.to_le_bytes() { print!("{:02x} ", byte); } println!(); Ok(()) } }<|fim_prefix|>// repo: JARVIS-AI/war path: ...
code_fim
medium
{ "lang": "rust", "repo": "JARVIS-AI/war", "path": "/crates/war-cli/src/command/crc64.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bltavares/artichoke path: /src/main.rs use clap::{App, Arg}; fn main() { env_logger::init(); <|fim_suffix|> match output { Some(content) => println!("{}", content), None => { println!("No article view from the given path"); std::process::exit(1); ...
code_fim
hard
{ "lang": "rust", "repo": "bltavares/artichoke", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match output { Some(content) => println!("{}", content), None => { println!("No article view from the given path"); std::process::exit(1); } } }<|fim_prefix|>// repo: bltavares/artichoke path: /src/main.rs use clap::{App, Arg}; fn main() { env_...
code_fim
medium
{ "lang": "rust", "repo": "bltavares/artichoke", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: play3577/mukaschultze_nes-rs path: /nes-core/src/cpu/instructions_info.rs ", addressing_mode: AddressMode::Implied, size: 1, ticks: 7, page_cross_add: 0, }, 1 => Instruction { opcode: 1, ...
code_fim
hard
{ "lang": "rust", "repo": "play3577/mukaschultze_nes-rs", "path": "/nes-core/src/cpu/instructions_info.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: play3577/mukaschultze_nes-rs path: /nes-core/src/cpu/instructions_info.rs Mode::ZeropageX, size: 2, ticks: 4, page_cross_add: 0, }, 150 => Instruction { opcode: 150, illegal: false, ...
code_fim
hard
{ "lang": "rust", "repo": "play3577/mukaschultze_nes-rs", "path": "/nes-core/src/cpu/instructions_info.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> addressing_mode: AddressMode::AbsoluteY, size: 3, ticks: 4, page_cross_add: 1, }, 58 => Instruction { opcode: 58, illegal: true, name: "???", description: "", ...
code_fim
hard
{ "lang": "rust", "repo": "play3577/mukaschultze_nes-rs", "path": "/nes-core/src/cpu/instructions_info.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> text: &Rope, width_cache: &mut WidthCache, _style_spans: &Spans<Style>, client: &T, max_width: f64, ) -> Breaks { let mut ctx = RewrapCtx::new(text, /* style_spans, */ client, max_width, width_cache, 0, text.len()); let mut builder = BreakBuilder::new(); let mut pos...
code_fim
hard
{ "lang": "rust", "repo": "fominok/xi-editor", "path": "/rust/core-lib/src/linewrap.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fominok/xi-editor path: /rust/core-lib/src/linewrap.rs opeInfo}; use xi_trace::trace_block; use xi_unicode::LineBreakLeafIter; use crate::client::Client; use crate::styles::{Style, N_RESERVED_STYLES}; use crate::width_cache::{CodepointMono, Token, WidthCache, WidthMeasure}; /// The visual widt...
code_fim
hard
{ "lang": "rust", "repo": "fominok/xi-editor", "path": "/rust/core-lib/src/linewrap.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Gabriel-Paulucci/ActixWebTest path: /src/main.rs mod routes; use actix_web::{App, HttpServer}; use routes::confi<|fim_suffix|>()> { HttpServer::new(|| App::new().configure(config_routes)) .bind("127.0.0.1:8080")? .run() .await }<|fim_middle|>g_routes; #[actix_web::m...
code_fim
medium
{ "lang": "rust", "repo": "Gabriel-Paulucci/ActixWebTest", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>()> { HttpServer::new(|| App::new().configure(config_routes)) .bind("127.0.0.1:8080")? .run() .await }<|fim_prefix|>// repo: Gabriel-Paulucci/ActixWebTest path: /src/main.rs mod routes; use actix_web::{App, HttpServer}; use routes::confi<|fim_middle|>g_routes; #[actix_web::m...
code_fim
medium
{ "lang": "rust", "repo": "Gabriel-Paulucci/ActixWebTest", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dignifiedquire/zim path: /src/directory_iterator.rs use crate::directory_entry::DirectoryEntry; use crate::zim::Zim; pub struct DirectoryIterator<'a> { max: u32, next: u32, zim: &'a Zim, } impl<'a> DirectoryIterator<'a> { pub fn new(zim: &'a Zim) -> DirectoryIterator<'a> { ...
code_fim
medium
{ "lang": "rust", "repo": "dignifiedquire/zim", "path": "/src/directory_iterator.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> std::iter::Iterator for DirectoryIterator<'a> { type Item = DirectoryEntry; fn next(&mut self) -> Option<Self::Item> { if self.next >= self.max { return None; } let dir_entry_ptr = self.zim.url_list[self.next as usize] as usize; self.next += 1...
code_fim
hard
{ "lang": "rust", "repo": "dignifiedquire/zim", "path": "/src/directory_iterator.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let dir_entry_ptr = self.zim.url_list[self.next as usize] as usize; self.next += 1; let slice = self.zim.master_view.get(dir_entry_ptr..); match slice { Some(slice) => DirectoryEntry::new(self.zim, slice).ok(), None => None, } } }<|fim_p...
code_fim
hard
{ "lang": "rust", "repo": "dignifiedquire/zim", "path": "/src/directory_iterator.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> From<&'a str> for Type<'a> { fn from(type_name: &'a str) -> Type<'a> { match type_name { "byte" => Type::Byte, "int" => Type::Int, "long" => Type::Long, "float" => Type::Float, "double" => Type::Double, _ => Type...
code_fim
hard
{ "lang": "rust", "repo": "king1600/clowlang", "path": "/clowc/src/parser/ast.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: king1600/clowlang path: /clowc/src/parser/ast.rs use std::fmt; pub type Context<'a> = (&'a str, &'a str); pub type SourceLoc = (usize, usize, usize); #[derive(Debug, Clone, PartialEq)] pub struct Expr<'a>(ExprType<'a>, SourceLoc); #[derive(Debug, Clone, PartialEq)] pub struct Token<'a>(Token...
code_fim
hard
{ "lang": "rust", "repo": "king1600/clowlang", "path": "/clowc/src/parser/ast.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> use self::Error::*; let ParseError(error, context, source_loc) = self; let (line, column, line_start) = source_loc; let (context, source) = context; write!(f, "Error on {}:{}:{}> ", context, line, column) .and_then(|_| match error { Unt...
code_fim
hard
{ "lang": "rust", "repo": "king1600/clowlang", "path": "/clowc/src/parser/ast.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn resolve(&self, vector_length: usize) -> Option<usize> { match *self { Index::Forward(n) => Some(n), Index::Backward(n) => if n >= vector_length { None } else { Some(vector_length - (n + 1)) }, ...
code_fim
hard
{ "lang": "rust", "repo": "schedutron/ion-1", "path": "/src/lib/parser/shell_expand/words/index.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: schedutron/ion-1 path: /src/lib/parser/shell_expand/words/index.rs /// Index into a vector-like object #[derive(Debug, PartialEq, Copy, Clone)] pub(crate) enum Index { /// Index starting from the beginning of the vector, where `Forward(0)` /// is the first element Forward(usize), ...
code_fim
hard
{ "lang": "rust", "repo": "schedutron/ion-1", "path": "/src/lib/parser/shell_expand/words/index.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // ensure values are correctly placed in heap in a bottom up fashion fn heapify_up(&mut self) { let mut index: usize = self.data.len() - 1; while( self.has_parent(index) && self.get_parent(index) > self.data[index] ) { self.swap(self.get_parent_index(index), index); ...
code_fim
hard
{ "lang": "rust", "repo": "victordeleau/rust-plinth", "path": "/data_structure/heap/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: victordeleau/rust-plinth path: /data_structure/heap/src/main.rs use rand::Rng; struct Heap { data: Vec<i64>, size: usize, } impl Heap { fn new() -> Heap { return Heap { data: Vec::new(), size: 0, }; } // get index relative to anoth...
code_fim
hard
{ "lang": "rust", "repo": "victordeleau/rust-plinth", "path": "/data_structure/heap/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn step(self: &mut Self, input: &mut impl FnMut() -> i64, output: &mut impl FnMut(i64)) -> i64 { let opcode = self.mem[self.pos] % 100; match opcode { 1 => { let arg1 = self.read(1); let arg2 = self.read(2); self.write(3, arg...
code_fim
hard
{ "lang": "rust", "repo": "maximbaz/advent2019", "path": "/src/intcode.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maximbaz/advent2019 path: /src/intcode.rs pub struct IntCode { mem: Vec<i64>, pos: usize, rel: usize, } impl IntCode { pub fn new(program: &[i64]) -> IntCode { IntCode { mem: program.to_vec(), pos: 0, rel: 0, } } pub f...
code_fim
hard
{ "lang": "rust", "repo": "maximbaz/advent2019", "path": "/src/intcode.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let opcode = self.mem[self.pos] % 100; match opcode { 1 => { let arg1 = self.read(1); let arg2 = self.read(2); self.write(3, arg1 + arg2); self.pos += 4; } 2 => { let arg1 =...
code_fim
hard
{ "lang": "rust", "repo": "maximbaz/advent2019", "path": "/src/intcode.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl From<json::JsonValue> for TransferCallCallArgs { fn from(v: json::JsonValue) -> Self { Self { receiver_id: v.string("receiver_id").expect(FAILED_PARSE), amount: v.u128("amount").expect(FAILED_PARSE), memo: v.string("memo").ok(), msg: v.strin...
code_fim
hard
{ "lang": "rust", "repo": "sept-en/eth-connector", "path": "/pure-eth-connector/src/types.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sept-en/eth-connector path: /pure-eth-connector/src/types.rs #![allow(dead_code)] use super::*; use primitive_types::{H160, H256, U256}; use sha3::{Digest, Keccak256}; pub const FAILED_PARSE: &str = "Failed parse json"; pub type RawAddress = [u8; 20]; pub type RawU256 = [u8; 32]; pub type RawH...
code_fim
hard
{ "lang": "rust", "repo": "sept-en/eth-connector", "path": "/pure-eth-connector/src/types.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> Self { account_id: v.string("account_id").expect(FAILED_PARSE), } } } impl From<json::JsonValue> for StorageDepositCallArgs { fn from(v: json::JsonValue) -> Self { Self { account_id: v.string("account_id").ok(), registration_only: v.bool...
code_fim
hard
{ "lang": "rust", "repo": "sept-en/eth-connector", "path": "/pure-eth-connector/src/types.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> let tests = vec![( "valid", RapidResynchronizationRequest { sender_ssrc: 0x902f9e2e, media_ssrc: 0x902f9e2e, }, None, )]; for (name, want, want_error) in tests { let got = want.marshal(); assert_eq!( got.is_o...
code_fim
hard
{ "lang": "rust", "repo": "stepa2/webrtc-rs-rtcp", "path": "/src/transport_feedbacks/rapid_resynchronization_request/rapid_resynchronization_request_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stepa2/webrtc-rs-rtcp path: /src/transport_feedbacks/rapid_resynchronization_request/rapid_resynchronization_request_test.rs use super::*; #[test] fn test_rapid_resynchronization_request_unmarshal() { let tests = vec![ ( "valid", Bytes::from_static(&[ ...
code_fim
hard
{ "lang": "rust", "repo": "stepa2/webrtc-rs-rtcp", "path": "/src/transport_feedbacks/rapid_resynchronization_request/rapid_resynchronization_request_test.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> CommandSyntaxError = 500, ParameterSyntaxError = 501, CommandNotImplemented = 502, BadCommandSequence = 503, CommandNotImplementedForParameter = 504, NotLoggedIn = 530, NeedAccountToStore = 532, FileError = 550, PageTypeUnknown = 551, ExceededStorageAllocation = 552...
code_fim
hard
{ "lang": "rust", "repo": "koenw/firetrap", "path": "/src/reply.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: koenw/firetrap path: /src/reply.rs /// A reply to the FTP client pub enum Reply { None, CodeAndMsg { code: ReplyCode, msg: String }, MultiLine { code: ReplyCode, lines: Vec<String> }, } /// The reply codes accoding to RFC 959. #[derive(Debug, Clone, Copy)] #[repr(u32)] #[allow(dead_...
code_fim
hard
{ "lang": "rust", "repo": "koenw/firetrap", "path": "/src/reply.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// Safety: pointers can be cast to other pointer types unsafe impl<T, U> SimdCastPtr<T> for *const U where U: core::ptr::Pointee, T: core::ptr::Pointee<Metadata = U::Metadata>, { } // Safety: pointers can be cast to other pointer types unsafe impl<T, U> SimdCastPtr<T> for *mut U where U: core:...
code_fim
hard
{ "lang": "rust", "repo": "aDotInTheVoid/rust", "path": "/library/portable-simd/crates/core_simd/src/cast.rs", "mode": "spm", "license": "LicenseRef-scancode-other-permissive", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aDotInTheVoid/rust path: /library/portable-simd/crates/core_simd/src/cast.rs use crate::simd::SimdElement; /// Supporting trait for `Simd::cast`. Typically doesn't need to be used directly. /// /// # Safety /// Implementing this trait asserts that the type is a valid vector element for the `si...
code_fim
hard
{ "lang": "rust", "repo": "aDotInTheVoid/rust", "path": "/library/portable-simd/crates/core_simd/src/cast.rs", "mode": "psm", "license": "LicenseRef-scancode-other-permissive", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rodya-mirov/palladium path: /main/src/skills/mod.rs //! TODO: plug in skills at some point #![allow(dead_code)] use std::collections::HashMap; use serde::Deserialize; #[derive(Debug, Eq, PartialEq)] struct Skill { /// List of parents of this skill parents: Vec<SkillParentRelation>, ...
code_fim
hard
{ "lang": "rust", "repo": "rodya-mirov/palladium", "path": "/main/src/skills/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> 1 } #[cfg(test)] mod tests { use super::*; #[test] fn empty_test() { let ron = "[]"; let actual = SkillTree::from_ron(ron).expect("Should deserialize"); let expected = SkillTree::new(); assert_eq!(expected, actual); } #[test] fn one_test() {...
code_fim
hard
{ "lang": "rust", "repo": "rodya-mirov/palladium", "path": "/main/src/skills/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tl-marco-cameriero/grpc-build path: /src/graph_layout.rs use petgraph::graph::NodeIndex; use petgraph::{Direction, Graph}; use std::fs; use std::fs::File; use std::io::Write; pub struct ProtoGraphNode { is_root: bool, is_leaf: bool, weight: String, filename: String, leaf_tok...
code_fim
hard
{ "lang": "rust", "repo": "tl-marco-cameriero/grpc-build", "path": "/src/graph_layout.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }