text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: thuchede/aoc-2020-rust path: /src/day08.rs use std::fs::File; use regex::Regex; use std::str::FromStr; use crate::helpers; // ____________________ // Part 1 // ____________________ pub fn day8_1() -> i32 { return run_part_1_for_file(String::from("src/input/day08.txt")); } fn run_part_1_fo...
code_fim
hard
{ "lang": "rust", "repo": "thuchede/aoc-2020-rust", "path": "/src/day08.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some((_, read_flag)) = instructions.get_mut(index) { if *read_flag { return Err(acc); } else { *read_flag = true; } let (instruction, _) = instructions.get(index).unwrap(); let res = match instruction { Instruction...
code_fim
hard
{ "lang": "rust", "repo": "thuchede/aoc-2020-rust", "path": "/src/day08.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[cfg(test)] mod tests { use super::*; #[test] fn test_day8_1() { assert_eq!(1137, day8_1()); } #[test] fn test_part_sample1() { assert_eq!(5, run_part_1_for_file(String::from("src/input/day08-sample.txt"))); } // ____________________ // Part 2 /...
code_fim
hard
{ "lang": "rust", "repo": "thuchede/aoc-2020-rust", "path": "/src/day08.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: smathog/Exercism path: /rust/prime-factors/src/lib.rs pub fn factors(mut n: u64) -> Vec<u64> { //Not the most efficient algorithm (si<|fim_suffix|>i in 2..=n { while n % i == 0 { n /= i; factors.push(i); } if n == 1 { break; ...
code_fim
medium
{ "lang": "rust", "repo": "smathog/Exercism", "path": "/rust/prime-factors/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>i in 2..=n { while n % i == 0 { n /= i; factors.push(i); } if n == 1 { break; } } factors }<|fim_prefix|>// repo: smathog/Exercism path: /rust/prime-factors/src/lib.rs pub fn factors(mut n: u64) -> Vec<u64> { //Not the most e...
code_fim
medium
{ "lang": "rust", "repo": "smathog/Exercism", "path": "/rust/prime-factors/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lambdastackio/azure-sdk-rust path: /src/azure/service_bus/event_hub/client.rs use azure::service_bus::event_hub::send_event; use azure::core::errors::AzureError; use time::Duration; use std::io::Read; use crypto::sha2::Sha256; use crypto::hmac::Hmac; pub struct Client { namespace: String,...
code_fim
medium
{ "lang": "rust", "repo": "lambdastackio/azure-sdk-rust", "path": "/src/azure/service_bus/event_hub/client.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut c = Client::new("namespace", "event_hub", "policy", "key"); c.hmac.input(str_to_sign.as_bytes()); let sig = c.hmac.result().code().to_base64(STANDARD); assert_eq!(sig, "2UNXaoPpeJBAhh6qxmTqXyNzTpOflGO6IhxegeUQBcU="); } }<|fim_prefix|>// repo: lambdastackio/azu...
code_fim
hard
{ "lang": "rust", "repo": "lambdastackio/azure-sdk-rust", "path": "/src/azure/service_bus/event_hub/client.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod test { #[allow(unused_imports)] use super::Client; #[test] pub fn client_ctor() { Client::new("namespace", "event_hub", "policy", "key"); } #[test] pub fn client_enc() { use crypto::mac::Mac; use serialize::base64::{STANDARD, ToBase64}...
code_fim
hard
{ "lang": "rust", "repo": "lambdastackio/azure-sdk-rust", "path": "/src/azure/service_bus/event_hub/client.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alpalg/rust_learn path: /modules/src/main.rs use std::{cmp::Ordering, iter}; use std::{self, write}; use std::collections::*; mod sound; mod menu; mod performance_group; mod plant; use crate::sound::sound::instrument::strings; use self::sound::sound::instrument::woodwind::clarinet; fn main() ...
code_fim
medium
{ "lang": "rust", "repo": "alpalg/rust_learn", "path": "/modules/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> performance_group::performance_group::music_group(); performance_group::performance_group::instrument::strings::guitar(); }<|fim_prefix|>// repo: alpalg/rust_learn path: /modules/src/main.rs use std::{cmp::Ordering, iter}; use std::{self, write}; use std::collections::*; mod sound; mod menu; mod...
code_fim
hard
{ "lang": "rust", "repo": "alpalg/rust_learn", "path": "/modules/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match body { Atom(a) => Atom(a), Sum(n, constructor, values) => { let subbed_values = values.into_iter().map(|val| sub_at_index(val, t, index)).collect(); Sum(n, constructor, subbed_values) }, Case(arg, cases, default) => { let new_ar...
code_fim
hard
{ "lang": "rust", "repo": "cdouglass/samara", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cdouglass/samara path: /src/lib.rs pub mod ui; mod lex; use self::lex::build_lexer; use self::lex::build_lexer_decl; use self::lex::TokenStream; mod structures; use self::structures::Atom::*; use self::structures::LetBinding; use self::structures::Op::*; use self::structures::Term; use self::s...
code_fim
hard
{ "lang": "rust", "repo": "cdouglass/samara", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn usertype_works() { } #[test] fn utility_works() { } }<|fim_prefix|>// repo: vztpv/ClauTextRS path: /src/lib.rs mod itemtype; mod utility; use itemtype::item_type; use utility::Utility; use std::io::prelude::*; use std::fs::File; #[cfg(test)] mod test...
code_fim
medium
{ "lang": "rust", "repo": "vztpv/ClauTextRS", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vztpv/ClauTextRS path: /src/lib.rs mod itemtype; mod utility; use itemtype::item_type; use utility::Utility; use std::io::prelude::*; use std::fs::File; #[cfg(test)] mod tests { #[test] fn itemtype_works() { <|fim_suffix|> assert!(*x.get_name() == "abc".to_string()); ...
code_fim
medium
{ "lang": "rust", "repo": "vztpv/ClauTextRS", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: UMASHIBA1/MyRustTutorialPractice path: /4/4_23/clojure/src/main.rs // クロージャ fn clojure_test() { // クロージャは返り値の型を示さない let plus_one = |x: i32| x + 1; assert_eq!(2, plus_one(1)); // 複数行のクロージャを書くことも可能 let plus_two = |x| { let mut result: i32 = x; result += 1; ...
code_fim
hard
{ "lang": "rust", "repo": "UMASHIBA1/MyRustTutorialPractice", "path": "/4/4_23/clojure/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> i + 1 } let f = add_one; let answer = call_with_one(&f); assert_eq!(2, answer); // クロージャを返す fn factory() -> Box<Fn(i32) -> i32> { let num = 5; Box::new(move |x| x + num) } let f = factory(); let answer = f(1); assert_eq!(6, answer); } fn...
code_fim
hard
{ "lang": "rust", "repo": "UMASHIBA1/MyRustTutorialPractice", "path": "/4/4_23/clojure/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andoriyu/material-design-icons-rs path: /src/materialicons/device/icon_screen_search_desktop.rs pub struct IconScreenSearchDesktop { props: crate::Props, } impl yew::Component for IconScreenSearchDesktop { type Properties = crate::Props; type Message = (); fn create(props: Self::Pr...
code_fim
medium
{ "lang": "rust", "repo": "andoriyu/material-design-icons-rs", "path": "/src/materialicons/device/icon_screen_search_desktop.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> out_stream.write_all(&block); out_stream.close(); }); // connect to server match TcpStream::connect("127.0.0.1:15605") { Ok(stream) => { // read block from stream let mut in_stream = BlockInputStream::new( ...
code_fim
hard
{ "lang": "rust", "repo": "hamersaw/utilities-rs", "path": "/hdfs-comm/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut buf = Vec::new(); in_stream.read_to_end(&mut buf); in_stream.close(); println!("buf len: {}", buf.len()); }, Err(e) => println!("failed to connect to server"), } // join server thread j...
code_fim
hard
{ "lang": "rust", "repo": "hamersaw/utilities-rs", "path": "/hdfs-comm/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hamersaw/utilities-rs path: /hdfs-comm/src/lib.rs #[macro_use] extern crate log; pub mod block; pub mod rpc; #[cfg(test)] mod tests { #[test] fn transfer_random_block() { use rand::Rng; use std::io::{Read, Write}; use std::net::{TcpListener, TcpStream}; ...
code_fim
hard
{ "lang": "rust", "repo": "hamersaw/utilities-rs", "path": "/hdfs-comm/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: foxfriends/lumber path: /src/ast/fields.rs use super::*; use crate::parser::Rule; use std::collections::BTreeMap; #[derive(Clone, Hash, Eq, PartialEq, Default, Debug)] pub(crate) struct Fields { pub fields: BTreeMap<Atom, Pattern>, } <|fim_suffix|>impl IntoIterator for Fields { type It...
code_fim
hard
{ "lang": "rust", "repo": "foxfriends/lumber", "path": "/src/ast/fields.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl IntoIterator for Fields { type Item = <BTreeMap<Atom, Pattern> as IntoIterator>::Item; type IntoIter = <BTreeMap<Atom, Pattern> as IntoIterator>::IntoIter; fn into_iter(self) -> Self::IntoIter { self.fields.into_iter() } }<|fim_prefix|>// repo: foxfriends/lumber path: /src/a...
code_fim
medium
{ "lang": "rust", "repo": "foxfriends/lumber", "path": "/src/ast/fields.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn iter(&self) -> impl Iterator<Item = (&Atom, &Pattern)> { self.fields.iter() } } impl IntoIterator for Fields { type Item = <BTreeMap<Atom, Pattern> as IntoIterator>::Item; type IntoIter = <BTreeMap<Atom, Pattern> as IntoIterator>::IntoIter; fn into_iter(self) -> Self::...
code_fim
hard
{ "lang": "rust", "repo": "foxfriends/lumber", "path": "/src/ast/fields.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn run_toy_vec_03() { let testdir = TestDir::new("./examples/toy_vec_03", "Run ToyVec example 03"); let output = testdir.cmd().expect_success(); assert!(output.stdout_str().is_empty()); assert!(output.stderr_str().is_empty()); }<|fim_prefix|>// repo: rike422/rustbook path: /ch07/t...
code_fim
hard
{ "lang": "rust", "repo": "rike422/rustbook", "path": "/ch07/toy-vec/tests/integration_tests.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rike422/rustbook path: /ch07/toy-vec/tests/integration_tests.rs use cli_test_dir::*; // バイナリを実行して入出力を確認するテスト // `cargo test` で実行できる #[test] fn run_toy_vec_01() { <|fim_suffix|>#[test] fn run_toy_vec_02() { let testdir = TestDir::new("./examples/toy_vec_02", "Run ToyVec example 02"); le...
code_fim
hard
{ "lang": "rust", "repo": "rike422/rustbook", "path": "/ch07/toy-vec/tests/integration_tests.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wiltonlazary/wasmer path: /lib/compiler-singlepass/src/x64_decl.rs //! X64 structures. use crate::common_decl::{MachineState, MachineValue, RegisterIndex}; use std::collections::BTreeMap; use wasmer_compiler::CallingConvention; use wasmer_types::Type; /// General-purpose registers. #[repr(u8)]...
code_fim
hard
{ "lang": "rust", "repo": "wiltonlazary/wasmer", "path": "/lib/compiler-singlepass/src/x64_decl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// An allocator that allocates registers for function arguments according to the System V ABI. #[derive(Default)] pub struct ArgumentRegisterAllocator { n_gprs: usize, n_xmms: usize, } impl ArgumentRegisterAllocator { /// Allocates a register for argument type `ty`. Returns `None` if no regi...
code_fim
hard
{ "lang": "rust", "repo": "wiltonlazary/wasmer", "path": "/lib/compiler-singlepass/src/x64_decl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>le, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustc-perf", "path": "/collector/compile-benchmarks/issue-58319/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rustc-perf path: /collector/compile-benchmarks/issue-58319/src/main.rs fn main() {} #[derive(Clone)] pub struct Little; #[derive(Clone)] pub struct Big( Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, Little, ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustc-perf", "path": "/collector/compile-benchmarks/issue-58319/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: OrangeTux/servus path: /build.rs use std::env; fn main() { match env::var(<|fim_suffix|>=web") }, Err(_) => {}, } }<|fim_middle|>"SERVUS_WEB") { Ok(value) => if value == "1" { println!("cargo:rustc-cfg
code_fim
medium
{ "lang": "rust", "repo": "OrangeTux/servus", "path": "/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>== "1" { println!("cargo:rustc-cfg=web") }, Err(_) => {}, } }<|fim_prefix|>// repo: OrangeTux/servus path: /build.rs use std::env; fn main() { match env::var(<|fim_middle|>"SERVUS_WEB") { Ok(value) => if value
code_fim
easy
{ "lang": "rust", "repo": "OrangeTux/servus", "path": "/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: OrangeTux/servus path: /build.rs use std::env; fn main() { match env::var("SERVUS_WEB") { Ok(value) => if value <|fim_suffix|>=web") }, Err(_) => {}, } }<|fim_middle|>== "1" { println!("cargo:rustc-cfg
code_fim
easy
{ "lang": "rust", "repo": "OrangeTux/servus", "path": "/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: scampi/falcon path: /src/interpreter/variables.rs //! This module manages variables appearing in the script. A variable is by //! default global, but can be local if declared within a function. A variable //! is either a scalar or an array and this module provides logic for //! getting/setting f...
code_fim
hard
{ "lang": "rust", "repo": "scampi/falcon", "path": "/src/interpreter/variables.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Add a new function call to the stack, where `locals` is the set of /// variables which scope is limited to the function, and `references` /// is a set of array variables that points to those in the current set. pub fn push_local_stack( &mut self, locals: HashMap<String,...
code_fim
hard
{ "lang": "rust", "repo": "scampi/falcon", "path": "/src/interpreter/variables.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Rahix/eagre-asn1 path: /src/der/der.rs use byteorder::{BigEndian, ReadBytesExt, WriteBytesExt}; use std::io::{self, Read, Write}; use super::*; /// The base trait for DER /// /// Every type implementing this trait may be serialized /// /// Note that only `der_intermediate()` and `der_from_inte...
code_fim
hard
{ "lang": "rust", "repo": "Rahix/eagre-asn1", "path": "/src/der/der.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn der_content() -> ContentType { ContentType::Constructed } fn der_encode_content(&self, w: &mut dyn Write) -> io::Result<()> { for item in self.iter() { item.der_encode(w)?; } Ok(()) } fn der_decode_content(r: &mut dyn Read, length: usize...
code_fim
hard
{ "lang": "rust", "repo": "Rahix/eagre-asn1", "path": "/src/der/der.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lzw5399/rust-rookie path: /h_hashmap/src/main.rs use std::collections::HashMap; fn main() { <|fim_suffix|> let filtered = hm .iter() .filter(|&(k,v)| *k == "c") .cloned() .collect(); }<|fim_middle|> // 1. 声明 let mut hm = HashMap::new(); // 2. 插入 ...
code_fim
hard
{ "lang": "rust", "repo": "lzw5399/rust-rookie", "path": "/h_hashmap/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let filtered = hm .iter() .filter(|&(k,v)| *k == "c") .cloned() .collect(); }<|fim_prefix|>// repo: lzw5399/rust-rookie path: /h_hashmap/src/main.rs use std::collections::HashMap; fn main() { // 1. 声明 let mut hm = HashMap::new(); // 2. 插入 hm.insert("a...
code_fim
easy
{ "lang": "rust", "repo": "lzw5399/rust-rookie", "path": "/h_hashmap/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arontsang/smol-quiche path: /src/lib.rs use async_net::UdpSocket; use crossfire::mpmc::{RxFuture, SharedFutureBoth}; use smol::channel::{Sender, Receiver, RecvError}; use smol::lock::Mutex; use smol::LocalExecutor; use std::collections::HashMap; use std::pin::Pin; use std::rc::Rc; use std::net:...
code_fim
hard
{ "lang": "rust", "repo": "arontsang/smol-quiche", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let ret = SmolHttp3Client{ connection: connection.connection.clone(), http_client: http_client, dispatch_table: connection.dispatch_table.clone(), send_packet_event_sender: connection.send_packet_event_sender.clone(), timeout_event_sender...
code_fim
hard
{ "lang": "rust", "repo": "arontsang/smol-quiche", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> { let connection = connection.clone(); scheduler.run(async move { loop { let is_connected = { let connection = connection.lock().await; connection.is_established() }; ...
code_fim
hard
{ "lang": "rust", "repo": "arontsang/smol-quiche", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn create_instance(&self, create_info: &vk::InstanceCreateInfo, allocation_callbacks: Option<&vk::AllocationCallbacks>) -> Result<Instance<Self::Fp>, InstanceError> { unsafe { let mut instance: vk::Instance = mem:...
code_fim
hard
{ "lang": "rust", "repo": "acmcarther/next_space_coop", "path": "/cargo/vendor/ash-0.14.2/src/entry.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: acmcarther/next_space_coop path: /cargo/vendor/ash-0.14.2/src/entry.rs use prelude::*; use std::mem; use std::ptr; use vk; use instance::Instance; use shared_library::dynamic_library::DynamicLibrary; use std::path::Path; use ::RawPtr; use version::{FunctionPointers, V1_0, InstanceLoader, EntryLo...
code_fim
hard
{ "lang": "rust", "repo": "acmcarther/next_space_coop", "path": "/cargo/vendor/ash-0.14.2/src/entry.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<V: FunctionPointers> Entry<V> { pub fn new() -> Result<Entry<V>, LoadingError> { let static_fn = match *VK_LIB { Ok(ref lib) => { let static_fn = vk::StaticFn::load(|name| unsafe { let name = name.to_str().unwrap(); ...
code_fim
hard
{ "lang": "rust", "repo": "acmcarther/next_space_coop", "path": "/cargo/vendor/ash-0.14.2/src/entry.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bartlomieju/dprint path: /crates/dprint/src/cli/arg_parser.rs use std::path::PathBuf; use crate::environment::Environment; use crate::types::ErrBox; pub struct CliArgs { pub sub_command: SubCommand, pub allow_node_modules: bool, pub verbose: bool, pub file_patterns: Vec<String>,...
code_fim
hard
{ "lang": "rust", "repo": "bartlomieju/dprint", "path": "/crates/dprint/src/cli/arg_parser.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> dprint fmt "**/*.{ts,tsx,js,jsx,json}""#, ) .subcommand( SubCommand::with_name("init") .about("Initializes a configuration file in the current directory.") ) .subcommand( SubCommand::with_name("fmt") .about("Form...
code_fim
hard
{ "lang": "rust", "repo": "bartlomieju/dprint", "path": "/crates/dprint/src/cli/arg_parser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>OPTIONS: {unified} ARGS: {positionals} {after-help}"#) .after_help( r#"GETTING STARTED: 1. Navigate to the root directory of a code repository 2. Run `dprint init` to create a dprint.config.json file in that directory 3. Modify configuration file if necessary 4. Run `...
code_fim
hard
{ "lang": "rust", "repo": "bartlomieju/dprint", "path": "/crates/dprint/src/cli/arg_parser.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: accierro/leetcode-solutions path: /easy/arrays/next_greater_element_1/src/main.rs // You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1's elements in the corresponding places of nums2. // The Next...
code_fim
hard
{ "lang": "rust", "repo": "accierro/leetcode-solutions", "path": "/easy/arrays/next_greater_element_1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!( Solution::next_greater_element( vec![ 137, 59, 92, 122, 52, 131, 79, 236, 94, 171, 141, 86, 169, 199, 248, 120, 196, 168, 77, 71, 5, 198, 215, 230, 176, 87, 189, 206, 115, 76, 13, 216, 197, 26, 183, 54, 250, 27, 109, 140, ...
code_fim
hard
{ "lang": "rust", "repo": "accierro/leetcode-solutions", "path": "/easy/arrays/next_greater_element_1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zerox029/RustyBunny path: /src/utils/calendar.rs use chrono::prelude::*; pub fn construct_calendar_url(query: &str) -> String { if query == "cal" { let google_calendar = "https://calendar.google.com/calendar/u/0/r/"; google_calendar.to_string() } else { construct_calendar_url_d...
code_fim
medium
{ "lang": "rust", "repo": "zerox029/RustyBunny", "path": "/src/utils/calendar.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let fake_query = "cal d 2020 11 3"; let expected_value = "https://calendar.google.com/calendar/u/0/r/day/2020/11/3"; assert_eq!(construct_calendar_url(fake_query), expected_value); } }<|fim_prefix|>// repo: zerox029/RustyBunny path: /src/utils/calendar.rs use chrono::prelude::*; pub fn co...
code_fim
hard
{ "lang": "rust", "repo": "zerox029/RustyBunny", "path": "/src/utils/calendar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut render_pass = encoder.begin_render_pass(&wgpu::RenderPassDescriptor { label: Some("Render Pass"), color_attachments: &[ // [[location(0)]] in the fragment shader targets this attachment wgpu::RenderPassColorAttachment { ...
code_fim
hard
{ "lang": "rust", "repo": "rhysd/misc", "path": "/wgpu/src/triangle_example.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rhysd/misc path: /wgpu/src/triangle_example.rs use bytemuck::{Pod, Zeroable}; use std::f32; use std::iter; use std::mem; use wgpu::util::DeviceExt as _; use winit::dpi::PhysicalSize; use winit::event::*; use winit::event_loop::{ControlFlow, EventLoop}; use winit::window::Window; use winit::windo...
code_fim
hard
{ "lang": "rust", "repo": "rhysd/misc", "path": "/wgpu/src/triangle_example.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Update color let mut red = self.vertices[0].color; if red[2] >= 1.0 { let i = red.iter().position(|f| *f > -1.0).unwrap(); red[i] -= 0.02; } else { let i = red.iter().position(|f| *f < 1.0).unwrap(); red[i] += 0.02; ...
code_fim
hard
{ "lang": "rust", "repo": "rhysd/misc", "path": "/wgpu/src/triangle_example.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: astro/rust-lpc43xx path: /src/eventrouter/enable/mod.rs ct WAKEUP3_ENR { bits: bool, } impl WAKEUP3_ENR { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { self.bits } #[doc = r" Returns `true` if the bit is clear (0)"] #[inline...
code_fim
hard
{ "lang": "rust", "repo": "astro/rust-lpc43xx", "path": "/src/eventrouter/enable/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: astro/rust-lpc43xx path: /src/eventrouter/enable/mod.rs () } #[doc = r" Returns `true` if the bit is set (1)"] #[inline] pub fn bit_is_set(&self) -> bool { self.bit() } } #[doc = r" Value of the field"] pub struct WAKEUP2_ENR { bits: bool, } impl WAKEUP2_ENR { ...
code_fim
hard
{ "lang": "rust", "repo": "astro/rust-lpc43xx", "path": "/src/eventrouter/enable/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>oc = r" Value of the field"] pub struct DPDRESET_ENR { bits: bool, } impl DPDRESET_ENR { #[doc = r" Value of the field as raw bits"] #[inline] pub fn bit(&self) -> bool { self.bits } #[doc = r" Returns `true` if the bit is clear (0)"] #[inline] pub fn bit_is_clear(&...
code_fim
hard
{ "lang": "rust", "repo": "astro/rust-lpc43xx", "path": "/src/eventrouter/enable/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> { *result = format!("{}{}\n", result, content); } let type_declarations = format_node::get_types(root, true); if !type_declarations.is_empty() { write_header(&mut result, "Type Declarations"); write(&mut result, type_declarations); } let type_definitio...
code_fim
medium
{ "lang": "rust", "repo": "rajin-s/specs", "path": "/src/compiler/_old/_older/output/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let type_declarations = format_node::get_types(root, true); if !type_declarations.is_empty() { write_header(&mut result, "Type Declarations"); write(&mut result, type_declarations); } let type_definitions = format_node::get_types(root, false); if !type_definitions....
code_fim
hard
{ "lang": "rust", "repo": "rajin-s/specs", "path": "/src/compiler/_old/_older/output/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rajin-s/specs path: /src/compiler/_old/_older/output/mod.rs use crate::language::nodes::*; use crate::language::runtime; mod format_node; pub fn get_c_string(root: &Node) -> String { let mut result = String::new(); result.push_str("#include \"specs_runtime.h\""); fn write_header(...
code_fim
hard
{ "lang": "rust", "repo": "rajin-s/specs", "path": "/src/compiler/_old/_older/output/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub enum BlockType { Wall, Empty, SnakeHead, SnakeBody, PlusOne }<|fim_prefix|>// repo: g33kidd/rust-games path: /snake/src/block.rs use location::Location; <|fim_middle|>#[derive(Debug)] pub struct Block { pub location: Location, pub block_type: BlockType } ...
code_fim
medium
{ "lang": "rust", "repo": "g33kidd/rust-games", "path": "/snake/src/block.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: g33kidd/rust-games path: /snake/src/block.rs use location::Location; <|fim_suffix|>#[derive(Debug)] pub enum BlockType { Wall, Empty, SnakeHead, SnakeBody, PlusOne }<|fim_middle|>#[derive(Debug)] pub struct Block { pub location: Location, pub block_type: BlockType } ...
code_fim
medium
{ "lang": "rust", "repo": "g33kidd/rust-games", "path": "/snake/src/block.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nolwn/rust_server path: /src/main.rs // These are features required by Rocket that are contained in the "Nightly" build #![feature(proc_macro_hygiene, decl_macro, plugin)] // #![plugin(rocket_codegen)] // This is Rocket! I don't know what "macro_use" means, but it's how you import it so... cool...
code_fim
medium
{ "lang": "rust", "repo": "nolwn/rust_server", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> movie_routes::movies(); rocket::ignite() // Prep for launch... .mount("/", routes![ movie_routes::movies, movie_routes::movie, movie_routes::create_movie, actors]) // Pull in the routes... .register(catchers![not_found]) // Pull in th...
code_fim
hard
{ "lang": "rust", "repo": "nolwn/rust_server", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rome/tools path: /crates/rome_js_formatter/src/js/module/export_named_from_specifier.rs use crate::prelude::*; use rome_formatter::write; use rome_js_syntax::JsExportNamedFromSpecifier; use rome_js_syntax::JsExportNamedFromSpecifierFields; #[derive(Debug, Clone, Default)] pub(crate) struct For...
code_fim
hard
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_js_formatter/src/js/module/export_named_from_specifier.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(export_as) = export_as { write!(f, [space(), export_as.format()])?; } Ok(()) } }<|fim_prefix|>// repo: rome/tools path: /crates/rome_js_formatter/src/js/module/export_named_from_specifier.rs use crate::prelude::*; use rome_formatter::write; use rome_j...
code_fim
medium
{ "lang": "rust", "repo": "rome/tools", "path": "/crates/rome_js_formatter/src/js/module/export_named_from_specifier.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns the encoded public point. pub fn encoded_public_key(&self) -> Result<Vec<u8>, ()> { let mut ret = Vec::new(); ret.resize(self.public_point_len(), 0); try!(self.fill_with_encoded_public_key(&mut ret[..])); Ok(ret) } fn oct_to_point(&self, point_b...
code_fim
hard
{ "lang": "rust", "repo": "viadata/rust-ipfs", "path": "/src/crypto/ecc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: viadata/rust-ipfs path: /src/crypto/ecc.rs #![allow(non_camel_case_types)] //! Elliptic curve DH. extern crate libc; use self::libc::{c_int, size_t}; use std::ptr; enum EC_KEY { } enum EC_POINT { } enum EC_GROUP { } /// An ephemeral key pair. pub struct EphemeralKeyPair { key: *mut EC_KE...
code_fim
hard
{ "lang": "rust", "repo": "viadata/rust-ipfs", "path": "/src/crypto/ecc.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn EC_KEY_free(key: *mut EC_KEY); fn ECDH_compute_key(out: *mut u8, out_len: size_t, pub_key: *const EC_POINT, ec_key: *mut EC_KEY, kdf: *const u8) -> c_int; fn EC_POINT_ne...
code_fim
hard
{ "lang": "rust", "repo": "viadata/rust-ipfs", "path": "/src/crypto/ecc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 3Hren/photon path: /src/geometry/sphere.rs use crate::{geometry::Geometry, matrix::Matrix4x4, transform::Transform, vec3::Vec3, vec4::Vec4, Intersection, Ray}; #[derive(Copy, Clone, Debug, Deserialize)] pub struct Sphere { center: Vec3<f64>, radius: f64, } impl Geometry for Sphere { ...
code_fim
medium
{ "lang": "rust", "repo": "3Hren/photon", "path": "/src/geometry/sphere.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let vec4 = Vec4::new(self.center.x, self.center.y, self.center.z, 1.0); self.center = (transformation * vec4).into(); } }<|fim_prefix|>// repo: 3Hren/photon path: /src/geometry/sphere.rs use crate::{geometry::Geometry, matrix::Matrix4x4, transform::Transform, vec3::Vec3, vec4::Vec4, I...
code_fim
medium
{ "lang": "rust", "repo": "3Hren/photon", "path": "/src/geometry/sphere.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Dstri26/21-days-Programming path: /Day13/main.rs /* DAY 13: Given a positive integer n( 1 <= n <= 1015). Find the largest prime factor of a number. Details: The program can be used to find the largest prime factor of a number. Inputs: Input any number. Outputs: Print largest prime factor of...
code_fim
medium
{ "lang": "rust", "repo": "Dstri26/21-days-Programming", "path": "/Day13/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut k: i64 = 0; for i in 2..num { if num % i == 0 { k = -1; } } if k == -1 { false } else { true } } fn main() { let num: i64 = read!(); for i in 2..num{ if num%i==0{ if prime_check(num/i) { ...
code_fim
medium
{ "lang": "rust", "repo": "Dstri26/21-days-Programming", "path": "/Day13/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ryanhossain9797/snips-nlu-rs path: /src/intent_classifier/featurizer.rs es: Vec<f32> = vectorizer.transform(input)?; features.extend(cooccurrence_features) }; Ok(Array::from_iter(features)) } } pub struct TfidfVectorizer { builtin_entity_scope: Vec<BuiltinEnt...
code_fim
hard
{ "lang": "rust", "repo": "ryanhossain9797/snips-nlu-rs", "path": "/src/intent_classifier/featurizer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ryanhossain9797/snips-nlu-rs path: /src/intent_classifier/featurizer.rs ds_replacement_string; let ontology_language = Language::from_str(model.language_code.as_ref())?; let language = NluUtilsLanguage::from_language(ontology_language); Ok(Self { language, ...
code_fim
hard
{ "lang": "rust", "repo": "ryanhossain9797/snips-nlu-rs", "path": "/src/intent_classifier/featurizer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_transform() { // Given let mocked_custom_parser = MockedCustomEntityParser::from_iter(vec![( "hello this bird is a beauti bird with 22 wings".to_string(), vec![ CustomEntity { value: "hello".to_string(), ...
code_fim
hard
{ "lang": "rust", "repo": "ryanhossain9797/snips-nlu-rs", "path": "/src/intent_classifier/featurizer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> } }; // Convert the position let gmst = satellite::propogation::gstime::gstime_datetime(time); let sat_pos = satellite::transforms::eci_to_geodedic(&result.position, gmst); // Save the point tracks[i] = TrackPoint { ...
code_fim
hard
{ "lang": "rust", "repo": "richinfante/satellite-screensaver", "path": "/rust/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: richinfante/satellite-screensaver path: /rust/src/lib.rs extern crate satellite; extern crate chrono; use chrono::prelude::*; use chrono::Duration; use std::os::raw::*; use std::ffi::{CString, CStr}; #[repr(C)] #[derive(Copy, Clone)] struct TrackPoint { pub latitude: f64, pub longitude...
code_fim
hard
{ "lang": "rust", "repo": "richinfante/satellite-screensaver", "path": "/rust/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return Track { error: false, current: current_pos, track: tracks } } return Track { error: true, current: TrackPoint { latitude: 0.0, longitude: 0.0, altitude: 0.0, }, track: [T...
code_fim
hard
{ "lang": "rust", "repo": "richinfante/satellite-screensaver", "path": "/rust/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn ZopfliCostModelSetFromCommands( mut xself : &mut ZopfliCostModel, mut position : usize, mut ringbuffer : & [u8], mut ringbuffer_mask : usize, mut commands : & [Command], mut num_commands : usize, mut last_insert_len : usize ) { let mut histogram_literal : *mut u32; l...
code_fim
hard
{ "lang": "rust", "repo": "dropbox/rust-brotli", "path": "/corrosion/backward_references_hq_safe.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dropbox/rust-brotli path: /corrosion/backward_references_hq_safe.rs apping_add(1 as (usize)); } if k >= 2usize { break 'continue28; } { let mut len : usize = min_len; j = 0...
code_fim
hard
{ "lang": "rust", "repo": "dropbox/rust-brotli", "path": "/corrosion/backward_references_hq_safe.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dropbox/rust-brotli path: /corrosion/backward_references_hq_safe.rs Code( &mut match_ ) } else { len ...
code_fim
hard
{ "lang": "rust", "repo": "dropbox/rust-brotli", "path": "/corrosion/backward_references_hq_safe.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KBryan/rust-algorand-sdk path: /src/transaction.rs use serde::{Deserialize, Serialize}; use crate::account::Account; use crate::crypto::{Address, MultisigSignature, Signature}; use crate::{Error, HashDigest, MicroAlgos, Round, VotePK, VRFPK}; const MIN_TXN_FEE: MicroAlgos = MicroAlgos(1000); ...
code_fim
hard
{ "lang": "rust", "repo": "KBryan/rust-algorand-sdk", "path": "/src/transaction.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Estimates the size of the encoded transaction, used in calculating the fee fn estimate_size(&self) -> Result<u64, Error> { let account = Account::generate(); let len = rmp_serde::to_vec_named(&account.sign_transaction(self)?)?.len() as u64; Ok(len) } } /// Wraps a t...
code_fim
hard
{ "lang": "rust", "repo": "KBryan/rust-algorand-sdk", "path": "/src/transaction.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Return brand spanking new HashNode Node::Hash { pos: newpos, index: newindex, hash: hashed, } } Node::Leaf { .. } => { // Write the value for the leaf node...
code_fim
hard
{ "lang": "rust", "repo": "davebryson/urkel-rs", "path": "/src/tree.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: davebryson/urkel-rs path: /src/tree.rs use hashutils::{sha3, sha3_value, Digest}; use nodes::Node; use proof::{has_bit, Proof, ProofType}; use store::Store; /// Base-2 Merkle Trie #[derive(Default)] pub struct UrkelTree<'a> { /// Root Node root: Option<Node<'a>>, /// Size in bits of...
code_fim
hard
{ "lang": "rust", "repo": "davebryson/urkel-rs", "path": "/src/tree.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dendisuhubdy/revm path: /bin/revm-ethereum-tests/src/models/mod.rs use bytes::Bytes; use primitive_types::{H160, H256, U256}; use std::{collections::{BTreeMap, HashMap}}; mod deserializer; mod spec; use deserializer::*; use serde_derive::*; pub use self::spec::SpecName; #[derive(Debug, Parti...
code_fim
hard
{ "lang": "rust", "repo": "dendisuhubdy/revm", "path": "/bin/revm-ethereum-tests/src/models/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use serde_json::Error; #[test] pub fn serialize_u256() -> Result<(), Error> { let json = r#"{"_item":"0x10"}"#; #[derive(Deserialize, Debug)] pub struct Test { _item: Option<U256>, } let out: Tes...
code_fim
hard
{ "lang": "rust", "repo": "dendisuhubdy/revm", "path": "/bin/revm-ethereum-tests/src/models/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let value: i64 = reg_match.as_str().parse().ok()?; let durations: Vec<_> = vec![ (r"^m(in(utes?)?)?$", Duration::minutes(value)), (r"^h(ours?)?$", Duration::hours(value)), (r"^d(ays?)?$", Duration::days(value)), (r"^w(eeks?)?$", Duration::weeks(value)), ] ....
code_fim
hard
{ "lang": "rust", "repo": "wa7sa34cx/nag", "path": "/src/agenda/time_parsing/parsers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let (word, remaining_words) = state.remaining_words.split_first()?; let time = match *word { "today" => Some(state.now), "tomorrow" => Some(state.now + Duration::days(1)), _ => None }?; let cron_updates = get_cron_from_time( time, &[ Cr...
code_fim
hard
{ "lang": "rust", "repo": "wa7sa34cx/nag", "path": "/src/agenda/time_parsing/parsers.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wa7sa34cx/nag path: /src/agenda/time_parsing/parsers.rs use std::convert::TryInto; use log::debug; use regex::Regex; use chrono::{DateTime, Datelike, Duration, Timelike}; use crate::DateFormat; use super::super::cron::{CronColumn, CronValue, CRON_COLUMNS}; use super::{ParsingState, ParseUpdate};...
code_fim
hard
{ "lang": "rust", "repo": "wa7sa34cx/nag", "path": "/src/agenda/time_parsing/parsers.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ax_level ( ) ) ; return ; } let exe = env : : current_exe ( ) . unwrap ( ) ; let out = process : : Command : : new ( exe ) . env ( " YOU_ARE_TESTING_NOW " " 1 " ) . env ( " RUST_LOG " " debug " ) . output ( ) . unwrap_or_else ( | e | panic ! ( " Unable to start child process : { } " e ) ) ; if out . statu...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/env_logger/tests/init-twice-retains-filter.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/env_logger/tests/init-twice-retains-filter.rs extern crate env_logger ; extern crate log ; use std : : env ; use std : : process ; use std : : str ; fn main ( ) { if env : : var ( " YOU_ARE_TESTING_NOW " ) . is_ok ( ) { / / Init from the env ( ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/env_logger/tests/init-twice-retains-filter.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use self::{ mutex::{Mutex, MutexGuard}, rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}, };<|fim_prefix|>// repo: ericyao2013/drone-core path: /src/sync/mod.rs //! Useful synchronization primitives. <|fim_middle|>pub mod spsc; mod mutex; mod rwlock;
code_fim
easy
{ "lang": "rust", "repo": "ericyao2013/drone-core", "path": "/src/sync/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ericyao2013/drone-core path: /src/sync/mod.rs //! Useful synchronization primitives. <|fim_suffix|>pub use self::{ mutex::{Mutex, MutexGuard}, rwlock::{RwLock, RwLockReadGuard, RwLockWriteGuard}, };<|fim_middle|>pub mod spsc; mod mutex; mod rwlock;
code_fim
easy
{ "lang": "rust", "repo": "ericyao2013/drone-core", "path": "/src/sync/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nemo157/amleth path: /benches/amleth.rs #![feature(test)] #![feature(fnbox)] #[macro_use] extern crate amleth; extern crate test; use test::{ Bencher, black_box }; fn run(mut s: String) -> String { <|fim_suffix|> assert_eq!( run(String::new()), "<div>Hello world!</div>"); }...
code_fim
hard
{ "lang": "rust", "repo": "Nemo157/amleth", "path": "/benches/amleth.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn run(mut s: String) -> String { use std::fmt::Write; let events = html!({ div { %("Hello world!") } }); for event in events { write!(s, "{}", event).unwrap(); } s } #[test] fn test() { assert_eq!( run(String::new()), "<div>...
code_fim
medium
{ "lang": "rust", "repo": "Nemo157/amleth", "path": "/benches/amleth.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>terial { pub fn dig_multiplier(self) -> f64 { match self { crate::ToolMaterial::Diamond => 8f64, crate::ToolMaterial::Golden => 12f64, crate::ToolMaterial::Iron => 6f64, crate::ToolMaterial::Stone => 4f64, crate::ToolMaterial::Wooden ...
code_fim
hard
{ "lang": "rust", "repo": "feather-rs/feather", "path": "/feather/old/definitions/src/generated/tool.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: feather-rs/feather path: /feather/old/definitions/src/generated/tool.rs // This file is @generated #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, ToPrimitive, FromPrimitive)] pub enum Tool { Axe, Pickaxe, Shovel, Hoe, Sword, Shears, } #[derive(Copy, Cl...
code_fim
hard
{ "lang": "rust", "repo": "feather-rs/feather", "path": "/feather/old/definitions/src/generated/tool.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>(165u32), crate::Item::IronHoe => Some(250u32), crate::Item::IronLeggings => Some(225u32), crate::Item::IronPickaxe => Some(250u32), crate::Item::IronShovel => Some(250u32), crate::Item::IronSword => Some(250u32), crate::Item::Leather...
code_fim
hard
{ "lang": "rust", "repo": "feather-rs/feather", "path": "/feather/old/definitions/src/generated/tool.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }