text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> pub fn btb(&self) -> BTB_R { BTB_R::new(((self.bits >> 26) & 1) != 0) } #[doc = "Bit 27 - PSE"] #[inline(always)] pub fn pse(&self) -> PSE_R { PSE_R::new(((self.bits >> 27) & 1) != 0) } } impl W { #[doc = "Bit 0 - GB"] #[inline(always)] #[must_use] ...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/eth_mac_mmc/eth_macmdioar.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32mp1/src/stm32mp157/eth_mac_mmc/eth_macmdioar.rs #[doc = "Register `ETH_MACMDIOAR` reader"] pub type R = crate::R<ETH_MACMDIOAR_SPEC>; #[doc = "Register `ETH_MACMDIOAR` writer"] pub type W = crate::W<ETH_MACMDIOAR_SPEC>; #[doc = "Field `GB` reader - GB"] pu...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/eth_mac_mmc/eth_macmdioar.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) fn parse_and_render_error(schema: &str) -> String { parse_unwrap_err(schema) } #[track_caller] pub(crate) fn assert_valid(schema: &str) { match psl::parse_schema(schema) { Ok(_) => (), Err(err) => panic!("{err}"), } } pub(crate) const SQLITE_SOURCE: &str = r#" ...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/psl/psl/tests/common/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prisma/prisma-engines path: /psl/psl/tests/common/mod.rs mod asserts; pub(crate) use ::indoc::{formatdoc, indoc}; pub(crate) use asserts::*; pub(crate) use expect_test::expect; use psl::Configuration; pub(crate) fn reformat(input: &str) -> String { psl::reformat(input, 2).unwrap_or_else(|...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/psl/psl/tests/common/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub(crate) const SQLITE_SOURCE: &str = r#" datasource db { provider = "sqlite" url = "file:dev.db" } "#; pub(crate) const POSTGRES_SOURCE: &str = r#" datasource db { provider = "postgres" url = "postgresql://localhost:5432" } "#; pub(crate) const...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/psl/psl/tests/common/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let path = PathBuf::from("src"); let bindings = bindgen::Builder::default() .header("src/wrapper.h") .generate() .expect("bindgen失敗"); bindings .write_to_file(path.join(generated)) .expect("ファイル書き込み失敗"); }<|fim_prefix|>// repo: akatsuki-chan/nginx-rust...
code_fim
easy
{ "lang": "rust", "repo": "akatsuki-chan/nginx-rust-function", "path": "/src/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akatsuki-chan/nginx-rust-function path: /src/build.rs extern crate bindgen; extern crate gcc; use std::path::PathBuf; fn main() { <|fim_suffix|>fn expand_headers(generated: &str) { let path = PathBuf::from("src"); let bindings = bindgen::Builder::default() .header("src/wrapper....
code_fim
medium
{ "lang": "rust", "repo": "akatsuki-chan/nginx-rust-function", "path": "/src/build.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> bindings .write_to_file(path.join(generated)) .expect("ファイル書き込み失敗"); }<|fim_prefix|>// repo: akatsuki-chan/nginx-rust-function path: /src/build.rs extern crate bindgen; extern crate gcc; use std::path::PathBuf; fn main() { let path = PathBuf::from("src"); // build時に毎回実行されるので...
code_fim
medium
{ "lang": "rust", "repo": "akatsuki-chan/nginx-rust-function", "path": "/src/build.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: elliottt/rendrs path: /src/transform.rs use nalgebra::{Matrix4, Normed, Point3, Unit, Vector3}; use std::ops::Neg; #[derive(Debug, Clone)] pub struct Transform { matrix: Matrix4<f32>, inverse: Matrix4<f32>, scale_factor: f32, } impl Transform { pub fn new() -> Self { Se...
code_fim
hard
{ "lang": "rust", "repo": "elliottt/rendrs", "path": "/src/transform.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let inv = Vector3::new(1. / vec.x, 1. / vec.y, 1. / vec.z); self.inverse.append_nonuniform_scaling_mut(&inv); // hmmm self.scale_factor *= vec.x.max(vec.y).max(vec.z); self } /// Compose an axis-angle rotation to the transform. pub fn rotate(mut self, ...
code_fim
hard
{ "lang": "rust", "repo": "elliottt/rendrs", "path": "/src/transform.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> m.transform_point(self) } } impl ApplyTransform for Vector3<f32> { #[inline] fn transform(&self, m: &Matrix4<f32>) -> Self { m.transform_vector(self) } } impl<T: Normed + ApplyTransform> ApplyTransform for Unit<T> { #[inline] fn transform(&self, m: &Matrix4<f32>) ...
code_fim
hard
{ "lang": "rust", "repo": "elliottt/rendrs", "path": "/src/transform.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(match s { "top-left" => Anchor::TopLeft, "top-right" => Anchor::TopRight, "bottom-left" => Anchor::BottomLeft, "bottom-right" => Anchor::BottomRight, s => { return Err(ErrorKind::ConfigError(format!( ...
code_fim
medium
{ "lang": "rust", "repo": "mishajw/incredi-panel", "path": "/src/anchor.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mishajw/incredi-panel path: /src/anchor.rs use crate::error::*; /// Where to anchor the panel #[allow(missing_docs)] pub enum Anchor { TopLeft, TopRight, BottomLeft, BottomRight, } <|fim_suffix|> Ok(match s { "top-left" => Anchor::TopLeft, "top-ri...
code_fim
medium
{ "lang": "rust", "repo": "mishajw/incredi-panel", "path": "/src/anchor.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> mod bi_symmetry; mod tri_symmetry; mod quad_symmetry; mod penta_symmetry;<|fim_prefix|>// repo: Stovoy/rpi-music-visualizer path: /src/visualizer/symmetry/mod.rs pub use self::bi_symmetry::BiSymmetryVisualizer; pub use self::tri_symmetry::TriSymmetryVisualizer; pub use self::quad_symmetry::QuadSymmetryV...
code_fim
medium
{ "lang": "rust", "repo": "Stovoy/rpi-music-visualizer", "path": "/src/visualizer/symmetry/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Stovoy/rpi-music-visualizer path: /src/visualizer/symmetry/mod.rs pub use self::bi_symmetry::BiSymmetryVisualizer; pub use self::tri_symmetr<|fim_suffix|>zer; pub use self::penta_symmetry::PentaSymmetryVisualizer; mod symmetry; mod bi_symmetry; mod tri_symmetry; mod quad_symmetry; mod penta_sym...
code_fim
medium
{ "lang": "rust", "repo": "Stovoy/rpi-music-visualizer", "path": "/src/visualizer/symmetry/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if let Some(rr) = pkt .as_any() .downcast_ref::<rtcp::receiver_report::ReceiverReport>() { assert_eq!(1, rr.reports.len()); assert_eq!( rtcp::reception_report::ReceptionReport { ssrc: 123456, last_sequence_number: 0x03, ...
code_fim
hard
{ "lang": "rust", "repo": "algesten/interceptor", "path": "/src/report/receiver/receiver_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: algesten/interceptor path: /src/report/receiver/receiver_test.rs rtcp().await.unwrap(); if let Some(rr) = pkt .as_any() .downcast_ref::<rtcp::receiver_report::ReceiverReport>() { assert_eq!(1, rr.reports.len()); assert_eq!( rtcp::reception_rep...
code_fim
hard
{ "lang": "rust", "repo": "algesten/interceptor", "path": "/src/report/receiver/receiver_test.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> stream .receive_rtp(rtp::packet::Packet { header: rtp::header::Header { sequence_number: 0x01, ..Default::default() }, ..Default::default() }) .await; stream .receive_rtp(rtp::packet::Packet { ...
code_fim
hard
{ "lang": "rust", "repo": "algesten/interceptor", "path": "/src/report/receiver/receiver_test.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut ch_unit = &mut ctx.ch_units[ch_block].as_mut().unwrap(); for i in 0..((SUBBANDS - ch_unit.num_subbands as usize) * SUBBAND_SAMPLES) { ch_unit.prev_buf[ch][(ch_unit.num_subbands as usize * SUBBAND_SAMPLES) + i] = 0.0; } for i in 0..((SUBBANDS - ch_unit....
code_fim
hard
{ "lang": "rust", "repo": "travistrue2008/riff-wave-reader", "path": "/atrac3p/src/decoder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Ok(()) } fn generate_tones( ch_unit: &mut ChannelUnit, ch_num: usize, sb: usize, output: &mut [f32], ) -> Result<(), Error> { unimplemented!(); } fn ipqf(hist: &mut IPQFChannelCtx, input: &[f32], output: &mut [f32]) -> Result<(), Error> { unsafe { std::ptr::write_bytes(output...
code_fim
hard
{ "lang": "rust", "repo": "travistrue2008/riff-wave-reader", "path": "/atrac3p/src/decoder.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: travistrue2008/riff-wave-reader path: /atrac3p/src/decoder.rs use crate::data::*; use crate::{ChannelUnit, ChannelUnitType, Context, Error, GCContext, GainInfo, IPQFChannelCtx}; use rustdct::mdct::{window_fn, MDCTNaive, MDCT}; pub(crate) fn decode_residual_spectrum( channel_unit: &mut Chan...
code_fim
hard
{ "lang": "rust", "repo": "travistrue2008/riff-wave-reader", "path": "/atrac3p/src/decoder.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: WuerthPhoenix/tornado path: /tornado/engine_api_dto/src/common.rs use serde::{Deserialize, Serialize}; use std::collections::HashMap; use typescript_definitions::TypeScriptify; <|fim_suffix|>#[derive(Serialize, TypeScriptify)] pub struct WebError { pub code: String, pub params: HashMap<...
code_fim
medium
{ "lang": "rust", "repo": "WuerthPhoenix/tornado", "path": "/tornado/engine_api_dto/src/common.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Serialize, TypeScriptify)] pub struct WebError { pub code: String, pub params: HashMap<String, String>, pub message: Option<String>, }<|fim_prefix|>// repo: WuerthPhoenix/tornado path: /tornado/engine_api_dto/src/common.rs use serde::{Deserialize, Serialize}; use std::collections::Ha...
code_fim
medium
{ "lang": "rust", "repo": "WuerthPhoenix/tornado", "path": "/tornado/engine_api_dto/src/common.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!("Hello mocking!", hello_world(Watcher {})); } } fn hello_world(w: impl Watch) -> String { format!("Hello {}!", w.watch()) } fn main() { println!("Hello, world!"); }<|fim_prefix|>// repo: autozimu/rust-mock-sample path: /src/main.rs #![cfg_attr(test, feature(proc_macro_hyg...
code_fim
hard
{ "lang": "rust", "repo": "autozimu/rust-mock-sample", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> unreachable!() } } #[test] fn mock_test() { Watcher::watch.mock_safe(|_| MockResult::Return("mocking".into())); assert_eq!("Hello mocking!", hello_world(Watcher {})); } } fn hello_world(w: impl Watch) -> String { format!("Hello {}!", w.watch()) } ...
code_fim
medium
{ "lang": "rust", "repo": "autozimu/rust-mock-sample", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: autozimu/rust-mock-sample path: /src/main.rs #![cfg_attr(test, feature(proc_macro_hygiene))] #[cfg(test)] use mocktopus::macros::mockable; trait Watch { fn watch(&self) -> String; } #[cfg(test)] #[cfg_attr(test, mockable)] mod test { use crate::*; use mocktopus::mocking::*; s...
code_fim
medium
{ "lang": "rust", "repo": "autozimu/rust-mock-sample", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match info.si_signo { 0 => return Ok(None), // TODO: check if there is WNOHANG in the arguments libc::SIGCHLD => (), wtf => panic!("waitid() returned information about signal {}, not SIGCHLD", wtf) } let info_sigchld: siginfo_pad_sigchld = transmute(info._pad); Ok(Some(info_sigchld.si_p...
code_fim
hard
{ "lang": "rust", "repo": "vthriller/zombieland", "path": "/src/waitid.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: vthriller/zombieland path: /src/waitid.rs extern crate std; extern crate libc; use std::mem::{uninitialized, transmute}; // SIGCHLD /* typedef struct { int si_signo; int si_errno; int si_code; union { // … struct { __pid_t si_pid; __uid_t si_uid; int si_status; <|fim_suffix|>/...
code_fim
hard
{ "lang": "rust", "repo": "vthriller/zombieland", "path": "/src/waitid.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: grumbach/sn_api path: /src/app/files/metadata.rs // Copyright 2021 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licenses/BSD-3...
code_fim
hard
{ "lang": "rust", "repo": "grumbach/sn_api", "path": "/src/app/files/metadata.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // These are all Option<String> let original_created = file_item .get(PREDICATE_ORIGINAL_CREATED) .map(ToOwned::to_owned); let original_modified = file_item .get(PREDICATE_ORIGINAL_MODIFIED) .map(ToOwned::to_owned); let readon...
code_fim
hard
{ "lang": "rust", "repo": "grumbach/sn_api", "path": "/src/app/files/metadata.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>, #[doc = "0x80 - Channel cluster: CCR?, CNDTR?, CPAR?, and CMAR? registers"] pub ch7: CH, } #[doc = r" Register block"] #[repr(C)] pub struct CH { #[doc = "0x00 - DMA channel configuration register (DMA_CCR)"] pub cr: self::ch::CR, #[doc = "0x04 - DMA channel 1 number of data register...
code_fim
hard
{ "lang": "rust", "repo": "burrbull/stm32f1-gates", "path": "/src/stm32f102/dma1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: burrbull/stm32f1-gates path: /src/stm32f102/dma1.rs #[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { #[doc = "0x00 - DMA interrupt status register (DMA_ISR)"] pub isr: ISR, #[doc = "0x04 - DMA interrupt flag clear register (DMA_IFCR)"] pub ifcr: IFCR, #[doc =...
code_fim
hard
{ "lang": "rust", "repo": "burrbull/stm32f1-gates", "path": "/src/stm32f102/dma1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(rr.part1(), Result::Ok(444019)); } #[test] fn test_part2() { let rr = &ReportRepair::load("data/day1_input.txt"); assert_eq!(rr.part2(), Result::Ok(29212176)); } }<|fim_prefix|>// repo: dave20874/rs_aoc2020 path: /src/report_repair.rs use std::fs::File...
code_fim
medium
{ "lang": "rust", "repo": "dave20874/rs_aoc2020", "path": "/src/report_repair.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dave20874/rs_aoc2020 path: /src/report_repair.rs use std::fs::File; use std::io::{BufRead, BufReader}; use itertools::Itertools; pub struct ReportRepair { // a list of expense report values entries: Vec<i64>, } impl ReportRepair { pub fn load(filename: &str) -> ReportRepair { ...
code_fim
hard
{ "lang": "rust", "repo": "dave20874/rs_aoc2020", "path": "/src/report_repair.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] mod tests { use super::*; use crate::Day; #[test] fn test_part1() { let rr = &ReportRepair::load("data/day1_input.txt"); assert_eq!(rr.part1(), Result::Ok(444019)); } #[test] fn test_part2() { let rr = &ReportRepair::load("data/day1_i...
code_fim
hard
{ "lang": "rust", "repo": "dave20874/rs_aoc2020", "path": "/src/report_repair.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn domain_transform( value: f64, source_min: f64, source_max: f64, target_min: f64, target_max: f64, ) -> f64 { let source_range = source_max - source_min; let target_range = target_max - target_min; let offset_in_source = value - source_min; target_min + ((offset_in_...
code_fim
hard
{ "lang": "rust", "repo": "ricardopieper/polygon-check-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ricardopieper/polygon-check-rs path: /src/main.rs bounding_box: BoundingBox { min_x: min(triangle_vertices.iter().map(|v| v.x)), max_x: max(triangle_vertices.iter().map(|v| v.x)), min_y: min(triangle_vertices.iter().map(|v|...
code_fim
hard
{ "lang": "rust", "repo": "ricardopieper/polygon-check-rs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut num = 1; for vertex in poly.vertices.iter() { let bad_triangles = find_triangles_with_vertex_inside(&triangles, vertex); let mut polygon: Vec<[Vertex; 2]> = vec![]; for triangle in bad_triangles.iter() { for edge in triangle.edges.iter() { ...
code_fim
hard
{ "lang": "rust", "repo": "ricardopieper/polygon-check-rs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Elaborate the parameters into the core language let mut params = Vec::with_capacity(struct_type.params.len()); for (param_name, param_type) in &struct_type.params { let (param_type, _) = self.is_type(&param_type); params.push((param_name.clone(), Arc::new...
code_fim
hard
{ "lang": "rust", "repo": "yeslogic/fathom", "path": "/experiments/rust-prototype-v3/fathom/src/pass/surface_to_core.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> core_field_declarations.push(core::FieldDeclaration { doc: field.doc.clone(), label: field.label.clone(), type_: core_type, }); self.push_local_param(field.label.data.clone()...
code_fim
hard
{ "lang": "rust", "repo": "yeslogic/fathom", "path": "/experiments/rust-prototype-v3/fathom/src/pass/surface_to_core.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yeslogic/fathom path: /experiments/rust-prototype-v3/fathom/src/pass/surface_to_core.rs ta::NumberLiteral(source), _) => { let parse_state = literal::State::new(surface_term.location, source, &mut self.messages); let term_data = match expected_...
code_fim
hard
{ "lang": "rust", "repo": "yeslogic/fathom", "path": "/experiments/rust-prototype-v3/fathom/src/pass/surface_to_core.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gnoliyil/fuchsia path: /src/ui/bin/brightness_manager/src/test_helpers.rs // Copyright 2022 The Fuchsia Authors. All rights reserved. // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. use { anyhow::format_err, futures::{channel::ones...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/ui/bin/brightness_manager/src/test_helpers.rs", "mode": "psm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> use { super::*, assert_matches::assert_matches, futures::{join, poll}, }; #[fuchsia::test] async fn basic_get_set_and_clear() { let f = ResettableFuture::<u32>::new(); assert_matches!(poll!(f.clone()), Poll::Pending); f.set(17).await; ...
code_fim
hard
{ "lang": "rust", "repo": "gnoliyil/fuchsia", "path": "/src/ui/bin/brightness_manager/src/test_helpers.rs", "mode": "spm", "license": "BSD-2-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let destination_queue = item.get_queue_name(); match publisher.publish(&destination_queue, &message).await { Ok(_) => {}, Err(e) => { println!("{} Error publishing a message to the '{}' queue. err: {}, message...
code_fim
hard
{ "lang": "rust", "repo": "danieligazit/yoloplan", "path": "/extractor/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danieligazit/yoloplan path: /extractor/src/main.rs mod datasources; mod model; extern crate nats; use { crate::nats::asynk as nats_client, std::sync::Arc, crate::model::Datasource, crate::model::http_client::WebpageHttpClient, }; const MAX_CONCURRENT_MESSAGES: usize = 100; ext...
code_fim
hard
{ "lang": "rust", "repo": "danieligazit/yoloplan", "path": "/extractor/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let extracted_items = match datasource.extract(&message.data).await{ Ok(k) => k, Err(e) => { println!("{} Error occured in the extract logic. err: {}", &datasource_name, e); return; } }; ...
code_fim
hard
{ "lang": "rust", "repo": "danieligazit/yoloplan", "path": "/extractor/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>scription("Can't write metadata") cause(err) } Read(path: PathBuf, err: io::Error) { display("IO error {:?}: {}", path, err) description("IO error") cause(err) } InvalidMeta(path: PathBuf, err: &'static str) { disp...
code_fim
hard
{ "lang": "rust", "repo": "tailhook/cantal-rs", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tailhook/cantal-rs path: /src/error.rs use std::io; use std::path::PathBuf; quick_error! { /// Error of exporting metrics /// /// Can be triggered on ``cantal::start`` or ``cantal::start_by_reading``. /// And may be ignored if metrics are not crucial for the application. #[...
code_fim
hard
{ "lang": "rust", "repo": "tailhook/cantal-rs", "path": "/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fineconstant/rust_fizz_buzz path: /src/main.rs use fizz_buzz::FizzBuzz; //Binary - use case fn main() { <|fim_suffix|> for (x, fb) in fizz_buzz { println!("FizzBuzz {}: {}", x, fb); } }<|fim_middle|> let fizz_buzz = (1..=1_000).map(|x| (x, FizzBuzz::for_number(x)));
code_fim
medium
{ "lang": "rust", "repo": "fineconstant/rust_fizz_buzz", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let fizz_buzz = (1..=1_000).map(|x| (x, FizzBuzz::for_number(x))); for (x, fb) in fizz_buzz { println!("FizzBuzz {}: {}", x, fb); } }<|fim_prefix|>// repo: fineconstant/rust_fizz_buzz path: /src/main.rs use fizz_buzz::FizzBuzz; <|fim_middle|>//Binary - use case fn main() {
code_fim
easy
{ "lang": "rust", "repo": "fineconstant/rust_fizz_buzz", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: synapticarbors/advent_of_code_2020 path: /rust/aoc22/src/main.rs use std::collections::hash_map::DefaultHasher; use std::collections::{HashSet, VecDeque}; use std::hash::{Hash, Hasher}; use std::io::{self, Read}; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; fn main() ->...
code_fim
hard
{ "lang": "rust", "repo": "synapticarbors/advent_of_code_2020", "path": "/rust/aoc22/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn part2(input: &str) -> Result<()> { let decks = parse_input(input)?; let mut p1 = decks[0].clone(); let mut p2 = decks[1].clone(); let winner = play_recursive_game(&mut p1, &mut p2); let soln = match winner { 1 => score_deck(&p1), 2 => score_deck(&p2), _ => ...
code_fim
hard
{ "lang": "rust", "repo": "synapticarbors/advent_of_code_2020", "path": "/rust/aoc22/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pigeon-working-group/9001d path: /src/gp2d12_pub/main.rs extern crate mcp3008; extern crate nanomsg; extern crate rand; #[macro_use] extern crate structopt; extern crate colored; extern crate quickersort; extern crate gp2d12; extern crate shared; use std::thread::sleep; use std::time::Durati...
code_fim
hard
{ "lang": "rust", "repo": "pigeon-working-group/9001d", "path": "/src/gp2d12_pub/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if let Ok(mcp3008) = Mcp3008::new(&opt.spi_dev_path) { let mut gp2d12 = Gp2d12::new(mcp3008, opt.adc); let mut value_buffer = [0_f32; VALUE_BUFFER_SIZE]; let mut write_index: usize = 0; let mut avg: f32 = 0.0; loop { match gp2d12.read() { ...
code_fim
hard
{ "lang": "rust", "repo": "pigeon-working-group/9001d", "path": "/src/gp2d12_pub/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: louiszhuang/OpenZKP path: /crypto/stark/examples/pedersen_merkle/inputs.rs use super::pedersen_points::merkle_hash; use std::{prelude::v1::*, vec}; use zkp_primefield::FieldElement; #[derive(PartialEq, Clone)] #[cfg_attr(feature = "std", derive(Debug))] pub struct Claim { pub path_length: u...
code_fim
hard
{ "lang": "rust", "repo": "louiszhuang/OpenZKP", "path": "/crypto/stark/examples/pedersen_merkle/inputs.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut bytes: Self = vec![]; bytes.extend_from_slice(&claim.path_length.to_be_bytes()); bytes.extend_from_slice(&claim.root.as_montgomery().to_bytes_be()); bytes.extend_from_slice(&claim.leaf.as_montgomery().to_bytes_be()); bytes } } #[cfg(test)] use zkp_macro...
code_fim
hard
{ "lang": "rust", "repo": "louiszhuang/OpenZKP", "path": "/crypto/stark/examples/pedersen_merkle/inputs.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(test)] use zkp_macros_decl::field_element; #[cfg(test)] use zkp_u256::U256; #[cfg(test)] pub(crate) const SHORT_CLAIM: Claim = Claim { path_length: 4, leaf: field_element!("00"), root: field_element!("0720d51348b23cb2ca2c3c279ad338b759cbe85aa986f1e3e6e5dad5fff30255"), }; ...
code_fim
hard
{ "lang": "rust", "repo": "louiszhuang/OpenZKP", "path": "/crypto/stark/examples/pedersen_merkle/inputs.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let target_index = label_to_index[&target_label]; // +-----+ +-----+ +-----------------------------+ // | | | | | | // +-----------|-----|-----|-----|----...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/advent-of-code", "path": "/aoc-20/src/day_23.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nwtnni/advent-of-code path: /aoc-20/src/day_23.rs use std::collections::HashMap; use std::collections::VecDeque; use aoc::*; #[derive(Clone, Debug)] pub struct CrabCups(VecDeque<i64>); impl Fro for CrabCups { fn fro(input: &str) -> Self { input .trim() .cha...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/advent-of-code", "path": "/aoc-20/src/day_23.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut index_to_index = vec![0usize; MAX as usize]; let index_to_label = &self.0; for i in 0..MAX as usize { let curr = i; let next = (i + 1) % (MAX as usize); index_to_index[curr] = next; } let mut current_index = 0; l...
code_fim
hard
{ "lang": "rust", "repo": "nwtnni/advent-of-code", "path": "/aoc-20/src/day_23.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Amanieu/parking_lot path: /core/src/parking_lot.rs in_queue.set(current); } else { requeue_threads = current; } requeue_threads_tail = current; (*current).key.store(key_to, Ordering::Relaxed); res...
code_fim
hard
{ "lang": "rust", "repo": "Amanieu/parking_lot", "path": "/core/src/parking_lot.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Amanieu/parking_lot path: /core/src/parking_lot.rs , callback: impl FnOnce(RequeueOp, UnparkResult) -> UnparkToken, ) -> UnparkResult { // Lock the two buckets for the given key let (bucket_from, bucket_to) = lock_bucket_pair(key_from, key_to); // If the validation function fail...
code_fim
hard
{ "lang": "rust", "repo": "Amanieu/parking_lot", "path": "/core/src/parking_lot.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[cfg(feature = "deadlock_detection")] mod deadlock_impl { use super::{get_hashtable, lock_bucket, with_thread_data, ThreadData, NUM_THREADS}; use crate::thread_parker::{ThreadParkerT, UnparkHandleT}; use crate::word_lock::WordLock; use backtrace::Backtrace; use petgraph; use petgr...
code_fim
hard
{ "lang": "rust", "repo": "Amanieu/parking_lot", "path": "/core/src/parking_lot.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mryingster/ProjectEuler path: /problem_013.rs // -*- compile-command: "rustc -o problem_013_rs problem_013.rs" -*- // Copyright (c) 2016 Michael Caldwell fn main() { let mut numbers: [[u16; 50]; 100] = [ [3,7,1,0,7,2,8,7,5,3,3,9,0,2,1,0,2,7,9,8,7,9,7,9,9,8,2,2,0,8,3,7,5,9,0,2,4,6,5...
code_fim
hard
{ "lang": "rust", "repo": "mryingster/ProjectEuler", "path": "/problem_013.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>,8,0,2,5,2,1,6,7,4,6,7,0,8,8,3,2,1,5,1,2,0,1,8,5,8,8,3,5,4,3,2,2,3,8,1,2,8,7,6,9,5,2,7,8,6], [7,1,3,2,9,6,1,2,4,7,4,7,8,2,4,6,4,5,3,8,6,3,6,9,9,3,0,0,9,0,4,9,3,1,0,3,6,3,6,1,9,7,6,3,8,7,8,0,3,9], [6,2,1,8,4,0,7,3,5,7,2,3,9,9,7,9,4,2,2,3,4,0,6,2,3,5,3,9,3,8,0,8,3,3,9,6,5,1,3,2,7,4,0,8,0,1,1...
code_fim
hard
{ "lang": "rust", "repo": "mryingster/ProjectEuler", "path": "/problem_013.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: artursapek/iced path: /native/src/input/keyboard.rs //! Build keyboard events. mod event; mod key_code; mod modifiers_state; pub use<|fim_suffix|> pub use modifiers_state::ModifiersState;<|fim_middle|> event::Event; pub use key_code::KeyCode;
code_fim
easy
{ "lang": "rust", "repo": "artursapek/iced", "path": "/native/src/input/keyboard.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub use modifiers_state::ModifiersState;<|fim_prefix|>// repo: artursapek/iced path: /native/src/input/keyboard.rs //! Build keyboard events. mod event; mod key_code; mod modifiers_state; pub use<|fim_middle|> event::Event; pub use key_code::KeyCode;
code_fim
easy
{ "lang": "rust", "repo": "artursapek/iced", "path": "/native/src/input/keyboard.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> event::Event; pub use key_code::KeyCode; pub use modifiers_state::ModifiersState;<|fim_prefix|>// repo: artursapek/iced path: /native/src/input/keyboard.rs //! Build keyboard events. mod event; mo<|fim_middle|>d key_code; mod modifiers_state; pub use
code_fim
easy
{ "lang": "rust", "repo": "artursapek/iced", "path": "/native/src/input/keyboard.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// TODO: make this function safe when we have feature(target_feature_11) #[target_feature(enable = "rdrand")] unsafe fn rdrand_exact(dest: &mut [MaybeUninit<u8>]) -> Option<()> { // We use chunks_exact_mut instead of chunks_mut as it allows almost all // calls to memcpy to be elided by the compile...
code_fim
hard
{ "lang": "rust", "repo": "chromium/chromium", "path": "/third_party/rust/getrandom/v0_2/crate/src/rdrand.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: chromium/chromium path: /third_party/rust/getrandom/v0_2/crate/src/rdrand.rs // Copyright 2018 Developers of the Rand project. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // https://www.apache.org/licenses/LICENSE-2.0> or the MIT license // <LICENSE-MIT or https://ope...
code_fim
hard
{ "lang": "rust", "repo": "chromium/chromium", "path": "/third_party/rust/getrandom/v0_2/crate/src/rdrand.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // if nothing is between these two squares, then it's an attack if between == chess::EMPTY { self.pieces_being_attacked.insert(ws); } } // now look at the knights let attack...
code_fim
hard
{ "lang": "rust", "repo": "wspeirs/cgir", "path": "/src/board_widget.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn update(&mut self, ctx: &mut UpdateCtx, old_data: &State, data: &State, env: &Env) { // debug!("Widget::update"); // check for all our pieces being attacked let mut white_board = data.game.current_position().color_combined(chess::Color::White).clone(); let white_squa...
code_fim
hard
{ "lang": "rust", "repo": "wspeirs/cgir", "path": "/src/board_widget.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wspeirs/cgir path: /src/board_widget.rs s f64, self.square_size * row as f64); let rect = Rect::from_origin_size(point, Size::new(self.square_size, self.square_size)); // debug!("R: {} C: {} => {}", row, col, rect); rect } fn square2piece(board: &Board, square:...
code_fim
hard
{ "lang": "rust", "repo": "wspeirs/cgir", "path": "/src/board_widget.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wspeirs/kvs path: /src/record.rs use std::cmp::Ordering; use std::fmt::{Debug, Formatter, Result as FmtResult}; use std::io::{Cursor, Error as IOError, Write, Read}; use byteorder::{ReadBytesExt, WriteBytesExt, LE}; use crate::U32_SIZE; use crate::U64_SIZE; use crate::record_file::buf2string; ...
code_fim
hard
{ "lang": "rust", "repo": "wspeirs/kvs", "path": "/src/record.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Record{ key, value, created, ttl } } pub fn is_expired(&self, ts: u64) -> bool { self.ttl <= ts } pub fn created(&self) -> u64 { self.created } pub fn ttl(&self) -> u64 { self.ttl } pub fn is_delete(&self) -> bool { self.value.is_...
code_fim
hard
{ "lang": "rust", "repo": "wspeirs/kvs", "path": "/src/record.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cosmos-client/cosmos-client-rs path: /src/generated/commitment.rs if !self.key_prefix.is_empty() { os.write_bytes(1, &self.key_prefix)?; } os.write_unknown_fields(self.get_unknown_fields())?; ::std::result::Result::Ok(()) } fn get_cached_size(&self)...
code_fim
hard
{ "lang": "rust", "repo": "cosmos-client/cosmos-client-rs", "path": "/src/generated/commitment.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> <MerkleProof as ::protobuf::Message>::default_instance() } } impl MerkleProof { pub fn new() -> MerkleProof { ::std::default::Default::default() } // repeated .ics23.CommitmentProof proofs = 1; pub fn get_proofs(&self) -> &[super::proofs::CommitmentProof] { ...
code_fim
hard
{ "lang": "rust", "repo": "cosmos-client/cosmos-client-rs", "path": "/src/generated/commitment.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cosmos-client/cosmos-client-rs path: /src/generated/commitment.rs ::CachedSize, } impl<'a> ::std::default::Default for &'a MerklePrefix { fn default() -> &'a MerklePrefix { <MerklePrefix as ::protobuf::Message>::default_instance() } } impl MerklePrefix { pub fn new() -> Mer...
code_fim
hard
{ "lang": "rust", "repo": "cosmos-client/cosmos-client-rs", "path": "/src/generated/commitment.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> re .replace_all(&source_code, |caps: &regex::Captures| format!("TYPE_{}D", &caps[1])) .into_owned() } fn process_surface_extension_name_referrals(source_code: String) -> String { let re = regex::Regex::new("(?x)vk::VK_KHR_([A-Z _ 0-9]*)_EXTENSION_NAME").unwrap(); println!("Fi...
code_fim
hard
{ "lang": "rust", "repo": "bzm3r/ash-integrator", "path": "/src/main.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_suffix|> let mut source_code = fs::read_to_string(file_path).unwrap(); let case_camel_to_snake = vec!["SubpassContents", "StructureType", "PipelineBindPoint", "ComponentSwizzle", "IndexType", "ImageLayout", "AttachmentLoadOp", "SamplerAddressMode", "BorderColor", "PrimitiveTopolo...
code_fim
hard
{ "lang": "rust", "repo": "bzm3r/ash-integrator", "path": "/src/main.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bzm3r/ash-integrator path: /src/main.rs extern crate clap; extern crate heck; extern crate regex; use clap::{Arg, App}; use std::fs as fs; use std::path::{Path, PathBuf}; use heck::ShoutySnakeCase; use heck::CamelCase; fn append_if_non_empty(input: &str, tail: &str) -> String { if input.ch...
code_fim
hard
{ "lang": "rust", "repo": "bzm3r/ash-integrator", "path": "/src/main.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arvikonoha/rusty-crab path: /ownership/main.rs fn main() { let name = String::from("Hello world"); let n_name = take_and_give(name); // yeh karna padtha hai, // ownership maintain karne ke lie println!("{}",n_name); // string stores data in a heap, and name has the following details ...
code_fim
medium
{ "lang": "rust", "repo": "arvikonoha/rusty-crab", "path": "/ownership/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // println!("{} {}",x,y) // but there is no mocing ownership in the case // of scalar values, Copy trait } fn take_and_give(name: String) -> String{ name }<|fim_prefix|>// repo: arvikonoha/rusty-crab path: /ownership/main.rs fn main() { let name = String::from("Hello world"); let n_name = take...
code_fim
medium
{ "lang": "rust", "repo": "arvikonoha/rusty-crab", "path": "/ownership/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: coriolinus/exercism-rs path: /luhn-trait/src/lib.rs extern crate luhn; use luhn::is_valid; <|fim_suffix|>impl<T: ToString> Luhn for T {}<|fim_middle|>pub trait Luhn: ToString { fn valid_luhn(&self) -> bool { is_valid(&self.to_string()) } }
code_fim
medium
{ "lang": "rust", "repo": "coriolinus/exercism-rs", "path": "/luhn-trait/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<T: ToString> Luhn for T {}<|fim_prefix|>// repo: coriolinus/exercism-rs path: /luhn-trait/src/lib.rs extern crate luhn; use luhn::is_valid; <|fim_middle|>pub trait Luhn: ToString { fn valid_luhn(&self) -> bool { is_valid(&self.to_string()) } }
code_fim
medium
{ "lang": "rust", "repo": "coriolinus/exercism-rs", "path": "/luhn-trait/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> is_valid(&self.to_string()) } } impl<T: ToString> Luhn for T {}<|fim_prefix|>// repo: coriolinus/exercism-rs path: /luhn-trait/src/lib.rs extern crate luhn; use luhn::is_valid; <|fim_middle|>pub trait Luhn: ToString { fn valid_luhn(&self) -> bool {
code_fim
medium
{ "lang": "rust", "repo": "coriolinus/exercism-rs", "path": "/luhn-trait/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iliekturtles/uom path: /src/si/linear_mass_density.rs //! Linear mass density (base unit kilogram per meter, m⁻¹ · kg). quantity! { /// Linear mass density (base unit kilogram per meter, m⁻¹ · kg). quantity: LinearMassDensity; "linear mass density"; /// Dimension of linear mass dens...
code_fim
hard
{ "lang": "rust", "repo": "iliekturtles/uom", "path": "/src/si/linear_mass_density.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn test<M: m::Conversion<V>, L: l::Conversion<V>, D: d::Conversion<V>>() { Test::assert_approx_eq(&LinearMassDensity::new::<D>(V::one()), &(Mass::new::<M>(V::one()) / Length::new::<L>(V::one()))); } } } }<|fim_prefix|>// repo: iliektu...
code_fim
hard
{ "lang": "rust", "repo": "iliekturtles/uom", "path": "/src/si/linear_mass_density.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /* [must_use] readonly attribute unsigned long authFlags; */ Method { name: "get_authFlags", abi: "C", params: &[Param { name: "aAuthFlags", ty: "*mut libc::uint32_t" }], ...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/bt/nsIHttpAuthenticator.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: mystor/dist-xprs-example path: /bt/nsIHttpAuthenticator.rs // // DO NOT EDIT. THIS FILE IS GENERATED FROM ../../../dist/idl/nsIHttpAuthenticator.idl // {static D: &'static [Interface] = &[ Interface { name: "nsIHttpAuthenticator", base: Some("nsISupports"), ...
code_fim
hard
{ "lang": "rust", "repo": "mystor/dist-xprs-example", "path": "/bt/nsIHttpAuthenticator.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> } }; let client = Client::new(); let credentials = Credentials::Token(token.clone()); let credentials2 = Credentials::Token(token); let github = Github::new( format!("hubcaps/{}", env!("CARGO_PKG_VERSION")), &client, credentials2); let mut args = ...
code_fim
hard
{ "lang": "rust", "repo": "badboy/hubcaps-asset-upload", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: badboy/hubcaps-asset-upload path: /src/main.rs extern crate hubcaps; extern crate hubcaps_asset_upload; extern crate hyper; extern crate env_logger; use std::path::Path; use std::{env, process}; use std::io::BufReader; use std::fs::File; use hubcaps_asset_upload::{AssetRequest, AssetUploader};...
code_fim
hard
{ "lang": "rust", "repo": "badboy/hubcaps-asset-upload", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let client = Client::new(); let credentials = Credentials::Token(token.clone()); let credentials2 = Credentials::Token(token); let github = Github::new( format!("hubcaps/{}", env!("CARGO_PKG_VERSION")), &client, credentials2); let mut args = env::args().skip(1)...
code_fim
medium
{ "lang": "rust", "repo": "badboy/hubcaps-asset-upload", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self.0 } } #[doc = "Field `POL_CLK` writer - USB need_clock polarity for triggering the USB wake-up interrupt"] pub struct POL_CLK_W<'a> { w: &'a mut W, } impl<'a> POL_CLK_W<'a> { #[doc = r"Writes `variant` to the field"] #[inline(always)] pub fn variant(self, variant: POL_CLK...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc11uxx/src/syscon/usbclkctrl.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lpc-rs/lpc-pac path: /lpc11uxx/src/syscon/usbclkctrl.rs #[doc = "Register `USBCLKCTRL` reader"] pub struct R(crate::R<USBCLKCTRL_SPEC>); impl core::ops::Deref for R { type Target = crate::R<USBCLKCTRL_SPEC>; #[inline(always)] fn deref(&self) -> &Self::Target { &self.0 } }...
code_fim
hard
{ "lang": "rust", "repo": "lpc-rs/lpc-pac", "path": "/lpc11uxx/src/syscon/usbclkctrl.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { // This is our socket address... let addr = ([127, 0, 0, 1], 3000).into(); // A `Service` is needed for every connection, so this // creates one from our `hello_world` function. let new_svc = || { // service_fn_ok converts our function into a `Service` serv...
code_fim
medium
{ "lang": "rust", "repo": "Sparkenstein/cross-benchmarks", "path": "/rust/ex-hyper/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Sparkenstein/cross-benchmarks path: /rust/ex-hyper/src/main.rs extern crate hyper; use hyper::rt::Future; use hyper::service::service_fn_ok; use hyper::{Body, Request, Response, Server}; const PHRASE: &str = "Hello, World!"; fn hello_world(_req: Request<Body>) -> Response<Body> { <|fim_suffix...
code_fim
medium
{ "lang": "rust", "repo": "Sparkenstein/cross-benchmarks", "path": "/rust/ex-hyper/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let inside_coord = Coordinate { x: 1.0, y: 1.0 }; assert_eq!( square_poly.coordinate_position(&inside_coord), CoordPos::Inside ); let vertex_coord = Coordinate { x: 0.0, y: 0.0 }; assert_eq!( square_poly.coordinate_position(&vert...
code_fim
hard
{ "lang": "rust", "repo": "gisfromscratch/geo", "path": "/geo/src/algorithm/coordinate_position.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gisfromscratch/geo path: /geo/src/algorithm/coordinate_position.rs if self.0.len() == 2 { // line string with two coords is just a line Line::new(self.0[0], self.0[1]).calculate_coordinate_position( coord, is_inside, bound...
code_fim
hard
{ "lang": "rust", "repo": "gisfromscratch/geo", "path": "/geo/src/algorithm/coordinate_position.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gisfromscratch/geo path: /geo/src/algorithm/coordinate_position.rs te_position( &self, coord: &Coordinate<T>, is_inside: &mut bool, _boundary_count: &mut usize, ) { if &self.0 == coord { *is_inside = true; } } } impl<T> Coordin...
code_fim
hard
{ "lang": "rust", "repo": "gisfromscratch/geo", "path": "/geo/src/algorithm/coordinate_position.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }