text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> pub fn new(path: Path) -> PathWrapper { PathWrapper { value: path } } } // Important bit of PathSrc here is the ability to "show" the path this is // hugely useful for tests and to display errors, etc.. impl Show for PathWrapper { fn fmt(&self, f: &mut Formatter) -> Result<(), FormatError> { ...
code_fim
hard
{ "lang": "rust", "repo": "KevinGrandon/overlord", "path": "/src/overlord/util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut val = 0; unsafe { match $f32(&mut val) { // retry at least once 0 => match $f32(&mut val) { 0 => Err($e(())), _ => Ok(val), ...
code_fim
hard
{ "lang": "rust", "repo": "nvzqz/chance-rs", "path": "/src/arch/x86.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nvzqz/chance-rs path: /src/arch/x86.rs //! x86 family specific functionality. //! //! This module contains two random number generators: `rdrand` and `rdsweed`. //! The differences are outlined //! [here](https://software.intel.com/en-us/blogs/2012/11/17/the-difference-between-rdrand-and-rdseed)...
code_fim
hard
{ "lang": "rust", "repo": "nvzqz/chance-rs", "path": "/src/arch/x86.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn poll_next(self: Pin<&mut Self>, ctx: &mut Context) -> Poll<Option<Self::Item>> { let this = self.project(); match futures_util::ready!(this.0.stream.poll_next_unpin(ctx)) { Some(item) => { let meta = LogMeta::from(&item); let res = (this.0...
code_fim
hard
{ "lang": "rust", "repo": "bonedaddy/ethers-rs", "path": "/ethers-contract/src/stream.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn poll_next(self: Pin<&mut Self>, ctx: &mut Context) -> Poll<Option<Self::Item>> { let mut this = self.project(); match futures_util::ready!(this.stream.poll_next_unpin(ctx)) { Some(item) => Poll::Ready(Some((this.parse)(item))), None => Poll::Pending, ...
code_fim
hard
{ "lang": "rust", "repo": "bonedaddy/ethers-rs", "path": "/ethers-contract/src/stream.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bonedaddy/ethers-rs path: /ethers-contract/src/stream.rs use crate::LogMeta; use ethers_core::types::{Log, U256}; use futures_util::stream::{Stream, StreamExt}; use pin_project::pin_project; use std::pin::Pin; use std::task::{Context, Poll}; type MapEvent<'a, R, E> = Box<dyn Fn(Log) -> Result<R...
code_fim
hard
{ "lang": "rust", "repo": "bonedaddy/ethers-rs", "path": "/ethers-contract/src/stream.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let lat: f64 = -23.0095839; let lon: f64 = -43.4361816; let coord = coord::Coord::new(lat, lon); let utm: Utm = coord.clone().into(); let coord2: Coord = utm.clone().into(); println!("coord: {}, utm: {}, coord2: {}", coord, utm, coord2); } }<|fim_prefix...
code_fim
hard
{ "lang": "rust", "repo": "Smart-Ag/geomorph", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Smart-Ag/geomorph path: /src/lib.rs //! //! Simple conversion between different coordinate systems //! without external wrappers injection //! //! # Code Example //! ``` //! use geomorph::*; //! //! fn main() { //! let lat: f64 = -23.0095839; //! let lon: f64 = -43.4361816; //! //! ...
code_fim
hard
{ "lang": "rust", "repo": "Smart-Ag/geomorph", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn full_test() { let lat: f64 = -23.0095839; let lon: f64 = -43.4361816; let coord = coord::Coord::new(lat, lon); let utm: Utm = coord.clone().into(); let coord2: Coord = utm.clone().into(); println!("coord: {}, utm: {}, coord2: {}", coord, ...
code_fim
hard
{ "lang": "rust", "repo": "Smart-Ag/geomorph", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let data = read_test_data("benches/data/sorting_sorted_10K.in").unwrap(); c.bench_function("Quicksort - Big Input 10K Sorted", |b| { b.iter_batched_ref( || data.clone(), |mut data| quick_sort(&mut data), BatchSize::SmallInput, ) }); } criter...
code_fim
hard
{ "lang": "rust", "repo": "gustavgransbo/algorithms", "path": "/benches/quick_sort.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gustavgransbo/algorithms path: /benches/quick_sort.rs use algorithms::quick_sort::quick_sort; use criterion::{criterion_group, criterion_main, BatchSize, Criterion}; use std::fs::File; use std::io::{BufRead, BufReader, Error, ErrorKind}; <|fim_suffix|> let data = read_test_data("benches/dat...
code_fim
hard
{ "lang": "rust", "repo": "gustavgransbo/algorithms", "path": "/benches/quick_sort.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn big_input_ten_thousand(c: &mut Criterion) { let data = read_test_data("benches/data/sorting_10K.in").unwrap(); c.bench_function("Quicksort - Big Input 10K", |b| { b.iter_batched_ref( || data.clone(), |mut data| quick_sort(&mut data), BatchSize::SmallI...
code_fim
hard
{ "lang": "rust", "repo": "gustavgransbo/algorithms", "path": "/benches/quick_sort.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[no_mangle] unsafe extern "C" fn player_count() -> u32 { *get_static!(PLAYER_NUM) as u32 } #[no_mangle] unsafe extern "C" fn player_me() -> u32 { *get_static!(ME) as u32 }<|fim_prefix|>// repo: Mythridor/yare-rust path: /src/headless/player.rs use crate::{ get_static, yare_impl::{ME, PLA...
code_fim
medium
{ "lang": "rust", "repo": "Mythridor/yare-rust", "path": "/src/headless/player.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mythridor/yare-rust path: /src/headless/player.rs use crate::{ get_static, yare_impl::{ME, PLAYER_NUM}, }; <|fim_suffix|>#[no_mangle] unsafe extern "C" fn player_count() -> u32 { *get_static!(PLAYER_NUM) as u32 } #[no_mangle] unsafe extern "C" fn player_me() -> u32 { *get_static...
code_fim
medium
{ "lang": "rust", "repo": "Mythridor/yare-rust", "path": "/src/headless/player.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "SHULKER_CACHE_DIR", default = "cache")] pub cache_dir: String, }<|fim_prefix|>// repo: DAYELA/Shulker path: /shulker-operator/src/config.rs use envconfig::Envconfig; /// Configuration extracted from the /// en<|fim_middle|>vironment. #[derive(Envconfig, Clone)] pub struct Config { /// Director...
code_fim
medium
{ "lang": "rust", "repo": "DAYELA/Shulker", "path": "/shulker-operator/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ectory to use as resource storage /// root. #[envconfig(from = "SHULKER_CACHE_DIR", default = "cache")] pub cache_dir: String, }<|fim_prefix|>// repo: DAYELA/Shulker path: /shulker-operator/src/config.rs use envconfig::Envconfig; /// Configuration extracted from the /// en<|fim_middle|>viron...
code_fim
medium
{ "lang": "rust", "repo": "DAYELA/Shulker", "path": "/shulker-operator/src/config.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DAYELA/Shulker path: /shulker-operator/src/config.rs use envconfig::Envconfig; /// Configuration extracted from the /// en<|fim_suffix|>ectory to use as resource storage /// root. #[envconfig(from = "SHULKER_CACHE_DIR", default = "cache")] pub cache_dir: String, }<|fim_middle|>viron...
code_fim
medium
{ "lang": "rust", "repo": "DAYELA/Shulker", "path": "/shulker-operator/src/config.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use self::key::*; pub use self::private::*; pub use self::signed::*;<|fim_prefix|>// repo: richerarc/saphir-cookie path: /src/secure/mod.rs extern crate base64; extern crate ring; <|fim_middle|>#[macro_use] mod macros; mod key; mod private; mod signed;
code_fim
medium
{ "lang": "rust", "repo": "richerarc/saphir-cookie", "path": "/src/secure/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: richerarc/saphir-cookie path: /src/secure/mod.rs extern crate base64; extern crate ring; <|fim_suffix|>pub use self::key::*; pub use self::private::*; pub use self::signed::*;<|fim_middle|>#[macro_use] mod macros; mod key; mod private; mod signed;
code_fim
medium
{ "lang": "rust", "repo": "richerarc/saphir-cookie", "path": "/src/secure/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HTheolin/pasc path: /Project/Software/src/pulsemeter.rs use crate::time; pub struct Pulse { pub pulse: f32, // Current pulse, beats per minute. pub counts: u8, pub samples: [u16; 800], // Buffer: last few ADC values. 400 / 32 Hz = 12.5 s. frequency: time::Hertz, // Hz. Sampl...
code_fim
hard
{ "lang": "rust", "repo": "HTheolin/pasc", "path": "/Project/Software/src/pulsemeter.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut is_high: bool = false; if ((self.samples[0] - self.min) as f32) / d >= hi { is_high = true; } for s in self.samples.iter() { let r_s = ((*s - self.min) as f32) / d; // HYSTERESIS is_high = match is_high ...
code_fim
hard
{ "lang": "rust", "repo": "HTheolin/pasc", "path": "/Project/Software/src/pulsemeter.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mystor/dist-xprs-example path: /bt/nsIWebProgress.rs // // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIWebProgress.idl // {static D: &'static [Interface] = &[ Interface { name: "nsIWebProgress", base: Some("nsISupports"), methods:...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/bt/nsIWebProgress.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /* readonly attribute unsigned long loadType; */ Method { name: "get_loadType", abi: "C", params: &[Param { name: "aLoadType", ty: "*mut libc::uint32_t" }], ret: "nsresul...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/bt/nsIWebProgress.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: starcoinorg/starcoin path: /rpc/server/src/module/node_manager_rpc.rs // Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::module::map_err; use futures::future::TryFutureExt; use futures::FutureExt; use starcoin_crypto::HashValue; use starcoin_node_a...
code_fim
hard
{ "lang": "rust", "repo": "starcoinorg/starcoin", "path": "/rpc/server/src/module/node_manager_rpc.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn shutdown_system(&self) -> FutureResult<()> { let service = self.service.clone(); let fut = async move { service.shutdown_system().await?; Ok(()) } .map_err(map_err); Box::pin(fut.boxed()) } fn reset_to_block(&self, block_hash:...
code_fim
hard
{ "lang": "rust", "repo": "starcoinorg/starcoin", "path": "/rpc/server/src/module/node_manager_rpc.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let service = self.service.clone(); let fut = async move { service.reset_node(block_hash).await?; Ok(()) } .map_err(map_err); Box::pin(fut.boxed()) } fn re_execute_block(&self, block_hash: HashValue) -> FutureResult<()> { let...
code_fim
hard
{ "lang": "rust", "repo": "starcoinorg/starcoin", "path": "/rpc/server/src/module/node_manager_rpc.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>l<'a> PR_DEFAULT_W<'a> { #[doc = r"Writes raw bits to the field"] #[inline(always)] pub unsafe fn bits(self, value: u8) -> &'a mut W { self.w.bits = (self.w.bits & !(0x0f << 4)) | (((value as u32) & 0x0f) << 4); self.w } } impl R { #[doc = "Bits 0:3 - Support of Window ...
code_fim
hard
{ "lang": "rust", "repo": "oxidecomputer/stm32-rs-nightlies", "path": "/stm32g0/src/stm32g081/iwdg/hwcfgr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oxidecomputer/stm32-rs-nightlies path: /stm32g0/src/stm32g081/iwdg/hwcfgr.rs #[doc = "Reader of register HWCFGR"] pub type R = crate::R<u32, super::HWCFGR>; #[doc = "Writer for register HWCFGR"] pub type W = crate::W<u32, super::HWCFGR>; #[doc = "Register HWCFGR `reset()`'s with value 0x71"] imp...
code_fim
hard
{ "lang": "rust", "repo": "oxidecomputer/stm32-rs-nightlies", "path": "/stm32g0/src/stm32g081/iwdg/hwcfgr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jiyilanzhou/chw path: /bifrost_note/src/17_YouTube_benchmark.rs /* 0. Concept a. Weight is a representation of block execution time 10^12 Weight = 1 Second 即 1000 Weight = 1 nanosecond b. 可以使用一些额外的零即使用 Weight 0 类似于亚纳秒级测量 输入内容以便为它们多加 1000 这就是为什么只有 10 ~ 12 点而非 10 ~ 9 的原因 ...
code_fim
hard
{ "lang": "rust", "repo": "jiyilanzhou/chw", "path": "/bifrost_note/src/17_YouTube_benchmark.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> benchmark_for_func { ... }:func(param) // 当 func 与 benchmark_for_func 同名时 func 可用" _ "替代 verify{ ... } c. 只有在 ..runtime/Cargo.toml 内加载" pallet_xxx/runtime-benchmarks "才会加载 相应模块 6. benchmark 基准测试与 WeightInfo 编写 ...
code_fim
hard
{ "lang": "rust", "repo": "jiyilanzhou/chw", "path": "/bifrost_note/src/17_YouTube_benchmark.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(ct) = curr_task { ct.tid } else { console_println!("current task not set"); usize::MAX } } fn task_wrapper(task_fn: fn()) { task_fn(); reset_curr_task(); suspend(); // completed task execution should never be resumed console_println!("error: completed task resumed"); loop ...
code_fim
hard
{ "lang": "rust", "repo": "cheezzar10/uos", "path": "/sys/task.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cheezzar10/uos path: /sys/task.rs use core::mem; use core::ptr; use core::usize; use crate::lock; use crate::vec; #[link(name = "uos")] extern { fn get_sp() -> *const u32; fn get_eflags() -> u32; fn get_cs() -> u32; fn syscall(); } const TASK_STACK_SIZE: usize = 0x1000; const STACK_PTR...
code_fim
hard
{ "lang": "rust", "repo": "cheezzar10/uos", "path": "/sys/task.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.waker.wake(); } } pub fn make_redis_pubsub_stream(mut pubsub: RedisPubSub) -> impl Stream<Item = redis::Msg> { let (mut sender, receiver) = mpsc::channel(1); let waker = Arc::new(AtomicWaker::new()); let w = waker.clone(); let stream_fut = async move { let mut st...
code_fim
hard
{ "lang": "rust", "repo": "pbzweihander/warp-redis-sse-example", "path": "/src/redis.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn make_redis_pubsub_stream(mut pubsub: RedisPubSub) -> impl Stream<Item = redis::Msg> { let (mut sender, receiver) = mpsc::channel(1); let waker = Arc::new(AtomicWaker::new()); let w = waker.clone(); let stream_fut = async move { let mut stream = pubsub.on_message(); ...
code_fim
hard
{ "lang": "rust", "repo": "pbzweihander/warp-redis-sse-example", "path": "/src/redis.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pbzweihander/warp-redis-sse-example path: /src/redis.rs use { crate::config::RedisConfig, anyhow::Result, bb8::{Pool, PooledConnection}, bb8_redis::RedisConnectionManager, futures::{ prelude::*, ready, task::{AtomicWaker, Context, Poll}, }, std...
code_fim
hard
{ "lang": "rust", "repo": "pbzweihander/warp-redis-sse-example", "path": "/src/redis.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>async fn dump_api_group( env: &crate::Environment, api_resource: &ApiResource, ) -> anyhow::Result<()> { println!(" - {}.{}", api_resource.kind, api_resource.api_version); let api = Api::<DynamicObject>::all_with(env.client.clone(), api_resource); let object_list: Vec<DynamicObject> ...
code_fim
hard
{ "lang": "rust", "repo": "MikailBag/kube-dump", "path": "/src/generic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Modifies `object` in-place, applying all requested strips fn apply_strips(object: &mut serde_json::Value, strips: &[Strip]) { for strip in strips { match strip { Strip::ManagedFields => { if let Some(managed_fields) = object.pointer_mut("/metadata/managedFields"...
code_fim
hard
{ "lang": "rust", "repo": "MikailBag/kube-dump", "path": "/src/generic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MikailBag/kube-dump path: /src/generic.rs //! Generic dumping behavior use kube::api::{Api, ApiResource, DynamicObject}; pub enum Strip { ManagedFields, } impl std::str::FromStr for Strip { type Err = anyhow::Error; fn from_str(s: &str) -> Result<Self, Self::Err> { match s...
code_fim
hard
{ "lang": "rust", "repo": "MikailBag/kube-dump", "path": "/src/generic.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Open a channel - None says let the library choose the channel ID. let channel = connection.open_channel(None)?; // Get a handle to the direct exchange on our channel. let exchange = Exchange::direct(&channel); let name = generator.next().unwrap(); print...
code_fim
hard
{ "lang": "rust", "repo": "Modulus/rust-rabbitmq-demo", "path": "/src/bin/send.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Modulus/rust-rabbitmq-demo path: /src/bin/send.rs use amiquip::{Connection, Exchange, Publish, Result}; // use rand::seq::SliceRandom; // 0.7.2 use std::env; use names::{Generator, Name}; use std::{thread, time}; // use serde::Deserialize; // use reqwest::Error; // // #[derive(Deserialize, De...
code_fim
hard
{ "lang": "rust", "repo": "Modulus/rust-rabbitmq-demo", "path": "/src/bin/send.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>p[x - 1].max(0) + a[y - 1] - a[x - 1]); } println!("{}", dp.iter().max().unwrap()); }<|fim_prefix|>// repo: sugyan/atcoder path: /abc188/src/bin/e.rs use proconio::{fastout, input}; #[fastout] fn main() { input! { n: usize, m: us<|fim_middle|>ize, a: [i32; n], mut xy:...
code_fim
medium
{ "lang": "rust", "repo": "sugyan/atcoder", "path": "/abc188/src/bin/e.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sugyan/atcoder path: /abc188/src/bin/e.rs use proconio::{fastout, input}; #[fastout] fn main() { input! { n: usize, m: us<|fim_suffix|>p[x - 1].max(0) + a[y - 1] - a[x - 1]); } println!("{}", dp.iter().max().unwrap()); }<|fim_middle|>ize, a: [i32; n], mut xy:...
code_fim
medium
{ "lang": "rust", "repo": "sugyan/atcoder", "path": "/abc188/src/bin/e.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>d::i32::MIN; n]; xy.sort(); for &(x, y) in &xy { dp[y - 1] = dp[y - 1].max(dp[x - 1].max(0) + a[y - 1] - a[x - 1]); } println!("{}", dp.iter().max().unwrap()); }<|fim_prefix|>// repo: sugyan/atcoder path: /abc188/src/bin/e.rs use proconio::{fastout, input}; #[fastout] fn main() {...
code_fim
medium
{ "lang": "rust", "repo": "sugyan/atcoder", "path": "/abc188/src/bin/e.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if self.play_button.clicked() { return Some(State::Game); } if self.exit_button.clicked() { save_highscore(self.highscore); return Some(State::Exit); } None } fn draw(&self, win: &mut RenderWindow) { self.play_b...
code_fim
hard
{ "lang": "rust", "repo": "thomaslienbacher/Moving-Tower", "path": "/src/scenes.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thomaslienbacher/Moving-Tower path: /src/scenes.rs use std::fs::*; use std::io::*; use std::option::Option; use sfml::graphics::*; use sfml::system::Vector2f; use sfml::window::*; use crate::actors::*; use crate::assets::AssetManager; use crate::ui::UiButton; use super::{WIN_HEIGHT, WIN_WIDTH...
code_fim
hard
{ "lang": "rust", "repo": "thomaslienbacher/Moving-Tower", "path": "/src/scenes.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> GameScene<'a> { pub fn new(am: &'a AssetManager) -> GameScene<'a> { let score_text = { let mut t = Text::new("0.0", am.get_font("font.ttf"), 20); t.set_fill_color(&Color::BLACK); t.set_position(Vector2f::new(WIN_WIDTH / 2.0, 5.0)); t ...
code_fim
hard
{ "lang": "rust", "repo": "thomaslienbacher/Moving-Tower", "path": "/src/scenes.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(burgers(16, 7), (1, 6)); assert_eq!(burgers(17, 4), (-1, -1)); assert_eq!(burgers(4, 17), (-1, -1)); } fn burgers(tomato: isize, cheese: isize) -> (isize, isize) { if tomato % 2 == 1 || tomato < 2 * cheese || tomato > cheese * 4 { return (-1, -1); } let jumbo =...
code_fim
medium
{ "lang": "rust", "repo": "qeedquan/challenges", "path": "/leetcode/number-of-burgers-with-no-waste-of-ingredients.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { assert_eq!(burgers(16, 7), (1, 6)); assert_eq!(burgers(17, 4), (-1, -1)); assert_eq!(burgers(4, 17), (-1, -1)); } fn burgers(tomato: isize, cheese: isize) -> (isize, isize) { if tomato % 2 == 1 || tomato < 2 * cheese || tomato > cheese * 4 { return (-1, -1); } ...
code_fim
hard
{ "lang": "rust", "repo": "qeedquan/challenges", "path": "/leetcode/number-of-burgers-with-no-waste-of-ingredients.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qeedquan/challenges path: /leetcode/number-of-burgers-with-no-waste-of-ingredients.rs /* Given two integers tomatoSlices and cheeseSlices. The ingredients of different burgers are as follows: Jumbo Burger: 4 tomato slices and 1 cheese slice. Small Burger: 2 Tomato slices and 1 cheese slice. Re...
code_fim
medium
{ "lang": "rust", "repo": "qeedquan/challenges", "path": "/leetcode/number-of-burgers-with-no-waste-of-ingredients.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test_case] fn test_println_long() { println!("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean enim justo, egestas vitae vehicula non, tempor condimentum ligula. In urna felis, convallis non turpis id, varius suscipit tortor. Aliquam eu velit at velit pellentesque vulputate. Donec sit...
code_fim
hard
{ "lang": "rust", "repo": "teunvw14/rust_os", "path": "/tests/basic_boot.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: teunvw14/rust_os path: /tests/basic_boot.rs #![no_std] #![no_main] #![feature(custom_test_frameworks)] #![test_runner(rust_os::run_tests)] #![reexport_test_harness_main = "test_main"] use core::panic::PanicInfo; use rust_os::println; use rust_os::vga_buffer; #[no_mangle] // don't mangle the na...
code_fim
medium
{ "lang": "rust", "repo": "teunvw14/rust_os", "path": "/tests/basic_boot.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: floric/neuland path: /src/model/node.rs use super::attributes::{Attributes, HasAttributes}; use std::hash::Hash; <|fim_suffix|> pub fn id(&self) -> &String { &self.id } } impl HasAttributes for Node { fn attributes_mut(&mut self) -> &mut Attributes { &mut self.attrib...
code_fim
hard
{ "lang": "rust", "repo": "floric/neuland", "path": "/src/model/node.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn id(&self) -> &String { &self.id } } impl HasAttributes for Node { fn attributes_mut(&mut self) -> &mut Attributes { &mut self.attributes } fn attributes(&self) -> &Attributes { &self.attributes } }<|fim_prefix|>// repo: floric/neuland path: /src/mo...
code_fim
hard
{ "lang": "rust", "repo": "floric/neuland", "path": "/src/model/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: db-ohhhh/rust-kvdb path: /src/store.rs use crate::config::Config; use crate::lsmt::{LSMTError, LSMT}; use std::collections::HashMap; use std::hash::Hash; /// Depicts whether an operation was successfully executed or not. #[cfg_attr(test, derive(PartialEq, Debug))] pub enum ExecResult { Succ...
code_fim
hard
{ "lang": "rust", "repo": "db-ohhhh/rust-kvdb", "path": "/src/store.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let result = store.set("key1", "value1"); assert_eq!(result, ExecResult::Success); let result = store.get("key1"); assert_eq!(result, Ok("value1")); let result = store.del("key1"); assert_eq!(result, ExecResult::Success); let result = store.get("k...
code_fim
hard
{ "lang": "rust", "repo": "db-ohhhh/rust-kvdb", "path": "/src/store.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: swift-nav/libsbp path: /rust/sbp/tests/integration/auto_check_sbp_observation_msg_ephemeris_gal.rs d 2154, is {}", msg.toc.wn ); assert!( msg.w.almost_eq(1.22509120916626246e-01), "incorrect value for w, ...
code_fim
hard
{ "lang": "rust", "repo": "swift-nav/libsbp", "path": "/rust/sbp/tests/integration/auto_check_sbp_observation_msg_ephemeris_gal.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nicolas-cherel/rumblebars path: /tests/eval/trimming.rs use serialize::json::Json; use std::default::Default; use rumblebars::eval; use rumblebars::parse; fn test_eq_expected(template: &str, json_str: &str, expected: &str) { let json = Json::from_str(json_str).ok().unwrap(); let tmpl = par...
code_fim
hard
{ "lang": "rust", "repo": "nicolas-cherel/rumblebars", "path": "/tests/eval/trimming.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> test_eq_expected("|{{#none}}{{/none~}} ", "{}", "|"); } #[test] fn trim_left() { test_eq_expected(" {{~#none}}{{/none}}|", "{}", "|"); } #[test] fn trim_both() { test_eq_expected(" {{~#none}}{{/none~}} ", "{}", ""); } #[test] fn trim_left_with_raw() { test_eq_expected(...
code_fim
hard
{ "lang": "rust", "repo": "nicolas-cherel/rumblebars", "path": "/tests/eval/trimming.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alilee/arm-rust-clust path: /src/archs/aarch64/pager/layout.rs // SPDX-License-Identifier: Unlicense //! Understanding of physical layout on reset //! //! FIXME: should layout be an arch concern? use crate::pager::{FixedOffset, PhysAddrRange, Translate, VirtAddrRange}; /// Where kernel moves ...
code_fim
hard
{ "lang": "rust", "repo": "alilee/arm-rust-clust", "path": "/src/archs/aarch64/pager/layout.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|>/// Read-ony data section of the kernel boot image (using linker symbols) pub fn static_image() -> PhysAddrRange { extern "C" { static static_base: u8; static static_end: u8; } unsafe { kernel_offset().translate_range(VirtAddrRange::from_linker_symbols( &sta...
code_fim
hard
{ "lang": "rust", "repo": "alilee/arm-rust-clust", "path": "/src/archs/aarch64/pager/layout.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> { let mut assign_view = res.view_mut(); let arrays = arrays.iter().map(|a| a.mapv(MaybeUninit::new)); for mut array in arrays { let len = array.len_of(axis); let (mut front, rest) = assign_view.split_at(axis, len); Zip::from(&mut front).and(&...
code_fim
hard
{ "lang": "rust", "repo": "dingxiangfei2009/sss", "path": "/src/array.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dingxiangfei2009/sss path: /src/array.rs use std::mem::MaybeUninit; use ndarray::{Array, ArrayView, Axis, ErrorKind, RemoveAxis, ShapeError, Zip}; /// A variant of `ndarray::stack!` macro that accepts a borrowed `ArrayView` #[macro_export] macro_rules! stack { ($axis:expr, $( $array:expr )...
code_fim
hard
{ "lang": "rust", "repo": "dingxiangfei2009/sss", "path": "/src/array.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // we can safely use uninitialized values here because they are Copy // and we will only ever write to them let size = res_dim.size(); let mut v = Vec::with_capacity(size); v.resize_with(size, MaybeUninit::uninit); let mut res: Array<MaybeUninit<A>, _> = Array::from_shape_vec(res_d...
code_fim
hard
{ "lang": "rust", "repo": "dingxiangfei2009/sss", "path": "/src/array.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TmLev/ray-tracer-rust path: /src/hit.rs use std::rc::Rc; use crate::{Material, Point3, Ray, Vec3}; pub struct HitRecord { point: Point3, normal: Vec3, material: Rc<dyn Material>, t: f64, front_face: bool, } impl HitRecord { pub fn new(point: Point3, normal: Vec3, mater...
code_fim
hard
{ "lang": "rust", "repo": "TmLev/ray-tracer-rust", "path": "/src/hit.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn front_face(&self) -> bool { self.front_face } } pub trait Hittable { fn hit(&self, ray: &Ray, t_min: f64, t_max: f64) -> Option<HitRecord>; } #[derive(Default)] pub struct HittableList { objects: Vec<Rc<dyn Hittable>>, } impl HittableList { pub fn new(hittable: Rc<dyn...
code_fim
hard
{ "lang": "rust", "repo": "TmLev/ray-tracer-rust", "path": "/src/hit.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: simonbrahan/rustbook path: /art/src/lib.rs //! # Art //! //! A library for modelling artistic concepts. pub use self::kinds::PrimaryColour; pub use self::kinds::SecondaryColour; pub use self::utils::mix; pub mod kinds { /// The primary colours according to RYB pub enum PrimaryColour { ...
code_fim
medium
{ "lang": "rust", "repo": "simonbrahan/rustbook", "path": "/art/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub mod utils { use crate::kinds::*; /// Combines two primary colours to create a secondary colour. /// Combining the same primary colour with itself will give `None`. /// /// # Examples /// /// ``` /// let red = art::PrimaryColour::Red; /// let yellow = art::PrimaryCo...
code_fim
medium
{ "lang": "rust", "repo": "simonbrahan/rustbook", "path": "/art/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sakai-ryota/monkey path: /src/repl.rs use crate::token::Token; use crate::lexer::Lexer; const PROMPT: &'static str = ">> "; pub fn start_repl<R, W>(reader: &mut R, writer: &mut W) where R: std::io::BufRead, W: std::io::Write, { let mut src = String::new(); lo<|fim_suffix...
code_fim
hard
{ "lang": "rust", "repo": "sakai-ryota/monkey", "path": "/src/repl.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> lex.next_token(); toks.push(tok.clone()); if tok == Token::EOF { break; } } writeln!(writer, "{:?}", toks).unwrap(); writer.flush().unwrap(); src.clear(); } }<|fim_prefix|>// repo: sakai-ryota/monkey path: /src/repl....
code_fim
hard
{ "lang": "rust", "repo": "sakai-ryota/monkey", "path": "/src/repl.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn decode_key_pair( base58: String, key_pair_format: String, ) -> Result<KeyPair, Box<dyn std::error::Error>> { let key_pair = bs58::decode(base58).into_vec()?; Ok( KeyPair::from_vec(key_pair, KeyFormat::from_str(&key_pair_format)?) .map_err(|e| Error::new(ErrorKin...
code_fim
hard
{ "lang": "rust", "repo": "octaplexsys/fluence", "path": "/crates/server-config/src/keys.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: octaplexsys/fluence path: /crates/server-config/src/keys.rs /* * Copyright 2020 Fluence Labs Limited * * 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 * * htt...
code_fim
hard
{ "lang": "rust", "repo": "octaplexsys/fluence", "path": "/crates/server-config/src/keys.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> decode_key_pair(base58.trim().to_string(), keypair_format) } pub fn decode_key_pair( base58: String, key_pair_format: String, ) -> Result<KeyPair, Box<dyn std::error::Error>> { let key_pair = bs58::decode(base58).into_vec()?; Ok( KeyPair::from_vec(key_pair, KeyFormat::from_st...
code_fim
hard
{ "lang": "rust", "repo": "octaplexsys/fluence", "path": "/crates/server-config/src/keys.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ChrisMaxheart/Competitive-Programming path: /Advent of Code/2019/day4_1.rs use std::fs::File; use std::io::{self, BufRead}; use std::path::Path; struct InputReader { filename: String, } impl InputReader { fn read(&self) -> Vec<String> { if let Ok(lines) = read_lines(&self.file...
code_fim
hard
{ "lang": "rust", "repo": "ChrisMaxheart/Competitive-Programming", "path": "/Advent of Code/2019/day4_1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut prev_char = '.'; for char in num.to_string().chars() { if char == prev_char { return true } prev_char = char; } false } fn has_increasing_trend_digit(&self, num: &i32) -> bool { let mut current_num...
code_fim
hard
{ "lang": "rust", "repo": "ChrisMaxheart/Competitive-Programming", "path": "/Advent of Code/2019/day4_1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: userbaruu/aeromit path: /src/app/permissions/mod.rs //! # Module Permission Services //! //! Module ini digunakan untuk membantu kelola izin pengguna untuk digunakan di `routes`. //! //! <br /> //! //! # Contoh //! //! ```rust //! use crate::pengguna::services::permissions::{...} //! ``` <|fim_...
code_fim
medium
{ "lang": "rust", "repo": "userbaruu/aeromit", "path": "/src/app/permissions/mod.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>/// _Struct_ yang digunakan untuk kelola perizinan melalui impl pub struct UserPermissions; /// _Enum_ Roles sebagai peran pengguna pub enum Roles { Admin, Authenticated, }<|fim_prefix|>// repo: userbaruu/aeromit path: /src/app/permissions/mod.rs //! # Module Permission Services //! //! Module i...
code_fim
easy
{ "lang": "rust", "repo": "userbaruu/aeromit", "path": "/src/app/permissions/mod.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> if three_div && five_div { println!("fizzbuzz"); } else if three_div { println!("fizz"); } else if five_div { println!("buzz"); } else { println!("{}", x); } } }<|fim_prefix|>// repo: damons...
code_fim
medium
{ "lang": "rust", "repo": "damons-git/fizzbuzz-rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: damons-git/fizzbuzz-rust path: /src/main.rs fn main() { let max: i16 = 100; fizz_buzz(max); } <|fim_suffix|> for x in 1..range+1 { let three_div = if x % 3 == 0 { true } else { false }; let five_div = if x % 5 == 0 { true } else { false }; if three_div && fi...
code_fim
medium
{ "lang": "rust", "repo": "damons-git/fizzbuzz-rust", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for x in 1..range+1 { let three_div = if x % 3 == 0 { true } else { false }; let five_div = if x % 5 == 0 { true } else { false }; if three_div && five_div { println!("fizzbuzz"); } else if three_div { println!("fizz"); } ...
code_fim
medium
{ "lang": "rust", "repo": "damons-git/fizzbuzz-rust", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/existential_types/generic_lifetime_param.rs // compile-pass <|fim_suffix|>fn main() {} existential type Region<'a>: std::fmt::Debug; fn region<'b>(a: &'b ()) -> Region<'b> { a }<|fim_middle|>#![feature(existential_type)]
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/existential_types/generic_lifetime_param.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: blueluna/zigbee-rs path: /src/lib.rs pub mod state; pub mod machine_state; pub mod machine; pub mod init; pub mod serde; pub mod nwk; <|fim_suffix|> assert_eq!(2 + 2, 4); } }<|fim_middle|>#[cfg(test)] mod tests { #[test] fn it_works() {
code_fim
easy
{ "lang": "rust", "repo": "blueluna/zigbee-rs", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(2 + 2, 4); } }<|fim_prefix|>// repo: blueluna/zigbee-rs path: /src/lib.rs pub mod state; pub mod machine_state; pub mod machine; pub mod init; pub mod serde; pub mod nwk; <|fim_middle|>#[cfg(test)] mod tests { #[test] fn it_works() {
code_fim
easy
{ "lang": "rust", "repo": "blueluna/zigbee-rs", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>CEW<'a> { w: &'a mut W, } impl<'a> _OC1CEW<'a> { #[doc = r" Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: OC1CEW) -> &'a mut W { { self.bit(variant._bits()) } } #[doc = "OC1Ref is not affected by the ETRF Input"] #[i...
code_fim
hard
{ "lang": "rust", "repo": "creationix/stm32f042x", "path": "/stm32f0x2/src/tim1/ccmr1_output/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>b fn is_force_inactive(&self) -> bool { *self == OC1MR::FORCEINACTIVE } #[doc = "Checks if the value of the field is `FORCEACTIVE`"] #[inline(always)] pub fn is_force_active(&self) -> bool { *self == OC1MR::FORCEACTIVE } #[doc = "Checks if the value of the field is ...
code_fim
hard
{ "lang": "rust", "repo": "creationix/stm32f042x", "path": "/stm32f0x2/src/tim1/ccmr1_output/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: creationix/stm32f042x path: /stm32f0x2/src/tim1/ccmr1_output/mod.rs } #[doc = r" Sets the field bit"] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r" Clears the field bit"] pub fn clear_bit(self) -> &'a mut W { self.bit(false) } #[doc =...
code_fim
hard
{ "lang": "rust", "repo": "creationix/stm32f042x", "path": "/stm32f0x2/src/tim1/ccmr1_output/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/xenowing path: /sim/peek-buffer/src/lib.rs #[cfg(test)] mod tests { mod modules { include!(concat!(env!("OUT_DIR"), "/modules.rs")); } use modules::*; #[test] fn reset_empty() { let mut m = PeekBuffer::new(); m.reset(); m.prop(); ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/xenowing", "path": "/sim/peek-buffer/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Disable egress read m.egress_read_enable = false; m.prop(); // Egress initial item on same cycle assert_eq!(m.egress_ready, true); assert_eq!(m.egress_data, 0xfadebabe); // Don't ingress read for next item, since we could overrun the buffer ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/xenowing", "path": "/sim/peek-buffer/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Don't ingress read for next item, since we could overrun the buffer assert_eq!(m.ingress_read_enable, false); m.posedge_clk(); // Don't return any new data, since a read was not requested last cycle m.ingress_data = 0xdeadbeef; // This value should be ignored ...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/xenowing", "path": "/sim/peek-buffer/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> msg.channel_id .say( &ctx.http, format!("{} has banned {}", msg.author.name, target.user.name), ) .await?; } else { msg.channel_id .say(&ctx.http, "You do not have Permission to use this Command") ...
code_fim
hard
{ "lang": "rust", "repo": "AkiraTenchi/AkiraBot", "path": "/src/commands/management.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let target = get_member_from_user_id(&ctx, &msg, target_id).await; target.kick(ctx).await.expect("failed to kick member"); msg.channel_id .say( &ctx.http, format!( "{} has been kicked by {}", targe...
code_fim
hard
{ "lang": "rust", "repo": "AkiraTenchi/AkiraBot", "path": "/src/commands/management.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AkiraTenchi/AkiraBot path: /src/commands/management.rs use serenity::framework::standard::{macros::command, Args, CommandResult}; use serenity::model::prelude::*; use serenity::prelude::Context; #[command] async fn delete_msg(ctx: &Context, msg: &Message, args: Args) -> CommandResult { let ...
code_fim
hard
{ "lang": "rust", "repo": "AkiraTenchi/AkiraBot", "path": "/src/commands/management.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(format_elements![ global_token.format(formatter)?, space_token(), body.format(formatter)? ]) } }<|fim_prefix|>// repo: Tembocs/rome path: /crates/rome_js_formatter/src/ts/declarations/global_declaration.rs use crate::formatter_traits::FormatToken...
code_fim
medium
{ "lang": "rust", "repo": "Tembocs/rome", "path": "/crates/rome_js_formatter/src/ts/declarations/global_declaration.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tembocs/rome path: /crates/rome_js_formatter/src/ts/declarations/global_declaration.rs use crate::formatter_traits::FormatTokenAndNode; use crate::{ format_elements, space_token, FormatElement, FormatResult, Formatter, ToFormatElement, }; use rome_js_syntax::TsGlobalDeclaration; use rome_js_...
code_fim
medium
{ "lang": "rust", "repo": "Tembocs/rome", "path": "/crates/rome_js_formatter/src/ts/declarations/global_declaration.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pushkar-bharambe/wasm-learning path: /nodejs/algos/src/lib.rs ianMixtureModel}; use rm::learning::naive_bayes::{NaiveBayes, Gaussian}; use rm::learning::k_means::KMeansClassifier; use rm::learning::svm::SVM; use rm::learning::toolkit::kernel::Linear; use rm::learning::nnet::{NeuralNet, BCECriter...
code_fim
hard
{ "lang": "rust", "repo": "pushkar-bharambe/wasm-learning", "path": "/nodejs/algos/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pushkar-bharambe/wasm-learning path: /nodejs/algos/src/lib.rs padding: 0, } } pub fn add_point(&mut self, x: f64, y: f64) { self.points.push(Point { x, y }); } pub fn graph_map(&self, points: Vec<(f64, f64)>) -> Vec<(f64, f64)> { points .iter() .map...
code_fim
hard
{ "lang": "rust", "repo": "pushkar-bharambe/wasm-learning", "path": "/nodejs/algos/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> context.insert("n", &self.size); context.insert("preds", &preds); Tera::one_off(include_str!("nb.svg"), &mut context, true).expect("Could not draw graph") } pub fn dbscan_svg(&self) -> String { let mut xs: Vec<f64> = Vec::new(); let mut ys: Vec<f64> = Vec::new(); let mut p_ve...
code_fim
hard
{ "lang": "rust", "repo": "pushkar-bharambe/wasm-learning", "path": "/nodejs/algos/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> client.list_certificates(request).await.unwrap(); }<|fim_prefix|>// repo: wg/rusoto path: /integration_tests/tests/acm.rs #![cfg(feature = "acm")] extern crate rusoto_acm; extern crate rusoto_core; <|fim_middle|>use rusoto_acm::{Acm, AcmClient, ListCertificatesRequest}; use rusoto_core::Region; #[...
code_fim
hard
{ "lang": "rust", "repo": "wg/rusoto", "path": "/integration_tests/tests/acm.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wg/rusoto path: /integration_tests/tests/acm.rs #![cfg(feature = "acm")] extern crate rusoto_acm; extern crate rusoto_core; <|fim_suffix|> client.list_certificates(request).await.unwrap(); }<|fim_middle|>use rusoto_acm::{Acm, AcmClient, ListCertificatesRequest}; use rusoto_core::Region; #[...
code_fim
hard
{ "lang": "rust", "repo": "wg/rusoto", "path": "/integration_tests/tests/acm.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>t"); assert_eq!(err.line(), 5); assert_eq!(err.column(), 7); }<|fim_prefix|>// repo: gitpicard/atom path: /tests/error_tests.rs extern crate atom; #[test] fn test_error() { let err = atom::error::Error::new("test error", "test file.at", 5, 7); assert_eq!(err.<|fim_middle|>message(), "tes...
code_fim
medium
{ "lang": "rust", "repo": "gitpicard/atom", "path": "/tests/error_tests.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gitpicard/atom path: /tests/error_tests.rs extern crate atom; #[test] fn test_error() { let err = atom::erro<|fim_suffix|>t"); assert_eq!(err.line(), 5); assert_eq!(err.column(), 7); }<|fim_middle|>r::Error::new("test error", "test file.at", 5, 7); assert_eq!(err.message(), "tes...
code_fim
medium
{ "lang": "rust", "repo": "gitpicard/atom", "path": "/tests/error_tests.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }