text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>use crate::component::*; use crate::config::PlanePrototypeRef; use crate::protocol::client::Login; use crate::protocol::FlagCode; use crate::util::NalgebraExt; use crate::Vector2; /// Build a player pub(crate) fn build_default_player( login: &Login, proto: PlanePrototypeRef, start_time: Instant, ...
code_fim
medium
{ "lang": "rust", "repo": "steamroller-airmash/airmash-server", "path": "/server/src/defaults.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reitermarkus/msp432p401r-pac path: /src/eusci_b3/ucbx_ctlw0.rs .w.bits & !(0x01 << 5)) | (((value as u16) & 0x01) << 5); self.w } } #[doc = "eUSCI_B clock source select\n\nValue on reset: 3"] #[derive(Clone, Copy, Debug, PartialEq)] #[repr(u8)] pub enum UCSSEL_A { #[doc = "0: UCL...
code_fim
hard
{ "lang": "rust", "repo": "reitermarkus/msp432p401r-pac", "path": "/src/eusci_b3/ucbx_ctlw0.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> variant as u8 != 0 } } #[doc = "Reader of field `UCSLA10`"] pub type UCSLA10_R = crate::R<bool, UCSLA10_A>; impl UCSLA10_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> UCSLA10_A { match self.bits { false => UCSLA10_A::UC...
code_fim
hard
{ "lang": "rust", "repo": "reitermarkus/msp432p401r-pac", "path": "/src/eusci_b3/ucbx_ctlw0.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: reitermarkus/msp432p401r-pac path: /src/eusci_b3/ucbx_ctlw0.rs leased for operation"] #[inline(always)] pub fn ucswrst_0(self) -> &'a mut W { self.variant(UCSWRST_A::UCSWRST_0) } #[doc = "Enabled. eUSCI_B logic held in reset state"] #[inline(always)] pub fn ucswrs...
code_fim
hard
{ "lang": "rust", "repo": "reitermarkus/msp432p401r-pac", "path": "/src/eusci_b3/ucbx_ctlw0.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl CollectionData { pub fn add_fonts(&mut self, scanner: &mut FontScanner, data: super::font::FontData, mut reg: Option<&mut Registration>) -> Option<u32> { let is_user = self.is_user; let source_id = SourceId::alloc(self.sources.len(), is_user)?; let mut added_source = false...
code_fim
hard
{ "lang": "rust", "repo": "chrsan/fount", "path": "/src/scan.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chrsan/fount path: /src/scan.rs use super::data::*; use super::id::*; use super::Registration; use swash::{Attributes, CacheKey, FontDataRef, FontRef, Stretch, StringId}; use std::sync::{Arc, RwLock}; #[derive(Default)] pub struct ScannedFont { pub name: String, pub lowercase_name: Stri...
code_fim
hard
{ "lang": "rust", "repo": "chrsan/fount", "path": "/src/scan.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: denny1997/Bitcoin-client-with-Prism-1.0 path: /src/block.rs use serde::{Serialize, Deserialize}; use crate::crypto::hash::{H256, Hashable}; use crate::transaction::{Transaction, SignedTransaction}; use ring::digest; use rand::Rng; use crate::crypto::merkle::{MerkleTree}; #[derive(Serialize, Des...
code_fim
hard
{ "lang": "rust", "repo": "denny1997/Bitcoin-client-with-Prism-1.0", "path": "/src/block.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Hashable for Block { fn hash(&self) -> H256 { return self.header.hash(); } } #[cfg(any(test, test_utilities))] pub mod test { use super::*; use crate::crypto::hash::H256; pub fn generate_random_block(parent: &H256) -> Block { let mut rng = rand::thread_rng(); ...
code_fim
hard
{ "lang": "rust", "repo": "denny1997/Bitcoin-client-with-Prism-1.0", "path": "/src/block.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, Deserialize, Debug, Clone)] pub struct Block { pub header:Header, pub txPointer:TxPointer, pub content:Content, } impl Hashable for Block { fn hash(&self) -> H256 { return self.header.hash(); } } #[cfg(any(test, test_utilities))] pub mod test { use sup...
code_fim
hard
{ "lang": "rust", "repo": "denny1997/Bitcoin-client-with-Prism-1.0", "path": "/src/block.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mokosha/pbrt_rust path: /src/spectrum.rs les(samples: &[(f32, f32)], lambda_start: f32, lambda_end: f32) -> f32 { // Handle cases with out of bounds range or single sample only if samples.len() == 0 { return 0.0 } if lambda_end ...
code_fim
hard
{ "lang": "rust", "repo": "Mokosha/pbrt_rust", "path": "/src/spectrum.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Mokosha/pbrt_rust path: /src/spectrum.rs y if samples.len() == 0 { return 0.0 } if lambda_end <= samples[0].0 { return samples[0].1 } if lambda_start >= samples.last().unwrap().0 { return samples.last().unwrap().1 } if samples.len() == 1 { return samples[0].1 } l...
code_fim
hard
{ "lang": "rust", "repo": "Mokosha/pbrt_rust", "path": "/src/spectrum.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.elementwise(_rhs, |(x, y)| x / y) } } impl Div<f32> for Spectrum { type Output = Spectrum; fn div(self, _rhs: f32) -> Spectrum { self.transform(|x| x / _rhs) } } impl<'a> Div<f32> for &'a Spectrum { type Output = Spectrum; fn div(self, _rhs: f32) -> Spectrum ...
code_fim
hard
{ "lang": "rust", "repo": "Mokosha/pbrt_rust", "path": "/src/spectrum.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> None } pub fn is_empty(&self) -> bool { self.bitmex_orders.is_empty() && self.deribit_orders.is_empty() } pub fn is_one_filled_one_unfilled(&self) -> bool { if self.bitmex_orders.len() == self.deribit_orders.len() { if let (Some(last_bitmex_order), Som...
code_fim
hard
{ "lang": "rust", "repo": "ssh352/crypto-trading-bot-public", "path": "/src/portfolio.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ssh352/crypto-trading-bot-public path: /src/portfolio.rs use crate::{ constants::*, order::{Order, OrderStatus, OrderUpdate}, Exchange::*, }; use chrono::{DateTime, Utc}; use std::cmp::{max, min}; /// Keeps track of current state of portfolio #[derive(Clone, Debug)] pub struct Portf...
code_fim
hard
{ "lang": "rust", "repo": "ssh352/crypto-trading-bot-public", "path": "/src/portfolio.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sify21/couch-rs path: /couch_rs/src/model.rs use crate::document::TypedCouchDocument; use serde::ser::Serialize; use serde_json::{from_value, to_value, Value}; /// Trait that provides methods that can be used to switch between abstract `Value` and concrete `Model` implementors (such as your cus...
code_fim
easy
{ "lang": "rust", "repo": "sify21/couch-rs", "path": "/couch_rs/src/model.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> from_value(d).unwrap() } fn to_raw(&self) -> Value where Self: Serialize, { to_value(self).unwrap() } }<|fim_prefix|>// repo: sify21/couch-rs path: /couch_rs/src/model.rs use crate::document::TypedCouchDocument; use serde::ser::Serialize; use serde_json::{from...
code_fim
hard
{ "lang": "rust", "repo": "sify21/couch-rs", "path": "/couch_rs/src/model.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> where Self: Serialize, { to_value(self).unwrap() } }<|fim_prefix|>// repo: sify21/couch-rs path: /couch_rs/src/model.rs use crate::document::TypedCouchDocument; use serde::ser::Serialize; use serde_json::{from_value, to_value, Value}; /// Trait that provides methods that can ...
code_fim
easy
{ "lang": "rust", "repo": "sify21/couch-rs", "path": "/couch_rs/src/model.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn gen_key_returns_correct_size_keys() { let key = gen_key(); assert_eq!(key.0.len(), KEY_BYTES); } #[test] fn gen_nonce_returns_correct_size_once() { let nonce = gen_nonce(); assert_eq!(nonce.0.len(), NONCE_BYTES); } #[test] fn gen...
code_fim
hard
{ "lang": "rust", "repo": "Fanarito/libpassvault", "path": "/src/crypto.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Fanarito/libpassvault path: /src/crypto.rs //! Provides a high level API for encrypting and decrypting bytes use ring::{digest, pbkdf2, aead, rand}; use ring::rand::SecureRandom; static DIGEST_ALG: &'static digest::Algorithm = &digest::SHA256; static ENCRYPTION_ALG: &'static aead::Algorithm = ...
code_fim
hard
{ "lang": "rust", "repo": "Fanarito/libpassvault", "path": "/src/crypto.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn add_suffix_space_adds_space() { let byte_length = 20; let mut bytes = vec![0; byte_length]; assert_eq!(bytes.len(), byte_length); add_suffix_space(&mut bytes); assert_eq!(bytes.len(), byte_length + ENCRYPTION_ALG.tag_len()); } #[test] ...
code_fim
hard
{ "lang": "rust", "repo": "Fanarito/libpassvault", "path": "/src/crypto.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `lo_vco_short_vbias_filter` writer - "] pub struct LO_VCO_SHORT_VBIAS_FILTER_W<'a> { w: &'a mut W, } impl<'a> LO_VCO_SHORT_VBIAS_FILTER_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true)...
code_fim
hard
{ "lang": "rust", "repo": "username223/bl602-pac", "path": "/src/rf/vco2.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: username223/bl602-pac path: /src/rf/vco2.rs #[doc = "Register `vco2` reader"] pub struct R(crate::R<VCO2_SPEC>); impl core::ops::Deref for R { type Target = crate::R<VCO2_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } } impl core::convert::From<crat...
code_fim
hard
{ "lang": "rust", "repo": "username223/bl602-pac", "path": "/src/rf/vco2.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `lo_vco_idac_boot` writer - "] pub struct LO_VCO_IDAC_BOOT_W<'a> { w: &'a mut W, } impl<'a> LO_VCO_IDAC_BOOT_W<'a> { #[doc = r"Sets the field bit"] #[inline(always)] pub fn set_bit(self) -> &'a mut W { self.bit(true) } #[doc = r"Clears...
code_fim
hard
{ "lang": "rust", "repo": "username223/bl602-pac", "path": "/src/rf/vco2.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/Emuka path: /emuka-client/src/audio.rs use core::panic; use std::{collections::VecDeque, sync::Mutex}; use avro_rs::{Reader, types::Value}; use cpal::{OutputCallbackInfo, SampleFormat, SampleRate, Stream, SupportedStreamConfigRange, traits::{DeviceTrait, HostTrait, StreamTrait}}; use ey...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/Emuka", "path": "/emuka-client/src/audio.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let reader = Reader::with_schema(&AUDIO_DATA_API_SCHEMA, &avro_data[..]).unwrap(); for record in reader { match record.unwrap() { Value::Record(fields) => { let bytes = &fields.get(0).unwrap().1; match bytes { Value::Bytes(dat...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/Emuka", "path": "/emuka-client/src/audio.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub async fn init_audio_requests(base: String) -> Result<()> { let audio_id = reqwest::get(&format!("{}/api/v1/audio/register", base)) .await? .json::<AudioRegisterApi>() .await? .id; tokio::spawn(async move { let mut interval = time::interval(time::Dur...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/Emuka", "path": "/emuka-client/src/audio.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> f.write_str("service overloaded") } } impl std::error::Error for Overloaded {}<|fim_prefix|>// repo: tower-rs/tower path: /tower/src/load_shed/error.rs //! Error types use std::fmt; /// An error returned by [`LoadShed`] when the underlying service /// is not ready to handle any requests at...
code_fim
medium
{ "lang": "rust", "repo": "tower-rs/tower", "path": "/tower/src/load_shed/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tower-rs/tower path: /tower/src/load_shed/error.rs //! Error types use std::fmt; /// An error returned by [`LoadShed`] when the underlying service /// is not ready to handle any requests at the time of being /// called. /// /// [`LoadShed`]: crate::load_shed::LoadShed #[derive(Default)] pub st...
code_fim
medium
{ "lang": "rust", "repo": "tower-rs/tower", "path": "/tower/src/load_shed/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl fmt::Display for Overloaded { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { f.write_str("service overloaded") } } impl std::error::Error for Overloaded {}<|fim_prefix|>// repo: tower-rs/tower path: /tower/src/load_shed/error.rs //! Error types use std::fmt; /// An error r...
code_fim
medium
{ "lang": "rust", "repo": "tower-rs/tower", "path": "/tower/src/load_shed/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn matches(text: &str) -> Vec<Match> { let mut matches = Vec::new(); for (row, line) in text.split('\n').enumerate() { let ascii = &util::Lazy::new(|| line.is_ascii()); /// Constructs a `Match` from a `regex::Match`. /// We use a macro here to (a) avoid the overhead of...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/tmux-copy", "path": "/src/find.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nwtnni/tmux-copy path: /src/find.rs use once_cell::sync; use crate::util; macro_rules! regex_set { ($($name:ident: $regex:expr);* $(;)?) => { paste::item! { $( static $name: &str = $regex; static [<$name _RE>]: sync::Lazy<regex::Regex> = ...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/tmux-copy", "path": "/src/find.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>! [ feature = " fs " ] pub mod statfs ; } feature ! { # ! [ feature = " fs " ] pub mod statvfs ; } # [ cfg ( any ( target_os = " android " target_os = " linux " ) ) ] # [ cfg_attr ( docsrs doc ( cfg ( all ( ) ) ) ) ] # [ allow ( missing_docs ) ] pub mod sysinfo ; feature ! { # ! [ feature = " term " ] # [...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/nix/src/sys/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> " fuchsia " target_os = " illumos " target_os = " haiku " ) ) ) ] feature ! { # ! [ feature = " resource " ] pub mod resource ; } # [ cfg ( not ( target_os = " redox " ) ) ] feature ! { # ! [ feature = " poll " ] pub mod select ; } # [ cfg ( any ( target_os = " android " target_os = " dragonfly " target_...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/nix/src/sys/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/nix/src/sys/mod.rs / / ! Mostly platform - specific functionality # [ cfg ( any ( target_os = " dragonfly " target_os = " freebsd " target_os = " ios " all ( target_os = " linux " not ( target_env = " uclibc " ) ) target_os = " macos " target_o...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/nix/src/sys/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Rusty-Quartz/quartz_commands path: /macros/src/parse.rs ument node, or a node which can take on a value. Argument nodes can be of any /// type which implements FromArgument, and they can also have a default value. Nodes of /// the type String and &'cmd str can be declared as `greedy`, me...
code_fim
hard
{ "lang": "rust", "repo": "Rusty-Quartz/quartz_commands", "path": "/macros/src/parse.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Iterator type for flattening nodes pub enum FlattenNodeIter<'a> { Singleton(Option<&'a Node>), Multiple(<&'a Punctuated<Node, Token![,]> as IntoIterator>::IntoIter), } impl<'a> Iterator for FlattenNodeIter<'a> { type Item = &'a Node; fn next(&mut self) -> Option<Self::Item> { ...
code_fim
hard
{ "lang": "rust", "repo": "Rusty-Quartz/quartz_commands", "path": "/macros/src/parse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Returns a unique, valid identifier for this node. Arguments will simply return their name, /// whereas literals will return an identifier with a hash of the literal incorporated. /// /// # Panics /// Panics if this node is not an argument or literal. pub fn unique_ident(&self) ...
code_fim
hard
{ "lang": "rust", "repo": "Rusty-Quartz/quartz_commands", "path": "/macros/src/parse.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub const GAMMAS_INV_MONTGOMERY: [u16; 1024] = [ 256, 10570, 1510, 7238, 1034, 7170, 6291, 7921, 11665, 3422, 4000, 2327, 2088, 5565, 795, 10647, 1521, 5484, 2539, 7385, 1055, 7173, 8047, 11683, 1669, 1994, 3796, 5809, 4341, 9398, 11876, 12230, 10525, 12037, 12253, 3506, 4012, 9351, 4847, 2448...
code_fim
hard
{ "lang": "rust", "repo": "vlad9486/pq-newhope", "path": "/src/poly/tables.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vlad9486/pq-newhope path: /src/poly/tables.rs 5, 6974, 7373, 7965, 3262, 5079, 522, 2169, 6364, 1018, 1041, 8775, 2344, 11011, 5574, 1973, 4536, 1050, 6844, 3860, 3818, 6118, 2683, 1190, 4789, 7822, 7540, 6752, 5456, 4449, 3789, 12142, 11973, 382, 3988, 468, 6843, 5339, 6196, 3710, 11316...
code_fim
hard
{ "lang": "rust", "repo": "vlad9486/pq-newhope", "path": "/src/poly/tables.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nephele-rs/cynthia path: /cynthia/src/runtime/mod.rs pub use { crate::future::{future, prelude, stream, swap}, crate::io::{block_on, Async}, crate::runtime::blocking::{unblock, Unblock}, }; <|fim_suffix|>mod local; pub use local::LocalExecutor; pub use crate::net::transport::UdpSoc...
code_fim
hard
{ "lang": "rust", "repo": "nephele-rs/cynthia", "path": "/cynthia/src/runtime/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>mod executor; pub use executor::{Executor, MonoExecutor}; mod local; pub use local::LocalExecutor; pub use crate::net::transport::UdpSocket; pub use crate::net::transport::{Incoming, TcpListener, TcpStream};<|fim_prefix|>// repo: nephele-rs/cynthia path: /cynthia/src/runtime/mod.rs pub use { crate:...
code_fim
medium
{ "lang": "rust", "repo": "nephele-rs/cynthia", "path": "/cynthia/src/runtime/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let program = Program { statements: vec![Statement::LetStatement(LetStatement { token: Token { ttype: LET, literal: String::from("let"), }, name: Some(Identifier { token: Token {...
code_fim
hard
{ "lang": "rust", "repo": "ogenev/monkey_interpreter", "path": "/src/ast.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ogenev/monkey_interpreter path: /src/ast.rs use crate::token::Token; trait Node { fn token_literal(&self) -> String; fn string(&self) -> String; } #[derive(Eq, PartialEq, Debug)] pub enum Statement<'a> { LetStatement(LetStatement<'a>), ReturnStatement(ReturnStatement<'a>), ...
code_fim
hard
{ "lang": "rust", "repo": "ogenev/monkey_interpreter", "path": "/src/ast.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: m-kann0/atcoder-rust path: /examples/joi2012yo_d.rs #![allow(non_snake_case)] use std::io::Read; fn main() { let mut buf = String::new(); std::io::stdin().read_to_string(&mut buf).unwrap(); let answer = solve(&buf); println!("{}", answer); } fn solve(input: &str) -> String {...
code_fim
hard
{ "lang": "rust", "repo": "m-kann0/atcoder-rust", "path": "/examples/joi2012yo_d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gbip/rust-render-engine path: /src/scene.rs use std::vec::Vec; use math::{Vector3, Vector3f, VectorialOperations}; use geometry::obj3d::Object; use light::LightObject; use sampler::Sample; use ray::Ray; use io_utils; use serde_json; use renderer::render::Renderer; use std::time::Instant; use ray...
code_fim
hard
{ "lang": "rust", "repo": "gbip/rust-render-engine", "path": "/src/scene.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // La distance entre le canvas et l'origine de la caméra. clip: f32, } const DEFAULT_FOV: f32 = 70.0; const DEFAULT_CLIP: f32 = 0.1; impl Camera { pub fn new(position: Vector3f, target: Vector3f, up: Vector3f) -> Self { Camera { world_position: position, targe...
code_fim
hard
{ "lang": "rust", "repo": "gbip/rust-render-engine", "path": "/src/scene.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_camera_canvas_base() { let cam: Camera = Camera { world_position: Vector3f { x: 4.0, y: 4.0, z: 4.0, }, target_position: Vector3f { x: -1.0, y: -1.0, ...
code_fim
hard
{ "lang": "rust", "repo": "gbip/rust-render-engine", "path": "/src/scene.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>rks / / / A significant figure is determined using the following rules : / / / 1 . Non - zero digits are always significant . / / / 2 . Zeros between non - zero digits are always significant . / / / 3 . Leading zeros are never significant . / / / 4 . Trailing zeros are only significant if the number conta...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/rust_decimal/src/decimal.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>d_assign ( & mut self other : & ' a Decimal ) { Decimal : : add_assign ( self * other ) } } impl < ' a > AddAssign < Decimal > for & ' a mut Decimal { fn add_assign ( & mut self other : Decimal ) { Decimal : : add_assign ( * self other ) } } impl < ' a > AddAssign < & ' a Decimal > for & ' a mut Decimal {...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/rust_decimal/src/decimal.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/rust_decimal/src/decimal.rs tive ( ) & & ! self . fract ( ) . is_zero ( ) { floored - ONE } else { floored } } / / / Returns the smallest integer greater than or equal to a number . / / / / / / # Example / / / / / / / / / # use rust_decimal : :...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/rust_decimal/src/decimal.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wingyplus/nlpo3 path: /nlpo3-nodejs/src/lib.rs use ahash::AHashMap as HashMap; use lazy_static::lazy_static; use neon::prelude::*; use nlpo3::tokenizer::{newmm_custom::Newmm, tokenizer_trait::Tokenizer}; use std::sync::Mutex; lazy_static! { static ref DICT_COLLECTION:Mutex<HashMap<String,Bo...
code_fim
hard
{ "lang": "rust", "repo": "wingyplus/nlpo3", "path": "/nlpo3-nodejs/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut dict_col_lock = DICT_COLLECTION.lock().unwrap(); let file_path = cx.argument::<JsString>(0)?.value(&mut cx); let dict_name = cx.argument::<JsString>(1)?.value(&mut cx); if dict_name == "default" { Ok(cx.string(format!("Failed: 'default' dictionary name is reserved"))) }...
code_fim
medium
{ "lang": "rust", "repo": "wingyplus/nlpo3", "path": "/nlpo3-nodejs/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Vec3 { x: self.dot(rhs.c0), y: self.dot(rhs.c1), z: self.dot(rhs.c2), } } }<|fim_prefix|>// repo: msiglreith/glace path: /glace/src/mat33.rs use super::Vec3; use crate::std::scalar::Scalar; use core::ops::Mul; #[derive(Debug, Copy, Clone)] #[cfg_at...
code_fim
hard
{ "lang": "rust", "repo": "msiglreith/glace", "path": "/glace/src/mat33.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { c0: Default::default(), c1: Default::default(), c2: Default::default(), } } } impl Mat33<f32> { #[cfg(target_arch = "spirv")] pub fn transpose(&self) -> Self { let mut result = Self::default(); unsafe { asm...
code_fim
medium
{ "lang": "rust", "repo": "msiglreith/glace", "path": "/glace/src/mat33.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: msiglreith/glace path: /glace/src/mat33.rs use super::Vec3; use crate::std::scalar::Scalar; use core::ops::Mul; #[derive(Debug, Copy, Clone)] #[cfg_attr(target_arch = "spirv", spirv(matrix))] pub struct Mat33<T> { pub c0: Vec3<T>, pub c1: Vec3<T>, pub c2: Vec3<T>, } <|fim_suffix|> ...
code_fim
hard
{ "lang": "rust", "repo": "msiglreith/glace", "path": "/glace/src/mat33.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: longlb/exercism path: /rust/largest-series-product/src/lib.rs #[derive(Debug, PartialEq)] pub enum Error { SpanTooLong, InvalidDigit(char), } <|fim_suffix|> let mut max = 0; for slice in string_digits.chars().collect::<Vec<char>>().windows(span) { let x = slice ...
code_fim
hard
{ "lang": "rust", "repo": "longlb/exercism", "path": "/rust/largest-series-product/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut max = 0; for slice in string_digits.chars().collect::<Vec<char>>().windows(span) { let x = slice .iter() .map(|c| c.to_digit(10).unwrap() as u64) .product::<u64>(); max = if x > max { x } else { max }; } Ok(max) }<|fim_prefix|>// ...
code_fim
hard
{ "lang": "rust", "repo": "longlb/exercism", "path": "/rust/largest-series-product/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>(2, 2, 8, 8); //! assert_eq!(canvas.frame(), //! " \ //! ⢄ //! ⠙⢄ //! ⠁ "); //! } //! ``` pub mod braille; pub mod block;<|fim_prefix|>// repo: awelkie/drawille-rs path: /src/lib.rs #![crate_type = "lib"] #![crate_name = "drawille"] //! drawille—a terminal graphics library for Rust. Th...
code_fim
hard
{ "lang": "rust", "repo": "awelkie/drawille-rs", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: awelkie/drawille-rs path: /src/lib.rs #![crate_type = "lib"] #![crate_name = "drawille"] //! drawille—a terminal graphics library for Rust. The `braille` module is based on th<|fim_suffix|>(2, 2, 8, 8); //! assert_eq!(canvas.frame(), //! " \ //! ⢄ //! ⠙⢄ //! ⠁ "); //! } //! ```...
code_fim
hard
{ "lang": "rust", "repo": "awelkie/drawille-rs", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>} fn handle_client(mut stream: TcpStream, router: Arc<Router>) { let mut request = Request::from_tcp_stream(&stream); let route = router.get_route(&request); let response_string = route.handle(&mut request).as_http_string(); let _ = stream.write(response_string.as_bytes()); }<|fim_prefix...
code_fim
hard
{ "lang": "rust", "repo": "mpgarate/aramid", "path": "/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for stream in listener.incoming() { let router = router_arc.clone(); self.pool.execute(|| { handle_client(stream.unwrap(), router); }); println!("executed"); } } pub fn handle(&mut self, path: &str, handler: Handler...
code_fim
hard
{ "lang": "rust", "repo": "mpgarate/aramid", "path": "/src/server.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mpgarate/aramid path: /src/server.rs use std::net::{TcpListener, TcpStream, ToSocketAddrs}; use std::io::Write; use std::sync::Arc; use request::Request; use thread_pool::ThreadPool; use router::{Route, Router, Handler}; pub struct AramidServer { pool: ThreadPool, router: Router, } ...
code_fim
medium
{ "lang": "rust", "repo": "mpgarate/aramid", "path": "/src/server.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn correct_straight() { let mut card_vec = Card::new_card_vec([(6, 0), (8, 2), (7, 3), (5, 1), (9, 1), (3, 2)]); card_vec.sort(); let card = combos::has_straight(&card_vec); assert_eq!(card, Some(Card::new(9, 1))); } #[test] fn incorrect_straight() { let mut card_vec = Card::ne...
code_fim
hard
{ "lang": "rust", "repo": "PGRoyal/pokers", "path": "/tests/combos.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PGRoyal/pokers path: /tests/combos.rs extern crate pokers; use pokers::cards::Card; use pokers::combos; #[test] fn correct_pair() { let mut card_vec = Card::new_card_vec([(8, 2), (7, 3), (6, 1), (8, 1)]); card_vec.sort(); let card = combos::has_pair(&card_vec); assert_eq!(card, ...
code_fim
hard
{ "lang": "rust", "repo": "PGRoyal/pokers", "path": "/tests/combos.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nilsso/challenge-solutions path: /exercism/rust/dot-dsl/src/node.rs use maplit::hashmap; use std::collections::HashMap; <|fim_suffix|>impl Node { pub fn new(name: &str) -> Self { Self { name: name.to_string(), attrs: hashmap! {}, } } }<|fim_middle...
code_fim
medium
{ "lang": "rust", "repo": "nilsso/challenge-solutions", "path": "/exercism/rust/dot-dsl/src/node.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Node { pub fn new(name: &str) -> Self { Self { name: name.to_string(), attrs: hashmap! {}, } } }<|fim_prefix|>// repo: nilsso/challenge-solutions path: /exercism/rust/dot-dsl/src/node.rs use maplit::hashmap; use std::collections::HashMap; use super::A...
code_fim
medium
{ "lang": "rust", "repo": "nilsso/challenge-solutions", "path": "/exercism/rust/dot-dsl/src/node.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cs2dsb/github-game-jam-2018 path: /src/config/physics.rs use amethyst::core::cgmath::Vector2; #[derive(Debug, Deserialize, Serialize)] pub struct PhysicsConfig { pub gravity: f32, pub lift_width: f32, pub lift_height: f32, pub lift_y_offset: f32, pub lift_velocity: Vector2<f32>, pub...
code_fim
medium
{ "lang": "rust", "repo": "cs2dsb/github-game-jam-2018", "path": "/src/config/physics.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Self { gravity: -9.81, lift_width: 50.0, lift_height: 50.0, lift_y_offset: -20.0, lift_velocity: Vector2::new(1.0, 1.0), lift_velocity_rotation: 0.1, change_direction_width: 50.0, change_direction_height: 50.0, exit_width: 50.0, exit_height: ...
code_fim
medium
{ "lang": "rust", "repo": "cs2dsb/github-game-jam-2018", "path": "/src/config/physics.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> $name::RESET } } impl $name { #[inline] pub fn advance(self, c: char) -> Self { match (self, c) { $($(($name::$state, $match))|+ => $name::$result,)* $(($name::$complete, ':') => $n...
code_fim
hard
{ "lang": "rust", "repo": "msgpo/urlocator", "path": "/src/scheme.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: msgpo/urlocator path: /src/scheme.rs macro_rules! schemes { ($name:ident { $([$state:ident, $($match:literal)|+ => $result:ident]$(,)?)* } [$($complete:ident),*]) => ( #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum $name { $($result,)*...
code_fim
hard
{ "lang": "rust", "repo": "msgpo/urlocator", "path": "/src/scheme.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>schemes! { SchemeState { [RESET, 'h'|'H' => H], [H, 't'|'T' => HT], [HT, 't'|'T' => HTT], [HTT, 'p'|'P' => HTTP], [HTTP, 's'|'S' => HTTPS], [RESET, 'f'|'F' => F], [F, 't'|'T' => FT], [FT, 'p'|'P' => FTP], [F, 'i'|'I' => FI], ...
code_fim
hard
{ "lang": "rust", "repo": "msgpo/urlocator", "path": "/src/scheme.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NathanSWard/gemini path: /gemini/src/ws/market/trade.rs use rust_decimal::Decimal; use serde::Deserialize; #[derive(Deserialize, Clone, Copy, PartialEq, Eq, Hash, Debug)] #[serde(rename_all = "lowercase")] pub enum MakerSide { Bid, Ask, Auction, } #[derive(Deserialize, Clone, Debug...
code_fim
hard
{ "lang": "rust", "repo": "NathanSWard/gemini", "path": "/gemini/src/ws/market/trade.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(flatten)] pub data: TradeData, } #[cfg(test)] pub(crate) mod test { use super::*; use rust_decimal_macros::dec; pub const TRADE_TEST_STRINGS: &[&str] = &[TRADE]; pub const BLOCK_TRADE_TEST_STRINGS: &[&str] = &[BLOCK_TRADE]; const TRADE: &str = r#"{ "type": "t...
code_fim
hard
{ "lang": "rust", "repo": "NathanSWard/gemini", "path": "/gemini/src/ws/market/trade.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if i[1] > last[1] { last = i; count += 1; } } count } }<|fim_prefix|>// repo: HerringtonDarkholme/leetcode path: /src/1288_remove_covered_intervals.rs impl Solution { pub fn remove_covered_intervals(mut intervals: Vec<Vec<i32>>) -> ...
code_fim
hard
{ "lang": "rust", "repo": "HerringtonDarkholme/leetcode", "path": "/src/1288_remove_covered_intervals.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HerringtonDarkholme/leetcode path: /src/1288_remove_covered_intervals.rs impl Solution { pub fn remove_covered_intervals(mut intervals: Vec<Vec<i32>>) -> i32 { if intervals.len() <= 1 {<|fim_suffix|>= &intervals[0]; let mut count = 1; for i in 1..intervals.len() { ...
code_fim
hard
{ "lang": "rust", "repo": "HerringtonDarkholme/leetcode", "path": "/src/1288_remove_covered_intervals.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let res = a + b; res } fn func03_copy02(a: i32, b: i32) -> i32 { a + b }<|fim_prefix|>// repo: aloha1024/LearnRust path: /x04_function/src/main.rs fn main() { println!("Hello, world!"); func01(); let a: i32 = 11; let b: u32 = 22; func02(1, 2); func02(a, b); print...
code_fim
medium
{ "lang": "rust", "repo": "aloha1024/LearnRust", "path": "/x04_function/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// fn func02(a, b) error fn func02(a: i32, b: u32) { println!("{},{}", a, b); } fn func03(a: i32, b: i32) -> i32 { let res = a + b; return res; } fn func03_copy01(a: i32, b: i32) -> i32 { let res = a + b; res } fn func03_copy02(a: i32, b: i32) -> i32 { a + b }<|fim_prefix|>// r...
code_fim
medium
{ "lang": "rust", "repo": "aloha1024/LearnRust", "path": "/x04_function/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aloha1024/LearnRust path: /x04_function/src/main.rs fn main() { println!("Hello, world!"); func01(); let a: i32 = 11; let b: u32 = 22; func02(1, 2); func02(a, b); println!("func3 result is {}", func03(1, 2)); println!("func3_copy result is {}", func03_copy01(11, ...
code_fim
hard
{ "lang": "rust", "repo": "aloha1024/LearnRust", "path": "/x04_function/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ltfschoen/rustrush-crypto-workshop path: /hash/src/main.rs //! This app computes hash sum of a given file (or stdin input) using selected //! cryptographic hashing algorithm. //! //! # Examples //! ```sh //! $ rustrush-hashes sha256 ../* //! ../Cargo.lock b94363eab7f77787553a6e4f0d4d850b356849...
code_fim
hard
{ "lang": "rust", "repo": "ltfschoen/rustrush-crypto-workshop", "path": "/hash/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> where D: Digest, R: io::Read { // TODO Ok(vec![]) } /// Process reader content using hash `Input` impl and return hash with the /// requested length. Panic if provided length is not supported. fn var_digest<D, R>(mut src: R, length: usize) -> io::Result<Vec<u8>> where D: Input + VariableO...
code_fim
hard
{ "lang": "rust", "repo": "ltfschoen/rustrush-crypto-workshop", "path": "/hash/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mas-yo/rustgs-testcl path: /src/main.rs use lazy_static::lazy_static; use rand; use rand::Rng; use std::env; use std::net::SocketAddr; use std::sync::{Arc, Mutex, RwLock}; use tokio::codec::{Decoder, Encoder, Framed}; use tokio::io; use tokio::net::{TcpListener, TcpStream}; use tokio::prelude::*...
code_fim
hard
{ "lang": "rust", "repo": "mas-yo/rustgs-testcl", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn main() -> Result<(), Box<std::error::Error>> { let args: Vec<String> = env::args().collect(); let addr = args[1].clone(); let (tx, rx) = futures::sync::mpsc::channel::<(u32, String)>(1024); let tx2 = tx.clone(); let mut ids = Vec::new(); for i in 0..100 { ids.push(...
code_fim
hard
{ "lang": "rust", "repo": "mas-yo/rustgs-testcl", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: letheed/aoc path: /rust/src/y2016/d06.rs use fnv::FnvHashMap as HashMap; use crate::{Date, Day, OkOrFail, Puzzle, Result}; const DATE: Date = Date::new(Day::D06, super::YEAR); pub(super) const PUZZLE: Puzzle = Puzzle::new(DATE, solve); <|fim_suffix|> let first_line = input.lines().next().o...
code_fim
medium
{ "lang": "rust", "repo": "letheed/aoc", "path": "/rust/src/y2016/d06.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let first_line = input.lines().next().ok_or_fail("input is empty")?; let mut count_maps = vec![HashMap::default(); first_line.chars().count()]; for line in input.lines() { for (c, count_map) in line.chars().zip(count_maps.iter_mut()) { count_map.entry(c).and_modify(|v| *v +...
code_fim
medium
{ "lang": "rust", "repo": "letheed/aoc", "path": "/rust/src/y2016/d06.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn kind(state: &Self::State) -> &str { &state.kind } } impl ErasedResource { fn erase<K: Resource>() -> ErasedResourceState { ErasedResourceState { group: K::GROUP, version: K::VERSION, kind: K::KIND, } } } impl<K: Resource> Fro...
code_fim
hard
{ "lang": "rust", "repo": "slinkydeveloper/extending-kubernetes-api-in-process-poc", "path": "/kube-rs-runtime/src/reflector/object_ref.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: slinkydeveloper/extending-kubernetes-api-in-process-poc path: /kube-rs-runtime/src/reflector/object_ref.rs use derivative::Derivative; use k8s_openapi::{apimachinery::pkg::apis::meta::v1::OwnerReference, Resource}; use kube::api::Meta; use std::{fmt::Debug, hash::Hash}; #[derive(Derivative)] #[...
code_fim
hard
{ "lang": "rust", "repo": "slinkydeveloper/extending-kubernetes-api-in-process-poc", "path": "/kube-rs-runtime/src/reflector/object_ref.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> &state.version } fn kind(state: &Self::State) -> &str { &state.kind } } impl ErasedResource { fn erase<K: Resource>() -> ErasedResourceState { ErasedResourceState { group: K::GROUP, version: K::VERSION, kind: K::KIND, } ...
code_fim
hard
{ "lang": "rust", "repo": "slinkydeveloper/extending-kubernetes-api-in-process-poc", "path": "/kube-rs-runtime/src/reflector/object_ref.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn as_proc_mut(&mut self) -> &mut Procedure { if let Symbol::Proc(proc) = self { proc } else { panic!("expected symbol `{}` to be a Procedure", self.name()); } } } #[derive(Debug, PartialEq, Eq, Hash, Clone)] pub enum SymbolKind { Var, P...
code_fim
hard
{ "lang": "rust", "repo": "spacemeshos/tytle", "path": "/tytle_core/src/ast/semantic/symbol.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: spacemeshos/tytle path: /tytle_core/src/ast/semantic/symbol.rs use crate::ast::semantic::{Procedure, Variable}; use std::fmt; #[derive(Debug, Hash, Copy, Clone, PartialEq, Eq)] pub struct SymbolId(pub usize); impl fmt::Display for SymbolId { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Re...
code_fim
hard
{ "lang": "rust", "repo": "spacemeshos/tytle", "path": "/tytle_core/src/ast/semantic/symbol.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Marwes/repa-rs path: /src/slice.rs use std::marker::PhantomData; use shape::{Cons, Z, Shape}; pub struct All; pub struct Any<S>(PhantomData<S>); pub fn any<S>() -> Any<S> { Any(PhantomData) } pub trait Slice { type Full: Shape; type Slice: Shape; fn slice_of_full(&self, full:...
code_fim
medium
{ "lang": "rust", "repo": "Marwes/repa-rs", "path": "/src/slice.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> slice: Cons<<S as Slice>::Slice, usize>) -> Cons<<S as Slice>::Full, usize> { Cons(self.0.full_of_slice(slice.0), slice.1) } } impl<S> Slice for Cons<S, usize> where S: Slice { type Full = Cons<<S as Slice>::Full, usize>; type Slice = <S a...
code_fim
hard
{ "lang": "rust", "repo": "Marwes/repa-rs", "path": "/src/slice.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<S> Slice for Cons<S, All> where S: Slice { type Full = Cons<<S as Slice>::Full, usize>; type Slice = Cons<<S as Slice>::Slice, usize>; fn slice_of_full(&self, full: Cons<<S as Slice>::Full, usize>) -> Cons<<S as Slice>::Slice, usize> { ...
code_fim
medium
{ "lang": "rust", "repo": "Marwes/repa-rs", "path": "/src/slice.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aheart/molecule-parser path: /src/model.rs pub type Atom = (String, usize); pub type Molecule = Vec<Atom>; /// Increase the index by a number /// add_atoms((H, 2), 1) -> (H, 3) pub fn add_atoms(atom: &Atom, number: usize) -> Atom { (atom.0.clone(), atom.1 + number) } /// Multiply the index...
code_fim
medium
{ "lang": "rust", "repo": "aheart/molecule-parser", "path": "/src/model.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> (atom.0.clone(), atom.1 * multiplier) } /// Multiply the indices of all atoms in a vector of Atoms (Molecule) pub fn mul_molecule(molecule: &Molecule, multiplier: usize) -> Molecule { molecule.iter() .map(|atom| { mul_atoms(atom, multiplier) }) .collect() }<|fi...
code_fim
medium
{ "lang": "rust", "repo": "aheart/molecule-parser", "path": "/src/model.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bacongobbler/clap path: /tests/help_env.rs #![cfg(feature = "env")] use std::env; use clap::{App, Arg}; mod utils; static HIDE_ENV: &str = "ctest 0.1 USAGE: ctest [OPTIONS] OPTIONS: -c, --cafe <FILE> A coffeehouse, coffee shop, or café. -h, --help Print help inform...
code_fim
hard
{ "lang": "rust", "repo": "bacongobbler/clap", "path": "/tests/help_env.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let app = App::new("ctest").version("0.1").arg( Arg::new("cafe") .short('c') .long("cafe") .hide_env_values(true) .env("ENVVAR") .about("A coffeehouse, coffee shop, or café."), ); assert!(utils::compare_output( app, ...
code_fim
hard
{ "lang": "rust", "repo": "bacongobbler/clap", "path": "/tests/help_env.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub company_short_cik: String, pub filing_name: String, pub filing_edgar_url: String, pub filing_quarter: i32, pub filing_year: i32, }<|fim_prefix|>// repo: murtyjones/birb path: /crates/filing-data/src/filing.rs use filing_metadata::time_periods::Quarter; use filing_metadata::time_peri...
code_fim
medium
{ "lang": "rust", "repo": "murtyjones/birb", "path": "/crates/filing-data/src/filing.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: murtyjones/birb path: /crates/filing-data/src/filing.rs use filing_metadata::time_periods::Quarter; use filing_metadata::time_periods::Year; #[derive(Debug, FromSql)] pub struct Filing { pub id: i32, <|fim_suffix|>_edgar_url: String, pub filing_quarter: i32, pub filing_year: i32, ...
code_fim
medium
{ "lang": "rust", "repo": "murtyjones/birb", "path": "/crates/filing-data/src/filing.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ring, pub password: String, pub email: String, }<|fim_prefix|>// repo: IvoSte/Schrobox path: /authentication_service/user_api/src/models.rs use serde::{Deserialize, Serialize}; #[derive(Deserial<|fim_middle|>ize, Serialize)] pub struct User { pub username: String, pub first_name: String,...
code_fim
medium
{ "lang": "rust", "repo": "IvoSte/Schrobox", "path": "/authentication_service/user_api/src/models.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IvoSte/Schrobox path: /authentication_service/user_api/src/models.rs use serde::{Deserialize, Serialize}; #[derive(Deserialize, Serialize)] pub struct User { pub username: St<|fim_suffix|>ring, pub password: String, pub email: String, }<|fim_middle|>ring, pub first_name: String,...
code_fim
easy
{ "lang": "rust", "repo": "IvoSte/Schrobox", "path": "/authentication_service/user_api/src/models.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }