text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>/ /* targ_name */ /* req_flags */ /* meta_data */ /* */ /* minor_status */ /* mech_oid */ /* cred_handle */ /* context_handle */ /* targ_name */ /* req_flags */ /* meta_data */ /* */ /* minor_status */ /* mech_oid */ /* auth_scheme */ /* */ /* * In the user space we use a wrapper structure to encompass t...
code_fim
hard
{ "lang": "rust", "repo": "xentrick/gssapi-rs", "path": "/src/lib/gssapi/mechglue/g_mechname.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>*/ /* lifetime */ /* cred_usage */ /* mechanisms */ /* minor_status */ /* input_cred_handle */ /* desired_name */ /* desired_mech */ /* cred_usage */ /* initiator_time_req */ /* acceptor_time_req */ /* output_cred_handle */ /* actual_mechs */ /* initiator_time_rec */ /* acceptor_time_rec */ /* minor_statu...
code_fim
hard
{ "lang": "rust", "repo": "xentrick/gssapi-rs", "path": "/src/lib/gssapi/mechglue/g_mechname.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wibbe/organizer path: /src/main.rs extern crate glutin; extern crate libc; #[macro_use] extern crate lazy_static; mod gl; mod ui; mod font; mod app; mod doc; use ui::*; use app::*; fn main() { let window = glutin::WindowBuilder::new() .with_title...
code_fim
medium
{ "lang": "rust", "repo": "wibbe/organizer", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> app.paint(); window.swap_buffers().unwrap(); for event in window.wait_events() { match event { glutin::Event::Closed => break, glutin::Event::ReceivedCharacter(ch) => println!("Wrote char: {}", ch), glutin::Event::Refresh => (), _ => () ...
code_fim
medium
{ "lang": "rust", "repo": "wibbe/organizer", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let background = Color::new(40, 50, 60); let foreground = Color::new(230, 230, 230); app.paint(); window.swap_buffers().unwrap(); for event in window.wait_events() { match event { glutin::Event::Closed => break, glutin::Event::ReceivedCharacter(ch)...
code_fim
hard
{ "lang": "rust", "repo": "wibbe/organizer", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zofrex/better-than-basic path: /src/errors.rs use std::fmt; #[derive(Ord,Eq,PartialEq,PartialOrd)] pub enum LoginError { UsernameMissing, UsernameNotFound, PasswordMissing, PasswordIncorrect, } impl fmt::Display for LoginError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt:...
code_fim
medium
{ "lang": "rust", "repo": "zofrex/better-than-basic", "path": "/src/errors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match error { "username_missing" => Some(LoginError::UsernameMissing), "username_not_found" => Some(LoginError::UsernameNotFound), "password_missing" => Some(LoginError::PasswordMissing), "password_incorrect" => Some(LoginError::PasswordIncorrect), ...
code_fim
medium
{ "lang": "rust", "repo": "zofrex/better-than-basic", "path": "/src/errors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[marine] pub struct TestRecord { pub field_0: bool, pub field_1: i8, pub field_2: i16, pub field_3: i32, pub field_4: i64, pub field_5: u8, pub field_6: u16, pub field_7: u32, pub field_8: u64, pub field_9: f32, pub field_10: f64, pub field_11: String, ...
code_fim
medium
{ "lang": "rust", "repo": "amrosaeed/Fluence-Service", "path": "/marine-examples/records/test-record/src/test_record.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: amrosaeed/Fluence-Service path: /marine-examples/records/test-record/src/test_record.rs /* * Copyright 2020 Fluence Labs Limited * * 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 ...
code_fim
medium
{ "lang": "rust", "repo": "amrosaeed/Fluence-Service", "path": "/marine-examples/records/test-record/src/test_record.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let builtins = shell.builtins; let stdout = io::stdout(); let mut stdout = stdout.lock(); if let Some(command) = args.get(1) { if builtins.contains_key(command) { if let Some(bltin) = builtins.get(command) { let _ = stdout.write_all(bltin.help.as_bytes()...
code_fim
hard
{ "lang": "rust", "repo": "bb010g/ion", "path": "/src/builtins/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bb010g/ion path: /src/builtins/mod.rs pub mod source; pub mod variables; pub mod functions; pub mod calc; mod job_control; mod test; mod time; mod echo; mod set; use self::variables::{alias, drop_alias, drop_variable, drop_array}; use self::functions::fn_; use self::source::source; use self::e...
code_fim
hard
{ "lang": "rust", "repo": "bb010g/ion", "path": "/src/builtins/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match source(shell, args) { Ok(()) => SUCCESS, Err(why) => { let stderr = io::stderr(); let mut stderr = stderr.lock(); let _ = stderr.write_all(why.as_bytes()); FAILURE } } } fn builtin_echo(args: &[&str], _: &mut Shell) ->...
code_fim
hard
{ "lang": "rust", "repo": "bb010g/ion", "path": "/src/builtins/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tomba-io/rust path: /src/lib.rs // Copyright 2021 Tomba technology web service LLC // // 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.a...
code_fim
hard
{ "lang": "rust", "repo": "tomba-io/rust", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Search path const SEARCH_PATH: &str = "domain-search/"; /// Finder path const FINDER_PATH: &str = "email-finder/"; /// Verifier path const VERIFIER_PATH: &str = "email-verifier/"; /// Email Sources path const SOURCES_PATH: &str = "email-sources/"; /// Email Count path const COUNT_PATH: &str = "ema...
code_fim
hard
{ "lang": "rust", "repo": "tomba-io/rust", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Domain status path const AUTOCOMPLETE_PATH: &str = "domains-suggestion/"; #[macro_use] mod tomba; mod account; mod autocomplete; // mod error; mod count; mod finder; mod logs; mod search; mod sources; mod status; mod usage; mod verifier; pub use crate::tomba::*; pub use account::*; pub use autocompl...
code_fim
hard
{ "lang": "rust", "repo": "tomba-io/rust", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert!(is_on_sight(&map, &Point::new(0, 0), &Point::new(4, 2))); assert!(is_on_sight(&map, &Point::new(1, 3), &Point::new(2, 3))); assert!(!is_on_sight(&map, &Point::new(1, 3), &Point::new(3, 3))); } #[test] fn test_extract_asteroids() { let map = create_map(...
code_fim
hard
{ "lang": "rust", "repo": "icanwalkonwater/adventofcode2019", "path": "/day10/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: icanwalkonwater/adventofcode2019 path: /day10/src/lib.rs pub use laser::consume_laser_round; pub use laser::sort_asteroids_by_angle; pub use laser::start_laser; pub use point::Point; pub use vision::count_asteroid_on_sight; pub use vision::find_asteroid_with_most_sight; pub use vision::get_aster...
code_fim
hard
{ "lang": "rust", "repo": "icanwalkonwater/adventofcode2019", "path": "/day10/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match S1 { Low => match S2 { Low => Low, High => High } High => High } } } #[test] fn sec_test() { assert_type_eq::<Low, MaxSec<Low, Low>>(); assert_type_eq::<High, MaxSec<Low, High>>(); assert_type_eq::<High, MaxSec<High, Low>>(); assert_type_eq::<High...
code_fim
medium
{ "lang": "rust", "repo": "LaplaceKorea/tyrade", "path": "/tests/security.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LaplaceKorea/tyrade path: /tests/security.rs #![feature(generic_associated_types, specialization)] #![allow(incomplete_features)] use tyrade::*; <|fim_suffix|> assert_type_eq::<Low, MaxSec<Low, Low>>(); assert_type_eq::<High, MaxSec<Low, High>>(); assert_type_eq::<High, MaxSec<High, Low>>...
code_fim
hard
{ "lang": "rust", "repo": "LaplaceKorea/tyrade", "path": "/tests/security.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] #[should_panic(expected = "Invalid input: costs is not a square matrix")] fn wa_not_square() { let cost = vec![ vec![1, 2], // lf vec![3, 4, 5], // lf ]; work_assign(&cost); } #[bench] fn wa_bench(b: &mut test::Bencher) { ...
code_fim
hard
{ "lang": "rust", "repo": "weirane/gadgets", "path": "/rust/work-assign/src/lib.rs", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|>// repo: weirane/gadgets path: /rust/work-assign/src/lib.rs #![feature(test)] extern crate test; use std::u32::MAX as U32_MAX; /// Returns the minimal cost and a vector of `vec[i] == j` indicating the /// i-th person gets the j-th job. Indexes starts at 0. pub fn work_assign(costs: &[Vec<u32>]) -> (u32...
code_fim
hard
{ "lang": "rust", "repo": "weirane/gadgets", "path": "/rust/work-assign/src/lib.rs", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> assert_wa!(Vec::new(), 0, vec![]); } #[test] #[should_panic(expected = "Invalid input: costs is not a square matrix")] fn wa_not_square() { let cost = vec![ vec![1, 2], // lf vec![3, 4, 5], // lf ]; work_assign(&cost); } ...
code_fim
hard
{ "lang": "rust", "repo": "weirane/gadgets", "path": "/rust/work-assign/src/lib.rs", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> // Test solving precedence with groups. assert_parse!(r#"fn main() { (0 < 10) >= 10 }"#); assert_parse!(r#"fn main() { 0 < (10 >= 10) }"#); assert_parse!(r#"fn main() { 0 < 10 && 10 > 0 }"#); assert_parse!(r#"fn main() { 0 < 10 && 10 > 0 || true }"#); }<|fim_prefix|>// repo: killercup/...
code_fim
medium
{ "lang": "rust", "repo": "killercup/rune", "path": "/crates/rune-testing/tests/compiler_expr_binary.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: killercup/rune path: /crates/rune-testing/tests/compiler_expr_binary.rs use rune_testing::*; #[test] fn test_binary_exprs() { <|fim_suffix|> // Test solving precedence with groups. assert_parse!(r#"fn main() { (0 < 10) >= 10 }"#); assert_parse!(r#"fn main() { 0 < (10 >= 10) }"#); ...
code_fim
medium
{ "lang": "rust", "repo": "killercup/rune", "path": "/crates/rune-testing/tests/compiler_expr_binary.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn ignore_events_when_not_listening() { let mut p = HumanPlayer::new(); assert_eq!(None, p.move_to_play()); p.mouse_clicked((0, 0)); assert_eq!(None, p.move_to_play()); } #[test] fn register_last_event_when_not_listening() { let mut p = ...
code_fim
hard
{ "lang": "rust", "repo": "ColinPitrat/RustMisc", "path": "/tictactoe/src/human_player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; #[test] fn ignore_events_when_not_listening() { let mut p = HumanPlayer::new(); assert_eq!(None, p.move_to_play()); p.mouse_clicked((0, 0)); assert_eq!(None, p.move_to_play()); } #[test] fn register_last_event...
code_fim
hard
{ "lang": "rust", "repo": "ColinPitrat/RustMisc", "path": "/tictactoe/src/human_player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ColinPitrat/RustMisc path: /tictactoe/src/human_player.rs use crate::player::Player; use crate::board::Board; pub struct HumanPlayer { listening: bool, played_pos: Option<(usize, usize)>, } impl HumanPlayer { pub fn new() -> HumanPlayer { HumanPlayer{ listening:...
code_fim
hard
{ "lang": "rust", "repo": "ColinPitrat/RustMisc", "path": "/tictactoe/src/human_player.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arapat/sparrow path: /src/lib.rs /*! Sparrow is an implementation of TMSN for boosting. From a high level, Sparrow consists of three components, 1. scanner: it runs the boosting process, which scans the samples in memory, and updates the current model by finding a new weak rule to be added to ...
code_fim
hard
{ "lang": "rust", "repo": "arapat/sparrow", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Load configurations let config = Config::new(config_filepath); let sample_mode = SampleMode::new(&config.sampling_mode); // Clear S3 before running if sample_mode == SampleMode::S3 { clear_s3_bucket(REGION, BUCKET, config.exp_name.as_str()); } debug!("Loading bins....
code_fim
hard
{ "lang": "rust", "repo": "arapat/sparrow", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yurydelendik/wasmtime-embed path: /wasmtime-embed/src/extra.rs pub use cranelift_codegen::{ir, isa}; pub use cranelift_entity::PrimaryMap; pub use was<|fim_suffix|>smtime_runtime::{VMContext, VMFunctionBody};<|fim_middle|>mtime_environ::{Export, Module}; pub use wa
code_fim
easy
{ "lang": "rust", "repo": "yurydelendik/wasmtime-embed", "path": "/wasmtime-embed/src/extra.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>smtime_runtime::{VMContext, VMFunctionBody};<|fim_prefix|>// repo: yurydelendik/wasmtime-embed path: /wasmtime-embed/src/extra.rs pub use cranelift_codegen::{ir, isa}; pub u<|fim_middle|>se cranelift_entity::PrimaryMap; pub use wasmtime_environ::{Export, Module}; pub use wa
code_fim
medium
{ "lang": "rust", "repo": "yurydelendik/wasmtime-embed", "path": "/wasmtime-embed/src/extra.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> test1(); test2(); test3(); test4().await; p1.await; }<|fim_prefix|>// repo: lflxp/ipscan-rs path: /src/main.rs mod ping; use ping::{pings, pingsspawn}; // mod server; // use server::run; mod mthread; use mthread::{test1, test2, test3, test4}; use async_std::task::{sleep, spawn}; <...
code_fim
medium
{ "lang": "rust", "repo": "lflxp/ipscan-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lflxp/ipscan-rs path: /src/main.rs mod ping; use ping::{pings, pingsspawn}; // mod server; // use server::run; mod mthread; use mthread::{test1, test2, test3, test4}; use async_std::task::{sleep, spawn}; <|fim_suffix|> test1(); test2(); test3(); test4().await; p1.await; }...
code_fim
medium
{ "lang": "rust", "repo": "lflxp/ipscan-rs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: a-mackay/raystack path: /src/err.rs use crate::auth::AuthError; use crate::grid::{Grid, ParseJsonGridError}; use thiserror::Error; impl Error { /// Return true if this error encapsulates a Haystack error grid. pub fn is_grid(&self) -> bool { matches!(self, Self::Grid { .. }) ...
code_fim
hard
{ "lang": "rust", "repo": "a-mackay/raystack", "path": "/src/err.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Errors that can occur when creating a new `SkySparkClient`. #[derive(Debug, Error)] pub enum NewSkySparkClientError { /// An error which occurred during the authentication process. #[error("Error occurred during authentication")] Auth(#[from] AuthError), /// An error caused by an inval...
code_fim
hard
{ "lang": "rust", "repo": "a-mackay/raystack", "path": "/src/err.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pauldoo/scratch path: /timetrace2/src/swizzle/tests.rs use rand::{SeedableRng, RngCore}; use crate::swizzle::{swizzle, unswizzle}; #[test] pub fn zeros() -> () { let x: u32 = 0; let y: u32 = 0; <|fim_suffix|> assert_eq!(xa, x); assert_eq!(ya, y); } #[test] pub fn only_y_bits() ...
code_fim
hard
{ "lang": "rust", "repo": "pauldoo/scratch", "path": "/timetrace2/src/swizzle/tests.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> let s: u64 = swizzle(x, y); let (xa, ya) = unswizzle(s); assert_eq!(xa, x); assert_eq!(ya, y); } }<|fim_prefix|>// repo: pauldoo/scratch path: /timetrace2/src/swizzle/tests.rs use rand::{SeedableRng, RngCore}; use crate::swizzle::{swizzle, unswizzle}; #[test] pub fn...
code_fim
hard
{ "lang": "rust", "repo": "pauldoo/scratch", "path": "/timetrace2/src/swizzle/tests.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|> //initializing bngdings //Error,rust warns us that we never use the variable binding. //let cf: i32; //println!("{:?}",cf ); //Vrariable bindings can be shadowed. let sd: i32 = 42; { println!("{}",sd); //print "42" let sd = 22; println!("{}",sd); //pri...
code_fim
medium
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/syntax_and_semantics.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TianTianForever/Rust-Tutorial path: /syntax_and_semantics.rs fn main() { //Variable bindings let x = 5; let y = 5; println!("x is {0},y is {1}",x,y); <|fim_suffix|> //initializing bngdings //Error,rust warns us that we never use the variable binding. //let cf: i32; ...
code_fim
hard
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/syntax_and_semantics.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Building proto files..."); let output = Command::new("protoc").args( &["--rust_out=src", "deps/ribbon-bridge/proto/rpc.proto", "-Ideps/nanopb/generator/proto", "-Ideps/ribbon-bridge/proto"]).output().expect("Failed to build proto files"); println...
code_fim
medium
{ "lang": "rust", "repo": "davidko/ribbon-bridge-rs", "path": "/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: davidko/ribbon-bridge-rs path: /build.rs use std::process::Command; // protoc --rust_out . rpc.proto -I ../../nanopb/generator/proto/ -I . fn main() { <|fim_suffix|> println!("status: {}", output.status); println!("stdout: {}", String::from_utf8_lossy(&output.stdout)); println!("stderr: {}"...
code_fim
hard
{ "lang": "rust", "repo": "davidko/ribbon-bridge-rs", "path": "/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/lfs path: /src/main.rs mod fmt_mount; mod json; use argh::FromArgs; #[derive(FromArgs)] /// List your filesystems. /// /// All units are SI. /// /// Source at https://github.com/Canop/lfs struct Args { <|fim_suffix|> /// output as JSON #[argh(switch, short='j')] json: bool...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/lfs", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() -> lfs_core::Result<()> { let args:Args = argh::from_env(); if args.version { println!("lfs {}", env!("CARGO_PKG_VERSION")); return Ok(()); } let mut mounts = lfs_core::read_mounts()?; if !args.all { mounts.retain(|m| m.disk.is_some() ...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/lfs", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let stake = CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: env.contract.address, msg: to_binary(&HandleMsg::stake { asset_token: mir_token.clone(), })?, send: vec![], }); let response = HandleResponse { messages: vec![swap_mir, increase_a...
code_fim
hard
{ "lang": "rust", "repo": "spectrum-lumiere/contracts", "path": "/contracts/spectrum_mirror_farm/src/reinvest.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let swap_rate = simulate(&deps, &pair_info.contract_addr.clone(), &net_swap_asset)?; let swap_asset_token = CosmosMsg::Wasm(WasmMsg::Execute { contract_addr: pair_info.contract_addr.clone(), msg: to_binary(&TerraswapHandleMsg::Swap { offer_asset: net_swap_asset, ...
code_fim
hard
{ "lang": "rust", "repo": "spectrum-lumiere/contracts", "path": "/contracts/spectrum_mirror_farm/src/reinvest.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: spectrum-lumiere/contracts path: /contracts/spectrum_mirror_farm/src/reinvest.rs use cosmwasm_std::{ log, to_binary, Api, CanonicalAddr, Coin, CosmosMsg, Decimal, Env, Extern, HandleResponse, HandleResult, HumanAddr, Querier, StdError, StdResult, Storage, Uint128, WasmMsg, }; use crate:...
code_fim
hard
{ "lang": "rust", "repo": "spectrum-lumiere/contracts", "path": "/contracts/spectrum_mirror_farm/src/reinvest.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ComponentManagerConfiguration::default() } fn namespace_capabilities(&self) -> Box<dyn Iterator<Item = Self::ComponentCapability>> { Box::new(iter::empty()) } fn builtin_capabilities(&self) -> Box<dyn Iterator<Item = Self::ComponentCapability>> { ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/security/lib/scrutiny/x/src/component_manager.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/security/lib/scrutiny/x/src/component_manager.rs // Copyright 2022 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // TODO(fxbug.dev/111251): Implement for production Sy...
code_fim
medium
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/security/lib/scrutiny/x/src/component_manager.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shanavas786/coding-fu path: /adventofcode/2019/rust/prelude/src/lib.rs use std::fs::File; use std::io::{BufReader, BufRead}; pub fn nums_from_file(path: &str) -> impl Iterator<Item = u64> { let input = File::open(path).expect("Failed to open file"); let buffered = BufReader::new(input)...
code_fim
hard
{ "lang": "rust", "repo": "shanavas786/coding-fu", "path": "/adventofcode/2019/rust/prelude/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_nums_from_file() { use std::io::Write; let path = "/tmp/nums.txt"; let mut output = File::create(path).expect("Failed to create file"); write!(output, "123\n90\n123\n").expect("ads"); for num in nums_from_file(path) { println!("{}", num) } } #[test] fn t...
code_fim
medium
{ "lang": "rust", "repo": "shanavas786/coding-fu", "path": "/adventofcode/2019/rust/prelude/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wezm/mode-s-demod path: /src/lib.rs valid_preamble: c_uint, demodulated0: c_uint, demodulated1: c_uint, demodulated2: c_uint, demodulated3: c_uint, goodcrc: c_uint, badcrc: c_uint, fixed: c_uint, // Histogram of fixed bit errors: index 0 for single bit error...
code_fim
hard
{ "lang": "rust", "repo": "wezm/mode-s-demod", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wezm/mode-s-demod path: /src/lib.rs st MODES_MSG_ENCODER_ERRS: c_int = 3; // Maximum number of encoding errors // When changing, change also fixBitErrors() and modesInitErrorTable() !! pub const MODES_MAX_BITERRORS: usize = 2; // Global max for fixable bit errors const MODES_PREAMBLE_US: usize...
code_fim
hard
{ "lang": "rust", "repo": "wezm/mode-s-demod", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Add the specified entry to the cache of recently seen ICAO addresses. // Note that we also add a timestamp so that we can make sure that the // entry is only valid for MODES_ICAO_CACHE_TTL seconds. // fn add_recently_seen_addr(&mut self, addr: u32) { let h: u32 = Self::icao_...
code_fim
hard
{ "lang": "rust", "repo": "wezm/mode-s-demod", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn push(&mut self, block: &'static mut Block) { block.next = self.blocks.take(); self.number_of_blocks += 1; self.blocks.get_or_insert(block); } fn pop(&mut self) -> Option<&'static Block> { let old_head:Option<&'static Block> = self.blocks.take(); matc...
code_fim
hard
{ "lang": "rust", "repo": "amp287/kernel", "path": "/raspberrypi3/src/allocator.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: amp287/kernel path: /raspberrypi3/src/allocator.rs extern crate alloc; use alloc::alloc::{GlobalAlloc, Layout}; use core::ptr::null_mut; use spin::Mutex; struct Block { next: Option<&'static Block> } struct MemoryBlockList { block_size: usize, start_address: usize, number_of_b...
code_fim
hard
{ "lang": "rust", "repo": "amp287/kernel", "path": "/raspberrypi3/src/allocator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wisest30/AlgoStudy path: /source/HackerCup/2022_Qualification_Round/C/hyo.rs use std::io::Read; fn main() { let mut stdin = std::io::stdin(); let mut buf = String::new(); stdin.read_to_string(&mut buf).unwrap(); let mut input = buf.split_ascii_whitespace(); let test_case ...
code_fim
medium
{ "lang": "rust", "repo": "wisest30/AlgoStudy", "path": "/source/HackerCup/2022_Qualification_Round/C/hyo.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut dot_starts = Vec::<String>::new(); let mut dash_starts = Vec::<String>::new(); for x in 0..1 << 10 { let mut s = String::new(); for i in 0..10 { s.push(if (x & (1 << i)) == 0 { '.' } else { '-' }); } if (x & 1) == 0 { dot_starts....
code_fim
medium
{ "lang": "rust", "repo": "wisest30/AlgoStudy", "path": "/source/HackerCup/2022_Qualification_Round/C/hyo.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ResourceModify<InputControllerStateScripted> for InputController { fn modify_resource(&mut self, source: InputControllerStateScripted) { for (k, v) in source.axes { self.set_axis(&k, v); } for (k, v) in source.triggers { self.set_trigger(&k, v); ...
code_fim
hard
{ "lang": "rust", "repo": "rustyforks/Oxygengine", "path": "/oxygengine-script-web/src/integration/input.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustyforks/Oxygengine path: /oxygengine-script-web/src/integration/input.rs use crate::{ interface::{ResourceAccess, ResourceModify}, scriptable::ScriptableValue, }; use oxygengine_core::Scalar; use oxygengine_input::resource::{InputController, TriggerState}; use serde::{Deserialize, Ser...
code_fim
hard
{ "lang": "rust", "repo": "rustyforks/Oxygengine", "path": "/oxygengine-script-web/src/integration/input.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> for (k, (a, b)) in source.mapping_axes { self.map_axis(&k, &a, &b); } for (k, (a, b)) in source.mapping_triggers { self.map_trigger(&k, &a, &b); } } } #[derive(Debug, Default, Clone, Serialize, Deserialize)] pub struct InputControllerStateScript...
code_fim
hard
{ "lang": "rust", "repo": "rustyforks/Oxygengine", "path": "/oxygengine-script-web/src/integration/input.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pythoneer/examples path: /actix_todo/src/db.rs use std::ops::Deref; use actix::prelude::{Actor, Handler, Message, SyncContext}; use actix_web::{error, Error}; use diesel::pg::PgConnection; use diesel::r2d2::{ConnectionManager, Pool, PoolError, PooledConnection}; use model::{NewTask, Task}; ty...
code_fim
hard
{ "lang": "rust", "repo": "pythoneer/examples", "path": "/actix_todo/src/db.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn handle(&mut self, task: ToggleTask, _: &mut Self::Context) -> Self::Result { Task::toggle_with_id(task.id, self.get_conn()?.deref()) .map(|_| ()) .map_err(|_| error::ErrorInternalServerError("Error inserting task")) } } pub struct DeleteTask { pub id: i32, }...
code_fim
hard
{ "lang": "rust", "repo": "pythoneer/examples", "path": "/actix_todo/src/db.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: titouanc/tinycc path: /src/ast.rs use std::fmt; pub trait AST { fn const_fold(&self) -> Self where Self: Sized+Clone { self.clone() } } pub type Program = Vec<Declaration>; impl AST for Program { fn const_fold(&self) -> Program { self.iter().map(|ref x| x.const_fo...
code_fim
hard
{ "lang": "rust", "repo": "titouanc/tinycc", "path": "/src/ast.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn length(&self) -> usize { match self { &Type::ArrayOf(_, n) => n, _ => 0, } } pub fn base(&self) -> Type { match *self { Type::ArrayOf(ref t, _) => t.base(), _ => self.clone(), } } pub fn inner(&sel...
code_fim
hard
{ "lang": "rust", "repo": "titouanc/tinycc", "path": "/src/ast.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> InfixOp(Operator, Box<Expression>, Box<Expression>), // left op right Ternary(Box<Expression>, Box<Expression>, Box<Expression>), // a ? b : c } impl AST for Expression { // Constant folding implementation at the AST level fn const_fold(&self) -> Expression { match self { ...
code_fim
hard
{ "lang": "rust", "repo": "titouanc/tinycc", "path": "/src/ast.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.name } } impl PartialEq<dyn Any> for AggregateFunctionExpr { fn eq(&self, other: &dyn Any) -> bool { down_cast_any_ref(other) .downcast_ref::<Self>() .map(|x| { self.name == x.name && self.data_type == x.data_type ...
code_fim
hard
{ "lang": "rust", "repo": "biaoma-ty/arrow-datafusion", "path": "/datafusion/core/src/physical_plan/udaf.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: biaoma-ty/arrow-datafusion path: /datafusion/core/src/physical_plan/udaf.rs // Licensed to the Apache Software Foundation (ASF) under one // or more contributor license agreements. See the NOTICE file // distributed with this work for additional information // regarding copyright ownership. Th...
code_fim
hard
{ "lang": "rust", "repo": "biaoma-ty/arrow-datafusion", "path": "/datafusion/core/src/physical_plan/udaf.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ernel::*; pub use {cache::*, run::*, selfupdate::*, validate::*};<|fim_prefix|>// repo: sax1johno/wasmer path: /src/commands.rs mod cache; #[cfg(all(target_os = "linux", feature = "loader-kernel"))] mod kernel; mod run; mod selfupdate; mod validate; #[cfg<|fim_middle|>(all(target_os = "linux", feature =...
code_fim
medium
{ "lang": "rust", "repo": "sax1johno/wasmer", "path": "/src/commands.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sax1johno/wasmer path: /src/commands.rs mod cache; #[cfg(all(target_os = "linux", feature = "loader-kern<|fim_suffix|>(all(target_os = "linux", feature = "loader-kernel"))] pub use kernel::*; pub use {cache::*, run::*, selfupdate::*, validate::*};<|fim_middle|>el"))] mod kernel; mod run; mod sel...
code_fim
medium
{ "lang": "rust", "repo": "sax1johno/wasmer", "path": "/src/commands.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xiyuera/rust_gui path: /src/draw.rs /*! things for drawing paths should be made with the `path!` macro because this is in most cases more efficient and simpler. */ use std::fmt::{self, Debug}; use primitives::Rect; use Color; //TODO: check num arguments in path macro #[macro_export] macro_rules...
code_fim
hard
{ "lang": "rust", "repo": "xiyuera/rust_gui", "path": "/src/draw.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// print a svg compatible path description impl<I:AsRef<[PathInstr]>, V:AsRef<[f32]>> Debug for Path<I, V>{ fn fmt(&self, f: &mut fmt::Formatter) -> Result<(), fmt::Error>{ let mut vi = self.vals.as_ref().iter(); macro_rules! tv(($i:ident)=>(match $i.next(){Some(e)=>e,_=>return Ok(())}.clone())); ...
code_fim
hard
{ "lang": "rust", "repo": "xiyuera/rust_gui", "path": "/src/draw.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 2d-rpg/card-playroom-server path: /src/schema.rs table! { belongings (id) { id -> Int4, deck_id -> Int4, card_id -> Int4, num -> Int4, } } <|fim_suffix|>table! { decks (id) { id -> Int4, name -> Varchar, } } joinable!(belongings -...
code_fim
medium
{ "lang": "rust", "repo": "2d-rpg/card-playroom-server", "path": "/src/schema.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>allow_tables_to_appear_in_same_query!( belongings, cards, decks, );<|fim_prefix|>// repo: 2d-rpg/card-playroom-server path: /src/schema.rs table! { belongings (id) { id -> Int4, deck_id -> Int4, card_id -> Int4, num -> Int4, } } table! { cards (id)...
code_fim
medium
{ "lang": "rust", "repo": "2d-rpg/card-playroom-server", "path": "/src/schema.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a, K: Ord, V> IntoIterator for &'a mut AvlMap<K, V> { type Item = (&'a K, &'a mut V); type IntoIter = AvlMapIter<&'a mut Box<Node<K, V>>>; fn into_iter(self) -> Self::IntoIter { self.iter_mut() } } impl<'a, K: Ord, V> IntoIterator for &'a AvlMap<K, V> { type Item = (&'a...
code_fim
hard
{ "lang": "rust", "repo": "Morgan-iv/avl-map", "path": "/src/map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Morgan-iv/avl-map path: /src/map.rs use crate::tree::Node; use crate::iter::AvlMapIter; use std::iter::IntoIterator; pub struct AvlMap<K: Ord, V> { pub(crate) root: Option<Box<Node<K, V>>>, pub(crate) size: usize, } impl<K: Ord, V> AvlMap<K, V> { pub fn new() -> Self { AvlM...
code_fim
hard
{ "lang": "rust", "repo": "Morgan-iv/avl-map", "path": "/src/map.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn into_iter(self) -> Self::IntoIter { self.iter_mut() } } impl<'a, K: Ord, V> IntoIterator for &'a AvlMap<K, V> { type Item = (&'a K, &'a V); type IntoIter = AvlMapIter<&'a Box<Node<K, V>>>; fn into_iter(self) -> Self::IntoIter { self.iter() } }<|fim_prefix|>// r...
code_fim
hard
{ "lang": "rust", "repo": "Morgan-iv/avl-map", "path": "/src/map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[tokio::main] async fn main() { let framework = StandardFramework::new() .configure(|c| c.prefix(".")) // set the bot's prefix to "~" .group(&GENERAL_GROUP); // Login with a bot token from the environment let token = env::var("DISCORD_TOKEN").expect("token"); let mut client = Client::builder(t...
code_fim
hard
{ "lang": "rust", "repo": "willdoescode/rust-discord-bot", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: willdoescode/rust-discord-bot path: /src/main.rs #![feature(array_map)] mod commands; use commands::{fun::*, help::*}; use serenity::async_trait; use serenity::client::{Client, Context, EventHandler}; use serenity::model::channel::{Message}; use serenity::model::prelude::{Ready}; use serenity::...
code_fim
medium
{ "lang": "rust", "repo": "willdoescode/rust-discord-bot", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[async_trait] impl EventHandler for Handler { async fn message(&self, _ctx: Context, msg: Message) { println!("{}: {}", msg.author.name, msg.content); } async fn ready(&self, _: Context, ready: Ready) { println!("{} is ready!", ready.user.name); } } #[tokio::main] async fn main() { let framewo...
code_fim
medium
{ "lang": "rust", "repo": "willdoescode/rust-discord-bot", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>toResponse { "hi!" } fn main() {}<|fim_prefix|>// repo: tokio-rs/axum path: /axum-macros/tests/debug_handler/pass/impl_into_response.rs use axum_macros::debug_handler; use axum::response::IntoResponse; #[debug_<|fim_middle|>handler] async fn handler() -> impl In
code_fim
easy
{ "lang": "rust", "repo": "tokio-rs/axum", "path": "/axum-macros/tests/debug_handler/pass/impl_into_response.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tokio-rs/axum path: /axum-macros/tests/debug_handler/pass/impl_into_response.rs use axum_macros::debug_handler; use a<|fim_suffix|>handler] async fn handler() -> impl IntoResponse { "hi!" } fn main() {}<|fim_middle|>xum::response::IntoResponse; #[debug_
code_fim
easy
{ "lang": "rust", "repo": "tokio-rs/axum", "path": "/axum-macros/tests/debug_handler/pass/impl_into_response.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Fold<Expr> for ExprInjector<'a> { fn fold(&mut self, expr: Expr) -> Expr { let expr = expr.fold_children(self); match expr { Expr::Call(CallExpr { callee: ExprOrSuper::Super(..), .. }) => { self.injected_...
code_fim
hard
{ "lang": "rust", "repo": "anurbol/swc", "path": "/ecmascript/transforms/src/util/constructor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anurbol/swc path: /ecmascript/transforms/src/util/constructor.rs use crate::util::prepend_stmts; use ast::*; use std::iter; use swc_common::{util::move_map::MoveMap, Fold, FoldWith, DUMMY_SP}; #[allow(clippy::vec_box)] pub(crate) fn inject_after_super(mut c: Constructor, exprs: Vec<Box<Expr>>) ...
code_fim
hard
{ "lang": "rust", "repo": "anurbol/swc", "path": "/ecmascript/transforms/src/util/constructor.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Fold<Class> for ExprInjector<'_> { fn fold(&mut self, c: Class) -> Class { let super_class = c.super_class.fold_with(self); Class { super_class, ..c } } } impl<'a> Fold<Expr> for ExprInjector<'a> { fn fold(&mut self, expr: Expr) -> Expr { let expr = expr.fold_chi...
code_fim
hard
{ "lang": "rust", "repo": "anurbol/swc", "path": "/ecmascript/transforms/src/util/constructor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/where-clauses/where-clause-placement-type-alias.rs // check-fail // Fine, but lints as unused type Foo where<|fim_suffix|>; //~^ ERROR where clauses are not allowed type Baz = () where; //~^ ERROR where clauses are not allowed fn main() {}<|fim_middle|> u32: Copy...
code_fim
easy
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/tests/ui/where-clauses/where-clause-placement-type-alias.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>; //~^ ERROR where clauses are not allowed type Baz = () where; //~^ ERROR where clauses are not allowed fn main() {}<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/where-clauses/where-clause-placement-type-alias.rs // check-fail // Fine, but lints as unused type Foo where<|fim_middle|> u32: Copy...
code_fim
easy
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/tests/ui/where-clauses/where-clause-placement-type-alias.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// This function connects all the actions from the provided `PackFileSettingsView` with their slots in `PackFileSettingsSlots`. /// /// This function is just glue to trigger after initializing both, the actions and the slots. It's here /// to not pollute the other modules with a ton of connections. pub u...
code_fim
medium
{ "lang": "rust", "repo": "Frodo45127/rpfm", "path": "/rpfm_ui/src/packedfile_views/packfile_settings/connections.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Frodo45127/rpfm path: /rpfm_ui/src/packedfile_views/packfile_settings/connections.rs //---------------------------------------------------------------------------// // Copyright (c) 2017-2023 Ismael Gutiérrez González. All rights reserved. // // This file is part of the Rusted PackFile Manager (...
code_fim
hard
{ "lang": "rust", "repo": "Frodo45127/rpfm", "path": "/rpfm_ui/src/packedfile_views/packfile_settings/connections.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jameslaydigital/jld_glium path: /src/main.rs #[macro_use] extern crate glium; extern crate image; use glium::{glutin, Surface}; use std::io::Cursor; mod teapot; //teapot.rs// // DEFINE VERTEX STRUCT {{{ #[derive(Copy, Clone)] struct Vertex { position: [f32; 2], tex_coords: [f32; 2], } i...
code_fim
hard
{ "lang": "rust", "repo": "jameslaydigital/jld_glium", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let program = glium::Program::from_source( &display, vertex_shader_src, fragment_shader_src, None ).unwrap(); // }}} // RENDER LOOP {{{ let mut t: f32 = -0.5; let mut closed = false; while closed == false { t = if t >= 0.5 { ...
code_fim
hard
{ "lang": "rust", "repo": "jameslaydigital/jld_glium", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> target.finish().unwrap(); events_loop.poll_events(|ev| { match ev { glutin::Event::WindowEvent{event, ..} => match event { glutin::WindowEvent::Closed => { closed = true; println!("Closed"); ...
code_fim
hard
{ "lang": "rust", "repo": "jameslaydigital/jld_glium", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut escaped = false; let mut len: usize = 1; let mut dollar = false; loop { let c = context.next(); if c == '\0' { return Option::None; } len += 1; if escaped { escaped = false; } else { match c { '`' => return Option::Some(( (if left_open { to...
code_fim
medium
{ "lang": "rust", "repo": "davidaq/rust-babeljs", "path": "/src/syntax/tokenize/rule_tplstr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: davidaq/rust-babeljs path: /src/syntax/tokenize/rule_tplstr.rs use syntax::tokenize::token_type; use syntax::tokenize::context::Context; pub fn all (context: &mut Context) -> Option<( u16, u32, usize )> { match context.next() { '`' => read_tpl(context, false), '}' => { let is_tp...
code_fim
medium
{ "lang": "rust", "repo": "davidaq/rust-babeljs", "path": "/src/syntax/tokenize/rule_tplstr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kpfromer/javascript-interpreter-rust path: /src/parser.rs use crate::ast::*; use crate::lexer::*; use std::mem; pub struct Parser<'a> { pub lexer: Lexer<'a>, } impl<'a> Parser<'a> { // fn eat<T: TokenKind>(&self mut, TokenKind kind) -> T { // if let T = // } // Literals pub fn n...
code_fim
hard
{ "lang": "rust", "repo": "kpfromer/javascript-interpreter-rust", "path": "/src/parser.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // let NAME = EXPR ; pub fn letStatement(&mut self) -> Stmt { if let TokenKind::Id(value) = self.lexer.getNextToken().kind { if value == "let" { let name = self.name(); assert_eq!(self.lexer.getNextToken().kind, TokenKind::Equal); let stmt = Stmt::Let(name, self.addSu...
code_fim
hard
{ "lang": "rust", "repo": "kpfromer/javascript-interpreter-rust", "path": "/src/parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Statements pub fn name(&mut self) -> Name { let token = self.lexer.getNextToken(); if let TokenKind::Id(value) = token.kind { return Name { value }; } println!("Invalid {:?}", token); panic!(); } // let NAME = EXPR ; pub fn letStatement(&mut self) -> Stmt { if l...
code_fim
hard
{ "lang": "rust", "repo": "kpfromer/javascript-interpreter-rust", "path": "/src/parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: meafs/rust path: /src/test/rustdoc/issue-53812.rs pub trait MyIterator { } pub struct MyStruct<T>(T); macro_rules! array_impls { ($($N:expr)+) => { $( impl<'a, T> MyIterator for &'a MyStruct<[T;<|fim_suffix|>@id="implementors-list"]/details[2]/summary/h3' 'MyStruct<[T; ...
code_fim
medium
{ "lang": "rust", "repo": "meafs/rust", "path": "/src/test/rustdoc/issue-53812.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>mplementors-list"]/details[4]/summary/h3' 'MyStruct<[T; 3]>' // @has - '//*[@id="implementors-list"]/details[5]/summary/h3' 'MyStruct<[T; 10]>' array_impls! { 10 3 2 1 0 }<|fim_prefix|>// repo: meafs/rust path: /src/test/rustdoc/issue-53812.rs pub trait MyIterator { } pub struct MyStruct<T>(T); macro_r...
code_fim
medium
{ "lang": "rust", "repo": "meafs/rust", "path": "/src/test/rustdoc/issue-53812.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jetbrains-academy/rustlings-course path: /Generic Types, Traits, and Lifetime/Traits/Trait Bound Syntax/src/lib.rs use std::fmt::Display; pub struct ReportCard<T: Display> { pub grade: T, p<|fim_suffix|> { pub fn print(&self) -> String { format!("{} ({}) - achieved a grade o...
code_fim
medium
{ "lang": "rust", "repo": "jetbrains-academy/rustlings-course", "path": "/Generic Types, Traits, and Lifetime/Traits/Trait Bound Syntax/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>of {}", &self.student_name, &self.student_age, &self.grade) } }<|fim_prefix|>// repo: jetbrains-academy/rustlings-course path: /Generic Types, Traits, and Lifetime/Traits/Trait Bound Syntax/src/lib.rs use std::fmt::Display; pub struct ReportCard<T: Display> { pub grade: T, p<...
code_fim
medium
{ "lang": "rust", "repo": "jetbrains-academy/rustlings-course", "path": "/Generic Types, Traits, and Lifetime/Traits/Trait Bound Syntax/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }