text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> let eps = T::from(1e-8).unwrap(); move |(param, (grad, AdamOptimizerCachedValue { v, s })): (&mut T, (&T, &mut AdamOptimizerCachedValue<T>))| { if !grad.is_finite() && !grad.is_zero() { dbg!(grad.to_f64()); } *v = beta_1 * *v + (T::one() - beta_1) * *grad; ...
code_fim
hard
{ "lang": "rust", "repo": "White-Green/selecting_flow", "path": "/src/optimizer/adam/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn update_once<T: Float + Send + Sync>(beta_1: T, beta_2: T, beta_1_t: T, beta_2_t: T, alpha: T) -> impl Fn((&mut T, (&T, &mut AdamOptimizerCachedValue<T>))) + Send + Sync { let eps = T::from(1e-8).unwrap(); move |(param, (grad, AdamOptimizerCachedValue { v, s })): (&mut T, (&T, &mut AdamOptimizer...
code_fim
hard
{ "lang": "rust", "repo": "White-Green/selecting_flow", "path": "/src/optimizer/adam/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: White-Green/selecting_flow path: /src/optimizer/adam/mod.rs use num_traits::Float; use rayon::prelude::{IndexedParallelIterator, IntoParallelRefIterator, IntoParallelRefMutIterator, ParallelIterator}; use crate::data_types::Dense; use crate::optimizer::{FullyConnectedLayerOptimizer, IntoFullyCo...
code_fim
hard
{ "lang": "rust", "repo": "White-Green/selecting_flow", "path": "/src/optimizer/adam/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bottlerocket-os/bottlerocket path: /sources/api/netdog/src/cli/write_primary_interface_status.rs use super::{error, primary_interface_name, write_primary_interface_sysctl, Result}; use crate::dns::DnsSettings; use crate::networkd_status::NetworkDInterfaceStatus; use crate::CURRENT_IP; use argh::...
code_fim
hard
{ "lang": "rust", "repo": "bottlerocket-os/bottlerocket", "path": "/sources/api/netdog/src/cli/write_primary_interface_status.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let dns_settings = DnsSettings::from_config_or_status(status).context(error::GetDnsSettingsSnafu)?; dns_settings .write_resolv_conf() .context(error::ResolvConfWriteFailedSnafu) }<|fim_prefix|>// repo: bottlerocket-os/bottlerocket path: /sources/api/netdog/src/cli/write_p...
code_fim
hard
{ "lang": "rust", "repo": "bottlerocket-os/bottlerocket", "path": "/sources/api/netdog/src/cli/write_primary_interface_status.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Write out current IP let primary_ip = &primary_link_status .primary_address() .context(error::PrimaryInterfaceAddressSnafu {})?; write_current_ip(primary_ip)?; // Write out resolv.conf write_resolv_conf(&primary_link_status)?; write_primary_interface_sysctl(pri...
code_fim
hard
{ "lang": "rust", "repo": "bottlerocket-os/bottlerocket", "path": "/sources/api/netdog/src/cli/write_primary_interface_status.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ericrobolson/valkyrie path: /valkyrie_core/crates/core_voxels/src/child_descriptor.rs /// Bitmask representing voxel indexes. pub type VoxelIndex = u8; /// A voxel chunk. Internally it's a u64, but this enables shared functionality. pub struct ChildDescriptor { /// The 16 bit pointer to the...
code_fim
hard
{ "lang": "rust", "repo": "ericrobolson/valkyrie", "path": "/valkyrie_core/crates/core_voxels/src/child_descriptor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(false, ChildDescriptor::leaf_child(i << j, &chunk)); } } #[test] fn ChildDescriptor_is_empty_all_empty_returns_true() { let chunk = ChildDescriptor { child_pointer: 0, valid_mask: 0, leaf_mask: 0, reserved:...
code_fim
hard
{ "lang": "rust", "repo": "ericrobolson/valkyrie", "path": "/valkyrie_core/crates/core_voxels/src/child_descriptor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut i = 1; for j in 0..8 { chunk.valid_mask = i << j; chunk.leaf_mask = i << j; assert_eq!(true, ChildDescriptor::leaf_child(i << j, &chunk)); } } #[test] fn ChildDescriptor_leaf_child_not_a_leaf_returns_false() { let mu...
code_fim
hard
{ "lang": "rust", "repo": "ericrobolson/valkyrie", "path": "/valkyrie_core/crates/core_voxels/src/child_descriptor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ebfe/rust-rosetta path: /src/mutual_recursion.rs // Implements http://rosettacode.org/wiki/Mutual_recursion <|fim_suffix|> match n { 0 => 1, _ => n - m(f(n - 1)) } } #[cfg(not(test))] fn m(n: int) -> int { match n { 0 => 0, _ => n - f(m(n - 1)) } ...
code_fim
easy
{ "lang": "rust", "repo": "ebfe/rust-rosetta", "path": "/src/mutual_recursion.rs", "mode": "psm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> for i in range(0, 20).map(f) { print!("{} ", i); } println!("") for i in range(0, 20).map(m) { print!("{} ", i); } println!("") }<|fim_prefix|>// repo: ebfe/rust-rosetta path: /src/mutual_recursion.rs // Implements http://rosettacode.org/wiki/Mutual_recursion #[c...
code_fim
medium
{ "lang": "rust", "repo": "ebfe/rust-rosetta", "path": "/src/mutual_recursion.rs", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vigna/webgraph-rs path: /src/algorithms/transpose.rs use crate::prelude::{COOIterToGraph, COOIterToLabelledGraph, SortPairsPayload}; use crate::traits::{LabelledIterator, LabelledSequentialGraph, SequentialGraph}; use crate::utils::{BatchIterator, KMergeIters, SortPairs}; use anyhow::Result; use...
code_fim
hard
{ "lang": "rust", "repo": "vigna/webgraph-rs", "path": "/src/algorithms/transpose.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(g, g3); Ok(()) } #[cfg(test)] #[cfg_attr(test, test)] fn test_transposition_labelled() -> anyhow::Result<()> { use crate::graph::vec_graph::VecGraph; use dsi_bitstream::prelude::*; #[derive(Clone, Copy, PartialEq, Debug)] struct Payload(f64); impl SortPairsPayload...
code_fim
hard
{ "lang": "rust", "repo": "vigna/webgraph-rs", "path": "/src/algorithms/transpose.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn to_bitstream<E: Endianness, B: WriteCodes<E>>( &self, bitstream: &mut B, ) -> Result<usize> { let value = self.0 as u64; let mantissa = value & ((1 << 53) - 1); let exponent = value >> 53; let mut written_bits = 0; ...
code_fim
hard
{ "lang": "rust", "repo": "vigna/webgraph-rs", "path": "/src/algorithms/transpose.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> where B: IntoFuture, Self: Sized { select::new(self, other.into_future()) } /// Joins the result of two futures, waiting for them both to complete. /// /// This function will return a new future which awaits both this and the /// `other` future to complete. The ret...
code_fim
hard
{ "lang": "rust", "repo": "sullivanchan/futures-rs", "path": "/futures-util/src/try_future/mod.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> /// Joins the result of two futures, waiting for them both to complete. /// /// This function will return a new future which awaits both this and the /// `other` future to complete. The returned future will finish with a tuple /// of both results. /// /// Both futures must have...
code_fim
hard
{ "lang": "rust", "repo": "sullivanchan/futures-rs", "path": "/futures-util/src/try_future/mod.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sullivanchan/futures-rs path: /futures-util/src/try_future/mod.rs //! Futures //! //! This module contains a number of functions for working with `Future`s, //! including the `FutureExt` trait which adds methods to `Future` types. use futures_core::future::TryFuture; use futures_sink::Sink; /*...
code_fim
hard
{ "lang": "rust", "repo": "sullivanchan/futures-rs", "path": "/futures-util/src/try_future/mod.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_valid_word_abbreviation_2() { assert!(!Solution::valid_word_abbreviation(String::from("apple"), String::from("a2e"))); } #[test] fn test_valid_word_abbreviation_3() { assert!(!Solution::valid_word_abbreviation(String::from("hi"), String::from("1"))); ...
code_fim
hard
{ "lang": "rust", "repo": "weworld/rusty-leetcode", "path": "/src/string_tag/valid_word_abbreviation_408.rs", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_prefix|>// repo: weworld/rusty-leetcode path: /src/string_tag/valid_word_abbreviation_408.rs /* * @lc app=leetcode.cn id=408 lang=rust * * [408] 有效单词缩写 */ // @lc code=start #[derive(Debug)] enum AbbrType { Char(char), Num(i32) } impl Solution { pub fn valid_word_abbreviation(word: String, abbr:...
code_fim
hard
{ "lang": "rust", "repo": "weworld/rusty-leetcode", "path": "/src/string_tag/valid_word_abbreviation_408.rs", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> let str: String = num_chars.iter().collect(); let num = str.parse::<i32>().unwrap(); (num, num!=0 && num.to_string() == str) } } // @lc code=end struct Solution; #[cfg(test)] mod test { use super::*; #[test] fn test_valid_word_abbreviation_1() { assert!(S...
code_fim
hard
{ "lang": "rust", "repo": "weworld/rusty-leetcode", "path": "/src/string_tag/valid_word_abbreviation_408.rs", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> pub fn pressed(&self, key: Key) -> bool { *self.state.get(&key).unwrap_or(&false) } fn handle_key(&mut self, el_state: &ElementState, keycode: &VirtualKeyCode) { let new_state = *el_state == ElementState::Pressed; if let Some(key) = self.keymap.get(keycode) { ...
code_fim
hard
{ "lang": "rust", "repo": "vickenty/roids", "path": "/src/input.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vickenty/roids path: /src/input.rs use std::collections::HashMap; use glutin::{ Event, ElementState, VirtualKeyCode }; #[derive(Copy, Clone, Hash, PartialEq, Eq)] pub enum Key { Left, Right, Forward, Reverse, Fire, } pub struct Input { state: HashMap<Key, bool>, key...
code_fim
medium
{ "lang": "rust", "repo": "vickenty/roids", "path": "/src/input.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let x: Result<i32, &str> = Ok(-3); assert_eq!(x.is_ok(), true); let x: Result<i32, &str> = Err("Some error message"); assert_eq!(x.is_ok(), false); }<|fim_prefix|>// repo: cwhongtop/rust_learning path: /test_02_56/main.rs // Result<T, E> 使用示例 <|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "cwhongtop/rust_learning", "path": "/test_02_56/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cwhongtop/rust_learning path: /test_02_56/main.rs // Result<T, E> 使用示例 <|fim_suffix|> let x: Result<i32, &str> = Ok(-3); assert_eq!(x.is_ok(), true); let x: Result<i32, &str> = Err("Some error message"); assert_eq!(x.is_ok(), false); }<|fim_middle|>fn main() {
code_fim
easy
{ "lang": "rust", "repo": "cwhongtop/rust_learning", "path": "/test_02_56/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: provable-things/ptokens-core path: /src/erc20_on_evm/evm/eth_tx_info.rs get_eth_chain_id_from_db, get_eth_gas_price_from_db, get_eth_private_key_from_db, }, eth_utils::safely_convert_hex_to_eth_address, }, evm::{ ...
code_fim
hard
{ "lang": "rust", "repo": "provable-things/ptokens-core", "path": "/src/erc20_on_evm/evm/eth_tx_info.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn subtract_fees(&self, dictionary: &EthEvmTokenDictionary) -> Result<Self> { self.get_fees(dictionary).and_then(|fee_tuples| { Ok(Self::new( self.iter() .zip(fee_tuples.iter()) .map(|(info, (_, fee))| { ...
code_fim
hard
{ "lang": "rust", "repo": "provable-things/ptokens-core", "path": "/src/erc20_on_evm/evm/eth_tx_info.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: provable-things/ptokens-core path: /src/erc20_on_evm/evm/eth_tx_info.rs self.iter() .map(|info| info.calculate_fee_via_dictionary(dictionary)) .collect() } fn subtract_fees(&self, dictionary: &EthEvmTokenDictionary) -> Result<Self> { self.get_fees(diction...
code_fim
hard
{ "lang": "rust", "repo": "provable-things/ptokens-core", "path": "/src/erc20_on_evm/evm/eth_tx_info.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andrewwhitehead/brangetree path: /rust/src/hash.rs use std::marker::PhantomData; pub use digest::Digest; use super::tree::TreeFold; pub struct HashFold<H: Digest, B: AsRef<[u8]>> { _pd: PhantomData<(H, B)>, } impl<H: Digest, B: AsRef<[u8]>> HashFold<H, B> { pub fn new() -> Self { ...
code_fim
hard
{ "lang": "rust", "repo": "andrewwhitehead/brangetree", "path": "/rust/src/hash.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn fold(&mut self, a: &Self::Target, b: &Self::Target) -> Result<Self::Target, Self::Error> { let mut h = H::new(); h.input(a); h.input(b); Ok(h.result().to_vec()) } } #[cfg(test)] mod test { use super::*; use crate::tree::TreeFolder; use sha2::Sha256; ...
code_fim
hard
{ "lang": "rust", "repo": "andrewwhitehead/brangetree", "path": "/rust/src/hash.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_hash() { let leaves: Vec<[u8; 8]> = [0, 1].iter().map(|n| (*n as u64).to_be_bytes()).collect(); let (result, _) = TreeFolder::fold(HashFold::<Sha256, [u8; 8]>::new(), leaves.clone(), None).unwrap(); let h0 = Sha256::digest(&leaves[0]).to_vec(); ...
code_fim
hard
{ "lang": "rust", "repo": "andrewwhitehead/brangetree", "path": "/rust/src/hash.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: clarkcb/xsearch path: /rust/rssearch/src/config.rs use std::fs; use serde::{Deserialize, Serialize}; #[derive(Debug)] pub struct Config { pub xsearch_path: String, pub shared_path: String, pub file_types_path: String, pub search_options_path: String, pub version: String, } ...
code_fim
hard
{ "lang": "rust", "repo": "clarkcb/xsearch", "path": "/rust/rssearch/src/config.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub const XSEARCH_PATH: &str = "/Users/cary/src/xsearch"; pub const CONFIG_FILE_PATH: &str = "/Users/cary/src/xsearch/shared/config.json"; pub const VERSION: &str = "1.0.0"; impl Config { pub fn new() -> Config { let xsearch_path = String::from(XSEARCH_PATH); let version = String::fro...
code_fim
medium
{ "lang": "rust", "repo": "clarkcb/xsearch", "path": "/rust/rssearch/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { cargo_binutils::Tool::Objdump.cargo_exec(Some(EXAMPLES)) }<|fim_prefix|>// repo: rust-embedded/cargo-binutils path: /src/bin/cargo-objdump.rs const EXAMPLES: &str = " EXAMPLES <|fim_middle|>`cargo objdump --lib --release -- -d` - disassemble `cargo objdump --bin foo --...
code_fim
medium
{ "lang": "rust", "repo": "rust-embedded/cargo-binutils", "path": "/src/bin/cargo-objdump.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> cargo_binutils::Tool::Objdump.cargo_exec(Some(EXAMPLES)) }<|fim_prefix|>// repo: rust-embedded/cargo-binutils path: /src/bin/cargo-objdump.rs const EXAMPLES: &str = " EXAMPLES `cargo objdump --lib --release -- -d` - disassemble `cargo objdump --bin foo --release -- -s -j .rodata` ...
code_fim
easy
{ "lang": "rust", "repo": "rust-embedded/cargo-binutils", "path": "/src/bin/cargo-objdump.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-embedded/cargo-binutils path: /src/bin/cargo-objdump.rs const EXAMPLES: &str = " EXAMPLES <|fim_suffix|>fn main() { cargo_binutils::Tool::Objdump.cargo_exec(Some(EXAMPLES)) }<|fim_middle|>`cargo objdump --lib --release -- -d` - disassemble `cargo objdump --bin foo --...
code_fim
medium
{ "lang": "rust", "repo": "rust-embedded/cargo-binutils", "path": "/src/bin/cargo-objdump.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn flush(&mut self) -> nb::Result<(), Self::Error> { return match self.0.borrow_mut().flush() { Ok(_) => Ok(()), Err(e) => Err(nb::Error::from(e)), }; } } #[allow(dead_code)] // This allows us to share code between different PC-based examples. // There's pr...
code_fim
hard
{ "lang": "rust", "repo": "DanBrezeanu/hzgrow-r502", "path": "/examples/pc_utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DanBrezeanu/hzgrow-r502 path: /examples/pc_utils.rs use embedded_hal::serial::{Read, Write}; use serialport::prelude::*; use std::cell::RefCell; // We're cheating here and will use the host OS's serial port // as our UART, and for that we have to implement the read/write // interfaces from embe...
code_fim
hard
{ "lang": "rust", "repo": "DanBrezeanu/hzgrow-r502", "path": "/examples/pc_utils.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let buf: [u8; 1] = [word]; loop { match self.0.borrow_mut().write(&buf) { Ok(n) => { if n == 1 { println!("write: {:02x}", word); return Ok(()); } } ...
code_fim
hard
{ "lang": "rust", "repo": "DanBrezeanu/hzgrow-r502", "path": "/examples/pc_utils.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rbspy/rbspy path: /examples/record.rs mod include; extern crate rbspy; use crate::include::path_to_ruby_binary; use rbspy::recorder::{RecordConfig, Recorder}; use rbspy::OutputFormat; fn main() { <|fim_suffix|> let config = RecordConfig { format: OutputFormat::flamegraph, ra...
code_fim
hard
{ "lang": "rust", "repo": "rbspy/rbspy", "path": "/examples/record.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut process = std::process::Command::new(path_to_ruby_binary()) .arg("ci/ruby-programs/infinite.rb") .spawn() .unwrap(); let out_path = std::path::PathBuf::from("rbspy-out.svg"); let config = RecordConfig { format: OutputFormat::flamegraph, raw_path...
code_fim
medium
{ "lang": "rust", "repo": "rbspy/rbspy", "path": "/examples/record.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fretn/voca_rs path: /src/case.rs //! Converts the `subject` to a selected case. use split; /// Converts the `subject` to camel case. /// /// # Arguments /// /// * `subject` - The string to convert to camel case. /// /// # Example /// ``` /// use voca_rs::*; /// case::camel_case("bird flight"); ...
code_fim
hard
{ "lang": "rust", "repo": "fretn/voca_rs", "path": "/src/case.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn return_string(subject: &str, rest_to_lower: bool) -> String { let mut res = String::with_capacity(subject.len()); for (i, c) in split::chars(subject).iter().enumerate() { let s = if i == 0 || rest_to_lower { c.to_lowercase() } else { ...
code_fim
hard
{ "lang": "rust", "repo": "fretn/voca_rs", "path": "/src/case.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn kebab_and_shouty_kebab_case(subject: &str, shouty: bool) -> String { match subject.len() { 0 => subject.to_string(), _ => split::words(subject) .into_iter() .map(|c| { if shouty { upper_case(&c) } else { ...
code_fim
hard
{ "lang": "rust", "repo": "fretn/voca_rs", "path": "/src/case.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/lib/ui/carnelian/examples/rive.rs // Copyright 2021 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::Error, argh::FromArgs, carnelian::{ ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/ui/carnelian/examples/rive.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> self.playback_speed *= factor; self.app_sender.request_render(self.view_key); } } impl ViewAssistant for RiveViewAssistant { fn resize(&mut self, new_size: &Size) -> Result<(), Error> { self.set_size(new_size); Ok(()) } fn render( &mut self, ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/lib/ui/carnelian/examples/rive.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: WLBF/reg-watcher path: /examples/stream.rs extern crate futures; extern crate reg_watcher; extern crate winreg; extern crate tokio; <|fim_suffix|> let fut = w.for_each(|_| { println!("notify"); Ok(()) }).map_err(|err| { println!("accept error = {:?}", err); })...
code_fim
hard
{ "lang": "rust", "repo": "WLBF/reg-watcher", "path": "/examples/stream.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qoollo/pearl path: /src/io/windows/sync.rs // Sync windows use crate::prelude::*; use bytes::{Bytes, BytesMut}; use std::sync::atomic::AtomicU64; use std::{ os::windows::fs::{FileExt, OpenOptionsExt}, time::SystemTime, }; //use tokio::fs::OpenOptions; use std::fs::OpenOptions; /// IO d...
code_fim
hard
{ "lang": "rust", "repo": "qoollo/pearl", "path": "/src/io/windows/sync.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.created_at() } fn dirty_bytes(&self) -> u64 { self.dirty_bytes() } async fn write_append_writable_data<R: Send + 'static>(&self, c: impl WritableDataCreator<R>) -> IOResult<R> { self.write_append_writable_data(c).await } async fn write_append_all(&self...
code_fim
hard
{ "lang": "rust", "repo": "qoollo/pearl", "path": "/src/io/windows/sync.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[no_mangle] #[allow(non_upper_case_globals)] pub static mut mbedtls_mutex_init: unsafe extern "C" fn(mutex: *mut *mut StaticMutex) = StaticMutex::init; #[no_mangle] #[allow(non_upper_case_globals)] pub static mut mbedtls_mutex_free: unsafe extern "C" fn(mutex: *mut *mut StaticMutex) = StaticMutex...
code_fim
hard
{ "lang": "rust", "repo": "rust-mbedtls/mbedtls", "path": "/src/threading.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>use mbedtls_sys::types::raw::c_int; pub struct StaticMutex { guard: Option<MutexGuard<'static, ()>>, mutex: Mutex<()>, } #[no_mangle] #[allow(non_upper_case_globals)] pub static mut mbedtls_mutex_init: unsafe extern "C" fn(mutex: *mut *mut StaticMutex) = StaticMutex::init; #[no_mangle] #[all...
code_fim
hard
{ "lang": "rust", "repo": "rust-mbedtls/mbedtls", "path": "/src/threading.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-mbedtls/mbedtls path: /src/threading.rs /* Copyright (c) Fortanix, Inc. * * Licensed under the GNU General Public License, version 2 <LICENSE-GPL or * https://www.gnu.org/licenses/gpl-2.0.html> or the Apache License, Version * 2.0 <LICENSE-APACHE or http://www.apache.org/licenses/LICENS...
code_fim
hard
{ "lang": "rust", "repo": "rust-mbedtls/mbedtls", "path": "/src/threading.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: libp2p/rust-libp2p path: /protocols/perf/src/server/handler.rs // Copyright 2023 Protocol Labs. // // Permission is hereby granted, free of charge, to any person obtaining a // copy of this software and associated documentation files (the "Software"), // to deal in the Software without restricti...
code_fim
hard
{ "lang": "rust", "repo": "libp2p/rust-libp2p", "path": "/protocols/perf/src/server/handler.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ConnectionEvent::DialUpgradeError(DialUpgradeError { info, .. }) => { void::unreachable(info) } ConnectionEvent::AddressChange(_) | ConnectionEvent::LocalProtocolsChange(_) | ConnectionEvent::RemoteProtocolsChange(_) => {} ...
code_fim
hard
{ "lang": "rust", "repo": "libp2p/rust-libp2p", "path": "/protocols/perf/src/server/handler.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn poll( &mut self, cx: &mut Context<'_>, ) -> Poll< ConnectionHandlerEvent< Self::OutboundProtocol, Self::OutboundOpenInfo, Self::ToBehaviour, Self::Error, >, > { while let Poll::Ready(Some(result)) = self...
code_fim
hard
{ "lang": "rust", "repo": "libp2p/rust-libp2p", "path": "/protocols/perf/src/server/handler.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emirhod/trin path: /trin-core/src/jsonrpc/endpoints.rs use std::str::FromStr; /// Discv5 JSON-RPC endpoints. Start with "discv5_" prefix #[derive(Debug, PartialEq, Clone)] pub enum Discv5EndpointKind { NodeInfo, RoutingTableInfo, } /// State network JSON-RPC endpoints. Start with "port...
code_fim
medium
{ "lang": "rust", "repo": "emirhod/trin", "path": "/trin-core/src/jsonrpc/endpoints.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl FromStr for PortalEndpointKind { type Err = (); fn from_str(input: &str) -> Result<PortalEndpointKind, Self::Err> { match input { "discv5_nodeInfo" => Ok(PortalEndpointKind::Discv5EndpointKind( Discv5EndpointKind::NodeInfo, )), "dis...
code_fim
hard
{ "lang": "rust", "repo": "emirhod/trin", "path": "/trin-core/src/jsonrpc/endpoints.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: simhaonline/hcloud-rust path: /src/models/create_image_from_server_request.rs /* * Hetzner Cloud API * * Copied from the official API documentation for the Public Hetzner Cloud. * * The version of the OpenAPI document: 0.0.3 * * Generated by: https://openapi-generator.tech */ /// Creat...
code_fim
hard
{ "lang": "rust", "repo": "simhaonline/hcloud-rust", "path": "/src/models/create_image_from_server_request.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Type of Image to create (default: `snapshot`) #[derive(Clone, Copy, Debug, Eq, PartialEq, Ord, PartialOrd, Hash, Serialize, Deserialize)] pub enum Type { #[serde(rename = "backup")] Backup, #[serde(rename = "snapshot")] Snapshot, }<|fim_prefix|>// repo: simhaonline/hcloud-rust path: /...
code_fim
hard
{ "lang": "rust", "repo": "simhaonline/hcloud-rust", "path": "/src/models/create_image_from_server_request.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub const WINDOW_PIXEL_WIDTH: u32 = 256; pub const WINDOW_PIXEL_HEIGHT: u32 = 144; pub const WINDOW_TILE_WIDTH: u32 = WINDOW_PIXEL_WIDTH / TILE_SIZE; pub const WINDOW_TILE_HEIGHT: u32 = WINDOW_PIXEL_HEIGHT / TILE_SIZE;<|fim_prefix|>// repo: Johan-Mi/persimmon path: /constants/src/lib.rs pub mod keybinds;...
code_fim
medium
{ "lang": "rust", "repo": "Johan-Mi/persimmon", "path": "/constants/src/lib.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Johan-Mi/persimmon path: /constants/src/lib.rs pub mod keybinds; pub const TEAM_SIZE: usize = 6; <|fim_suffix|>pub const TILE_SIZE: u32 = 16; pub const WINDOW_PIXEL_WIDTH: u32 = 256; pub const WINDOW_PIXEL_HEIGHT: u32 = 144; pub const WINDOW_TILE_WIDTH: u32 = WINDOW_PIXEL_WIDTH / TILE_SIZE; p...
code_fim
easy
{ "lang": "rust", "repo": "Johan-Mi/persimmon", "path": "/constants/src/lib.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>/// <p>Attaches a service configuration to the specified group. This occurs asynchronously, /// and can take time to complete. You can use <a>GetGroupConfiguration</a> to /// check the status of the update.</p> /// <p> /// <b>Minimum permissions</b> /// </p> /// <p>To run this command, you must have the f...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/resourcegroups/src/operation.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/resourcegroups/src/operation.rs != 200 { crate::operation_deser::parse_create_group_error(response) } else { crate::operation_deser::parse_create_group_response(response) } } } /// <p>Deletes the specified resource group...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/resourcegroups/src/operation.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/resourcegroups/src/operation.rs GetGroupQueryInput`](crate::input::GetGroupQueryInput) pub fn builder() -> crate::input::get_group_query_input::Builder { crate::input::get_group_query_input::Builder::default() } pub fn new() -> Self { Se...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/resourcegroups/src/operation.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vijaylaxmid/k8-api path: /src/k8-ctx-util/src/main.rs /// Performs following /// add minikube IP address to /etc/host /// create new kubectl cluster and context which uses minikube name fn main() { <|fim_suffix|> create_dns_context(Option::default()) }<|fim_middle|> use k8...
code_fim
medium
{ "lang": "rust", "repo": "vijaylaxmid/k8-api", "path": "/src/k8-ctx-util/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> create_dns_context(Option::default()) }<|fim_prefix|>// repo: vijaylaxmid/k8-api path: /src/k8-ctx-util/src/main.rs /// Performs following /// add minikube IP address to /etc/host /// create new kubectl cluster and context which uses minikube name fn main() { <|fim_middle|> use k8...
code_fim
medium
{ "lang": "rust", "repo": "vijaylaxmid/k8-api", "path": "/src/k8-ctx-util/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shonenada-archives/asc-in-rust path: /rust-demo/examples/hash.rs use wasmer_runtime::{error, imports, instantiate, Array, Func, WasmPtr}; use wasmer_wasi; use wasmer_wasi::WasiVersion; const WASI_VERSION: WasiVersion = WasiVersion::Snapshot0; <|fim_suffix|> print!("String in memory: "); ...
code_fim
hard
{ "lang": "rust", "repo": "shonenada-archives/asc-in-rust", "path": "/rust-demo/examples/hash.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let memory_writer = buffer_ptr .deref(wasm_instance_memory, 0, raw.len() as u32) .unwrap(); for (i, b) in raw.bytes().enumerate() { memory_writer[i].set(b); } print!("String in memory: "); let print_memory: Func<u32, u32> = instance.func("printMemory").expect("...
code_fim
hard
{ "lang": "rust", "repo": "shonenada-archives/asc-in-rust", "path": "/rust-demo/examples/hash.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rust path: /tests/ui/methods/field-method-suggestion-using-return-ty.rs struct Wrapper<T>(T); impl Wrapper<Option<i32>> { fn inner_mut(&self) -> Option<&mut i32> { <|fim_suffix|> self.as_mut() //~^ ERROR no method named `as_mut` found for reference `&Wrapper<Option<...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/tests/ui/methods/field-method-suggestion-using-return-ty.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn inner_mut_bad(&self) -> Option<&mut u32> { self.as_mut() //~^ ERROR no method named `as_mut` found for reference `&Wrapper<Option<i32>>` in the current scope //~| HELP items from traits can only be used if } } fn main() {}<|fim_prefix|>// repo: rust-lang/rust path: /te...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/tests/ui/methods/field-method-suggestion-using-return-ty.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let result = prev_output_ratio + output_ratio + quadratic_ratio; result.clamp(0., 1.) } } pub struct ValueMapperNode<C> { lut: Vec<C>, } impl<C> ValueMapperNode<C> { pub const fn new(lut: Vec<C>) -> Self { Self { lut } } } impl<'i, L: LuminanceMut + 'i> Node<'i, L> for ValueMapperNode<L::Lumi...
code_fim
hard
{ "lang": "rust", "repo": "GraphiteEditor/Graphite", "path": "/node-graph/gcore/src/raster/curve.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GraphiteEditor/Graphite path: /node-graph/gcore/src/raster/curve.rs use super::{Channel, Linear, LuminanceMut}; use crate::Node; use dyn_any::{DynAny, StaticType}; use core::ops::{Add, Mul, Sub}; #[derive(Debug, Clone, PartialEq, DynAny, specta::Type)] #[cfg_attr(feature = "serde", derive(ser...
code_fim
hard
{ "lang": "rust", "repo": "GraphiteEditor/Graphite", "path": "/node-graph/gcore/src/raster/curve.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zhouyuxiang0/facade path: /ui/src/widgets/scene.rs use crate::live::{Requirement, ResponseEvt}; use crate::widgets::{self, Reqs, View, Widget, WidgetModel}; use protocol::{Reaction, Scene}; use yew::{html, Properties, ShouldRender}; pub type SceneWidget = WidgetModel<Model>; pub struct Model {...
code_fim
hard
{ "lang": "rust", "repo": "zhouyuxiang0/facade", "path": "/ui/src/widgets/scene.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let ResponseEvt::Reaction(Reaction::Scene(scene)) = event { log::info!("Changing scene: {:?}", scene); self.scene = scene; true } else { false } } fn main_view(&self) -> View<Self> { match self.scene { ...
code_fim
hard
{ "lang": "rust", "repo": "zhouyuxiang0/facade", "path": "/ui/src/widgets/scene.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>at_id: ChatIdOrUsername, /// New chat description, 0-255 characters #[serde(skip_serializing_if = "Option::is_none")] pub(crate) description: Option<String>, }<|fim_prefix|>// repo: jeizsm/actix-telegram path: /src/raw/methods/set_chat_description.rs use crate::types::*; /// Use this method ...
code_fim
hard
{ "lang": "rust", "repo": "jeizsm/actix-telegram", "path": "/src/raw/methods/set_chat_description.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jeizsm/actix-telegram path: /src/raw/methods/set_chat_description.rs use crate::types::*; /// Use this method to change the description of a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. Returns True on success...
code_fim
medium
{ "lang": "rust", "repo": "jeizsm/actix-telegram", "path": "/src/raw/methods/set_chat_description.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> //TODO uncomment the line below //static STATIC_REF: &'static mut i32 = &mut X; } #[test] fn with_error1() { const CONSTANT: i32 = 2; //TODO uncomment some below // these three are not allowed: // const CR: &'static mut i32 = &mut C; //...
code_fim
medium
{ "lang": "rust", "repo": "rustkas/error-index", "path": "/main_tests/tests/e0017.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rustkas/error-index path: /main_tests/tests/e0017.rs /* cargo test --test e0017 cargo test --test e0017 with_error cargo test --test e0017 with_error1 cargo test --test e0017 with_error2 */ <|fim_suffix|> //TODO uncomment the line below //static STATIC_REF: &'static mut i32 = &m...
code_fim
hard
{ "lang": "rust", "repo": "rustkas/error-index", "path": "/main_tests/tests/e0017.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn do_work(map: &Map, out: &str) { let width = 1000.; let height = 1000.; let surface = cairo::ImageSurface::create(cairo::Format::ARgb32, width as i32, height as i32); let cr = cairo::Context::new(surface.as_ref()); cr.set_line_width(0.2); let renderer = CairoRenderer::new(&cr, ...
code_fim
hard
{ "lang": "rust", "repo": "samlecuyer/ecumene-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: samlecuyer/ecumene-rs path: /src/main.rs extern crate cairo; extern crate image; extern crate getopts; extern crate ecumene; use std::path::Path; use std::io::Result; use getopts::Options; use std::env; use ecumene::map::Map; use ecumene::rendering::CairoRenderer; fn print_usage(program: &s...
code_fim
hard
{ "lang": "rust", "repo": "samlecuyer/ecumene-rs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.process_file(fd)?; } } let service_names = self .service_names .iter() .map(|name| ServiceResponse { name: name.clone() }) .collect(); Ok(ServerReflectionServer::new(ReflectionService { s...
code_fim
hard
{ "lang": "rust", "repo": "bmwill/tonic", "path": "/tonic-reflection/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> tokio::spawn(async move { while let Some(req) = req_rx.next().await { let req = match req { Ok(req) => req, Err(_) => { return; } }; let resp_msg = match...
code_fim
hard
{ "lang": "rust", "repo": "bmwill/tonic", "path": "/tonic-reflection/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bmwill/tonic path: /tonic-reflection/src/server.rs use crate::proto::server_reflection_request::MessageRequest; use crate::proto::server_reflection_response::MessageResponse; use crate::proto::server_reflection_server::{ServerReflection, ServerReflectionServer}; use crate::proto::{ FileDescr...
code_fim
hard
{ "lang": "rust", "repo": "bmwill/tonic", "path": "/tonic-reflection/src/server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl From<client::contact::TransferResponse> for epp_proto::contact::ContactTransferReply { fn from(res: client::contact::TransferResponse) -> Self { epp_proto::contact::ContactTransferReply { pending: res.pending, status: super::utils::i32_from_transfer_status(res.data...
code_fim
hard
{ "lang": "rust", "repo": "AS207960/epp-proxy", "path": "/src/grpc/contact.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> epp_proto::contact::ContactPanReply { id: res.id, result: res.result, server_transaction_id: res.server_transaction_id, client_transaction_id: res.client_transaction_id, date: super::utils::chrono_to_proto(Some(res.date)), } }...
code_fim
hard
{ "lang": "rust", "repo": "AS207960/epp-proxy", "path": "/src/grpc/contact.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AS207960/epp-proxy path: /src/grpc/contact.rs ipality => { Some(client::contact::EntityType::FinnishMunicipality) } epp_proto::contact::EntityType::FinnishGovernment => { Some(client::contact::EntityType::FinnishGovernment) } ...
code_fim
hard
{ "lang": "rust", "repo": "AS207960/epp-proxy", "path": "/src/grpc/contact.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>: Some(&path.as_ref().to_string_lossy()), source: wgpu::util::make_spirv(&data), }); Ok(module) }<|fim_prefix|>// repo: LucasWolschick/tetrs path: /src/graphics/shader.rs use std::path::Path; pub fn create_shader( device: &wgpu::Device, path: impl AsRef<Path>, ) -> Result<wg<|fi...
code_fim
hard
{ "lang": "rust", "repo": "LucasWolschick/tetrs", "path": "/src/graphics/shader.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LucasWolschick/tetrs path: /src/graphics/shader.rs use std::path::Path; pub fn create_shader( device: &wgpu::Device, path: impl AsRef<Path>, ) -> Result<wgpu::ShaderModule, Box<dyn std::error::Error>> { let data = std::fs::read(path.as_ref())?; let module = d<|fim_suffix|>: Som...
code_fim
medium
{ "lang": "rust", "repo": "LucasWolschick/tetrs", "path": "/src/graphics/shader.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>evice.create_shader_module(&wgpu::ShaderModuleDescriptor { flags: wgpu::ShaderFlags::all(), label: Some(&path.as_ref().to_string_lossy()), source: wgpu::util::make_spirv(&data), }); Ok(module) }<|fim_prefix|>// repo: LucasWolschick/tetrs path: /src/graphics/shader.rs use ...
code_fim
medium
{ "lang": "rust", "repo": "LucasWolschick/tetrs", "path": "/src/graphics/shader.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hurryabit/homer path: /compiler/src/anf/mod.rs Atom, Vec<Atom>), AppFunc(u32, ExprVar, Vec<Atom>), BinOp(Atom, OpCode, Atom), If(Atom, Box<Expr>, Box<Expr>), // NOTE(MH): Both vectors always have the same length. We split it here // because we want to be able to borrow the fi...
code_fim
hard
{ "lang": "rust", "repo": "hurryabit/homer", "path": "/compiler/src/anf/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl fmt::Display for Binding { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { let Self { binder, bindee } = self; write!(f, "let {} = {};", binder, bindee) } } impl fmt::Display for Bindee { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { match ...
code_fim
hard
{ "lang": "rust", "repo": "hurryabit/homer", "path": "/compiler/src/anf/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hurryabit/homer path: /compiler/src/anf/mod.rs Eq, PartialEq)] pub struct Branch { pub pattern: Pattern, pub rhs: Expr, } #[derive(Clone, Eq, PartialEq)] pub struct Pattern { pub rank: u32, pub constr: ExprCon, pub binder: Option<ExprVar>, } impl syntax::Module { pub fn...
code_fim
hard
{ "lang": "rust", "repo": "hurryabit/homer", "path": "/compiler/src/anf/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Copy, Clone)] pub struct CPUInterval { /// Total amount of time spent executing in user mode pub user: Second, /// Total amount of time spent executing in kernel mode pub system: Second, }<|fim_prefix|>// repo: hcxiong/hyperfine path: /src/hyperfine/timer/internal.rs use ...
code_fim
medium
{ "lang": "rust", "repo": "hcxiong/hyperfine", "path": "/src/hyperfine/timer/internal.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hcxiong/hyperfine path: /src/hyperfine/timer/internal.rs use crate::hyperfine::units::Second; #[derive(Debug, Copy, Clone)] pub struct CPUTimes { /// Total amount of time spent executing in user mode pub user_usec: i64, <|fim_suffix|> /// Total amount of time spent executing in kern...
code_fim
hard
{ "lang": "rust", "repo": "hcxiong/hyperfine", "path": "/src/hyperfine/timer/internal.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Total amount of time spent executing in kernel mode pub system: Second, }<|fim_prefix|>// repo: hcxiong/hyperfine path: /src/hyperfine/timer/internal.rs use crate::hyperfine::units::Second; #[derive(Debug, Copy, Clone)] pub struct CPUTimes { /// Total amount of time spent executing in us...
code_fim
hard
{ "lang": "rust", "repo": "hcxiong/hyperfine", "path": "/src/hyperfine/timer/internal.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /third_party/rust_crates/vendor/proptest-derive-0.3.0/tests/value_param.rs // Copyright 2018 The proptest developers // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/proptest-derive-0.3.0/tests/value_param.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let T2::V0(x) = v; assert!(x); } #[test] fn t2_test_false(v in any_with::<T2>(10)) { let T2::V0(x) = v; assert!(!x); } #[test] fn t3_test(v in any_with::<T3>(4)) { let T3::V0 { field: x } = v; assert_eq!(x, 16); } #[test] ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/proptest-derive-0.3.0/tests/value_param.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>proptest! { #[test] fn t0_test(v in any_with::<T0>(4)) { let T0::V0(x) = v; assert_eq!(x, 2); } #[test] fn t1_test(v in any_with::<T1>(4)) { let T1::V0 { field: x } = v; assert_eq!(x, 8); } #[test] fn t2_test_true(v in any_with::<T2>(4)) { ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/third_party/rust_crates/vendor/proptest-derive-0.3.0/tests/value_param.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-datetime/zoneinfo-data path: /src/data/America/Santa_Isabel.rs ffset: -28800, // UTC offset -28800, DST offset 0 is_dst: false, name: Cow::Borrowed("PST"), }), (923220000, FixedTimespan { // 1999-03-04T10-00-00 UTC offset: -25200, // ...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/America/Santa_Isabel.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-datetime/zoneinfo-data path: /src/data/America/Santa_Isabel.rs is_dst: false, name: Cow::Borrowed("PST"), }), (2596096800, FixedTimespan { // 2052-03-07T10-00-00 UTC offset: -25200, // UTC offset -28800, DST offset 3600 is_dst: t...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/America/Santa_Isabel.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ed("PDT"), }), (909306000, FixedTimespan { // 1998-09-25T9-00-00 UTC offset: -28800, // UTC offset -28800, DST offset 0 is_dst: false, name: Cow::Borrowed("PST"), }), (923220000, FixedTimespan { // 1999-03-04T10-00-00 UTC ...
code_fim
hard
{ "lang": "rust", "repo": "rust-datetime/zoneinfo-data", "path": "/src/data/America/Santa_Isabel.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }