text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>/// Return true with probability p. pub fn do_with_probability(p: f64) -> bool { random::<f64>() <= p }<|fim_prefix|>// repo: dirvine/ewok path: /src/random.rs use rand::{self, weak_rng, XorShiftRng, Rand, Rng}; use std::cell::RefCell; thread_local! { static WEAK_RNG: RefCell<XorShiftRng> = RefC...
code_fim
hard
{ "lang": "rust", "repo": "dirvine/ewok", "path": "/src/random.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dirvine/ewok path: /src/random.rs use rand::{self, weak_rng, XorShiftRng, Rand, Rng}; use std::cell::RefCell; thread_local! { static WEAK_RNG: RefCell<XorShiftRng> = RefCell::new(weak_rng()); } /// Random value from the thread-local weak RNG. pub fn random<T: Rand>() -> T { WEAK_RNG.wi...
code_fim
medium
{ "lang": "rust", "repo": "dirvine/ewok", "path": "/src/random.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> DeviceUpdate::new() .add_peers(&updates) .apply(self.interface, self.backend)?; let start = Instant::now(); while start.elapsed() < STEP_INTERVAL { self.refresh_remaining()?; if self.is_finished() { log::debug!("NAT t...
code_fim
hard
{ "lang": "rust", "repo": "Honos2014/innernet", "path": "/client/src/nat.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let start = Instant::now(); while start.elapsed() < STEP_INTERVAL { self.refresh_remaining()?; if self.is_finished() { log::debug!("NAT traverser is finished!"); break; } std::thread::sleep(Duration::from_milli...
code_fim
hard
{ "lang": "rust", "repo": "Honos2014/innernet", "path": "/client/src/nat.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Honos2014/innernet path: /client/src/nat.rs //! ICE-like NAT traversal logic. //! //! Doesn't follow the specific ICE protocol, but takes great inspiration from RFC 8445 //! and applies it to a protocol more specific to innernet. use std::time::{Duration, Instant}; use anyhow::Error; use share...
code_fim
hard
{ "lang": "rust", "repo": "Honos2014/innernet", "path": "/client/src/nat.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: viggin543/my_rust_workspace path: /learn-rust/src/bin/boxes_smart_pointers/main.rs mod custom_list; mod custom_pointer; mod cyclic_ref_mem_leak; mod mocking_mock_all; mod mutable_list_many_mutators; mod ref_cell_inner_mutability; mod weak_ref_tree; <|fim_suffix|> custom_list::print_a_list();...
code_fim
easy
{ "lang": "rust", "repo": "viggin543/my_rust_workspace", "path": "/learn-rust/src/bin/boxes_smart_pointers/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> custom_list::print_a_list(); }<|fim_prefix|>// repo: viggin543/my_rust_workspace path: /learn-rust/src/bin/boxes_smart_pointers/main.rs mod custom_list; mod custom_pointer; mod cyclic_ref_mem_leak; mod mocking_mock_all; mod mutable_list_many_mutators; mod ref_cell_inner_mutability; mod weak_ref_tree;...
code_fim
easy
{ "lang": "rust", "repo": "viggin543/my_rust_workspace", "path": "/learn-rust/src/bin/boxes_smart_pointers/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cprohoda/diesel_minimal_reproduction path: /src/schema.rs table! { use diesel::sql_types::*; us<|fim_suffix|> id -> Int4, my_things -> Nullable<Array<Thing>>, a_thing -> Thing, } }<|fim_middle|>e crate::types::*; things (id) {
code_fim
easy
{ "lang": "rust", "repo": "cprohoda/diesel_minimal_reproduction", "path": "/src/schema.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> id -> Int4, my_things -> Nullable<Array<Thing>>, a_thing -> Thing, } }<|fim_prefix|>// repo: cprohoda/diesel_minimal_reproduction path: /src/schema.rs table! { use diesel::sql_types::*; us<|fim_middle|>e crate::types::*; things (id) {
code_fim
easy
{ "lang": "rust", "repo": "cprohoda/diesel_minimal_reproduction", "path": "/src/schema.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thenozzl3/oddsandends path: /rust_things/aoc2015/day7/src/main.rs use std::fs::File; use std::io::BufRead; use std::io::BufReader; use std::str::FromStr; use std::collections::HashMap; fn main() { let mut registers:HashMap<String,u32> = HashMap::new(); let mut overrides:HashMap<String,u32...
code_fim
hard
{ "lang": "rust", "repo": "thenozzl3/oddsandends", "path": "/rust_things/aoc2015/day7/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> //im op reg -> reg } else { if registers.contains_key(elts[2]) { registers.insert( String::from_str(elts[4]).unwrap(), do_op( elts[1], &val, registers.get(e...
code_fim
hard
{ "lang": "rust", "repo": "thenozzl3/oddsandends", "path": "/rust_things/aoc2015/day7/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> } registers.insert(String::from_str(elts[2]).unwrap(), val); current_line.clear(); //im op reg -> reg } else { if registers.contains_key(elts[2]) { registers.insert( String::from_str(elts[4])...
code_fim
hard
{ "lang": "rust", "repo": "thenozzl3/oddsandends", "path": "/rust_things/aoc2015/day7/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `DEBNC1` writer - Debouncer Enable 1"] pub struct DEBNC1_W<'a> { w: &'a mut W, } impl<'a> DEBNC1_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the field b...
code_fim
hard
{ "lang": "rust", "repo": "atsamd-rs/atsamd", "path": "/pac/atsamd51n/src/rtc/mode2/tampctrl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: atsamd-rs/atsamd path: /pac/atsamd51n/src/rtc/mode2/tampctrl.rs self.bits(variant.into()) } #[doc = "Off (Disabled)"] #[inline(always)] pub fn off(self) -> &'a mut W { self.variant(IN1ACT_A::OFF) } #[doc = "Wake without timestamp"] #[inline(always)] pub f...
code_fim
hard
{ "lang": "rust", "repo": "atsamd-rs/atsamd", "path": "/pac/atsamd51n/src/rtc/mode2/tampctrl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `TAMLVL4` writer - Tamper Level Select 4"] pub struct TAMLVL4_W<'a> { w: &'a mut W, } impl<'a> TAMLVL4_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears the f...
code_fim
hard
{ "lang": "rust", "repo": "atsamd-rs/atsamd", "path": "/pac/atsamd51n/src/rtc/mode2/tampctrl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bitex-la/tiny_ram_db path: /tests/lib.rs extern crate tiny_ram_db; extern crate error_chain; use std::string::ToString; use std::thread; use std::time::Instant; use tiny_ram_db::{Index, Indexer, Record, Table, PlainTable}; use tiny_ram_db::errors::*; struct Author { name: String, } impl Au...
code_fim
hard
{ "lang": "rust", "repo": "bitex-la/tiny_ram_db", "path": "/tests/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn obtain_data() { obtain_data_result().expect("Error") } fn obtain_data_result() -> Result<()> { let start = Instant::now(); let db = create_db()?; println!("DB Creation took {:?}", start.elapsed()); let a_post = db.posts.find(400000)?; println!("A post text is: {}", &a_p...
code_fim
hard
{ "lang": "rust", "repo": "bitex-la/tiny_ram_db", "path": "/tests/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaj/rsass path: /rsass/tests/spec/directives/forward/with/multi_load.rs //! Tests auto-converted from "sass-spec/spec/directives/forward/with/multi_load.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { super::runner() .with_cwd("multi_load") .mock_file("forward/_mids...
code_fim
hard
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/directives/forward/with/multi_load.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let runner = runner().with_cwd("forward"); assert_eq!( runner.ok("@forward \"upstream\" with ($a: configured);\ \n@use \"midstream\";\ \nb {c: midstream.$a}\n"), "b {\ \n c: configured;\ \n}\n" ); } #[test] fn transitive() { let ...
code_fim
medium
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/directives/forward/with/multi_load.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let runner = runner().with_cwd("use"); assert_eq!( runner.ok("@forward \"upstream\" with ($a: configured);\ \n@use \"midstream\";\n"), "b {\ \n c: configured;\ \n}\n" ); }<|fim_prefix|>// repo: kaj/rsass path: /rsass/tests/spec/directives/forwar...
code_fim
hard
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/directives/forward/with/multi_load.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let user_record: SlackUser = match existing_user { Ok(user) => { user }, _ => { // Insert new user and return that record. diesel::insert_into(slack_users) .values(slack_id.eq(user_id)) .execute(conn) ...
code_fim
hard
{ "lang": "rust", "repo": "Checkroth/rsv-eschatologist", "path": "/src/action/alias.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Checkroth/rsv-eschatologist path: /src/action/alias.rs extern crate slack; use super::slackaction::SlackAction; use super::DBConnection; use super::models::{SlackUser, UserAlias}; use super::schema::slack_users::dsl::*; use super::schema::slack_users::dsl::id as slack_users_id; // for unamibigu...
code_fim
hard
{ "lang": "rust", "repo": "Checkroth/rsv-eschatologist", "path": "/src/action/alias.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let message_split: Vec<&str> = text.split(" remove ").collect(); let alias: &str = match message_split.get(1) { Some(alias) => { alias }, _ => { return Some(String::from("Alias not provided")) } }; // Check if alias exists let existing_alias ...
code_fim
hard
{ "lang": "rust", "repo": "Checkroth/rsv-eschatologist", "path": "/src/action/alias.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matsutake-eg/atcoder path: /rust/typical90/src/bin/008.rs #![allow(unused_imports)] use itertools::Itertools; use itertools_num::ItertoolsNum as _; use num_integer::*; use petgraph::*; use proconio::{fastout, input, marker::*}; use std::cmp::*; use std::collections::*; use std::f64::consts::*; u...
code_fim
hard
{ "lang": "rust", "repo": "matsutake-eg/atcoder", "path": "/rust/typical90/src/bin/008.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<T> MulAssign<ModInt<T>> for ModInt<T> where T: Copy, ModInt<T>: Mul<ModInt<T>, Output = ModInt<T>>, { fn mul_assign(&mut self, rhs: ModInt<T>) { *self = *self * rhs; } } impl<T> Div<T> for ModInt<T> where T: Copy + Add<Output = T> + Sub<Output = T> ...
code_fim
hard
{ "lang": "rust", "repo": "matsutake-eg/atcoder", "path": "/rust/typical90/src/bin/008.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sindrsh/tens path: /src/elements.rs use crate::prelude::*; pub fn figs1() -> [Texture2D; 9] { let fig1 = Texture2D::from_file_with_format( include_bytes!("../assets/fig1.png"), Some(ImageFormat::Png)); let fig2 = Texture2D::from_file_with_format( include_bytes!("../asset...
code_fim
hard
{ "lang": "rust", "repo": "sindrsh/tens", "path": "/src/elements.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let fig1 = Texture2D::from_file_with_format( include_bytes!("../assets/fig100.png"), Some(ImageFormat::Png)); let fig2 = Texture2D::from_file_with_format( include_bytes!("../assets/fig200.png"), Some(ImageFormat::Png)); let fig4 = Texture2D::from_file_with_format( include_...
code_fim
hard
{ "lang": "rust", "repo": "sindrsh/tens", "path": "/src/elements.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaj/rsass path: /rsass/tests/spec/values/numbers/divide/slash_free/variable.rs //! Tests auto-converted from "sass-spec/spec/values/numbers/divide/slash_free/variable.hrx" #[allow(unused)] fn runner() -> crate::TestRunner { super::runner() .with_cwd("variable") .mock_file( ...
code_fim
hard
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/values/numbers/divide/slash_free/variable.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn forward_with() { let runner = runner().with_cwd("forward_with"); assert_eq!( runner.ok("@use \"midstream\";\n"), "b {\ \n c: 0.5;\ \n}\n" ); } #[test] fn local() { let runner = runner().with_cwd("local"); assert_eq!( runner.ok("$a: ...
code_fim
hard
{ "lang": "rust", "repo": "kaj/rsass", "path": "/rsass/tests/spec/values/numbers/divide/slash_free/variable.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>AD_ADDRESS: i32 = 0x0_0940; const OVERWORLD_AFTER_JOYPAD_ADDRESS: i32 = 0x25_6712; // in HandleMapTimeAndJoypad const PLAYER_EVENTS_ADDRESS: i32 = 0x25_675e; // PlayerEvents const PLAYER_SCRIPT_RUNNING_MEM_ADDRESS: u16 = 0xd15f; // wScriptRunning const PLAYER_EVENTS_SEEN_BY_TRAINER...
code_fim
hard
{ "lang": "rust", "repo": "entrpntr/mon-tas-gen", "path": "/src/rom.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ER+RAM+BATTERY"; const GENERATION: Generation = Generation::Gen2; } #[allow(dead_code)] pub enum Silver {} impl BasicRomInfo for Silver { const ROM_FILE_NAME: &'static str = "roms/silver.gbc"; const GAME_NAME: &'static str = "Pokemon - Silver Version (USA, Europe)"; const SHA1: &'static str = "49B...
code_fim
hard
{ "lang": "rust", "repo": "entrpntr/mon-tas-gen", "path": "/src/rom.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: entrpntr/mon-tas-gen path: /src/rom.rs i32; // CheckMenuOW.Select const PLAYER_EVENTS_NO_EVENTS_ADDRESS: i32; // PlayerEvents.noEvents const PLAYER_DIRECTION_MEM_ADDRESS: u16; // wPlayerDirection } pub trait InputIdentificationAddresses { const II_ADDRESSES: &'static [(i32, i32, i32, &'st...
code_fim
hard
{ "lang": "rust", "repo": "entrpntr/mon-tas-gen", "path": "/src/rom.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(dead_code)] pub struct Object { pub pos : [f32;3], pub orientation : [f32;4], pub scale : f32, pub draw : bool, pub model : Option<Model>, }<|fim_prefix|>// repo: alexjgriffith/landmass path: /src/model/object.rs implement_vertex!(Verte...
code_fim
hard
{ "lang": "rust", "repo": "alexjgriffith/landmass", "path": "/src/model/object.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alexjgriffith/landmass path: /src/model/object.rs implement_vertex!(Vertex, position); implement_vertex!(Normal, normal); #[derive(Debug,Clone,Copy)] pub struct Vertex { pub position: (f32,f32,f32) } <|fim_suffix|>#[derive(Debug,Clone)] pub struct Model{ pub vertices : Vec<Vertex>, ...
code_fim
hard
{ "lang": "rust", "repo": "alexjgriffith/landmass", "path": "/src/model/object.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: psoc-rs/psoc6-pac path: /src/ble/blell/adv_config.rs #[doc = "Register `ADV_CONFIG` reader"] pub struct R(crate::R<ADV_CONFIG_SPEC>); impl core::ops::Deref for R { type Target = crate::R<ADV_CONFIG_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 ...
code_fim
hard
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/ble/blell/adv_config.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>terrupt."] #[inline(always)] pub fn adv_scn_req_rx_en(&mut self) -> ADV_SCN_REQ_RX_EN_W<4> { ADV_SCN_REQ_RX_EN_W::new(self) } #[doc = "Bit 5 - Enable connect request packet received interrupt."] #[inline(always)] pub fn adv_conn_req_rx_en(&mut self) -> ADV_CONN_REQ_R...
code_fim
hard
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/ble/blell/adv_config.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_shift_only() { let input = "382253568 723152896 37802240 379425024 404894720 471526144"; let mut numbers: Vec<u64> = input.split_whitespace().map(|s| s.parse::<u64>().ok().unwrap()).collect(); let mut counter = 0; while is_all_even(&numbers) { ...
code_fim
hard
{ "lang": "rust", "repo": "UseK/atcoder-rust", "path": "/src/beginners_selection/shift_only.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: UseK/atcoder-rust path: /src/beginners_selection/shift_only.rs fn count_shift(numbers: &Vec<u64>) -> usize { let mut cloned = numbers.clone(); let mut counter = 0; while is_all_even(&cloned) { counter += 1; cloned = cloned.iter().map(|x| x / 2).collect(); } co...
code_fim
hard
{ "lang": "rust", "repo": "UseK/atcoder-rust", "path": "/src/beginners_selection/shift_only.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marionebl/rust-hal-reversor path: /src/main.rs mod lib; use lib::reversor; use std::env; <|fim_suffix|> let args = env::args().skip(1); match args.len() { 0 => { eprintln!("requires 1 arguments, received 0"); std::process::exit(1) }, _ =>...
code_fim
easy
{ "lang": "rust", "repo": "marionebl/rust-hal-reversor", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match args.len() { 0 => { eprintln!("requires 1 arguments, received 0"); std::process::exit(1) }, _ => { args.for_each(|w| { print!("{} ", reversor(&w)); }) } } }<|fim_prefix|>// repo: marionebl/rust-ha...
code_fim
easy
{ "lang": "rust", "repo": "marionebl/rust-hal-reversor", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn solve(&self) -> Result<(Answers, Duration)> { let input = self.read_to_string(self.input_filename)?; let t = Instant::now(); let answers = (self.solver)(input)?; let duration = t.elapsed(); Ok((answers, duration)) } ...
code_fim
hard
{ "lang": "rust", "repo": "letheed/aoc", "path": "/rust/src/common.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: letheed/aoc path: /rust/src/common.rs use std::result::Result as StdResult; use lazy_static::lazy_static; pub use self::{date::Date, day::Day, puzzle::Puzzle, puzzles::Puzzles, year::Year, year_puzzles::YearPuzzles}; pub type Answer = String; pub type Result<T = Answers> = StdResult<T, anyhow...
code_fim
hard
{ "lang": "rust", "repo": "letheed/aoc", "path": "/rust/src/common.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> impl YearPuzzles { #[inline] pub(crate) const fn new(year: Year, puzzles: &'static [Option<Puzzle>; 25]) -> Self { Self { year, puzzles } } #[inline] #[must_use] pub const fn year(self) -> Year { self.year } #[in...
code_fim
hard
{ "lang": "rust", "repo": "letheed/aoc", "path": "/rust/src/common.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Not all sudokus can be solved with elimination. // Others need trial and error. Rekursive or try flat? // If no number fits, -> impossible /* /// This is the program entry point to a /// program that prints "Hello, World". fn main() { /* This is a comment that says "Prints "Hello World"" */ ...
code_fim
hard
{ "lang": "rust", "repo": "Julian-Wollersberger/sudoku_solver", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Julian-Wollersberger/sudoku_solver path: /src/main.rs use crate::csv_parser::parse_csv; use crate::csv_parser::EXAMPLE; use crate::solver::sudoku_solver::solve_sudoku; <|fim_suffix|> let sudoku = parse_csv(EXAMPLE.into()).expect("Parsing failed"); println!("Unsolved sudoku: {}", sudoku);...
code_fim
medium
{ "lang": "rust", "repo": "Julian-Wollersberger/sudoku_solver", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/* /// This is the program entry point to a /// program that prints "Hello, World". fn main() { /* This is a comment that says "Prints "Hello World"" */ // Prints "Hello World" println!("Hello, World"); } */<|fim_prefix|>// repo: Julian-Wollersberger/sudoku_solver path: /src/main.rs use crate...
code_fim
hard
{ "lang": "rust", "repo": "Julian-Wollersberger/sudoku_solver", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match self { Reg(reg) => Debug::fmt(reg, f), Cst(cst) => write!(f, "#{:?}", cst), Mem(mem) => write!(f, "{}", mem), Ref(reg) => write!(f, "*{:?}", reg), Idx(arr, idx) => write!(f, "{}({:?})", arr, idx), } } } pub enum Code { ...
code_fim
medium
{ "lang": "rust", "repo": "ivfranco/notes", "path": "/Dragon_Book/chapter_8/tree_rewrite/src/machine_code.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ivfranco/notes path: /Dragon_Book/chapter_8/tree_rewrite/src/machine_code.rs use super::{BinOp, Cst, Mem, Reg, Var}; use std::fmt::{self, Debug, Formatter}; #[derive(Clone, Copy)] pub enum Addr { Reg(Reg), Cst(Cst), Mem(Mem), Ref(Reg), Idx(Var, Reg), } impl Debug for Addr {...
code_fim
hard
{ "lang": "rust", "repo": "ivfranco/notes", "path": "/Dragon_Book/chapter_8/tree_rewrite/src/machine_code.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(clippy::len_without_is_empty)] impl Binary { pub fn new(codes: Vec<Code>) -> Self { Binary { codes } } pub fn len(&self) -> usize { self.codes.len() } } impl Debug for Binary { fn fmt(&self, f: &mut Formatter) -> Result<(), fmt::Error> { for code in &s...
code_fim
hard
{ "lang": "rust", "repo": "ivfranco/notes", "path": "/Dragon_Book/chapter_8/tree_rewrite/src/machine_code.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Phala-Network/phala-blockchain path: /vendor/ring/src/io/der_writer.rs // Copyright 2018 Brian Smith. // // Permission to use, copy, modify, and/or distribute this software for any // purpose with or without fee is hereby granted, provided that the above // copyright notice and this permission n...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/phala-blockchain", "path": "/vendor/ring/src/io/der_writer.rs", "mode": "psm", "license": "OpenSSL", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) fn write_all(tag: Tag, write_value: &dyn Fn(&mut dyn Accumulator)) -> Box<[u8]> { let length = { let mut length = LengthMeasurement::zero(); write_tlv(&mut length, tag, write_value); length }; let mut output = Writer::with_capacity(length); write_tlv(&mu...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/phala-blockchain", "path": "/vendor/ring/src/io/der_writer.rs", "mode": "spm", "license": "OpenSSL", "source": "the-stack-v2" }
<|fim_suffix|>pub fn config_read<S: Storage>(storage: &S) -> ReadonlySingleton<S, Config> { singleton_read(storage, CONFIG_KEY) } #[derive(Serialize, Deserialize, Clone, Debug, PartialEq, JsonSchema)] pub struct LastWinner { pub address: CanonicalAddr, pub pot_amount: Uint128, } pub fn last_winner<S: Stor...
code_fim
medium
{ "lang": "rust", "repo": "csanti/lucky-terran", "path": "/src/state.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: csanti/lucky-terran path: /src/state.rs use schemars::JsonSchema; use serde::{Deserialize, Serialize}; use cosmwasm_std::{CanonicalAddr, Storage, Uint128}; use cosmwasm_storage::{singleton, singleton_read, ReadonlySingleton, Singleton}; <|fim_suffix|>#[derive(Serialize, Deserialize, Clone, Deb...
code_fim
hard
{ "lang": "rust", "repo": "csanti/lucky-terran", "path": "/src/state.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn last_winner<S: Storage>(storage: &mut S) -> Singleton<S, LastWinner> { singleton(storage, LAST_WINNER_KEY) } pub fn last_winner_read<S: Storage>(storage: &S) -> ReadonlySingleton<S, LastWinner> { singleton_read(storage, LAST_WINNER_KEY) }<|fim_prefix|>// repo: csanti/lucky-terran path: /s...
code_fim
hard
{ "lang": "rust", "repo": "csanti/lucky-terran", "path": "/src/state.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) } fn run() -> Res<()> { use parsers::lisp::LispProgram; let it = "(f (h 1 2) (g 3 4 5))"; dump!(it.parsed::<LispProgram>()); Ok(()) }<|fim_prefix|>// repo: phenguin/hue path: /src/main.rs #![feature(proc_macro)] #![feature(log_syntax)] #![recursion_limit = "1024"] #![feature...
code_fim
medium
{ "lang": "rust", "repo": "phenguin/hue", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phenguin/hue path: /src/main.rs #![feature(proc_macro)] #![feature(log_syntax)] #![recursion_limit = "1024"] #![feature(try_from)] #![feature(core_intrinsics)] #![allow(dead_code)] #![feature(trace_macros)] #[macro_use] extern crate error_chain; #[macro_use] extern crate pest_derive; #[allow(u...
code_fim
hard
{ "lang": "rust", "repo": "phenguin/hue", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(dead_code)] fn run2() -> Res<()> { Ok(()) } fn run() -> Res<()> { use parsers::lisp::LispProgram; let it = "(f (h 1 2) (g 3 4 5))"; dump!(it.parsed::<LispProgram>()); Ok(()) }<|fim_prefix|>// repo: phenguin/hue path: /src/main.rs #![feature(proc_macro)] #![feature(log_synta...
code_fim
hard
{ "lang": "rust", "repo": "phenguin/hue", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tspooner/rstat path: /src/univariate/kumaraswamy.rs use crate::{ statistics::{Modes, Quantiles, ShannonEntropy, UvMoments}, ContinuousDistribution, Distribution, Probability, Univariate, }; use rand; use spaces::intervals::Closed; use std::fmt; #[inline] fn harmonic_n(n: usi...
code_fim
hard
{ "lang": "rust", "repo": "tspooner/rstat", "path": "/src/univariate/kumaraswamy.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Probability::new_unchecked(1.0 - (1.0 - x.powf(a)).powf(b)) } fn sample<R: rand::Rng + ?Sized>(&self, rng: &mut R) -> f64 { let x = crate::univariate::uniform::Uniform::<f64>::default().sample(rng); let (a, b) = get_params!(self); (1.0f64 - (1.0 - x).powf(1.0 / b)...
code_fim
hard
{ "lang": "rust", "repo": "tspooner/rstat", "path": "/src/univariate/kumaraswamy.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let m1 = self.moment_n(1); self.moment_n(2) - m1 * m1 } fn skewness(&self) -> f64 { let m3 = self.moment_n(3); let var = self.variance(); let mean = self.mean(); (m3 - 3.0 * mean * var - mean.powi(3)) / var.powf(3.0 / 2.0) } fn excess_kur...
code_fim
hard
{ "lang": "rust", "repo": "tspooner/rstat", "path": "/src/univariate/kumaraswamy.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ry/tokio path: /tokio-current-thread/src/lib.rs ed either successfully or with an /// error. The result of the future is then returned from this function /// call. /// /// Note that this function will **also** execute any spawned futures on the /// current thread, but will **...
code_fim
hard
{ "lang": "rust", "repo": "ry/tokio", "path": "/tokio-current-thread/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ry/tokio path: /tokio-current-thread/src/lib.rs not use this crate directly. Instead, they will use the //! `tokio` crate. Library authors should only depend on `tokio-current-thread` if they //! are building a custom task executor. //! //! For more details, see [executor module] documentation ...
code_fim
hard
{ "lang": "rust", "repo": "ry/tokio", "path": "/tokio-current-thread/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // NOTE: += 2 since LSB is the shutdown bit let pending = self.num_futures.fetch_add(2, atomic::Ordering::SeqCst); if pending % 2 == 1 { // Bring the count back so we still know when the Runtime is idle. self.num_futures.fetch_sub(2, atomic::Ordering::SeqCst...
code_fim
hard
{ "lang": "rust", "repo": "ry/tokio", "path": "/tokio-current-thread/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Kryndex/hat-backup path: /src/key/index.rs // Copyright 2014 Google Inc. All rights reserved. // // 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....
code_fim
hard
{ "lang": "rust", "repo": "Kryndex/hat-backup", "path": "/src/key/index.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> id_: u64, last_modified: Option<u64>, hash_opt: Option<hash::Hash>, hash_ref_opt: Option<hash::tree::HashRef>) -> Result<(), DieselError> { use super::schema::keys::dsl::*; ...
code_fim
hard
{ "lang": "rust", "repo": "Kryndex/hat-backup", "path": "/src/key/index.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if last_modified.is_some() { try!(diesel::update(keys.find(id_) .filter(modified.eq::<Option<i64>>(None) .or(modified.le(last_modified.map(|u| u as i64))))) .set((hash.eq(hash_bytes), hash_ref.eq(hash_ref_bytes))) ...
code_fim
hard
{ "lang": "rust", "repo": "Kryndex/hat-backup", "path": "/src/key/index.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mm0205/aizu-rust path: /src/itp1_5/mod.rs //! ITP1_5_Xの回答 //! [https://judge.u-aizu.ac.jp<|fim_suffix|>TP1) pub mod a; pub mod b; pub mod c; pub mod d;<|fim_middle|>/onlinejudge/finder.jsp?course=ITP1](https://judge.u-aizu.ac.jp/onlinejudge/finder.jsp?course=I
code_fim
medium
{ "lang": "rust", "repo": "mm0205/aizu-rust", "path": "/src/itp1_5/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mm0205/aizu-rust path: /src/itp1_5/mod.rs //! ITP1_5_Xの回答 //! [https://judge.u-aizu.ac.jp/onlinejudge/finder.jsp?course=ITP1](https://jud<|fim_suffix|>TP1) pub mod a; pub mod b; pub mod c; pub mod d;<|fim_middle|>ge.u-aizu.ac.jp/onlinejudge/finder.jsp?course=I
code_fim
easy
{ "lang": "rust", "repo": "mm0205/aizu-rust", "path": "/src/itp1_5/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>TP1) pub mod a; pub mod b; pub mod c; pub mod d;<|fim_prefix|>// repo: mm0205/aizu-rust path: /src/itp1_5/mod.rs //! ITP1_5_Xの回答 //! [https://judge.u-aizu.ac.jp/onlinejudge/finder.jsp?course=ITP1](https://jud<|fim_middle|>ge.u-aizu.ac.jp/onlinejudge/finder.jsp?course=I
code_fim
easy
{ "lang": "rust", "repo": "mm0205/aizu-rust", "path": "/src/itp1_5/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn tera(&self) -> Tera { let mut tera = self.tera.clone(); if CONFIG.env.as_str() == "development" { match tera.full_reload() { Ok(_) => tracing::info!("Tera templates reloaded successfully!"), Err(e) => tracing::error!("Failed to reload ...
code_fim
hard
{ "lang": "rust", "repo": "dhruvasagar/url-mapper-rs", "path": "/src/server/state.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dhruvasagar/url-mapper-rs path: /src/server/state.rs use crate::{config::CONFIG, db::Message}; use anyhow::Result; use tera::Tera; use tokio::sync::mpsc::Sender; #[derive(Debug)] pub struct State { db_sender: Sender<Message>, tera: Tera, } <|fim_suffix|> pub fn tera(&self) -> Tera {...
code_fim
hard
{ "lang": "rust", "repo": "dhruvasagar/url-mapper-rs", "path": "/src/server/state.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Urgau/rsix path: /src/const_assert.rs /// A simple `assert` macro that works in `const fn`, for use until the /// standard `assert` macro works in `const fn`. #[allow(unused_macros)] macro_rules! con<|fim_suffix|> as usize]; }; } #[test] fn test_const_assert() { const_assert!(true); }<|...
code_fim
medium
{ "lang": "rust", "repo": "Urgau/rsix", "path": "/src/const_assert.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>st_assert { ($x:expr) => { let b: bool = $x; let _ = [()][!b as usize]; }; } #[test] fn test_const_assert() { const_assert!(true); }<|fim_prefix|>// repo: Urgau/rsix path: /src/const_assert.rs /// A simple `assert` macro that works in `const fn`, for use until the /// stan<|f...
code_fim
medium
{ "lang": "rust", "repo": "Urgau/rsix", "path": "/src/const_assert.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AlfredZKY/learn_rust path: /src/fileop.rs extern crate bit_set; extern crate rand; extern crate time; use bit_set::BitSet; use rand::Rng; use std::fs::File; use std::io; use std::io::prelude::*; use std::io::BufReader; use time::*; // 生成1千万的随机数 pub fn init() { const FILE_NAME: &'static str ...
code_fim
hard
{ "lang": "rust", "repo": "AlfredZKY/learn_rust", "path": "/src/fileop.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn set_bit(byte: &mut Vec<u32>, n: u32) { byte[(n / 32) as usize] |= 1 << (n % 32); // 设置 } fn get_bit(byte: &mut Vec<u32>, n: u32) -> u32 { return (byte[(n / 32) as usize] & (1 << (n % 32))); }<|fim_prefix|>// repo: AlfredZKY/learn_rust path: /src/fileop.rs extern crate bit_set; extern crate ra...
code_fim
hard
{ "lang": "rust", "repo": "AlfredZKY/learn_rust", "path": "/src/fileop.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: distransient/amethyst-rhusics path: /src/pick.rs use amethyst_core::GlobalTransform; use amethyst_core::cgmath::{EuclideanSpace, InnerSpace, Matrix4, Point3, SquareMatrix, Transform, Vector3, Vector4}; use amethyst_renderer::Camera; use collision::Ray3; fn mouse_to_c...
code_fim
hard
{ "lang": "rust", "repo": "distransient/amethyst-rhusics", "path": "/src/pick.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> (inverse_view * eye).truncate().normalize() } /// Generate a ray for picking, based on the clicked position in pixel coordinates. /// /// ## Parameters: /// /// - `window_pos`: clicked position in pixel coordinates /// - `window_size`: window size in pixels /// - `camera`: `Camera`, used to convert f...
code_fim
hard
{ "lang": "rust", "repo": "distransient/amethyst-rhusics", "path": "/src/pick.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: himlpplm/rust-tdlib path: /src/types/pin_chat_message.rs use crate::errors::*; use crate::types::*; use uuid::Uuid; /// Pins a message in a chat; requires can_pin_messages rights or can_edit_messages rights in the channel #[derive(Debug, Clone, Default, Serialize, Deserialize)] pub struct PinCh...
code_fim
hard
{ "lang": "rust", "repo": "himlpplm/rust-tdlib", "path": "/src/types/pin_chat_message.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn chat_id(&self) -> i64 { self.chat_id } pub fn message_id(&self) -> i64 { self.message_id } pub fn disable_notification(&self) -> bool { self.disable_notification } pub fn only_for_self(&self) -> bool { self.only_for_self } } #[doc(...
code_fim
hard
{ "lang": "rust", "repo": "himlpplm/rust-tdlib", "path": "/src/types/pin_chat_message.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tgolsson/kludgine path: /kludgine/examples/text.rs use kludgine::{core::text::bundled_fonts::ROBOTO, prelude::*}; fn main() { SingleWindowApplication::run(TextExample {}); } <|fim_suffix|> "Text - Kludgine".to_owned() } } impl Window for TextExample { fn render( &mu...
code_fim
medium
{ "lang": "rust", "repo": "tgolsson/kludgine", "path": "/kludgine/examples/text.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Frehaa/Kattis path: /carrots/src/main.rs use std::io; fn main() { <|fim_suffix|> println!("{}", num.unwrap()); }<|fim_middle|> let stdin = io::stdin(); let mut line = String::new(); stdin.read_line(&mut line).unwrap(); let num = line.split_whitespace().nth(1);
code_fim
medium
{ "lang": "rust", "repo": "Frehaa/Kattis", "path": "/carrots/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{}", num.unwrap()); }<|fim_prefix|>// repo: Frehaa/Kattis path: /carrots/src/main.rs use std::io; fn main() { <|fim_middle|> let stdin = io::stdin(); let mut line = String::new(); stdin.read_line(&mut line).unwrap(); let num = line.split_whitespace().nth(1);
code_fim
medium
{ "lang": "rust", "repo": "Frehaa/Kattis", "path": "/carrots/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yo-main/akingbee path: /cerbes/src/infrastructure/database/repository/permissions.rs use crate::domain::adapters::database::PermissionRepositoryTrait; use crate::domain::entities::Permissions; use crate::domain::entities::User; use crate::domain::errors::CerbesError; use crate::infrastructure::d...
code_fim
hard
{ "lang": "rust", "repo": "yo-main/akingbee", "path": "/cerbes/src/infrastructure/database/repository/permissions.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[async_trait] impl PermissionRepositoryTrait for PermissionRepositoryPg { async fn get_permissions_for_user(&self, user: &User) -> Result<Vec<Permissions>, CerbesError> { // let public_id: Uuid = user.public_id.clone(); let permissions = PermissionModel::Entity::find() .jo...
code_fim
hard
{ "lang": "rust", "repo": "yo-main/akingbee", "path": "/cerbes/src/infrastructure/database/repository/permissions.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return Ok(permissions .into_iter() .map(|p| Into::<Permissions>::into(p)) .collect()); } async fn add_permission_for_user( &self, permission: &Permissions, user: &User, ) -> Result<(), CerbesError> { let user_entity =...
code_fim
hard
{ "lang": "rust", "repo": "yo-main/akingbee", "path": "/cerbes/src/infrastructure/database/repository/permissions.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PsichiX/Oxygengine path: /demos/archived/pokemon/src/states/loading.rs use crate::states::game::GameState; use oxygengine::prelude::*; #[derive(Default)] pub struct LoadingState { preloader: Option<AssetPackPreloader>, } <|fim_suffix|> let mut assets = universe.expect_resource_mut::...
code_fim
medium
{ "lang": "rust", "repo": "PsichiX/Oxygengine", "path": "/demos/archived/pokemon/src/states/loading.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut assets = universe.expect_resource_mut::<AssetsDatabase>(); if let Some(preloader) = &mut self.preloader { if preloader.process(&mut assets).unwrap() { return StateChange::Swap(Box::new(GameState::default())); } } else { se...
code_fim
medium
{ "lang": "rust", "repo": "PsichiX/Oxygengine", "path": "/demos/archived/pokemon/src/states/loading.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: toobamalaika/Asynchronous-Rust path: /src/main.rs use std::thread; //thread lib use std::time::Duration; // time lib <|fim_suffix|> thread_one.join().expect("Thread One Panicked! "); thread_two.join().expect("Thread Two Panicked! "); } fn main() { get_sites(); }<|fim_middle|>// Mult...
code_fim
hard
{ "lang": "rust", "repo": "toobamalaika/Asynchronous-Rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> thread_one.join().expect("Thread One Panicked! "); thread_two.join().expect("Thread Two Panicked! "); } fn main() { get_sites(); }<|fim_prefix|>// repo: toobamalaika/Asynchronous-Rust path: /src/main.rs use std::thread; //thread lib use std::time::Duration; // time lib // Multi threading fn...
code_fim
hard
{ "lang": "rust", "repo": "toobamalaika/Asynchronous-Rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn connect_labels_notify<F: Fn(&Self) + 'static>(&self, f: F) -> SignalHandlerId { unsafe extern "C" fn notify_labels_trampoline< P: IsA<ElemInfoEnumerated>, F: Fn(&P) + 'static, >( this: *mut ffi::ALSACtlElemInfoEnumerated, _param_spec: ...
code_fim
hard
{ "lang": "rust", "repo": "alsa-project/alsa-gobject-rs", "path": "/alsactl/src/auto/elem_info_enumerated.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alsa-project/alsa-gobject-rs path: /alsactl/src/auto/elem_info_enumerated.rs // This file was generated by gir (https://github.com/gtk-rs/gir) // from // from gir-files (https://github.com/gtk-rs/gir-files) // DO NOT EDIT use crate::ElemInfoCommon; use crate::ElemInfoSingleArray; use glib::obje...
code_fim
hard
{ "lang": "rust", "repo": "alsa-project/alsa-gobject-rs", "path": "/alsactl/src/auto/elem_info_enumerated.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<O: IsA<ElemInfoEnumerated>> ElemInfoEnumeratedExt for O { fn labels(&self) -> Vec<glib::GString> { glib::ObjectExt::property(self.as_ref(), "labels") } fn set_labels(&self, labels: &[&str]) { glib::ObjectExt::set_property(self.as_ref(), "labels", &labels) } fn co...
code_fim
hard
{ "lang": "rust", "repo": "alsa-project/alsa-gobject-rs", "path": "/alsactl/src/auto/elem_info_enumerated.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rectinajh/rust-leetcode path: /src/l290_word_pattern.rs /* 290. 单词规律 给定一种规律 pattern 和一个字符串 str ,判断 str 是否遵循相同的规律。 这里的 遵循 指完全匹配,例如, pattern 里的每个字母和字符串 str 中的每个非空单词之间存在着双向连接的对应规律。 示例1: 输入: pattern = "abba", str = "dog cat cat dog" 输出: true 示例 2: 输入:pattern = "abba", str = "dog cat cat fish" 输...
code_fim
hard
{ "lang": "rust", "repo": "rectinajh/rust-leetcode", "path": "/src/l290_word_pattern.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( Solution::word_pattern(String::from("abba"), String::from("dog cat cat fish")), false ); assert_eq!( Solution::word_pattern(String::from("abba"), String::from("dog cat cat dog")), true ); } }<|fim_prefix|>// re...
code_fim
hard
{ "lang": "rust", "repo": "rectinajh/rust-leetcode", "path": "/src/l290_word_pattern.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // if let Err(e) = server.await { // Err(AppError { // error: format!("server: {}", e), // }) // } else { // } } fn print_usage(program: &str, opts: Options) { let brief = format!("Usage: {}", program); print!("{}", opts.usage(&brief)); } #[tok...
code_fim
hard
{ "lang": "rust", "repo": "emcfarlane/edi-blue", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (_, server) = warp::serve(index.or(script).or(metrics).or(sock)) .bind_with_graceful_shutdown(([0, 0, 0, 0], 8080), signal); server.await; println!("shutdown server"); Ok(()) // if let Err(e) = server.await { // Err(AppError { // error: format!("...
code_fim
hard
{ "lang": "rust", "repo": "emcfarlane/edi-blue", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emcfarlane/edi-blue path: /src/main.rs #![allow(non_upper_case_globals)] #![allow(non_camel_case_types)] #![allow(non_snake_case)] include!("bindings.rs"); #[allow(dead_code)] mod dm2; #[macro_use] extern crate prometheus; use futures::stream::StreamExt; use getopts::Options; use hyper; use l...
code_fim
hard
{ "lang": "rust", "repo": "emcfarlane/edi-blue", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> output.extend(vec![ TokenTree::Group( Group::new(Delimiter::Brace, TokenStream::new()) ) ].into_iter()); output }<|fim_prefix|>// repo: vulpesgames/mist-game-engine path: /mist-dom-parser/src/lib.rs extern crate proc_macro; use proc_macro::{TokenStream, TokenTree...
code_fim
hard
{ "lang": "rust", "repo": "vulpesgames/mist-game-engine", "path": "/mist-dom-parser/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vulpesgames/mist-game-engine path: /mist-dom-parser/src/lib.rs extern crate proc_macro; use proc_macro::{TokenStream, TokenTree, Literal, Group, Delimiter}; use proc_macro_hack::proc_macro_hack; use quote::{quote, quote_spanned}; use syn::{parse_macro_input, Expr}; <|fim_suffix|>#[proc_macro_h...
code_fim
medium
{ "lang": "rust", "repo": "vulpesgames/mist-game-engine", "path": "/mist-dom-parser/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: itkrt2y/LeetCode path: /172.factorial-trailing-zeroes.rs /* * @lc app=leetcode id=172 lang=rust * * [172] Factorial Trailing Zeroes */ <|fim_suffix|> while n > 0 { n /= 5; result += n; } result } } // @lc code=end<|fim_middle|>// @lc code=...
code_fim
medium
{ "lang": "rust", "repo": "itkrt2y/LeetCode", "path": "/172.factorial-trailing-zeroes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }