text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> Ok(AsyncSink::Ready) } fn poll_complete(&mut self) -> Poll<(), Error> { while let Async::Ready(_) = self.delay.poll()? { let val = match self.delay_buffer.pop() { Some(v) => v, None => break, }; if let Err(err) = ...
code_fim
hard
{ "lang": "rust", "repo": "howlowck/srt-rs", "path": "/tests/lossy_conn/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: leorse/rust_learning path: /test1/src/main.rs fn main() { println!("Hello, world!"); let condition:bool = true; let number= if(condition) {5} else {15}; if number < 10 { println!("nombre inférieur: {}", number); } else { println!("nombre supérieur: {}", numbe...
code_fim
medium
{ "lang": "rust", "repo": "leorse/rust_learning", "path": "/test1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let x = 5; let y = x; let s1 = String::from("oui"); let s2 = s1.clone(); println!("s1:{}", s1); #[derive(Copy, Clone)] struct Point { x: i32, y: i32 } let mut p1 = Point{ x: -1, y: 2 }; let p2 = p1; p1.x = 1; println!("p1: {}, {}", p1.x, p1.y); println!(...
code_fim
medium
{ "lang": "rust", "repo": "leorse/rust_learning", "path": "/test1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> celsius * 1.8 + 32.0 } fn get_celsius(pin: &AnalogPin) -> f64 { let raw = pin.get_value(); let volts = 5.0 / 4095.0 * raw as f64; volts / 0.01 } fn get_average(array: &[f64]) -> f64 { array.iter().sum::<f64>() / array.len() as f64 }<|fim_prefix|>// repo: hanhossain/edison-rs path: /...
code_fim
hard
{ "lang": "rust", "repo": "hanhossain/edison-rs", "path": "/examples/analog-temperature/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hanhossain/edison-rs path: /examples/analog-temperature/src/main.rs use edison::arduino::{AnalogPin, TristateBuffer}; use std::thread; use std::time::Duration; fn main() { <|fim_suffix|>fn to_fahrenheit(celsius: f64) -> f64 { celsius * 1.8 + 32.0 } fn get_celsius(pin: &AnalogPin) -> f64 { ...
code_fim
hard
{ "lang": "rust", "repo": "hanhossain/edison-rs", "path": "/examples/analog-temperature/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: L-as/wlroots-rs path: /rootston/src/input.rs use super::{seat, server::Server}; use wlroots::{self, Capability, Compositor, HandleResult, InputDevice, InputManagerHandler}; const DEFAULT_SEAT_NAME: &str = "seat0"; pub struct InputManager { seats: Vec<seat::Seat> } impl InputManagerHandler...
code_fim
hard
{ "lang": "rust", "repo": "L-as/wlroots-rs", "path": "/rootston/src/input.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn add_device_to_seat(&mut self, compositor: &mut Compositor, mut seat: wlroots::SeatHandle, input: &mut InputDevice) -> HandleResult<()> { use wlroots::wlr_input_device_...
code_fim
hard
{ "lang": "rust", "repo": "L-as/wlroots-rs", "path": "/rootston/src/input.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Construct a response depending on the selected tasks. let response = if let Some(signal) = &message.signal { match &message.tasks { TaskSelection::TaskIds(task_ids) => task_action_response_helper( "Tasks are being killed", task_ids.clone(), ...
code_fim
hard
{ "lang": "rust", "repo": "Nukesor/pueue", "path": "/pueue/src/daemon/network/message_handler/kill.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Nukesor/pueue path: /pueue/src/daemon/network/message_handler/kill.rs use pueue_lib::network::message::*; use pueue_lib::state::SharedState; use super::{TaskSender, SENDER_ERR}; use crate::daemon::network::response_helper::{ensure_group_exists, task_action_response_helper}; /// Invoked when ca...
code_fim
hard
{ "lang": "rust", "repo": "Nukesor/pueue", "path": "/pueue/src/daemon/network/message_handler/kill.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let foo = project() .file( "Cargo.toml", r#" [package] name = "foo" version = "0.0.1" edition = "2018" authors = [] [dependencies] reg-dep = "1.0.0" ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/cargo", "path": "/tests/testsuite/lints.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/cargo path: /tests/testsuite/lints.rs uires_option() { let foo = project() .file( "Cargo.toml", r#" [package] name = "foo" version = "0.0.1" authors = [] [lints.rust] ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/cargo", "path": "/tests/testsuite/lints.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/cargo path: /tests/testsuite/lints.rs ] fn package_requires_option() { let foo = project() .file( "Cargo.toml", r#" [package] name = "foo" version = "0.0.1" authors = [] ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/cargo", "path": "/tests/testsuite/lints.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Seiichi-Yahiro/bomberman path: /src/utils/flatten_2d.rs pub fn flatten_2d<T>(v: &Vec<Vec<T>>) -> Vec<(usize, usize, &T)> { v.iter<|fim_suffix|>.iter() .enumerate() .map(move |(column_index, tile_id)| (row_index, column_index, tile_id)) }) .coll...
code_fim
medium
{ "lang": "rust", "repo": "Seiichi-Yahiro/bomberman", "path": "/src/utils/flatten_2d.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> tile_id)| (row_index, column_index, tile_id)) }) .collect() }<|fim_prefix|>// repo: Seiichi-Yahiro/bomberman path: /src/utils/flatten_2d.rs pub fn flatten_2d<T>(v: &Vec<Vec<T>>) -> Vec<(usize, usize, &T)> { v.iter<|fim_middle|>() .enumerate() .flat_map(|(row_index, ro...
code_fim
medium
{ "lang": "rust", "repo": "Seiichi-Yahiro/bomberman", "path": "/src/utils/flatten_2d.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn dbs_proof_verification(c: &mut Criterion) { let mut group = c.benchmark_group("dbs_proof_verification"); BenchmarkGroup::sampling_mode(&mut group, criterion::SamplingMode::Flat); for &n in &TEST_POINTS { let rng = &mut StdRng::seed_from_u64(SEED); let t = (n + 1) / 2; ...
code_fim
hard
{ "lang": "rust", "repo": "zhtluo/dbs_bench", "path": "/benches/dbs.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn dbs_combination(c: &mut Criterion) { let mut group = c.benchmark_group("dbs_combination"); BenchmarkGroup::sampling_mode(&mut group, criterion::SamplingMode::Flat); for &n in &TEST_POINTS { let rng = &mut StdRng::seed_from_u64(SEED); let t = (n + 1) / 2; let keys...
code_fim
hard
{ "lang": "rust", "repo": "zhtluo/dbs_bench", "path": "/benches/dbs.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zhtluo/dbs_bench path: /benches/dbs.rs use criterion::{ criterion_group, criterion_main, BenchmarkGroup, BenchmarkId, Criterion, Throughput, }; use dbs_bench::*; use rand::{rngs::StdRng, SeedableRng}; const SEED: u64 = 42; static TEST_POINTS: [usize; 7] = [3, 10, 20, 30, 50, 75, 100]; const...
code_fim
hard
{ "lang": "rust", "repo": "zhtluo/dbs_bench", "path": "/benches/dbs.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if track == '+' { self.i = (self.i + 1) % 3 } self.dir = match (&self.dir, track, self.i) { ('<', '/', _) => 'v', ('>', '/', _) => '^', ('v', '/', _) => '<', ('^', '/', _) => '>', ('<', '\\', _) => '^', ('>', '\\',...
code_fim
hard
{ "lang": "rust", "repo": "zeddidragon/Advent-of-Code-2018", "path": "/src/day13.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> j += 1; } i += 1; } collision } pub fn run() { let file = File::open("./input/day13.txt").expect("File not found"); let input = BufReader::new(file); let mut carts = vec!(); let mut grid = vec!(); for (j, line) in input.lines().enumerate() { ...
code_fim
hard
{ "lang": "rust", "repo": "zeddidragon/Advent-of-Code-2018", "path": "/src/day13.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zeddidragon/Advent-of-Code-2018 path: /src/day13.rs use std::io::{BufReader, BufRead}; use std::fs::File; use std::collections::{HashMap}; fn part1(grid: &Vec<Vec<char>>, mut carts: &mut Vec<Cart>) { loop { match step(&grid, &mut carts) { Some((x, y)) => { ...
code_fim
hard
{ "lang": "rust", "repo": "zeddidragon/Advent-of-Code-2018", "path": "/src/day13.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Parses a module's import section into a list of tuples containing the import fields. pub fn get_imports(module: &Module) -> Option<Vec<(&str, &str)>> { if !has_import_section(module) { return None; } else { let imports_list: Option<Vec<(&str, &str)>> = Some( module ...
code_fim
hard
{ "lang": "rust", "repo": "jakelang/libeci", "path": "/src/pwasm.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let func_type_ref: usize = match import_section.entries()[index].external() { &External::Function(idx) => idx as usize, _ => usize::max_value(), }; match type_section.types()[func_type_ref] { Type::Function(ref func_type) => func_type.clone(), } } /// Resolves an ...
code_fim
hard
{ "lang": "rust", "repo": "jakelang/libeci", "path": "/src/pwasm.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jakelang/libeci path: /src/pwasm.rs /* * libeci: Ethereum WebAssembly ABI compliance library * * Copyright (c) 2018 Jake Lang * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * ...
code_fim
hard
{ "lang": "rust", "repo": "jakelang/libeci", "path": "/src/pwasm.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> #[derive(Deserialize)] #[serde(rename_all = "PascalCase")] pub struct DhtQueryResponse { #[serde(rename = "ID")] pub id: String, #[serde(rename = "Type")] pub typ: isize, #[serde(deserialize_with = "serde::deserialize_vec")] pub responses: Vec<DhtPeerResponse>, pub extra: S...
code_fim
hard
{ "lang": "rust", "repo": "leavehouse/rust-ipfs-api-1", "path": "/ipfs-api/src/response/dht.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: leavehouse/rust-ipfs-api-1 path: /ipfs-api/src/response/dht.rs use response::serde; #[derive(Deserialize)] #[serde(rename_all = "PascalCase")] pub struct DhtPeerResponse { #[serde(rename = "ID")] pub id: String, pub addrs: String, } #[derive(Deserialize)] #[serde(rename_all = "P...
code_fim
hard
{ "lang": "rust", "repo": "leavehouse/rust-ipfs-api-1", "path": "/ipfs-api/src/response/dht.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub const VERSION: i16 = 3; #[derive(Clone, Debug, PartialEq)] pub struct Responses<'i> { pub name: &'i str, pub error_code: ErrorCode, } impl<'i> crate::Encode for Responses<'i> { fn encode_len(&self) -> usize { self.name.encode_len() + self.error_code.encode_len() } fn enco...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/kafka-protocol", "path": "/src/parser/delete_topics_response.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone, Debug, PartialEq)] pub struct Responses<'i> { pub name: &'i str, pub error_code: ErrorCode, } impl<'i> crate::Encode for Responses<'i> { fn encode_len(&self) -> usize { self.name.encode_len() + self.error_code.encode_len() } fn encode(&self, writer: &mut impl B...
code_fim
hard
{ "lang": "rust", "repo": "iCodeIN/kafka-protocol", "path": "/src/parser/delete_topics_response.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: iCodeIN/kafka-protocol path: /src/parser/delete_topics_response.rs use super::*; pub fn delete_topics_response<'i, I>() -> impl Parser<I, Output = DeleteTopicsResponse<'i>> + 'i where I: RangeStream<Token = u8, Range = &'i [u8]> + 'i, I::Error: ParseError<I::Token, I::Range, I::Position>...
code_fim
medium
{ "lang": "rust", "repo": "iCodeIN/kafka-protocol", "path": "/src/parser/delete_topics_response.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shinykitten/hello_panel path: /src/panel_controller.rs use image::RgbaImage; pub struct PanelCache { panel_width: usize, // Needed when creating new panels; assigned at new, never updated. panel_height: usize, // Needed when creating new panels; assigned at new, never updated. nex...
code_fim
hard
{ "lang": "rust", "repo": "shinykitten/hello_panel", "path": "/src/panel_controller.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub enum PanelTransition { ShareScreen, SnapToScreenEdge, } pub struct PanelGraphEdge { from: String, // Asset path name. to: String, transition: PanelTransition, } pub struct PanelGraph { }<|fim_prefix|>// repo: shinykitten/hello_panel path: /src/panel_controller.rs use image::RgbaIm...
code_fim
hard
{ "lang": "rust", "repo": "shinykitten/hello_panel", "path": "/src/panel_controller.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct PanelGraphEdge { from: String, // Asset path name. to: String, transition: PanelTransition, } pub struct PanelGraph { }<|fim_prefix|>// repo: shinykitten/hello_panel path: /src/panel_controller.rs use image::RgbaImage; pub struct PanelCache { panel_width: usize, // Needed ...
code_fim
hard
{ "lang": "rust", "repo": "shinykitten/hello_panel", "path": "/src/panel_controller.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ctx.push_error({ let message: &str = &format!( "The {}index definition refers to the unknown fields: {}.", if index_data.is_unique() { "unique " } else { "" }, fields.join(", "), ...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/psl/parser-database/src/attributes.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prisma/prisma-engines path: /psl/parser-database/src/attributes.rs id].relation_attribute = Some(ctx.current_attribute_id()); if let Some(fields) = ctx.visit_optional_arg("fields") { let fields = match resolve_field_array_without_args(fields, attr.span, model_id, ctx) { ...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/psl/parser-database/src/attributes.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> matches!(self, Self::FollowComposites) } } /// Takes an attribute argument, validates it as an array of fields with potentially args, /// then resolves the constant literal as field names on the model. The error variant /// contains the fields that are not in the model. fn resolve_field_arra...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/psl/parser-database/src/attributes.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: luminalang/lumina path: /lumina-compiler/src/checker.old/mod.rs use super::*; mod error; pub use error::{Error, ErrorCompiler}; mod type_check; pub use type_check::TypeCheck; pub mod patterns; use hir::function::Identifier; use lumina_parser::ast::Inlinable; use lumina_typesystem::{Direct, Ge...
code_fim
hard
{ "lang": "rust", "repo": "luminalang/lumina", "path": "/lumina-compiler/src/checker.old/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match &traittype.inner { // static type hir::TraitType::True(exp) => self.type_check( &mut genbuffer, Tr::tr(traittype.span.clone(), exp), Tr::tr(p.span.clone(), &expr.meta), ...
code_fim
hard
{ "lang": "rust", "repo": "luminalang/lumina", "path": "/lumina-compiler/src/checker.old/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: beltegeuse/genetic-drawing-rust path: /src/lib.rs h self { ImageAlpha::Gray(v) => v.height(), ImageAlpha::Color(v) => v.height(), } } } /// Helper function to transform Vec floats to GrayScale image (image crate) fn vec_f32_to_image(values: &Vec<f32>, width: ...
code_fim
hard
{ "lang": "rust", "repo": "beltegeuse/genetic-drawing-rust", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Main entry point to update the strokes /// Each strokes are updated iteratively. /// The number of iteration is a sensitive parameter as it balance quality /// of the optimization and compute time. pub fn iterate(&mut self, number_iter: usize, rng: &mut rand::rngs::ThreadRng) { ...
code_fim
hard
{ "lang": "rust", "repo": "beltegeuse/genetic-drawing-rust", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: beltegeuse/genetic-drawing-rust path: /src/lib.rs it again and again inside the for loop match (&self, img) { (Image::Gray(_), ImageAlpha::Gray(_)) => {} (Image::Color(_), ImageAlpha::Color(_)) => {} _ => panic!("Incompatible type to splat"), ...
code_fim
hard
{ "lang": "rust", "repo": "beltegeuse/genetic-drawing-rust", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut sp = Sphere::new(); sp.transform = Matrix::scale(2.0, 2.0, 2.0); let s = Object::Sphere(sp); let pa = StripedPattern::default(); let p = Point { x: 1.5, y: 0.0, z: 0.0 }; assert_eq!(pa.color_at_object(&s, p), Color { r: 1.0, g: 1.0, b: 1.0 }); } #[test] fn stripes...
code_fim
hard
{ "lang": "rust", "repo": "fredrikln/the-raytracer-challenge", "path": "/src/pattern.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fredrikln/the-raytracer-challenge path: /src/pattern.rs use crate::point::Point; use crate::matrix::Matrix; use crate::canvas::Color; use crate::object::{Object,Intersectable}; pub trait PatternTrait { fn color_at(&self, p: Point) -> Color; fn color_at_object(&self, o: &Object, p: Point) ->...
code_fim
hard
{ "lang": "rust", "repo": "fredrikln/the-raytracer-challenge", "path": "/src/pattern.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hashmismatch/multiwii_serial_protocol.rs path: /src/commands.rs #[derive(PrimitiveEnum_u8)] #[derive(Debug, Copy, Clone, PartialEq)] #[allow(non_camel_case_types)] /// MSP command values, used for command encapsulation pub enum MspCommandCode { MSP_API_VERSION = 1, MSP_FC_VAR...
code_fim
hard
{ "lang": "rust", "repo": "hashmismatch/multiwii_serial_protocol.rs", "path": "/src/commands.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> MSP_SERVO_MIX_RULES = 241, MSP_SET_SERVO_MIX_RULE = 242, MSP_EEPROM_WRITE = 250, MSP_DEBUGMSG = 253, MSP_DEBUG = 254, MSP_BF_CONFIG = 66, // Additional baseflight commands that are not compatible with MultiWii MSP_UID = ...
code_fim
hard
{ "lang": "rust", "repo": "hashmismatch/multiwii_serial_protocol.rs", "path": "/src/commands.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// exports pub use self::error::XmlSecError; pub use self::error::XmlSecResult; pub use self::keys::XmlSecKey; pub use self::keys::XmlSecKeyFormat; pub use self::xmldsig::XmlSecSignatureContext; pub use self::xmlsec::{enable_tty_error_output, XmlSecContext};<|fim_prefix|>// repo: samueltardieu/samael pat...
code_fim
hard
{ "lang": "rust", "repo": "samueltardieu/samael", "path": "/src/xmlsec/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: samueltardieu/samael path: /src/xmlsec/mod.rs // // Source of xmlsec adapted from a separate project: https://github.com/voipir/rust-xmlsec // MIT Licence (Voipir Group): https://github.com/voipir/rust-xmlsec/blob/master/LICENSE //! //! Bindings for XmlSec1 //! //! Modules reflect the header na...
code_fim
medium
{ "lang": "rust", "repo": "samueltardieu/samael", "path": "/src/xmlsec/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>const OT_STRING: u32 = 0x08000010; named!( parse_object<String>, do_parse!( s: switch!(le_u32, OT_STRING => call!(parse_string_object)) >> (s) ) ); named!( parse_string_object<String>, do_parse!( length: le_u64 >> value: take!(length) >> (std::str:...
code_fim
hard
{ "lang": "rust", "repo": "rlipscombe/sqdis", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rlipscombe/sqdis path: /src/main.rs #[macro_use] extern crate nom; use nom::{le_u32, le_u64, le_u8}; use std::fs; named!( parse_bytecode_stream<Closure>, do_parse!(tag!([0xfa, 0xfa]) >> closure: parse_closure_stream >> (closure)) ); #[derive(Debug)] struct Closure { fun: FunctionP...
code_fim
hard
{ "lang": "rust", "repo": "rlipscombe/sqdis", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn test_mul() { let mut rng = thread_rng(); for _ in 0..10 { let a = Fr::random(&mut rng); let b = Fr::random(&mut rng); let mut c = a.clone(); c.mul_assign(&b); assert_eq!(call_kernel!("test_mul_32", GpuFr(a), Gpu...
code_fim
hard
{ "lang": "rust", "repo": "HorizenOfficial/ginger-algebra-ocl", "path": "/ff-cl-gen/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: HorizenOfficial/ginger-algebra-ocl path: /ff-cl-gen/src/lib.rs mod nvidia; mod utils; use ff::PrimeField; use itertools::*; use num_bigint::BigUint; static COMMON_SRC: &str = include_str!("cl/common.cl"); static FIELD_SRC: &str = include_str!("cl/field.cl"); pub trait Limb: Sized + Clone + Co...
code_fim
hard
{ "lang": "rust", "repo": "HorizenOfficial/ginger-algebra-ocl", "path": "/ff-cl-gen/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Krishnacore/move-tools path: /dove/src/cli.rs extern crate structopt; use std::env; use anyhow::Result; use structopt::StructOpt; use crate::cmd::build::Build; use crate::cmd::clean::Clean; use crate::cmd::tx::CreateTransactionCmd; use crate::cmd::fetch::Fetch; use crate::cmd::init::Init; use...
code_fim
hard
{ "lang": "rust", "repo": "Krishnacore/move-tools", "path": "/dove/src/cli.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn create_long_version() -> &'static str { let dove: String = [DOVE_VERSION, DOVE_HASH] .iter() .filter(|str| !str.is_empty()) .map(|str| str.to_string()) .collect::<Vec<String>>() .join("-"); let diem: String = [DIEM_VERSION, DIEM_HASH] .iter() ...
code_fim
hard
{ "lang": "rust", "repo": "Krishnacore/move-tools", "path": "/dove/src/cli.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let dove: String = [DOVE_VERSION, DOVE_HASH] .iter() .filter(|str| !str.is_empty()) .map(|str| str.to_string()) .collect::<Vec<String>>() .join("-"); let diem: String = [DIEM_VERSION, DIEM_HASH] .iter() .filter(|str| !str.is_empty()) ...
code_fim
hard
{ "lang": "rust", "repo": "Krishnacore/move-tools", "path": "/dove/src/cli.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TorstenCScholz/slackbot-rs path: /src/command.rs use diesel::sqlite::{SqliteConnection}; use slack::{RtmClient, User}; use std::cmp::{PartialEq, Eq}; use std::hash::{Hash, Hasher}; pub struct Command<'a> { name: &'a str, callback: Box<Fn(&mut Context, Vec<&str>) -> bool>, } impl <'a>...
code_fim
hard
{ "lang": "rust", "repo": "TorstenCScholz/slackbot-rs", "path": "/src/command.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.name.hash(state) } } pub struct Context<'a> { pub db_conn: &'a SqliteConnection, pub cli: &'a RtmClient, pub channel: &'a Option<String>, pub user: &'a Option<User> } impl <'a> Context<'a> { pub fn new(db_conn: &'a SqliteConnection, cli: &'a RtmClient, channel: &'a O...
code_fim
hard
{ "lang": "rust", "repo": "TorstenCScholz/slackbot-rs", "path": "/src/command.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Clone)] struct X; impl ::std::marker()::Copy for X {} //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/issues/issue-32995-2.rs #![allow(unused)] fn main() { { f...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/issues/issue-32995-2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: IThawk/rust-project path: /rust-master/src/test/ui/issues/issue-32995-2.rs #![allow(unused)] fn main() { { fn f<X: ::std::marker()::Send>() {} } //~^ ERROR parenthesized type parameters may only be used with a `Fn` trait //~| WARN previously accepted <|fim_suffix|>#[derive(Clone)] ...
code_fim
medium
{ "lang": "rust", "repo": "IThawk/rust-project", "path": "/rust-master/src/test/ui/issues/issue-32995-2.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[async_trait] impl Service for DatabaseService { async fn create_user(&self, user: CreateUser) -> Result<User, Error> { Ok(diesel::insert_into(schema::users::table) .values(&user) .get_result(&self.connection().await?)?) } async fn list_users(&self) -> Result<...
code_fim
hard
{ "lang": "rust", "repo": "gribbet/rust-tide-test", "path": "/src/database.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: gribbet/rust-tide-test path: /src/database.rs use crate::{ error::Error, model::{CreateUser, User}, schema, schema::users::dsl::users, service::Service, }; use async_trait::async_trait; use diesel::prelude::*; use mobc::Pool; use mobc_diesel::ConnectionManager; #[derive(Clon...
code_fim
hard
{ "lang": "rust", "repo": "gribbet/rust-tide-test", "path": "/src/database.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// (temporary) Set texture wrapping mode along Y direction. /// /// **Arguments** /// /// * `wrap` - New wrapping mode (one of `TextureWrap::*`). pub fn set_wrap_y(&self,wrap: TextureWrap) { unsafe { gl::BindTexture(gl::TEXTURE_2D,self.core.tex); } match wrap { ...
code_fim
hard
{ "lang": "rust", "repo": "des256/classic-e", "path": "/src/gpu/opengl45/texture2d.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: des256/classic-e path: /src/gpu/opengl45/texture2d.rs // E - OpenGL - Texture2D // Desmond Germans, 2020 use crate::*; use std::{ ffi::c_void, marker::PhantomData, rc::Rc, }; use gl::types::GLuint; #[doc(hidden)] pub struct CoreTexture2D<T: GPUTextureFormat> { _graphics: Rc<Gra...
code_fim
hard
{ "lang": "rust", "repo": "des256/classic-e", "path": "/src/gpu/opengl45/texture2d.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// (temporary) Set texture wrapping mode along X direction. /// /// **Arguments** /// /// * `wrap` - New wrapping mode (one of `TextureWrap::*`). pub fn set_wrap_x(&self,wrap: TextureWrap) { unsafe { gl::BindTexture(gl::TEXTURE_2D,self.core.tex); } match wrap { ...
code_fim
hard
{ "lang": "rust", "repo": "des256/classic-e", "path": "/src/gpu/opengl45/texture2d.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>RCD_USER_MODES: &str = "oOx"; pub static IRCD_CHANNEL_MODES: &str = "qaohvmiklnst";<|fim_prefix|>// repo: diath/ayame path: /src/ayame.rs pub static IRCD_NAME: &str = "ayame"; pub static IRCD_VERSION: &str = "0.1.0"; pub static IRCD_REPOSITORY: &str = "https://github.com/diath/ayame"; pub static IRCD_C<|...
code_fim
medium
{ "lang": "rust", "repo": "diath/ayame", "path": "/src/ayame.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>ONFIG: &str = "config.toml"; pub static IRCD_MOTD: &str = "motd.txt"; pub static IRCD_USER_MODES: &str = "oOx"; pub static IRCD_CHANNEL_MODES: &str = "qaohvmiklnst";<|fim_prefix|>// repo: diath/ayame path: /src/ayame.rs pub static IRCD_NAME: &str = "ayame"; pub static IRCD_VERSION: &str = "0.1.0"; pub<|f...
code_fim
medium
{ "lang": "rust", "repo": "diath/ayame", "path": "/src/ayame.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: diath/ayame path: /src/ayame.rs pub static IRCD_NAME: &str = "ayame"; pub static IRCD_VERSION: &str = "0.1.0"; pub<|fim_suffix|>ONFIG: &str = "config.toml"; pub static IRCD_MOTD: &str = "motd.txt"; pub static IRCD_USER_MODES: &str = "oOx"; pub static IRCD_CHANNEL_MODES: &str = "qaohvmiklnst";<|f...
code_fim
medium
{ "lang": "rust", "repo": "diath/ayame", "path": "/src/ayame.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: NickeZ/rsmsi path: /src/lexer.rs use std::str::CharIndices; pub type Spanned<Tok, Loc, Error> = Result<(Loc, Tok, Loc), Error>; const SPECIAL_CHARS: &str = "\n\"=, \t${}()\\"; const KEYWORDS: &[&str] = &["include", "substitute", "${", "$("]; #[derive(Debug, PartialEq)] pub enum Tok<'input> { ...
code_fim
hard
{ "lang": "rust", "repo": "NickeZ/rsmsi", "path": "/src/lexer.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_lexer() { //let stim = "my test $(hej) ${hej} ${he${hej}} $ test $test include inc substitute s"; //let lex = Lexer::new(stim); //println!("{}", stim); //for l in lex { // println!("{:?} ", l); //} let stim = "include \"file.tmp\""; let mut lex = Lexer::n...
code_fim
hard
{ "lang": "rust", "repo": "NickeZ/rsmsi", "path": "/src/lexer.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nymtech/nym path: /common/socks5-client-core/src/socks/request.rs use crate::socks::SOCKS4_VERSION; use super::types::{AddrType, ResponseCodeV5, SocksProxyError}; use super::{utils as socks_utils, SOCKS5_VERSION}; use log::*; use std::fmt::{self, Display}; use tokio::io::{AsyncRead, AsyncReadEx...
code_fim
hard
{ "lang": "rust", "repo": "nymtech/nym", "path": "/common/socks5-client-core/src/socks/request.rs", "mode": "psm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|> write!(f, "{}", self.address_string()) } } /// SOCK5 CMD type #[derive(Debug)] pub(crate) enum SocksCommand { Connect = 0x01, Bind = 0x02, UdpAssociate = 0x3, } impl SocksCommand { /// Parse bytes to SocksCommand fn from(n: usize) -> Option<SocksCommand> { match n...
code_fim
hard
{ "lang": "rust", "repo": "nymtech/nym", "path": "/common/socks5-client-core/src/socks/request.rs", "mode": "spm", "license": "CC0-1.0", "source": "the-stack-v2" }
<|fim_suffix|>od that returns an 'Option'. as long at the Option is not 'None' we can call next.<|fim_prefix|>// repo: thodges314/Rust path: /a_gentle_intro_to_rust/iter1/src/main.rs fn main() { let mut iter = 0..3; // defined directly assert_eq!(iter.next(<|fim_middle|>), Some(0)); assert_eq!(iter.next()...
code_fim
medium
{ "lang": "rust", "repo": "thodges314/Rust", "path": "/a_gentle_intro_to_rust/iter1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thodges314/Rust path: /a_gentle_intro_to_rust/iter1/src/main.rs fn main() { let mut iter = 0..3; // defined directly assert_eq!(iter.next(), Some(0)); assert_eq!(iter.next(), Some(1)); assert_eq!(iter.next(), Some<|fim_suffix|>od that returns an 'Option'. as long at the Option i...
code_fim
medium
{ "lang": "rust", "repo": "thodges314/Rust", "path": "/a_gentle_intro_to_rust/iter1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sternho/restaurant path: /restaurant/src/service/order_service.rs extern crate chrono; use chrono::Local; use crate::order::Order; use crate::{order_redis, table_redis}; use crate::table::Table; use crate::table_service::TableService; use self::chrono::{DateTime, Duration}; /// This is servi...
code_fim
hard
{ "lang": "rust", "repo": "sternho/restaurant", "path": "/restaurant/src/service/order_service.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// Checking the order can be create or not /// /// Examples: /// let checking = is_able_create_order(table, vec![String::from('new_item_id')]); pub fn is_able_create_order(table: Table, orders: Vec<String>) -> bool { return !TableService::is_too_much_order(table.clone(), order...
code_fim
hard
{ "lang": "rust", "repo": "sternho/restaurant", "path": "/restaurant/src/service/order_service.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /* * function for handle redis/database */ /// Save the order in both table list and order map in redis /// /// Examples: /// save_order(orders); pub fn save_order(orders: Vec<Order>) { for order in orders.clone() { table_redis::add_order(order.table_...
code_fim
hard
{ "lang": "rust", "repo": "sternho/restaurant", "path": "/restaurant/src/service/order_service.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: realrunner/adventofcode2016 path: /src/bin/day1.rs use std::fmt; use std::collections::HashSet; #[derive(Copy, Clone, PartialEq, Debug, Eq, Hash)] struct Vector2 { x: i32, y: i32 } impl fmt::Display for Vector2 { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!...
code_fim
medium
{ "lang": "rust", "repo": "realrunner/adventofcode2016", "path": "/src/bin/day1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> for _ in 0..moves { position = Vector2 { x: position.x + directions[direction].x, y: position.y + directions[direction].y, }; if first_intersection.is_none() && history.contains(&position) { first_intersection = So...
code_fim
hard
{ "lang": "rust", "repo": "realrunner/adventofcode2016", "path": "/src/bin/day1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: comit-network/create-comit-app path: /scripts/src/print_progress.rs #[macro_export] macro_rules! print_progress { ($($arg:tt)*) => ({ use std::io::Write; print!($<|fim_suffix|>).flush().ok().expect("Could not flush stdout"); }) }<|fim_middle|>($arg)*); print!("......
code_fim
easy
{ "lang": "rust", "repo": "comit-network/create-comit-app", "path": "/scripts/src/print_progress.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>($arg)*); print!("..."); std::io::stdout().flush().ok().expect("Could not flush stdout"); }) }<|fim_prefix|>// repo: comit-network/create-comit-app path: /scripts/src/print_progress.rs #[macro_export] macro_rules! print_progress { ($($arg<|fim_middle|>:tt)*) => ({ use std:...
code_fim
easy
{ "lang": "rust", "repo": "comit-network/create-comit-app", "path": "/scripts/src/print_progress.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: biaoma-ty/arrow-datafusion path: /datafusion/sql/src/expr/mod.rs ogical_expr(*right, schema, planner_context)?), ))), SQLExpr::IsTrue(expr) => Ok(Expr::IsTrue(Box::new(self.sql_expr_to_logical_expr(*expr, schema, planner_context)?))), SQLExpr::IsFalse(expr) ...
code_fim
hard
{ "lang": "rust", "repo": "biaoma-ty/arrow-datafusion", "path": "/datafusion/sql/src/expr/mod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> &self, array_agg: ArrayAgg, input_schema: &DFSchema, planner_context: &mut PlannerContext, ) -> Result<Expr> { // Some dialects have special syntax for array_agg. DataFusion only supports it like a function. let ArrayAgg { distinct, ...
code_fim
hard
{ "lang": "rust", "repo": "biaoma-ty/arrow-datafusion", "path": "/datafusion/sql/src/expr/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let order_by = if let Some(order_by) = order_by { Some(self.order_by_to_sort_expr(&order_by, input_schema, planner_context)?) } else { None }; if let Some(limit) = limit { return Err(DataFusionError::NotImplemented(format!( ...
code_fim
hard
{ "lang": "rust", "repo": "biaoma-ty/arrow-datafusion", "path": "/datafusion/sql/src/expr/mod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: acrrd/todo-backend-rs path: /src/bin/main.rs use actix_cors::Cors; use actix_web::{http::header, http::Method, middleware::Logger, App, HttpServer}; use todo_backend_rs::todo_endpoints; fn main() -> std::io::Result<()> { <|fim_suffix|> HttpServer::new(move || { App::new() ...
code_fim
hard
{ "lang": "rust", "repo": "acrrd/todo-backend-rs", "path": "/src/bin/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> HttpServer::new(move || { App::new() .data(todo_data.clone()) .wrap( Cors::new() .send_wildcard() .allowed_methods(vec![ Method::GET, Method::PATCH, ...
code_fim
hard
{ "lang": "rust", "repo": "acrrd/todo-backend-rs", "path": "/src/bin/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match serde_json::from_reader::<_, ErrorBody>(response) { Ok(error_body) => Self::StatusCodeError(StatusCodeError { status_code, request_id, error_message: error_body.error, }), Err(error) => Self::JsonDecodeError(...
code_fim
hard
{ "lang": "rust", "repo": "qiniu/rust-upload-sdk", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub(super) fn json_decode_response<T: DeserializeOwned>( response: Response, ) -> HttpCallResult<(T, Option<HeaderValue>)> { let status_code = response.status(); let request_id = response .headers() .get(HeaderName::from_static(X_REQ_ID)) .cloned(); match serde_json...
code_fim
hard
{ "lang": "rust", "repo": "qiniu/rust-upload-sdk", "path": "/src/error.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: qiniu/rust-upload-sdk path: /src/error.rs use reqwest::{ blocking::Response, header::{HeaderName, HeaderValue}, Error as ReqwestError, StatusCode, }; use serde::{de::DeserializeOwned, Deserialize}; use serde_json::Error as JSONError; use std::{error::Error, fmt, io::Error as IOError}...
code_fim
hard
{ "lang": "rust", "repo": "qiniu/rust-upload-sdk", "path": "/src/error.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Azure/iot-identity-service path: /pkcs11/pkcs11/src/session.rs pkcs11_sys::CK_ATTRIBUTE_IN { r#type: pkcs11_sys::CKA_SENSITIVE, pValue: r#true, ulValueLen: true_size, }, pkcs11_sys::CK_ATTRIBUTE_IN {...
code_fim
hard
{ "lang": "rust", "repo": "Azure/iot-identity-service", "path": "/pkcs11/pkcs11/src/session.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match self.get_key_inner(pkcs11_sys::CKO_SECRET_KEY, Some(label)) { Ok(key_handle) => { let result = (self.context.C_DestroyObject)(self.handle, key_handle); if result != pkcs11_sys::CKR_OK { return Err(DeleteKeyEr...
code_fim
hard
{ "lang": "rust", "repo": "Azure/iot-identity-service", "path": "/pkcs11/pkcs11/src/session.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Azure/iot-identity-service path: /pkcs11/pkcs11/src/session.rs &mut num_objects, ); if result != pkcs11_sys::CKR_OK { return Some(Err(FindObjectsError::FindObjectsFailed( format!("C_FindObjects failed with {}", result).into(), ...
code_fim
hard
{ "lang": "rust", "repo": "Azure/iot-identity-service", "path": "/pkcs11/pkcs11/src/session.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub use self::constraints as SelectedConstraints; pub use self::global::SelectedPlan;<|fim_prefix|>// repo: zhuguangxiang/mmtk-core path: /src/plan/nogc/mod.rs pub mod constraints; mod global; mod mutator; <|fim_middle|>pub use self::global::NoGC;
code_fim
easy
{ "lang": "rust", "repo": "zhuguangxiang/mmtk-core", "path": "/src/plan/nogc/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zhuguangxiang/mmtk-core path: /src/plan/nogc/mod.rs pub mod constraints; mod global; mod mutator; <|fim_suffix|>pub use self::constraints as SelectedConstraints; pub use self::global::SelectedPlan;<|fim_middle|>pub use self::global::NoGC;
code_fim
easy
{ "lang": "rust", "repo": "zhuguangxiang/mmtk-core", "path": "/src/plan/nogc/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Auth { pub fn client(&self) -> Client { match self { &Auth::CertAuth { ref cacert, ref cert, ref key } => { let conn = ssl_connector(Path::new(cacert), Some(Path::new(cert)), Some...
code_fim
hard
{ "lang": "rust", "repo": "adreyer/puppetdb-cli", "path": "/src/net.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adreyer/puppetdb-cli path: /src/net.rs use std::io::Write; use std::path::Path; use openssl::ssl::{SslContext, Ssl, SslMethod, SslStream, SSL_VERIFY_PEER}; use openssl::ssl::error::SslError; use openssl::x509::X509FileType; use openssl_verify; use hyper; use hyper::net::{HttpsConnector, Fresh...
code_fim
hard
{ "lang": "rust", "repo": "adreyer/puppetdb-cli", "path": "/src/net.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn request(&self, method: Method, url: Url) -> Request<Fresh> { match self { &Auth::CertAuth { ref cacert, ref cert, ref key } => { let conn = ssl_connector(Path::new(cacert), Some(Path::new(cert)), ...
code_fim
hard
{ "lang": "rust", "repo": "adreyer/puppetdb-cli", "path": "/src/net.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let mut result1_binary = false; let mut result2_binary = false; let mut result1_undefined = false; let mut result2_undefined = false; let mut result1_unres_expr = Expression::Empty(true); let mut result2_unres_expr = Expression::Empty(true); match result1 { ResolveRes...
code_fim
hard
{ "lang": "rust", "repo": "stranger80/golem-market-api", "path": "/src/resolver/matching.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stranger80/golem-market-api path: /src/resolver/matching.rs use super::errors::MatchError; use super::expression::{Expression, ResolveResult}; use super::prepare::{PreparedDemand, PreparedOffer}; use super::properties::PropertyRef; // Matching relation result enum #[derive(Debug, Clone, Partial...
code_fim
hard
{ "lang": "rust", "repo": "stranger80/golem-market-api", "path": "/src/resolver/matching.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match result1 { ResolveResult::True => { result1_binary = true; } ResolveResult::False(mut un_props, unresolved_expr) => { result1_binary = false; un_props1.append(&mut un_props); result1_unres_expr = unresolved_expr; } ...
code_fim
hard
{ "lang": "rust", "repo": "stranger80/golem-market-api", "path": "/src/resolver/matching.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Reset values for each field in ADC2 pub const reset: ResetValues = ResetValues { ADC_ISR: 0x00000000, ADC_IER: 0x00000000, ADC_CR: 0x20000000, ADC_CFGR: 0x80000000, ADC_CFGR2: 0x00000000, ADC_SMPR1: 0x00000000, ADC_SMPR2: 0x00000000, ...
code_fim
hard
{ "lang": "rust", "repo": "adamgreig/stm32ral", "path": "/src/stm32mp/instances/adc2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: adamgreig/stm32ral path: /src/stm32mp/instances/adc2.rs #![allow(non_snake_case, non_upper_case_globals)] #![allow(non_camel_case_types)] //! ADC2 //! //! Used by: stm32mp153, stm32mp157 #[cfg(not(feature = "nosync"))] pub use crate::stm32mp::peripherals::adc2::Instance; pub use crate::stm32mp:...
code_fim
hard
{ "lang": "rust", "repo": "adamgreig/stm32ral", "path": "/src/stm32mp/instances/adc2.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Unsafely steal ADC2 /// /// This function is similar to take() but forcibly takes the /// Instance, marking it as taken irregardless of its previous /// state. #[cfg(not(feature = "nosync"))] #[inline] pub unsafe fn steal() -> Instance { ADC2_TAKEN = true; ...
code_fim
hard
{ "lang": "rust", "repo": "adamgreig/stm32ral", "path": "/src/stm32mp/instances/adc2.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> println!("Population StdDev: {}\nSample StdDev: {}", measures_of_variation.0, measures_of_variation.1); println!("Mean: {}\nMedian: {}\nMode: {}", central_tendencies.0, central_tendencies.1, central_tendencies.2); println!("Quartiles: 1st = {}, 2nd = {}, 3rd = {}, IQR = {}", quartiles.0, quart...
code_fim
hard
{ "lang": "rust", "repo": "chungmcl/statscalc", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }