text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>om_transference( transfer, Status::Failed(error_msgs::INSUFFICIENT_BALANCE.to_string()), )) .unwrap(); } }, ...
code_fim
hard
{ "lang": "rust", "repo": "petrusbatalha/saga-realworld", "path": "/realworld-balance/src/application/transference_service.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let h: usize = read(); let w: usize = read(); let mut a = vec![0; h * w]; for i in 0..h * w { a[i] = read(); } a.sort(); for i in 0..h { let b = &a[i * w..(i + 1) * w]; println!( "{}", b.iter() .map(|x| x.to_string...
code_fim
medium
{ "lang": "rust", "repo": "ia7ck/competitive-programming", "path": "/yukicoder/1130.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ia7ck/competitive-programming path: /yukicoder/1130.rs use std::io::Read; fn read<T: std::str::FromStr>() -> T { let token: String = std::io::stdin() .bytes() .map(|c| c.ok().unwrap() as char) .skip_while(|c| c.is_whitespace()) .take_while(|c| !c.is_whitespac...
code_fim
medium
{ "lang": "rust", "repo": "ia7ck/competitive-programming", "path": "/yukicoder/1130.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn process_request(&mut self, version: u64, peer: PeerNetworkId) { if let Some(prev_request) = self.requests.get_mut(&version) { prev_request.last_request_peer = peer; prev_request.last_request_time = SystemTime::now(); } else { self.requests ...
code_fim
hard
{ "lang": "rust", "repo": "jolestar/libra", "path": "/state-synchronizer/src/peer_manager.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jolestar/libra path: /state-synchronizer/src/peer_manager.rs // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use crate::counters; use libra_config::config::{PeerNetworkId, UpstreamConfig}; use libra_logger::prelude::*; use rand::{ distributions::{Distribu...
code_fim
hard
{ "lang": "rust", "repo": "jolestar/libra", "path": "/state-synchronizer/src/peer_manager.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn is_empty(&self) -> bool { self.get_active_upstream_peers().is_empty() } pub fn update_score(&mut self, peer: &PeerNetworkId, update_type: PeerScoreUpdateType) { if let Some(peer_info) = self.peers.get_mut(peer) { let old_score = peer_info.score; ...
code_fim
hard
{ "lang": "rust", "repo": "jolestar/libra", "path": "/state-synchronizer/src/peer_manager.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: loalang/loalang path: /src/lib/id.rs use crate::*; use serde::{Deserialize, Serialize}; use std::sync::atomic::{AtomicUsize, Ordering}; #[derive(Eq, PartialEq, Copy, Clone, Hash, PartialOrd, Ord, Serialize, Deserialize)] pub struct Id(usize); static NODE_GEN: AtomicUsize = AtomicUsize::new(0xf...
code_fim
medium
{ "lang": "rust", "repo": "loalang/loalang", "path": "/src/lib/id.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl From<usize> for Id { fn from(n: usize) -> Self { Id(n) } } impl Into<usize> for Id { fn into(self) -> usize { self.0 } }<|fim_prefix|>// repo: loalang/loalang path: /src/lib/id.rs use crate::*; use serde::{Deserialize, Serialize}; use std::sync::atomic::{AtomicUsize,...
code_fim
hard
{ "lang": "rust", "repo": "loalang/loalang", "path": "/src/lib/id.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> 7 - PDDIN7"] #[inline(always)] #[must_use] pub fn pddin7(&mut self) -> PDDIN7_W<7> { PDDIN7_W::new(self) } #[doc = "Bit 8 - PDDIN8"] #[inline(always)] #[must_use] pub fn pddin8(&mut self) -> PDDIN8_W<8> { PDDIN8_W::new(self) } #[doc = "Bit 9 - PDDIN...
code_fim
hard
{ "lang": "rust", "repo": "ht32-rs/ht32-rs-nightlies", "path": "/ht32f5xxxx/src/ht32f52357_67/gpiod/pddinr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ht32-rs/ht32-rs-nightlies path: /ht32f5xxxx/src/ht32f52357_67/gpiod/pddinr.rs #[doc = "Register `PDDINR` reader"] pub struct R(crate::R<PDDINR_SPEC>); impl core::ops::Deref for R { type Target = crate::R<PDDINR_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self...
code_fim
hard
{ "lang": "rust", "repo": "ht32-rs/ht32-rs-nightlies", "path": "/ht32f5xxxx/src/ht32f52357_67/gpiod/pddinr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let intersection = Intersection::new(1.0, &sphere, Matrix4x4::identity(), Matrix4x4::identity()); let mut intersections = Vec::new(); intersections.push(intersection); let computations = Computations::new(&intersections[0], &ray, &intersections); assert!(computations.t == interse...
code_fim
hard
{ "lang": "rust", "repo": "bonhamjp/JBTracer", "path": "/src/rendering/computations_tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bonhamjp/JBTracer path: /src/rendering/computations_tests.rs #[cfg(test)] mod tests { use std::f64; use crate::rendering::math::Point; use crate::rendering::math::Vector; use crate::rendering::math::Color; use crate::rendering::math::Matrix4x4; use crate::rendering::shapes::Spher...
code_fim
hard
{ "lang": "rust", "repo": "bonhamjp/JBTracer", "path": "/src/rendering/computations_tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: asteryx/domains path: /src/db/models/statistic.rs use crate::db::models::domains::{DomainState, DomainStatusShort}; use crate::db::schema::domain; use crate::db::schema::domain_status; use crate::db::DbExecutor; use crate::CONFIG; use actix::{Handler, Message}; use chrono::{DateTime, Local, Naiv...
code_fim
hard
{ "lang": "rust", "repo": "asteryx/domains", "path": "/src/db/models/statistic.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, SerdeSerialize, SerdeDeserialize, Validate)] pub struct DomainGroup { pub id: i32, pub name: String, pub statuses: Vec<DomainStatusShort>, } impl Message for Statistic { type Result = io::Result<Option<Vec<DomainGroup>>>; } impl Handler<Statistic> for DbExecutor { typ...
code_fim
hard
{ "lang": "rust", "repo": "asteryx/domains", "path": "/src/db/models/statistic.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: narfit66/ncursesw-win-rs path: /src/gen/hasattributes.rs /* src/gen/hasattributes.rs Copyright (c) 2019-2021 Stephen Whittle All rights reserved. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (t...
code_fim
hard
{ "lang": "rust", "repo": "narfit66/ncursesw-win-rs", "path": "/src/gen/hasattributes.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(ncursesw::wattron(self._handle(), attrs)?) } fn attrset(&self, attrs: normal::Attributes) -> result!(()) { assert!(self._screen() == attrs.screen()); Ok(ncursesw::wattrset(self._handle(), attrs)?) } fn color_set<P, T>(&self, color_pair: P) -> result!(()) ...
code_fim
hard
{ "lang": "rust", "repo": "narfit66/ncursesw-win-rs", "path": "/src/gen/hasattributes.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ; fn poll ( self : Pin < & mut Self > cx : & mut Context < ' _ > ) - > Poll < Self : : Output > { # [ cfg ( all ( tokio_unstable feature = " tracing " ) ) ] let _resource_span = self . node . ctx . resource_span . clone ( ) . entered ( ) ; # [ cfg ( all ( tokio_unstable feature = " tracing " ) ) ] let _a...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/tokio/src/sync/batch_semaphore.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>{ node : Waiter : : new ( num_permits ) semaphore num_permits queued : false } ; # [ cfg ( all ( tokio_unstable feature = " tracing " ) ) ] return semaphore . resource_span . in_scope ( | | { let async_op_span = tracing : : trace_span ! ( " runtime . resource . async_op " source = " Acquire : : new " ) ; ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/tokio/src/sync/batch_semaphore.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/tokio/src/sync/batch_semaphore.rs Self : : MAX_PERMITS " a semaphore may not have more than MAX_PERMITS permits ( { } ) " Self : : MAX_PERMITS ) ; # [ cfg ( all ( tokio_unstable feature = " tracing " ) ) ] let resource_span = { let resource_spa...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/tokio/src/sync/batch_semaphore.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>impl Entity for Reprint { fn from_json(json: &str) -> Result<Reprint, EntityError> { Ok(serde_json::from_str(json)?) } }<|fim_prefix|>// repo: bauhaus93/optimizer path: /mkm-client/src/entities/reprint.rs use serde_json; use entities::entity::Entity; use entities::entity_error::EntityErr...
code_fim
medium
{ "lang": "rust", "repo": "bauhaus93/optimizer", "path": "/mkm-client/src/entities/reprint.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bauhaus93/optimizer path: /mkm-client/src/entities/reprint.rs use serde_json; use entities::entity::Entity; use entities::entity_error::EntityError; #[derive(Deserialize, Debug, Clone)] #[serde(rename_all = "camelCase")] pub struct Reprint { id_product: u32, expansion: String, exp_...
code_fim
medium
{ "lang": "rust", "repo": "bauhaus93/optimizer", "path": "/mkm-client/src/entities/reprint.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: simonasker/adventofcode2016 path: /src/solutions/day05.rs extern crate crypto; use std::io::prelude::*; use std::fs::File; use self::crypto::md5::Md5; use self::crypto::digest::Digest; pub fn run(part: i32) { match part { 1 => part_one(), 2 => part_two(), _ => prin...
code_fim
hard
{ "lang": "rust", "repo": "simonasker/adventofcode2016", "path": "/src/solutions/day05.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn part_two() { let mut f = File::open("input/day05.txt").unwrap(); let mut input = String::new(); f.read_to_string(&mut input).unwrap(); let input = input.trim().to_owned(); let mut answer = ['-'; 8]; let mut found = [false; 8]; for n in 0.. { let mut hasher = Md5::n...
code_fim
hard
{ "lang": "rust", "repo": "simonasker/adventofcode2016", "path": "/src/solutions/day05.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lichen-liu/dv-in-rust path: /o2versioner/src/comm/scheduler_dbproxy.rs //! Communication between scheduler and dbproxy use super::msql_response::MsqlResponse; use crate::core::*; use serde::{Deserialize, Serialize}; <|fim_suffix|>impl Message { pub fn try_get_request_meta(&self) -> Result<...
code_fim
hard
{ "lang": "rust", "repo": "lichen-liu/dv-in-rust", "path": "/o2versioner/src/comm/scheduler_dbproxy.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Message { pub fn try_get_request_meta(&self) -> Result<&RequestMeta, ()> { match self { Self::MsqlRequest(meta, _, _) => Ok(meta), Self::MsqlResponse(meta, _) => Ok(meta), _ => Err(()), } } }<|fim_prefix|>// repo: lichen-liu/dv-in-rust path...
code_fim
hard
{ "lang": "rust", "repo": "lichen-liu/dv-in-rust", "path": "/o2versioner/src/comm/scheduler_dbproxy.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: funnyzpc/cargo_test path: /src/history/main14.rs /// /// 动态数组: Vectors /// fn main(){ // 形式一 let v = vec![1,2,33,5]; for item in v{ println!("=>val :{}",item); } // 形式二 let mut e = vec![0;5]; e[2] = 99; println!("val : {}",e[2]); // 索引(不能使用有符号int做索引)...
code_fim
medium
{ "lang": "rust", "repo": "funnyzpc/cargo_test", "path": "/src/history/main14.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 索引(不能使用有符号int做索引) let v:Vec<i32> = vec![1,3,7,9,11]; let i:usize = 0; // let j:i32 = 0; println!("v[i] = {}",v[i]); // println!("v[j] = {}",v[j]); // 匹配 match v.get(8) { Some(x) => println!("value is {}",x), None => println!("Sorry,never have this value!...
code_fim
medium
{ "lang": "rust", "repo": "funnyzpc/cargo_test", "path": "/src/history/main14.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[allow(dead_code)] #[derive(Default)] pub struct VulkanData { pub api_version: vulkan::ApiVersion, pub instance_extensions: Vec<String>, pub device_extensions: Vec<String>, pub instance: vulkan::Instance, pub surface: vulkan::SurfaceKHR, pub device_data: DeviceData, } #[allow(dea...
code_fim
hard
{ "lang": "rust", "repo": "nikitablack/rust_vulkan_bindings_test", "path": "/src/app/data.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nikitablack/rust_vulkan_bindings_test path: /src/app/data.rs use super::vk; use super::vulkan; #[allow(dead_code)] pub struct WindowData { pub window: winit::window::Window, } #[allow(dead_code)] pub struct DeviceData { pub physical_device: vulkan::PhysicalDevice, pub device: vulka...
code_fim
hard
{ "lang": "rust", "repo": "nikitablack/rust_vulkan_bindings_test", "path": "/src/app/data.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn solution() -> SolutionResult { let mut divisors_map = HashMap::new(); for i in 2i64..10000 { divisors_map.insert(i, sum_divisors(i)); } let mut sum = 0i64; for (key, value) in &divisors_map { if *key != *value && divisors_map.get(value) == Some(key) { ...
code_fim
medium
{ "lang": "rust", "repo": "zsiciarz/euler.rs", "path": "/src/solutions/problem21.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zsiciarz/euler.rs path: /src/solutions/problem21.rs use std::collections::HashMap; use super::SolutionResult; use super::common::divisors; <|fim_suffix|>pub fn solution() -> SolutionResult { let mut divisors_map = HashMap::new(); for i in 2i64..10000 { divisors_map.insert(i, su...
code_fim
medium
{ "lang": "rust", "repo": "zsiciarz/euler.rs", "path": "/src/solutions/problem21.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: spebern/refinery path: /refinery_cli/src/util.rs use std::ffi::OsStr; use std::path::{Path, PathBuf}; use walkdir::{DirEntry, WalkDir}; <|fim_suffix|> let file_paths = WalkDir::new(location) .into_iter() .filter_map(Result::ok) .map(DirEntry::into_path) // fil...
code_fim
hard
{ "lang": "rust", "repo": "spebern/refinery", "path": "/refinery_cli/src/util.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let file_paths = WalkDir::new(location) .into_iter() .filter_map(Result::ok) .map(DirEntry::into_path) // filter by migration file regex .filter( move |entry| match entry.file_name().and_then(OsStr::to_str) { Some(file_name) => re.is_...
code_fim
medium
{ "lang": "rust", "repo": "spebern/refinery", "path": "/refinery_cli/src/util.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let root = it.intern(root_name.clone().into()); fn walk( it: &InternTable, map: &HashMap<StringId, HashSet<StringId>>, seen: &mut HashSet<StringId>, id: StringId, ) -> JsonValue { if seen.contains(&id) { return json!(null); } ...
code_fim
medium
{ "lang": "rust", "repo": "GaloisInc/mir-json", "path": "/src/bin/mir-json-callgraph.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: GaloisInc/mir-json path: /src/bin/mir-json-callgraph.rs //! Usage: `mir-json-callgraph NAME CRATES...` //! //! Print the reverse callgraph of item `NAME`, after linking together `CRATES` as in //! `mir-json-dce`. Useful for figuring out how to prevent a function from being called, when //! that...
code_fim
hard
{ "lang": "rust", "repo": "GaloisInc/mir-json", "path": "/src/bin/mir-json-callgraph.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> it: &InternTable, map: &HashMap<StringId, HashSet<StringId>>, seen: &mut HashSet<StringId>, id: StringId, ) -> JsonValue { if seen.contains(&id) { return json!(null); } seen.insert(id); let callers = match map.get(&id) { ...
code_fim
hard
{ "lang": "rust", "repo": "GaloisInc/mir-json", "path": "/src/bin/mir-json-callgraph.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> ensure_eq!(s.square(), x1 + x2 + x3, "x3 wrong"); let expected_y3 = s * (x1 - x3) - y1; ensure_eq!( y3, expected_y3, format!("y3 wrong {}: (expected {}, got {})", row, expected_y3, y3) ); let not_same_y = F::from((y1 != y2) as u6...
code_fim
hard
{ "lang": "rust", "repo": "gpestana/proof-systems", "path": "/circuits/kimchi/src/polynomials/complete_add.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gpestana/proof-systems path: /circuits/kimchi/src/polynomials/complete_add.rs //! This implements a complete EC addition gate. //! The layout is //! //! 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 //! x1 y1 x2 y2 x3 y3 inf same_x s inf_z x21_inv //! //! where...
code_fim
hard
{ "lang": "rust", "repo": "gpestana/proof-systems", "path": "/circuits/kimchi/src/polynomials/complete_add.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let runtime = tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap(); js_runtime.register_op( "dispatch_request", deno_core::json_op_sync(op_dispatch_request), ); js_runtime.register_op("get_request", deno_core::json_op_sync(...
code_fim
medium
{ "lang": "rust", "repo": "flow-heater/hello-rsdeno", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: flow-heater/hello-rsdeno path: /src/main.rs use deno_core::error::AnyError; use deno_core::JsRuntime; use deno_core::OpState; use deno_core::ZeroCopyBuf; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; use tokio; #[derive(Serialize, Deserialize)] struc...
code_fim
medium
{ "lang": "rust", "repo": "flow-heater/hello-rsdeno", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // let x = js_runtime.execute("index.js", js).unwrap(); let runtime = tokio::runtime::Builder::new_current_thread() .enable_all() .build() .unwrap(); js_runtime.register_op( "dispatch_request", deno_core::json_op_sync(op_dispatch_request), ); j...
code_fim
hard
{ "lang": "rust", "repo": "flow-heater/hello-rsdeno", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.systick } fn service_pending_interrupts(&mut self) { unsafe { while let Some(interrupt) = nvic::next_pending() { /* match interrupt { GPIO => gpio::PORT.handle_interrupt(), // AON Programmabl...
code_fim
hard
{ "lang": "rust", "repo": "Timocin/tock", "path": "/chips/cc2538/src/chip.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Timocin/tock path: /chips/cc2538/src/chip.rs use cortexm3::{self, nvic}; use kernel; pub struct Cc2538 { mpu: (), systick: cortexm3::systick::SysTick, } impl Cc2538 { pub unsafe fn new() -> Cc2538 { Cc2538 { mpu: (), // The systick clocks with 48MHz...
code_fim
hard
{ "lang": "rust", "repo": "Timocin/tock", "path": "/chips/cc2538/src/chip.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod tee_api; mod tee_api_defines; mod tee_api_types; mod trace; mod user_ta_header; mod utee_syscalls; mod utee_types;<|fim_prefix|>// repo: SunLab-GMU/RusTEE-CompileTAinRust path: /optee-utee/optee-utee-sys/src/lib.rs #![allow(non_camel_case_types, non_snake_case)] <|fim_middle|>pub use tee_api::*; pub...
code_fim
medium
{ "lang": "rust", "repo": "SunLab-GMU/RusTEE-CompileTAinRust", "path": "/optee-utee/optee-utee-sys/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SunLab-GMU/RusTEE-CompileTAinRust path: /optee-utee/optee-utee-sys/src/lib.rs #![allow(non_camel_case_types, non_snake_case)] <|fim_suffix|>mod tee_api; mod tee_api_defines; mod tee_api_types; mod trace; mod user_ta_header; mod utee_syscalls; mod utee_types;<|fim_middle|>pub use tee_api::*; pub...
code_fim
medium
{ "lang": "rust", "repo": "SunLab-GMU/RusTEE-CompileTAinRust", "path": "/optee-utee/optee-utee-sys/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Make sure that each implementation is in agreement with the others. I // chain the assert statements together like since to hopefully return a // more readable error in case of a panic. assert_eq!(lemire_avx_ascii, lemire_avx); assert_eq!(lemire_avx, lemire_sse); assert_eq!(lemi...
code_fim
hard
{ "lang": "rust", "repo": "ArniDagur/rust-isutf8", "path": "/fuzz/fuzz_targets/agreement.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ArniDagur/rust-isutf8 path: /fuzz/fuzz_targets/agreement.rs #![no_main] use is_utf8::{lemire, libcore, range}; use libfuzzer_sys::fuzz_target; <|fim_suffix|> // Make sure that each implementation is in agreement with the others. I // chain the assert statements together like since to hop...
code_fim
hard
{ "lang": "rust", "repo": "ArniDagur/rust-isutf8", "path": "/fuzz/fuzz_targets/agreement.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(HTML_PAGE .replace("{{title}}", "oops!") .replace("{{content}}", "<h1>MY page</h1>") .to_string()) } } impl HtmlPage { pub fn new(pb: impl Into<PathBuf>) -> Self { Self { pb: pb.into(), content: None, title...
code_fim
hard
{ "lang": "rust", "repo": "shakyShane/topics", "path": "/topics_core/src/html.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shakyShane/topics path: /topics_core/src/html.rs use crate::context::Context; use crate::doc::Doc; use crate::doc_src::MdSrc; use crate::html_template::HtmlTemplate; use crate::items::{Item, LineMarker}; use crate::print::Print; use crate::{DbError, ErrorRef, Output, SerializedError}; use std::c...
code_fim
hard
{ "lang": "rust", "repo": "shakyShane/topics", "path": "/topics_core/src/html.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn output_html<'a>( graph: &'a HashMap<&'a String, Vec<&'a LineMarker<String>>>, lookup: &'a HashMap<&'a String, (&'a MdSrc<'a>, &'a Item)>, items: &'a Vec<(&'_ MdSrc, Vec<Item>)>, ) -> HtmlOutput { // let mut output = Output::default(); // let cycles = detect_cycle(graph, lookup);...
code_fim
hard
{ "lang": "rust", "repo": "shakyShane/topics", "path": "/topics_core/src/html.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl PartialEq for Hashable { fn eq(&self, other: &Self) -> bool { self.0.strict_eq(&other.0) } } impl Hash for Hashable { fn hash<H: Hasher>(&self, state: &mut H) { fn inner<H: Hasher>(v: &Value, state: &mut H) { match v { Value::Char(c) => { ...
code_fim
hard
{ "lang": "rust", "repo": "hermetique/eso", "path": "/rjam/src/value.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match v { Value::Int(i) => Some(i), _ => None, } } } impl FromValue for f64 { fn description() -> &'static str { "float" } fn matches(v: &Value) -> bool { matches!(v, Value::Real(_)) } fn from_value(v: Value) -> Option<Self> { ...
code_fim
hard
{ "lang": "rust", "repo": "hermetique/eso", "path": "/rjam/src/value.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hermetique/eso path: /rjam/src/value.rs pub use num_bigint::BigInt as Int; use num_traits::{Zero as _, ToPrimitive as _}; use std::cmp::Ordering; use std::fmt::Write as _; use std::hash::{Hash, Hasher}; use std::rc::Rc; use crate::bytecode::Bytecode; use crate::utils::{ f64_total_cmp, bigi...
code_fim
hard
{ "lang": "rust", "repo": "hermetique/eso", "path": "/rjam/src/value.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// CHECK: define { i32, i8 } @pair_i32_bool(i32 %pair.0, i1 zeroext %pair.1) #[no_mangle] pub fn pair_i32_bool(pair: (i32, bool)) -> (i32, bool) { pair } // CHECK: define { i8, i8 } @pair_and_or(i1 zeroext %arg0.0, i1 zeroext %arg0.1) #[no_mangle] pub fn pair_and_or((a, b): (bool, bool)) -> (bool, bo...
code_fim
medium
{ "lang": "rust", "repo": "unnsa/rust", "path": "/src/test/codegen/scalar-pair-bool.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: unnsa/rust path: /src/test/codegen/scalar-pair-bool.rs // Copyright 2018 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-APACHE or // htt...
code_fim
hard
{ "lang": "rust", "repo": "unnsa/rust", "path": "/src/test/codegen/scalar-pair-bool.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match variant { ACMD23_ARGU2_EN_A::ACMD23_ARGU2_EN_0 => false, ACMD23_ARGU2_EN_A::ACMD23_ARGU2_EN_1 => true, } } } #[doc = "Reader of field `ACMD23_ARGU2_EN`"] pub type ACMD23_ARGU2_EN_R = crate::R<bool, ACMD23_ARGU2_EN_A>; impl ACMD23_ARGU2_EN_R { #[doc = r"Get enumerated values v...
code_fim
hard
{ "lang": "rust", "repo": "rv32m1-rust/rv32m1_ri5cy-pac", "path": "/src/usdhc0/vend_spec2.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rv32m1-rust/rv32m1_ri5cy-pac path: /src/usdhc0/vend_spec2.rs #[doc = "Reader of register VEND_SPEC2"] pub type R = crate::R<u32, super::VEND_SPEC2>; #[doc = "Writer for register VEND_SPEC2"] pub type W = crate::W<u32, super::VEND_SPEC2>; #[doc = "Register VEND_SPEC2 `reset()`'s with value 0x1006...
code_fim
hard
{ "lang": "rust", "repo": "rv32m1-rust/rv32m1_ri5cy-pac", "path": "/src/usdhc0/vend_spec2.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[rustfmt::skip] let expected = &[ 5, // a // b is skipped 11, // str length b'H', b'e', b'l', b'l', b'o', b' ', b'w', b'o', b'r', b'l', b'd' // str ]; let mut result = [0u8; 20]; let len = bincode::serde::encode_into_slice(&input, &mut result, bincode:...
code_fim
hard
{ "lang": "rust", "repo": "mswdwk/bincode", "path": "/tests/serde.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut result = [0u8; 20]; let len = bincode::serde::encode_into_slice(&input, &mut result, bincode::config::standard()) .unwrap(); let result = &result[..len]; assert_eq!(result, expected); let result = bincode::serde::encode_to_vec(&input, bincode::config::standard()).unwra...
code_fim
hard
{ "lang": "rust", "repo": "mswdwk/bincode", "path": "/tests/serde.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mswdwk/bincode path: /tests/serde.rs #![cfg(all(feature = "serde", feature = "alloc", feature = "derive"))] extern crate alloc; use alloc::string::String; use serde_derive::{Deserialize, Serialize}; #[derive(Serialize, Deserialize, bincode::Encode, bincode::Decode)] #[serde(crate = "serde_inc...
code_fim
hard
{ "lang": "rust", "repo": "mswdwk/bincode", "path": "/tests/serde.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ykws/relly path: /src/main.rs mod disk; mod buffer; fn main() { <|fim_suffix|> println!("Hello, world!"); }<|fim_middle|> disk::DiskManager::check_call(); buffer::Buffer::check_call(); buffer::Frame::check_call(); buffer::BufferPool::check_call(); buffer::BufferPoolManager...
code_fim
medium
{ "lang": "rust", "repo": "ykws/relly", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("Hello, world!"); }<|fim_prefix|>// repo: ykws/relly path: /src/main.rs mod disk; mod buffer; fn main() { <|fim_middle|> disk::DiskManager::check_call(); buffer::Buffer::check_call(); buffer::Frame::check_call(); buffer::BufferPool::check_call(); buffer::BufferPoolManager...
code_fim
medium
{ "lang": "rust", "repo": "ykws/relly", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] pub fn test_generic_example_string() { let a = ExampleGeneric{x:"hej".to_string()}; assert_roundtrip(a); } #[test] pub fn test_generic_example2_string() { let a = ExampleGeneric2{x:"hej".to_string()}; assert_roundtrip(a); } #[test] pub fn test_generic_example3_tuple() { let a ...
code_fim
medium
{ "lang": "rust", "repo": "avl/savefile", "path": "/savefile-test/src/test_generic.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Savefile, Debug, PartialEq)] pub enum ExampleGenericEnum<T> { Value1, Value2(T), } #[test] pub fn test_generic_example_u32() { let a = ExampleGeneric{x:42u32}; assert_roundtrip(a); } #[test] pub fn test_generic_example_string() { let a = ExampleGeneric{x:"hej".to_string()}...
code_fim
hard
{ "lang": "rust", "repo": "avl/savefile", "path": "/savefile-test/src/test_generic.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: avl/savefile path: /savefile-test/src/test_generic.rs use std::fmt::Debug; use std::marker::{PhantomData, PhantomPinned}; use ::savefile::prelude::*; use assert_roundtrip; #[derive(Savefile, Debug, PartialEq)] pub struct ExampleGeneric<T> { pub x: T } #[derive(Savefile, Debug, PartialEq)]...
code_fim
medium
{ "lang": "rust", "repo": "avl/savefile", "path": "/savefile-test/src/test_generic.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Millimeters(self.0 + (other.0 * 1000)) } } fn main() { assert_eq!(Millimeters(100) + Meters(2), Millimeters(2100)); }<|fim_prefix|>// repo: marceloboeira/trpl path: /chapters/chapter-19/example09.rs use std::ops::Add; #[derive(Debug, PartialEq)] struct Millimeters(u32); #[derive(Debug,...
code_fim
medium
{ "lang": "rust", "repo": "marceloboeira/trpl", "path": "/chapters/chapter-19/example09.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marceloboeira/trpl path: /chapters/chapter-19/example09.rs use std::ops::Add; #[derive(Debug, PartialEq)] struct Millimeters(u32); #[derive(Debug, PartialEq)] struct Meters(u32); impl Add<Meters> for Millimeters { type Output = Millimeters; <|fim_suffix|> Millimeters(self.0 + (oth...
code_fim
easy
{ "lang": "rust", "repo": "marceloboeira/trpl", "path": "/chapters/chapter-19/example09.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HerringtonDarkholme/leetcode path: /src/1461_has_all_codes.rs impl Solution { pub fn has_all_codes(s: String, k: i32) -> bool { let s: Vec<_> = s.chars().collect(); let mut set = std::collections::HashSet:<|fim_suffix|>collect::<String>()); } set.len() == 2_us...
code_fim
medium
{ "lang": "rust", "repo": "HerringtonDarkholme/leetcode", "path": "/src/1461_has_all_codes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>:new(); for w in s.windows(k as usize) { set.insert(w.iter().collect::<String>()); } set.len() == 2_usize.pow(k as u32) } }<|fim_prefix|>// repo: HerringtonDarkholme/leetcode path: /src/1461_has_all_codes.rs impl Solution { pub fn has_all_codes(s: String, k: i3...
code_fim
medium
{ "lang": "rust", "repo": "HerringtonDarkholme/leetcode", "path": "/src/1461_has_all_codes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while min > 0 { let temp_n = n + n_max; let temp_x = (x + max) % MOD; if temp_x <= min { n = temp_n; x = temp_x; min = x; sum += x; println!("{:20} {:12} {:20}", n, x, sum); } if temp_x > max { ...
code_fim
hard
{ "lang": "rust", "repo": "sonygod/rust-project-euler", "path": "/euler700/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sonygod/rust-project-euler path: /euler700/src/main.rs fn main() { const INC: u64 = 1504170715041707_u64; const MOD: u64 = 4503599627370517_u64; // 试验的过程 let mut x = 0_u64; let mut min = INC; for n in 1_u64..9999999 { x = (x + INC) % MOD; if x <= min { ...
code_fim
hard
{ "lang": "rust", "repo": "sonygod/rust-project-euler", "path": "/euler700/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 第三种:最优美的算法 let inc = 1504170715041707_u64; let modular = 4503599627370517_u64; let mut low = inc; let mut high = inc; let mut sum = inc; while low > 0 { let next = (low + high) % modular; if next < low { low = next; sum += low; ...
code_fim
hard
{ "lang": "rust", "repo": "sonygod/rust-project-euler", "path": "/euler700/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/type-alias-impl-trait/issue-58951.rs // check-pass #![feature(type_alias_impl_trait)] type A = impl Iterator; <|fim_suffix|>pub fn use_a() { def_a().map(|x| x); } fn main() {}<|fim_middle|>fn def_a() -> A { 0..1 }
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/type-alias-impl-trait/issue-58951.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn use_a() { def_a().map(|x| x); } fn main() {}<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/type-alias-impl-trait/issue-58951.rs // check-pass #![feature(type_alias_impl_trait)] type A = impl Iterator; <|fim_middle|>fn def_a() -> A { 0..1 }
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/type-alias-impl-trait/issue-58951.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/devopsguru/src/operation.rs one::Clone, std::fmt::Debug)] pub struct AddNotificationChannel { _private: (), } impl AddNotificationChannel { /// Creates a new builder-style object to manufacture [`AddNotificationChannelInput`](crate::input::AddNotificationCh...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/devopsguru/src/operation.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mnts26/aws-sdk-rust path: /sdk/devopsguru/src/operation.rs le object to manufacture [`DescribeServiceIntegrationInput`](crate::input::DescribeServiceIntegrationInput) pub fn builder() -> crate::input::describe_service_integration_input::Builder { crate::input::describe_service_integr...
code_fim
hard
{ "lang": "rust", "repo": "mnts26/aws-sdk-rust", "path": "/sdk/devopsguru/src/operation.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::{Token, Tag}; #[test] fn token_new_test() { let _ = Token::new_numi32(10); let _ = Token::new_numf32(12.04); let _ = Token::new_word(Tag::Id, "abcdefghijklmn"); } }<|fim_prefix|>// repo: Yuta1004/dragonbook path: /src/chapter2/t...
code_fim
hard
{ "lang": "rust", "repo": "Yuta1004/dragonbook", "path": "/src/chapter2/token.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Yuta1004/dragonbook path: /src/chapter2/token.rs use std::fmt; use std::clone::Clone; use std::str::FromStr; /// Tag /// /// # derive /// - Clone /// - PartialEQ #[derive(Clone, PartialEq)] pub enum Tag { Id, // 語 Type, // 型 Symbol, // 記号 Primary, ...
code_fim
hard
{ "lang": "rust", "repo": "Yuta1004/dragonbook", "path": "/src/chapter2/token.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mozilla/gecko-dev path: /third_party/rust/icu_collections/src/codepointinvlist/utils.rs // This file is part of ICU4X. For terms of use, please see the file // called LICENSE at the top level of the ICU4X source tree // (online at: https://github.com/unicode-org/icu4x/blob/main/LICENSE ). use c...
code_fim
hard
{ "lang": "rust", "repo": "mozilla/gecko-dev", "path": "/third_party/rust/icu_collections/src/codepointinvlist/utils.rs", "mode": "psm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_suffix|> // deconstruct_range #[test] fn test_deconstruct_range() { let expected = (0x41, 0x45); let check = deconstruct_range(&('A'..'E')); // Range assert_eq!(check, expected); let check = deconstruct_range(&('A'..='D')); // Range Inclusive assert_eq!(check, e...
code_fim
hard
{ "lang": "rust", "repo": "mozilla/gecko-dev", "path": "/third_party/rust/icu_collections/src/codepointinvlist/utils.rs", "mode": "spm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_suffix|> sleep(250.ms()); } } const WDT_WKEY_VALUE: u32 = 0x50D83AA1; fn disable_timg_wdts(timg0: &mut target::TIMG0, timg1: &mut target::TIMG1) { timg0 .wdtwprotect .write(|w| unsafe { w.bits(WDT_WKEY_VALUE) }); timg1 .wdtwprotect .write(|w| unsafe { w.bits(WD...
code_fim
hard
{ "lang": "rust", "repo": "esp-rs/esp32-hal", "path": "/examples/dac.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: esp-rs/esp32-hal path: /examples/dac.rs #![no_std] #![no_main] use core::panic::PanicInfo; use esp32_hal::prelude::*; use esp32_hal::analog::dac::DAC; use esp32_hal::clock_control::sleep; use esp32_hal::dport::Split; use esp32_hal::target; #[no_mangle] fn main() -> ! { let dp = target::P...
code_fim
medium
{ "lang": "rust", "repo": "esp-rs/esp32-hal", "path": "/examples/dac.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // Ensure we have features thread::sleep(Duration::from_millis(500)); assert_eq!(true, client.is_enabled("default", None, false)); // Ensure the metrics get up-loaded thread::sleep(Duration::from_millis(500)); task::block_on(async { client.stop_p...
code_fim
hard
{ "lang": "rust", "repo": "humb1t/unleash-client-rust", "path": "/tests/functional.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_smoke_threaded() -> Result<(), Box<dyn std::error::Error + Send + Sync + 'static>> { let _ = simple_logger::init(); let config = EnvironmentConfig::from_env()?; let client = Arc::new(client::ClientBuilder::default().interval(500).into_client( &co...
code_fim
hard
{ "lang": "rust", "repo": "humb1t/unleash-client-rust", "path": "/tests/functional.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: humb1t/unleash-client-rust path: /tests/functional.rs // Copyright 2020 Cognite AS //! Functional test against an unleashed API server running locally. //! Set environment variables as per config.rs to exercise this. //! //! Currently expects a feature called default with one strategy default /...
code_fim
hard
{ "lang": "rust", "repo": "humb1t/unleash-client-rust", "path": "/tests/functional.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn new(spec: &JobSpec) -> Self { Self::with_data(JobData::new(spec)) } pub fn parse_job_spec(&mut self) -> Result<()> { let spec = &self.data.spec; let bench = super::bench::find_bench(&spec.kind)?; let desc = bench.desc(); if !desc.takes_run_props ...
code_fim
hard
{ "lang": "rust", "repo": "limkokholefork/resctl-demo", "path": "/resctl-bench/src/job.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: limkokholefork/resctl-demo path: /resctl-bench/src/job.rs // Copyright (c) Facebook, Inc. and its affiliates. use anyhow::{bail, Result}; use chrono::{DateTime, Local}; use log::warn; use serde::{Deserialize, Serialize}; use std::collections::BTreeSet; use std::fmt::Write; use std::fs; use std::...
code_fim
hard
{ "lang": "rust", "repo": "limkokholefork/resctl-demo", "path": "/resctl-bench/src/job.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let iocost = &data.sysreqs.iocost; if iocost.qos.enable > 0 { let model = &iocost.model; let qos = &iocost.qos; writeln!( buf, " iocost model: rbps={} rseqiops={} rrandiops={}", ...
code_fim
hard
{ "lang": "rust", "repo": "limkokholefork/resctl-demo", "path": "/resctl-bench/src/job.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>b fn adc_im_mask1(&self) -> ADC_IM_MASK1_R { ADC_IM_MASK1_R::new(((self.bits >> 1) & 0x01) != 0) } #[doc = "Bit 2 - SS2 Interrupt Mask"] #[inline(always)] pub fn adc_im_mask2(&self) -> ADC_IM_MASK2_R { ADC_IM_MASK2_R::new(((self.bits >> 2) & 0x01) != 0) } #[doc = "B...
code_fim
hard
{ "lang": "rust", "repo": "perlindgren/lm3s6965", "path": "/src/adc0/im.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: perlindgren/lm3s6965 path: /src/adc0/im.rs #[doc = "Reader of register IM"] pub type R = crate::R<u32, super::IM>; #[doc = "Writer for register IM"] pub type W = crate::W<u32, super::IM>; #[doc = "Register IM `reset()`'s with value 0"] impl crate::ResetValue for super::IM { type Type = u32; ...
code_fim
hard
{ "lang": "rust", "repo": "perlindgren/lm3s6965", "path": "/src/adc0/im.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub use self::bgrs_to_labs::{bgrs_to_labs, bgrs_to_labs_chunk}; pub use self::labs_to_bgrs::{labs_to_bgrs, labs_to_bgrs_chunk}; pub use self::labs_to_rgbs::{labs_to_rgbs, labs_to_rgbs_chunk}; pub use self::rgbs_to_labs::{rgbs_to_labs, rgbs_to_labs_chunk}; use super::{Lab, CBRT_EPSILON, EPSILON, KAPPA};<|f...
code_fim
medium
{ "lang": "rust", "repo": "kuviki/lab", "path": "/src/simd/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kuviki/lab path: /src/simd/mod.rs //! Experimental functions for parallel conversion using AVX and SSE4.1 //! //! This module is conditionally compiled by the cfg gate //! `#[cfg(target_arch = "x86_64")]` <|fim_suffix|>pub use self::bgrs_to_labs::{bgrs_to_labs, bgrs_to_labs_chunk}; pub use self...
code_fim
medium
{ "lang": "rust", "repo": "kuviki/lab", "path": "/src/simd/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jonkgrimes/artichoke path: /scolapasta-string-escape/src/unicode.rs #[doc(inline)] pub use core::char::REPLACEMENT_CHARACTER; /// The UTF-8 encoded byte representation of `U+FFFD REPLACEMENT CHARACTER` (�). /// /// # Examples /// /// ```ruby /// [2.6.3] > "\u{FFFD}" /// => "�" /// [2.6.3] > "\u...
code_fim
hard
{ "lang": "rust", "repo": "jonkgrimes/artichoke", "path": "/scolapasta-string-escape/src/unicode.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn unicode_replacement_bytes_to_char() { let enc = REPLACEMENT_CHARACTER_BYTES; let string = str::from_utf8(&enc).unwrap(); assert_eq!(string.chars().count(), 1); assert_eq!(string.chars().next().unwrap(), REPLACEMENT_CHARACTER); } }<|fim_prefix|>// repo...
code_fim
hard
{ "lang": "rust", "repo": "jonkgrimes/artichoke", "path": "/scolapasta-string-escape/src/unicode.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let enc = REPLACEMENT_CHARACTER_BYTES; let string = str::from_utf8(&enc).unwrap(); assert_eq!(string.chars().count(), 1); assert_eq!(string.chars().next().unwrap(), REPLACEMENT_CHARACTER); } }<|fim_prefix|>// repo: jonkgrimes/artichoke path: /scolapasta-string-escape/s...
code_fim
hard
{ "lang": "rust", "repo": "jonkgrimes/artichoke", "path": "/scolapasta-string-escape/src/unicode.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn on_signal(signal: i32) -> std::result::Result<(), i32> { match signal { SIGHUP => { warn!("SIGHUP."); Ok(()) } SIGTERM => { warn!("SIGTERM."); Err(0) } _ => { warn!("unknown signal."); Er...
code_fim
hard
{ "lang": "rust", "repo": "ari23/NetBricks", "path": "/examples/signals/src/main.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ari23/NetBricks path: /examples/signals/src/main.rs #[macro_use] extern crate log; extern crate netbricks; extern crate simplelog; use log::Level; use netbricks::common::Result; use netbricks::config::load_config; use netbricks::runtime::{Runtime, SIGHUP, SIGTERM}; use simplelog::{Config, LevelF...
code_fim
hard
{ "lang": "rust", "repo": "ari23/NetBricks", "path": "/examples/signals/src/main.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_suffix|>fn main() -> Result<()> { start_logger()?; let configuration = load_config()?; println!("{}", configuration); let mut runtime = Runtime::init(&configuration)?; runtime.set_on_signal(on_signal); runtime.execute() }<|fim_prefix|>// repo: ari23/NetBricks path: /examples/signals/src/m...
code_fim
hard
{ "lang": "rust", "repo": "ari23/NetBricks", "path": "/examples/signals/src/main.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stanxii/etcd-rs path: /src/raft/quorum/majority.rs use std::collections::HashSet; use std::fmt::{self, Formatter, Display, Write}; use std::process::id; use std::cmp::Ordering; use crate::raft::quorum::quorum::{AckedIndexer, Index}; #[derive(Clone)] pub struct MajorityConfig { pub(crate) vo...
code_fim
hard
{ "lang": "rust", "repo": "stanxii/etcd-rs", "path": "/src/raft/quorum/majority.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut majority = MajorityConfig::new(); majority.votes.insert(0); majority.votes.insert(1); assert_eq!("(0,1)", format!("{}", majority)); let mut majority = MajorityConfig::new(); assert_eq!("()", format!("{}", majority)); let v = &vec![0, 1, 2]; ...
code_fim
hard
{ "lang": "rust", "repo": "stanxii/etcd-rs", "path": "/src/raft/quorum/majority.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }