text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_prefix|>// repo: Overmuse/risk-manager path: /src/risk_manager.rs { pub fn new(datastore_url: String) -> Self { Self { kafka_consumer: None, alpaca_client: None, cash: Decimal::ZERO, holdings: HashMap::new(), is_pattern_day_trader: false, ...
code_fim
hard
{ "lang": "rust", "repo": "Overmuse/risk-manager", "path": "/src/risk_manager.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> manager.update_holdings("AAPL", Shares(Decimal::ONE), Price(Decimal::new(100, 0))); manager.update_cash(Decimal::new(300, 0)); assert_eq!(manager.long_market_exposure(), Decimal::new(100, 0)); assert_eq!(manager.short_market_exposure(), Decimal::ZERO); assert_eq!(ma...
code_fim
hard
{ "lang": "rust", "repo": "Overmuse/risk-manager", "path": "/src/risk_manager.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // This should default to an `AltNeu::Alt` timestamp. let mut changes = changes .enter(inner) ; for (join_idx, key_selector, mut trace) in join_plan.into_iter() { // Use alt or neu...
code_fim
hard
{ "lang": "rust", "repo": "TimelyDataflow/differential-dataflow", "path": "/interactive/src/plan/sfw.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TimelyDataflow/differential-dataflow path: /interactive/src/plan/sfw.rs This plan provides us the opportunity to map out a non-trivial differential //! implementation for a complex join query. In particular, we are able to invoke //! delta-query and worst-case optimal join plans, which avoid an...
code_fim
hard
{ "lang": "rust", "repo": "TimelyDataflow/differential-dataflow", "path": "/interactive/src/plan/sfw.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TimelyDataflow/differential-dataflow path: /interactive/src/plan/sfw.rs particular, we are able to invoke //! delta-query and worst-case optimal join plans, which avoid any intermediate //! materialization. //! //! Each `MultiwayJoin` indicates several source collections, equality constraints //...
code_fim
hard
{ "lang": "rust", "repo": "TimelyDataflow/differential-dataflow", "path": "/interactive/src/plan/sfw.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TheZoq2/pilander path: /src/bno055.rs extern crate nalgebra as na; use std::thread; use std::time::Duration; use i2cdev::core::I2CDevice; use i2cdev::linux::{LinuxI2CDevice, LinuxI2CError}; const MODE_CONFIG: u8 = 0x00; const MODE_NDOF: u8 = 0x0C; const OPR_MODE_REG: u8 = 0x3D; const POWER_...
code_fim
hard
{ "lang": "rust", "repo": "TheZoq2/pilander", "path": "/src/bno055.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_system_status(&mut self) -> Result<Bno055Status, LinuxI2CError> { let status = self.i2c_device.smbus_read_byte_data(SYSTEM_STATUS_ADDR)?; let error = if status == 0x01 { Some(self.i2c_device.smbus_read_byte_data(SYSTEM_ERROR_ADDR)?) } else { ...
code_fim
hard
{ "lang": "rust", "repo": "TheZoq2/pilander", "path": "/src/bno055.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> { Ok( na::Vector3::new( i2c_helpers::read_i16_i2c_big_endian(&mut self.i2c_device, start_addr)?, i2c_helpers::read_i16_i2c_big_endian(&mut self.i2c_device, start_addr + 2)?, i2c_helpers::read_i16_i2c_big_endian(&mut self.i2c_device, s...
code_fim
hard
{ "lang": "rust", "repo": "TheZoq2/pilander", "path": "/src/bno055.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: soruh/rust_i_telex_teilnehmerserver path: /src/telex_server/mod.rs #[macro_use] pub mod errors; pub mod background_tasks; pub mod client; const PEER_SEARCH_VERSION: u8 = 1; const FULL_QUERY_VERSION: u8 = 1; const LOGIN_VERSION: u8 = 1; // 1/1/1900 = 1/1/1970 - 70 Years + 17 Days // (for the 17...
code_fim
hard
{ "lang": "rust", "repo": "soruh/rust_i_telex_teilnehmerserver", "path": "/src/telex_server/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Err(err) = result.as_ref() { warn!("{:?}", err); } result } async fn start_handling_client(mut client: Client) -> TaskId { trace!("starting to handle client"); let task_id = { let mut task_id_counter = TASK_ID_COUNTER.lock().await; let mut task_id = *...
code_fim
hard
{ "lang": "rust", "repo": "soruh/rust_i_telex_teilnehmerserver", "path": "/src/telex_server/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let bottom = self.bottom(); let top = self.top(); hop::line(&bottom, &top, &t) } } impl<T: 'static + Copy> Ring for HyperbolaFunc<T> { type Output = PointFunc<(T, f64)>; fn ring(&self, t: f64) -> Self::Output { let bottom = self.bottom(); let top = self...
code_fim
hard
{ "lang": "rust", "repo": "advancedresearch/higher_order_point", "path": "/examples/hyperbola.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: advancedresearch/higher_order_point path: /examples/hyperbola.rs /* This example shows how to generate a hyperbolic shape by twisting circles connected by lines. */ extern crate piston; extern crate sdl2_window; extern crate opengl_graphics; extern crate graphics; extern crate higher_order_core...
code_fim
hard
{ "lang": "rust", "repo": "advancedresearch/higher_order_point", "path": "/examples/hyperbola.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: winksaville/fuchsia path: /third_party/rust_crates/vendor/rand-0.3.23/src/rand_impls.rs // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License,...
code_fim
hard
{ "lang": "rust", "repo": "winksaville/fuchsia", "path": "/third_party/rust_crates/vendor/rand-0.3.23/src/rand_impls.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let Open01(f) = rng.gen::<Open01<f32>>(); assert!(0.0 < f && f < 1.0); } } #[test] fn rand_closed() { let mut rng = thread_rng(); for _ in 0..1_000 { // strict inequalities let Closed01(f) = rng.gen::<Closed01<f64>>(); ...
code_fim
hard
{ "lang": "rust", "repo": "winksaville/fuchsia", "path": "/third_party/rust_crates/vendor/rand-0.3.23/src/rand_impls.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> Error::JSON(e) } } impl core::convert::From<SymmetricCipherError> for Error { fn from(e: SymmetricCipherError) -> Error { Error::AES(e) } } impl core::convert::From<std::net::AddrParseError> for Error { fn from(e: std::net::AddrParseError) -> Error { Error::AddrPars...
code_fim
hard
{ "lang": "rust", "repo": "garious/loom", "path": "/src/result.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: garious/loom path: /src/result.rs use std; use serde_json; use core; use crypto; use crypto::symmetriccipher::SymmetricCipherError; #[derive(Debug)] pub enum Error { IO(std::io::Error), JSON(serde_json::Error), AES(crypto::symmetriccipher::SymmetricCipherError), AddrParse(std::n...
code_fim
medium
{ "lang": "rust", "repo": "garious/loom", "path": "/src/result.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>impl core::convert::From<std::io::Error> for Error { fn from(e: std::io::Error) -> Error { Error::IO(e) } } impl core::convert::From<serde_json::Error> for Error { fn from(e: serde_json::Error) -> Error { Error::JSON(e) } } impl core::convert::From<SymmetricCipherError> for...
code_fim
hard
{ "lang": "rust", "repo": "garious/loom", "path": "/src/result.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match e { RpcCustomError::NonexistentClusterRoot { cluster_root, node_root, } => Self { code: ErrorCode::ServerError(JSON_RPC_SERVER_ERROR_0), message: format!( "Cluster largest_confirmed_ro...
code_fim
hard
{ "lang": "rust", "repo": "ChorusOne/sohlarna", "path": "/core/src/rpc_error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ChorusOne/sohlarna path: /core/src/rpc_error.rs use jsonrpc_core::{Error, ErrorCode}; use solana_sdk::clock::Slot; const JSON_RPC_SERVER_ERROR_0: i64 = -32000; const JSON_RPC_SERVER_ERROR_1: i64 = -32001; const JSON_RPC_SERVER_ERROR_2: i64 = -32002; <|fim_suffix|> match e { ...
code_fim
hard
{ "lang": "rust", "repo": "ChorusOne/sohlarna", "path": "/core/src/rpc_error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: inv2004/soa-derive path: /soa-derive-internal/src/lib.rs #![recursion_limit="512"] extern crate proc_macro; extern crate case; extern crate syn; #[macro_use] extern crate quote; <|fim_suffix|>#[proc_macro_derive(StructOfArray, attributes(soa_derive))] pub fn soa_derive(input: TokenStream) -> T...
code_fim
medium
{ "lang": "rust", "repo": "inv2004/soa-derive", "path": "/soa-derive-internal/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut generated = quote::Tokens::new(); generated.append(vec::derive(&input).as_str()); generated.append(refs::derive(&input).as_str()); generated.append(slice::derive_slice(&input).as_str()); generated.append(slice::derive_slice_mut(&input).as_str()); generated.append(iter::deri...
code_fim
hard
{ "lang": "rust", "repo": "inv2004/soa-derive", "path": "/soa-derive-internal/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[proc_macro_derive(StructOfArray, attributes(soa_derive))] pub fn soa_derive(input: TokenStream) -> TokenStream { let source = input.to_string(); let ast = syn::parse_macro_input(&source).unwrap(); let input = structs::Struct::new(ast); let mut generated = quote::Tokens::new(); gener...
code_fim
medium
{ "lang": "rust", "repo": "inv2004/soa-derive", "path": "/soa-derive-internal/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MadonnaMat/mbta_with_friends path: /src/schema.rs table! { friends (id) { id -> Int4, user_id -> Int4, friend_id -> Int4, } } table! { lines (id) { id -> Int4, name -> Varchar, } } table! { stops (id) { id -> Int4, nam...
code_fim
hard
{ "lang": "rust", "repo": "MadonnaMat/mbta_with_friends", "path": "/src/schema.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>allow_tables_to_appear_in_same_query!( friends, lines, stops, sublines, subline_stops, users, );<|fim_prefix|>// repo: MadonnaMat/mbta_with_friends path: /src/schema.rs table! { friends (id) { id -> Int4, user_id -> Int4, friend_id -> Int4, } } tab...
code_fim
hard
{ "lang": "rust", "repo": "MadonnaMat/mbta_with_friends", "path": "/src/schema.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn sound(sound_no: u32) -> SharedSound { Audio::instance().sounds[sound_no as usize].clone() } pub fn music(music_no: u32) -> SharedMusic { Audio::instance().musics[music_no as usize].clone() } pub fn play_pos(channel_no: u32) -> Option<(u32, u32)> { crate::channel(channel_no).lock().pla...
code_fim
hard
{ "lang": "rust", "repo": "kitao/pyxel", "path": "/crates/pyxel-core/src/audio.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Audio { channels: [SharedChannel; NUM_CHANNELS as usize], sounds: [SharedSound; NUM_SOUNDS as usize], musics: [SharedMusic; NUM_MUSICS as usize], } unsafe_singleton!(Audio); impl Audio { pub fn init() { let mut blip_buf = BlipBuf::new(NUM_SAMPLES as usize); bli...
code_fim
hard
{ "lang": "rust", "repo": "kitao/pyxel", "path": "/crates/pyxel-core/src/audio.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kitao/pyxel path: /crates/pyxel-core/src/audio.rs use std::array; use crate::blipbuf::BlipBuf; use crate::channel::{Channel, SharedChannel}; use crate::music::{Music, SharedMusic}; use crate::platform::{AudioCallback, Platform}; use crate::settings::{ CLOCK_RATE, NUM_CHANNELS, NUM_CLOCKS_PE...
code_fim
hard
{ "lang": "rust", "repo": "kitao/pyxel", "path": "/crates/pyxel-core/src/audio.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dan-win/fairways path: /h2a/src/errors.rs use actix::prelude::SendError; use actix::MailboxError; use actix_web::{error, Error as AWError, HttpResponse, ResponseError}; use amiquip; use derive_more::Display; // naming it clearly for illustration purposes use crate::messages::AmqpMessage; #[de...
code_fim
hard
{ "lang": "rust", "repo": "dan-win/fairways", "path": "/h2a/src/errors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> SvcError::ActixQueueOverflow } } impl From<amiquip::Error> for SvcError { fn from(error: amiquip::Error) -> Self { use amiquip::Error::*; // SvcError::GenericAmiquipError(error) let msg = format!("{}", error); match error { // The client closed...
code_fim
hard
{ "lang": "rust", "repo": "dan-win/fairways", "path": "/h2a/src/errors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lisiur/.leetcode path: /rust/leetcode/editor/cn/src/bin/29_divide_two_integers.rs struct Solution; //leetcode submit region begin(Prohibit modification and deletion) impl Solution { pub fn divide(mut dividend: i32, mut divisor: i32) -> i32 { // 处理溢出 if divisor == -1 && divide...
code_fim
hard
{ "lang": "rust", "repo": "lisiur/.leetcode", "path": "/rust/leetcode/editor/cn/src/bin/29_divide_two_integers.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn main() {} #[cfg(test)] mod tests { use super::Solution; #[test] fn test() { let dividend = i32::MIN; let divisor = -1; assert_eq!(i32::MAX, Solution::divide(dividend, divisor)); } }<|fim_prefix|>// repo: lisiur/.leetcode path: /rust/leetcode/editor/cn/src/bin/...
code_fim
hard
{ "lang": "rust", "repo": "lisiur/.leetcode", "path": "/rust/leetcode/editor/cn/src/bin/29_divide_two_integers.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: franziskuskiefer/nss-rust path: /src/nss-bindings/public/nss/ecl-exp.rs /* automatically generated by rust-bindgen */ #![allow(dead_code, non_camel_case_types, non_upper_case_globals, non_snake_case)] #[derive(Copy, Clone)] #[repr(u32)] #[derive(Debug)] pub enum ECFie...
code_fim
hard
{ "lang": "rust", "repo": "franziskuskiefer/nss-rust", "path": "/src/nss-bindings/public/nss/ecl-exp.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>NB431R1 = 36, ECCurve_SECG_PRIME_112R1 = 37, ECCurve_SECG_PRIME_112R2 = 38, ECCurve_SECG_PRIME_128R1 = 39, ECCurve_SECG_PRIME_128R2 = 40, ECCurve_SECG_PRIME_160K1 = 41, ECCurve_SECG_PRIME_160R1 = 42, ECCurve_SECG_PRIME_160R2 = 43, ECCurve_SECG_PRIME_192K1 = 44, ECCurve_...
code_fim
hard
{ "lang": "rust", "repo": "franziskuskiefer/nss-rust", "path": "/src/nss-bindings/public/nss/ecl-exp.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: judemoses/ev3dev-lang-rust path: /src/infrared_sensor.rs use core::Sensor; use core::Device; use core::SensorPort; use driver::Driver; use driver::Attribute; use driver::AttributeResult; /// Proximity pub const MODE_IR_PROX: &'static str = "IR-PROX"; /// IR Seeker pub const MODE_IR_SEEK: &'sta...
code_fim
hard
{ "lang": "rust", "repo": "judemoses/ev3dev-lang-rust", "path": "/src/infrared_sensor.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn set_mode_ir_seek(&mut self) -> AttributeResult<()> { self.set_mode(String::from(MODE_IR_SEEK)) } pub fn set_mode_ir_remote(&mut self) -> AttributeResult<()> { self.set_mode(String::from(MODE_IR_REMOTE)) } pub fn set_mode_ir_rem_a(&mut self) -> AttributeResult<(...
code_fim
hard
{ "lang": "rust", "repo": "judemoses/ev3dev-lang-rust", "path": "/src/infrared_sensor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Device for InfraredSensor { fn get_attribute(&mut self, name: &str) -> &Attribute { self.driver.get_attribute(name) } } impl InfraredSensor { /// Try to get a `InfraredSensor` on the given port. Returns `None` if port is not used or another device is connected. pub fn new(po...
code_fim
hard
{ "lang": "rust", "repo": "judemoses/ev3dev-lang-rust", "path": "/src/infrared_sensor.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut input = string.split(' '); let action = input.next().unwrap_or(""); let mut coords = input.map(|n| n.parse().unwrap_or(0)); match (action, coords.next(), coords.next()) { ("s", Some(x), Some(y)) => self.show_square(x - 1, y - 1), ("m", Some(...
code_fim
medium
{ "lang": "rust", "repo": "brett-boyle/Polyglot-Mine-Sweeper", "path": "/rust/src/board/console_input.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: brett-boyle/Polyglot-Mine-Sweeper path: /rust/src/board/console_input.rs /* Implements a trait which parses text input to actions. There are two possible actions: -Show a square (s x y) -Mark a square as a mine (m x y) */ <|fim_suffix|>pub trait ConsoleInput { fn console_input(&mu...
code_fim
medium
{ "lang": "rust", "repo": "brett-boyle/Polyglot-Mine-Sweeper", "path": "/rust/src/board/console_input.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut coords = input.map(|n| n.parse().unwrap_or(0)); match (action, coords.next(), coords.next()) { ("s", Some(x), Some(y)) => self.show_square(x - 1, y - 1), ("m", Some(x), Some(y)) => self.mark_square(x - 1, y - 1), _ => () } } }<|fim_pr...
code_fim
hard
{ "lang": "rust", "repo": "brett-boyle/Polyglot-Mine-Sweeper", "path": "/rust/src/board/console_input.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yalamber/Raspberry-SenseHat path: /pi3sensehat-rust/src/responses/response_announce.rs use serde_derive::Deserialize; use serde_derive::Serializ<|fim_suffix|>sponseAnnounce { pub status: &'static str, pub channel_address: String, pub announcement_tag: String, }<|fim_middle|>e; #[der...
code_fim
easy
{ "lang": "rust", "repo": "yalamber/Raspberry-SenseHat", "path": "/pi3sensehat-rust/src/responses/response_announce.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>sponseAnnounce { pub status: &'static str, pub channel_address: String, pub announcement_tag: String, }<|fim_prefix|>// repo: yalamber/Raspberry-SenseHat path: /pi3sensehat-rust/src/responses/response_announce.rs use serde_derive::Deserialize; use serde_derive::Serializ<|fim_middle|>e; #[der...
code_fim
easy
{ "lang": "rust", "repo": "yalamber/Raspberry-SenseHat", "path": "/pi3sensehat-rust/src/responses/response_announce.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Node { pub fn eval() { } }<|fim_prefix|>// repo: tak0g/rhabdophis path: /src/parser/node.rs use std::rc::Rc; use parser::token::Token; use object::object::PyObject; <|fim_middle|>#[derive(Debug)] pub struct Node { leaf: Token, child: Vec<Rc<PyObject>>, // left: Option<Box<Py...
code_fim
medium
{ "lang": "rust", "repo": "tak0g/rhabdophis", "path": "/src/parser/node.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tak0g/rhabdophis path: /src/parser/node.rs use std::rc::Rc; use parser::token::Token; <|fim_suffix|>#[derive(Debug)] pub struct Node { leaf: Token, child: Vec<Rc<PyObject>>, // left: Option<Box<PyObject>>, // right: Box<PyObject>, } impl Node { pub fn eval() { } }<|f...
code_fim
easy
{ "lang": "rust", "repo": "tak0g/rhabdophis", "path": "/src/parser/node.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub struct Node { leaf: Token, child: Vec<Rc<PyObject>>, // left: Option<Box<PyObject>>, // right: Box<PyObject>, } impl Node { pub fn eval() { } }<|fim_prefix|>// repo: tak0g/rhabdophis path: /src/parser/node.rs use std::rc::Rc; use parser::token::Token; <|f...
code_fim
easy
{ "lang": "rust", "repo": "tak0g/rhabdophis", "path": "/src/parser/node.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>macro_rules! trait_op { ($i:ident, $trait:path) => { impl $trait for Num { type Output = Num; fn $i(self, rhs: Self) -> Self::Output { self.pair(rhs).$i() } } }; } macro_rules! impl_op { ($i:ident, $op:path) => { impl...
code_fim
hard
{ "lang": "rust", "repo": "Niskigvan/jaq", "path": "/jaq-core/src/num.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match self { Typ::Int((l, r)) if l % r == 0 => Typ::Int(l / r), Typ::Int((l, r)) => Typ::Flt(l as f64 / r as f64), Typ::Flt((l, r)) => Typ::Flt(l / r), } } } impl PartialOrd for Num { fn partial_cmp(&self, other: &Self) -> Option<core::cmp::Orde...
code_fim
hard
{ "lang": "rust", "repo": "Niskigvan/jaq", "path": "/jaq-core/src/num.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Niskigvan/jaq path: /jaq-core/src/num.rs use core::convert::{TryFrom, TryInto}; use core::fmt; use serde_json::Number; pub type Num = Typ<i64, f64>; type Pair = Typ<(i64, i64), (f64, f64)>; #[derive(Copy, Clone, Debug, PartialEq, Eq)] pub enum Typ<I, F> { Int(I), Flt(F), } impl Num { ...
code_fim
hard
{ "lang": "rust", "repo": "Niskigvan/jaq", "path": "/jaq-core/src/num.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Servidor { pub nombre: String, pub url: String, }<|fim_prefix|>// repo: emigr2k1/mejoranime path: /src/anime.rs use serde::{Deserialize, Serialize}; #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] ...
code_fim
medium
{ "lang": "rust", "repo": "emigr2k1/mejoranime", "path": "/src/anime.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: emigr2k1/mejoranime path: /src/anime.rs use serde::{Deserialize, Serialize}; #[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)] pub struct Anime { pub titulo: String, pub sinopsis: String, pub puntuacion: f32, pub fecha_lanzamiento: String, pub tipo: String,...
code_fim
medium
{ "lang": "rust", "repo": "emigr2k1/mejoranime", "path": "/src/anime.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub use integer::*; pub use vector::*; pub use matrix::*; #[cfg(test)] mod tests;<|fim_prefix|>// repo: mathiasmagnusson/whm path: /src/lib.rs #[cfg(feature = "big-floats")] pub type Float = f64; #[cfg(not(feature = "big-floats"))] pub type Float = f32; <|fim_middle|>mod integer; mod vector; mod matrix...
code_fim
easy
{ "lang": "rust", "repo": "mathiasmagnusson/whm", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mathiasmagnusson/whm path: /src/lib.rs #[cfg(feature = "big-floats")] pub type Float = f64; #[cfg(not(feature = "big-floats"))] pub type Float = f32; <|fim_suffix|>pub use integer::*; pub use vector::*; pub use matrix::*; #[cfg(test)] mod tests;<|fim_middle|>mod integer; mod vector; mod matrix...
code_fim
easy
{ "lang": "rust", "repo": "mathiasmagnusson/whm", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: RaymondK99/advent_of_code_2018 path: /src/util/day_06.rs use super::Part; use std::collections::{HashSet, HashMap}; pub fn solve(input : String, part: Part) -> String { let result = match part { Part::Part1 => part1(parse(input.as_str())), Part::Part2 => part2(parse(input.a...
code_fim
hard
{ "lang": "rust", "repo": "RaymondK99/advent_of_code_2018", "path": "/src/util/day_06.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test1() { let input = "1, 1 1, 6 8, 3 3, 4 5, 5 8, 9"; //let res = part1(input.lines().collect()); let res = part1(parse(input)); println!("{:?}", res); assert_eq!(17, res); } #[test] fn test2() { let input = "1, 1 1, 6 8, 3 ...
code_fim
hard
{ "lang": "rust", "repo": "RaymondK99/advent_of_code_2018", "path": "/src/util/day_06.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn from_str(s: &str) -> Result<Self, Self::Err> { ensure!(s.is_ascii(), "String slice is not valid ASCII"); let x = s.trim().as_bytes(); let date = parse_imf_fixdate(x) .or_else(|_| parse_rfc850_date(x)) .or_else(|_| parse_asctime(x))?; ensure!(d...
code_fim
hard
{ "lang": "rust", "repo": "nephele-rs/nephele", "path": "/nephele/src/proto/h1/date.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let leap_years = ((http_date.year - 1) - 1968) / 4 - ((http_date.year - 1) - 1900) / 100 + ((http_date.year - 1) - 1600) / 400; let mut ydays = match http_date.month { 1 => 0, 2 => 31, 3 => 59, 4 => 90, 5 => 120, ...
code_fim
hard
{ "lang": "rust", "repo": "nephele-rs/nephele", "path": "/nephele/src/proto/h1/date.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nephele-rs/nephele path: /nephele/src/proto/h1/date.rs use std::fmt::{self, Display, Formatter}; use std::str::{from_utf8, FromStr}; use std::time::{Duration, SystemTime, UNIX_EPOCH}; use crate::{bail, ensure, format_err}; const IMF_FIXDATE_LENGTH: usize = 29; const RFC850_MAX_LENGTH: usize = ...
code_fim
hard
{ "lang": "rust", "repo": "nephele-rs/nephele", "path": "/nephele/src/proto/h1/date.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>uct File { file_id: String, file_size: Option<u64>, file_path: Option<String>, }<|fim_prefix|>// repo: thiagopnts/rust-telegram path: /src/file.rs use rustc_serialize::json::{self, ToJson, Js<|fim_middle|>on}; #[derive(RustcDecodable, Debug)] pub str
code_fim
easy
{ "lang": "rust", "repo": "thiagopnts/rust-telegram", "path": "/src/file.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thiagopnts/rust-telegram path: /src/file.rs use rustc_serialize::json::{self, ToJson, Js<|fim_suffix|>uct File { file_id: String, file_size: Option<u64>, file_path: Option<String>, }<|fim_middle|>on}; #[derive(RustcDecodable, Debug)] pub str
code_fim
easy
{ "lang": "rust", "repo": "thiagopnts/rust-telegram", "path": "/src/file.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: miker1423/atsamv71q21 path: /src/pwm0/oss.rs #[doc = "Register `OSS` writer"] pub struct W(crate::W<OSS_SPEC>); impl core::ops::Deref for W { type Target = crate::W<OSS_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl core::ops::DerefMut for W ...
code_fim
hard
{ "lang": "rust", "repo": "miker1423/atsamv71q21", "path": "/src/pwm0/oss.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>) -> OSSH0_W { OSSH0_W { w: self } } #[doc = "Bit 1 - Output Selection Set for PWMH output of the channel 1"] #[inline(always)] pub fn ossh1(&mut self) -> OSSH1_W { OSSH1_W { w: self } } #[doc = "Bit 2 - Output Selection Set for PWMH output of the channel 2"] #[...
code_fim
hard
{ "lang": "rust", "repo": "miker1423/atsamv71q21", "path": "/src/pwm0/oss.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/connectivity/wlan/wlancfg/src/util/fuse_pending.rs // Copyright 2019 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use futures::{ stream::{FusedStream, Stream, Str...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/connectivity/wlan/wlancfg/src/util/fuse_pending.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use { super::*, fuchsia_async as fasync, futures::{channel::mpsc, future, select, stream::FuturesOrdered}, pin_utils::pin_mut, }; #[fuchsia::test] fn infinite_stream() { let mut exec = fasync::TestExecutor::new().expect("Fai...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/connectivity/wlan/wlancfg/src/util/fuse_pending.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: saschagrunert/craft path: /src/util/errors.rs //! Error reporting and conversion use std::error::Error; use std::ffi; use std::fmt; use std::io; use std::num; use std::process::{Output, ExitStatus}; use std::str; use std::string; use curl; use git2; use rustc_serialize::json; use semver; use te...
code_fim
hard
{ "lang": "rust", "repo": "saschagrunert/craft", "path": "/src/util/errors.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return ProcessError { desc: desc, exit: status.cloned(), output: output.cloned(), cause: cause, }; #[cfg(unix)] fn status_to_string(status: &ExitStatus) -> String { use std::os::unix::process::*; use libc; if let Some(signal) = stat...
code_fim
hard
{ "lang": "rust", "repo": "saschagrunert/craft", "path": "/src/util/errors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fmt::Display::fmt(self, f) } } impl Error for ConcreteCraftError { fn description(&self) -> &str { &self.description } fn cause(&self) -> Option<&Error> { self.cause.as_ref().map(|c| { let e: &Error = &**c; e }) } } impl CraftEr...
code_fim
hard
{ "lang": "rust", "repo": "saschagrunert/craft", "path": "/src/util/errors.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: illef/pantin path: /examples/textbox.rs use pantin::*; mod util; use util::*; fn make_view() -> view::DockPanel<BasicEvent> { <|fim_suffix|>#[tokio::main] async fn main() { let (event_sender, event_receiver) = mpsc::channel(1024); tokio::spawn(send_key_event::<BasicEvent>(event_sender)...
code_fim
hard
{ "lang": "rust", "repo": "illef/pantin", "path": "/examples/textbox.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[tokio::main] async fn main() { let (event_sender, event_receiver) = mpsc::channel(1024); tokio::spawn(send_key_event::<BasicEvent>(event_sender)); run(make_view(), event_receiver).await; }<|fim_prefix|>// repo: illef/pantin path: /examples/textbox.rs use pantin::*; mod util; use util::*; ...
code_fim
hard
{ "lang": "rust", "repo": "illef/pantin", "path": "/examples/textbox.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: CarlosJordanDev/fuchsia-pine64-pinephone path: /src/developer/ffx/common/error/src/lib.rs // Copyright 2020 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. <|fim_suffix|>// Utility macro for constr...
code_fim
hard
{ "lang": "rust", "repo": "CarlosJordanDev/fuchsia-pine64-pinephone", "path": "/src/developer/ffx/common/error/src/lib.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>// Utility macro for constructing a FfxError::Error with a simple error string. #[macro_export] macro_rules! printable_error { ($error_message: expr) => {{ use ::ffx_error::FfxError; FfxError::Error(anyhow::anyhow!($error_message)) }}; }<|fim_prefix|>// repo: CarlosJordanDev/fuchsi...
code_fim
hard
{ "lang": "rust", "repo": "CarlosJordanDev/fuchsia-pine64-pinephone", "path": "/src/developer/ffx/common/error/src/lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 00mjk/lta-rs path: /src/async/client.rs //! Client for interacting with LTA API use crate::{Client, LTAError, LTAResult}; /// A `Client` to make requests with /// The `Client` holds a connection pool internally, so it is advised that you create one and reuse it /// There are some instance where...
code_fim
medium
{ "lang": "rust", "repo": "00mjk/lta-rs", "path": "/src/async/client.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if api_key.is_empty() { return Err(LTAError::InvalidAPIKey); } let client = reqwest::Client::new(); Ok(LTAClient { api_key, client }) } fn req_builder(&self, url: &str) -> Self::RB { self.client .get(url) .header("Account...
code_fim
medium
{ "lang": "rust", "repo": "00mjk/lta-rs", "path": "/src/async/client.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: drogue-iot/drogue-async-kernel path: /examples/blinky/ld2.rs use stm32l4xx_hal::gpio::{PB14, Output, PushPull}; use crate::app_kernel::AppEvent; use drogue_async_kernel::led::LEDEvent; <|fim_suffix|>impl From<&AppEvent> for Option<LEDEvent<LD2>> { fn from(event: &AppEvent) -> Self { ...
code_fim
medium
{ "lang": "rust", "repo": "drogue-iot/drogue-async-kernel", "path": "/examples/blinky/ld2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl From<&AppEvent> for Option<LEDEvent<LD2>> { fn from(event: &AppEvent) -> Self { match event { AppEvent::StartAlert => { Some(LEDEvent::off()) } AppEvent::StopAlert => { Some(LEDEvent::on()) } _ => ...
code_fim
medium
{ "lang": "rust", "repo": "drogue-iot/drogue-async-kernel", "path": "/examples/blinky/ld2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match event { AppEvent::StartAlert => { Some(LEDEvent::off()) } AppEvent::StopAlert => { Some(LEDEvent::on()) } _ => { None } } } }<|fim_prefix|>// repo: drogue-iot/d...
code_fim
medium
{ "lang": "rust", "repo": "drogue-iot/drogue-async-kernel", "path": "/examples/blinky/ld2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: johannst/chip-remu path: /src/cpu.rs use super::decoder; use super::gpu; use super::memory; const PROGRAM_START: u16 = 0x200; #[derive(PartialEq)] enum PCOp { Inc, Stay, SkipNext, JumpAddr(u16), } #[allow(non_snake_case)] pub struct Cpu { V: [u8; 16], I: u16, DT: u...
code_fim
hard
{ "lang": "rust", "repo": "johannst/chip-remu", "path": "/src/cpu.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // ---- Bit Operations ---- /// AndVxVy(vx, vy) => { self.V[vx] &= self.V[vy]; } ShlVxby1(v) => { // VF = Vx[7] self.V[15] = (self.V[v] & 0x80) as u8; self.V[v] <<= 1; } ...
code_fim
hard
{ "lang": "rust", "repo": "johannst/chip-remu", "path": "/src/cpu.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.PC == self.prev_PC { panic!("BUG: cpu stuck at {:04x}", self.PC); } if pc_op != PCOp::Stay { self.prev_PC = self.PC; } match pc_op { PCOp::Inc => { self.PC += 2; } PCOp::SkipNext =>...
code_fim
hard
{ "lang": "rust", "repo": "johannst/chip-remu", "path": "/src/cpu.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/futures-diagnose-exec path: /src/fut_with_diag.rs use crate::{ctxt_with_diag, log_out}; use pin_project::pin_project; use std::sync::atomic::{AtomicU64, Ordering}; use std::time::Instant; use std::{borrow::Cow, future::Future, pin::Pin, task::Context, task::Poll, thread::ThreadId}; use s...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/futures-diagnose-exec", "path": "/src/fut_with_diag.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let before = Instant::now(); let outcome = self.inner.poll(); let after = Instant::now(); let last_time = match outcome { Ok(futures01::Async::Ready(_)) => true, Ok(futures01::Async::NotReady) => false, Err(_) => true, }; ...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/futures-diagnose-exec", "path": "/src/fut_with_diag.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// A label with a pointer to the file's contents located in the __data table__. pub struct File<'a> { pub label: &'a [u8], pub data: usize, }<|fim_prefix|>// repo: isgasho/lateral path: /src/fs/file.rs pub enum FileType<'a> { Directory(Directory<'a>), File(File<'a>), } <|fim_middle|>/// ...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/lateral", "path": "/src/fs/file.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/lateral path: /src/fs/file.rs pub enum FileType<'a> { Directory(Directory<'a>), File(File<'a>), } <|fim_suffix|>// A label with a pointer to the file's contents located in the __data table__. pub struct File<'a> { pub label: &'a [u8], pub data: usize, }<|fim_middle|>/// ...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/lateral", "path": "/src/fs/file.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> { match self.description.as_ref() { Some(s) => s, None => UNKNOWN_ERROR_TEXT } } fn cause(&self) -> Option<&Error> { None } } #[cfg(test)] mod test { use std::error::Error; use super::*; // ugly duplication // const UNKNOWN...
code_fim
hard
{ "lang": "rust", "repo": "jojonv/rust-win32error", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jojonv/rust-win32error path: /src/lib.rs //! Error-like wrapper around win32 GetLastError and FormatMessage extern crate kernel32; use std::ptr; use std::slice; use std::fmt; use std::error::Error; use self::kernel32::{ GetLastError, FormatMessageW}; // const FORMAT_MESSAGE_FROM_STRING: u32...
code_fim
hard
{ "lang": "rust", "repo": "jojonv/rust-win32error", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benwilber/exitcode path: /examples/basic.rs extern crate exitcode; use std::process; use std::io::{Write, stderr}; <|fim_suffix|>pub fn main() { match parse_int_or_return_error_exitcode("foo") { Ok(i) => { println!("Parsed: {}", i); process::exit(exitcode::O...
code_fim
medium
{ "lang": "rust", "repo": "benwilber/exitcode", "path": "/examples/basic.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub fn main() { match parse_int_or_return_error_exitcode("foo") { Ok(i) => { println!("Parsed: {}", i); process::exit(exitcode::OK); }, Err(code) => { writeln!(stderr(), "Parse error. Exiting with code: {}", code).unwrap(); proce...
code_fim
medium
{ "lang": "rust", "repo": "benwilber/exitcode", "path": "/examples/basic.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-console/voladdress path: /src/volblock.rs use super::*; /// A volatile memory block. /// /// This is intended to model when a portion of memory is an array of identical /// values in a row, such as a block of 256 `u16` values in a row. /// /// ## Generic Parameters /// * `T` / `R` / `W`: T...
code_fim
hard
{ "lang": "rust", "repo": "rust-console/voladdress", "path": "/src/volblock.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let i_c = i.clone().map(|a| a.as_usize()); assert_eq!(i_c.last(), Some(8)); let mut i_c = i.clone().map(|a| a.as_usize()); assert_eq!(i_c.nth(0), Some(2)); assert_eq!(i_c.nth(0), Some(4)); assert_eq!(i_c.nth(0), Some(6)); assert_eq!(i_c.nth(0), Some(8)); assert_eq!(i_c.nth(0), None); as...
code_fim
hard
{ "lang": "rust", "repo": "rust-console/voladdress", "path": "/src/volblock.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> //~^ ERROR invalid suffix `p4f64` for integer literal }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/parser/no-binary-float-literal.rs fn main() { 0b101010f64; //~^ ERROR binary float<|fim_middle|> literal is not supported 0b101.010; //~^ ERROR binary float l...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/parser/no-binary-float-literal.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/parser/no-binary-float-literal.rs fn main() { 0b101010f64; //~^ ERROR binary float<|fim_suffix|>binary float literal is not supported 0b101p4f64; //~^ ERROR invalid suffix `p4f64` for integer literal }<|fim_middle|> literal is no...
code_fim
easy
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/parser/no-binary-float-literal.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if result == 0 { error!("failed to allocate console, LastError: {:#}", GetLastError()); return Err(error::Error::win32_error()); } } let con_win = GetConsoleWindow(); if con_win == std::ptr::null_mut() as HWND { ...
code_fim
medium
{ "lang": "rust", "repo": "noonebtw/utils-rs", "path": "/src/conutils.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: noonebtw/utils-rs path: /src/conutils.rs use winapi::um::consoleapi::AllocConsole; use winapi::um::winuser::{ShowWindow, SW_SHOW}; use winapi::um::wincon::{GetConsoleWindow, FreeConsole}; use winapi::shared::windef::HWND; use winapi::um::errhandlingapi::GetLastError; <|fim_suffix|> ...
code_fim
hard
{ "lang": "rust", "repo": "noonebtw/utils-rs", "path": "/src/conutils.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.reboot(); } fn reboot(&mut self) -> ! { duprintln!(self.serial, "Rebooting..."); SCB::sys_reset(); } fn recover_internal(&mut self, golden: bool) -> Result<(), Error> { if self.serial.is_none() { return Err(Error::NoRecoverySupport); ...
code_fim
hard
{ "lang": "rust", "repo": "tweedegolf/loadstone", "path": "/src/devices/bootloader/recover.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if self.serial.is_none() { return Err(Error::NoRecoverySupport); } if let Some(bank) = self.mcu_banks.iter().find(|b| b.is_golden == golden) { duprintln!( self.serial, "Please send{} firmware image via XMODEM.", ...
code_fim
hard
{ "lang": "rust", "repo": "tweedegolf/loadstone", "path": "/src/devices/bootloader/recover.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tweedegolf/loadstone path: /src/devices/bootloader/recover.rs use crate::devices::{cli::file_transfer::FileTransfer, update_signal::ReadUpdateSignal}; use super::*; impl< EXTF: Flash, MCUF: Flash, SRL: Serial, T: time::Now, R: image::Reader, RUS:...
code_fim
hard
{ "lang": "rust", "repo": "tweedegolf/loadstone", "path": "/src/devices/bootloader/recover.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> args.push(author); } for committer in &committers { args.push("--committer"); args.push(committer); } let commits = cmd("git", &args).read()?; Ok(commits) }<|fim_prefix|>// repo: codeprintsdev/analyzer path: /src/git.rs use anyhow::Result; use duct::cmd; /// Get th...
code_fim
hard
{ "lang": "rust", "repo": "codeprintsdev/analyzer", "path": "/src/git.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: codeprintsdev/analyzer path: /src/git.rs use anyhow::Result; use duct::cmd; /// Get the count of commits for each day from the git logs pub fn count_commits( before: Option<String>, after: Option<String>, authors: Vec<String>, committers: Vec<String>, ) -> Result<String> { l...
code_fim
medium
{ "lang": "rust", "repo": "codeprintsdev/analyzer", "path": "/src/git.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sbchaos/cake path: /src/packages/deps.rs use crate::ofs::utils::size_human; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; #[derive(PartialEq, Serialize, Deserialize)] pub struct Package { pub name: String, pub version: String, pub size: u64, pub optional: bool, } ...
code_fim
hard
{ "lang": "rust", "repo": "sbchaos/cake", "path": "/src/packages/deps.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn get_installed_packages(self) -> Vec<Package>; fn get_cache(&self) -> Option<Cache>; fn get_wasted_bytes(&self) -> u64; }<|fim_prefix|>// repo: sbchaos/cake path: /src/packages/deps.rs use crate::ofs::utils::size_human; use serde::{Deserialize, Serialize}; use std::cmp::Ordering; #[derive(...
code_fim
medium
{ "lang": "rust", "repo": "sbchaos/cake", "path": "/src/packages/deps.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("Soma diagonal principal = {}", soma); println!(); print!("Tecle <Enter> para encerrar..."); io::stdout().flush().unwrap(); io::stdin().read(&mut [0u8]).unwrap(); }<|fim_prefix|>// repo: J-AugustoManzano/livro_Rust path: /ExerciciosFixacao/Cap07/c07Exer3C/src/main.rs use st...
code_fim
hard
{ "lang": "rust", "repo": "J-AugustoManzano/livro_Rust", "path": "/ExerciciosFixacao/Cap07/c07Exer3C/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for i in 0 .. 8 { for j in 0 .. 8 { if i == j { soma += a[j][i]; } } } println!("Soma diagonal principal = {}", soma); println!(); print!("Tecle <Enter> para encerrar..."); io::stdout().flush().unwrap(); io::stdin().read(&...
code_fim
hard
{ "lang": "rust", "repo": "J-AugustoManzano/livro_Rust", "path": "/ExerciciosFixacao/Cap07/c07Exer3C/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }