text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> Relation::Bakery.def() } } impl ActiveModelBehavior for ActiveModel {}<|fim_prefix|>// repo: chaosannals/trial-rust path: /dbormdemo/seaormdemo/src/entities/chef.rs //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, D...
code_fim
medium
{ "lang": "rust", "repo": "chaosannals/trial-rust", "path": "/dbormdemo/seaormdemo/src/entities/chef.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Copy, Clone, Debug, EnumIter, DeriveRelation)] pub enum Relation { #[sea_orm( belongs_to = "super::bakery::Entity", from = "Column::BakeryId", to = "super::bakery::Column::Id", on_update = "NoAction", on_delete = "NoAction" )] Bakery, } impl Re...
code_fim
hard
{ "lang": "rust", "repo": "chaosannals/trial-rust", "path": "/dbormdemo/seaormdemo/src/entities/chef.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chaosannals/trial-rust path: /dbormdemo/seaormdemo/src/entities/chef.rs //! `SeaORM` Entity. Generated by sea-orm-codegen 0.11.3 use sea_orm::entity::prelude::*; #[derive(Clone, Debug, PartialEq, DeriveEntityModel, Eq)] #[sea_orm(table_name = "chef")] pub struct Model { #[sea_orm(primary_k...
code_fim
hard
{ "lang": "rust", "repo": "chaosannals/trial-rust", "path": "/dbormdemo/seaormdemo/src/entities/chef.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ChunkWorks/pqcrypto path: /pqcrypto-rainbow/src/lib.rs //! # rainbow //! //! This crate provides bindings to and wrappers around the following //! implementations from [PQClean][pqc]: //! //! * rainbowI-circumzenithal - clean //! * rainbowI-classic - clean //! * rainbowI-compressed - clean //! *...
code_fim
hard
{ "lang": "rust", "repo": "ChunkWorks/pqcrypto", "path": "/pqcrypto-rainbow/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub use crate::rainbowicircumzenithal::{ detached_sign as rainbowicircumzenithal_detached_sign, keypair as rainbowicircumzenithal_keypair, open as rainbowicircumzenithal_open, public_key_bytes as rainbowicircumzenithal_public_key_bytes, secret_key_bytes as rainbowicircumzenithal_secret_key...
code_fim
hard
{ "lang": "rust", "repo": "ChunkWorks/pqcrypto", "path": "/pqcrypto-rainbow/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gatekeeper1122/UltimateTrainingModpack path: /src/training/input_delay.rs use lazy_static::lazy_static; use parking_lot::Mutex; use skyline::nn::hid::NpadHandheldState; use std::collections::VecDeque; lazy_static! { static ref P1_DELAYED_NPAD_STATES: Mutex<VecDeque<NpadHandheldState>> = ...
code_fim
hard
{ "lang": "rust", "repo": "gatekeeper1122/UltimateTrainingModpack", "path": "/src/training/input_delay.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> delayed_states.push_front(actual_state); delayed_states.truncate(crate::common::MENU.input_delay as usize); } else { // if INPUT_RECORD == 1 || INPUT_RECORD == 2 { // (*state).Buttons = P1_NPAD_STATES[INPUT_RECORD_FRAME].Buttons; // (*state).LStickX = P1...
code_fim
hard
{ "lang": "rust", "repo": "gatekeeper1122/UltimateTrainingModpack", "path": "/src/training/input_delay.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>// issue 8134 pub struct Parser<T>(T); impl<T: std::iter::Iterator<Item=char>> Parser<T> { fn in_doctype(&mut self) { static DOCTYPEPattern: [char; 6] = ['O', 'C', 'T', 'Y', 'P', 'E']; } } struct Bar; impl Foo { pub fn bar<T>(&self) { static X: usize = 1; } }<|fim_prefix|>...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-pass/auxiliary/nested_item.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/run-pass/auxiliary/nested_item.rs // original problem pub fn foo<T>() -> isize { { static foo: isize = 2; foo } } // issue 8134 struct Foo; impl Foo { pub fn foo<T>(&self) { static X: usize = 1; } } <|fim_s...
code_fim
hard
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/run-pass/auxiliary/nested_item.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rune-rs/rune path: /crates/rune/src/diagnostics.rs //! Diagnostics module for Rune. //! //! Diagnostics collects information about a source program in order to provide //! good human-readable diagnostics like errors, warnings, and hints. //! //! In order to collect diagnostics during compilation...
code_fim
hard
{ "lang": "rust", "repo": "rune-rs/rune", "path": "/crates/rune/src/diagnostics.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Convert into underlying diagnostics. pub fn into_diagnostics(self) -> Vec<Diagnostic> { self.diagnostics } /// Report an internal error. /// /// This should be used for programming invariants of the compiler which are /// broken for some reason. pub(crate) fn i...
code_fim
hard
{ "lang": "rust", "repo": "rune-rs/rune", "path": "/crates/rune/src/diagnostics.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> (first.clone(), first) } else { // TODO: Order by relevance won't work here let right = self .order_by .field() .expect("a field on which to order by is expected") .db_name() .to_own...
code_fim
hard
{ "lang": "rust", "repo": "debragail/prisma-engines", "path": "/query-engine/connectors/mongodb-query-connector/src/orderby.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> order_aggregate_proj_doc.push( doc! { "$addFields": { field.clone(): { "$size": format!("${}", field.clone()) } } }, ); } _ => unimplemented!("Order by aggregate only sup...
code_fim
hard
{ "lang": "rust", "repo": "debragail/prisma-engines", "path": "/query-engine/connectors/mongodb-query-connector/src/orderby.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: debragail/prisma-engines path: /query-engine/connectors/mongodb-query-connector/src/orderby.rs use crate::join::JoinStage; use itertools::Itertools; use mongodb::bson::{doc, Document}; use prisma_models::{OrderBy, SortOrder}; #[derive(Debug)] pub(crate) struct OrderByData { pub(crate) join:...
code_fim
hard
{ "lang": "rust", "repo": "debragail/prisma-engines", "path": "/query-engine/connectors/mongodb-query-connector/src/orderby.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> async fn sync_sent_transactions( &mut self, account_address: String, client: &XtClient, signer: &mut SrSigner, ) -> Result<(), Error> { println!("account:{:?}", self.account); let mut batch = JsonRpcBatch::new(); batch.add_get_account_transac...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/pdiem-relayer", "path": "/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) } async fn sync_transaction_with_proof( &mut self, transaction: &TransactionView, account_address: String, client: &XtClient, signer: &mut SrSigner, ) -> Result<(), Error> { if let Ok(transaction_with_proof) = self.get_transaction...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/pdiem-relayer", "path": "/src/main.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Phala-Network/pdiem-relayer path: /src/main.rs CryptoHash; use diem_types::{ account_address::{ AccountAddress, HashAccountAddress }, chain_id::{ChainId, NamedChain}, ledger_info::LedgerInfoWithSignatures, transaction::{TransactionInfo, SignedTransaction}, epoch_...
code_fim
hard
{ "lang": "rust", "repo": "Phala-Network/pdiem-relayer", "path": "/src/main.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Cypher1/demon path: /src/req.rs #[derive(Debug, Clone)] pub struct Req { pub path: String, pub method: String, pub params: std::collections::HashMap<String, String>, } impl Req { pub fn from_string(req: String) -> Req { let index_of_newline = req.find('\n').unwrap_or(req<...
code_fim
hard
{ "lang": "rust", "repo": "Cypher1/demon", "path": "/src/req.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let tail = line[(index_of_colon + 2)..line.len() - 1].to_string(); params.insert(head, tail); } Req { path: header[1].to_string(), method: header[0].to_string(), params, } } }<|fim_prefix|>// repo: Cypher1/demon path:...
code_fim
hard
{ "lang": "rust", "repo": "Cypher1/demon", "path": "/src/req.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn insert(&mut self, data: T) { // append the data into the array self.arr.push(data); // data is moved into the heap/array self.n += 1; // increment size self.bubble_up(self.n - 1); // Ordering::Less will bubble up // so, extract_mi...
code_fim
hard
{ "lang": "rust", "repo": "itzYaBoi6493/custom-heap", "path": "/src/pqueue.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: itzYaBoi6493/custom-heap path: /src/pqueue.rs use std::cmp::Ordering; pub struct Heap<T> { arr: Vec<T>, comp: Box<dyn Fn(&T, &T) -> Ordering>, n: usize, } impl<T> Heap<T> where T: std::fmt::Display { pub fn new<F>(comp: F) -> Self where F: Fn(&T, &T) -> Ordering + '...
code_fim
hard
{ "lang": "rust", "repo": "itzYaBoi6493/custom-heap", "path": "/src/pqueue.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn migrate_with_timeout() -> Result<(), Error> { let config = config_in_tests(); migrator::migrate_with_timeout( config.psql_diesel_url_server_user(), config.db_connection_attempts_timeout_seconds() as i64, ) }<|fim_prefix|>// repo: blazern/recipe_calculator_server path: /src/...
code_fim
hard
{ "lang": "rust", "repo": "blazern/recipe_calculator_server", "path": "/src/db/core/testing_util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: blazern/recipe_calculator_server path: /src/db/core/testing_util.rs use std::sync::Mutex; use super::connection::DBConnection; use super::connection::DBConnectionImpl; use super::error::Error; use super::migrator; use crate::testing_utils::config_in_tests; <|fim_suffix|>fn migrate_with_timeout...
code_fim
hard
{ "lang": "rust", "repo": "blazern/recipe_calculator_server", "path": "/src/db/core/testing_util.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] pub fn testing_connection_for_server_user() -> Result<impl DBConnection, Error> { let _migration_lock = MIGRATIONS_MUTEX.lock(); migrate_with_timeout().unwrap(); DBConnectionImpl::for_server_user(&config_in_tests()) } fn migrate_with_timeout() -> Result<(), Error> { let confi...
code_fim
hard
{ "lang": "rust", "repo": "blazern/recipe_calculator_server", "path": "/src/db/core/testing_util.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> f.write_str("/")?; if let Some(v) = self.0.complete_length { write!(f, "{}", v) } else { f.write_str("*") } } } } } fn split_in_two(s: &str, separator: char) -> Option<(&str, &...
code_fim
hard
{ "lang": "rust", "repo": "flodiebold/headers", "path": "/headers-ext/src/common/content_range.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> test_header!(test_bytes_unknown_range, vec![b"bytes */500"], Some(ContentRange(ContentRangeSpec::Bytes { range: None, complete_length: Some(500) }))); test_header!(test_unregistered, vec![b"seconds 1-2"], ...
code_fim
hard
{ "lang": "rust", "repo": "flodiebold/headers", "path": "/headers-ext/src/common/content_range.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: flodiebold/headers path: /headers-ext/src/common/content_range.rs use std::fmt; /// Content-Range, described in [RFC7233](https://tools.ietf.org/html/rfc7233#section-4.2) /// /// # ABNF /// /// ```text /// Content-Range = byte-content-range /// / other-content-range //...
code_fim
hard
{ "lang": "rust", "repo": "flodiebold/headers", "path": "/headers-ext/src/common/content_range.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'r, T: Serialize> Responder<'r, 'static> for HFResponse<T> { fn respond_to(self, _: &'r rocket::Request<'_>) -> rocket::response::Result<'static> { let stat = match self.status { Some(val) => val, None => Status::Ok, }; let res = ResponseSchema { ...
code_fim
hard
{ "lang": "rust", "repo": "HellFireCMS/hellfire-backend", "path": "/src/models/schemas/response_schema.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HellFireCMS/hellfire-backend path: /src/models/schemas/response_schema.rs use rocket::{ http::{ContentType, Status}, response::{Responder, Response}, serde::Serialize, }; use serde_json::json; use std::io::Cursor; pub struct HFResponse<T: Serialize> { pub status: Option<Status>,...
code_fim
hard
{ "lang": "rust", "repo": "HellFireCMS/hellfire-backend", "path": "/src/models/schemas/response_schema.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn as_u64<S: Into<String>>(&self, property_name: S) -> Option<u64> { self.properties.get(&property_name.into()).and_then(|p| p.as_u64()) } fn as_i64<S: Into<String>>(&self, property_name: S) -> Option<i64> { self.properties.get(&property_name.into()).and_then(|p| p.as_i64()) ...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/model/entity_instance.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> self.properties.get(&property_name.into()).and_then(|p| p.as_f64()) } fn as_string<S: Into<String>>(&self, property_name: S) -> Option<String> { self.properties.get(&property_name.into()).and_then(|p| p.as_str().and_then(|s| Some(s.to_string()))) } } impl MutablePropertyInsta...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/model/entity_instance.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: aschaeffer/rust-ecs-poc path: /src/model/entity_instance.rs use indradb::VertexProperties; use serde::{Deserialize, Serialize}; use serde_json::Value; use std::collections::HashMap; use uuid::Uuid; use crate::api::{MutablePropertyInstanceSetter, PropertyInstanceGetter}; #[derive(Serialize, Dese...
code_fim
hard
{ "lang": "rust", "repo": "aschaeffer/rust-ecs-poc", "path": "/src/model/entity_instance.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (entity, _) in (entities, comp_remove).join() { self.unsubscribe(entity); } for (entity, _) in (entities, comp_new).join() { self.subscribe(entity, storage); } } pub fn read_storage<'a>( &mut self, entity: Entity, ...
code_fim
hard
{ "lang": "rust", "repo": "jaynus/survival", "path": "/core/src/component_event_reader.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jaynus/survival path: /core/src/component_event_reader.rs use amethyst::ecs::{ storage, storage::{ComponentEvent, UnprotectedStorage}, BitSet, Component, Entities, Entity, Join, SystemData, World, WriteStorage, }; use amethyst::shrev; pub trait HasChannel<E> { /// Event channel ...
code_fim
hard
{ "lang": "rust", "repo": "jaynus/survival", "path": "/core/src/component_event_reader.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akiradeveloper/rust-comp-snippets path: /src/doubling.rs use cargo_snippet::snippet; /// ダブリング /// /// 理論的には /// [f^1,f^2,f^4,...] /// という配列を構築すればよいが、関数を保持するというのは難しい。 /// 例えば、f^4を計算するのにf^2が必要といったように関数を構築するのに遅延計算を行うと、計算量に影響する。 /// /// そこで、このライブラリでは、関数を表す値を保持することにする。 /// /// x0: 単位 /// f: ap(f...
code_fim
hard
{ "lang": "rust", "repo": "akiradeveloper/rust-comp-snippets", "path": "/src/doubling.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn inv(&self, x: &i64) -> i64 { *x } } let mut f = Doubling::new(F, 5); assert_eq!(f.pow(1), 2); assert_eq!(f.pow(2), 4); assert_eq!(f.pow(3), 8); assert_eq!(f.pow(50), 1125899906842624); }<|fim_prefix|>// repo: akiradeveloper/rust-comp-snippets path: /src/doubling.rs use ...
code_fim
medium
{ "lang": "rust", "repo": "akiradeveloper/rust-comp-snippets", "path": "/src/doubling.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: starcoinorg/starcoin path: /types/src/error/mod.rs // Copyright (c) The Starcoin Core Contributors // SPDX-License-Identifier: Apache-2.0 use starcoin_crypto::HashValue; use starcoin_vm_types::vm_status::DiscardedVMStatus; use std::error::Error; use thiserror::Error; <|fim_suffix|>#[derive(Err...
code_fim
medium
{ "lang": "rust", "repo": "starcoinorg/starcoin", "path": "/types/src/error/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Error, Debug)] pub enum BlockExecutorError { #[error("block transaction execute discard, status:{0:?}, transaction_id: {1}")] BlockTransactionDiscard(DiscardedVMStatus, HashValue), #[error("block transaction accumulator append error")] BlockAccumulatorAppendErr, #[error("block...
code_fim
medium
{ "lang": "rust", "repo": "starcoinorg/starcoin", "path": "/types/src/error/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: harshu4/advent-of-code-rust path: /rust/day4/src/main2.rs fn main() { let mut ins = 0; for x in 357253..892942 { let mut list = x .to_string() .chars() .map(|d| d.to_digit(10).unwrap()) .collect::<Vec<_>>(); let mut x = lis...
code_fim
medium
{ "lang": "rust", "repo": "harshu4/advent-of-code-rust", "path": "/rust/day4/src/main2.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn is_sorted(ro: &Vec<u32>) -> bool { let mut prev = ro[0]; for x in ro { if *x >= prev { prev = *x } else { return false; } } true } fn is_adjacent(ro: &Vec<u32>) -> bool { let mut prev = 20000; let mut repeat = 1; let mut cur: ...
code_fim
medium
{ "lang": "rust", "repo": "harshu4/advent-of-code-rust", "path": "/rust/day4/src/main2.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_is_retained() { let non_publish_fixed_header = FixedHeader { cp_type: CPType::Connack, flag: Flag { control_packet: CPType::Connack, is_reserved: false, bits: 1, }, remaining_len...
code_fim
hard
{ "lang": "rust", "repo": "telemq/telemq", "path": "/mqtt-packets/src/v_3_1_1/publish/fixed_header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: telemq/telemq path: /mqtt-packets/src/v_3_1_1/publish/fixed_header.rs //! This module contains helper methods for working with fixed //! header values specific for Publish control packet. use crate::v_3_1_1::cp_fixed_header::FixedHeader; use crate::v_3_1_1::cp_flag::Flag; use crate::v_3_1_1::{C...
code_fim
hard
{ "lang": "rust", "repo": "telemq/telemq", "path": "/mqtt-packets/src/v_3_1_1/publish/fixed_header.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let all_qoss = vec![ (0, QoS::Zero), (0b00000010, QoS::One), (0b00000100, QoS::Two), ]; for qos in all_qoss { let publish_fixed_header = FixedHeader { cp_type: CPType::Publish, flag: Flag { ...
code_fim
hard
{ "lang": "rust", "repo": "telemq/telemq", "path": "/mqtt-packets/src/v_3_1_1/publish/fixed_header.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dankrajnak/dankland path: /src/webassembly/fluid/tests/web.rs //! Test suite for the Web and headless browsers. #![cfg(target_arch = "wasm32")] <|fim_suffix|>wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn pass() { let mut fluid = FluidSimulation::new(1500, 1000, 100...
code_fim
medium
{ "lang": "rust", "repo": "dankrajnak/dankland", "path": "/src/webassembly/fluid/tests/web.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut fluid = FluidSimulation::new(1500, 1000, 1000); fluid.simulate(0.167); }<|fim_prefix|>// repo: dankrajnak/dankland path: /src/webassembly/fluid/tests/web.rs //! Test suite for the Web and headless browsers. #![cfg(target_arch = "wasm32")] <|fim_middle|>extern crate wasm_bindgen_test; us...
code_fim
medium
{ "lang": "rust", "repo": "dankrajnak/dankland", "path": "/src/webassembly/fluid/tests/web.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>wasm_bindgen_test_configure!(run_in_browser); #[wasm_bindgen_test] fn pass() { let mut fluid = FluidSimulation::new(1500, 1000, 1000); fluid.simulate(0.167); }<|fim_prefix|>// repo: dankrajnak/dankland path: /src/webassembly/fluid/tests/web.rs //! Test suite for the Web and headless browsers. #...
code_fim
medium
{ "lang": "rust", "repo": "dankrajnak/dankland", "path": "/src/webassembly/fluid/tests/web.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Parse HTTP response message to this struct pub fn parse_message(buf: &Bytes) -> Option<Self> { let mut pointer = 0; let mut last_end = 0; let mut status_code = 0; let mut headers = Vec::new(); while pointer + 1 < buf.len() { if buf.get(pointe...
code_fim
hard
{ "lang": "rust", "repo": "kellerli/rust-http-proxy", "path": "/src/response.rs", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kellerli/rust-http-proxy path: /src/response.rs use bytes::{BufMut, Bytes, BytesMut}; use indoc::indoc; /// The struct for HTTP Response #[derive(Debug)] pub struct HTTPResponse { /// Status code of the response pub status_code: u32, /// HTTP Headers, represented by key-value pairs ...
code_fim
hard
{ "lang": "rust", "repo": "kellerli/rust-http-proxy", "path": "/src/response.rs", "mode": "psm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> let mut lines: Vec<String> = Vec::new(); lines.push(format!("HTTP/1.1 {}", self.get_status_description())); for (key, value) in &self.headers { if key == "Connection" { lines.push(String::from("Connection: close")); } else { l...
code_fim
hard
{ "lang": "rust", "repo": "kellerli/rust-http-proxy", "path": "/src/response.rs", "mode": "spm", "license": "LicenseRef-scancode-public-domain", "source": "the-stack-v2" }
<|fim_suffix|> //let x = DMatrix::from_iterator(3, 3, vec![1000.0, 400.0, 70.0, // 2000.0, 500.0, 80.0, // 3000.0, 600.0, 90.0]); //let y = DVector::from_iterator(3, vec![4000.0, 600.0, 80.0]); //let theta = DVector::fr...
code_fim
medium
{ "lang": "rust", "repo": "sebashack/ml_tool_box", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sebashack/ml_tool_box path: /src/main.rs //use ml_tool_box::regression::linear::{compute_cost, gradient_descent, feature_normalize}; // //use nalgebra::{DMatrix, DVector}; // //use std::env::current_dir; <|fim_suffix|> //let x = DMatrix::from_iterator(3, 3, vec![1000.0, 400.0, 70.0, // ...
code_fim
medium
{ "lang": "rust", "repo": "sebashack/ml_tool_box", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a, 'dt: 'a> DevTreeProp<'a, 'dt> { pub(super) fn new( parent_iter: DevTreeIter<'a, 'dt>, propbuf: &'dt [u8], nameoff: usize, ) -> Self { Self { parent_iter, propbuf, nameoff, } } }<|fim_prefix|>// repo: ruabmbua/...
code_fim
hard
{ "lang": "rust", "repo": "ruabmbua/fdt-rs", "path": "/src/base/prop.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ruabmbua/fdt-rs path: /src/base/prop.rs use core::ptr; use crate::base::iters::DevTreeIter; use crate::base::{DevTree, DevTreeNode}; use crate::prelude::*; use unsafe_unwrap::UnsafeUnwrap; /// A handle to a [`DevTreeNode`]'s Device Tree Property #[derive(Clone)] pub struct DevTreeProp<'a, 'dt...
code_fim
hard
{ "lang": "rust", "repo": "ruabmbua/fdt-rs", "path": "/src/base/prop.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: phaylon/brimstone path: /brimstone-storage/src/lib.rs pub extern crate rusqlite; use std::path; use std::io; use std::fs; use std::cell; const CURRENT_VERSION: u32 = 1; pub fn do_nothing(_: &mut rusqlite::Connection) -> Result<(), rusqlite::Error> { Ok(()) } #[derive(Debug)] pub enum Error ...
code_fim
hard
{ "lang": "rust", "repo": "phaylon/brimstone", "path": "/brimstone-storage/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if path.exists() { let mut conn = rusqlite::Connection::open_with_flags( path, rusqlite::OpenFlags::SQLITE_OPEN_READ_WRITE, )?; common_prepare(&mut conn)?; prepare(&mut conn)?; let conn = cell::RefCell::new...
code_fim
hard
{ "lang": "rust", "repo": "phaylon/brimstone", "path": "/brimstone-storage/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Devolutions/picky-rs path: /ffi/src/ssh.rs use picky::ssh; impl From<ffi::SshCertKeyType> for ssh::SshCertKeyType { fn from(ty: ffi::SshCertKeyType) -> Self { match ty { ffi::SshCertKeyType::SshRsaV01 => ssh::SshCertKeyType::SshRsaV01, ffi::SshCertKeyType::Ss...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/picky-rs", "path": "/ffi/src/ssh.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Required pub fn set_cert_type(&self, cert_type: SshCertType) { self.0.cert_type(cert_type.into()); } /// Optional pub fn set_key_id(&self, key_id: &str) { self.0.key_id(key_id.to_owned()); } /// Required pub fn s...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/picky-rs", "path": "/ffi/src/ssh.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[diplomat::bridge] pub mod ffi { use crate::error::ffi::PickyError; use crate::key::ffi::{EcCurve, PrivateKey}; use crate::pem::ffi::Pem; use crate::signature::ffi::SignatureAlgorithm; use diplomat_runtime::DiplomatWriteable; use picky::ssh; use std::borrow::ToOwned; use s...
code_fim
hard
{ "lang": "rust", "repo": "Devolutions/picky-rs", "path": "/ffi/src/ssh.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> if value == 1 { info!("Stopping producer"); break; } warn!("Unexpected value {}", value); }, Err(TryRecvError::Empty) => { debug!("Tried to recv from empty channel"); ...
code_fim
hard
{ "lang": "rust", "repo": "ryanrolds/kafka_rust", "path": "/kafka_heartbeat/src/heartbeat/producer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ryanrolds/kafka_rust path: /kafka_heartbeat/src/heartbeat/producer.rs use kafka::producer::{Producer, Record, RequiredAcks}; use log::{debug, info, warn}; use std::{thread, time}; use std::fmt::Write; use std::sync::mpsc::{Receiver}; use std::sync::mpsc::TryRecvError; <|fim_suffix|> ...
code_fim
hard
{ "lang": "rust", "repo": "ryanrolds/kafka_rust", "path": "/kafka_heartbeat/src/heartbeat/producer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> warn!("Unexpected value {}", value); }, Err(TryRecvError::Empty) => { debug!("Tried to recv from empty channel"); }, Err(TryRecvError::Disconnected) => { panic!("Channel unexpectedly disconected"); ...
code_fim
hard
{ "lang": "rust", "repo": "ryanrolds/kafka_rust", "path": "/kafka_heartbeat/src/heartbeat/producer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marius-cristian/learning-rust path: /tokio/task_spawn/src/main.rs #[tokio::main] async fn main() { let handle = tokio::spawn(async { println!("doing some work, asynchronously"); <|fim_suffix|> // Wait for the spawned task to finish let res = handle.await; println!("got {...
code_fim
medium
{ "lang": "rust", "repo": "marius-cristian/learning-rust", "path": "/tokio/task_spawn/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Wait for the spawned task to finish let res = handle.await; println!("got {:?}", res); }<|fim_prefix|>// repo: marius-cristian/learning-rust path: /tokio/task_spawn/src/main.rs #[tokio::main] async fn main() { let handle = tokio::spawn(async { println!("doing some work, asynch...
code_fim
medium
{ "lang": "rust", "repo": "marius-cristian/learning-rust", "path": "/tokio/task_spawn/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Wdiviner/geektime-rust path: /08_borrow/src/ownership_reference.rs fn main() { let data = vec![1, 2, 3, 4]; let data1 = &data; // 值的地址是什么?引用的地址又是什么? println!( "addr of value: {:p}({:p}), addr of data {:p}, data1: {:p}", &data, data1, &&data, &data1 ); prin...
code_fim
medium
{ "lang": "rust", "repo": "Wdiviner/geektime-rust", "path": "/08_borrow/src/ownership_reference.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // 值的地址会改变么?引用的地址会改变么? println!("addr of value: {:p}, addr of ref: {:p}", data, &data); data.iter().sum() }<|fim_prefix|>// repo: Wdiviner/geektime-rust path: /08_borrow/src/ownership_reference.rs fn main() { let data = vec![1, 2, 3, 4]; let data1 = &data; // 值的地址是什么?引用的地址又是什么? ...
code_fim
medium
{ "lang": "rust", "repo": "Wdiviner/geektime-rust", "path": "/08_borrow/src/ownership_reference.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shaunstanislaus/diesel path: /diesel/src/types/mod.rs //! Types which represent a native SQL data type, and the conversions between //! them and Rust primitives. Additional types can be added by other crates. pub mod ops; mod ord; mod impls; #[doc(hidden)] pub mod structs { pub mod data_typ...
code_fim
hard
{ "lang": "rust", "repo": "shaunstanislaus/diesel", "path": "/diesel/src/types/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, PartialEq, Eq)] /// Tiny enum to make the return type of `ToSql` more descriptive pub enum IsNull { Yes, No, } /// Serializes a single value to be sent to the database. The output will be /// included as a bind parameter, and is expected to be the binary format, not /// text. pub ...
code_fim
hard
{ "lang": "rust", "repo": "shaunstanislaus/diesel", "path": "/diesel/src/types/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// How to deserialize multiple fields, with a known type. This type is /// implemented for tuples of various sizes. pub trait FromSqlRow<A: NativeSqlType>: Sized { fn build_from_row<T: Row>(row: &mut T) -> Result<Self, Box<Error>>; } impl<A, T> FromSqlRow<A> for T where A: NativeSqlType, T: ...
code_fim
hard
{ "lang": "rust", "repo": "shaunstanislaus/diesel", "path": "/diesel/src/types/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>multaneously"] pub fn multi_chan_trigger(self) -> Reg<regs::MultiChanTrigger, RW> { unsafe { Reg::from_ptr(self.0.add(1072usize)) } } #[doc = "Sniffer Control"] pub fn sniff_ctrl(self) -> Reg<regs::SniffCtrl, RW> { unsafe { Reg::from_ptr(self.0.add(1076usize)) } } #...
code_fim
hard
{ "lang": "rust", "repo": "Dirbaio/rp2040-pac", "path": "/src/dma.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Dirbaio/rp2040-pac path: /src/dma.rs use crate::generic::*; #[derive(Copy, Clone)] pub struct Channel(pub *mut u8); unsafe impl Send for Channel {} unsafe impl Sync for Channel {} impl Channel { #[doc = "DMA Channel 1 Read Address pointer This register updates automatically each time a read ...
code_fim
hard
{ "lang": "rust", "repo": "Dirbaio/rp2040-pac", "path": "/src/dma.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: metajack/badpostcond path: /src/lib.rs use mirai_annotations::{postcondition, assumed_postcondition}; pub struct Foo { capacity: usize, length: usize, } impl Foo { pub fn with_capacity(capacity: usize) -> Foo { let result = Foo { capacity, length: 0,...
code_fim
medium
{ "lang": "rust", "repo": "metajack/badpostcond", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let result = (&mut self.length, self.capacity); assumed_postcondition!(*result.0 <= result.1); result } }<|fim_prefix|>// repo: metajack/badpostcond path: /src/lib.rs use mirai_annotations::{postcondition, assumed_postcondition}; pub struct Foo { capacity: usize, leng...
code_fim
hard
{ "lang": "rust", "repo": "metajack/badpostcond", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> c.bench_function("extend", |b| { b.iter(|| { ec.extend_commitments(black_box(&source_commitments)) .unwrap() }) }); } criterion_group!(benches, criterion_benchmark); criterion_main!(benches);<|fim_prefix|>// repo: subspace/subspace path: /crates/subspa...
code_fim
hard
{ "lang": "rust", "repo": "subspace/subspace", "path": "/crates/subspace-erasure-coding/benches/commitments.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let source_commitments = (0..num_shards / 2) .map(|_| Commitment::from(FsG1::rand())) .collect::<Vec<_>>(); c.bench_function("extend", |b| { b.iter(|| { ec.extend_commitments(black_box(&source_commitments)) .unwrap() }) }); } criter...
code_fim
hard
{ "lang": "rust", "repo": "subspace/subspace", "path": "/crates/subspace-erasure-coding/benches/commitments.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: subspace/subspace path: /crates/subspace-erasure-coding/benches/commitments.rs use blst_rust::types::g1::FsG1; use criterion::{black_box, criterion_group, criterion_main, Criterion}; use kzg::G1; use std::num::NonZeroUsize; use subspace_core_primitives::crypto::kzg::Commitment; use subspace_core...
code_fim
hard
{ "lang": "rust", "repo": "subspace/subspace", "path": "/crates/subspace-erasure-coding/benches/commitments.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn enable_mem_read(mut self) -> Self { self.inner.enable_mem_read(); self } pub fn enable_mem_write(mut self) -> Self { self.inner.enable_mem_write(); self } pub fn enable_execute(mut self) -> Self { self.inner.enable_execute(); sel...
code_fim
hard
{ "lang": "rust", "repo": "Kazurin-775/process-inject-rs", "path": "/src/process/open_options.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Kazurin-775/process-inject-rs path: /src/process/open_options.rs use super::{Pid, Process}; use crate::sys::process as imp; pub struct ProcessOpenOptions { inner: imp::ProcessOpenOptions, } impl From<imp::ProcessOpenOptions> for ProcessOpenOptions { fn from(inner: imp::ProcessOpenOptio...
code_fim
hard
{ "lang": "rust", "repo": "Kazurin-775/process-inject-rs", "path": "/src/process/open_options.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(cx.string("hello node")) } #[neon::main] fn main(mut cx: ModuleContext) -> NeonResult<()> { cx.export_function("hello", hello)?; cx.export_function("jsBufferTo", buffer::jsbuffer_to)?; cx.export_function("bufferFromRs", buffer::buffer_from_rs)?; cx.export_function("imageGen", image...
code_fim
hard
{ "lang": "rust", "repo": "d-jsrsc/neon-demo", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: d-jsrsc/neon-demo path: /src/lib.rs mod buffer; mod image_gen; use lazy_static::lazy_static; use neon::prelude::*; lazy_static! { static ref THREAD_POOL: rayon::ThreadPool = init_pool(); } const RAYON_THREAD_NUM: usize = 8; fn init_pool() -> rayon::ThreadPool { <|fim_suffix|> Ok(cx.str...
code_fim
medium
{ "lang": "rust", "repo": "d-jsrsc/neon-demo", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jonfk/project-euler path: /23/23-rust.rs use std::collections::HashMap; fn main() { let mut is_abundants: HashMap<u64,bool> = HashMap::new(); let mut abundants = Vec::new(); for n in (1..28124) { let mut has_abundant = false; for i in (1..n) { if is_abun...
code_fim
hard
{ "lang": "rust", "repo": "jonfk/project-euler", "path": "/23/23-rust.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut divisors = Vec::new(); for i in (1..n) { if n % i == 0 { divisors.push(i); } } divisors } fn is_abundant(n: u64, cache: &mut HashMap<u64,bool>) -> bool { *cache.entry(n).or_insert_with(|| { let divisors = proper_divisors(n); let sum ...
code_fim
hard
{ "lang": "rust", "repo": "jonfk/project-euler", "path": "/23/23-rust.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn proper_divisors(n: u64) -> Vec<u64> { let mut divisors = Vec::new(); for i in (1..n) { if n % i == 0 { divisors.push(i); } } divisors } fn is_abundant(n: u64, cache: &mut HashMap<u64,bool>) -> bool { *cache.entry(n).or_insert_with(|| { let diviso...
code_fim
hard
{ "lang": "rust", "repo": "jonfk/project-euler", "path": "/23/23-rust.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#![feature(untagged_unions)] #[derive( Copy, )] union U { a: u8, b: u16, } impl Clone for U { fn clone(&self) -> Self { *self } } fn main() { let u = U { b: 0 }; let u1 = u; let u2 = u.clone(); }<|fim_prefix|>// repo: mhenes/rust path: /src/test/run-pass/union/union-derive....
code_fim
medium
{ "lang": "rust", "repo": "mhenes/rust", "path": "/src/test/run-pass/union/union-derive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Clone for U { fn clone(&self) -> Self { *self } } fn main() { let u = U { b: 0 }; let u1 = u; let u2 = u.clone(); }<|fim_prefix|>// repo: mhenes/rust path: /src/test/run-pass/union/union-derive.rs // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-le...
code_fim
medium
{ "lang": "rust", "repo": "mhenes/rust", "path": "/src/test/run-pass/union/union-derive.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mhenes/rust path: /src/test/run-pass/union/union-derive.rs // Copyright 2016 The Rust Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution and at // http://rust-lang.org/COPYRIGHT. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or //...
code_fim
medium
{ "lang": "rust", "repo": "mhenes/rust", "path": "/src/test/run-pass/union/union-derive.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_data(&self) -> u8 { (if self.background_display { 0x01 } else { 0 }) | (if self.sprite_display { 0x02 } else { 0 }) | (if self.sprite_size_big { 0x04 } else { 0 }) | (if self.background_tilemap { 0x08 } else { 0 }) | (if self.backgroun...
code_fim
hard
{ "lang": "rust", "repo": "p4ddy1/gbemulator", "path": "/lib_gbemulation/src/gpu/lcdc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: p4ddy1/gbemulator path: /lib_gbemulation/src/gpu/lcdc.rs pub struct Lcdc { pub background_display: bool, pub sprite_display: bool, pub sprite_size_big: bool, pub background_tilemap: bool, pub background_tiledata: bool, pub window_enabled: bool, pub window_tilemap: boo...
code_fim
hard
{ "lang": "rust", "repo": "p4ddy1/gbemulator", "path": "/lib_gbemulation/src/gpu/lcdc.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn set_data(&mut self, data: u8) { self.background_display = data & 0x01 == 0x01; self.sprite_display = data & 0x02 == 0x02; self.sprite_size_big = data & 0x04 == 0x04; self.background_tilemap = data & 0x08 == 0x08; self.background_tiledata = data & 0x10 == ...
code_fim
hard
{ "lang": "rust", "repo": "p4ddy1/gbemulator", "path": "/lib_gbemulation/src/gpu/lcdc.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: helloooooo/Ants-book path: /src/fact.rs mod scaneer; use scaneer::*; fn main(){ <|fim_suffix|> if n == 0{ 1 } else { n * fact(n - 1) } }<|fim_middle|> let s : i64 = read(); println!("{}",fact(s) ); } fn fact(n:i64) -> i64{
code_fim
medium
{ "lang": "rust", "repo": "helloooooo/Ants-book", "path": "/src/fact.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if n == 0{ 1 } else { n * fact(n - 1) } }<|fim_prefix|>// repo: helloooooo/Ants-book path: /src/fact.rs mod scaneer; use scaneer::*; fn main(){ <|fim_middle|> let s : i64 = read(); println!("{}",fact(s) ); } fn fact(n:i64) -> i64{
code_fim
medium
{ "lang": "rust", "repo": "helloooooo/Ants-book", "path": "/src/fact.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("cargo:rustc-link-lib=static=spdk_env_dpdk"); println!("cargo:rustc-link-lib=static=spdk_log"); println!("cargo:rustc-link-lib=static=spdk_util"); println!("cargo:rustc-link-lib=static=spdk_nvme"); println!("cargo:rustc-link-search=spdk/build/lib"); println!("cargo:rustc-l...
code_fim
medium
{ "lang": "rust", "repo": "PumpkinDB/rust-spdk", "path": "/build.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let mut make_dpdk = Command::new("make"); make_dpdk.current_dir(Path::new("spdk/dpdk")) .arg("install").arg("T=x86_64-native-linuxapp-gcc").arg("EXTRA_CFLAGS=-fPIC"); exec("dpdk config", make_dpdk); let mut config_spdk = Command::new("./configure"); config_spdk.current_dir(Pat...
code_fim
medium
{ "lang": "rust", "repo": "PumpkinDB/rust-spdk", "path": "/build.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PumpkinDB/rust-spdk path: /build.rs use std::process::{Command, exit}; use std::path::Path; use std::io::{stderr, Write}; fn exec(command_name: &str, mut cmd: Command) { match cmd.output() { Ok(out) => if !out.status.success() { let _ = writeln!(&mut stderr(), "{} failed...
code_fim
hard
{ "lang": "rust", "repo": "PumpkinDB/rust-spdk", "path": "/build.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> ({ $src:ty => $( $dst:ty ),+ }) => { $crate::unsafe_impl_as!{ $src => $( $dst ),+ } }; ({ $src:ty = $( $dst:ty )=+ }) => { $crate::unsafe_impl_as!{ $src = $( $dst )=+ } }; ( $( $def:tt; )+ ) => { $( $crate::unsafe_impl_as! { $def } )+ }...
code_fim
hard
{ "lang": "rust", "repo": "petertodd/coercion", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: petertodd/coercion path: /src/lib.rs #![cfg_attr(feature = "maybe_uninit", feature(maybe_uninit))] //! In-place conversions between types of the same size and alignment. //! //! # Examples //! //! ``` //! use coercion::{Coerce, As}; //! //! let u8_slice: Box<[u8]> = vec![1,0,1,0].into_boxed_sli...
code_fim
hard
{ "lang": "rust", "repo": "petertodd/coercion", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> $crate::unsafe_impl_coerce! { $u | $( $u_remaining )|+ } }; ( $( { $t:ty | $( $u:ty )|+ }; )+ ) => { $( $crate::unsafe_impl_coerce! { $t | $( $u )|+ } )+ }; } /// Implements `As` for a sized types. #[macro_exp...
code_fim
hard
{ "lang": "rust", "repo": "petertodd/coercion", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub(crate) fn merge_pkey_ty_to_meta(&mut self, meta_doc: &mut Document, value_doc: &Document) { let pkey_ty = value_doc.pkey_id().unwrap().ty_int(); self.flags |= (pkey_ty as u32) & KEY_TY_FLAG; meta_doc.insert(meta_doc_key::FLAGS.into(), Value::Int(self.flags as i64)); } ...
code_fim
hard
{ "lang": "rust", "repo": "grantyuan/PoloDB", "path": "/src/polodb_core/meta_doc_helper.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grantyuan/PoloDB path: /src/polodb_core/meta_doc_helper.rs use polodb_bson::{Document, Value}; use crate::DbResult; use crate::error::DbErr; // root_btree schema // { // _id: String, // root_pid: Int, // flags: Int, // } // // flags indicates: // key_ty: 1byte // ... // pub(crate) struct ...
code_fim
hard
{ "lang": "rust", "repo": "grantyuan/PoloDB", "path": "/src/polodb_core/meta_doc_helper.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: parasyte/r64drive path: /src/consts.rs /// Command magic number "_CMD" pub const COMMAND: u32 = 0x43_4D_44; /// Compare magic number "CMP_" pub const COMPARE: u32 = 0x43_4D_50_00; /// Device magic number: "UDEV" pub const MAGIC: u32 = 0x55_44_45_56; <|fim_suffix|>/// Maximum data transfer siz...
code_fim
medium
{ "lang": "rust", "repo": "parasyte/r64drive", "path": "/src/consts.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// Maximum data transfer size (in bytes) pub const MAX_TRANSFER_SIZE: usize = 8 * 1024 * 1024 / 4;<|fim_prefix|>// repo: parasyte/r64drive path: /src/consts.rs /// Command magic number "_CMD" pub const COMMAND: u32 = 0x43_4D_44; /// Compare magic number "CMP_" pub const COMPARE: u32 = 0x43_4D_50_00; <...
code_fim
medium
{ "lang": "rust", "repo": "parasyte/r64drive", "path": "/src/consts.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }