text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> let (is_bazel_platform, matches_all_platforms) = util::is_bazel_supported_platform(&target_str); // If the target is not supported by Bazel, we ignore it if !is_bazel_platform { continue; } // In cases where the cfg target matches all platforms,...
code_fim
hard
{ "lang": "rust", "repo": "therealbnut/cargo-raze", "path": "/impl/src/planning/subplanners.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: therealbnut/cargo-raze path: /impl/src/planning/subplanners.rs }) .map_err(|e| e.into()) } /// Produces a crate context for each declared crate and dependency. fn produce_crate_contexts(&self) -> Result<Vec<CrateContext>> { self .crate_catalog .metadata ....
code_fim
hard
{ "lang": "rust", "repo": "therealbnut/cargo-raze", "path": "/impl/src/planning/subplanners.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: therealbnut/cargo-raze path: /impl/src/planning/subplanners.rs ldableDependency>, // Dependencies that are required for build script only build_deps: Vec<BuildableDependency>, // Dependencies that proc macros and are required for the build script only build_proc_macro_deps: Vec<Buildable...
code_fim
hard
{ "lang": "rust", "repo": "therealbnut/cargo-raze", "path": "/impl/src/planning/subplanners.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reujab/wallpaper.rs path: /src/unsupported.rs use Result; pub fn get() -> Result<String> { Err("unsupported operating system".into()) } <|fim_suffix|>#[cfg(feature = "from_url")] pub fn set_from_url(_: &str) -> Result<()> { Err("unsupported operating system".into()) } pub fn set_mode(...
code_fim
medium
{ "lang": "rust", "repo": "reujab/wallpaper.rs", "path": "/src/unsupported.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "from_url")] pub fn set_from_url(_: &str) -> Result<()> { Err("unsupported operating system".into()) } pub fn set_mode(_: Mode) -> Result<()> { Err("unsupported operating system".into()) }<|fim_prefix|>// repo: reujab/wallpaper.rs path: /src/unsupported.rs use Result; pub fn get...
code_fim
medium
{ "lang": "rust", "repo": "reujab/wallpaper.rs", "path": "/src/unsupported.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>pub fn set_mode(_: Mode) -> Result<()> { Err("unsupported operating system".into()) }<|fim_prefix|>// repo: reujab/wallpaper.rs path: /src/unsupported.rs use Result; pub fn get() -> Result<String> { Err("unsupported operating system".into()) } <|fim_middle|>pub fn set_from_path(_: &str) -> Resu...
code_fim
hard
{ "lang": "rust", "repo": "reujab/wallpaper.rs", "path": "/src/unsupported.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kotamat/rust_tutorial path: /concurrency/src/shared_state.rs use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::thread; pub(crate) fn main() { mutex(); mutex_multithreads(); } <|fim_suffix|> // ArcはRcのatomic版。atomicはRcに比べてコストが高い代わりに、スレッドセーフなので、マルチスレッド時のみ使う let counter = Arc:...
code_fim
hard
{ "lang": "rust", "repo": "kotamat/rust_tutorial", "path": "/concurrency/src/shared_state.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for handle in handles { handle.join().unwrap(); } println!("Result: {}", *counter.lock().unwrap()); }<|fim_prefix|>// repo: kotamat/rust_tutorial path: /concurrency/src/shared_state.rs use std::rc::Rc; use std::sync::{Arc, Mutex}; use std::thread; pub(crate) fn main() { mutex(); ...
code_fim
hard
{ "lang": "rust", "repo": "kotamat/rust_tutorial", "path": "/concurrency/src/shared_state.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let m = Mutex::new(5); { let mut num = m.lock().unwrap(); *num = 6; // ロック中はデータが参照できない println!("m = {:?}", m); // スコープが終わるとMutexGuardが終了し、lockも解除される } println!("m = {:?}", m); } fn mutex_multithreads() { // ArcはRcのatomic版。atomicはRcに比べてコストが高い代わ...
code_fim
medium
{ "lang": "rust", "repo": "kotamat/rust_tutorial", "path": "/concurrency/src/shared_state.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait Persistable { fn save(&self); fn load(filename: &str) -> Self; }<|fim_prefix|>// repo: HerrBertling/saito-rust path: /src/time.rs use chrono::prelude::*; use std::time::{SystemTime, UNIX_EPOCH}; <|fim_middle|>pub fn create_timestamp() -> u64 { SystemTime::now() .duration_si...
code_fim
hard
{ "lang": "rust", "repo": "HerrBertling/saito-rust", "path": "/src/time.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HerrBertling/saito-rust path: /src/time.rs use chrono::prelude::*; use std::time::{SystemTime, UNIX_EPOCH}; <|fim_suffix|>pub fn format_timestamp( timestamp: u64, ) -> chrono::format::DelayedFormat<chrono::format::StrftimeItems<'static>> { let naive = NaiveDateTime::from_timestamp((time...
code_fim
medium
{ "lang": "rust", "repo": "HerrBertling/saito-rust", "path": "/src/time.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BaZzz01010101/ReflaxManRs path: /src/render/material.rs use super::Color; #[derive(Debug, Clone, PartialEq)] pub enum Kind { None, Metal, Dielectric, } impl Default for Kind { fn default() -> Kind { <|fim_suffix|>impl Material { pub fn new(kind: Kind, color: Color, reflectivity: f32,...
code_fim
medium
{ "lang": "rust", "repo": "BaZzz01010101/ReflaxManRs", "path": "/src/render/material.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Material { pub fn new(kind: Kind, color: Color, reflectivity: f32, transparency: f32) -> Material { Material { kind, color, reflectivity, transparency, } } }<|fim_prefix|>// repo: BaZzz01010101/ReflaxManRs path: /src/render/material.rs use super::Color; #[derive(...
code_fim
hard
{ "lang": "rust", "repo": "BaZzz01010101/ReflaxManRs", "path": "/src/render/material.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while checksum.len() % 2 == 0 { checksum = checksum .chunks_exact(2) .map(|chunk| !(chunk[0] ^ chunk[1])) .collect(); } checksum .into_iter() .map(|b| if b { '1' } else { '0' }) .collect() }<|fim_prefix|>// repo: ocstl/advent...
code_fim
hard
{ "lang": "rust", "repo": "ocstl/advent-of-code-2016", "path": "/src/bin/day16.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ocstl/advent-of-code-2016 path: /src/bin/day16.rs const INPUT: &str = "11110010111001001"; fn main() { // The first disk you have to fill has length 272. Using the initial state in your puzzle // input, what is the correct checksum? println!("Part 1: {}", checksum(&generate_data(INP...
code_fim
hard
{ "lang": "rust", "repo": "ocstl/advent-of-code-2016", "path": "/src/bin/day16.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn join() { let counter = AtomicUsize::new(0); scope(|scope| { let handle = scope.spawn(|| { counter.store(1, Ordering::Relaxed); }); assert!(handle.join().is_ok()); let panic_handle = scope.spawn(|| { ...
code_fim
hard
{ "lang": "rust", "repo": "oconnor663/crossbeam-utils", "path": "/src/thread.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oconnor663/crossbeam-utils path: /src/thread.rs //! Scoped thread. //! //! # Examples //! //! A basic scoped thread: //! //! ``` //! crossbeam_utils::thread::scope(|scope| { //! scope.spawn(|| { //! println!("Hello from a scoped thread!"); //! }); //! }).unwrap(); //! ``` //! //!...
code_fim
hard
{ "lang": "rust", "repo": "oconnor663/crossbeam-utils", "path": "/src/thread.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: matter-labs/eip1962 path: /src/test/g1_ops/bls12/mod.rs use crate::public_interface::constants::*; use crate::test::parsers::*; use super::*; pub(crate) fn assemble_single_curve_params(curve: JsonBls12PairingCurveParameters) -> (Vec<u8>, usize, usize) { // - Lengths of modulus (in bytes) ...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/eip1962", "path": "/src/test/g1_ops/bls12/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut calldata = calldata.clone(); calldata.extend(points_data); let result = call_g1_engine_mul(&calldata[..]); if result.is_err() { panic!("{}", result.err().unwrap()); } assert!(result.is_ok()); let ...
code_fim
hard
{ "lang": "rust", "repo": "matter-labs/eip1962", "path": "/src/test/g1_ops/bls12/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>extern "platform-intrinsic" { fn nvptx_thread_idx_x() -> i32; } fn thread_idx() -> i32 { unsafe { nvptx_thread_idx_x() } } #[lang = "copy"] trait Copy {} #[lang = "sized"] trait Sized {}<|fim_prefix|>// repo: MixmasterFresh/rust-on-gpu path: /src/test/run-make/nvptx/thread_idx.rs /...
code_fim
medium
{ "lang": "rust", "repo": "MixmasterFresh/rust-on-gpu", "path": "/src/test/run-make/nvptx/thread_idx.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MixmasterFresh/rust-on-gpu path: /src/test/run-make/nvptx/thread_idx.rs // Copyright 2016 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 <LICENSE...
code_fim
medium
{ "lang": "rust", "repo": "MixmasterFresh/rust-on-gpu", "path": "/src/test/run-make/nvptx/thread_idx.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Honey-Be/fireplace path: /fireplace_lib/src/handlers/workspaces/modes/bsp/mod.rs //! i3-like **B**inary **S**plit **P**artitioning `Mode` and corresponding //! handlers and types //! use callback::{AsWrapper, IntoCallback, Wrapper}; use handlers::geometry::{UsableScreenGeometry, UsableViewGeom...
code_fim
hard
{ "lang": "rust", "repo": "Honey-Be/fireplace", "path": "/fireplace_lib/src/handlers/workspaces/modes/bsp/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if focus { debug!(self.logger, "Focus shifts tiling root to {:?}", view); self.tiling_root = Some(view.weak_reference()); } else { self.tiling_root = None; } if let Some(child) = self.child() { child.view_focus(view, focus); ...
code_fim
hard
{ "lang": "rust", "repo": "Honey-Be/fireplace", "path": "/fireplace_lib/src/handlers/workspaces/modes/bsp/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> create_assert() .with_args(&["-vvv", "exec", "--list-commands"]) .current_dir(tmp_dir.clone()) .succeeds() .and() .stderr() .is("") .stdout() .contains( ...
code_fim
hard
{ "lang": "rust", "repo": "ethankhall/inc", "path": "/inc/tests/inc-exec.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn when_command_failes_it_will_stop() { with_test_dir(|tmp_dir| { let file_path = tmp_dir.clone().join("inc.yaml"); copy_resource("sample3.yaml", file_path); create_assert() .with_args(&["-vvv", "exec", "--list-commands"]) ...
code_fim
hard
{ "lang": "rust", "repo": "ethankhall/inc", "path": "/inc/tests/inc-exec.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ethankhall/inc path: /inc/tests/inc-exec.rs extern crate assert_cli; extern crate tempdir; mod shared; #[cfg(test)] #[cfg(unix)] mod exec_integration { use shared::utils::*; #[test] fn with_no_args() { create_assert() .with_args(&["exec"]) .fails() ...
code_fim
hard
{ "lang": "rust", "repo": "ethankhall/inc", "path": "/inc/tests/inc-exec.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pleeplop/rust-book path: /enums/src/main.rs #[derive(Debug)] enum IpAddrKind { V4(u8,u8,u8,u8), V6(String), } enum Message { Quit, Move { x: i32, y: i32}, Write(String), ChangeColor(i32,i32,i32), } impl Message { fn call(&self) { } } <|fim_suffix|> match c...
code_fim
hard
{ "lang": "rust", "repo": "pleeplop/rust-book", "path": "/enums/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let some_u8_value = 0u8; match some_u8_value { 0 => println!("zero"), 1 => println!("one"), 2 => println!("two"), _ => (), }; println!("{:?}", 1); let s3 = Some(3); if let Some(3) = s3 { println!("some 3"); } let mut count = 0; ...
code_fim
hard
{ "lang": "rust", "repo": "pleeplop/rust-book", "path": "/enums/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>i; } //check(num); num } #[cfg(test)] #[test] pub fn q5() {assert!(soln() == 232792560);}<|fim_prefix|>// repo: ElliottLester/euler path: /src/q5.rs /* fn check(input:usize) { println!("Checking {}",input); for i in 2..21 { if input % i != 0 { println!("Not by: {...
code_fim
medium
{ "lang": "rust", "repo": "ElliottLester/euler", "path": "/src/q5.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ElliottLester/euler path: /src/q5.rs /* fn check(input:usize) { println!("Checking {}",input); for i in 2..21 { if input % <|fim_suffix|>t num:usize = 1; let primes = [5,7,9,11,13,16,17,19]; for i in primes.iter() { num *= *i; } //check(num); num } #...
code_fim
medium
{ "lang": "rust", "repo": "ElliottLester/euler", "path": "/src/q5.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let fst = unsafe { util::mmap_fst(&self.input)? }; let mut q = fst.range(); if let Some(ref start) = self.start { q = q.ge(Vec::from_os_str_lossy(start)); } if let Some(ref end) = self.end { q = q.le(Vec::from_os_str_lossy(end)); } ...
code_fim
hard
{ "lang": "rust", "repo": "BurntSushi/fst", "path": "/fst-bin/src/cmd/range.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BurntSushi/fst path: /fst-bin/src/cmd/range.rs use std::ffi::OsString; use std::io; use std::path::PathBuf; use bstr::ByteVec; use crate::util; use crate::Error; pub fn run(matches: &clap::ArgMatches) -> Result<(), Error> { Args::new(matches).and_then(|args| args.run()) } <|fim_suffix|> ...
code_fim
medium
{ "lang": "rust", "repo": "BurntSushi/fst", "path": "/fst-bin/src/cmd/range.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(Args { input: m.value_of_os("input").map(PathBuf::from).unwrap(), outputs: m.is_present("outputs"), start: m.value_of_os("start").map(|v| v.to_os_string()), end: m.value_of_os("end").map(|v| v.to_os_string()), }) } fn run(&self) -...
code_fim
hard
{ "lang": "rust", "repo": "BurntSushi/fst", "path": "/fst-bin/src/cmd/range.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ThomasZumsteg/exercism-rust path: /spiral-matrix/src/lib.rs pub fn spiral_matrix(size: usize) -> Vec<Vec<usize>> { if size == 0 { return vec![] } if size == 1 { return vec![vec![1]] } <|fim_suffix|> let mut i = 0; while matrix[row as usize][col as usize] == 0 { i += 1; ...
code_fim
medium
{ "lang": "rust", "repo": "ThomasZumsteg/exercism-rust", "path": "/spiral-matrix/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut i = 0; while matrix[row as usize][col as usize] == 0 { i += 1; matrix[row as usize][col as usize] = i; if !(0 <= row + dr && row + dr < (size as i8)) || !(0 <= col + dc && col + dc < (size as i8)) || matrix[(row + dr) as usize][(col + dc) as u...
code_fim
medium
{ "lang": "rust", "repo": "ThomasZumsteg/exercism-rust", "path": "/spiral-matrix/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // key1 let privkey = generator.gen_privkey(); let pubkey = privkey.pubkey().expect("pubkey"); let pubkey_hash = if get_current_chain_id() == CHAIN_ID_BTC || get_current_chain_id() == CHAIN_ID_DOGE { let pubkey = if is_compressed() { pubkey_compressed(&p...
code_fim
hard
{ "lang": "rust", "repo": "XuJiandong/pw-lock", "path": "/src/tests/pw_anyone_can_pay_compatibility.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XuJiandong/pw-lock path: /src/tests/pw_anyone_can_pay_compatibility.rs o()) .build(), ) .output( CellOutput::new_builder() .capacity(dummy_capacity.pack()) .lock(lock_script) .build(), ) ....
code_fim
hard
{ "lang": "rust", "repo": "XuJiandong/pw-lock", "path": "/src/tests/pw_anyone_can_pay_compatibility.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: XuJiandong/pw-lock path: /src/tests/pw_anyone_can_pay_compatibility.rs uilder}, prelude::*, H256, }; use rand::{thread_rng, Rng, SeedableRng}; use sha3::{Digest, Keccak256}; const ERROR_ENCODING: i8 = -2; // const ERROR_LENGTH_NOT_ENOUGH: i8 = -3; const ERROR_PUBKEY_BLAKE160_HASH: i8 =...
code_fim
hard
{ "lang": "rust", "repo": "XuJiandong/pw-lock", "path": "/src/tests/pw_anyone_can_pay_compatibility.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yggie/mithril-examples path: /src/graphics/camera.rs extern crate mithril; use std::f64; use std::num::Float; use self::mithril::math::{ Vector, Quaternion }; pub struct Camera { position: Vector, focus_point: Vector, up: Vector, field_of_view: f64, aspect_ratio: f64, f...
code_fim
hard
{ "lang": "rust", "repo": "yggie/mithril-examples", "path": "/src/graphics/camera.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> [ x_view[0], x_view[1], x_view[2], x_trans, y_view[0], y_view[1], y_view[2], y_trans, z_view[0], z_view[1], z_view[2], z_trans, 0.0, 0.0, 0.0, 1.0, ] } pub fn projection_matrix(&self) -> [f32; 16] { let ...
code_fim
hard
{ "lang": "rust", "repo": "yggie/mithril-examples", "path": "/src/graphics/camera.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Sets a value to the cell pub fn set_cell(&self, row: Row, col: Col, value: impl ToString) { let event = TableEvent::SetCell { row, col, value: value.to_string(), }; self.tracer.send(event, None); } }<|fim_prefix|>// repo: rillrate...
code_fim
hard
{ "lang": "rust", "repo": "rillrate-fossil/rillrate", "path": "/pkg-packs/prime/src/visual/table/tracer.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rillrate-fossil/rillrate path: /pkg-packs/prime/src/visual/table/tracer.rs use super::state::*; use derive_more::{Deref, DerefMut}; use rill_derive::TracerOpts; use rill_protocol::flow::core::FlowMode; use rrpack_basis::{AutoPath, BindedTracer}; #[derive(TracerOpts, Clone, Default)] pub struct ...
code_fim
hard
{ "lang": "rust", "repo": "rillrate-fossil/rillrate", "path": "/pkg-packs/prime/src/visual/table/tracer.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: michelleN/bindle path: /src/invoice/sealed.rs /// A Marker trait that should not be exposed p<|fim_suffix|> /// which means that the trait cannot be implemented outside of this crate pub trait Sealed {}<|fim_middle|>ublicly. It is used to mark a trait as "sealed",
code_fim
easy
{ "lang": "rust", "repo": "michelleN/bindle", "path": "/src/invoice/sealed.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>mented outside of this crate pub trait Sealed {}<|fim_prefix|>// repo: michelleN/bindle path: /src/invoice/sealed.rs /// A Marker trait that should not be exposed p<|fim_middle|>ublicly. It is used to mark a trait as "sealed", /// which means that the trait cannot be imple
code_fim
medium
{ "lang": "rust", "repo": "michelleN/bindle", "path": "/src/invoice/sealed.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TianTianForever/Rust-Tutorial path: /twenty-three_days_of_rust/errors.rs #![crate_type="lib"] #![crate_name="errors"] use std::result; use std::num::ParseIntError; #[derive(Debug)] pub enum Point { X, Y, Z } #[derive(Debug)] pub enum Number { One, Two, Empty } pub fn have_x_and_y(point: Point)...
code_fim
hard
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/twenty-three_days_of_rust/errors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn print_x_and_y(point: Point, number: Number) { match have_x_and_y(point) { None => println!("Z : {:?}", number), Some(point) => println!("{:?} : {:?}", point, number), } } // A generic alias for any 'Result' with this specific 'Err' type. // type Result<T> = result::Result<T,...
code_fim
medium
{ "lang": "rust", "repo": "TianTianForever/Rust-Tutorial", "path": "/twenty-three_days_of_rust/errors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emirayka/nia_server path: /src/server/mod.rs use std::convert::TryFrom; use std::sync::Mutex; use std::sync::{mpsc, Arc}; use std::thread; use protobuf::Message; use ws::listen; use nia_interpreter_core::EventLoop; use nia_interpreter_core::Interpreter; use nia_interpreter_core::NiaInterprete...
code_fim
hard
{ "lang": "rust", "repo": "emirayka/nia_server", "path": "/src/server/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> move |msg| { match msg { ws::Message::Binary(bytes) => { let mut request = nia_protocol_rust::Request::new(); request.merge_from_bytes(&bytes); println!("Got request: {:?}", request); ...
code_fim
hard
{ "lang": "rust", "repo": "emirayka/nia_server", "path": "/src/server/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self { timestamp, sample_number, ads_status, ads_gpio, loff_statn, loff_statp, extra, channels, } } } impl From<&[u8]> for Sample { fn from(data: &[u8]) -> Self { Self::from_byt...
code_fim
hard
{ "lang": "rust", "repo": "starcat-io/hackeeg-client-rust", "path": "/src/client/sample.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn from_bytes(data: &[u8]) -> Self { let timestamp = u32::from_le_bytes(data[0..4].try_into().unwrap()); let sample_number = u32::from_le_bytes(data[4..8].try_into().unwrap()); // we shift by 1 because ads_status is technically 3 big endian bytes, but from_be_bytes ...
code_fim
hard
{ "lang": "rust", "repo": "starcat-io/hackeeg-client-rust", "path": "/src/client/sample.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: starcat-io/hackeeg-client-rust path: /src/client/sample.rs // Copyright © 2020 Starcat LLC // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.a...
code_fim
hard
{ "lang": "rust", "repo": "starcat-io/hackeeg-client-rust", "path": "/src/client/sample.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaychaks/lorri path: /tests/direnv/mod.rs extern crate lorri; extern crate tempfile<|fim_suffix|>case; use direnvtestcase::DirenvTestCase;<|fim_middle|>; extern crate serde_json; #[macro_use] extern crate serde_derive; mod direnvtest
code_fim
medium
{ "lang": "rust", "repo": "kaychaks/lorri", "path": "/tests/direnv/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>case; use direnvtestcase::DirenvTestCase;<|fim_prefix|>// repo: kaychaks/lorri path: /tests/direnv/mod.rs extern crate lorri; extern crate tempfile<|fim_middle|>; extern crate serde_json; #[macro_use] extern crate serde_derive; mod direnvtest
code_fim
medium
{ "lang": "rust", "repo": "kaychaks/lorri", "path": "/tests/direnv/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>xtern crate serde_derive; mod direnvtestcase; use direnvtestcase::DirenvTestCase;<|fim_prefix|>// repo: kaychaks/lorri path: /tests/direnv/mod.rs extern crate lorri; extern crate tempfile<|fim_middle|>; extern crate serde_json; #[macro_use] e
code_fim
easy
{ "lang": "rust", "repo": "kaychaks/lorri", "path": "/tests/direnv/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let property_value_json = json!(initial_property_value); let property = NamedProperty { name: ConstValueProperties::VALUE.to_string(), value: property_value_json }; let properties = vec![ property ]; let vertex_properties = VertexProperties { vert...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/tests/reactive/const_value_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aschaeffer/rust-ecs-poc path: /src/tests/reactive/const_value_test.rs use crate::api::{PropertyInstanceGetter, PropertyInstanceSetter}; use crate::reactive::{ConstValue, ConstValueProperties}; use crate::model::ReactiveEntityInstance; use crate::tests::utils::r_string; use indradb::{VertexProper...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/tests/reactive/const_value_test.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn tmp(i: u64, size: WidthSpec) -> MVal { MVal::new(format!("tmp_{:x}", i), size, MValType::Temporary, 0, None) } pub fn esilcur() -> MVal { MVal::new("".to_string(), 64, MValType::EsilCur, 0, None) } pub fn esilold() -> MVal { MVal::new("".to_string(), 64...
code_fim
hard
{ "lang": "rust", "repo": "nxnfufunezn/radeco-lib", "path": "/src/middle/ir.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nxnfufunezn/radeco-lib path: /src/middle/ir.rs // Copyright (c) 2015, The Radare Project. All rights reserved. // See the COPYING file at the top-level directory of this distribution. // Licensed under the BSD 3-Clause License: // <http://opensource.org/licenses/BSD-3-Clause> // This file may no...
code_fim
hard
{ "lang": "rust", "repo": "nxnfufunezn/radeco-lib", "path": "/src/middle/ir.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>impl<T: Clone> Fill<T> for () { #[inline(always)] fn fill(_: T) -> Self {} }<|fim_prefix|>// repo: colin-daniels/typing path: /src/paren/ops/fill.rs use crate::paren::Paren; pub trait Fill<T: Clone>: Paren { fn fill(init: T) -> Self; <|fim_middle|>} impl<T: Clone, B> Fill<T> for (T, B) wher...
code_fim
medium
{ "lang": "rust", "repo": "colin-daniels/typing", "path": "/src/paren/ops/fill.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (init.clone(), <B as Fill<_>>::fill(init)) } } impl<T: Clone> Fill<T> for () { #[inline(always)] fn fill(_: T) -> Self {} }<|fim_prefix|>// repo: colin-daniels/typing path: /src/paren/ops/fill.rs use crate::paren::Paren; pub trait Fill<T: Clone>: Paren { fn fill(init: T) -> Self...
code_fim
medium
{ "lang": "rust", "repo": "colin-daniels/typing", "path": "/src/paren/ops/fill.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: colin-daniels/typing path: /src/paren/ops/fill.rs use crate::paren::Paren; pub trait Fill<T: Clone>: Paren { fn fill(init: T) -> Self; <|fim_suffix|>impl<T: Clone> Fill<T> for () { #[inline(always)] fn fill(_: T) -> Self {} }<|fim_middle|>} impl<T: Clone, B> Fill<T> for (T, B) wher...
code_fim
medium
{ "lang": "rust", "repo": "colin-daniels/typing", "path": "/src/paren/ops/fill.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test() { // Input: 1->2->4, 1->3->4 // Output: 1->1->2->3->4->4 let l1 = Some(Box::new(ListNode { val: 1, next: Some(Box::new(ListNode { val: 2, next: Some(Box::new(ListNode { val: 4, next: None })), ...
code_fim
hard
{ "lang": "rust", "repo": "hhwyt/leetcode-rs", "path": "/00021.MergeTwoSortedLists-Recursive.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hhwyt/leetcode-rs path: /00021.MergeTwoSortedLists-Recursive.rs #![allow(dead_code)] #[derive(PartialEq, Eq, Clone, Debug)] pub struct ListNode { pub val: i32, pub next: Option<Box<ListNode>>, } impl ListNode { #[inline] fn new(val: i32) -> Self { ListNode { next: None, ...
code_fim
hard
{ "lang": "rust", "repo": "hhwyt/leetcode-rs", "path": "/00021.MergeTwoSortedLists-Recursive.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Input: 1->2->4, 1->3->4 // Output: 1->1->2->3->4->4 let l1 = Some(Box::new(ListNode { val: 1, next: Some(Box::new(ListNode { val: 2, next: Some(Box::new(ListNode { val: 4, next: None })), })), })); ...
code_fim
hard
{ "lang": "rust", "repo": "hhwyt/leetcode-rs", "path": "/00021.MergeTwoSortedLists-Recursive.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> filename: &str, quadgrams: &HashMap<u32, f64>, frequency_table: &[(u8, u32)], ) -> Option<()> { let (original, filtered) = prepare_file(filename)?; let mut frequencies: [(u32, usize); 26] = [(0, 0); 26]; for (i, v) in frequencies.iter_mut().enumerate() { v.1 = i; } ...
code_fim
hard
{ "lang": "rust", "repo": "rogday/ysda_algorithms", "path": "/decoder/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rogday/ysda_algorithms path: /decoder/src/main.rs use std::fs::File; use std::io::BufRead; use std::io::BufReader; use std::io::Read; use std::convert::TryInto; use rand::{rngs::SmallRng, Rng, SeedableRng}; use std::collections::HashMap; fn get_table(filename: &str) -> Option<HashMap<u32, f64...
code_fim
hard
{ "lang": "rust", "repo": "rogday/ysda_algorithms", "path": "/decoder/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> { &self.data } } impl<S: SystemManager> DerefMut for World<S> { fn deref_mut(&mut self) -> &mut DataHelper<S::Components, S::Services> { &mut self.data } } impl<C: ComponentManager, M: ServiceManager> Deref for DataHelper<C, M> { type Target = C; fn deref(&sel...
code_fim
hard
{ "lang": "rust", "repo": "HeroesGrave/ecs-rs", "path": "/src/world.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>} impl<S: SystemManager> Deref for World<S> { type Target = DataHelper<S::Components, S::Services>; fn deref(&self) -> &DataHelper<S::Components, S::Services> { &self.data } } impl<S: SystemManager> DerefMut for World<S> { fn deref_mut(&mut self) -> &mut DataHelper<S::Compone...
code_fim
hard
{ "lang": "rust", "repo": "HeroesGrave/ecs-rs", "path": "/src/world.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HeroesGrave/ecs-rs path: /src/world.rs #[cfg(feature="serialisation")] use cereal::{CerealData, CerealResult}; #[cfg(feature="serialisation")] use std::io::{Read, Write}; use std::ops::{Deref, DerefMut}; use {EntityData, ModifyData}; use {Entity, IndexedEntity, EntityIter}; use {EntityBuilder...
code_fim
hard
{ "lang": "rust", "repo": "HeroesGrave/ecs-rs", "path": "/src/world.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: honyacho/atcoder_excercise path: /abc166/b.rs use std::io; use std::str::FromStr; use std::iter::Map; use std::str::SplitWhitespace; fn split_to_i64<'r>(buf: &'r String) -> Map<SplitWhitespace, impl FnMut(&'r str) -> i64> { <|fim_suffix|> let stdin = io::stdin(); stdin.read_line(buf); ...
code_fim
hard
{ "lang": "rust", "repo": "honyacho/atcoder_excercise", "path": "/abc166/b.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let stdin = io::stdin(); let mut buf = String::new(); stdin.read_line(&mut buf); buf.pop(); let mut it = split_to_i64(&buf); let N = it.next().unwrap(); let K = it.next().unwrap(); let mut friends: Vec<i32> = Vec::with_capacity(101); for i in 0..101 { friends.pu...
code_fim
medium
{ "lang": "rust", "repo": "honyacho/atcoder_excercise", "path": "/abc166/b.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oblique/memsec path: /build.rs use std::env; fn main() { match env::var("CARGO_CFG_TARGET_OS").as_ref().map(String::as_str) { Ok("macos") | Ok("ios") => println!("cargo:rustc-cfg=apple"), Ok("fre<|fim_suffix|>Ok("netbsd") | Ok("bitrig") => println!("cargo:rust-cfg=netbsdlike...
code_fim
medium
{ "lang": "rust", "repo": "oblique/memsec", "path": "/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ebsd") | Ok("dragonfly") => println!("cargo:rustc-cfg=freebsdlike"), Ok("openbsd") | Ok("netbsd") | Ok("bitrig") => println!("cargo:rust-cfg=netbsdlike"), _ => () } }<|fim_prefix|>// repo: oblique/memsec path: /build.rs use std::env; fn main() { match env::var("CARGO_CFG_TARGET_O...
code_fim
medium
{ "lang": "rust", "repo": "oblique/memsec", "path": "/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emergent/ProjectEuler path: /Rust/src/bin/008.rs /// Problem 8 - Project Euler /// http://projecteuler.net/index.php?section=problems&id=8 fn main() { let digits = " 73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 858615607891129494954595...
code_fim
hard
{ "lang": "rust", "repo": "emergent/ProjectEuler", "path": "/Rust/src/bin/008.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>670428252483600823257530420752963450" .trim_start() .replace('\n', ""); let mut prodmax = 0; for i in 0..(digits.len() - 13 + 1) { let product = digits[i..(i + 13)] .chars() .map(|c| (c as i64) - 48) .product(); prodmax = std::cm...
code_fim
hard
{ "lang": "rust", "repo": "emergent/ProjectEuler", "path": "/Rust/src/bin/008.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] pub struct UdpConnectionInfo { pub multicast_addr: Vec<MulticastInfo>, } /// network socket config /// if udp packets are sent via multicast, then the `multicast_addr` has to /// be specified #[derive(Serialize, Deserialize, Debug)] pub struct SocketConfig { ...
code_fim
hard
{ "lang": "rust", "repo": "DmitryAstafyev/logviewer", "path": "/application/apps/indexer/indexer_base/src/config.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DmitryAstafyev/logviewer path: /application/apps/indexer/indexer_base/src/config.rs // Copyright (c) 2020 E.S.R.Labs. All rights reserved. // // NOTICE: All information contained herein is, and remains // the property of E.S.R.Labs and its suppliers, if any. // The intellectual and technical co...
code_fim
hard
{ "lang": "rust", "repo": "DmitryAstafyev/logviewer", "path": "/application/apps/indexer/indexer_base/src/config.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug)] pub struct SectionConfig { pub sections: Vec<IndexSection>, } impl IndexSection { pub fn len(&self) -> usize { self.last_line - self.first_line + 1 } pub fn is_empty(&self) -> bool { (self.len() == 0) || ((self.last_line + self.fir...
code_fim
hard
{ "lang": "rust", "repo": "DmitryAstafyev/logviewer", "path": "/application/apps/indexer/indexer_base/src/config.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: avaidyam/rusty-xinu path: /libxinu/main.rs #![no_main] extern { fn recvclr(); fn kprintf(fmt : *mut u8, ...) -> i32; <|fim_suffix|>#[no_mangle] pub extern fn main() -> i32 { unsafe { recvclr(); loop { kprintf("main(), hello\n\0".as_ptr() as (*mut u8)); ...
code_fim
easy
{ "lang": "rust", "repo": "avaidyam/rusty-xinu", "path": "/libxinu/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} #[no_mangle] pub extern fn main() -> i32 { unsafe { recvclr(); loop { kprintf("main(), hello\n\0".as_ptr() as (*mut u8)); kprintf("getpid: %d\n\0".as_ptr() as (*mut u8), getpid()); } } }<|fim_prefix|>// repo: avaidyam/rusty-xinu path: /libxinu/ma...
code_fim
easy
{ "lang": "rust", "repo": "avaidyam/rusty-xinu", "path": "/libxinu/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match x { _ if x < &2 => false, _ => { let mut i = 2; while &(i * i) <= x { if x % i == 0 { return false; } i += 1; } true } } } #[cfg(test)] mod tests { ...
code_fim
medium
{ "lang": "rust", "repo": "sjinno/exercism", "path": "/nth-prime/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sjinno/exercism path: /nth-prime/src/lib.rs pub fn nth(n: usize) -> Option<usize> { match n { 0 => None, 1 => Some(2), _ => (3..).step_by(2).filter(is_prime).nth(n - 2), } } fn is_prime(x: &usize) -> bool { <|fim_suffix|> assert_eq!(nth(10001), Some(104743...
code_fim
hard
{ "lang": "rust", "repo": "sjinno/exercism", "path": "/nth-prime/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: elliottslaughter/rust-pandoc-types path: /src/definition/extra.rs //! Additional types that aren't present in the Haskell package but are useful. use super::{Block, Inline}; /// A utility type to provide better error messages when /// an array of blocks doesn't match an expected pattern. /// //...
code_fim
hard
{ "lang": "rust", "repo": "elliottslaughter/rust-pandoc-types", "path": "/src/definition/extra.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>impl From<&Inline> for InlineType { fn from(inline: &Inline) -> Self { match inline { Inline::Str(_) => Self::Str, Inline::Emph(_) => Self::Emph, Inline::Underline(_) => Self::Underline, Inline::Strong(_) => Self::Strong, Inline::Stri...
code_fim
hard
{ "lang": "rust", "repo": "elliottslaughter/rust-pandoc-types", "path": "/src/definition/extra.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ldm0/ffgen path: /src/options.rs ers"), option_def!("protocols", OPT_EXIT, func_arg => show_protocols, "show available protocols"), option_def!("filters", OPT_EXIT, func_arg => show_filters, "show available filters"), option_def!(...
code_fim
hard
{ "lang": "rust", "repo": "ldm0/ffgen", "path": "/src/options.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// The options list is in ffmpeg_opt.c originally, but we move it here for cleanness. /// /// Steps to create the list from ffmpeg's code: /// 1. remove all other codes except the `options` /// 2. remove unnecessary lines like comments and empty line and `#ifdef #ifndef #endif` things /// 3. `\option_def...
code_fim
hard
{ "lang": "rust", "repo": "ldm0/ffgen", "path": "/src/options.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ldm0/ffgen path: /src/options.rs en dumping packets, also dump the payload"), option_def!("re", OPT_BOOL | OPT_EXPERT | OPT_OFFSET | OPT_INPUT, off => rate_emu, "read input at native frame rate", ""), option_def!("target", HAS_ARG | OPT_PERFILE | OPT_OUTPUT, func_arg => opt_targe...
code_fim
hard
{ "lang": "rust", "repo": "ldm0/ffgen", "path": "/src/options.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> BasicMethod::Unknown } } impl From<u16> for BasicMethod { fn from(method_id: u16) -> Self { match method_id { 10 => BasicMethod::Qos, 11 => BasicMethod::QosOk, 20 => BasicMethod::Consume, 21 => BasicMethod::ConsumeOk, 30 ...
code_fim
hard
{ "lang": "rust", "repo": "hml1006/amqp-proto", "path": "/src/method/basic.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> match method_id { 10 => BasicMethod::Qos, 11 => BasicMethod::QosOk, 20 => BasicMethod::Consume, 21 => BasicMethod::ConsumeOk, 30 => BasicMethod::Cancel, 31 => BasicMethod::CancelOk, 40 => BasicMethod::Publish, ...
code_fim
hard
{ "lang": "rust", "repo": "hml1006/amqp-proto", "path": "/src/method/basic.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hml1006/amqp-proto path: /src/method/basic.rs use crate::method::base::MethodId; #[derive(Clone, Copy)] pub enum BasicMethod { Qos, QosOk, Consume, ConsumeOk, Cancel, CancelOk, Publish, Return, Deliver, Get, GetOk, GetEmpty, Ack, Reject, ...
code_fim
hard
{ "lang": "rust", "repo": "hml1006/amqp-proto", "path": "/src/method/basic.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> /// /// Returns the squared length of the specified edge /// pub fn edge_sqr_length(&self, halfedge_id: HalfEdgeID) -> f64 { let (p0, p1) = self.edge_positions(halfedge_id); (p0 - p1).magnitude2() } }<|fim_prefix|>// repo: asny/tri-mesh path: /src/operations/edge_measu...
code_fim
hard
{ "lang": "rust", "repo": "asny/tri-mesh", "path": "/src/operations/edge_measures.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: asny/tri-mesh path: /src/operations/edge_measures.rs //! See [Mesh](crate::mesh::Mesh). use crate::mesh::*; /// # Edge measures impl Mesh { /// /// Returns the two positions of the vertices of either end of the given halfedge. /// pub fn edge_positions(&self, halfedge_id: HalfE...
code_fim
hard
{ "lang": "rust", "repo": "asny/tri-mesh", "path": "/src/operations/edge_measures.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[no_mangle] pub extern "C" fn __rbt_backtrace_pcinfo( _state: *mut backtrace_state, _addr: uintptr_t, _cb: backtrace_full_callback, _error: backtrace_error_callback, _data: *mut c_void, ) -> c_int { 0 } }<|fim_prefix|>// repo: Alsan/WeDPR-La...
code_fim
hard
{ "lang": "rust", "repo": "Alsan/WeDPR-Lab-Crypto", "path": "/ffi/ffi_c/ffi_c_common/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub enum backtrace_state {} #[no_mangle] pub extern "C" fn __rbt_backtrace_create_state( _filename: *const c_char, _threaded: c_int, _error: backtrace_error_callback, _data: *mut c_void, ) -> *mut backtrace_state { 0 as *mut _ } #[no_mangle...
code_fim
hard
{ "lang": "rust", "repo": "Alsan/WeDPR-Lab-Crypto", "path": "/ffi/ffi_c/ffi_c_common/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Alsan/WeDPR-Lab-Crypto path: /ffi/ffi_c/ffi_c_common/src/lib.rs // Copyright 2020 WeDPR Lab Project Authors. Licensed under Apache-2.0. //! Library of shared utilities for FFI targeting C/C++ //! compatible architectures (including iOS). /// Patch code to fix the missing 'backtrace_*' related ...
code_fim
hard
{ "lang": "rust", "repo": "Alsan/WeDPR-Lab-Crypto", "path": "/ffi/ffi_c/ffi_c_common/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RoryABrittain/Advent-of-code-2020 path: /src/eleven.rs use std::fs; #[derive(Debug)] #[derive(Clone)] #[derive(PartialEq)] enum Space { Empty, Occupied, Floor, } pub fn run() { let raw_data = fs::read_to_string("eleven_data.txt") .expect("Can't find f...
code_fim
hard
{ "lang": "rust", "repo": "RoryABrittain/Advent-of-code-2020", "path": "/src/eleven.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut output = Vec::new(); let width = initial[0].len(); let height = initial.len(); for y in 0..height { let mut row = Vec::new(); for x in 0..width { match initial[y][x] { Space::Empty => { let mut ...
code_fim
hard
{ "lang": "rust", "repo": "RoryABrittain/Advent-of-code-2020", "path": "/src/eleven.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/aws-endpoint/src/lib.rs /* * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. * SPDX-License-Identifier: Apache-2.0. */ #[doc(hidden)] pub mod partition; #[doc(hidden)] pub use partition::Partition; #[doc(hidden)] pub use partition::Partition...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/aws-endpoint/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> use crate::partition::endpoint::{Metadata, Protocol, SignatureVersion}; use crate::{set_endpoint_resolver, AwsEndpointStage, CredentialScope}; #[test] fn default_endpoint_updates_request() { let provider = Arc::new(Metadata { uri_template: "kinesis.{region}.amazonaws.c...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/aws-endpoint/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn modify_node<TF>(&self, node: &Hash, target: (&[String], &Hash), modify_node_f: TF) -> Option<Hash> where TF : FnOnce(FileSystemDir) -> FileSystemDir { let (target_path, target_node) = target; if let Some((target_path_head, target_path_rest)) = target_path.split_first() { ...
code_fim
hard
{ "lang": "rust", "repo": "szagi3891/online_disk", "path": "/src_api/src/filesystem/data/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }