text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>fg(feature = "package-preview-2022-06")] pub mod package_preview_2022_06; #[cfg(all(feature = "package-preview-2022-06", not(feature = "no-default-tag")))] pub use package_preview_2022_06::*; #[cfg(feature = "package-preview-2022-04")] pub mod package_preview_2022_04; #[cfg(all(feature = "package-preview-...
code_fim
hard
{ "lang": "rust", "repo": "Azure/azure-sdk-for-rust", "path": "/services/mgmt/costmanagement/src/lib.rs", "mode": "spm", "license": "LicenseRef-scancode-generic-cla", "source": "the-stack-v2" }
<|fim_suffix|> c.bench_function("description_validation", |b| { b.iter(|| { black_box(Desc::new( "api_http_requests_total".to_string(), "not empty help".to_string(), vec!["method".to_string(), "handler".to_string()], Default::default...
code_fim
medium
{ "lang": "rust", "repo": "tikv/rust-prometheus", "path": "/benches/desc.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tikv/rust-prometheus path: /benches/desc.rs // Copyright 2020 PingCAP, Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/license...
code_fim
medium
{ "lang": "rust", "repo": "tikv/rust-prometheus", "path": "/benches/desc.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match args.len() { 1 => progress::print_progress(), 2 | 3 => { let year_str = &args[1]; let year = year_str.parse::<u32>().unwrap(); match args.len() { 2 => match year { 2015 => runner::run_year::<y2015::Y2015, 20...
code_fim
hard
{ "lang": "rust", "repo": "jgilchrist/advent-of-code", "path": "/rust/src/runner/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jgilchrist/advent-of-code path: /rust/src/runner/src/main.rs #![warn(clippy::pedantic)] #![warn(clippy::nursery)] #![allow(clippy::approx_constant)] #![allow(clippy::blanket_clippy_restriction_lints)] #![allow(clippy::cast_possible_truncation)] #![allow(clippy::cast_possible_wrap)] #![allow(clip...
code_fim
hard
{ "lang": "rust", "repo": "jgilchrist/advent-of-code", "path": "/rust/src/runner/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // let mut s = "ADOBECODEBANC".to_string(); // let mut t = "ABC".to_string(); // let a:Chars = s.chars(); // let b:Vec<char> = a.clone().collect(); // println!("{}", a.count() == b.len()); // for k in t.chars() { // println!("{}", k); // } // let mut s = String::new...
code_fim
hard
{ "lang": "rust", "repo": "listen-lavender/testlab", "path": "/algorithm/X00013_slide_window/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> "hello world" } fn main() { // let mut s = "ADOBECODEBANC".to_string(); // let mut t = "ABC".to_string(); // let a:Chars = s.chars(); // let b:Vec<char> = a.clone().collect(); // println!("{}", a.count() == b.len()); // for k in t.chars() { // println!("{}", k); //...
code_fim
hard
{ "lang": "rust", "repo": "listen-lavender/testlab", "path": "/algorithm/X00013_slide_window/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: listen-lavender/testlab path: /algorithm/X00013_slide_window/src/main.rs use std::mem::swap; use std::cmp::max; use std::thread; use std::str::Chars; use std::collections::HashMap; use std::collections::HashSet; fn min_cover_substr(s: &str, t: &str) -> String { let s:Vec<char> = s.to_string...
code_fim
hard
{ "lang": "rust", "repo": "listen-lavender/testlab", "path": "/algorithm/X00013_slide_window/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: 1aim/rust-regex-cache path: /src/cache.rs // Copyright 2017 1aim GmbH // // Permission is hereby granted, free of charge, to any person obtaining a copy of // this software and associated documentation files (the "Software"), to deal in // the Software without restriction, including without limi...
code_fim
hard
{ "lang": "rust", "repo": "1aim/rust-regex-cache", "path": "/src/cache.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fmt::Display::fmt(regex!(self), f) } } /// A configurable builder for a cached `Regex`. #[derive(Clone, Debug)] pub struct CachedRegexBuilder { cache: Arc<Mutex<RegexCache>>, source: String, options: Options, } impl CachedRegexBuilder { /// Create a new regular expression builder with the give...
code_fim
hard
{ "lang": "rust", "repo": "1aim/rust-regex-cache", "path": "/src/cache.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mgabs/rustlings path: /exercises/standard_library_types/arc1.rs // arc1.rs // Make this code compile by filling in a value for `shared_numbers` where the // TODO comment is and create an initial binding for `child_numbers` // somewhere. Try not to create any copies of the `numbers` Vec! // Execu...
code_fim
hard
{ "lang": "rust", "repo": "mgabs/rustlings", "path": "/exercises/standard_library_types/arc1.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// Another solution based on Mutex and Arc use std::sync::Mutex; fn another() { let numbers: Vec<_> = (0..100u32).collect(); let shared_numbers = Arc::new(Mutex::new(numbers)); // TODO let mut joinhandles = Vec::new(); for offset in 0..8 { let shared_numbers = Arc::clone(&shared_n...
code_fim
hard
{ "lang": "rust", "repo": "mgabs/rustlings", "path": "/exercises/standard_library_types/arc1.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> builder.files(common_files.into_iter()); builder.include(target_falcon512_clean_dir).files( scheme_falcon512_clean_files .into_iter() .map(|p| p.unwrap().to_string_lossy().into_owned()), ); builder.include(target_falcon1024_clean_dir).files( scheme_f...
code_fim
hard
{ "lang": "rust", "repo": "thomwiggers/pqcrypto", "path": "/pqcrypto-falcon/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thomwiggers/pqcrypto path: /pqcrypto-falcon/build.rs extern crate cc; extern crate glob; use std::path::Path; fn main() { let target_falcon512_clean_dir = Path::new("pqclean/crypto_sign/falcon-512/clean"); let scheme_falcon512_clean_files = glob::glob(target_falcon512_clean_dir...
code_fim
hard
{ "lang": "rust", "repo": "thomwiggers/pqcrypto", "path": "/pqcrypto-falcon/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bauhaus93/world-gen path: /world/src/height_map.rs use std::cmp::Ordering; use std::convert::TryInto; use crate::{chunk::ChunkError, triangulate, Noise}; use core::graphics::mesh::Triangle; use core::{GraphicsError, Mesh, Point2f, Point2i, Point3f, Texture, TextureBuilder}; #[derive(Clone)] pu...
code_fim
hard
{ "lang": "rust", "repo": "bauhaus93/world-gen", "path": "/world/src/height_map.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get(&self, pos: Point2i) -> f32 { self.height_list[self.calculate_index(pos)] } pub fn get_normal(&self, pos: Point2i) -> Point3f { self.normal_list[self.calculate_index(pos)] } pub fn set_normal(&mut self, pos: Point2i, normal: Point3f) { let index = sel...
code_fim
hard
{ "lang": "rust", "repo": "bauhaus93/world-gen", "path": "/world/src/height_map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[allow(unused)] pub fn get_size(&self) -> i32 { self.size } pub fn get_list(&self) -> &[f32] { self.height_list.as_slice() } pub fn get_min(&self) -> f32 { match self.height_list.iter().min_by(|a, b| { if a > b { Ordering::Grea...
code_fim
hard
{ "lang": "rust", "repo": "bauhaus93/world-gen", "path": "/world/src/height_map.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ods/leetcode-rs path: /src/challenge_2021_mar/week2/coin_change.rs // Coin Change // https://leetcode.com/explore/challenge/card/march-leetcoding-challenge-2021/589/week-2-march-8th-march-14th/3668/ pub struct Solution; use std::cmp::Ordering::*; impl Solution { pub fn coin_change(mut coi...
code_fim
hard
{ "lang": "rust", "repo": "ods/leetcode-rs", "path": "/src/challenge_2021_mar/week2/coin_change.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(Solution::coin_change(vec![1], 0), 0); } #[test] fn example4() { assert_eq!(Solution::coin_change(vec![1], 1), 1); } #[test] fn example5() { assert_eq!(Solution::coin_change(vec![1], 2), 2); } }<|fim_prefix|>// repo: ods/leetcode-rs path: /...
code_fim
hard
{ "lang": "rust", "repo": "ods/leetcode-rs", "path": "/src/challenge_2021_mar/week2/coin_change.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_text(&self) -> Option<&str> { match self { Item::Text { text, .. } => Some(text), _ => None, } } pub fn is_whitespace(&self) -> bool { match self { Item::Text { text, .. } => text.chars().all(char::is_whitespace), ...
code_fim
hard
{ "lang": "rust", "repo": "edolstra/sst", "path": "/rust/src/ast.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: edolstra/sst path: /rust/src/ast.rs use serde::Serialize; use std::collections::HashMap; use std::ops::{Deref, DerefMut}; use std::path::PathBuf; use std::sync::Arc; #[derive(Serialize, Debug, Clone, PartialEq, Eq)] pub struct Doc(pub Vec<Item>); impl Deref for Doc { type Target = Vec<Item...
code_fim
hard
{ "lang": "rust", "repo": "edolstra/sst", "path": "/rust/src/ast.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.inner .find(|c: char| c.is_ascii_alphabetic()) .map(|next| { let (init, point) = self.inner.split_at(next); self.inner = &point[1..]; (init, point.as_bytes()[0].to_ascii_uppercase() as char) }) } } pub fn...
code_fim
medium
{ "lang": "rust", "repo": "FauxFaux/fetch-maybe", "path": "/src/period.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn parse_duration(s: &str) -> Result<chrono::Duration, failure::Error> { if let Ok(secs) = s.parse() { return Ok(chrono::Duration::seconds(secs)); } bail!("can't parse as a duration: {:?}", s) }<|fim_prefix|>// repo: FauxFaux/fetch-maybe path: /src/period.rs use failure::bail; s...
code_fim
hard
{ "lang": "rust", "repo": "FauxFaux/fetch-maybe", "path": "/src/period.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FauxFaux/fetch-maybe path: /src/period.rs use failure::bail; struct Parts<'s> { inner: &'s str, } impl<'s> Parts<'s> { fn new(inner: &str) -> Parts { <|fim_suffix|> fn next(&mut self) -> Option<(&'s str, char)> { self.inner .find(|c: char| c.is_ascii_alphabetic()...
code_fim
medium
{ "lang": "rust", "repo": "FauxFaux/fetch-maybe", "path": "/src/period.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: destenson/dwrensha--seer path: /tests/compiletest.rs extern crate compiletest_rs as compiletest; use std::path::{PathBuf, Path}; use std::io::Write; fn dylib_env_var() -> &'static str { if cfg!(windows) { "PATH" } else if cfg!(target_os = "macos") { "DYLD_LIBRARY_PATH" ...
code_fim
hard
{ "lang": "rust", "repo": "destenson/dwrensha--seer", "path": "/tests/compiletest.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if let Ok(path) = std::env::var("MIRI_RUSTC_TEST") { let mut mir_not_found = Vec::new(); let mut crate_not_found = Vec::new(); let mut success = 0; let mut failed = Vec::new(); let mut c_abi_fns = Vec::new(); let mut abi = Vec::new(); let mut uns...
code_fim
hard
{ "lang": "rust", "repo": "destenson/dwrensha--seer", "path": "/tests/compiletest.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shioyama18/apue path: /example/ch10_signals/f26_system.rs use apue::c_str; use errno::errno; use libc::{_exit, c_char, c_int, execl, fork, waitpid, EINTR}; use libc::{signal, SIGCHLD, SIGINT, SIG_ERR}; <|fim_suffix|> let mut status = 0; unsafe { let pid = fork(); match p...
code_fim
hard
{ "lang": "rust", "repo": "shioyama18/apue", "path": "/example/ch10_signals/f26_system.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if n<2 { let n : u64 = u64::from(n); n }else{ let f1:u64 = fib(n-1); let f2:u64 = fib(n-2); f1+f2 } }<|fim_prefix|>// repo: alaouizoubair/rust_fibonacci path: /src/main.rs use std::io; use std::time::Instant; fn main() { println!("Fibonacci Number"...
code_fim
medium
{ "lang": "rust", "repo": "alaouizoubair/rust_fibonacci", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: alaouizoubair/rust_fibonacci path: /src/main.rs use std::io; use std::time::Instant; fn main() { println!("Fibonacci Number"); println!("What is the depth? "); //Loop until integer is written to console let depth: u32 = loop{ //Define string variable named data ...
code_fim
hard
{ "lang": "rust", "repo": "alaouizoubair/rust_fibonacci", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bugadani/embedded-menu path: /src/builder.rs use crate::{ collection::{MenuItemCollection, MenuItems}, interaction::{InputAdapterSource, InputState}, selection_indicator::{style::IndicatorStyle, SelectionIndicatorController}, Menu, MenuDisplayMode, MenuItem, MenuState, MenuStyle,...
code_fim
hard
{ "lang": "rust", "repo": "bugadani/embedded-menu", "path": "/src/builder.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if max_idx < state.selected { state.selected = max_idx; let max_indicator_pos = items.bounds_of(max_idx).top_left.y; state.recompute_targets = false; self.style .indicator .change_selected_item(max_indicator_pos, &mu...
code_fim
hard
{ "lang": "rust", "repo": "bugadani/embedded-menu", "path": "/src/builder.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Identifying for Entity { fn identifier(&self) -> String { match self { Entity::Structure(s) => s.identifier(), Entity::Scalar(s) => s.identifier(), Entity::Enum(e) => e.identifier(), } } } #[derive(Debug, Clone, Copy)] pub enum Multiplicity...
code_fim
hard
{ "lang": "rust", "repo": "ajunlonglive/pakken", "path": "/ast/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ajunlonglive/pakken path: /ast/src/lib.rs use core::fmt; use std::rc::Rc; pub type Identifier = String; #[derive(Debug, Clone)] pub struct Namespace { pub identifier: Identifier, pub entities: Vec<Rc<Entity>>, } impl Namespace { pub fn find_entity(&self, identifier: Identifier) ->...
code_fim
hard
{ "lang": "rust", "repo": "ajunlonglive/pakken", "path": "/ast/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone, Copy)] pub enum Multiplicity { Concrete(Number), UnderUpper(Number, Number), Single, Optional, } #[derive(Debug, Clone, Copy)] pub enum Number { Discrete(usize), Infinity, NegativeInfinity, } #[derive(Debug, Clone)] pub struct Attribute { pub name: ...
code_fim
hard
{ "lang": "rust", "repo": "ajunlonglive/pakken", "path": "/ast/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ruma/ruma path: /crates/ruma-appservice-api/src/event/push_events.rs //! `PUT /_matrix/app/*/transactions/{txnId}` //! //! Endpoint to push an event (or batch of events) to the application service. pub mod v1 { //! `/v1/` ([spec]) //! //! [spec]: https://spec.matrix.org/latest/appli...
code_fim
hard
{ "lang": "rust", "repo": "ruma/ruma", "path": "/crates/ruma-appservice-api/src/event/push_events.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Whether the user is typing in the room or not. pub typing: bool, } #[cfg(feature = "unstable-msc2409")] impl TypingContent { /// Creates a new `TypingContent`. pub fn new(room_id: OwnedRoomId, user_id: OwnedUserId, typing: bool) -> Self { Self {...
code_fim
hard
{ "lang": "rust", "repo": "ruma/ruma", "path": "/crates/ruma-appservice-api/src/event/push_events.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// The content for "m.presence" Edu. #[cfg(feature = "unstable-msc2409")] #[derive(Clone, Debug, Deserialize, Serialize)] #[cfg_attr(not(feature = "unstable-exhaustive-types"), non_exhaustive)] pub struct PresenceContent { /// A list of presence updates that the receiving serv...
code_fim
hard
{ "lang": "rust", "repo": "ruma/ruma", "path": "/crates/ruma-appservice-api/src/event/push_events.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kornholi/gd32f30x-pac path: /src/sdio/resp1.rs #[doc = "Reader of register RESP1"] pub type R = crate::R<u32, super::RESP1>; #[doc = "Reader of field `RESP1`"] pub type RESP1_R = crate::R<u32, u32>; impl R {<|fim_suffix|>elf) -> RESP1_R { RESP1_R::new((self.bits & 0xffff_ffff) as u32) ...
code_fim
medium
{ "lang": "rust", "repo": "kornholi/gd32f30x-pac", "path": "/src/sdio/resp1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>elf) -> RESP1_R { RESP1_R::new((self.bits & 0xffff_ffff) as u32) } }<|fim_prefix|>// repo: kornholi/gd32f30x-pac path: /src/sdio/resp1.rs #[doc = "Reader of register RESP1"] pub type R = crate::R<u32, super::RESP1>; #[doc = "Reader of field `RESP1`"] pub type RESP1_R = crate::R<u32, u32>; imp...
code_fim
medium
{ "lang": "rust", "repo": "kornholi/gd32f30x-pac", "path": "/src/sdio/resp1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let interpolator = ScalarInterpolator::<f64>::new(sinc_len, oversampling_factor, f_cutoff, window); let value = interpolator.get_sinc_interpolated(&wave, 333, 123); let check = get_sinc_interpolated(&wave, 333, &interpolator.sincs[123]); assert!((value - check)....
code_fim
hard
{ "lang": "rust", "repo": "JoNil/rubato", "path": "/src/asynchro.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Query for the number of frames needed for the next call to "process". /// Will always return the chunk_size defined when creating the instance. fn nbr_frames_needed(&self) -> usize { self.chunk_size } /// Update the resample ratio. New value must be within +-10% of the ori...
code_fim
hard
{ "lang": "rust", "repo": "JoNil/rubato", "path": "/src/asynchro.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: JoNil/rubato path: /src/asynchro.rs nearest.1 as usize, ); wave_out[*chan][n] = point; } } } } let prev_input_len = self.needed_input_size; // store...
code_fim
hard
{ "lang": "rust", "repo": "JoNil/rubato", "path": "/src/asynchro.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> proptest! { #[test] fn parse_unary_postfix_expression(lhs: Numeric, op in unary_postfix_operator()) { let expected = format!("{} {}", lhs, &op); let tokens = vec![ Token::Number(lhs), Token::Operator(op), ].anywhere()...
code_fim
hard
{ "lang": "rust", "repo": "MaximilianKoestler/nextreq", "path": "/backend/src/formula/parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> write!(f, "{} <=> ", self.infix_str())?; self.fmt_classic(f) } } fn unary_prefix_operator() -> BoxedStrategy<LexerOperator> { prop_oneof![Just(LexerOperator::Plus), Just(LexerOperator::Minus),].boxed() } fn binary_infix_operator() -> BoxedStrategy<...
code_fim
hard
{ "lang": "rust", "repo": "MaximilianKoestler/nextreq", "path": "/backend/src/formula/parser.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MaximilianKoestler/nextreq path: /backend/src/formula/parser.rs ation token: {}", token.token )) .at_marker(token)) } }, None => break, }; } ...
code_fim
hard
{ "lang": "rust", "repo": "MaximilianKoestler/nextreq", "path": "/backend/src/formula/parser.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(not(unix))] #[allow(unused_variables)] pub fn display_date(metadata: &Metadata, options: &Options) -> String { if let Ok(mtime) = metadata.modified() { let time = time::at(Timespec::new( mtime .duration_since(UNIX_EPOCH) .unwrap() ...
code_fim
hard
{ "lang": "rust", "repo": "Babkock/unix", "path": "/ls/src/display.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Babkock/unix path: /ls/src/display.rs /* * ls/display.rs * Babkock/unix * * Copyright (c) 2019 Tanner Babcock. * MIT License. */ extern crate libc; extern crate term_grid; extern crate termsize; extern crate time; extern crate unicode_width; extern crate number_prefix; use number_prefix::{...
code_fim
hard
{ "lang": "rust", "repo": "Babkock/unix", "path": "/ls/src/display.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Returns location coordinates of all Taxis that are currently available for /// hire. Does not include "Hired" or "Busy" Taxis. /// /// **Update freq**: 1min pub fn get_passenger_vol_by( client: &LTAClient, ) -> impl Future<Item = Vec<Coordinates>, Error = Error> { let rb = client.get_req_build...
code_fim
medium
{ "lang": "rust", "repo": "euwbah/lta-rs", "path": "/src/async/taxi.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: euwbah/lta-rs path: /src/async/taxi.rs //! All API pertaining to taxis use futures::Future; use reqwest::Error; <|fim_suffix|>/// Returns location coordinates of all Taxis that are currently available for /// hire. Does not include "Hired" or "Busy" Taxis. /// /// **Update freq**: 1min pub fn g...
code_fim
medium
{ "lang": "rust", "repo": "euwbah/lta-rs", "path": "/src/async/taxi.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phil-opp/redox-kernel path: /src/acpi/aml/dataobj.rs use alloc::vec::Vec; use alloc::string::String; use super::AmlError; use super::parser::{ AmlParseType, ParseResult, AmlExecutionContext, ExecutionState }; use super::namespace::{ AmlValue, ObjectReference }; use super::type2opcode::{parse_d...
code_fim
hard
{ "lang": "rust", "repo": "phil-opp/redox-kernel", "path": "/src/acpi/aml/dataobj.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> while data[cur_ptr] != 0x00 { cur_string.push(data[cur_ptr]); cur_ptr += 1; } match String::from_utf8(cur_string) { Ok(s) => Ok(AmlParseType { val: AmlValue::String(s.clone()), len:...
code_fim
hard
{ "lang": "rust", "repo": "phil-opp/redox-kernel", "path": "/src/acpi/aml/dataobj.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match data[0] { 0x68 ... 0x6E => Ok(AmlParseType { val: AmlValue::ObjectReference(ObjectReference::ArgObj(data[0] - 0x68)), len: 1 as usize }), _ => Err(AmlError::AmlInvalidOpCode) } } pub fn parse_local_obj(data: &[u8], ctx: ...
code_fim
hard
{ "lang": "rust", "repo": "phil-opp/redox-kernel", "path": "/src/acpi/aml/dataobj.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marcospb19/blockfrost-rust path: /src/api/endpoints/addresses.rs use serde::{Deserialize, Serialize}; use crate::*; impl BlockFrostApi { endpoints! { /// Obtain information about a specific address. addresses(address: &str) -> Address => "/addresses/{address}"; ...
code_fim
hard
{ "lang": "rust", "repo": "marcospb19/blockfrost-rust", "path": "/src/api/endpoints/addresses.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Created by [`addresses_utxos`](BlockFrostApi::addresses_utxos) method. #[derive(Serialize, Deserialize, Debug, Clone)] pub struct AddressUtxo { /// Transaction hash of the UTXO. pub tx_hash: String, /// UTXO index in the transaction. pub output_index: Integer, /// Sum of assets for...
code_fim
hard
{ "lang": "rust", "repo": "marcospb19/blockfrost-rust", "path": "/src/api/endpoints/addresses.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// (Async) Fetches a player's battlelog (most recent battles), given its tag. /// /// # Errors /// /// This function may error: /// - While requesting (will return an [`Error::Request`]); /// - After receiving a bad status code (API or other error - returns an [`Error::Status`...
code_fim
hard
{ "lang": "rust", "repo": "PgBiel/rust-brawl-api", "path": "/src/model/players/battlelog.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PgBiel/rust-brawl-api path: /src/model/players/battlelog.rs /// /// [`Player`]: ../player/struct.Player.html /// [`BattleLog::fetch`]: #method.fetch #[cfg(feature = "async")] async fn a_fetch_from(client: &Client, player: &Player) -> Result<BattleLog> { BattleLog::a_fet...
code_fim
hard
{ "lang": "rust", "repo": "PgBiel/rust-brawl-api", "path": "/src/model/players/battlelog.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use serde_json; use crate::time::TimeLike; use super::{ BattleLog, BattleBrawler, BattlePlayer, Battle, BattleResultInfo, BattleEvent, BattleOutcome }; /// Tests for battlelog deserialization from API-provided JSON. #[test] fn battlelog_deser()...
code_fim
hard
{ "lang": "rust", "repo": "PgBiel/rust-brawl-api", "path": "/src/model/players/battlelog.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: skonair/greenhouse path: /rust-greenhouse/src/main.rs #![feature(proc_macro_hygiene, decl_macro)] #[macro_use] extern crate rocket; #[macro_use] extern crate serde_derive; use rocket_contrib::json::{Json}; #[derive(Serialize, Deserialize)] struct SensorData { sensor: String, sensortype: S...
code_fim
hard
{ "lang": "rust", "repo": "skonair/greenhouse", "path": "/rust-greenhouse/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[get("/sensor/<_name>")] fn get_sensor_data(_name: String) -> Json<SensorData> { Json(SensorData { sensor: _name, sensortype: "Temperature".to_string(), icon: "home".to_string(), data: vec![24.1, 24.5, 24.7, 24.8, 25.1, 25.5], currentValue: 25.5, unit: "°C".to_string() }) } fn ...
code_fim
hard
{ "lang": "rust", "repo": "skonair/greenhouse", "path": "/rust-greenhouse/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Json(SensorData { sensor: _name, sensortype: "Temperature".to_string(), icon: "home".to_string(), data: vec![24.1, 24.5, 24.7, 24.8, 25.1, 25.5], currentValue: 25.5, unit: "°C".to_string() }) } fn main() { println!("Hello, world!"); rocket::ignite() .mount("/greenhouse",...
code_fim
hard
{ "lang": "rust", "repo": "skonair/greenhouse", "path": "/rust-greenhouse/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: psoc-rs/psoc6-pac path: /src/prot/smpu/ms6_ctl.rs #[doc = "Register `MS6_CTL` reader"] pub struct R(crate::R<MS6_CTL_SPEC>); impl core::ops::Deref for R { type Target = crate::R<MS6_CTL_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl ...
code_fim
hard
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/prot/smpu/ms6_ctl.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> W(writer) } } #[doc = "Field `P` reader - See MS0_CTL.P."] pub type P_R = crate::BitReader<bool>; #[doc = "Field `P` writer - See MS0_CTL.P."] pub type P_W<'a, const O: u8> = crate::BitWriter<'a, u32, MS6_CTL_SPEC, bool, O>; #[doc = "Field `NS` reader - See MS0_CTL.NS."] pub type NS_R ...
code_fim
hard
{ "lang": "rust", "repo": "psoc-rs/psoc6-pac", "path": "/src/prot/smpu/ms6_ctl.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jTitor/leek2 path: /src/open-source/engine/modules/src/math/linear_algebra/mod.rs /*! Module definition for linear_algebra. */ //Vectors. pub mod vec_base; pub mod vec2; pub mod vec3; pub mod vec4; //Shortcut import all of these. pub use self::vec_base::VecOps; pub use self::vec2::{Vec2Access, ...
code_fim
medium
{ "lang": "rust", "repo": "jTitor/leek2", "path": "/src/open-source/engine/modules/src/math/linear_algebra/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>//Import the implementation structs too. pub mod internal; pub use self::internal::{Vec2, Vec3, Vec4, Mat4x4};<|fim_prefix|>// repo: jTitor/leek2 path: /src/open-source/engine/modules/src/math/linear_algebra/mod.rs /*! Module definition for linear_algebra. */ //Vectors. pub mod vec_base; pub mod vec2; p...
code_fim
medium
{ "lang": "rust", "repo": "jTitor/leek2", "path": "/src/open-source/engine/modules/src/math/linear_algebra/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kwsm114514/typical90 path: /MyAnswers/ans007.rs use proconio::{input, fastout}; use superslice::Ext; const MAX: isize = std::isize::MAX; <|fim_suffix|> // 二分探索をする。 for i in 0..q { let mut ans: isize = MAX; let index: usize = a_rates.lower_bound(&b_rates[i]); for &...
code_fim
medium
{ "lang": "rust", "repo": "kwsm114514/typical90", "path": "/MyAnswers/ans007.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 二分探索をする。 for i in 0..q { let mut ans: isize = MAX; let index: usize = a_rates.lower_bound(&b_rates[i]); for &dif in difs.iter() { if 0 <= index as isize + dif && index as isize + dif < n as isize { if ans > (a_rates[index + dif as usize] - b_r...
code_fim
medium
{ "lang": "rust", "repo": "kwsm114514/typical90", "path": "/MyAnswers/ans007.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> renderer.create_material( shader, &[&[ wgpu::BindGroupEntry { binding: 0, resource: wgpu::BindingResource::Buffer( uniform_buffer.as_entire_buffer_binding(), ...
code_fim
hard
{ "lang": "rust", "repo": "Heavenston/rust_portal", "path": "/game/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Heavenston/rust_portal path: /game/src/main.rs use std::{ borrow::Cow, collections::VecDeque, convert::TryInto, f32, path::PathBuf, str::FromStr, time::Instant, }; use imgui::im_str; use nalgebra::UnitQuaternion; use portal_engine::{ camera::{CameraComponent, Per...
code_fim
hard
{ "lang": "rust", "repo": "Heavenston/rust_portal", "path": "/game/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: worace/geoq path: /src/geoq/fgb/mod.rs use crate::geoq::fgb::hilbert::IndexNode; pub(crate) mod columns; pub(crate) mod feature; pub(crate) mod geometry; pub(crate) mod header; pub(crate) mod hilbert; pub(crate) mod index; pub(crate) mod properties; // TODO // * [x] Add envelope generation and...
code_fim
hard
{ "lang": "rust", "repo": "worace/geoq", "path": "/src/geoq/fgb/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_multipolygon() { let (input, output) = roundtrip(MULTIPOLYGON); assert_eq!(input, output); } #[test] fn test_multipolygon_with_hole() { let (input, output) = roundtrip(MULTIPOLYGON_WITH_HOLE); assert_eq!(input, output); } // #[t...
code_fim
hard
{ "lang": "rust", "repo": "worace/geoq", "path": "/src/geoq/fgb/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DelSkayn/rquickjs path: /sys/src/bindings/x86_64-apple-darwin.rs Atom) -> *const ::std::os::raw::c_char; } extern "C" { pub fn JS_ValueToAtom(ctx: *mut JSContext, val: JSValue) -> JSAtom; } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct JSPropertyEnum { pub is_enumerable: ::std::os:...
code_fim
hard
{ "lang": "rust", "repo": "DelSkayn/rquickjs", "path": "/sys/src/bindings/x86_64-apple-darwin.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "::", stringify!(prop_count) ) ); assert_eq!( unsafe { ::std::ptr::addr_of!((*ptr).prop_size) as usize - ptr as usize }, 96usize, concat!( "Offset of field: ", stringify!(JSMemoryUsage), "::", stringify!...
code_fim
hard
{ "lang": "rust", "repo": "DelSkayn/rquickjs", "path": "/sys/src/bindings/x86_64-apple-darwin.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DelSkayn/rquickjs path: /sys/src/bindings/x86_64-apple-darwin.rs 8; 0], } #[repr(C)] #[derive(Debug, Copy, Clone)] pub struct JSClass { _unused: [u8; 0], } pub type JSClassID = u32; pub type JSAtom = u32; pub const JS_TAG_FIRST: _bindgen_ty_1 = -11; pub const JS_TAG_BIG_DECIMAL: _bindgen_ty_...
code_fim
hard
{ "lang": "rust", "repo": "DelSkayn/rquickjs", "path": "/sys/src/bindings/x86_64-apple-darwin.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sagiegurari/fsio path: /src/error_test.rs use super::*; #[test] fn display_error_path_already_exists() { let error = FsIOError::PathAlreadyExists("test".to_string()); println!("{}", error); } <|fim_suffix|> let error = FsIOError::IOError("test".to_string(), None); println!("{}",...
code_fim
medium
{ "lang": "rust", "repo": "sagiegurari/fsio", "path": "/src/error_test.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn display_error_system_time_error() { let error = FsIOError::SystemTimeError("test".to_string(), None); println!("{}", error); }<|fim_prefix|>// repo: sagiegurari/fsio path: /src/error_test.rs use super::*; #[test] fn display_error_path_already_exists() { let error = FsIOError::Path...
code_fim
medium
{ "lang": "rust", "repo": "sagiegurari/fsio", "path": "/src/error_test.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let error = FsIOError::SystemTimeError("test".to_string(), None); println!("{}", error); }<|fim_prefix|>// repo: sagiegurari/fsio path: /src/error_test.rs use super::*; #[test] fn display_error_path_already_exists() { let error = FsIOError::PathAlreadyExists("test".to_string()); println!...
code_fim
hard
{ "lang": "rust", "repo": "sagiegurari/fsio", "path": "/src/error_test.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut map = ::serde::Serializer::serialize_map(s, None)?; if let Some(ref crl_sign) = self.crl_sign { ::serde::ser::SerializeMap::serialize_entry(&mut map, "CRLSign", crl_sign)?; } if let Some(ref data_encipherment) = self.data_encipherment...
code_fim
hard
{ "lang": "rust", "repo": "srijs/rust-cfn", "path": "/src/aws/acmpca.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: srijs/rust-cfn path: /src/aws/acmpca.rs = None; let mut distinguished_name_qualifier: Option<::Value<String>> = None; let mut generation_qualifier: Option<::Value<String>> = None; let mut given_name: Option<::Value<String>> = None; ...
code_fim
hard
{ "lang": "rust", "repo": "srijs/rust-cfn", "path": "/src/aws/acmpca.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: srijs/rust-cfn path: /src/aws/acmpca.rs mazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-acmpca-certificate-keyusage.html#cfn-acmpca-certificate-keyusage-digitalsignature). /// /// Update type: _Immutable_. /// AWS CloudFormation replaces the resource when you ...
code_fim
hard
{ "lang": "rust", "repo": "srijs/rust-cfn", "path": "/src/aws/acmpca.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oribenshir/learning_rust path: /docker_file_generator/examples/dynamic.rs use std::path::{ PathBuf }; use std::fs; use std::env; use dock_gen::generator::{DockerfileGenerator, GenerateError}; fn main() { let args: Vec<String> = env::args().collect(); if args.len() != 2 { printl...
code_fim
hard
{ "lang": "rust", "repo": "oribenshir/learning_rust", "path": "/docker_file_generator/examples/dynamic.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match result { Ok(_) => println!("Docker file generated successfully"), Err(error) => { match error { GenerateError::InvalidArgument(reason) => println!("Failed to generated docker file: {}", reason), GenerateError::IO(io_error) => println!("...
code_fim
hard
{ "lang": "rust", "repo": "oribenshir/learning_rust", "path": "/docker_file_generator/examples/dynamic.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(PartialEq, Default, Debug, Clone, Serialize, Deserialize)] pub struct ReferenceTypeCollector { pub data: ReferenceType, pub on_dot: bool, }<|fim_prefix|>// repo: BrainWiggans/Ellie-Language path: /parser/src/syntax/types/reference_type.rs use crate::syntax::types; use ellie_core::defs; u...
code_fim
hard
{ "lang": "rust", "repo": "BrainWiggans/Ellie-Language", "path": "/parser/src/syntax/types/reference_type.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: BrainWiggans/Ellie-Language path: /parser/src/syntax/types/reference_type.rs use crate::syntax::types; use ellie_core::defs; use serde::{Deserialize, Serialize}; <|fim_suffix|>#[derive(PartialEq, Default, Debug, Clone, Serialize, Deserialize)] pub struct ReferenceTypeCollector { pub data: R...
code_fim
hard
{ "lang": "rust", "repo": "BrainWiggans/Ellie-Language", "path": "/parser/src/syntax/types/reference_type.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shssoichiro/oxipng path: /src/reduction/bit_depth.rs use crate::colors::{BitDepth, ColorType}; use crate::headers::IhdrData; use crate::png::PngImage; /// Attempt to reduce a 16-bit image to 8-bit, returning the reduced image if successful #[must_use] pub fn reduced_bit_depth_16_to_8(png: &PngI...
code_fim
hard
{ "lang": "rust", "repo": "shssoichiro/oxipng", "path": "/src/reduction/bit_depth.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Expand a 1/2/4-bit image to 8-bit, returning the expanded image if successful #[must_use] pub fn expanded_bit_depth_to_8(png: &PngImage) -> Option<PngImage> { let bit_depth = png.ihdr.bit_depth as u32; if bit_depth >= 8 { return None; } // Calculate the current number of pixels...
code_fim
hard
{ "lang": "rust", "repo": "shssoichiro/oxipng", "path": "/src/reduction/bit_depth.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // If the image is grayscale we also need to reduce the transparency pixel let color_type = if let ColorType::Grayscale { transparent_shade: Some(trans), } = png.ihdr.color_type { let reduced_trans = (trans & 0xFF) >> (8 - minimum_bits); // Verify the reduction is v...
code_fim
hard
{ "lang": "rust", "repo": "shssoichiro/oxipng", "path": "/src/reduction/bit_depth.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: flier/rust-dapr path: /dapr-derive/src/stub.rs use proc_macro2::TokenStream; use quote::{format_ident, quote}; use syn::{parse_quote, Ident, TraitItem}; use crate::client::{arg_type_name, arg_types, result_type_name, result_types}; pub fn dapr_stub(item: &syn::ItemTrait) -> TokenStream { l...
code_fim
hard
{ "lang": "rust", "repo": "flier/rust-dapr", "path": "/dapr-derive/src/stub.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> quote! { async #method } } else { quote! { #item } } }); quote! { #[::dapr::async_trait] #(#attrs)* #vis trait #ident #ty_generics #colon_token #supertraits #where_clause { #(#items)* } } } pub fn output_type(output:...
code_fim
hard
{ "lang": "rust", "repo": "flier/rust-dapr", "path": "/dapr-derive/src/stub.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let pack_args = { let name = arg_type_name(trait_name, method); let args = args.clone().map(|syn::PatType { pat, .. }| pat); quote! { let args = #name { #(#args),* }; let args = ::dapr::json::pack(&args)?; } }; let invoke_service = quot...
code_fim
hard
{ "lang": "rust", "repo": "flier/rust-dapr", "path": "/dapr-derive/src/stub.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: leod/catch-rs path: /catch_client/src/main.rs #[macro_use] extern crate log; extern crate env_logger; extern crate renet as enet; #[macro_use] extern crate ecs; extern crate time; #[macro_use] extern crate glium; extern crate glium_text; extern crate getopts; extern crate rand; extern crate rodi...
code_fim
hard
{ "lang": "rust", "repo": "leod/catch-rs", "path": "/catch_client/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> info!("connected to server! My id: {}", client.my_id()); info!("game info: {:?}", client.game_info()); if !dummy { let display = glium::glutin::WindowBuilder::new() .with_dimensions(640, 480) .with_title(format!("Catching game")) .build_glium() ...
code_fim
hard
{ "lang": "rust", "repo": "leod/catch-rs", "path": "/catch_client/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/advent-of-code-3 path: /crates/core/src/year2016/day15.rs use crate::Input; struct Disc { positions: u32, initial_position: u32, } pub fn solve(input: &mut Input) -> Result<u32, String> { const MAX_TIME: u32 = 10_000_000; let mut discs = input .text .li...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/advent-of-code-3", "path": "/crates/core/src/year2016/day15.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] pub fn tests() { use crate::{test_part_one, test_part_two}; test_part_one!("Disc #1 has 5 positions; at time=0, it is at position 4. Disc #2 has 2 positions; at time=0, it is at position 1." => 5); let real_input = include_str!("day15_input.txt"); test_part_one!(real_input => 203...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/advent-of-code-3", "path": "/crates/core/src/year2016/day15.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bheisler/RustaCUDA path: /src/memory/malloc.rs use super::DeviceCopy; use crate::error::*; use crate::memory::DevicePointer; use crate::memory::UnifiedPointer; use std::mem; use std::os::raw::c_void; use std::ptr; /// Unsafe wrapper around the `cuMemAlloc` function, which allocates some device ...
code_fim
hard
{ "lang": "rust", "repo": "bheisler/RustaCUDA", "path": "/src/memory/malloc.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_cuda_malloc_unified_overflow() { let _context = crate::quick_init().unwrap(); unsafe { assert_eq!( CudaError::InvalidMemoryAllocation, cuda_malloc_unified::<u64>(::std::usize::MAX - 1).unwrap_err() ); }...
code_fim
hard
{ "lang": "rust", "repo": "bheisler/RustaCUDA", "path": "/src/memory/malloc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_cuda_malloc_unified() { let _context = crate::quick_init().unwrap(); unsafe { let mut unified = cuda_malloc_unified::<u64>(1).unwrap(); assert!(!unified.is_null()); // Write to the allocated memory *unified.as_raw_mut...
code_fim
hard
{ "lang": "rust", "repo": "bheisler/RustaCUDA", "path": "/src/memory/malloc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: luojia65/gwzos path: /gwzos-riscv-qemu/src/main.rs #![feature(naked_functions, asm)] #![no_std] #![no_main] <|fim_suffix|>#[cfg_attr(not(test), panic_handler)] #[allow(unused)] fn panic(info: &core::panic::PanicInfo) -> ! { loop {} }<|fim_middle|>#[macro_use] mod console; mod start; mod mm...
code_fim
easy
{ "lang": "rust", "repo": "luojia65/gwzos", "path": "/gwzos-riscv-qemu/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg_attr(not(test), panic_handler)] #[allow(unused)] fn panic(info: &core::panic::PanicInfo) -> ! { loop {} }<|fim_prefix|>// repo: luojia65/gwzos path: /gwzos-riscv-qemu/src/main.rs #![feature(naked_functions, asm)] #![no_std] #![no_main] <|fim_middle|>#[macro_use] mod console; mod start; mod mm...
code_fim
easy
{ "lang": "rust", "repo": "luojia65/gwzos", "path": "/gwzos-riscv-qemu/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: septimochen/rust-algs path: /src/dynamic_programming/all_construct.rs use std::collections::HashMap; #[allow(dead_code)] pub fn all_construct<'a>(target: &'a str, word_bank: &Vec<&'a str>) -> Vec<Vec<&'a str>> { let mut memo: HashMap<&str, Vec<Vec<&str>>> = HashMap::new(); helper(target...
code_fim
hard
{ "lang": "rust", "repo": "septimochen/rust-algs", "path": "/src/dynamic_programming/all_construct.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for &word in word_bank { if target.starts_with(word) { let suffix = target.strip_prefix(word).unwrap_or(""); let suffix_ways = helper(suffix, word_bank, memo); let mut target_ways = vec![]; for mut x in suffix_ways { x.insert(0, w...
code_fim
hard
{ "lang": "rust", "repo": "septimochen/rust-algs", "path": "/src/dynamic_programming/all_construct.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }