text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> self.inner.as_ref() } } impl CssGroupingRule for CssMediaRule {} impl css_condition_rule_seal::Seal for CssMediaRule { fn as_web_sys_css_condition_rule(&self) -> &web_sys::CssConditionRule { self.inner.as_ref() } } impl CssConditionRule for CssMediaRule {} impl From<web_sys...
code_fim
hard
{ "lang": "rust", "repo": "RSSchermer/ARWA", "path": "/arwa/src/cssom/css_media_rule.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>d percentage?"); } else if matches.is_present("volume") { run_mpv_command(&mpv, "set_property", &["volume", matches.value_of("volume").unwrap()]) .expect("Could not set the volume, are you sure you used a valid percentage?"); } } else if let Some(matches) = ...
code_fim
hard
{ "lang": "rust", "repo": "Phate6660/rsmpv", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Phate6660/rsmpv path: /src/main.rs use clap::{App, Arg, SubCommand}; use mpvipc::{ipc::run_mpv_command, Mpv}; fn main() { let matches = App::new("rsmpv") .version("0.0.1") .about("\nA controller for mpv written in Rust, requires ipc to be enabled in mpv.") .subcomman...
code_fim
hard
{ "lang": "rust", "repo": "Phate6660/rsmpv", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>et").unwrap(); if matches.is_present("clear") { run_mpv_command(&mpv, "clear-playlist", &[""]) .expect("Could not play mpv, are you sure that the ipc-server is set to /tmp/mpvsocket?"); } else if let Some(matches) = matches.subcommand_matches("set") { if matches.is_pres...
code_fim
hard
{ "lang": "rust", "repo": "Phate6660/rsmpv", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>mod subwords_widget; pub use self::subwords_widget::SubwordsWidget; pub trait EmbeddingsWidget { fn model(&self) -> &dyn EmbeddingsModel; fn update_validity(&self); }<|fim_prefix|>// repo: finalfusion/finalfusion-inspector path: /src/ui/mod.rs use crate::models::EmbeddingsModel; mod analogy_wi...
code_fim
hard
{ "lang": "rust", "repo": "finalfusion/finalfusion-inspector", "path": "/src/ui/mod.rs", "mode": "spm", "license": "BlueOak-1.0.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: finalfusion/finalfusion-inspector path: /src/ui/mod.rs use crate::models::EmbeddingsModel; mod analogy_widget; pub use self::analogy_widget::AnalogyWidget; mod basic_dialogs; pub use self::basic_dialogs::{open_embeddings, show_error}; mod inspector_window; pub use self::inspector_window::Insp...
code_fim
medium
{ "lang": "rust", "repo": "finalfusion/finalfusion-inspector", "path": "/src/ui/mod.rs", "mode": "psm", "license": "BlueOak-1.0.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hayashikun/atcoder path: /atcoder-rust/abc191/src/bin/f.rs use std::collections::HashMap; use num_integer::gcd; use proconio::{fastout, input}; <|fim_suffix|> aa.sort(); aa.dedup(); let min = aa[0]; let mut map = HashMap::new(); for a in aa { for i in 1.. { ...
code_fim
medium
{ "lang": "rust", "repo": "hayashikun/atcoder", "path": "/atcoder-rust/abc191/src/bin/f.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let min = aa[0]; let mut map = HashMap::new(); for a in aa { for i in 1.. { if i * i > a { break; } if a % i != 0 { continue; } if i < min { let p = map.entry(i).or_insert(a); ...
code_fim
medium
{ "lang": "rust", "repo": "hayashikun/atcoder", "path": "/atcoder-rust/abc191/src/bin/f.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match rvm::vm::run(bytecode) { Ok(context) => debug!("Execution ok\nbacktrace registers: {:?}\nbacktrace stack: {:?}", context.registers, context.stack), _ => println!("Error in execution") } }<|fim_prefix|>// repo: xermicus/rvm path: /src/main.rs use std::env; use std::process::exit; mod rvm; ...
code_fim
hard
{ "lang": "rust", "repo": "xermicus/rvm", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xermicus/rvm path: /src/main.rs use std::env; use std::process::exit; mod rvm; #[macro_use] extern crate log; fn main() { let filepath: String; let bytecode: rvm::Bytecode; if let Some (arg1) = env::args().nth(1) { filepath = arg1; } else { println!("Usage: ./rvm ...
code_fim
hard
{ "lang": "rust", "repo": "xermicus/rvm", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> debug!("Assembling {}", filepath); match rvm::parser::assemble_file(&filepath) { Ok(assembly) => { debug!("success!"); bytecode = assembly; }, _ => { println!("failed to parse file {}", filepath); exit(1) } } match rvm::vm::run(bytecode) { Ok(context) => debug!("Execution ok\nbacktrace register...
code_fim
hard
{ "lang": "rust", "repo": "xermicus/rvm", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Error for SkeletonError { fn description(&self) -> &str { match *self { SkeletonError::BoneNotFound(_) => "bone cannot be found in skeleton bones", SkeletonError::SlotNotFound(_) => "slot cannot be found in skeleton slots", SkeletonError::SkinNotFound(_...
code_fim
hard
{ "lang": "rust", "repo": "reeFridge/spine-rs", "path": "/src/skeleton/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// The requested animation was not found. AnimationNotFound(String), } impl fmt::Debug for SkeletonError { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { match *self { SkeletonError::BoneNotFound(ref name) => write!(f, "Cannot find bone '{}'", name), S...
code_fim
medium
{ "lang": "rust", "repo": "reeFridge/spine-rs", "path": "/src/skeleton/error.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reeFridge/spine-rs path: /src/skeleton/error.rs //! Module to handle all spine errors use rustc_hex::FromHexError; use serde_json::error::Error as SerdeError; use std::fmt; use std::error::Error; /// Error that can happen while calculating an animation. pub enum SkeletonError { /// Parser...
code_fim
hard
{ "lang": "rust", "repo": "reeFridge/spine-rs", "path": "/src/skeleton/error.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>"{:?}", node); //! } //! ``` #![feature(array_map, or_patterns)] pub mod syntax; pub mod semantic;<|fim_prefix|>// repo: metarmask/vox-format path: /src/lib.rs //! Allows parsing and writing MagicaVoxel files, including manipulating //! them using a [semantic](`semantic`) representation. //! # Reading a...
code_fim
medium
{ "lang": "rust", "repo": "metarmask/vox-format", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: metarmask/vox-format path: /src/lib.rs //! Allows parsing and writing MagicaVoxel files, including manipulating //! them using a [semanti<|fim_suffix|>"{:?}", node); //! } //! ``` #![feature(array_map, or_patterns)] pub mod syntax; pub mod semantic;<|fim_middle|>c](`semantic`) representation. /...
code_fim
medium
{ "lang": "rust", "repo": "metarmask/vox-format", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jenarvaezg/aoc2020 path: /src/solutions/day1.old.rs use io::Result; use crate::solver::Solver; use std::io::{self, BufRead, BufReader}; pub struct Problem; impl Solver for Problem { type Input = Vec<u64>; type Output = u64; fn parse_input<R: io::Read + io::Seek>(&self, r: R) -> S...
code_fim
hard
{ "lang": "rust", "repo": "jenarvaezg/aoc2020", "path": "/src/solutions/day1.old.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ((mass as f64 / 3f64).floor() - 2f64) as u64 } fn total_fuel_mass(mass: u64) -> u64 { match mass { 0 => 0, _ => { let fuel = module_fuel(mass); fuel + total_fuel_mass(fuel).max(0) } } } #[cfg(test)] mod tests { use super::*; #[test] ...
code_fim
hard
{ "lang": "rust", "repo": "jenarvaezg/aoc2020", "path": "/src/solutions/day1.old.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match mass { 0 => 0, _ => { let fuel = module_fuel(mass); fuel + total_fuel_mass(fuel).max(0) } } } #[cfg(test)] mod tests { use super::*; #[test] fn test_module_fuel() { assert_eq!(module_fuel(12), 2); assert_eq!(module...
code_fim
hard
{ "lang": "rust", "repo": "jenarvaezg/aoc2020", "path": "/src/solutions/day1.old.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let trimmed_highlight = highlight.highlight.iter() .skip(self.offset.x) .take(self.screen.x); for (ch, hl) in trimmed_row.chars().zip(trimmed_highlight) { let color = hl.color(); let color_chan...
code_fim
hard
{ "lang": "rust", "repo": "sam-roth/kilo-rust", "path": "/src/editor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sam-roth/kilo-rust path: /src/editor.rs et ioctl_rv = unsafe { libc::ioctl(1, libc::TIOCGWINSZ, &mut ws) }; if ioctl_rv == -1 { return Err(io::Error::last_os_error()); } Ok(Pos {x: ws.ws_col as usize, y: ws.ws_row as usize}) } #[derive(Default)] str...
code_fim
hard
{ "lang": "rust", "repo": "sam-roth/kilo-rust", "path": "/src/editor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sam-roth/kilo-rust path: /src/editor.rs if let Some((to_byte_index, _)) = to_byte_index { let slice = &s[..to_byte_index]; if let Some(match_byte_index) = slice.rfind(query) { let match_char_index = slice.char_indices() .position(|(i, _)| i == match...
code_fim
hard
{ "lang": "rust", "repo": "sam-roth/kilo-rust", "path": "/src/editor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akubera/flo path: /flo-server/src/server/mod.rs mod flo_io; mod server_options; use futures::{Stream, Sink, Future}; use tokio_core::net::{TcpStream, TcpListener}; use event_loops; use std::net::{SocketAddr, Ipv4Addr, SocketAddrV4}; use std::io; pub use self::server_options::{ServerOptions, ...
code_fim
hard
{ "lang": "rust", "repo": "akubera/flo", "path": "/flo-server/src/server/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let client_to_server = connection_handler .send_all(client_message_stream) .map(|_| ()); client_to_server.select(server_to_client).then(move |res| { if let Err((err, _)) = res { war...
code_fim
hard
{ "lang": "rust", "repo": "akubera/flo", "path": "/flo-server/src/server/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let server_to_client = ServerMessageStream::new(connection_id, client_rx, tcp_writer); let client_message_stream = ProtocolMessageStream::new(connection_id, tcp_reader); let connection_handler = ConnectionHandler::new( connection_id, ...
code_fim
hard
{ "lang": "rust", "repo": "akubera/flo", "path": "/flo-server/src/server/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mut state: ResMut<bevy::prelude::State<AppState>>, window: Res<Windows>, mut messages_to_send: ResMut<MessagesToSend>, mouse_button_input: Res<Input<MouseButton>>, mut ev_cursor: EventReader<CursorMoved>, q_camera: Query<&Transform, With<MainCamera>>, ) { if state.current() != ...
code_fim
hard
{ "lang": "rust", "repo": "Vrixyz/multiplayer", "path": "/client/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Vrixyz/multiplayer path: /client/src/main.rs use bevy::{math::Vec2, prelude::*}; use menu::AppState; use multiplayer_plugin::client::*; use shared::{ClientMessage, Command, Id}; mod menu; struct FollowCamera; struct UnitMaterial { pub mat: Handle<ColorMaterial>, } struct MainCamera; fn ma...
code_fim
hard
{ "lang": "rust", "repo": "Vrixyz/multiplayer", "path": "/client/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let call = fooCall { a: U256::from(1), b: U256::from(2), }; let _call_data = call.encode(); // the signatures are unaffected let _ = overloaded_0Call {}; assert_call_signature::<overloaded_0Call>("overloaded()"); let _ = overloaded_1Call { _0: U256::from(1) };...
code_fim
hard
{ "lang": "rust", "repo": "roynalnaruto/core", "path": "/crates/sol-types/tests/doctests/function_like.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert_error_signature::<MyError>("MyError(uint256,uint256)"); let call_data = hex!( "0000000000000000000000000000000000000000000000000000000000000001" "0000000000000000000000000000000000000000000000000000000000000002" ); assert_eq!( MyError::decode_raw(&call_data, ...
code_fim
hard
{ "lang": "rust", "repo": "roynalnaruto/core", "path": "/crates/sol-types/tests/doctests/function_like.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: roynalnaruto/core path: /crates/sol-types/tests/doctests/function_like.rs use alloy_primitives::{keccak256, U256}; use alloy_sol_types::{sol, SolCall, SolError}; use hex_literal::hex; // Unnamed arguments will be given a name based on their position, // e.g. `_0`, `_1`... // // A current limita...
code_fim
hard
{ "lang": "rust", "repo": "roynalnaruto/core", "path": "/crates/sol-types/tests/doctests/function_like.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rustfmt path: /tests/target/string-lit-2.rs fn main() -> &'static str { let too_many_lines = "Hello"; let leave_me = "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss\ s jjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjjj...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustfmt", "path": "/tests/target/string-lit-2.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let msg = "eedadn\n\ drvtee\n\ eandsr\n\ raavrd\n\ atevrs\n\ tsrnev\n\ sdttsa\n\ rasrtv\n\ nssdts\n\ ntnada\n\ svetve\n\ tesnvt\n\ ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rustfmt", "path": "/tests/target/string-lit-2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] pub fn should_parse_dockerfile() { let dockerfile = analysis(&dockerfile_dir().join("Go.Dockerfile")); for stage in dockerfile.iter_stages() { println!("stage #{}", stage.index); for ins in stage.instructions { println!(" {:?}", ins...
code_fim
hard
{ "lang": "rust", "repo": "chalme/coco", "path": "/plugins/coco_container/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chalme/coco path: /plugins/coco_container/src/lib.rs use core_model::CocoConfig; use core_model::PluginInterface; pub mod coco_container_plugin; pub struct CocoContainer {} impl PluginInterface for CocoContainer { fn name(&self) -> &'static str { "coco.swagger" } fn on_pl...
code_fim
hard
{ "lang": "rust", "repo": "chalme/coco", "path": "/plugins/coco_container/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> return root_dir.clone().join("_fixtures").join("dockerfile"); } #[test] pub fn should_parse_dockerfile() { let dockerfile = analysis(&dockerfile_dir().join("Go.Dockerfile")); for stage in dockerfile.iter_stages() { println!("stage #{}", stage.index); ...
code_fim
hard
{ "lang": "rust", "repo": "chalme/coco", "path": "/plugins/coco_container/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: crodjer/memorable path: /src/lib.rs // This is set so that `infer_schema` done by `src/schema.rs` does not fail. #![recursion_limit="128"] //! Memorable is a URL shortner using the iron web framework and PostgreSQL //! (via diesel). <|fim_suffix|> extern crate dotenv; extern crate iron; extern...
code_fim
medium
{ "lang": "rust", "repo": "crodjer/memorable", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> extern crate dotenv; extern crate iron; extern crate params; extern crate r2d2; extern crate r2d2_diesel; extern crate rand; extern crate router; extern crate url; pub mod db; pub mod error; pub mod handlers; pub mod middleware; pub mod models; pub mod schema; pub mod server;<|fim_prefix|>// repo: crodj...
code_fim
medium
{ "lang": "rust", "repo": "crodjer/memorable", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>; / / ! / / ! let c = atlas . allocate ( size2 ( 300 200 ) ) . unwrap ( ) ; / / ! / / ! atlas . deallocate ( c . id ) ; / / ! atlas . deallocate ( b . id ) ; / / ! / / ! / / ! # # License / / ! / / ! Licensed under either of / / ! / / ! * Apache License Version 2 . 0 ( [ LICENSE - APACHE ] ( LICENSE - APA...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/etagere/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/etagere/src/lib.rs / / ! Dynamic texture atlas allocation using the shelf packing algorithm . / / ! / / ! # # Texture atlas allocation / / ! / / ! The goal of a texture atlas allocator is to pack multiple rectangles into a larger one . / / ! Wh...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/etagere/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>es . / / / / / / Default value : false . pub vertical_shelves : bool / / / If possible split the allocator ' s surface into multiple columns . / / / / / / Having multiple columns allows having more ( smaller shelves ) . / / / / / / Default value : 1 . pub num_columns : i32 } pub const DEFAULT_OPTIONS : Al...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/etagere/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: harshasrisri/aoc path: /2022/src/day04.rs use sscanf::sscanf; use std::collections::HashSet; pub fn run(input: &'static str) -> (usize, usize) { input .lines() .map(|line| { let (s1, e1, s2, e2) = sscanf!(line, "{usize}-{usize},{usize}-{usize}").unwrap(); ...
code_fim
medium
{ "lang": "rust", "repo": "harshasrisri/aoc", "path": "/2022/src/day04.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let input = "\ 2-4,6-8 2-3,4-5 5-7,7-9 2-8,3-7 6-6,4-6 2-6,4-8 "; assert_eq!(run(input), (2, 4)); }<|fim_prefix|>// repo: harshasrisri/aoc path: /2022/src/day04.rs use sscanf::sscanf; use std::collections::HashSet; pub fn run(input: &'static str) -> (usize, usize) { input .lines() ...
code_fim
medium
{ "lang": "rust", "repo": "harshasrisri/aoc", "path": "/2022/src/day04.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let _green = (118, 237, 34); let _red = (212, 83, 54); let _white = (242, 246, 232); let colors = [ ("green", _green), ("red", _red), ("white", _white), ]; // these parameters work very well on the test images! let span = 4; let y = 1080 / 2; l...
code_fim
hard
{ "lang": "rust", "repo": "dxenonb/risk-of-rain-2-command-driver", "path": "/examples/screen_sampler.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dxenonb/risk-of-rain-2-command-driver path: /examples/screen_sampler.rs use ror2_command::average_distance2; fn main() { let green_items = image::open("./screens/green_items.jpg") .unwrap(); let green_items = green_items.as_rgb8() .unwrap(); let red_items = image::o...
code_fim
hard
{ "lang": "rust", "repo": "dxenonb/risk-of-rain-2-command-driver", "path": "/examples/screen_sampler.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for (name, value) in &colors { println!("Avg distance for {}", name); let mut dist; dist = average_distance2(green_items, value, x, y, span); println!("\tgreen items: {}", dist); dist = average_distance2(red_items, value, x, y, span); println!("\tred i...
code_fim
hard
{ "lang": "rust", "repo": "dxenonb/risk-of-rain-2-command-driver", "path": "/examples/screen_sampler.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Atul9/basalt path: /src/interface/interface.rs use std::sync::{Arc,Weak}; use std::collections::BTreeMap; use Basalt; use super::bin::Bin; use parking_lot::{Mutex,RwLock}; use interface::text::Text; use interface::odb::OrderedDualBuffer; use interface::hook::HookManager; impl_vertex!(ItfVertInf...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/basalt", "path": "/src/interface/interface.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn decrease_msaa(&self) { let mut msaa = self.msaa.lock(); *msaa = match *msaa { 1 => 1, 2 => 1, 4 => 2, 8 => 4, _ => panic!("Invalid MSAA level set!") }; self.itf_events.lock().push(ItfEvent::MSAAChanged); } pub(crate) fn new(basalt: Arc<Basalt>) -> Arc<Self> { let...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/basalt", "path": "/src/interface/interface.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> *self.msaa.lock() = amt; self.itf_events.lock().push(ItfEvent::MSAAChanged); Ok(()) } pub fn increase_msaa(&self) { let mut msaa = self.msaa.lock(); *msaa = match *msaa { 1 => 2, 2 => 4, 4 => 8, 8 => 8, _ => panic!("Invalid MSAA level set!") }; self.itf_events.lock()...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/basalt", "path": "/src/interface/interface.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn read_buy_and_sell_storages( &mut self, ) -> Result<(Storage, Storage), std::io::Error> { self.file.seek(SeekFrom::Start(0))?; let mut storages = String::with_capacity(100); self.file.read_to_string(&mut storages)?; let storages: [HashMap<Coins, Vec<En...
code_fim
hard
{ "lang": "rust", "repo": "sonicXconst1/open_midas", "path": "/src/reseller_saver.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sonicXconst1/open_midas path: /src/reseller_saver.rs use crate::bookkeeper::Coins; use crate::reseller::{Entry, Reseller, Storage}; use std::collections::HashMap; use std::io::{Read, Seek, SeekFrom, Write}; use std::path::PathBuf; use agnostic::trading_pair; pub struct ResellerSaver { file:...
code_fim
hard
{ "lang": "rust", "repo": "sonicXconst1/open_midas", "path": "/src/reseller_saver.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn convert_storage(storage: &Storage) -> HashMap<Coins, &Vec<Entry>> { storage .iter() .map(|(key, value)| (key.clone().into(), value)) .collect() } fn to_storage(storage: &HashMap<Coins, Vec<Entry>>) -> Storage { let mut map: Storage = HashMap::new(); storage ...
code_fim
hard
{ "lang": "rust", "repo": "sonicXconst1/open_midas", "path": "/src/reseller_saver.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: blt/bitintr path: /src/alg/x86/bmi2/mod.rs //! Bit Manipulation Instruction (BMI) Set 2.0: software fallback. <|fim_suffix|>pub use self::bzhi::*; pub use self::mulx::*; pub use self::pdep::*; pub use self::pext::*;<|fim_middle|>pub mod bzhi; pub mod mulx; pub mod pdep; pub mod pext;
code_fim
easy
{ "lang": "rust", "repo": "blt/bitintr", "path": "/src/alg/x86/bmi2/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use self::bzhi::*; pub use self::mulx::*; pub use self::pdep::*; pub use self::pext::*;<|fim_prefix|>// repo: blt/bitintr path: /src/alg/x86/bmi2/mod.rs //! Bit Manipulation Instruction (BMI) Set 2.0: software fallback. <|fim_middle|>pub mod bzhi; pub mod mulx; pub mod pdep; pub mod pext;
code_fim
easy
{ "lang": "rust", "repo": "blt/bitintr", "path": "/src/alg/x86/bmi2/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danbugs/danlogs path: /Rust/The Rust Programming Language - Tutorials/chapter18/patterns/src/main.rs #[derive(Debug)] struct Whatever { first: i32, middle: (i32, i32, i32, i32), last: Option<String>, } fn main() { <|fim_suffix|> match x { Whatever { first: 1 | 2, .. } =>...
code_fim
medium
{ "lang": "rust", "repo": "danbugs/danlogs", "path": "/Rust/The Rust Programming Language - Tutorials/chapter18/patterns/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match x { Whatever { first: 1 | 2, .. } => println!("one or two"), Whatever { first: 3, middle: (first, .., last), .. } => println!("first: {}, last: {}", first, last), Whatever { first: 4 ..= 6, .. } => println!("four through six"), Whatever { .. } if cond => println!...
code_fim
medium
{ "lang": "rust", "repo": "danbugs/danlogs", "path": "/Rust/The Rust Programming Language - Tutorials/chapter18/patterns/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: im-code/pelite path: /src/lib.rs /*! Your adventure start with a choice: Do you wish to inspect 64-bit PE binares? ⟶ [continue](pe64/index.html) Do you wish to inspect 32-bit PE binaries? ⟶ [continue](pe32/index.html) The `pelite::pe` module is aliased to the target of the compiled crate. Use...
code_fim
medium
{ "lang": "rust", "repo": "im-code/pelite", "path": "/src/lib.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>pub mod image; #[macro_use] mod strings; #[macro_use] pub mod util; pub mod pattern; mod error; pub use self::error::{Error, Result}; mod mmap; #[cfg(windows)] pub use self::mmap::{FileMap, ImageMap}; #[cfg(unix)] pub use self::mmap::{FileMap}; pub mod pe64; pub mod pe32; /// Defaults to the curren...
code_fim
hard
{ "lang": "rust", "repo": "im-code/pelite", "path": "/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>/// Defaults to the current platform if it is available. #[cfg(all(windows, target_pointer_width = "32"))] pub use pe32 as pe; /// Defaults to the current platform if it is available. #[cfg(all(windows, target_pointer_width = "64"))] pub use pe64 as pe; pub mod resources;<|fim_prefix|>// repo: im-code/pe...
code_fim
hard
{ "lang": "rust", "repo": "im-code/pelite", "path": "/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sammhicks/face-generator path: /src/slider.rs use yew::{prelude::*, services::ConsoleService}; use crate::value::Value; fn set_value(console: &mut ConsoleService, value: *mut Value, data: yew::html::InputData) { match data.value.parse() { Ok(v) => unsafe { *value = v }, Err...
code_fim
hard
{ "lang": "rust", "repo": "sammhicks/face-generator", "path": "/src/slider.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> html! { <div class="slider"> <span class="label">{self.props.name}</span> <input type="number" value=self.props.min oninput=self.link.callback(Msg::MinChanged)/> <input type="range" min=self.props.min max=self.props.max value=value step=v...
code_fim
hard
{ "lang": "rust", "repo": "sammhicks/face-generator", "path": "/src/slider.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: weltimperator/rust_portforwarder path: /src/main.rs use mio::*; use mio::net::{TcpListener, TcpStream, UdpSocket}; use std::net::{SocketAddr, ToSocketAddrs}; use std::collections::HashMap; use multi_map::MultiMap; use std::*; use getopts::Options; struct TcpConnection { src: TcpStream, ...
code_fim
hard
{ "lang": "rust", "repo": "weltimperator/rust_portforwarder", "path": "/src/main.rs", "mode": "psm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> // Create storage for events let mut events = Events::with_capacity(1024); let mut buf = [0; 8192]; loop { poll.poll(&mut events, None)?; for event in events.iter() { match event.token() { TCP_SERVER => { let (stream1, _) =...
code_fim
hard
{ "lang": "rust", "repo": "weltimperator/rust_portforwarder", "path": "/src/main.rs", "mode": "spm", "license": "WTFPL", "source": "the-stack-v2" }
<|fim_suffix|> 'outer: loop { for opt in &mut options { if opt.len() == 1 { taken.insert(opt[0].name.to_owned()); continue; } else { let mut to_remove = vec![]; for (i, range) in opt.iter().enumerate() { ...
code_fim
hard
{ "lang": "rust", "repo": "SanderHageman/advent_of_code_2020", "path": "/src/day16.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn in_range(&self, val: u32) -> bool { (val >= self.llow && val <= self.lhigh) || (val >= self.rlow && val <= self.rhigh) } } #[test] fn show_parse() { let input = parse(EXAMPLE_INPUT); println!("{:?}", input); } #[test] fn test_example_1() { let input = parse(EXAMPLE_INPUT);...
code_fim
hard
{ "lang": "rust", "repo": "SanderHageman/advent_of_code_2020", "path": "/src/day16.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SanderHageman/advent_of_code_2020 path: /src/day16.rs use std::collections::HashSet; type TParsed = (Vec<DoubleRange>, Vec<u32>, Vec<Vec<u32>>); pub fn day(input: String) -> (u32, u64) { let parsed_input = parse(&input); let (p1_result, p1_output) = part_1(&parsed_input); ( ...
code_fim
hard
{ "lang": "rust", "repo": "SanderHageman/advent_of_code_2020", "path": "/src/day16.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Item { pub fn make_dir(full_path: PathBuf, mode: u32) -> Self { Self { full_path, kind: Kind::Directory, start: None, finish: None, size: None, result: Ok(()), mode, } } pub fn write_file(...
code_fim
hard
{ "lang": "rust", "repo": "Gelbpunkt/rustup", "path": "/src/diskio/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Wrap up any pending operations and iterate over them. /// All operations submitted before the join will have been /// returned either through ready/complete or join once join /// returns. fn join(&mut self) -> Box<dyn Iterator<Item = Item> + '_>; /// Iterate over completed it...
code_fim
hard
{ "lang": "rust", "repo": "Gelbpunkt/rustup", "path": "/src/diskio/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Gelbpunkt/rustup path: /src/diskio/mod.rs /// Disk IO abstraction for rustup. /// /// This exists to facilitate high performance extraction even though OS's are /// imperfect beasts. For detailed design notes see the module source. // // When performing IO we have a choice: // - perform some IO ...
code_fim
hard
{ "lang": "rust", "repo": "Gelbpunkt/rustup", "path": "/src/diskio/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut state = gui::State::new(config, bg_runtime.executor()); let main_loop = event_stream(events_loop) .take_while(|events| { for event in events.iter() { if let Event::WindowEvent { event: WindowEvent::CloseRequested, ...
code_fim
hard
{ "lang": "rust", "repo": "Etimo/biketracker", "path": "/biketracker-agent/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Etimo/biketracker path: /biketracker-agent/src/main.rs // Very much based on https://github.com/PistonDevelopers/conrod/blob/master/examples/hello_world.rs mod config; mod cyclists; mod event_loop; mod gui; mod memo_future; mod widgets; use self::config::AgentConfig; use self::event_loop::even...
code_fim
hard
{ "lang": "rust", "repo": "Etimo/biketracker", "path": "/biketracker-agent/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raunaqjain/WebsiteAnalyzer path: /src/main.rs extern crate getopts; use getopts::Options; use openssl::ssl::{SslConnector, SslMethod}; use std::env; use std::io; use std::io::{Read, Write}; use std::net::TcpStream; use std::time::{Duration, Instant}; use std::vec::Vec; fn parse_url(url: String)...
code_fim
hard
{ "lang": "rust", "repo": "raunaqjain/WebsiteAnalyzer", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let make_query_params = if has_query_params(endpoint) { quote! { let #query_params = conjure_http::private::parse_query_params(&#parts); } } else { quote!() }; let make_safe_params = if has_safe_params(ctx, endpoint) { quote! { #resp...
code_fim
hard
{ "lang": "rust", "repo": "palantir/conjure-rust", "path": "/conjure-codegen/src/servers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: palantir/conjure-rust path: /conjure-codegen/src/servers.rs yle); let params = params(ctx, def); let sync = ctx.sync_ident(def.service_name()); let send = ctx.send_ident(def.service_name()); let input_trait = input_trait(ctx, def, style); let i_traits = match style { ...
code_fim
hard
{ "lang": "rust", "repo": "palantir/conjure-rust", "path": "/conjure-codegen/src/servers.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> ctx: &Context, service: &ServiceDefinition, endpoint: &EndpointDefinition, ) -> TokenStream { let endpoint_name = endpoint_name(ctx, endpoint); let some = ctx.some_ident(service.service_name()); let none = ctx.none_ident(service.service_name()); let option = ctx.option_ident(s...
code_fim
hard
{ "lang": "rust", "repo": "palantir/conjure-rust", "path": "/conjure-codegen/src/servers.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn edge_label<'b>(&'b self, _: &Ed<'_>) -> dot::LabelText<'b> { dot::LabelText::LabelStr("".into()) } } impl<'a, 'c> dot::GraphWalk<'a, Nd, Ed<'a>> for Graph<'c> { // fn nodes(&self) -> dot::Nodes<'a,Nd> { (0..self.nodes.len()).collect() } fn nodes(&self) -> dot::Nodes<'a, Nd> { ...
code_fim
hard
{ "lang": "rust", "repo": "PSeitz/veloci", "path": "/src/plan_creator/plan.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if unfulfilled_dependencies.is_empty() { steps_with_fullfilled_dependencies.push(remaining_steps.remove(i)); } } if steps_with_fullfilled_dependencies.is_empty() { panic!("invalid plan created"); } ...
code_fim
hard
{ "lang": "rust", "repo": "PSeitz/veloci", "path": "/src/plan_creator/plan.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PSeitz/veloci path: /src/plan_creator/plan.rs use crate::plan_creator::{channel::*, *}; use std::io::Write; #[derive(Debug)] /// Plan creates a plan based on a search::Request #[derive(Default)] pub struct Plan { pub steps: Vec<Box<dyn PlanStepTrait>>, pub dependencies: Vec<Dependency>,...
code_fim
hard
{ "lang": "rust", "repo": "PSeitz/veloci", "path": "/src/plan_creator/plan.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: whtahy/exercism path: /rust/18 isogram.rs use std::collections::HashSet; pub fn check(s: &str) -> bool { le<|fim_suffix|> return false; } set.insert(ch); } true }<|fim_middle|>t mut set = HashSet::new(); for mut ch in s.to_lowercase().chars().filter(|x| x.is...
code_fim
medium
{ "lang": "rust", "repo": "whtahy/exercism", "path": "/rust/18 isogram.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> return false; } set.insert(ch); } true }<|fim_prefix|>// repo: whtahy/exercism path: /rust/18 isogram.rs use std::collections::HashSet; pub fn check(s: &str) -> bool { let mut set = HashSet::new(); for mut ch in s.to_lowercase().chars()<|fim_middle|>.filter(|x| x.is...
code_fim
medium
{ "lang": "rust", "repo": "whtahy/exercism", "path": "/rust/18 isogram.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilammy/rust-talk path: /1/hello-world-2/examples/input.rs extern crate hello_world_2; use std::io; use hello_world_2::fib; <|fim_suffix|> match input.trim().parse() { Ok(n) => { println!("fib({}) = {}", n, fib(n)); } Err(_) => { ...
code_fim
medium
{ "lang": "rust", "repo": "ilammy/rust-talk", "path": "/1/hello-world-2/examples/input.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match input.trim().parse() { Ok(n) => { println!("fib({}) = {}", n, fib(n)); } Err(_) => { eprintln!("not an integer: {}", input); break; } } } }<|fim_prefix|>// repo: ilammy/rust-talk path...
code_fim
medium
{ "lang": "rust", "repo": "ilammy/rust-talk", "path": "/1/hello-world-2/examples/input.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // let read_count = stats.get_i64("Operations (Read)")? as u64; // let write_count = stats.get_i64("Operations (Write)")? as u64; Ok(IoCounters::new(name, read_bytes, write_bytes)) } /// Returns an iterator of disk I/O stats. Pulls data through IOKit. pub fn io_stats() -> anyhow::Result<Vec<...
code_fim
hard
{ "lang": "rust", "repo": "ClementTsang/bottom", "path": "/src/app/data_harvester/disks/unix/macos/counters.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ClementTsang/bottom path: /src/app/data_harvester/disks/unix/macos/counters.rs //! Based on [heim's implementation](https://github.com/heim-rs/heim/blob/master/heim-disk/src/sys/macos/counters.rs). use super::io_kit::{self, get_dict, get_disks, get_i64, get_string}; use crate::app::data_harvest...
code_fim
hard
{ "lang": "rust", "repo": "ClementTsang/bottom", "path": "/src/app/data_harvester/disks/unix/macos/counters.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let disk_props = device.properties()?; let parent_props = parent.properties()?; let name = get_string(&disk_props, "BSD Name")?; let stats = get_dict(&parent_props, "Statistics")?; let read_bytes = get_i64(&stats, "Bytes (Read)")? as u64; let write_bytes = get_i64(&stats, "Bytes ...
code_fim
hard
{ "lang": "rust", "repo": "ClementTsang/bottom", "path": "/src/app/data_harvester/disks/unix/macos/counters.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pachterlab/BP_2021 path: /alevin-fry/libradicl/src/quant.rs _gene_vec[*eq2id as usize] == true //{ // unidirected_in_multigene += 1; //} } PU...
code_fim
hard
{ "lang": "rust", "repo": "pachterlab/BP_2021", "path": "/alevin-fry/libradicl/src/quant.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let writer_deref = bcout.lock(); let writer = &mut *writer_deref.unwrap(); // get the row index and then increment it row_index = writer.row_index; writer.row_index += 1; ...
code_fim
hard
{ "lang": "rust", "repo": "pachterlab/BP_2021", "path": "/alevin-fry/libradicl/src/quant.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pachterlab/BP_2021 path: /alevin-fry/libradicl/src/quant.rs if x.1 > (2 * y.1 - 1) { return PUGEdgeType::XToY; } else if y.1 > (2 * x.1 - 1) { return PUGEdgeType::YToX; } else { return PUGEdgeType::BiDirected; } ...
code_fim
hard
{ "lang": "rust", "repo": "pachterlab/BP_2021", "path": "/alevin-fry/libradicl/src/quant.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reslario/enumerate path: /src/parse.rs use syn::{Error, FnArg}; use syn::parse::{Parse, ParseStream}; use syn::Token; use proc_macro2::{Ident, Span}; pub struct Arguments { pub enum_name: Option<Ident>, pub impls: Vec<Implementer> } impl Parse for Arguments { fn parse(input: ParseS...
code_fim
hard
{ "lang": "rust", "repo": "reslario/enumerate", "path": "/src/parse.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let ident = input.parse::<Ident>()?; let alias = input.parse::<Alias>().ok().map(|a| a.0); Ok(Implementer { ident, alias }) } } pub trait IsSelf { fn is_self(&self) -> bool; } impl IsSelf for FnArg { fn is_self(&self) -> bool { ...
code_fim
hard
{ "lang": "rust", "repo": "reslario/enumerate", "path": "/src/parse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BigRedEye/hse-healthcheck path: /app/src/node.rs use crate::prelude::*; use crate::api; use crate::config; use crate::repo; use crate::models; use chrono::prelude::*; use actix_web::{get, web, App, HttpServer, HttpResponse, Responder}; #[derive(Clone)] pub struct Node { conf: config::Setti...
code_fim
hard
{ "lang": "rust", "repo": "BigRedEye/hse-healthcheck", "path": "/app/src/node.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let clone = self.clone(); HttpServer::new(move || App::new().data(clone.clone()).service(healthcheck)) .bind(self.conf.bind_address)? .run() .await?; Ok(()) } async fn healthcheck(&self) -> impl Responder { match self.process_he...
code_fim
hard
{ "lang": "rust", "repo": "BigRedEye/hse-healthcheck", "path": "/app/src/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub async fn run(&self) -> Result<()> { let clone = self.clone(); actix_rt::spawn(async move { clone.run_heartbeats().await }); self.run_service().await } async fn local_ip() -> String { match Self::discover_ip().await { Ok(ip) ...
code_fim
hard
{ "lang": "rust", "repo": "BigRedEye/hse-healthcheck", "path": "/app/src/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>where P: Parser<'a, A> { move |orig_input|{ let mut input = orig_input; let mut result = Vec::new(); let mut i = 0; while let Ok((next_input, next_item)) = parser.parse(input){ input = next_input; result.push(next_item); i = i + ...
code_fim
hard
{ "lang": "rust", "repo": "mira01/rust_parser", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mira01/rust_parser path: /src/lib.rs type ParseResult<'a, Output> = Result<(&'a str, Output), &'a str>; trait Parser<'a, Output>{ fn parse(&self, input: &'a str) -> ParseResult<'a, Output>; } impl<'a, F, Output> Parser<'a, Output> for F where F: Fn(&'a str) -> ParseResult<Outpu...
code_fim
hard
{ "lang": "rust", "repo": "mira01/rust_parser", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: slavfox/lpd8_system_monitor path: /src/main.rs // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this // file, You can obtain one at https://mozilla.org/MPL/2.0/. // // Copyright 2021, Slavfox. #![warn(clippy:...
code_fim
hard
{ "lang": "rust", "repo": "slavfox/lpd8_system_monitor", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>macro_rules! pad_worker { ($threads:expr, $src:ident, $pad:expr) => { $threads.push(spawn(move || { let mut connection = connect(stringify!($src)).unwrap(); let mut duty_cycle = 0f32; loop { match $src.try_recv() { Ok(val)...
code_fim
hard
{ "lang": "rust", "repo": "slavfox/lpd8_system_monitor", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let (cpu_usage_tx, cpu_usage_rx) = mpsc::channel(); let (cpu_temp_tx, cpu_temp_rx) = mpsc::channel(); let (memory_usage_tx, memory_usage_rx) = mpsc::channel(); let (network_sent_tx, network_sent_rx) = mpsc::channel(); let (network_received_tx, network_received_rx) = mpsc::c...
code_fim
hard
{ "lang": "rust", "repo": "slavfox/lpd8_system_monitor", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>er, create_container}; pub use self::error::ErrorKind;<|fim_prefix|>// repo: qmutz/wallet713 path: /src/wallet/mod.rs mod adapter; pub mod api; mod backend; mod container;<|fim_middle|> pub mod error; mod seed; pub mod types; pub use self::backend::Backend; pub use self::container::{Contain
code_fim
medium
{ "lang": "rust", "repo": "qmutz/wallet713", "path": "/src/wallet/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>::backend::Backend; pub use self::container::{Container, create_container}; pub use self::error::ErrorKind;<|fim_prefix|>// repo: qmutz/wallet713 path: /src/wallet/mod.rs mod adapter; pub mod api; mod backend; mod container;<|fim_middle|> pub mod error; mod seed; pub mod types; pub use self
code_fim
easy
{ "lang": "rust", "repo": "qmutz/wallet713", "path": "/src/wallet/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qmutz/wallet713 path: /src/wallet/mod.rs mod adapter; pub mod api; mod backend; mod container;<|fim_suffix|>er, create_container}; pub use self::error::ErrorKind;<|fim_middle|> pub mod error; mod seed; pub mod types; pub use self::backend::Backend; pub use self::container::{Contain
code_fim
medium
{ "lang": "rust", "repo": "qmutz/wallet713", "path": "/src/wallet/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }