text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> pub fn ver_id(&self) -> RegionVerId { let region = &self.region; let epoch = region.region_epoch.as_ref().unwrap(); RegionVerId { id: region.id, conf_ver: epoch.conf_ver, ver: epoch.version, } } pub fn id(&self) -> RegionId {...
code_fim
hard
{ "lang": "rust", "repo": "tikv/client-rust", "path": "/src/region.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>This is intended to be guide-level introduction using examples to build intuition. For more detail, check out the [API documentation](super), which the tutorials will link to frequently. Most of the code examples here are typechecked and run, so you may copy-paste them to get started. There is also a [pa...
code_fim
medium
{ "lang": "rust", "repo": "mwillsey/egg", "path": "/src/tutorials/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mwillsey/egg path: /src/tutorials/mod.rs // -*- mode: markdown; markdown-fontify-code-block-default-mode: rustic-mode; -*- /*! # A Guide-level Explanation of `egg` `egg` is a e-graph library optimized for equality saturation. Using these techniques, one can pretty easily build an optimizer or...
code_fim
medium
{ "lang": "rust", "repo": "mwillsey/egg", "path": "/src/tutorials/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>There is also a [paper](https://arxiv.org/abs/2004.03082) describing `egg` and if are keen to read more about its technical novelties. The tutorials are a work-in-progress with more to be added soon. */ pub mod _01_background; pub mod _02_getting_started; pub mod _03_explanations;<|fim_prefix|>// repo:...
code_fim
hard
{ "lang": "rust", "repo": "mwillsey/egg", "path": "/src/tutorials/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> unsafe fn waker_wake(p: *const ()) { let id: usize = std::mem::transmute(p); Connection::wake_task_by_id(id); } unsafe fn waker_wake_by_ref(p: *const ()) { let id: usize = std::mem::transmute(p); Connection::wake_task_by_id(id); } unsafe fn waker_drop(...
code_fim
hard
{ "lang": "rust", "repo": "ony/wezterm", "path": "/window/src/tasks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn poll_by_slot(&self, slot: usize) -> bool { let mut task = match self.tasks.borrow_mut().get_mut(slot) { Some(&mut Slot::Running(ref mut task)) => task.take().unwrap(), Some(&mut Slot::Vacant { .. }) | None => return false, }; let waker = TaskWake...
code_fim
hard
{ "lang": "rust", "repo": "ony/wezterm", "path": "/window/src/tasks.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ony/wezterm path: /window/src/tasks.rs use crate::connection::ConnectionOps; use crate::Connection; use std::cell::{Cell, RefCell}; use std::future::Future; use std::task::{Context, RawWaker, RawWakerVTable, Waker}; pub struct Task(pub std::pin::Pin<Box<dyn Future<Output = ()>>>); enum Slot { ...
code_fim
hard
{ "lang": "rust", "repo": "ony/wezterm", "path": "/window/src/tasks.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> variant as u8 != 0 } } #[doc = "Reader of field `ADC0`"] pub type ADC0_R = crate::R<bool, ADC0_A>; impl ADC0_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> ADC0_A { match self.bits { false => ADC0_A::_0, true...
code_fim
hard
{ "lang": "rust", "repo": "siralexeyduke/MKL02Z4-PAC", "path": "/src/sim/scgc6.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: siralexeyduke/MKL02Z4-PAC path: /src/sim/scgc6.rs #[doc = "Reader of register SCGC6"] pub type R = crate::R<u32, super::SCGC6>; #[doc = "Writer for register SCGC6"] pub type W = crate::W<u32, super::SCGC6>; #[doc = "Register SCGC6 `reset()`'s with value 0x01"] impl crate::ResetValue for super::S...
code_fim
hard
{ "lang": "rust", "repo": "siralexeyduke/MKL02Z4-PAC", "path": "/src/sim/scgc6.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nimiq/core-rs-albatross path: /primitives/block/tests/mod.rs use std::str::FromStr; use nimiq_block::{MacroBlock, MacroBody, MacroHeader, MultiSignature}; use nimiq_bls::{AggregateSignature, CompressedPublicKey, KeyPair}; use nimiq_collections::bitset::BitSet; use nimiq_handel::update::LevelUpd...
code_fim
hard
{ "lang": "rust", "repo": "nimiq/core-rs-albatross", "path": "/primitives/block/tests/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let macro_block = MacroBlock { header: MacroHeader { version: 1, block_number: 42, round: 0, timestamp: 0, parent_hash: hash.clone(), parent_election_hash: hash.clone(), interlink: None, seed: VrfSe...
code_fim
hard
{ "lang": "rust", "repo": "nimiq/core-rs-albatross", "path": "/primitives/block/tests/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn as_slice(&self) -> &'a [u8] { self.0.as_slice() } fn is_empty(&self) -> bool { self.0.len() == 0 } fn peek(&self) -> Option<u8> { self.0.as_slice().first().copied() } fn advance(&mut self, skip: usize) { for _ in 0..skip { self....
code_fim
hard
{ "lang": "rust", "repo": "andygrove/arrow-rs", "path": "/arrow-json/src/reader/tape.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for offset in self.offsets.iter().copied() { if !strings.is_char_boundary(offset) { return Err(ArrowError::JsonError( "Encountered truncated UTF-8 sequence".to_string(), )); } } Ok(Tape { strin...
code_fim
hard
{ "lang": "rust", "repo": "andygrove/arrow-rs", "path": "/arrow-json/src/reader/tape.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: andygrove/arrow-rs path: /arrow-json/src/reader/tape.rs [`Tape`] string data Number(u32), /// A true literal True, /// A false literal False, /// A null literal Null, } /// A decoded JSON tape /// /// String and numeric data is stored alongside an array of [`TapeElem...
code_fim
hard
{ "lang": "rust", "repo": "andygrove/arrow-rs", "path": "/arrow-json/src/reader/tape.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lewiszlw/hello-world path: /hello-world-rust/src/json/serde_json_demo.rs use serde::{Deserialize, Serialize}; use serde_json::Result; #[derive(Debug, Serialize, Deserialize)] struct Address { city: String, street: String, } <|fim_suffix|> let json = r#"{"city":"Beijing","street":"Ha...
code_fim
hard
{ "lang": "rust", "repo": "lewiszlw/hello-world", "path": "/hello-world-rust/src/json/serde_json_demo.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn test_serialize() { let address = Address { city: "Beijing".to_string(), street: "Haidian".to_string(), }; let json = serde_json::to_string(&address).unwrap(); println!("{}", json); } fn test_deserialize() { let json = r#"{"city":"Beijing","street":"Haidian"}"#; l...
code_fim
medium
{ "lang": "rust", "repo": "lewiszlw/hello-world", "path": "/hello-world-rust/src/json/serde_json_demo.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let json = r#"{"city":"Beijing","street":"Haidian"}"#; let address: Address = serde_json::from_str(json).unwrap(); println!("{:?}", address); }<|fim_prefix|>// repo: lewiszlw/hello-world path: /hello-world-rust/src/json/serde_json_demo.rs use serde::{Deserialize, Serialize}; use serde_json::R...
code_fim
hard
{ "lang": "rust", "repo": "lewiszlw/hello-world", "path": "/hello-world-rust/src/json/serde_json_demo.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn draw(&mut self, renderer: &mut render::RenderContext, encoder: &mut piston_window::GfxEncoder, dt: f64) { for i in self.entities.iter_mut() { i.draw(renderer, encoder, dt) } } fn update(&mut self, dt: f64) { for mut i in &mut self.entities { ...
code_fim
hard
{ "lang": "rust", "repo": "kaitosawada/mg-rs", "path": "/src/world.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kaitosawada/mg-rs path: /src/world.rs use entity; use piston_window; use render; pub trait World { fn add_entity<T: 'static + entity::Entity>(&mut self, entity: Box<T>); fn draw(&mut self, renderer: &mut render::RenderContext, encoder: &mut piston_window::GfxEncoder, dt: f64); fn up...
code_fim
hard
{ "lang": "rust", "repo": "kaitosawada/mg-rs", "path": "/src/world.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TimeEngineer/devker path: /src/lib.rs //! # Support //! //! * Deflate/Inflate: [`deflate`] //! * Zlib: [`zlib`] //! //! [`deflate`]: deflate/index.html //! [`zlib`]: zlib/index.html <|fim_suffix|>mod adler32; mod bits; pub mod btype; pub mod cache; mod code; pub mod deflate; mod huffman; mod lz...
code_fim
hard
{ "lang": "rust", "repo": "TimeEngineer/devker", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>mod adler32; mod bits; pub mod btype; pub mod cache; mod code; pub mod deflate; mod huffman; mod lzss; pub mod zlib;<|fim_prefix|>// repo: TimeEngineer/devker path: /src/lib.rs //! # Support //! //! * Deflate/Inflate: [`deflate`] //! * Zlib: [`zlib`] //! //! [`deflate`]: deflate/index.html //! [`zlib`]: ...
code_fim
hard
{ "lang": "rust", "repo": "TimeEngineer/devker", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dotenv-linter/dotenv-linter path: /dotenv-linter/src/cli.rs use crate::{ cli::options::{CheckOptions, CompareOptions, FixOptions}, common::LintKind, Result, }; use clap::{command, value_parser, Arg, ArgAction, Command}; use std::path::PathBuf; pub mod options; pub fn run() -> Resul...
code_fim
hard
{ "lang": "rust", "repo": "dotenv-linter/dotenv-linter", "path": "/dotenv-linter/src/cli.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Arg::new("quiet") .short('q') .long("quiet") .help("Doesn't display additional information") .action(ArgAction::SetTrue) } fn no_color_flag() -> Arg { Arg::new("no-color") .long("no-color") .help("Turns off the colored output") .action(ArgAc...
code_fim
hard
{ "lang": "rust", "repo": "dotenv-linter/dotenv-linter", "path": "/dotenv-linter/src/cli.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LooMaclin/tux_async_example path: /src/main.rs #![feature(await_macro, async_await, futures_api)] /* [dependencies] futures = "0.1.25" tokio = { version = "0.1.15", features = ["async-await-preview"] } */ <|fim_suffix|> tokio::spawn_async(async move { while let Some(Ok(id)) = awai...
code_fim
hard
{ "lang": "rust", "repo": "LooMaclin/tux_async_example", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>use futures::sync::mpsc::unbounded; use futures::sync::mpsc::UnboundedSender as Sender; use futures::sync::mpsc::UnboundedReceiver as Receiver; use std::collections::HashMap; use std::sync::Arc; use std::sync::Mutex; type T = u8; async fn f1() { let (_, mut rx): (Sender<T>, Receiver<T>) = unbounde...
code_fim
medium
{ "lang": "rust", "repo": "LooMaclin/tux_async_example", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Object { /// Creates a new object layer. pub fn new() -> Object { Object(Vec::new()) } /// Adds a new object. pub fn add_object<T>( obj: &wobj::obj::Object, vertices: &mut Vec<T>, indices: &mut Vec<u32>, geometries: &mut Geometry ) -> R...
code_fim
medium
{ "lang": "rust", "repo": "stjahns/geometry", "path": "/src/object.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stjahns/geometry path: /src/object.rs use range::{ AddTo, Range }; use wobj; use quack::{ Action, Pair, SetAt }; use std::default::Default; use Position; use TextureCoords; use Normal; use Geometry; /// An object consists of a list of geometries. /// The geometries are stored separately, /// i...
code_fim
hard
{ "lang": "rust", "repo": "stjahns/geometry", "path": "/src/object.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Adds a new object. pub fn add_object<T>( obj: &wobj::obj::Object, vertices: &mut Vec<T>, indices: &mut Vec<u32>, geometries: &mut Geometry ) -> Range<AddTo<Object>> where T: Default, (Position, T): Pair<Data = Position, Object...
code_fim
hard
{ "lang": "rust", "repo": "stjahns/geometry", "path": "/src/object.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sks/rust_ground path: /src/vars.rs pub fn run() { let name = "Sabith"; println!("My name is {}", name); let mut age = 3<|fim_suffix|>age) = ("SKS", 30); println!("My name is {} and is {} years old, {}", my_name, my_age, ID); }<|fim_middle|>0; println!("My name is {} and is {}...
code_fim
medium
{ "lang": "rust", "repo": "sks/rust_ground", "path": "/src/vars.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>age) = ("SKS", 30); println!("My name is {} and is {} years old, {}", my_name, my_age, ID); }<|fim_prefix|>// repo: sks/rust_ground path: /src/vars.rs pub fn run() { let name = "Sabith"; println!("My name is {}", name); let mut age = 30; println!("My name is {} and is {} years old", n...
code_fim
medium
{ "lang": "rust", "repo": "sks/rust_ground", "path": "/src/vars.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mayjs/iota.rs path: /iota-client/core/get_balances.rs use anyhow::Result; use iota_bundle_preview::{Address, Hash, TransactionField}; use iota_conversion::Trinary; use crate::response::{GetBalancesResponse, GetBalancesResponseBuilder}; use crate::Client; /// Builder to construct getBalances AP...
code_fim
hard
{ "lang": "rust", "repo": "mayjs/iota.rs", "path": "/iota-client/core/get_balances.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl GetBalancesBuilder { pub(crate) fn new() -> Self { Self { addresses: Default::default(), threshold: 100, tips: Default::default(), } } /// Add address for which to get the balance (do not include the checksum) pub fn addresses(mut s...
code_fim
medium
{ "lang": "rust", "repo": "mayjs/iota.rs", "path": "/iota-client/core/get_balances.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nisarhassan12/materialize path: /src/secrets/src/lib.rs // Copyright Materialize, Inc. and contributors. All rights reserved. // // Use of this software is governed by the Business Source License // included in the LICENSE file. // // As of the Change Date specified in that file, in accordance w...
code_fim
hard
{ "lang": "rust", "repo": "nisarhassan12/materialize", "path": "/src/secrets/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug)] pub struct InMemorySecretsController { data: Arc<Mutex<BTreeMap<GlobalId, Vec<u8>>>>, } impl InMemorySecretsController { pub fn new() -> Self { Self { data: Arc::new(Mutex::new(BTreeMap::new())), } } } #[async_trait] impl SecretsController for InM...
code_fim
hard
{ "lang": "rust", "repo": "nisarhassan12/materialize", "path": "/src/secrets/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>} #[derive(Debug)] pub struct CachingPolicy { /// Whether or not caching is enabled. pub enabled: bool, /// "time to live" of records within the cache. pub ttl: Duration, } /// Securely reads secrets that are managed by a [`SecretsController`]. /// /// Does not provide access to create, ...
code_fim
hard
{ "lang": "rust", "repo": "nisarhassan12/materialize", "path": "/src/secrets/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: silphire/qrcode-convert-rust path: /src/qrcode/decoder/format_information.rs use crate::qrcode::decoder::error_correction_level::ErrorCorrectionLevel; const FORMAT_INFO_MASK_QR: isize = 0x5412; const FORMAT_INFO_DECODE_LOOKUP: [[isize; 2]; 0x20] = [ [0x5412, 0x00], [0x5125, 0x01], [...
code_fim
hard
{ "lang": "rust", "repo": "silphire/qrcode-convert-rust", "path": "/src/qrcode/decoder/format_information.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut bits_difference = Self::num_bits_differing(masked_format_info_1, target_info); if bits_difference < best_difference { best_format_info = decode_info[1]; best_difference = bits_difference; } if masked_format_info_1 != ...
code_fim
hard
{ "lang": "rust", "repo": "silphire/qrcode-convert-rust", "path": "/src/qrcode/decoder/format_information.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wasmerio/cranelift path: /cranelift-codegen/meta/src/cdsl/formats.rs use crate::cdsl::operands::{Operand, OperandKind}; use std::collections::{HashMap, HashSet}; use std::fmt; use std::slice; use cranelift_entity::{entity_impl, PrimaryMap}; /// An immediate field in an instruction format. ///...
code_fim
hard
{ "lang": "rust", "repo": "wasmerio/cranelift", "path": "/cranelift-codegen/meta/src/cdsl/formats.rs", "mode": "psm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_suffix|> pub fn build(self) -> InstructionFormat { let typevar_operand = if self.typevar_operand.is_some() { self.typevar_operand } else if self.has_value_list || self.num_value_operands > 0 { // Default to the first value operand, if there's one. Some(0) ...
code_fim
hard
{ "lang": "rust", "repo": "wasmerio/cranelift", "path": "/cranelift-codegen/meta/src/cdsl/formats.rs", "mode": "spm", "license": "LLVM-exception", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/wf/wf-enum-bound.rs // Test that we check enum bounds for WFedness. <|fim_suffix|>enum SomeEnum<T,U> //~ ERROR E0277 where T: ExtraCopy<U> { SomeVariant(T,U) } fn main() { }<|fim_middle|>#![feature(associated_type_defaults)] #![allow...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/wf/wf-enum-bound.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>trait ExtraCopy<T:Copy> { } enum SomeEnum<T,U> //~ ERROR E0277 where T: ExtraCopy<U> { SomeVariant(T,U) } fn main() { }<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/wf/wf-enum-bound.rs // Test that we check enum bounds for WFedness. <|fim_middle|>#![feature(associa...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/wf/wf-enum-bound.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: input-output-hk/chain-libs path: /chain-impl-mockchain/src/ledger/tests/certificate_tests/voting.rs #![cfg(test)] use crate::{ config::ConfigParam, key::BftLeaderId, ledger::ledger::{Block0Error, Error}, testing::{ builders::{ create_initial_update_proposal, ...
code_fim
hard
{ "lang": "rust", "repo": "input-output-hk/chain-libs", "path": "/chain-impl-mockchain/src/ledger/tests/certificate_tests/voting.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let ledger_builder_result = LedgerBuilder::from_config(ConfigBuilder::new()) .faucets_wallets(vec![&alice]) .certs(&[vote_tally_cert]) .build(); assert_eq!( ledger_builder_result.err().unwrap(), Error::Block0(Block0Error::HasVoteTally) ); } #[test] pub...
code_fim
hard
{ "lang": "rust", "repo": "input-output-hk/chain-libs", "path": "/chain-impl-mockchain/src/ledger/tests/certificate_tests/voting.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> assert!( ledger_build_result.is_err(), "ledger should not be built with faulty vote plan certificate" ); } #[test] pub fn vote_cast_in_block0() { let alice = Wallet::from_value(Value(100)); let vote_plan = VoteTestGen::vote_plan(); let vote_cast = VoteTestGen::vote_cas...
code_fim
hard
{ "lang": "rust", "repo": "input-output-hk/chain-libs", "path": "/chain-impl-mockchain/src/ledger/tests/certificate_tests/voting.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akhilnarang/rust-stuff path: /strings/src/main.rs fn main() { let mut x = String::from("Hello"); x.push(' '); x.push_str("world"); <|fim_suffix|> println!("{}", y); println!("{}", x); }<|fim_middle|> println!("{}", x); let y = x.clone();
code_fim
easy
{ "lang": "rust", "repo": "akhilnarang/rust-stuff", "path": "/strings/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{}", x); let y = x.clone(); println!("{}", y); println!("{}", x); }<|fim_prefix|>// repo: akhilnarang/rust-stuff path: /strings/src/main.rs fn main() { let mut x = String::from("Hell<|fim_middle|>o"); x.push(' '); x.push_str("world");
code_fim
easy
{ "lang": "rust", "repo": "akhilnarang/rust-stuff", "path": "/strings/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Create a place at the bottom of a list. /// /// # Example /// ``` /// # use harmony_rust_sdk::api::chat::Place; /// let place = Place::bottom(1); /// assert_eq!(place.after(), Some(1)); /// assert_eq!(place.before(), None); /// ``` pub fn bottom(after: u64) -> S...
code_fim
hard
{ "lang": "rust", "repo": "Defi-Ninja/harmony_rust_sdk", "path": "/src/api/chat.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Defi-Ninja/harmony_rust_sdk path: /src/api/chat.rs use harmony_derive::into_request; use std::fmt::{self, Display, Formatter}; pub mod v1 { #![allow(clippy::unit_arg)] hrpc::include_proto!("protocol.chat.v1"); } pub use v1::*; /// Describes where to subscribe for events. #[derive(Debug...
code_fim
hard
{ "lang": "rust", "repo": "Defi-Ninja/harmony_rust_sdk", "path": "/src/api/chat.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut i = 1; while i < n{ if matrix[row][i] == 0{ matrix[row][0] = 0; matrix[0][i] = 0; } i += 1; } row += 1; } let mut i:i32 = (matrix.len() - 1) as i...
code_fim
hard
{ "lang": "rust", "repo": "skylway/leetcode", "path": "/rust/src/question/q73.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: skylway/leetcode path: /rust/src/question/q73.rs // pub struct SolutionMN{ // // } // // impl SolutionMN { // pub fn set_zeroes_mn(matrix: &mut Vec<Vec<i32>>) { // if matrix.len() == 0{ // return // } // let l = matrix.len(); // // let mut rows = v...
code_fim
hard
{ "lang": "rust", "repo": "skylway/leetcode", "path": "/rust/src/question/q73.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Run a present process, and possibly emit the signal during the same instant (using join construct) // Whether the signal shall be emitted or not is decided at this point, according to the given parameter if emit_signal { let emit_process = pure_signal_1.emit().map(move |v| { present_s...
code_fim
hard
{ "lang": "rust", "repo": "Daru13/ens-reactrust", "path": "/src/signals/pure_signal.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> general_emit_and_await_immediate(false); } #[test] fn await_immediate_and_emit () { general_emit_and_await_immediate(true); } fn general_present_or_absent_signal (emit_signal: bool) { let pure_signal_1 = PureSignal::new(); let pure_signal_2 = pure_signal_1.clone(); let pr...
code_fim
hard
{ "lang": "rust", "repo": "Daru13/ens-reactrust", "path": "/src/signals/pure_signal.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Daru13/ens-reactrust path: /src/signals/pure_signal.rs use std::marker::PhantomData; use signals::signals::*; use signals::runtime::SignalRuntimeRef; /////////////////////////////////////////////////////////////////////////////////////////////////// // PURE SIGNAL ////////////////////////////...
code_fim
hard
{ "lang": "rust", "repo": "Daru13/ens-reactrust", "path": "/src/signals/pure_signal.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cedric-h/hauntfall path: /comn/src/art/player_anim.rs //! These structs make updating the player's Animate //! to reflect its Heading easier. #[derive(Copy, Clone)] #[cfg_attr(test, derive(PartialEq))] pub enum Direction { Up, Left, Down, Right, } #[cfg_attr(test, derive(Partia...
code_fim
hard
{ "lang": "rust", "repo": "cedric-h/hauntfall", "path": "/comn/src/art/player_anim.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>use serde::{Deserialize, Serialize}; use specs::{prelude::*, Component}; #[derive(Clone, Debug, Component, Serialize, Deserialize)] pub struct PlayerAnimationController;<|fim_prefix|>// repo: cedric-h/hauntfall path: /comn/src/art/player_anim.rs //! These structs make updating the player's Animate //! to...
code_fim
hard
{ "lang": "rust", "repo": "cedric-h/hauntfall", "path": "/comn/src/art/player_anim.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/matched-data-cli path: /src/matched_data.rs use bincode::ErrorKind; use hpke::{ aead::{AeadTag, ChaCha20Poly1305}, kdf::HkdfSha256, kem::X25519HkdfSha256, kex::{Deserializable, KeyExchange}, setup_receiver, EncappedKey, HpkeError, Kem as KemTrait, OpModeR, }; use rand...
code_fim
medium
{ "lang": "rust", "repo": "iCodeIN/matched-data-cli", "path": "/src/matched_data.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>// Generates a public-private key pair pub fn generate_key_pair() -> ( <Kex as KeyExchange>::PrivateKey, <Kex as KeyExchange>::PublicKey, ) { let mut csprng = StdRng::from_entropy(); Kem::gen_keypair(&mut csprng) } // Constructs a PrivateKey from an array of bytes pub fn get_private_key_f...
code_fim
medium
{ "lang": "rust", "repo": "iCodeIN/matched-data-cli", "path": "/src/matched_data.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: satvik-1203/rust-sandbox path: /src/primitives/array.rs use std::mem; // module used for dealing with memory. // This module contains functions for querying the size and alignment of types, initializing and manipulating memory. <|fim_suffix|> let first_int: i32 = arr[0]; let length = arr.len...
code_fim
medium
{ "lang": "rust", "repo": "satvik-1203/rust-sandbox", "path": "/src/primitives/array.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>struct Obj<'a> { test: &'a str, } pub fn run() { let xs: [i32; 10] = [0; 10]; // for initializing an array of size 5 and type should be given before; let obj_arr: [Obj; 1] = [Obj { test: "satvik" }]; // U can also make an array of custom objects with struct. let ans = analyze_fn(&xs[0..4]); ...
code_fim
medium
{ "lang": "rust", "repo": "satvik-1203/rust-sandbox", "path": "/src/primitives/array.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> while let Some(loc) = q.pop_front() { if loc.1 == [true; 8] { println!("visited all in {} steps", loc.2); break; } for pos in &[((loc.0).0 + 1, (loc.0).1), ((loc.0).0 - 1, (loc.0).1), ((loc.0).0, (loc.0).1 + 1), ...
code_fim
hard
{ "lang": "rust", "repo": "cleech/adventofcode2016", "path": "/src/bin/day24.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cleech/adventofcode2016 path: /src/bin/day24.rs use std::collections::VecDeque; use std::collections::HashSet; static DATA: &'static str = include_str!("day24.txt"); struct Map { x: usize, _y: usize, open: Vec<bool>, } fn main() { let mut targets: Vec<(usize, usize)> = vec![(0...
code_fim
hard
{ "lang": "rust", "repo": "cleech/adventofcode2016", "path": "/src/bin/day24.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[macro_export] macro_rules! print { ($($arg:tt)*) => ($crate::graphics::_print(format_args!($($arg)*))); } #[macro_export] macro_rules! println { () => ($crate::print!("\n")); ($($arg:tt)*) => ($crate::print!("{}\n", format_args!($($arg)*))); } #[doc(hidden)] pub fn _print(args: fmt::Argume...
code_fim
medium
{ "lang": "rust", "repo": "ilim0t/MikanOS", "path": "/rkernel/src/graphics/print.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ilim0t/MikanOS path: /rkernel/src/graphics/print.rs use super::Console; use core::fmt; use spin::{Mutex, Once}; <|fim_suffix|>#[doc(hidden)] pub fn _print(args: fmt::Arguments) { use core::fmt::Write; CONSOLE.lock().get_mut().unwrap().write_fmt(args).unwrap(); }<|fim_middle|>pub static ...
code_fim
hard
{ "lang": "rust", "repo": "ilim0t/MikanOS", "path": "/rkernel/src/graphics/print.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: YenTheFirst/advent-of-code-2018 path: /day_19/src/main.rs use std::io::BufRead; use crate::Opcode::*; fn main() { let stdin = std::io::stdin(); let lines : Vec<String> = stdin.lock().lines().map(Result::unwrap).collect(); //let mut reg : Reg = vec![0,0,0,0,0,0]; let mut reg : R...
code_fim
hard
{ "lang": "rust", "repo": "YenTheFirst/advent-of-code-2018", "path": "/day_19/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>type Reg = Vec<i32>; // should really be a [i32, 6], but I just don't feel like fighting the compiler impl Opcode { fn call(&self, a: i32, b: i32, c: i32, reg: &Reg) -> Reg { let ai = a as usize; let bi = b as usize; let mut new_reg = reg.clone(); new_reg[c as usize] =...
code_fim
hard
{ "lang": "rust", "repo": "YenTheFirst/advent-of-code-2018", "path": "/day_19/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LycrusHamster/muta path: /byzantine/src/commander.rs use bytes::Bytes; use futures::{ channel::mpsc::{UnboundedReceiver, UnboundedSender}, stream::StreamExt, }; use tokio::time::{self, Duration}; use core_consensus::message::{ BROADCAST_HEIGHT, END_GOSSIP_AGGREGATED_VOTE, END_GOSSIP...
code_fim
hard
{ "lang": "rust", "repo": "LycrusHamster/muta", "path": "/byzantine/src/commander.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let valid_recv_vote_generator = BehaviorGenerator { req_end: Some(END_GOSSIP_SIGNED_VOTE.to_string()), msg_type: MessageType::RecvVote, probability: 1.0, num_range: (1, 2), priority: Priority::High, }; list.push(valid_recv_vote_generator); ...
code_fim
hard
{ "lang": "rust", "repo": "LycrusHamster/muta", "path": "/byzantine/src/commander.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) const IDX_PARAM_COLOR: usize = 0; pub(crate) const IDX_PARAM_DESCRIPTION: usize = 1; pub(crate) const IDX_PARAM_DURATION: usize = 2; pub(crate) const IDX_PARAM_MINIMUM_BID: usize = 3; pub(crate) const IDX_PARAM_OWNER_MARGIN: usize = 4; pub(crate) const IDX_RESULT_BID...
code_fim
medium
{ "lang": "rust", "repo": "MR1991/wasp", "path": "/contracts/wasm/fairauction/src/keys.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MR1991/wasp path: /contracts/wasm/fairauction/src/keys.rs // Copyright 2020 IOTA Stiftung // SPDX-License-Identifier: Apache-2.0 // (Re-)generated by schema tool // >>>> DO NOT CHANGE THIS FILE! <<<< // Change the json schema instead // @formatter:off #![allow(dead_code)] use wasmlib::*; <|...
code_fim
medium
{ "lang": "rust", "repo": "MR1991/wasp", "path": "/contracts/wasm/fairauction/src/keys.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for o in output { let (metrics, letter) = self.font.font.rasterize(o.key.c, self.font.size); for x in 0..metrics.width { for (y_buf, y) in (0..metrics.height).rev().enumerate() { if letter[y_buf * metrics.width + x] != 0 { ...
code_fim
hard
{ "lang": "rust", "repo": "Fomys/cybook", "path": "/cygui/src/widget/text.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Fomys/cybook path: /cygui/src/widget/text.rs use crate::{ utils::font::{ fontdue::layout::{GlyphPosition, GlyphRasterConfig, Layout, LayoutSettings, TextStyle}, Font, }, widget::Widget, Event, Handler, }; use cgmath::Vector2; use cybuf::{Buffer, Drawable}; use std...
code_fim
hard
{ "lang": "rust", "repo": "Fomys/cybook", "path": "/cygui/src/widget/text.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let img = if let Some(default_buf) = default_buf { image::load_from_memory(default_buf)?.flipv().to_rgba() } else { image::open(&texpath.clone())?.flipv().to_rgba() }; let (w, h) = img.dimensions(); let kind = gfx::texture::Kind::D2(w as u16, h as u16, gfx::texture::Aa...
code_fim
hard
{ "lang": "rust", "repo": "MagnusThor/demolishedRust", "path": "/src/loader.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MagnusThor/demolishedRust path: /src/loader.rs use runner::TextureId; use error::{self,LoadShaderError}; use std::fs::File; use std::io::{self, Read}; use std::path::Path; use gfx; use image; pub static DEFAULT_VERT_SRC_BUF: &'static [u8] = include_bytes!("./shaders/elevated.vert"); pub static ...
code_fim
hard
{ "lang": "rust", "repo": "MagnusThor/demolishedRust", "path": "/src/loader.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let r1 = Ray::new(Vec3::point(1, 2, 3), Vec3::vector(0, 1, 0)); let r2 = r1.transform(&Matrix::translation(3.0, 4.0, 5.0)); assert_eq!(r2.origin, Vec3::point(4, 6, 8)); assert_eq!(r2.direction, Vec3::vector(0, 1, 0)); } #[test] fn scaling_ray() { let r1 ...
code_fim
hard
{ "lang": "rust", "repo": "sathwikmatsa/Handmade3DRenderer", "path": "/src/ray.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sathwikmatsa/Handmade3DRenderer path: /src/ray.rs use super::intersection::*; use super::matrix::Matrix; use super::object::*; use super::vec3::Vec3; #[derive(Copy, Clone, Debug, PartialEq)] pub struct Ray { pub origin: Vec3, pub direction: Vec3, } impl Ray { pub fn new(origin: Vec...
code_fim
hard
{ "lang": "rust", "repo": "sathwikmatsa/Handmade3DRenderer", "path": "/src/ray.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Dyr-El/advent_of_code_2020 path: /aelg-rust/src/day18.rs use crate::error; use crate::parser::{run_parser, IResult}; type Data = Vec<String>; fn parser1(input: &str) -> IResult<&str, i64> { use crate::parser::*; fn parens(input: &str) -> IResult<&str, i64> { delimited(tag("("), expr, ...
code_fim
hard
{ "lang": "rust", "repo": "Dyr-El/advent_of_code_2020", "path": "/aelg-rust/src/day18.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match run_parser( parser2, &v.iter().map(|x| x.as_str()).collect::<Vec<&str>>(), ) { Ok(l) => Some(format!("{}", l.iter().sum::<i64>())), Err(e) => { println!("{}", e); None } } } pub fn solve(v: Data) -> (Option<String>, Option<String>) { (solve1(&v), solve2(&v)) ...
code_fim
hard
{ "lang": "rust", "repo": "Dyr-El/advent_of_code_2020", "path": "/aelg-rust/src/day18.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fnetz/bootloader path: /src/interrupts.rs #[repr(packed)] #[derive(Copy, Clone)] struct InterruptGate { offset_low: u16, segment_selector: u16, zero: u8, attributes: u8, offset_high: u16, } <|fim_suffix|>static mut IDT_PTR: IdtPointer = IdtPointer { size: 0, offset: ...
code_fim
hard
{ "lang": "rust", "repo": "fnetz/bootloader", "path": "/src/interrupts.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>static mut IDT_PTR: IdtPointer = IdtPointer { size: 0, offset: 0, }; pub fn load_idt() { unsafe { IDT_PTR.size = core::mem::size_of_val(&IDT) as u16; IDT_PTR.offset = core::ptr::addr_of!(IDT) as u32; asm!("lidt, [{}]", sym IDT_PTR, options(nostack, preserves_flags)); ...
code_fim
hard
{ "lang": "rust", "repo": "fnetz/bootloader", "path": "/src/interrupts.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn load_idt() { unsafe { IDT_PTR.size = core::mem::size_of_val(&IDT) as u16; IDT_PTR.offset = core::ptr::addr_of!(IDT) as u32; asm!("lidt, [{}]", sym IDT_PTR, options(nostack, preserves_flags)); } }<|fim_prefix|>// repo: fnetz/bootloader path: /src/interrupts.rs #[repr...
code_fim
hard
{ "lang": "rust", "repo": "fnetz/bootloader", "path": "/src/interrupts.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub mod chain; pub mod config; pub mod daemon; pub mod electrum; pub mod errors; pub mod metrics; pub mod new_index; pub mod rest; pub mod signal; pub mod util; #[cfg(feature = "liquid")] pub mod elements;<|fim_prefix|>// repo: Blockstream/electrs path: /src/lib.rs #![recursion_limit = "1024"] // See h...
code_fim
medium
{ "lang": "rust", "repo": "Blockstream/electrs", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Blockstream/electrs path: /src/lib.rs #![recursion_limit = "1024"] // See https://github.com/romanz/electrs/issues/193 & https://github.com/rust-rocksdb/rust-rocksdb/issues/327 #[cfg(not(feature = "oldcpu"))] extern crate rocksdb; #[cfg(feature = "oldcpu")] extern crate rocksdb_oldcpu as rocksd...
code_fim
medium
{ "lang": "rust", "repo": "Blockstream/electrs", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[macro_use] extern crate lazy_static; pub mod chain; pub mod config; pub mod daemon; pub mod electrum; pub mod errors; pub mod metrics; pub mod new_index; pub mod rest; pub mod signal; pub mod util; #[cfg(feature = "liquid")] pub mod elements;<|fim_prefix|>// repo: Blockstream/electrs path: /src/lib.r...
code_fim
hard
{ "lang": "rust", "repo": "Blockstream/electrs", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rosarp/hackerrank-rust-practice path: /algorithm/30-days-of-code/bitwise-and/bitwise-and.rs use std::io; fn read_input() -> (i32, i32) { let mut s = String::new(); io::stdin().read_line(&mut s).ok().expect("read error"); let s = s.trim().parse::<String>().ok().expect("parse error");...
code_fim
medium
{ "lang": "rust", "repo": "rosarp/hackerrank-rust-practice", "path": "/algorithm/30-days-of-code/bitwise-and/bitwise-and.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut s = String::new(); io::stdin().read_line(&mut s).ok().expect("read error"); let sn = s.trim().parse::<i32>().ok().expect("parse error"); for _ in 0..sn { let (n, k) = read_input(); let mut mx = 0; for a in 1..n { for b in a+1..n+1 { ...
code_fim
medium
{ "lang": "rust", "repo": "rosarp/hackerrank-rust-practice", "path": "/algorithm/30-days-of-code/bitwise-and/bitwise-and.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Zaechus/kingslayer path: /src/types/status.rs use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub enum CombatStatus { InCombat, Resting, } <|fim_suffix|> CombatStatus::Resting } } #[derive(Copy, Clone, Debug, PartialEq, Deseri...
code_fim
easy
{ "lang": "rust", "repo": "Zaechus/kingslayer", "path": "/src/types/status.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Default for EnemyStatus { fn default() -> Self { EnemyStatus::Distracted } }<|fim_prefix|>// repo: Zaechus/kingslayer path: /src/types/status.rs use serde::{Deserialize, Serialize}; #[derive(Clone, Debug, PartialEq, Deserialize, Serialize)] pub enum CombatStatus { InCombat, ...
code_fim
hard
{ "lang": "rust", "repo": "Zaechus/kingslayer", "path": "/src/types/status.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>ctId}; def_query!(QueryContractGetRecords(ContractId) -> Vec<PyTransactionRecord>);<|fim_prefix|>// repo: sam-ulrich1/hedera-sdk-python path: /src/query_contract_get_records.rs use crate::PyTransactionRecord; use heder<|fim_middle|>a::{query::QueryContractGetRecords, Contra
code_fim
easy
{ "lang": "rust", "repo": "sam-ulrich1/hedera-sdk-python", "path": "/src/query_contract_get_records.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sam-ulrich1/hedera-sdk-python path: /src/query_contract_get_records.rs use crate::PyTransactionRecord; use heder<|fim_suffix|>(ContractId) -> Vec<PyTransactionRecord>);<|fim_middle|>a::{query::QueryContractGetRecords, ContractId}; def_query!(QueryContractGetRecords
code_fim
medium
{ "lang": "rust", "repo": "sam-ulrich1/hedera-sdk-python", "path": "/src/query_contract_get_records.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>(ContractId) -> Vec<PyTransactionRecord>);<|fim_prefix|>// repo: sam-ulrich1/hedera-sdk-python path: /src/query_contract_get_records.rs use crate::PyTransactionRecord; use hedera::{query::QueryContractGetRecords, Contra<|fim_middle|>ctId}; def_query!(QueryContractGetRecords
code_fim
easy
{ "lang": "rust", "repo": "sam-ulrich1/hedera-sdk-python", "path": "/src/query_contract_get_records.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: willdoescode/health-class-depression-slide path: /src/main.rs use cursive; fn main() { let mut siv = cursive::default(); siv.add_global_callback('q', |s| s.quit()); first_slide(&mut siv); siv.run(); } fn first_slide(s: &mut cursive::Cursive) { s.add_layer(cursive::views::Dialog::...
code_fim
hard
{ "lang": "rust", "repo": "willdoescode/health-class-depression-slide", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> s.pop_layer(); s.add_layer( cursive::views::Dialog::text( "Globally, depression affects more than 267,000,000 people\nwhich is almost the population of the united states." ).title("How Many People Suffer From Depression?") .button("Next slide", |s| fourth_slide(s)) ); } fn fou...
code_fim
medium
{ "lang": "rust", "repo": "willdoescode/health-class-depression-slide", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> s.pop_layer(); s.add_layer( cursive::views::Dialog::text("Facts about DEPRESSION, www.idph.state.il.us/about/womenshealth/factsheets/dep.htm.\nDepression.” World Health Organization, World Health Organization, www.who.int/news-room/fact-sheets/detail/depression.\nDepression Basics.” National Insti...
code_fim
hard
{ "lang": "rust", "repo": "willdoescode/health-class-depression-slide", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[serde(flatten, skip_serializing_if = "HashMap::is_empty")] pub additional_fields: HashMap<String, serde_json::Value>, } #[derive(Deserialize, Debug, Clone)] pub struct SauceJSON { #[serde(default)] pub header: Header, #[serde(default)] pub data: Data, } #[derive(Deserialize, Debug)] pub struct R...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/RustNAO", "path": "/src/handler/deserialize.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/RustNAO path: /src/handler/deserialize.rs //! Collection of structs used to deserialize the API JSON results, upon which it is further processed. use serde::Deserialize; use std::collections::HashMap; #[derive(Deserialize, Debug, Default, Clone)] pub struct Header { pub similarity: St...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/RustNAO", "path": "/src/handler/deserialize.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// @has 'issue_35488/index.html' '//code' 'pub use std::option::Option::None;' pub use std::option::Option::None;<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/rustdoc/issue-35488.rs mod foo { pub enum Foo { Bar, } pub use self::Foo::*; } <|fim_middle|>// @has...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/rustdoc/issue-35488.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/rustdoc/issue-35488.rs mod foo { pub enum Foo { Bar, } pub use self::Foo::*; } <|fim_suffix|>// @has 'issue_35488/index.html' '//code' 'pub use std::option::Option::None;' pub use std::option::Option::None;<|fim_middle|>// @has...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/rustdoc/issue-35488.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: koompi/koompi-desktop path: /panel/src/main.rs const WINDOW_HEIGHT: u32 = 32; const RESERVE_SIZE: [u64; 4] = [0, 0, 32, 0]; const MENU_WIDTH: u16 = 400; const MENU_HEIGHT: u16 = MENU_WIDTH; mod proxy_message; mod styles; mod task_manager; mod views; use proxy_message::ProxyMessage; use views::{ ...
code_fim
hard
{ "lang": "rust", "repo": "koompi/koompi-desktop", "path": "/panel/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let event_send_proxy = event_loop.create_proxy(); let (panel, _) = DesktopPanel::new(event_send_proxy); let mut control_state = block_on(State::new( window, panel, Some(&setttings(16)), cursor_position, &mut debug, &instance, )); let even...
code_fim
hard
{ "lang": "rust", "repo": "koompi/koompi-desktop", "path": "/panel/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sam-g99/Learning-Rust path: /data_types/src/main.rs fn main() { // SCALAR TYPES (represents a single value, types shown below) // Integer Types /* i - signed (can be negative) u - unsigned (can't be negative) 8-bit | i8 | u8 ((i) -128 to 127) ((u) 0 to 255) 2^8 (Disti...
code_fim
hard
{ "lang": "rust", "repo": "sam-g99/Learning-Rust", "path": "/data_types/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }