text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>impl fmt::Debug for Status { #[trusted] fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { f.debug_struct("Status").finish() } } /// A signed header contains both a `Header` and its corresponding `Commit`. pub type SignedHeader = TMSignedHeader;<|fim_prefix|>// repo: zgrannan/...
code_fim
hard
{ "lang": "rust", "repo": "zgrannan/tendermint-prusti", "path": "/light-client/src/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: synlestidae/membership-raft path: /src/raft/app_network.rs use crate::node::NodeTracker; use crate::node::SharedNetworkState; use crate::raft::Transition; use crate::rpc::HttpRpcClient; use crate::rpc::RpcClient; use actix; use actix::{Actor, Context, Handler}; use actix_raft::messages::InstallS...
code_fim
hard
{ "lang": "rust", "repo": "synlestidae/membership-raft", "path": "/src/raft/app_network.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let node = self .shared_network_state .get_node(msg.target) .expect("Unable to find node"); Box::new( self.rpc_client .install_snapshot(&node.rpc_url(), msg) .map_err(|_| ()), ) } } // Impl handle...
code_fim
hard
{ "lang": "rust", "repo": "synlestidae/membership-raft", "path": "/src/raft/app_network.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub(super) fn handle_ecall(fid: u32) -> SbiResult<usize> { match fid { _ => Err(Error::NotSupported), } }<|fim_prefix|>// repo: Stupremee/windy path: /crates/sbi/src/interface/ipi.rs //! RFENCE SBI extension implementation <|fim_middle|>use crate::{Error, SbiResult};
code_fim
easy
{ "lang": "rust", "repo": "Stupremee/windy", "path": "/crates/sbi/src/interface/ipi.rs", "mode": "spm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Stupremee/windy path: /crates/sbi/src/interface/ipi.rs //! RFENCE SBI extension implementation <|fim_suffix|>pub(super) fn handle_ecall(fid: u32) -> SbiResult<usize> { match fid { _ => Err(Error::NotSupported), } }<|fim_middle|>use crate::{Error, SbiResult};
code_fim
easy
{ "lang": "rust", "repo": "Stupremee/windy", "path": "/crates/sbi/src/interface/ipi.rs", "mode": "psm", "license": "Zlib", "source": "the-stack-v2" }
<|fim_suffix|> for r in (0..256).step_by(3) { for g in (0..256).step_by(4) { for b in (0..256).step_by(5) { let input = [(r as u8, g as u8, b as u8)]; let mut out = [(0, 0, 0)]; t.transform_pixels(&input, &mut out); n += 1; ...
code_fim
hard
{ "lang": "rust", "repo": "kornelski/rust-lcms2", "path": "/examples/compare.rs", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_suffix|> n += 1; if input != out { let (r2,g2,b2) = out[0]; let diff = (r - i32::from(r2)).pow(2) + (g - i32::from(g2)).pow(2) + (b - i32::from(b2)).pow(2); tota...
code_fim
hard
{ "lang": "rust", "repo": "kornelski/rust-lcms2", "path": "/examples/compare.rs", "mode": "spm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kornelski/rust-lcms2 path: /examples/compare.rs use lcms2::{Intent, PixelFormat, Profile, Transform}; use std::env; fn main() { let path = env::args().nth(1).expect("Specify a profile as an argument"); let p1 = Profile::new_file(path).unwrap(); let p2 = Profile::new_srgb(); <|fim_...
code_fim
hard
{ "lang": "rust", "repo": "kornelski/rust-lcms2", "path": "/examples/compare.rs", "mode": "psm", "license": "MIT-0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: peterschwarz/diesel path: /diesel_compile_tests/tests/fail/derive/bad_column_name.rs #[macro_use] extern crate diesel; table! { users { id -> Integer, name -> Text, } } #[derive(Queryable)] #[diesel(table_name = users)] struct User1 { #[diesel(column_name)] name...
code_fim
medium
{ "lang": "rust", "repo": "peterschwarz/diesel", "path": "/diesel_compile_tests/tests/fail/derive/bad_column_name.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Queryable)] #[diesel(table_name = users)] struct User3 { #[diesel(column_name = true)] name: String, } fn main() {}<|fim_prefix|>// repo: peterschwarz/diesel path: /diesel_compile_tests/tests/fail/derive/bad_column_name.rs #[macro_use] extern crate diesel; table! { users { ...
code_fim
hard
{ "lang": "rust", "repo": "peterschwarz/diesel", "path": "/diesel_compile_tests/tests/fail/derive/bad_column_name.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn composition_seed(&self) -> [u8; 32]; fn query_seed(&self) -> [u8; 32]; // PRNG BUILDERS // -------------------------------------------------------------------------------------------- /// Returns a PRNG for transition constraint coefficients. fn get_transition_coefficient_prng...
code_fim
hard
{ "lang": "rust", "repo": "zCloak-Network/winterfell", "path": "/common/src/random/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zCloak-Network/winterfell path: /common/src/random/mod.rs // Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the root directory of this source tree. use crate::ComputationContext; use crypto::{Hasher, Rand...
code_fim
hard
{ "lang": "rust", "repo": "zCloak-Network/winterfell", "path": "/common/src/random/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: audiocogs/flac.rs path: /src/decoder.rs use std; use aurora; pub struct Decoder { source: aurora::channel::Source<aurora::Binary>, metadata_source: aurora::channel::Source<::metadata::Metadata>, sink: aurora::channel::Sink<aurora::Audio> } impl Decoder { pub fn new(source: aurora::cha...
code_fim
hard
{ "lang": "rust", "repo": "audiocogs/flac.rs", "path": "/src/decoder.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> samples_remaining -= samples as u64; last = samples_remaining == 0; audio.last = last; }); } } }<|fim_prefix|>// repo: audiocogs/flac.rs path: /src/decoder.rs use std; use aurora; pub struct Decoder { source: aurora::channel::Source<aurora::Binary...
code_fim
hard
{ "lang": "rust", "repo": "audiocogs/flac.rs", "path": "/src/decoder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wjzz/primes path: /rust-checker/src/time.rs pub fn format_time(milis: u128) -> String { let mut v = milis; let mil = v % 1000; v /= 1000; let sec = v % 60; v /= 60; let min = v % 60; v /= 60; let hours = v % 24; v /= 24; let days = v; format!("{}d {:...
code_fim
hard
{ "lang": "rust", "repo": "wjzz/primes", "path": "/rust-checker/src/time.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_days2() { assert_eq!(format_time(36 * 3600 * 1000), "1d 12:00:00.000"); } }<|fim_prefix|>// repo: wjzz/primes path: /rust-checker/src/time.rs pub fn format_time(milis: u128) -> String { let mut v = milis; let mil = v % 1000; v /= 1000; let sec = v % 60...
code_fim
hard
{ "lang": "rust", "repo": "wjzz/primes", "path": "/rust-checker/src/time.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nushell/nushell path: /src/tests/test_config.rs use crate::tests::{run_test, TestResult}; use super::run_test_with_default_config; #[test] fn mutate_nu_config() -> TestResult { run_test_with_default_config( r#"$env.config.footer_mode = 30; $env.config.footer_mode"#, "30", ...
code_fim
medium
{ "lang": "rust", "repo": "nushell/nushell", "path": "/src/tests/test_config.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn mutate_nu_config_nested_filesize() -> TestResult { run_test_with_default_config( r#"$env.config.filesize.format = 'kb'; $env.config.filesize.format"#, "kb", ) }<|fim_prefix|>// repo: nushell/nushell path: /src/tests/test_config.rs use crate::tests::{run_test, TestResult...
code_fim
hard
{ "lang": "rust", "repo": "nushell/nushell", "path": "/src/tests/test_config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: spadix0/AoC2020 path: /14/bitmask/src/split.rs use std::mem::swap; use super::{Memory, Program, mask_combos}; // split – hypercube intersection // // tracks masked addresses and only expands overwritten regions. minimal // memory usage even w/many Xs but can still explode for other cases. // b...
code_fim
hard
{ "lang": "rust", "repo": "spadix0/AoC2020", "path": "/14/bitmask/src/split.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn size(&self) -> usize { self.len() } fn sum(&self) -> u64 { self.iter() .map(|e| e.data << e.mask.count_ones()) .sum() } } //---------------------------------------------------------------------------- #[cfg(test)] pub mod tests { use super:...
code_fim
hard
{ "lang": "rust", "repo": "spadix0/AoC2020", "path": "/14/bitmask/src/split.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// A basic point defined by a n-dimensional vector #[derive(Clone)] pub struct VectorPointN<N : DimName> where DefaultAllocator: Allocator<f64, N> { pub origin : VectorN<f64, N> } impl<N : DimName> NPoint for VectorPointN<N> where DefaultAllocator: Allocator<f64, N> { type N = N; ...
code_fim
hard
{ "lang": "rust", "repo": "TheInnerLight/RustCloud", "path": "/src/domain.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheInnerLight/RustCloud path: /src/domain.rs use na::{DefaultAllocator, DimName, VectorN, U2, U3}; use na::allocator::Allocator; /// An n-dimensional point with a defined n-vector from the origin pub trait NPoint: Clone where DefaultAllocator: Allocator<f64, Self::N>, { type N: DimName;...
code_fim
hard
{ "lang": "rust", "repo": "TheInnerLight/RustCloud", "path": "/src/domain.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // prover let begin = Instant::now(); let proof = create_random_proof(full_circuit, &param, &mut rng).unwrap(); let end = Instant::now(); println!("prove time {:?}", end.duration_since(begin)); // verifier let mut l1_inputs = Vec::new(); for i in 0..l1_com_vec.len() { ...
code_fim
hard
{ "lang": "rust", "repo": "zk-ml/ZEN", "path": "/zen-arkworks/examples/shallownet_mnist.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zk-ml/ZEN path: /zen-arkworks/examples/shallownet_mnist.rs use std::time::Instant; use pedersen_example::*; use ark_serialize::CanonicalDeserialize; use ark_serialize::CanonicalSerialize; use ark_ff::UniformRand; use ark_groth16::*; use ark_crypto_primitives::{commitment::pedersen::Randomness, ...
code_fim
hard
{ "lang": "rust", "repo": "zk-ml/ZEN", "path": "/zen-arkworks/examples/shallownet_mnist.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nuhtan/minecraft_monitor path: /src/bin/launch.rs //! Crate wide documentation? extern crate minecraft_monitor as mon; use mon::functions::configuration::{determine_config, Verbosity}; use mon::functions::minecraft_related::*; use mon::functions::shared_data::*; use mon::functions::web_server::h...
code_fim
hard
{ "lang": "rust", "repo": "nuhtan/minecraft_monitor", "path": "/src/bin/launch.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn launch( shared_data: ServerSharedData, address: Ipv4Addr, port: u16, web_index: String, jar_name: String, gen_args: Option<String>, min_ram: String, max_ram: String, web_log: bool, verbosity: Verbosity, ) { let (web_sender, web_receiver) = mpsc::channel::<Str...
code_fim
hard
{ "lang": "rust", "repo": "nuhtan/minecraft_monitor", "path": "/src/bin/launch.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> handle_opts(opts_from_env()).map_err(|e| FileAnIssue::new(e).into()) }<|fim_prefix|>// repo: denisidoro/abra path: /src/bin/main.rs extern crate abra; use abra::{handle_opts, opts_from_env, FileAnIssue}; use anyhow::Error; <|fim_middle|>fn main() -> Result<(), Error> {
code_fim
easy
{ "lang": "rust", "repo": "denisidoro/abra", "path": "/src/bin/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: denisidoro/abra path: /src/bin/main.rs extern crate abra; use abra::{handle_opts, opts_from_env, FileAnIssue}; use anyhow::Error; <|fim_suffix|> handle_opts(opts_from_env()).map_err(|e| FileAnIssue::new(e).into()) }<|fim_middle|>fn main() -> Result<(), Error> {
code_fim
easy
{ "lang": "rust", "repo": "denisidoro/abra", "path": "/src/bin/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns the 120-bit serial number of the sam4l in a byte array pub fn get(&self) -> [u8; 15] { self.regs.serial_num } /// Helper function for simply returning the lower 64 bits of the serial number /// as a u64 rather than a byte array pub fn get_lower_64(&self) -> u64...
code_fim
hard
{ "lang": "rust", "repo": "tock/tock", "path": "/chips/sam4l/src/serial_num.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Helper function for simply returning the lower 64 bits of the serial number /// as a u64 rather than a byte array pub fn get_lower_64(&self) -> u64 { let full_num = self.regs.serial_num; full_num .iter() .rev() .take(8) .enume...
code_fim
medium
{ "lang": "rust", "repo": "tock/tock", "path": "/chips/sam4l/src/serial_num.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tock/tock path: /chips/sam4l/src/serial_num.rs // Licensed under the Apache License, Version 2.0 or the MIT License. // SPDX-License-Identifier: Apache-2.0 OR MIT // Copyright Tock Contributors 2022. //! Provides a struct that enables access to the unique 120 bit serial number stored in read-on...
code_fim
hard
{ "lang": "rust", "repo": "tock/tock", "path": "/chips/sam4l/src/serial_num.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Guitarbum722/spinners path: /src/lib.rs extern crate spinner; #[macro_use] extern crate lazy_static; extern crate strum; #[macro_use] extern crate strum_macros; mod spinner_data; mod spinners_data; mod spinner_names; <|fim_suffix|> /// Update spinner's message /// /// Returns the S...
code_fim
hard
{ "lang": "rust", "repo": "Guitarbum722/spinners", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // @todo implement my own Spinner thread let handle = spinner::SpinnerBuilder::new(message) .spinner(spinner_data.frames.clone()) .step(Duration::from_millis(spinner_data.interval.into())) .start(); Spinner { handle: handle } } /// Upda...
code_fim
hard
{ "lang": "rust", "repo": "Guitarbum722/spinners", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>().zip(strand2.chars()).filter(|&(a, b)| a != b).count() as i32) }<|fim_prefix|>// repo: stanciua/exercism path: /rust/hamming/src/lib.rs pub fn hamming_distance(strand1: &str, strand2: &str) -> Result<i32, &'static str> { if strand1.len() != strand2.len() { r<|fim_middle|>eturn Err("inputs ...
code_fim
medium
{ "lang": "rust", "repo": "stanciua/exercism", "path": "/rust/hamming/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stanciua/exercism path: /rust/hamming/src/lib.rs pub fn hamming_distance(strand1: &str, strand2: &str) -> Result<i32<|fim_suffix|>().zip(strand2.chars()).filter(|&(a, b)| a != b).count() as i32) }<|fim_middle|>, &'static str> { if strand1.len() != strand2.len() { return Err("inputs ...
code_fim
medium
{ "lang": "rust", "repo": "stanciua/exercism", "path": "/rust/hamming/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_idx_slice(3, 0, &[0]); test_idx_slice(3, 1, &[1]); test_idx_slice(3, 2, &[2]); test_idx_slice(3, 3, &[0, 0]); test_idx_slice(3, 4, &[0, 1]); test_idx_slice(3, 5, &[0, 2]); test_idx_slice(3, 6, &[1, 1]); test_idx_slice(3, 7, &[1, 2]); ...
code_fim
hard
{ "lang": "rust", "repo": "thomvil/comb-iter-rs", "path": "/src/combination_with_repetitions/single_combination_with_repetitions.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let text_time = Instant::now(); let elapsed = text_time - decoded_time; let elapsed_f = elapsed.subsec_micros() as f64 / 1_000_000.0 + elapsed.as_secs() as f64; println!("STT done in {:?}. Real time factor {:.5}", elapsed, elapsed_f / len_seconds); // Output the result p...
code_fim
hard
{ "lang": "rust", "repo": "mbc1990/stt", "path": "/stt/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mbc1990/stt path: /stt/src/main.rs extern crate deepspeech; extern crate audrey; use std::path::Path; use std::env::args; use std::fs::File; use std::time::Instant; use deepspeech::Model; use audrey::read::Reader; use audrey::sample::interpolate::{Converter, Linear}; use audrey::sample::signal...
code_fim
hard
{ "lang": "rust", "repo": "mbc1990/stt", "path": "/stt/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Decoding done in {:?}. Sample length {}s. Running STT.", decoded_time - initialized_time, len_seconds); // Run the speech to text algorithm let result = m.speech_to_text(&audio_buf, SAMPLE_RATE).unwrap(); let text_time = Instant::now(); let elapsed = text_time...
code_fim
hard
{ "lang": "rust", "repo": "mbc1990/stt", "path": "/stt/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CasualX/adventofcode2019 path: /src/bin/day1.rs use std::io; use std::io::prelude::*; fn calculate_recursive_fuel(mass: f64) -> f64 { <|fim_suffix|> let mass = input.lines().map(|line| line.trim().parse::<f64>().expect("error parsing mass number")).collect::<Vec<_>>(); let total_fuel1 = mass....
code_fim
hard
{ "lang": "rust", "repo": "CasualX/adventofcode2019", "path": "/src/bin/day1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut input = String::new(); let _ = io::stdin().read_to_string(&mut input).expect("error reading input"); let mass = input.lines().map(|line| line.trim().parse::<f64>().expect("error parsing mass number")).collect::<Vec<_>>(); let total_fuel1 = mass.iter().cloned().map(|mass| (mass / 3.0).floor()...
code_fim
medium
{ "lang": "rust", "repo": "CasualX/adventofcode2019", "path": "/src/bin/day1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut index = 0; loop { if index < 50 { unsafe { data[index] = 1; } index = index + 1; } if switch_two.is_on() || switch_one.is_on() { led.toggle(); } else { led.off(); } ...
code_fim
hard
{ "lang": "rust", "repo": "featureenvy/rust-embedded", "path": "/src/labs/lab9.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> loop { if index < 50 { unsafe { data[index] = 1; } index = index + 1; } if switch_two.is_on() || switch_one.is_on() { led.toggle(); } else { led.off(); } clock::delay(500); }...
code_fim
medium
{ "lang": "rust", "repo": "featureenvy/rust-embedded", "path": "/src/labs/lab9.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: featureenvy/rust-embedded path: /src/labs/lab9.rs use hal::clock; use driver::led; use driver::switch; use hal::gpio; static mut data: [u8; 50] = [0; 50]; #[allow(dead_code)] pub fn run() { clock::init(); let led = led::Led::new(gpio::Port::PortF, gpio::Pins::Pin1); let switch_one...
code_fim
medium
{ "lang": "rust", "repo": "featureenvy/rust-embedded", "path": "/src/labs/lab9.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Quinn1876/Rust-Neural-Network-Framework path: /src/main.rs use neural_network::utils::{ InputAttributes, OutputAttributes, PerceptronOutput }; use neural_network::neural_network::NeuralNetwork; use neural_network::perceptron::Perceptron; use neural_network::activation_functions::*; struct Inpu...
code_fim
hard
{ "lang": "rust", "repo": "Quinn1876/Rust-Neural-Network-Framework", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Read input file // let mut nn: NeuralNetwork<Input, Output> = NeuralNetwork::new(1, 0.05); let inputs = vec![ Input::new(0f32,1f32,0f32), Input::new(0f32, 0f32, 1f32), Input::new(1f32, 0f32, 0f32), Input::new(1f32, 1f32, 0f32), Input::new(1f32, 1f32,...
code_fim
hard
{ "lang": "rust", "repo": "Quinn1876/Rust-Neural-Network-Framework", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kenaniah/rust-ruby path: /ruby-core/src/lib.rs //! Ruby Core use std::collections::HashMap; #[macro_use] extern crate ruby_proc_macros; #[macro_use] mod macros; mod array; mod class; mod compiler; mod error; mod hash; mod memory_pool; mod object; mod proc; mod range; mod ruby; mod string; mo...
code_fim
medium
{ "lang": "rust", "repo": "kenaniah/rust-ruby", "path": "/ruby-core/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Represents a Ruby `Symbol` #[maps_to(mruby: mrb_sym)] pub type Symbol = u32; /// Represents a table of variables #[maps_to(mruby: iv_table)] pub type VariableTable = HashMap<Symbol, Value>; /// Function pointer type for functions that are callable in Ruby /// /// The arguments to the function are st...
code_fim
hard
{ "lang": "rust", "repo": "kenaniah/rust-ruby", "path": "/ruby-core/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Stargateur/newline path: /src/lib.rs #![cfg_attr(feature = "benchmarks", feature(test))] use jetscii; use std::io::{BufRead, ErrorKind}; #[derive(Debug)] pub enum Error { Io(std::io::Error), FromUtf8Error(std::string::FromUtf8Error), } pub trait NewLine: BufRead + Sized { /* fn...
code_fim
hard
{ "lang": "rust", "repo": "Stargateur/newline", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let input = BufReader::with_capacity( 3, "Heading:\r\nLine 1\rLine 2\rLine 3\r\nEnd\n\r".as_bytes(), ); let output = ["Heading:", "Line 1", "Line 2", "Line 3", "End"]; for (a, b) in input.lines_all().flatten().zip_eq(output.iter()) { asse...
code_fim
hard
{ "lang": "rust", "repo": "Stargateur/newline", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> diesel::delete( csml_states::table .filter(csml_states::expires_at.lt(date_now)) ).execute(&db.client).ok(); Ok(()) }<|fim_prefix|>// repo: CSML-by-Clevy/csml-engine path: /csml_engine/src/db_connectors/sqlite/expired_data.rs use diesel::{RunQueryDsl, ExpressionMethods, Query...
code_fim
hard
{ "lang": "rust", "repo": "CSML-by-Clevy/csml-engine", "path": "/csml_engine/src/db_connectors/sqlite/expired_data.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CSML-by-Clevy/csml-engine path: /csml_engine/src/db_connectors/sqlite/expired_data.rs use diesel::{RunQueryDsl, ExpressionMethods, QueryDsl}; use crate::{ EngineError, SqliteClient, }; use super::{ schema::{ csml_conversations, csml_memories, csml_states } }; <|fim...
code_fim
hard
{ "lang": "rust", "repo": "CSML-by-Clevy/csml-engine", "path": "/csml_engine/src/db_connectors/sqlite/expired_data.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustwasm/gloo path: /examples/clock/src/lib.rs use chrono::Timelike; use futures_util::{future::ready, stream::StreamExt}; use gloo::timers::future::IntervalStream; use wasm_bindgen::prelude::*; use wasm_bindgen_futures::spawn_local; #[wasm_bindgen(start)] pub fn main() { console_error_pani...
code_fim
medium
{ "lang": "rust", "repo": "rustwasm/gloo", "path": "/examples/clock/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // print the current date let date = chrono::Local::now(); let format_str = if date.second() % 2 == 0 { "%Y-%m-%d %H %M" } else { "%Y-%m-%d %H:%M" }; let date_str = date.format(format_str).to_string(); // Set the contents of `el` to our date string el.set...
code_fim
hard
{ "lang": "rust", "repo": "rustwasm/gloo", "path": "/examples/clock/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>color: 1px;\n}\n" ); test!( unitless_nan_min_middle_arg, "$n: (0/0);\na {\n color: min(1px, $n, 0);\n}\n", "a {\n color: 0;\n}\n" ); test!( unitless_nan_max_first_arg, "$n: (0/0);\na {\n color: max($n, 1px);\n}\n", "a {\n color: NaN;\n}\n" ); test!( unitless_nan_max_last_ar...
code_fim
hard
{ "lang": "rust", "repo": "MidasLamb/grass", "path": "/tests/nan.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MidasLamb/grass path: /tests/nan.rs #[macro_use] mod macros; error!( unitless_nan_str_slice_start_at, "a {\n color: str-slice(\"\", (0/0));\n}\n", "Error: NaN is not an int." ); error!( unitless_nan_str_slice_end_at, "a {\n color: str-slice(\"\", 0, (0/0));\n}\n", "Error: NaN ...
code_fim
hard
{ "lang": "rust", "repo": "MidasLamb/grass", "path": "/tests/nan.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: digitsu/bitcrust path: /net/src/transactions.rs use Encode; use VarInt; #[derive(Debug, Encode, PartialEq)] pub struct TransactionInput { pub previous: Outpoint, #[count] pub script: Vec<u8>, pub sequence: u32, } impl TransactionInput { pub fn len(&self) -> usize { ...
code_fim
medium
{ "lang": "rust", "repo": "digitsu/bitcrust", "path": "/net/src/transactions.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Outpoint { pub fn new(index: u32, hash: &[u8]) -> Outpoint { debug_assert!(hash.len() == 32); let mut a: [u8; 32] = Default::default(); a.copy_from_slice(&hash); Outpoint { index: index, hash: a, } } } #[derive(Debug, Encode, PartialE...
code_fim
medium
{ "lang": "rust", "repo": "digitsu/bitcrust", "path": "/net/src/transactions.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> [.borrow_box.per_byte_serialized, optional "borrow_box.per_byte_serialized", (10 + 1) * MUL], [.remove_box.per_byte_serialized, optional "remove_box.per_byte_serialized", (8 + 1) * MUL], [.contains_box.per_byte_serialized, optional "contains_box.per_byte_serialized", (40 + 1) * MUL], [...
code_fim
hard
{ "lang": "rust", "repo": "starcoinorg/starcoin", "path": "/vm/gas-algebra-ext/src/table.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: starcoinorg/starcoin path: /vm/gas-algebra-ext/src/table.rs // Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::gas_meter::EXECUTION_GAS_MULTIPLIER as MUL; use move_table_extension::GasParameters; // same order as from https://github.com/starcoinor...
code_fim
medium
{ "lang": "rust", "repo": "starcoinorg/starcoin", "path": "/vm/gas-algebra-ext/src/table.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn is_alive(&self, entity: Entity) -> bool { // self.next_id is the ID for the next entity so any entities with // that ID or higher haven't been spawned yet if entity.0 >= self.next_id { panic!("Attempted to use an entity in an EntityGenerator that it wa...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/entity-component-scrapyard", "path": "/Book/02-Entities/code/src/entities.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/entity-component-scrapyard path: /Book/02-Entities/code/src/entities.rs #[derive(Debug, Copy, Clone, Eq, PartialEq, Hash)] pub struct Entity(u64); pub(crate) struct EntityGenerator { next_id: u64, dead_entities: std::collections::HashSet<Entity>, } impl EntityGenerator { pu...
code_fim
medium
{ "lang": "rust", "repo": "iCodeIN/entity-component-scrapyard", "path": "/Book/02-Entities/code/src/entities.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qinxiaoguang/rs-lc path: /src/solution/l153.rs pub struct Solution {} /* * @lc app=leetcode.cn id=153 lang=rust * * [153] 寻找旋转排序数组中的最小值 * * https://leetcode-cn.com/problems/find-minimum-in-rotated-sorted-array/description/ * * algorithms * Medium (50.18%) * Likes: 210 * Dislikes: 0...
code_fim
hard
{ "lang": "rust", "repo": "qinxiaoguang/rs-lc", "path": "/src/solution/l153.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod test { use super::*; #[test] fn test_l153() { assert_eq!(Solution::find_min(vec![3, 4, 5, 1, 2]), 1); assert_eq!(Solution::find_min(vec![4, 5, 6, 7, 0, 1, 2]), 0); assert_eq!(Solution::find_min(vec![0, 1, 2]), 0); assert_eq!(Solution::find_min(v...
code_fim
hard
{ "lang": "rust", "repo": "qinxiaoguang/rs-lc", "path": "/src/solution/l153.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>//////////////////////////////////////////////////////////////////////////////////////// //// FoldR_ //////////////////////////////////////////////////////////////////////////////////////// impl<L0, OrRes0, DefaultVal, Op> FoldR_<DefaultVal, Op> for tlist![L0,] where Op: TypeFn_<(D...
code_fim
hard
{ "lang": "rust", "repo": "rodrimati1992/type_level", "path": "/type_level_values/src/new_types/type_list/generated_impls.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rodrimati1992/type_level path: /type_level_values/src/new_types/type_list/generated_impls.rs /* These impls are automatically generated using the scripts in impls_scripts.rs */ use crate_::collection_ops::{Filter_, FoldL_, FoldR_, Map_}; use crate_::type_fn::TypeFn_; ////////////////////...
code_fim
hard
{ "lang": "rust", "repo": "rodrimati1992/type_level", "path": "/type_level_values/src/new_types/type_list/generated_impls.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Origen-SDK/o2 path: /rust/origen/src/services/swd/service.rs use crate::core::dut::Dut; use crate::generator::PAT; use crate::precludes::controller::*; use crate::{Result, TEST}; #[derive(Debug, Clone, PartialEq, Serialize)] pub enum Acknowledgements { Ok, Wait, Fault, None, } ...
code_fim
hard
{ "lang": "rust", "repo": "Origen-SDK/o2", "path": "/rust/origen/src/services/swd/service.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn verify_dp( &self, dut: &crate::Dut, transaction: Transaction, ack: Acknowledgements, parity: Option<bool>, ) -> Result<()> { let swdio = PinCollection::from_group(dut, &self.swdio.0, self.swdio.1)?; let mut t2 = transaction.clone(); ...
code_fim
hard
{ "lang": "rust", "repo": "Origen-SDK/o2", "path": "/rust/origen/src/services/swd/service.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if div.clone() * denominator.clone() > nominator.clone() { if denominator.is_positive() { div -= BigInt::one(); } else { div += BigInt::one(); } } let rem = nominator - div.clone() * denominator; Some((div, rem)) }<|fim_prefix|>// repo: prz...
code_fim
hard
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-math/src/euclidean/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prz23/zinc path: /zinc-math/src/euclidean/mod.rs //! //! The Euclidean division and remainder. //! #[cfg(test)] mod tests; use std::ops::Div; use num::BigInt; use num::One; use num::Signed; use num::Zero; /// /// Euclidean division of BigInt. /// /// div_rem(9, 4) -> (2, 1) /// div_rem(9, -4...
code_fim
medium
{ "lang": "rust", "repo": "prz23/zinc", "path": "/zinc-math/src/euclidean/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut m_c = Vec::<Vec<f64>>::with_capacity(N); for _ in 0..N { m_c.push(vec![0.0; N]); } matrix_multiply(&m_a, &m_b, &mut m_c); println!("m_c = {:?}", m_c); }<|fim_prefix|>// repo: emanuellima1/matrix-multiply-raw path: /src/main.rs // https://play.rust-lang.org/?v...
code_fim
hard
{ "lang": "rust", "repo": "emanuellima1/matrix-multiply-raw", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emanuellima1/matrix-multiply-raw path: /src/main.rs // https://play.rust-lang.org/?version=stable&mode=debug&edition=2018&gist=e62972d1ada878cfda92ca2d6173a519 extern crate rand; use rand::Rng; <|fim_suffix|> b: &Vec<Vec<f64>>, c: &mut Vec<Vec<f64>>) { fo...
code_fim
medium
{ "lang": "rust", "repo": "emanuellima1/matrix-multiply-raw", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: crestonbunch/reticulated path: /parser/trees/parse/src/vfpdef.rs use std::cell::RefCell; use std::rc::Rc; use crate::node::{Child, NodeProxy, PNode, ParseConstruct, ParseNode}; use lexer::tokens::Token; use lexer::Span; use syntax::{Arg, SNode}; <|fim_suffix|>impl ParseNode<VfpDef> { fn ad...
code_fim
medium
{ "lang": "rust", "repo": "crestonbunch/reticulated", "path": "/parser/trees/parse/src/vfpdef.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(Token::Name(ref tok)) = self.inner.child { Ok(Arg::new(String::clone(tok), None, self.span)) } else { Err("could not build syntax node from VfpDef") } } } impl_parse_construct!(VfpDef, Arg);<|fim_prefix|>// repo: crestonbunch/reticulated pa...
code_fim
hard
{ "lang": "rust", "repo": "crestonbunch/reticulated", "path": "/parser/trees/parse/src/vfpdef.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn create_syntax(&self) -> Result<SNode<Arg>, &'static str> { if let Some(Token::Name(ref tok)) = self.inner.child { Ok(Arg::new(String::clone(tok), None, self.span)) } else { Err("could not build syntax node from VfpDef") } } } impl_parse_construct...
code_fim
hard
{ "lang": "rust", "repo": "crestonbunch/reticulated", "path": "/parser/trees/parse/src/vfpdef.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct AssetsManager<'a> { primary_font: RefCell<GlyphCache<'a>>, } impl<'a> AssetsManager<'a> { pub fn load() -> AssetsManager<'a> { let exe_directory = env::current_exe().unwrap().parent().unwrap().to_owned(); let exe_directory = &exe_directory.join("assets/FiraSans-Regula...
code_fim
medium
{ "lang": "rust", "repo": "In-line/rust_2048", "path": "/src/assets_manager.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: In-line/rust_2048 path: /src/assets_manager.rs use std::env; use opengl_graphics::glyph_cache::GlyphCache; use opengl_graphics::TextureSettings; use std::cell::{RefCell, RefMut}; pub struct AssetsManager<'a> { primary_font: RefCell<GlyphCache<'a>>, } <|fim_suffix|> pub fn get_primary_f...
code_fim
hard
{ "lang": "rust", "repo": "In-line/rust_2048", "path": "/src/assets_manager.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let re = Regex::new(r"^position=<\s*(-?\d+),\s*(-?\d+)> velocity=<\s*(-?\d+),\s*(-?\d+)>$").unwrap(); let mut stars = vec![]; for line in input.lines() { match re.captures(line) { Some(cap) => stars.push(Star { point: Point { x: c...
code_fim
hard
{ "lang": "rust", "repo": "timocp/adventofcode-2018", "path": "/src/day10.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: timocp/adventofcode-2018 path: /src/day10.rs use super::{Part, Part::*}; use image::ImageBuffer; use regex::Regex; pub fn run(part: Part, input: &str) { match part { One => { find_message(&mut parse_input(input), true); println!("Wrote day10.png containing an...
code_fim
hard
{ "lang": "rust", "repo": "timocp/adventofcode-2018", "path": "/src/day10.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let (min, max) = boxsize(stars); ((max.x - min.x + 1).abs() * (max.y - min.y + 1).abs()) as u64 } fn boxsize(stars: &Vec<Star>) -> (Point, Point) { let mut min = stars.first().unwrap().point; let mut max = stars.first().unwrap().point; for star in stars.iter().skip(1) { if sta...
code_fim
hard
{ "lang": "rust", "repo": "timocp/adventofcode-2018", "path": "/src/day10.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Print `Entry` column headers pub fn headers(color: bool) { println!( "{}", format!(" {}", Message::report_headers(color)) .pad_to_width_with_alignment(terminal_width(), Alignment::Left) ); }<|fim_prefix|>// repo: kaikalii/coral path: /src/print.rs /*! functions ...
code_fim
hard
{ "lang": "rust", "repo": "kaikalii/coral", "path": "/src/print.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaikalii/coral path: /src/print.rs /*! functions for printing `Entry`s */ use std::io::{stdout, Write}; use pad::{Alignment, PadStr}; use crate::{terminal_width, Entry, Message}; /// Print a CLI prompt arrow pub fn prompt() { print!( "{}\r> ", "".pad_to_width_with_alignme...
code_fim
hard
{ "lang": "rust", "repo": "kaikalii/coral", "path": "/src/print.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Print a `Message` with an assigned index pub fn message(index: usize, color: bool, message: &Message) { if let Some(report) = message.report(color, terminal_width() - 4) { println!( "{} {}", index .to_string() .pad_to_width_with_align...
code_fim
hard
{ "lang": "rust", "repo": "kaikalii/coral", "path": "/src/print.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let urls: Vec<(String,)> = sqlx::query_as("SELECT url FROM link WHERE domainUrl = $1") .bind(domain_name) .fetch_all(&mut conn) .await?; let urls = urls.into_iter().map(|x| x.0).collect(); Ok(urls) }<|fim_prefix|>// repo: Dzejkop/crowley path: /sr...
code_fim
hard
{ "lang": "rust", "repo": "Dzejkop/crowley", "path": "/src/list.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Dzejkop/crowley path: /src/list.rs use crate::db::get_connection; use crate::UrlEncodedUrl; use anyhow::anyhow; pub async fn list_or_fail(url: UrlEncodedUrl) -> anyhow::Result<Vec<String>> { let mut conn = get_connection().await?; let domain_name = url .into_inner() .dom...
code_fim
medium
{ "lang": "rust", "repo": "Dzejkop/crowley", "path": "/src/list.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let urls = urls.into_iter().map(|x| x.0).collect(); Ok(urls) }<|fim_prefix|>// repo: Dzejkop/crowley path: /src/list.rs use crate::db::get_connection; use crate::UrlEncodedUrl; use anyhow::anyhow; pub async fn list_or_fail(url: UrlEncodedUrl) -> anyhow::Result<Vec<String>> { let mut conn = ...
code_fim
medium
{ "lang": "rust", "repo": "Dzejkop/crowley", "path": "/src/list.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if opts.patchset == "latest" { sayln("white", " latest patchset"); } else { say("white", " at patchset "); sayln("yellow", opts.patchset); } try!(git::diff(opts.change, opts.patchset, &target, &opts.local)); Ok(0) }<|fim_prefix|>// repo: kevinreedy/delivery-cli ...
code_fim
hard
{ "lang": "rust", "repo": "kevinreedy/delivery-cli", "path": "/src/delivery/command/diff.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kevinreedy/delivery-cli path: /src/delivery/command/diff.rs // // Copyright:: Copyright (c) 2016 Chef Software, Inc. // License:: Apache License, Version 2.0 // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. ...
code_fim
hard
{ "lang": "rust", "repo": "kevinreedy/delivery-cli", "path": "/src/delivery/command/diff.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matthewkennedy5/Poker path: /rust/tests/tests.rs ctionType::Bet, amount: 750, }, Action { action: ActionType::Bet, amount: 2500, }, Action { action: ActionType::Call, amount: 2000, }, Acti...
code_fim
hard
{ "lang": "rust", "repo": "matthewkennedy5/Poker", "path": "/rust/tests/tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matthewkennedy5/Poker path: /rust/tests/tests.rs ; assert!(!bot_strategy_contains_amount( 19834, "Ts8s", "Js5sQc", actions )); } // Due to a bug in action translation, the out of position player's "all in" size (18750) bigger // can be bigger than its remaining stack (18450) #[t...
code_fim
hard
{ "lang": "rust", "repo": "matthewkennedy5/Poker", "path": "/rust/tests/tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let actions: Vec<Action> = vec![ Action { action: ActionType::Bet, amount: 200, }, Action { action: ActionType::Bet, amount: 1250, }, Action { action: ActionType::Call, amount: 1050, ...
code_fim
hard
{ "lang": "rust", "repo": "matthewkennedy5/Poker", "path": "/rust/tests/tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>_number(array_value[4])@, @lib.check_number(array_value[5])@ @/repeat@<|fim_prefix|>// repo: bradunov/shkola path: /questions/numbers/q00069/text.rs Napiši redom, od najmanjeg do najvećeg, sve trocifrene brojeve koji su @repeat(4)@ @ce<|fim_middle|>nter@ veći od @leftb@, a manji od...
code_fim
medium
{ "lang": "rust", "repo": "bradunov/shkola", "path": "/questions/numbers/q00069/text.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bradunov/shkola path: /questions/numbers/q00069/text.rs Napiši redom, od najmanjeg do najvećeg, sve trocifrene brojeve koji su @repeat(4)@ @ce<|fim_suffix|>_number(array_value[4])@, @lib.check_number(array_value[5])@ @/repeat@<|fim_middle|>nter@ veći od @leftb@, a manji od...
code_fim
medium
{ "lang": "rust", "repo": "bradunov/shkola", "path": "/questions/numbers/q00069/text.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn puzzle1() { assert_cli::Assert::main_binary() .stdin("289326") .stdout() .is("295229") .unwrap(); }<|fim_prefix|>// repo: zayenz/advent-of-code-2017 path: /day3-2/tests/samples.rs extern crate assert_cli; #[test] fn sample1() { assert_cli::Assert::main_...
code_fim
hard
{ "lang": "rust", "repo": "zayenz/advent-of-code-2017", "path": "/day3-2/tests/samples.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn sample3() { assert_cli::Assert::main_binary() .stdin("58") .stdout() .is("59") .unwrap(); } #[test] fn puzzle1() { assert_cli::Assert::main_binary() .stdin("289326") .stdout() .is("295229") .unwrap(); }<|fim_prefix|>// rep...
code_fim
medium
{ "lang": "rust", "repo": "zayenz/advent-of-code-2017", "path": "/day3-2/tests/samples.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zayenz/advent-of-code-2017 path: /day3-2/tests/samples.rs extern crate assert_cli; #[test] fn sample1() { assert_cli::Assert::main_binary() .stdin("3") .stdout() .is("4") .unwrap(); } <|fim_suffix|> assert_cli::Assert::main_binary() .stdin("289326...
code_fim
hard
{ "lang": "rust", "repo": "zayenz/advent-of-code-2017", "path": "/day3-2/tests/samples.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alan-love/rs_pbrt path: /src/core/spectrum.rs 0.155_366_7, 0.146_230_0, 0.137_490_0, 0.129_146_7, 0.121_200_0, 0.113_639_7, 0.106_465_0, 0.099_690_44, 0.093_330_61, 0.087_400_00, 0.081_900_96, 0.076_804_28, 0.072_077_12, 0.067_686_640, 0....
code_fim
hard
{ "lang": "rust", "repo": "Alan-love/rs_pbrt", "path": "/src/core/spectrum.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alan-love/rs_pbrt path: /src/core/spectrum.rs _18, 0.000_011_362_54, 0.000_010_600_00, 0.000_009_885_877, 0.000_009_217_304, 0.000_008_592_362, 0.000_008_009_133, 0.000_007_465_700, 0.000_006_959_567, 0.000_006_487_995, 0.000_006_048_699, 0.000_005_639...
code_fim
hard
{ "lang": "rust", "repo": "Alan-love/rs_pbrt", "path": "/src/core/spectrum.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>.000_002_797_139, 0.000_002_607_800, 0.000_002_431_220, 0.000_002_266_531, 0.000_002_113_013, 0.000_001_969_943, 0.000_001_836_600, 0.000_001_712_230, 0.000_001_596_228, 0.000_001_488_090, 0.000_001_387_314, 0.000_001_293_400, 0.000_001_205_820, 0.000_00...
code_fim
hard
{ "lang": "rust", "repo": "Alan-love/rs_pbrt", "path": "/src/core/spectrum.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fdumontmd/adventofcode path: /2019/day-08/src/main.rs static INPUT: &str = include_str!("input.txt"); static WIDTH: usize = 25; static HEIGHT: usize = 6; fn part_1(desc: &str, width: usize, height: usize) -> usize { <|fim_suffix|>fn part_2(desc: &str, width: usize, height: usize) -> Vec<Vec<u8>...
code_fim
hard
{ "lang": "rust", "repo": "fdumontmd/adventofcode", "path": "/2019/day-08/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }