text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: cgilliard/mwc-wallet path: /libwallet/src/internal/scan.rs ommit, None, *proof)? } else { None }; // If legacy didn't work, try new rewind if info_legacy.is_none() { proof::rewind(keychain.secp(), &builder, *commit, None, *proof)? } else { info_legacy } }; ...
code_fim
hard
{ "lang": "rust", "repo": "cgilliard/mwc-wallet", "path": "/libwallet/src/internal/scan.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Skipping cancelled transactions, they processed below if tx_type == TxLogEntryType::TxReceivedCancelled || tx_type == TxLogEntryType::TxSentCancelled { continue; // Processing not cancelled transactions. Cancelled will be reactivated as a recovery plan. } // Collecting known (belong to...
code_fim
hard
{ "lang": "rust", "repo": "cgilliard/mwc-wallet", "path": "/libwallet/src/internal/scan.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cgilliard/mwc-wallet path: /libwallet/src/internal/scan.rs status_send_channel: &Option<Sender<StatusMessage>>, percentage_complete: u8, ) -> Result<Vec<OutputResult>, Error> where K: Keychain + 'a, { let mut wallet_outputs: Vec<OutputResult> = Vec::new(); let legacy_builder = proof::Legac...
code_fim
hard
{ "lang": "rust", "repo": "cgilliard/mwc-wallet", "path": "/libwallet/src/internal/scan.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> self.consume(block); } fn end_hash(self) -> String { format!("{:x}", self.compute()) } } impl Hash for RingContext { fn update_block(&mut self, block: &[u8]) { self.update(block); } fn end_hash(self) -> String { let digest = self.finish(); l...
code_fim
hard
{ "lang": "rust", "repo": "Eolien55/Voila", "path": "/voila/src/interpreter/hash.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn with_blocks<F, R: Read>(reader: &mut R, mut cont: F) -> Result<(), io::Error> where F: FnMut(&[u8]), R: Read, { let mut buf = [0u8; 8192]; loop { let len = reader.read(&mut buf)?; if len == 0 { break; } cont(&buf[..len]) } Ok(()) }...
code_fim
hard
{ "lang": "rust", "repo": "Eolien55/Voila", "path": "/voila/src/interpreter/hash.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Eolien55/Voila path: /voila/src/interpreter/hash.rs use enum_dispatch::enum_dispatch; use std::io::{self, Read}; #[enum_dispatch] pub trait Hash: Sized { fn update_block(&mut self, block: &[u8]); fn end_hash(self) -> String; fn hash_reader<R: Read>(mut self, reader: &mut R) -> io::R...
code_fim
hard
{ "lang": "rust", "repo": "Eolien55/Voila", "path": "/voila/src/interpreter/hash.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: diegopacheco/rustybox path: /libbb/parse_mode.rs use libc; use libc::mode_t; use libc::umask; extern "C" { #[no_mangle] fn strtoul( __nptr: *const libc::c_char, __endptr: *mut *mut libc::c_char, __base: libc::c_int, ) -> libc::c_ulong; } #[no_mangle] pub unsafe extern "C" f...
code_fim
hard
{ "lang": "rust", "repo": "diegopacheco/rustybox", "path": "/libbb/parse_mode.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>s mode_t; 'c_7982: loop { p = perm_chars.as_ptr(); loop { if *p as libc::c_int == *s as libc::c_int { if *p as libc::c_int != 'X' as i32 || new_mode & (0o40000i32 | 0o100i32 | 0o100i32 >> 3i...
code_fim
hard
{ "lang": "rust", "repo": "diegopacheco/rustybox", "path": "/libbb/parse_mode.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CasualX/programming-problems-rs path: /src/intermediate/1-permutations.rs // Write a program that outputs all possibilities to put + or - or nothing between the numbers 1,2,…,9 (in this order) such that the result is 100. // For example 1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100. <|fim_suffix|> // Re...
code_fim
medium
{ "lang": "rust", "repo": "CasualX/programming-problems-rs", "path": "/src/intermediate/1-permutations.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Recurse end condition if digit == 10 { let total = total + current; if total == 100 { println!("found one: {} = 100!", s); } } else { // Concatenate the digit { let current = current * 10 + if current < 0 { -digit } else { digit }; let s = format!("{}{}", s, digit); compute(s,...
code_fim
medium
{ "lang": "rust", "repo": "CasualX/programming-problems-rs", "path": "/src/intermediate/1-permutations.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn draw(&self) { let mut canvas = super::canvas::Canvas::default(); for (position, color) in &self.canvas { canvas.add_color(position, *color) } canvas.add_roboter(&self.position, &self.facing); canvas.run(); } } #[derive(Debug, Eq, Parti...
code_fim
hard
{ "lang": "rust", "repo": "AlexanderThaller/advent_of_code_2019", "path": "/src/day_11/roboter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AlexanderThaller/advent_of_code_2019 path: /src/day_11/roboter.rs use super::computer::{ Computer, Reader, Writer, }; use crossbeam_channel::unbounded; use std::{ collections::BTreeMap, thread, }; const ROBOT_SOFTWARE: &[isize] = &[ 3, 8, 1005, 8, 330, ...
code_fim
hard
{ "lang": "rust", "repo": "AlexanderThaller/advent_of_code_2019", "path": "/src/day_11/roboter.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (_, Up) => Up, (_, Down) => Down, }; self.facing = new_direction; } fn step(&mut self) { let step = match &self.facing { Direction::Up => (0, -1), Direction::Down => (0, 1), Direction::Right => (1, 0), ...
code_fim
hard
{ "lang": "rust", "repo": "AlexanderThaller/advent_of_code_2019", "path": "/src/day_11/roboter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lyswifter/forest path: /forest/src/cli/client.rs // Copyright 2019-2022 ChainSafe Systems // SPDX-License-Identifier: Apache-2.0, MIT use directories::ProjectDirs; use rpc_client::DEFAULT_PORT; use serde::{Deserialize, Serialize}; use std::{ net::{IpAddr, Ipv4Addr, SocketAddr}, path::Pa...
code_fim
hard
{ "lang": "rust", "repo": "lyswifter/forest", "path": "/forest/src/cli/client.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let dir = ProjectDirs::from("com", "ChainSafe", "Forest").expect("failed to find project directories, please set FOREST_CONFIG_PATH environment variable manually."); Self { data_dir: dir.data_dir().to_path_buf(), genesis_file: None, enable_rpc: true, ...
code_fim
hard
{ "lang": "rust", "repo": "lyswifter/forest", "path": "/forest/src/cli/client.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Default, Component)] #[storage(DenseVecStorage)] pub struct TerrainMeshes { pub terrain: Mesh<BlockVertex, u32>, pub liquid: Mesh<LiquidVertex, u32>, }<|fim_prefix|>// repo: qm3ster/Notcraft path: /src/engine/render/mod.rs use cgmath::{Vector2, Vector3}; use engine::render::{ ...
code_fim
hard
{ "lang": "rust", "repo": "qm3ster/Notcraft", "path": "/src/engine/render/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qm3ster/Notcraft path: /src/engine/render/mod.rs use cgmath::{Vector2, Vector3}; use engine::render::{ mesh::Mesh, terrain::{BlockVertex, LiquidVertex}, }; use specs::prelude::*; pub mod debug; pub mod mesh; pub mod mesher; pub mod terrain; pub mod ui; <|fim_suffix|> vertex! { ...
code_fim
hard
{ "lang": "rust", "repo": "qm3ster/Notcraft", "path": "/src/engine/render/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Copy, Clone)] pub struct SoaTransform { pub translation: SoaFloat3, pub rotation: SoaQuaternion, pub scale: SoaFloat3, } impl SoaTransform { #[inline] pub fn identity() -> SoaTransform { return SoaTransform { translation: SoaFloat3::zero(), rot...
code_fim
medium
{ "lang": "rust", "repo": "yangfengzzz/vox_render-rs", "path": "/src/soa_transform.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yangfengzzz/vox_render-rs path: /src/soa_transform.rs /* * // Copyright (c) 2021 Feng Yang * // * // I am making my contributions/submissions to this project solely in my * // personal capacity and am not conveying any rights to any intellectual * // property of any third parties. */ // S...
code_fim
medium
{ "lang": "rust", "repo": "yangfengzzz/vox_render-rs", "path": "/src/soa_transform.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn soa_transform_constant() { expect_soa_float3_eq!(SoaTransform::identity().translation, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0); expect_soa_quaternion_eq!(SoaTransform::identity().rotation, 0.0, 0.0, 0.0, 0.0, ...
code_fim
hard
{ "lang": "rust", "repo": "yangfengzzz/vox_render-rs", "path": "/src/soa_transform.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SCRTHodl/blockchain path: /dmbc/src/currency/api/fees.rs extern crate bodyparser; extern crate exonum; extern crate iron; extern crate router; extern crate serde; extern crate serde_json; use std::collections::HashMap; use exonum::api::Api; use exonum::blockchain::Blockchain; use exonum::crypt...
code_fim
hard
{ "lang": "rust", "repo": "SCRTHodl/blockchain", "path": "/dmbc/src/currency/api/fees.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Into<Box<FeesCalculator>> for FeesRequest { fn into(self) -> Box<FeesCalculator> { match self { FeesRequest::Transfer(trans) => Box::new(trans), FeesRequest::AddAssets(trans) => Box::new(trans), FeesRequest::DeleteAssets(trans) => Box::new(trans), ...
code_fim
hard
{ "lang": "rust", "repo": "SCRTHodl/blockchain", "path": "/dmbc/src/currency/api/fees.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn it_works() { let arr: Vec<i64> = vec![3, 7, 9, 34, 57, 57, 57, 92, 234, 568]; let indx = binary_search(arr, 57); assert_eq!(indx, 6); } }<|fim_prefix|>// repo: twin-devs/algorithms-in-rust path: /src/algorithms/binary_search.rs pub fn binary_search(arr: Vec<...
code_fim
medium
{ "lang": "rust", "repo": "twin-devs/algorithms-in-rust", "path": "/src/algorithms/binary_search.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let arr: Vec<i64> = vec![3, 7, 9, 34, 57, 57, 57, 92, 234, 568]; let indx = binary_search(arr, 57); assert_eq!(indx, 6); } }<|fim_prefix|>// repo: twin-devs/algorithms-in-rust path: /src/algorithms/binary_search.rs pub fn binary_search(arr: Vec<i64>, x: i64) -> usize { pri...
code_fim
medium
{ "lang": "rust", "repo": "twin-devs/algorithms-in-rust", "path": "/src/algorithms/binary_search.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: twin-devs/algorithms-in-rust path: /src/algorithms/binary_search.rs pub fn binary_search(arr: Vec<i64>, x: i64) -> usize { println!("inside binary search"); let n = arr.len(); let (mut l, mut r) = (0, n-1); let mut mid; while r-l > 1 { mid = l + (r-l)/2; if x ...
code_fim
medium
{ "lang": "rust", "repo": "twin-devs/algorithms-in-rust", "path": "/src/algorithms/binary_search.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let bytes = self.inner.write(buf)?; self.count += bytes as u64; Ok(bytes) } fn flush(&mut self) -> Result<(), io::Error> { self.inner.flush() } } impl<I: AsyncRead + Unpin> AsyncRead for CountingIO<I> { fn poll_read( self: Pin<&mut Self>, c...
code_fim
hard
{ "lang": "rust", "repo": "ryanleh/io-utils", "path": "/src/counting.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ryanleh/io-utils path: /src/counting.rs //! This module defines the [`CountingIO<I>`] wrapper type for measuring the //! amount of communication used by a network connection. //! //! Much of the code in this module is inspired by the //! [`count-write`](https://crates.io/crates/count-write) crat...
code_fim
hard
{ "lang": "rust", "repo": "ryanleh/io-utils", "path": "/src/counting.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pombredanne/contentin path: /ci-capnp/src/write.rs use std; use entry; use Ownership; pub fn write_meta(meta: &::Meta, entry: &mut entry::Builder, size: u64) { entry.set_atime(meta.atime); entry.set_mtime(meta.mtime); entry.set_ctime(meta.ctime); entry.set_btime(meta.btime); ...
code_fim
hard
{ "lang": "rust", "repo": "pombredanne/contentin", "path": "/ci-capnp/src/write.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> { let mut type_ = entry.borrow().get_type(); use ItemType::*; match meta.item_type { Unknown => match size { 0 => type_.set_directory(()), _ => type_.set_normal(()), }, RegularFile => type_.set_normal(()), ...
code_fim
hard
{ "lang": "rust", "repo": "pombredanne/contentin", "path": "/ci-capnp/src/write.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Steelbirdy/poise path: /src/reply.rs use crate::serenity_prelude as serenity; /// Message builder that abstracts over prefix and application command responses #[derive(Default)] pub struct CreateReply<'a> { /// Message content pub content: Option<String>, /// Embed, if present p...
code_fim
hard
{ "lang": "rust", "repo": "Steelbirdy/poise", "path": "/src/reply.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Send a message in the given context: normal message if prefix command, interaction response /// if application command. /// /// If you just want to send a string, use [`say_reply`]. /// /// ```rust,no_run /// # #[tokio::main] async fn main() -> Result<(), Box<dyn std::error::Error>> { /// # let ctx: p...
code_fim
hard
{ "lang": "rust", "repo": "Steelbirdy/poise", "path": "/src/reply.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Returned from [`send_reply`] to retrieve the sent message object. /// /// For prefix commands, you can retrieve the sent message directly. For slash commands, Discord /// requires a network request. pub enum ReplyHandle<'a> { /// When sending a normal message, Discord returns the message object di...
code_fim
hard
{ "lang": "rust", "repo": "Steelbirdy/poise", "path": "/src/reply.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sug0/zz path: /src/smt.rs p()._eq(&capi_lhs.as_bv().unwrap().bvsge(&capi_rhs.as_bv().unwrap()))); } else { write!(self.debug.borrow_mut(), "{}(assert (= {} (bvuge {} {})))\n", self.debug_indent, smt_tmp, smt_lhs...
code_fim
hard
{ "lang": "rust", "repo": "sug0/zz", "path": "/src/smt.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sug0/zz path: /src/smt.rs lf.solve(); self.solver.pop(1); !r } _ => false, } } pub fn infix_op( &self, tmp: Symbol, lhs: TemporalSymbol, rhs: TemporalSymbol, op: crate::a...
code_fim
hard
{ "lang": "rust", "repo": "sug0/zz", "path": "/src/smt.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert!(lhs.len() > 0); let mut asserts_capi = Vec::new(); let mut asserts_debug = Vec::new(); for lhs in lhs { let (capi_lhs, smt_lhs) = self.var(&lhs); asserts_capi.push(capi_lhs.as_bool().unwrap().not()); asserts_debug.push(format!(...
code_fim
hard
{ "lang": "rust", "repo": "sug0/zz", "path": "/src/smt.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kuy/rustracer path: /src/vector.rs use std::marker::PhantomData; pub trait Kind {} #[derive(Debug)] pub struct General(); impl Kind for General {} #[derive(Debug)] pub struct Normal(); impl Kind for Normal {} #[derive(Debug)] pub struct Vector3D<T: Kind> { pub x: f32, pub y: f32, ...
code_fim
hard
{ "lang": "rust", "repo": "kuy/rustracer", "path": "/src/vector.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_vector3d_mul() { let v = Vector3D::new(3.0, 4.0, 5.0); let r = v.mul(3.0); assert_eq!([9.0, 12.0, 15.0], [r.x, r.y, r.z]); } #[test] fn test_vector3d_invert() { let v1 = Vector3D::new(0.0, 0.0, 0.0); let r1 = v1.invert(); ...
code_fim
hard
{ "lang": "rust", "repo": "kuy/rustracer", "path": "/src/vector.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_vector3d_invert() { let v1 = Vector3D::new(0.0, 0.0, 0.0); let r1 = v1.invert(); assert_eq!([0.0, 0.0, 0.0], [r1.x, r1.y, r1.z]); let v2 = Vector3D::new(3.0, 4.0, 5.0); let r2 = v2.invert(); assert_eq!([-3.0, -4.0, -5.0], [r2.x, r2.y...
code_fim
hard
{ "lang": "rust", "repo": "kuy/rustracer", "path": "/src/vector.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joseluis/arraystring path: /tests/string_parity.rs use arraystring::{error::Error, prelude::*, utils::is_char_boundary, utils::is_inside_boundary}; use std::panic::{catch_unwind, AssertUnwindSafe, RefUnwindSafe}; use std::{fmt::Debug, iter::FromIterator}; fn unwind<R, F>(func: F) -> Result<R, (...
code_fim
hard
{ "lang": "rust", "repo": "joseluis/arraystring", "path": "/tests/string_parity.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok("".to_owned()) } } impl Normalize<Result<String, ()>> for MaxString { fn normalize(&self) -> Result<String, ()> { Ok(self.as_str().to_owned()) } } impl Normalize<Result<String, ()>> for String { fn normalize(&self) -> Result<String, ()> { Ok(self.as_str().to_ow...
code_fim
hard
{ "lang": "rust", "repo": "joseluis/arraystring", "path": "/tests/string_parity.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok(self.as_str().to_owned()) } } impl Normalize<Result<String, ()>> for String { fn normalize(&self) -> Result<String, ()> { Ok(self.as_str().to_owned()) } } impl<'a> Normalize<Result<String, ()>> for &'a str { fn normalize(&self) -> Result<String, ()> { Ok(self.t...
code_fim
hard
{ "lang": "rust", "repo": "joseluis/arraystring", "path": "/tests/string_parity.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pcwalton/rust-sandbox path: /lib.rs // Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license...
code_fim
medium
{ "lang": "rust", "repo": "pcwalton/rust-sandbox", "path": "/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[deriving(Clone, Eq)] pub enum SandboxMode { RestrictedMode, OpenGLMode, } #[cfg(not(target_os="macos"))] pub fn enter(_: SandboxMode) { // No-op. // // FIXME(pcwalton): Sandbox on Windows and Linux. }<|fim_prefix|>// repo: pcwalton/rust-sandbox path: /lib.rs // Copyright 2013 The S...
code_fim
medium
{ "lang": "rust", "repo": "pcwalton/rust-sandbox", "path": "/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(not(target_os="macos"))] pub fn enter(_: SandboxMode) { // No-op. // // FIXME(pcwalton): Sandbox on Windows and Linux. }<|fim_prefix|>// repo: pcwalton/rust-sandbox path: /lib.rs // Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this...
code_fim
medium
{ "lang": "rust", "repo": "pcwalton/rust-sandbox", "path": "/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mathspy/euler_rust_practice path: /009_special_pythagorean_triplet/src/main.rs #[macro_use] extern crate itertools; use std::env; fn main() { let args: Vec<String> = env::args().collect(); println!( "{}", solve(args[1].parse().expect("Please input a valid integer")) ...
code_fim
hard
{ "lang": "rust", "repo": "Mathspy/euler_rust_practice", "path": "/009_special_pythagorean_triplet/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn produces_correct_answer_for_example() { assert_eq!(60, solve(12)); } #[test] fn produces_correct_answer_for_problem() { assert_eq!(31875000, solve(1000)); } }<|fim_prefix|>// repo: Mathspy/euler_rust_practice path: /009_special_pythagorean_triplet/src/m...
code_fim
hard
{ "lang": "rust", "repo": "Mathspy/euler_rust_practice", "path": "/009_special_pythagorean_triplet/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32mp1/src/stm32mp157/gicd/gicd_ipriorityr47.rs #[doc = "Register `GICD_IPRIORITYR47` reader"] pub type R = crate::R<GICD_IPRIORITYR47_SPEC>; #[doc = "Register `GICD_IPRIORITYR47` writer"] pub type W = crate::W<GICD_IPRIORITYR47_SPEC>; #[doc = "Field `PRIORIT...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/gicd/gicd_ipriorityr47.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let bad = { let x = 1; let y = &x; //~ ERROR `x` does not live long enough scoped(|| { let _z = y; //~^ ERROR `y` does not live long enough }) }; bad.join(); }<|fim_prefix|>// repo: theduke/rust path: /src/test/ui/span/send-is-not-stat...
code_fim
medium
{ "lang": "rust", "repo": "theduke/rust", "path": "/src/test/ui/span/send-is-not-static-ensures-scoping.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: theduke/rust path: /src/test/ui/span/send-is-not-static-ensures-scoping.rs // Copyright 2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICE...
code_fim
medium
{ "lang": "rust", "repo": "theduke/rust", "path": "/src/test/ui/span/send-is-not-static-ensures-scoping.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MindFlavor/azure-sdk-for-rust path: /services/svc/synapse/src/package_kql_script_2021_06_preview/models.rs #![doc = "generated by AutoRust 0.1.0"] #![allow(non_camel_case_types)] #![allow(unused_imports)] use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Serialize, Deseriali...
code_fim
hard
{ "lang": "rust", "repo": "MindFlavor/azure-sdk-for-rust", "path": "/services/svc/synapse/src/package_kql_script_2021_06_preview/models.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(default, skip_serializing_if = "Option::is_none")] pub language: Option<String>, } #[derive(Clone, Debug, PartialEq, Serialize, Deserialize)] pub struct CurrentConnection { #[serde(default, skip_serializing_if = "Option::is_none")] ...
code_fim
hard
{ "lang": "rust", "repo": "MindFlavor/azure-sdk-for-rust", "path": "/services/svc/synapse/src/package_kql_script_2021_06_preview/models.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: e42s/kernel path: /src/reactors/sequence.rs use std::cell::Cell; use std::rc::Rc; #[derive(Clone)] pub struct Sequence { value: Rc<Cell<usize>> } <|fim_suffix|> self.value.set(id + 1); id } } impl Default for Sequence { fn default() -> Self { Sequence::new(...
code_fim
medium
{ "lang": "rust", "repo": "e42s/kernel", "path": "/src/reactors/sequence.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn next(&self) -> usize { let id = self.value.get(); self.value.set(id + 1); id } } impl Default for Sequence { fn default() -> Self { Sequence::new() } }<|fim_prefix|>// repo: e42s/kernel path: /src/reactors/sequence.rs use std::cell::Cell; use std:...
code_fim
medium
{ "lang": "rust", "repo": "e42s/kernel", "path": "/src/reactors/sequence.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for Sequence { fn default() -> Self { Sequence::new() } }<|fim_prefix|>// repo: e42s/kernel path: /src/reactors/sequence.rs use std::cell::Cell; use std::rc::Rc; #[derive(Clone)] pub struct Sequence { value: Rc<Cell<usize>> } impl Sequence { pub fn new() -> Sequenc...
code_fim
medium
{ "lang": "rust", "repo": "e42s/kernel", "path": "/src/reactors/sequence.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shayne-fletcher/zen path: /rust/grmtools/asdl-rec/build.rs use cfgrammar::yacc::YaccKind; use lrlex::CTLexerBuilder; <|fim_suffix|> CTLexerBuilder::new() .lrpar_config(|ctp| { ctp.yacckind(YaccKind::Grmtools) .grammar_in_src_dir("asdl.y") ....
code_fim
easy
{ "lang": "rust", "repo": "shayne-fletcher/zen", "path": "/rust/grmtools/asdl-rec/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> CTLexerBuilder::new() .lrpar_config(|ctp| { ctp.yacckind(YaccKind::Grmtools) .grammar_in_src_dir("asdl.y") .unwrap() }) .lexer_in_src_dir("asdl.l")? .build()?; Ok(()) }<|fim_prefix|>// repo: shayne-fletcher/zen path: /rus...
code_fim
easy
{ "lang": "rust", "repo": "shayne-fletcher/zen", "path": "/rust/grmtools/asdl-rec/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn sym_source_mut(&mut self) -> &mut SymbolSource { self.inherit.sym_source_mut() } fn retain<F>(&mut self, f: F) where F: FnMut(Symbol, &[Symbol], &WeightedHistory<W>) -> bool, { self.inherit.retain(f) } fn add_rule(&mut self, lhs: Symbol, rhs: &[Symb...
code_fim
hard
{ "lang": "rust", "repo": "pczarn/cfg", "path": "/src/generation/weighted/binarized_grammar.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pczarn/cfg path: /src/generation/weighted/binarized_grammar.rs use std::ops::{Deref, DerefMut}; use binarized::BinarizedRules; use rule::container::RuleContainer; use rule::RuleRef; use symbol::SymbolSource; use BinarizedCfg; use ContextFree; use ContextFreeRef; use Symbol; use super::*; /// ...
code_fim
hard
{ "lang": "rust", "repo": "pczarn/cfg", "path": "/src/generation/weighted/binarized_grammar.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/testing/sl4f/src/factory_store/facade.rs // Copyright 2019 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; use crate::factory_store::types::{FactoryS...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/testing/sl4f/src/factory_store/facade.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #[fasync::run_singlethreaded(test)] async fn read_file_with_unknown_file_fails() -> Result<(), Error> { let factory_store_facade = FactoryStoreFacade::new(); factory_store_facade .read_file(json!({ "provider": "cast", "filename": "missing_file" })) .await ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/testing/sl4f/src/factory_store/facade.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) } #[fasync::run_singlethreaded(test)] async fn read_file_with_unknown_provider_fails() -> Result<(), Error> { let factory_store_facade = FactoryStoreFacade::new(); factory_store_facade .read_file(json!({ "provider": "unknown", "filename": "missing_fi...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/testing/sl4f/src/factory_store/facade.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(head(Path::new("hightenp.txt"),2).unwrap(), "高知県\t江川崎\t41\t2013-08-12\n埼玉県\t熊谷\t40.9\t2007-08-16\n".to_string()); } #[test] fn knock15() { assert_eq!(tail(Path::new("hightenp.txt"),2).unwrap(), "山形県\t鶴岡\t39.9\t1978-08-03\n愛知県\t名古屋\t39.9\t1942-08-02\n".to_string()); ...
code_fim
hard
{ "lang": "rust", "repo": "yushiray/knock100-2015-rust", "path": "/tests/ch2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yushiray/knock100-2015-rust path: /tests/ch2.rs extern crate knock100_2015; mod ch2_tests { use knock100_2015::ch2::knock10::count_lines; use knock100_2015::ch2::knock10::head; use knock100_2015::ch2::knock10::tail; use knock100_2015::ch2::knock10::split; use knock100_2015::...
code_fim
hard
{ "lang": "rust", "repo": "yushiray/knock100-2015-rust", "path": "/tests/ch2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(split(Path::new("hightenp.txt"),2).unwrap(), vec!["高知県\t江川崎\t41\t2013-08-12\n埼玉県\t熊谷\t40.9\t2007-08-16".to_string(), "岐阜県\t多治見\t40.9\t2007-08-16\n山形県\t山形\t40.8\t1933-07-25".to_string(), ...
code_fim
hard
{ "lang": "rust", "repo": "yushiray/knock100-2015-rust", "path": "/tests/ch2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pragmatrix/emergent path: /view/src/lazy_map.rs use crate::{ChangeSet, IndexedSource, IndexedTarget}; pub struct LazyMap<E, R> { generator: Box<dyn Fn(&E) -> R>, elements: Vec<E>, generated: Vec<Option<R>>, } impl<E, R> LazyMap<E, R> { pub fn new(generator: impl Fn(&E) -> R + '...
code_fim
hard
{ "lang": "rust", "repo": "pragmatrix/emergent", "path": "/view/src/lazy_map.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn iter_at(&mut self, start: usize) -> Box<dyn Iterator<Item = &R> + '_> { Box::new(self.iter_at(start)) } } impl<E, R> IndexedTarget<E> for LazyMap<E, R> { fn apply(&mut self, elements: &[E]) -> ChangeSet<E> where E: Clone, E: PartialEq, { let cs = sel...
code_fim
medium
{ "lang": "rust", "repo": "pragmatrix/emergent", "path": "/view/src/lazy_map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fossabot/necsim-rust path: /necsim/core/src/cogs/backup.rs use core::ops::Deref; #[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_trait] pub trait Backup: Sized { #[must_use] unsafe fn backup_unchecked(&self) -> Self; fn backup(&self) -> BackedUp<Self> { <...
code_fim
medium
{ "lang": "rust", "repo": "fossabot/necsim-rust", "path": "/necsim/core/src/cogs/backup.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>impl<T: Backup> Deref for BackedUp<T> { type Target = T; fn deref(&self) -> &Self::Target { &self.0 } }<|fim_prefix|>// repo: fossabot/necsim-rust path: /necsim/core/src/cogs/backup.rs use core::ops::Deref; #[allow(clippy::inline_always, clippy::inline_fn_without_body)] #[contract_t...
code_fim
medium
{ "lang": "rust", "repo": "fossabot/necsim-rust", "path": "/necsim/core/src/cogs/backup.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pickfire/webapp.rs path: /src/backend/database/executor.rs //! Everything related to database handling use actix::prelude::*; use backend::{ database::{models::Session, schema::sessions::dsl::*}, server::ServerError, }; use diesel::{ delete, insert_into, prelude::*, r2d2::{C...
code_fim
hard
{ "lang": "rust", "repo": "pickfire/webapp.rs", "path": "/src/backend/database/executor.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Insert the session into the database debug!("Creating new session: {}", msg.id); insert_into(sessions) .values(&Session { id: msg.id }) .get_result::<Session>(&self.0.get()?) .map_err(|_| ServerError::InsertToken.into()) } } /// The updat...
code_fim
hard
{ "lang": "rust", "repo": "pickfire/webapp.rs", "path": "/src/backend/database/executor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub(super) async fn new_log_file(path: &Path, generation: u64) -> Result<File> { let path = log_path(&path, generation); Ok(OpenOptions::new() .create(true) .write(true) .append(true) .open(&path) .await?) } pub(super) fn log_path(dir: &Path, generation: u6...
code_fim
easy
{ "lang": "rust", "repo": "ysaito1001/pna-rust", "path": "/project-5/src/engines/kvs/log_common.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ysaito1001/pna-rust path: /project-5/src/engines/kvs/log_common.rs use std::path::{Path, PathBuf}; use async_std::fs::{File, OpenOptions}; use crate::Result; <|fim_suffix|>pub(super) fn log_path(dir: &Path, generation: u64) -> PathBuf { dir.join(format!("{}.log", generation)) }<|fim_middl...
code_fim
hard
{ "lang": "rust", "repo": "ysaito1001/pna-rust", "path": "/project-5/src/engines/kvs/log_common.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: srfraser/adventofcode path: /2017/11/rust/src/main.rs use std::collections::HashMap; #[derive(Debug)] struct Coord { x: i32, y: i32, z: i32, } fn movecoord(start: &mut Coord, direction: &Coord) { start.x += direction.x; start.y += direction.y; start.z += direction.z; } ...
code_fim
hard
{ "lang": "rust", "repo": "srfraser/adventofcode", "path": "/2017/11/rust/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for step in data { movecoord(&mut current, direction_map.get(step).unwrap()); current_distance = cube_distance(&start, &current); if current_distance > max_distance { max_distance = current_distance; } } println!( "Position {:?} is {} steps a...
code_fim
hard
{ "lang": "rust", "repo": "srfraser/adventofcode", "path": "/2017/11/rust/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Jasperav/cdrs_orm path: /cdrs_db_mirror/src/db_mirror.rs use cdrs_query_writer::{Crud, Inf, Writer}; use proc_macro2::{Ident, TokenStream}; use quote::format_ident; use syn::DeriveInput; pub(crate) fn db_mirror(derive_input: DeriveInput) -> TokenStream { cdrs_query_writer::write(derive_inpu...
code_fim
hard
{ "lang": "rust", "repo": "Jasperav/cdrs_orm", "path": "/cdrs_db_mirror/src/db_mirror.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn write( &self, inf: &Inf, db_mirror_fn_name: &Ident, _custom_fn_name: &Ident, crud: Crud, ) -> proc_macro2::TokenStream { match crud { Crud::InsertUnique(using_ttl) => { crate::cdrs_query_writers::insert::generate(inf, d...
code_fim
hard
{ "lang": "rust", "repo": "Jasperav/cdrs_orm", "path": "/cdrs_db_mirror/src/db_mirror.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zerosign/etcdr path: /build.rs fn main() { let proto_files = [ "proto/etcd/etcdserver/etcdserverpb/rpc.proto", "proto/etcd/v3election/v3electionpb/v3election.proto", "proto/etcd/v3lock/v3lockpb/v3lock.proto", ]; <|fim_suffix|> tonic_build::configure() ...
code_fim
easy
{ "lang": "rust", "repo": "zerosign/etcdr", "path": "/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> tonic_build::configure() .build_client(true) .build_server(false) .format(true) .compile(&proto_files, &include_paths) .unwrap(); }<|fim_prefix|>// repo: zerosign/etcdr path: /build.rs fn main() { let proto_files = [ "proto/etcd/etcdserver/etcdserve...
code_fim
easy
{ "lang": "rust", "repo": "zerosign/etcdr", "path": "/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raven-os/nest-server path: /src/api/package/download.rs use std::path::PathBuf; use std::sync::Arc; use libnest::package::PackageName; use rocket::response::NamedFile; use rocket::response::Responder; use rocket::State; use rocket::{response, Request, Response}; use semver::Version; use crate:...
code_fim
hard
{ "lang": "rust", "repo": "raven-os/nest-server", "path": "/src/api/package/download.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'r> Responder<'r> for DownloadFile { fn respond_to(self, req: &Request) -> response::Result<'r> { Response::build_from(self.file.respond_to(req)?) .raw_header( "content-disposition", format!( "attachment; filename=\"{}-{}.nes...
code_fim
hard
{ "lang": "rust", "repo": "raven-os/nest-server", "path": "/src/api/package/download.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Response::build_from(self.file.respond_to(req)?) .raw_header( "content-disposition", format!( "attachment; filename=\"{}-{}.nest\"", self.name, self.version, ), ) .ok() }...
code_fim
hard
{ "lang": "rust", "repo": "raven-os/nest-server", "path": "/src/api/package/download.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Threshold invalid Threshold, } #[cfg(feature = "std")] impl std::error::Error for Error {}<|fim_prefix|>// repo: iqlusioninc/armistice path: /core/src/error.rs //! Error type use displaydoc::Display; <|fim_middle|>/// Types of errors #[derive(Copy, Clone, Debug, Display, Eq, PartialEq)] pu...
code_fim
medium
{ "lang": "rust", "repo": "iqlusioninc/armistice", "path": "/core/src/error.rs", "mode": "spm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iqlusioninc/armistice path: /core/src/error.rs //! Error type use displaydoc::Display; /// Types of errors #[derive(Copy, Clone, Debug, Display, Eq, PartialEq)] pub enum Error { /// Crypto error Crypto, <|fim_suffix|> /// Threshold invalid Threshold, } #[cfg(feature = "std")] ...
code_fim
easy
{ "lang": "rust", "repo": "iqlusioninc/armistice", "path": "/core/src/error.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iqlusioninc/armistice path: /core/src/error.rs //! Error type use displaydoc::Display; <|fim_suffix|> /// Provisioning error Provision, /// Threshold invalid Threshold, } #[cfg(feature = "std")] impl std::error::Error for Error {}<|fim_middle|>/// Types of errors #[derive(Copy...
code_fim
medium
{ "lang": "rust", "repo": "iqlusioninc/armistice", "path": "/core/src/error.rs", "mode": "psm", "license": "LicenseRef-scancode-warranty-disclaimer", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alxandr/semantic-rpg path: /skorm-store/src/lib.rs ::Result { write!(f, "_:{}", self.id) } } #[derive(Debug, Hash, PartialEq, Eq, Clone, Copy)] enum RdfStoreNamedOrBlankNode { Named(Id<RdfStoreNamedNode>), Blank(Id<RdfStoreBlankNode>), } impl RdfDisplay for RdfStoreNamedOrBlankNode {...
code_fim
hard
{ "lang": "rust", "repo": "Alxandr/semantic-rpg", "path": "/skorm-store/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alxandr/semantic-rpg path: /skorm-store/src/lib.rs Simple(String), LanguageTaggedString(String, String), Typed(String, Id<RdfStoreNamedNode>), } impl RdfStoreLiteral { fn value(&self) -> &str { match self { RdfStoreLiteral::Simple(s) => &s, RdfStoreLiteral::LanguageTagge...
code_fim
hard
{ "lang": "rust", "repo": "Alxandr/semantic-rpg", "path": "/skorm-store/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn insert_literal(&mut self, literal: skorm_core::Literal<'_>) -> Id<RdfStoreLiteral> { use skorm_core::Literal; let literal = match literal { Literal::Simple { value } => RdfStoreLiteral::Simple(value.to_owned()), Literal::LanguageTaggedString { value, language } => { RdfSt...
code_fim
hard
{ "lang": "rust", "repo": "Alxandr/semantic-rpg", "path": "/skorm-store/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn unique_literals(clause: FlatClause) -> FlatClause { use std::collections::HashSet; let mut result = Vec::new(); let mut set = HashSet::new(); clause.into_iter().for_each(|l| { if !set.contains(&l) { set.insert(l.clone()); result.push(l); } })...
code_fim
hard
{ "lang": "rust", "repo": "salmans/rusty-razor", "path": "/razor-chase/src/chase/impl/relational/sequent.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let head_linear = head_relational.linear_with(&mut linear_generator()); let head_attributes = AttributeList::try_from(&head_linear)?.universals(); let range = Vec::from(&head_attributes); // apply range restriction: let body_range_restricted = body_linear.range_res...
code_fim
hard
{ "lang": "rust", "repo": "salmans/rusty-razor", "path": "/razor-chase/src/chase/impl/relational/sequent.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: salmans/rusty-razor path: /razor-chase/src/chase/impl/relational/sequent.rs use super::{ attribute::{Attribute, AttributeList}, constants::*, expression::Convertor, symbol::Symbol, Error, Tuple, }; use crate::chase::Sequent; use codd::expression as rel_exp; use itertools::Ite...
code_fim
hard
{ "lang": "rust", "repo": "salmans/rusty-razor", "path": "/razor-chase/src/chase/impl/relational/sequent.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>4b091e2e4920023f1a7ce40908255228e36f0f2424394b3c48 34130cf8223f23084813e745e006531a1e464b005e0e1ee405413fe22b4e 4af201080c0928420c2d491f6e5121e451223b070dee54244b3efc470a0e 771c161f795df81c22101408465ae7ef0c0604733ee03a20560c1512f217 2f3a142c4155073a200f04166c565634020a59ea04244ff7413c4bc10858 240d4752e5f...
code_fim
hard
{ "lang": "rust", "repo": "ocrickard/Crypto", "path": "/challenge4/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ocrickard/Crypto path: /challenge4/src/main.rs 200a470537ecec392d31070b38 07e32c180dfa56496a461627542115132a4c284050495b23e2245b093159 2d3c230a1e5a300f6c3e26ed0d1709434950fd6f1e121335054129e4e4ec ef22fa2112311b11584ce43434f46f521a215433f9514fe33d313a3e0838 34e7f336270c08010f2f544f0f1c1e235c02226...
code_fim
hard
{ "lang": "rust", "repo": "ocrickard/Crypto", "path": "/challenge4/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ocrickard/Crypto path: /challenge4/src/main.rs 14 372b453d5a357c05142be65b3c17f92d2b134853390a312bf92a531b513d 5658265f4c0ce4440a20322f591a413034292b312206a01be6453a512d21 1c585c19f31f785324f8583d1ee02620342b10a236263f105011ee5b0e14 0f522b550818591a752e5fea0e033322ee5e280a4a1b244f5a2b35341255 39...
code_fim
hard
{ "lang": "rust", "repo": "ocrickard/Crypto", "path": "/challenge4/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub use util::file_as_string; pub use day::Day; use_days!( day_01, day_02, day_03, day_04, day_05, day_06, day_07, day_08, day_09, day_10, day_11, day_12, day_13, day_14, day_15, day_16 );<|fim_prefix|>// repo: lux01/advent-of-code-2017 pat...
code_fim
medium
{ "lang": "rust", "repo": "lux01/advent-of-code-2017", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lux01/advent-of-code-2017 path: /src/lib.rs //! # Advent of Code 2017 //! //! This crate contains my solutions for the [Advent of Code 2017](https://adventofcode.com/2017) challenges. //! Each solution is separated into a different [Day](trait.Day.html). Use `cargo test` to run each implementat...
code_fim
medium
{ "lang": "rust", "repo": "lux01/advent-of-code-2017", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use_days!( day_01, day_02, day_03, day_04, day_05, day_06, day_07, day_08, day_09, day_10, day_11, day_12, day_13, day_14, day_15, day_16 );<|fim_prefix|>// repo: lux01/advent-of-code-2017 path: /src/lib.rs //! # Advent of Code 2017 //! //!...
code_fim
medium
{ "lang": "rust", "repo": "lux01/advent-of-code-2017", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SteadBytes/study path: /rust-in-action/ch09/clock-3/src/main.rs //! `clock` - Cross-platform NTP client and system time control mod clock; mod ntp; use chrono::{format::ParseResult, DateTime, Duration as ChronoDuration, FixedOffset, Utc}; use clap::{arg_enum, value_t, App, AppSettings, Arg, Sub...
code_fim
hard
{ "lang": "rust", "repo": "SteadBytes/study", "path": "/rust-in-action/ch09/clock-3/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let args = app.get_matches(); // Default value set in clap app -> safe to unwrap let std = value_t!(args, "std", TimeFormat).unwrap(); match args.subcommand() { ("get", _) => { let now = Clock::get(); match std { TimeFormat::Timestamp => pr...
code_fim
hard
{ "lang": "rust", "repo": "SteadBytes/study", "path": "/rust-in-action/ch09/clock-3/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AudioBucket/axiom path: /compiler/src/codegen/controls/graph_control.rs ata_ptr, 2, "paused.ptr") }; let curve_count = control .ctx .b .build_load( &unsafe { control.ctx.b.build_struct_gep(&control.shared_ptr, 0, "") }, ...
code_fim
hard
{ "lang": "rust", "repo": "AudioBucket/axiom", "path": "/compiler/src/codegen/controls/graph_control.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AudioBucket/axiom path: /compiler/src/codegen/controls/graph_control.rs ctx.b.build_struct_gep(&control.shared_ptr, 2, "") }; let tension_array_ptr = unsafe { control.ctx.b.build_struct_gep(&control.shared_ptr, 3, "") }; let state_array_ptr = unsafe { control.ctx.b.bu...
code_fim
hard
{ "lang": "rust", "repo": "AudioBucket/axiom", "path": "/compiler/src/codegen/controls/graph_control.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }