text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> // proto: void QLocalServer::setMaxPendingConnections(int numConnections); impl /*struct*/ QLocalServer { pub fn setMaxPendingConnections<RetType, T: QLocalServer_setMaxPendingConnections<RetType>>(& self, overload_args: T) -> RetType { return overload_args.setMaxPendingConnections(self); //...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/network/qlocalserver.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kitech/qt.rs path: /src/network/qlocalserver.rs ); fn _ZN12QLocalServer6listenERK7QString(qthis: u64 /* *mut c_void*/, arg0: *mut c_void) -> c_char; // proto: bool QLocalServer::listen(qintptr socketDescriptor); fn _ZN12QLocalServer6listenEi(qthis: u64 /* *mut c_void*/, arg0: c_int) -> c_...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/network/qlocalserver.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub trait QLocalServer_errorString<RetType> { fn errorString(self , rsthis: & QLocalServer) -> RetType; } // proto: QString QLocalServer::errorString(); impl<'a> /*trait*/ QLocalServer_errorString<QString> for () { fn errorString(self , rsthis: & QLocalServer) -> QString { // let qthis: *mut c...
code_fim
hard
{ "lang": "rust", "repo": "kitech/qt.rs", "path": "/src/network/qlocalserver.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut rules = vec![]; rules.push(wrapper(gl.n_columns)); for e in gl.elements.iter() { rules.push(element(e)); } js! { // Get style sheet named "tdv_style" var sheets = document.styleSheets; console.log(sheets); for (var i = 0; i < sheets.le...
code_fim
hard
{ "lang": "rust", "repo": "taku-y/learn-web-rust", "path": "/workspace/tdv_ui/src/grid.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let gr = if e.row_max == 0 { format!("{}", e.row) } else { format!("{} / {}", e.row, e.row_max + 1) }; let gc = if e.col_max == 0 { format!("{}", e.col) } else { format!("{} / {}", e.col, e.col_max + 1) }; format!("#{} {{ grid-row: {}; grid-col...
code_fim
hard
{ "lang": "rust", "repo": "taku-y/learn-web-rust", "path": "/workspace/tdv_ui/src/grid.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: taku-y/learn-web-rust path: /workspace/tdv_ui/src/grid.rs use tdv_msg::{GridLayout, GridElement}; fn remove_all_grids() { js! { var plot_area = document.getElementById("tdv_plot_area"); while (plot_area.firstChild) { plot_area.removeChild(plot_area.firstChild); ...
code_fim
hard
{ "lang": "rust", "repo": "taku-y/learn-web-rust", "path": "/workspace/tdv_ui/src/grid.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Logicalshift/flowbetween path: /animation/src/serializer/target.rs use flo_float_encoder::*; use std::time::{Duration}; /// /// Character encoding for a 6-bit value /// pub (super) const ENCODING_CHAR_SET: [char; 64] = [ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N',...
code_fim
hard
{ "lang": "rust", "repo": "Logicalshift/flowbetween", "path": "/animation/src/serializer/target.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> #[test] fn encode_small_usize() { let mut res = String::new(); res.write_usize(5); assert!(&res == "F"); } #[test] fn encode_small_u64() { let mut res = String::new(); res.write_small_u64(5); assert!(&res == "F"); } #[test] ...
code_fim
hard
{ "lang": "rust", "repo": "Logicalshift/flowbetween", "path": "/animation/src/serializer/target.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let params = lsp_types::CodeActionParams { text_document: lsp_types::TextDocumentIdentifier { uri: "file:/path/to/schema.prisma".parse().unwrap(), }, range: lsp_types::Range::default(), context: lsp_types::CodeActionContext::default(), work_done_prog...
code_fim
medium
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/prisma-fmt/tests/regressions/language_tools_1473.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: prisma/prisma-engines path: /prisma-fmt/tests/regressions/language_tools_1473.rs #[test] fn code_actions_should_not_crash_on_validation_errors_with_multi_schema() { let schema = r#" generator client { provider = "prisma-client-js" previewFeatures = ["multiS...
code_fim
hard
{ "lang": "rust", "repo": "prisma/prisma-engines", "path": "/prisma-fmt/tests/regressions/language_tools_1473.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn compress(&self, context: &mut SendStreamUpgradeContext) -> anyhow::Result<Self> { context.trace_stats(); let source_version = self.sc_version; let destination_version = context.get_destination_version()?; info!(context.ssuc_logger, "Compressing Command={}", self)...
code_fim
hard
{ "lang": "rust", "repo": "facebookincubator/antlir", "path": "/antlir/btrfs_send_stream_upgrade/src/send_elements/send_command.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // Set the new command to dirty -- we haven't copied over the data // payload to the command buffer let command = SendCommand { sc_header: header, sc_buffer: buffer, sc_data_attribute: Some(data_attribute), sc_data_attribute_initial_s...
code_fim
hard
{ "lang": "rust", "repo": "facebookincubator/antlir", "path": "/antlir/btrfs_send_stream_upgrade/src/send_elements/send_command.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: facebookincubator/antlir path: /antlir/btrfs_send_stream_upgrade/src/send_elements/send_command.rs // Generate the command from the header Self::new_from_header(context, header) } pub fn new_from_header( context: &mut SendStreamUpgradeContext, header: Send...
code_fim
hard
{ "lang": "rust", "repo": "facebookincubator/antlir", "path": "/antlir/btrfs_send_stream_upgrade/src/send_elements/send_command.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: irauta/regl-app path: /src/graphics.rs use ::cgmath::{Matrix4,Vector3,Point3,Basis3,Rotation3,Rotation,Rad}; use regl::{Context,Shader,ShaderSource,ShaderType,Program, VertexArray,Buffer,BufferTarget,BufferUsage,RenderOption, VertexAttribute,VertexAttributeType,PrimitiveMode,IndexType,U...
code_fim
hard
{ "lang": "rust", "repo": "irauta/regl-app", "path": "/src/graphics.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let scaled_distance = DISTANCE_MULTIPLIER * self.camera_distance; let yaw = self.camera_orientation.0 * YAW_MULTIPLIER; let pitch = self.camera_orientation.1 * PITCH_MULTIPLIER; let basis = Basis3::from_euler(rad(pitch), rad(yaw), rad(0.0)); let eye_vec = basis.rot...
code_fim
hard
{ "lang": "rust", "repo": "irauta/regl-app", "path": "/src/graphics.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn worldview(&self) -> Matrix4<f32> { let scaled_distance = DISTANCE_MULTIPLIER * self.camera_distance; let yaw = self.camera_orientation.0 * YAW_MULTIPLIER; let pitch = self.camera_orientation.1 * PITCH_MULTIPLIER; let basis = Basis3::from_euler(rad(pitch), rad(yaw), ...
code_fim
hard
{ "lang": "rust", "repo": "irauta/regl-app", "path": "/src/graphics.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DavidWittman/cryptopals-rust path: /src/set1/ch7.rs /* AES in ECB mode The Base64-encoded content in [this file](./testdata/7.txt) has been encrypted via AES-128 in ECB mode under the key "YELLOW SUBMARINE". (case-sensitive, without the quotes; exactly 16 characters; I like "YELLOW ...
code_fim
hard
{ "lang": "rust", "repo": "DavidWittman/cryptopals-rust", "path": "/src/set1/ch7.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>Decrypt it. You know the key, after all. Easiest way: use OpenSSL::Cipher and give it AES-128-ECB as the cipher. Do this with code. You can obviously decrypt this using the OpenSSL command-line tool, but we're having you get ECB working in code for a reason. You'll need it a lot later on, and not ...
code_fim
medium
{ "lang": "rust", "repo": "DavidWittman/cryptopals-rust", "path": "/src/set1/ch7.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cottonguard/rust-async-http path: /src/http.rs use crate::net::*; use crate::reactor; use crate::runner::{Runner, Spawner}; use futures::prelude::*; use log::*; use std::{collections::HashMap, future::Future, io, rc::Rc}; pub trait HttpApp { type Output: Future<Output = Response>; // TO...
code_fim
hard
{ "lang": "rust", "repo": "cottonguard/rust-async-http", "path": "/src/http.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a, T: HttpApp + 'a> HttpServerInner<'a, T> { async fn accept(self: Rc<Self>) { loop { match self.tcp.accept().await { Ok((sock, addr)) => { info!("accepted: {}", addr); let cloned = Rc::clone(&self); ...
code_fim
hard
{ "lang": "rust", "repo": "cottonguard/rust-async-http", "path": "/src/http.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn get_extents(locs: &Vec<Location>) -> Rect { let min_x = locs.iter().map(|l| l.x).min().unwrap(); let max_x = locs.iter().map(|l| l.x).max().unwrap(); let min_y = locs.iter().map(|l| l.y).min().unwrap(); let max_y = locs.iter().map(|l| l.y).max().unwrap(); Rect { x: min_x, ...
code_fim
hard
{ "lang": "rust", "repo": "bmitchelmore/rust-advent-2018", "path": "/d6p1/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bmitchelmore/rust-advent-2018 path: /d6p1/src/main.rs extern crate regex; use std::fs::File; use std::io::{BufRead,BufReader}; use regex::Regex; use std::collections::HashMap; #[derive(Copy, Clone, Debug, PartialEq, Eq, Hash)] struct Location { x: i32, y: i32 } #[derive(Copy, Clone, D...
code_fim
hard
{ "lang": "rust", "repo": "bmitchelmore/rust-advent-2018", "path": "/d6p1/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: StephanErb/pants path: /src/rust/engine/testutil/mock/src/lib.rs // Enable all clippy lints except for many of the pedantic ones. It's a shame this needs to be copied and pasted across crates, but there doesn't appear to be a way to include inner attributes from a common source. #![cfg_attr( f...
code_fim
hard
{ "lang": "rust", "repo": "StephanErb/pants", "path": "/src/rust/engine/testutil/mock/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ant_field_names) )] // Default isn't as big a deal as people seem to think it is. #![cfg_attr( feature = "cargo-clippy", allow(new_without_default, new_without_default_derive) )] // Arc<Mutex> can be more clear than needing to grok Orderings: #![cfg_attr(feature = "cargo-clippy", allow(mutex_atomic))]...
code_fim
hard
{ "lang": "rust", "repo": "StephanErb/pants", "path": "/src/rust/engine/testutil/mock/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: atonkyra/kagami path: /src/main.rs extern crate zmq; #[macro_use] extern crate serde_json; use std::vec::Vec; mod snmp_querier; fn main() { let ctx = zmq::Context::new(); let socket = ctx.socket(zmq::REP).unwrap(); if socket.bind("ipc:///tmp/kagami.ipc").is_err() { println...
code_fim
hard
{ "lang": "rust", "repo": "atonkyra/kagami", "path": "/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> "error": "missing or invalid address" }); } } else { resp = json!({ "status": "error", "error": "missing or invalid address"...
code_fim
hard
{ "lang": "rust", "repo": "atonkyra/kagami", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match snmp_querier::walk_oid(agent_addr, community_bytes, oid_slice) { Ok(v) => { resp = json!({ "status": "ok", "data": v ...
code_fim
hard
{ "lang": "rust", "repo": "atonkyra/kagami", "path": "/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: timothycobrien/slide path: /libslide/src/bignum/mul.rs #![allow(clippy::suspicious_arithmetic_impl)] use crate::bignum::utils::convert_poly; use crate::bignum::utils::fft; use crate::bignum::utils::ifft; use crate::bignum::utils::ispowerof2; use crate::bignum::utils::normalize_vecs; use crate::b...
code_fim
hard
{ "lang": "rust", "repo": "timothycobrien/slide", "path": "/libslide/src/bignum/mul.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> mod mul { bignum_test_mul! { int1: "99", "99", "9801" int2: "5", "5", "25" int3: "10", "10", "100" int4: "999", "999", "998001" int5: "9", "1", "9" int6: "9", "10", "90" int7: "25", "25", "625" int8...
code_fim
hard
{ "lang": "rust", "repo": "timothycobrien/slide", "path": "/libslide/src/bignum/mul.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>//GameData is the internal shared data between states impl SimpleState for GameplayState { fn on_start(&mut self, data: StateData<'_, GameData<'_, '_>>) { println!("Number of lifeforms: {}", self.lifeforms); let world = data.world; let sprite_sheet_handle = load_sprite_sheet(wo...
code_fim
hard
{ "lang": "rust", "repo": "tengrommel/amethyst_3d_game", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tengrommel/amethyst_3d_game path: /src/main.rs extern crate amethyst; use amethyst::{ assets::{AssetStorage, Loader, Handle}, core::transform::{ Transform, TransformBundle }, // Component is used to attach structs to entities in the game ecs::prelude::{Compone...
code_fim
hard
{ "lang": "rust", "repo": "tengrommel/amethyst_3d_game", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn initialise_lifeforms(world: &mut World, sprite_sheet: Handle<SpriteSheet>) { let mut transform = Transform::default(); // Correctly position the life form. let y = ARENA_HEIGHT / 2.0; transform.set_translation_xyz(LIFEFORM_WIDTH*0.5, y, 0.0); // Assign the sprites for the lifeform ...
code_fim
hard
{ "lang": "rust", "repo": "tengrommel/amethyst_3d_game", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let sample = include_bytes!("../sample-data/first-message.grib2"); let reader = Cursor::new(sample.to_vec()); let message = Message::new(reader); println!("{:#?}", &message); let json = &message.pretty_json()?; println!("As json: \n{}", json); let reference_date = &message.refe...
code_fim
medium
{ "lang": "rust", "repo": "justin1dennison/gribbrs", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: justin1dennison/gribbrs path: /src/main.rs use gribbrs::message::{Message, ToJson}; use std::io::Cursor; <|fim_suffix|> let sample = include_bytes!("../sample-data/first-message.grib2"); let reader = Cursor::new(sample.to_vec()); let message = Message::new(reader); println!("{:#?...
code_fim
medium
{ "lang": "rust", "repo": "justin1dennison/gribbrs", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bollo35/cryptopals path: /src/bin/p056.rs extern crate ooga; use ooga::base64; extern crate openssl; use openssl::symm::{encrypt, Cipher}; extern crate rand; use rand::Rng; use rand::distributions::{Uniform}; fn main() { let secret = base64::decode("QkUgU1VSRSBUTyBEUklOSyBZT1VSIE9WQUxUSU5F")...
code_fim
medium
{ "lang": "rust", "repo": "bollo35/cryptopals", "path": "/src/bin/p056.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // then use the biases to figure out the stuff // z16 = 240 // z32 = 224 // since we know the message length is 30, let's just push everything out to byte 32 let mut map = [0usize; 256]; // for each byte in the plaintext for index in 0..msg_len { // create dummy text to extend the byte out to the...
code_fim
medium
{ "lang": "rust", "repo": "bollo35/cryptopals", "path": "/src/bin/p056.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let code = &machine.registers()[ckb_vm::registers::A7]; if code.to_i32() != SYSCODE_RET { return Ok(false); } let addr = machine.registers()[ckb_vm::registers::A0].to_usize(); let size = machine.registers()[ckb_vm::registers::A1].to_usize(); let ...
code_fim
medium
{ "lang": "rust", "repo": "Atul9/cita-vm", "path": "/src/riscv/syscall/ret.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Atul9/cita-vm path: /src/riscv/syscall/ret.rs // Since ckb-vm can only return 0 or 1 as exit code, We must find another way to return string, u64... use std::cell::RefCell; use std::rc::Rc; use ckb_vm::instructions::Register; <|fim_suffix|>impl SyscallRet { pub fn new(data: Rc<RefCell<Vec<...
code_fim
medium
{ "lang": "rust", "repo": "Atul9/cita-vm", "path": "/src/riscv/syscall/ret.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Tolledo/database path: /entities/repr/src/lib.rs // Copyright 2020 - present Alex Dukhno // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apach...
code_fim
hard
{ "lang": "rust", "repo": "Tolledo/database", "path": "/entities/repr/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn from_u32(val: u32) -> Datum<'static> { Datum::from_i32(val as i32) } pub const fn from_i64(val: i64) -> Datum<'static> { Datum::Int64(val) } pub const fn from_u64(val: u64) -> Datum<'static> { Datum::from_i64(val as i64) } pub fn from_optional_...
code_fim
hard
{ "lang": "rust", "repo": "Tolledo/database", "path": "/entities/repr/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nikomatsakis/rust path: /src/test/bench/task-perf-word-count-generic.rs // xfail-test - #1038 - Can't do this safely with bare functions /** A parallel word-frequency counting program. This is meant primarily to demonstrate Rust's MapReduce framework. It takes a list of files on the ...
code_fim
hard
{ "lang": "rust", "repo": "nikomatsakis/rust", "path": "/src/test/bench/task-perf-word-count-generic.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> alt c { 'a' { true } 'b' { true } 'c' { true } 'd' { true } 'e' { true } 'f' { true } 'g' { true } 'h' { true } 'i' { true } 'j' { true } 'k' { true } 'l' { true } 'm' { true } 'n' { true } 'o' { true } 'p'...
code_fim
hard
{ "lang": "rust", "repo": "nikomatsakis/rust", "path": "/src/test/bench/task-perf-word-count-generic.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> if left_sum >= right_sum && left_sum >= cross_sum { (left_low, left_high, left_sum) } else if right_sum >= left_sum && right_sum >= cross_sum { (right_low, right_high, right_sum) } else { (cross_low, cross_high, cross_sum) } } } #[cf...
code_fim
hard
{ "lang": "rust", "repo": "EFanZh/Introduction-to-Algorithms", "path": "/src/chapter_4_divide_and_conquer/section_4_1_the_maximum_subarray_problem/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> /// The length of `payload` that contains the relevant data. pub(crate) payload_len: usize, /// Stimulus port this packet was sent from. pub(crate) port: u8, } impl Instrumentation { /// Data in this packet. pub fn payload(&self) -> &[u8] { &self.payload[0..self.payload_l...
code_fim
hard
{ "lang": "rust", "repo": "cs2dsb/itm", "path": "/src/packet.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cs2dsb/itm path: /src/packet.rs //! Defines ITM packets and their possible contents. pub(crate) const MAX_PAYLOAD_SIZE: usize = 4; /// Represents a complete received packet. #[derive(Debug)] pub struct Packet { /// The header byte received for this packet. pub(crate) header: u8, /...
code_fim
medium
{ "lang": "rust", "repo": "cs2dsb/itm", "path": "/src/packet.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maxmelander/raytracer path: /src/material.rs use super::color::Color; use super::patterns::Patterns; #[allow(dead_code)] pub const VACUUM: f64 = 1.0; #[allow(dead_code)] pub const AIR: f64 = 1.00029; #[allow(dead_code)] pub const WATER: f64 = 1.333; #[allow(dead_code)] pub const GLASS: f64 = 1....
code_fim
hard
{ "lang": "rust", "repo": "maxmelander/raytracer", "path": "/src/material.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self { color: Color::new(1., 1., 1.), ambient: 0.1, diffuse: 0.9, specular: 0.9, reflective: 0.0, shininess: 200., transparency: 0.0, refractive_index: VACUUM, pattern: None } } ...
code_fim
medium
{ "lang": "rust", "repo": "maxmelander/raytracer", "path": "/src/material.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl JsCompiler { pub fn compile_async( &self, source_file: &SourceFile, ) -> Pin<Box<CompiledModuleFuture>> { let module = CompiledModule { code: str::from_utf8(&source_file.source_code) .unwrap() .to_string(), name: source_file.url.to_string(), }; fut...
code_fim
medium
{ "lang": "rust", "repo": "yamalight/deno", "path": "/cli/compilers/js.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: yamalight/deno path: /cli/compilers/js.rs // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. use crate::compilers::CompiledModule; use crate::compilers::CompiledModuleFuture; use crate::file_fetcher::SourceFile; use futures::future::FutureExt; use std::pin::Pin; use std::...
code_fim
medium
{ "lang": "rust", "repo": "yamalight/deno", "path": "/cli/compilers/js.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> for (count, v) in vec.iter().enumerate() { if count < len - 1 { try!(write!(f, "{}, ", v)) } } write!(f, "{}", vec[len-1]) } } let v: List = List(vec![1, 2]); println!("{}", v); // public private let wbox = my::WhiteBox { contents: "pub" }; println!("wbox {}", wbox.contents); ...
code_fim
hard
{ "lang": "rust", "repo": "arunkumarpatange/rust-dev", "path": "/rust.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> struct List(Vec<i32>); impl fmt::Display for List { fn fmt(&self, f: &mut fmt:: Formatter) -> fmt::Result { let List(ref vec) = *self; let len = vec.len(); for (count, v) in vec.iter().enumerate() { if count < len - 1 { try!(write!(f, "{}, ", v)) } } write!(f, "{}", vec[len-1]) ...
code_fim
medium
{ "lang": "rust", "repo": "arunkumarpatange/rust-dev", "path": "/rust.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arunkumarpatange/rust-dev path: /rust.rs use std::fmt; mod my { pub struct WhiteBox<T> { pub contents: T } //#[allow(dead_code)] #[derive(Debug)] pub struct BlackBox<T> { contents: T } impl<T> BlackBox<T> { pub fn new(contents: T) -> BlackBox<T> { BlackBox { contents: c...
code_fim
hard
{ "lang": "rust", "repo": "arunkumarpatange/rust-dev", "path": "/rust.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>nvalid callback has been passed").into() }; } }<|fim_prefix|>// repo: evernym/indy-sdk path: /vcx/libvcx/src/utils/ccallback.rs macro_rules! check_useful_c_callback { ($x:ident, $e:e<|fim_middle|>xpr) => { let $x = match $x { Some($x) => $x, None => return ...
code_fim
medium
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/vcx/libvcx/src/utils/ccallback.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: evernym/indy-sdk path: /vcx/libvcx/src/utils/ccallback.rs macro_rules! check_useful_c_callback { ($x:ident, $e:expr) => { let $x = match $x { Some($x) <|fim_suffix|>nvalid callback has been passed").into() }; } }<|fim_middle|>=> $x, None => return ...
code_fim
easy
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/vcx/libvcx/src/utils/ccallback.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hoangpq/tokio path: /src/http/message.rs use std; use bytes::Bytes; use http::headers::Headers; /// Request http version #[derive(Copy, Clone, PartialEq, Debug)] pub enum Version { Http10, Http11, } #[derive(Copy, Clone, PartialEq, Debug)] pub enum ConnectionType { Close, Kee...
code_fim
hard
{ "lang": "rust", "repo": "hoangpq/tokio", "path": "/src/http/message.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>pub trait RequestUpdater { fn new() -> Request; fn update_status(&mut self, src: Bytes, meth: (u8, u8), path: (u8, u16)); } impl RequestUpdater for Request { fn new() -> Request { Request { version: Version::Http11, headers: Headers::new(), conne...
code_fim
hard
{ "lang": "rust", "repo": "hoangpq/tokio", "path": "/src/http/message.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> bytes: Bytes, meth: (u8, u8), path: (u8, u16), } impl Request { #[inline] pub fn method(&self) -> &str { unsafe { std::str::from_utf8_unchecked( &self.bytes[(self.meth.0 as usize)..(self.meth.1 as usize)]) } } #[inline] pub fn path(&self) -> &str { ...
code_fim
hard
{ "lang": "rust", "repo": "hoangpq/tokio", "path": "/src/http/message.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[test] pub fn trailing_dash() { let custom_trailing_dash_ = || Tag(); unused(|| mox!(<custom-trailing-dash-></custom-trailing-dash->)); } #[test] pub fn keywords() { let custom_for_loop_in_self = || Tag(); unused(|| mox!(<custom-for-loop-in-self></custom-for-loop-in-self>)); } #[test] p...
code_fim
hard
{ "lang": "rust", "repo": "anp/moxie", "path": "/mox/tests/dashes.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>#[test] pub fn leading_keyword() { let for_loop_in_self = || Tag(); unused(|| mox!(<for-loop-in-self></for-loop-in-self>)); }<|fim_prefix|>// repo: anp/moxie path: /mox/tests/dashes.rs //! These are compile time tests, but they shouldn't take any time to run, so we don't ignore them. use mox::mox...
code_fim
hard
{ "lang": "rust", "repo": "anp/moxie", "path": "/mox/tests/dashes.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: anp/moxie path: /mox/tests/dashes.rs //! These are compile time tests, but they shouldn't take any time to run, so we don't ignore them. use mox::mox; struct Tag(); impl Tag { fn single_dash(self, _value: &str) -> Self { self } <|fim_suffix|>fn unused<T>(_x: T) {} #[test] pub...
code_fim
medium
{ "lang": "rust", "repo": "anp/moxie", "path": "/mox/tests/dashes.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tazjin/datadog-cli path: /src/main.rs extern crate clap; extern crate dogstatsd; use clap::*; use dogstatsd::*; fn get_client() -> Client { Client::new(Options::default()) .expect("Could not create Datadog client") } fn run_send_event(data: &ArgMatches) { <|fim_suffix|>fn main() {...
code_fim
hard
{ "lang": "rust", "repo": "tazjin/datadog-cli", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let send_event = SubCommand::with_name("send-event") .about("Send a single event to dogstatsd") .arg(Arg::with_name("title") .help("title for the event") .required(true)) .arg(Arg::with_name("text") .help("text for the event") ...
code_fim
hard
{ "lang": "rust", "repo": "tazjin/datadog-cli", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let response = client .patch(&upload.url) .json(&json) .header("authorization", format!("Bearer {}", auth)) .send() .await?; match response.error_for_status_ref() { Ok(_) => { ...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/pahkat", "path": "/pahkat-uploader/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Atul9/pahkat path: /pahkat-uploader/src/main.rs use serde::{Deserialize, Serialize}; use std::path::{Path, PathBuf}; use structopt::StructOpt; #[derive(StructOpt, Serialize, Deserialize)] struct Upload { #[structopt(short, long)] pub url: String, #[structopt(short, long)] pub ve...
code_fim
hard
{ "lang": "rust", "repo": "Atul9/pahkat", "path": "/pahkat-uploader/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> return 60; } fn muted(&self) -> bool { return self.debug_disable; } fn mute(&mut self) { self.debug_disable = true; } fn unmute(&mut self) { self.debug_disable = false; } fn playing(&self) -> bool { return (self.lengt...
code_fim
hard
{ "lang": "rust", "repo": "zeta0134/rusticnes-core", "path": "/src/apu/noise.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: zeta0134/rusticnes-core path: /src/apu/noise.rs use super::length_counter::LengthCounterState; use super::volume_envelope::VolumeEnvelopeState; use super::audio_channel::AudioChannelState; use super::audio_channel::PlaybackRate; use super::audio_channel::Volume; use super::audio_channel::Timbre;...
code_fim
hard
{ "lang": "rust", "repo": "zeta0134/rusticnes-core", "path": "/src/apu/noise.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Create the attribute macro save. #[proc_macro_attribute] #[inline] #[must_use] pub fn save(metadata: TokenStream, input: TokenStream) -> TokenStream { save::implementation(&metadata, input) }<|fim_prefix|>// repo: FreddyWordingham/arctk-attr path: /src/lib.rs //! Support library of attribute macr...
code_fim
hard
{ "lang": "rust", "repo": "FreddyWordingham/arctk-attr", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Create the attribute macro input. #[proc_macro_attribute] #[inline] #[must_use] pub fn input(metadata: TokenStream, input: TokenStream) -> TokenStream { input::implementation(&metadata, input) } /// Create the attribute macro output. #[proc_macro_attribute] #[inline] #[must_use] pub fn output(met...
code_fim
medium
{ "lang": "rust", "repo": "FreddyWordingham/arctk-attr", "path": "/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: FreddyWordingham/arctk-attr path: /src/lib.rs //! Support library of attribute macros. #![warn( clippy::all, clippy::cargo, clippy::missing_docs_in_private_items, clippy::nursery, clippy::pedantic, clippy::restriction )] #![allow( clippy::blanket_clippy_restriction_l...
code_fim
hard
{ "lang": "rust", "repo": "FreddyWordingham/arctk-attr", "path": "/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let (epochs, learning_rate, momentum, train_batch_size, eval_batch_size, save) = { let mut epochs = 50; let mut learning_rate = 0.001; let mut momentum = 0.1; let mut train_batch_size: usize = 256; let mut eval_batch_size: usize = 1024; let m...
code_fim
hard
{ "lang": "rust", "repo": "charles-r-earp/autograph-v0.0.3", "path": "/examples/mnist_lenet5.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fs::create_dir_all("models/mnist_lenet5/checkpoints"); // models are saved as [name].model let model_path = "models/mnist_lenet5/mnist_lenet5"; // checkpoints are saved as [name]_epoch[epoch].checkpoint let checkpoint_path = "models/mnist_lenet5/checkpoints/mnist_lenet5"; ...
code_fim
hard
{ "lang": "rust", "repo": "charles-r-earp/autograph-v0.0.3", "path": "/examples/mnist_lenet5.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: charles-r-earp/autograph-v0.0.3 path: /examples/mnist_lenet5.rs #![allow(warnings)] use argparse::{ArgumentParser, Store, StoreTrue}; #[macro_use] extern crate autograph; use autograph::nn::{ Conv2d, Dense, Forward, Layer, Pool2dArgs, autograd::{Graph, ParameterD, Variable, Variable2, Va...
code_fim
hard
{ "lang": "rust", "repo": "charles-r-earp/autograph-v0.0.3", "path": "/examples/mnist_lenet5.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>trait BitAccess { fn get_bit(&self, i: usize) -> Option<bool>; } impl<Scalar: PrimeField> BitAccess for Scalar { fn get_bit(&self, i: usize) -> Option<bool> { if i as u32 >= Scalar::NUM_BITS { return None; } let (byte_pos, bit_pos) = (i / 8, i % 8); let byte = self.to_repr().as...
code_fim
medium
{ "lang": "rust", "repo": "MercysJest/NovaBreakingTheCycleAttack", "path": "/src/gadgets/nonnative/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: MercysJest/NovaBreakingTheCycleAttack path: /src/gadgets/nonnative/mod.rs //! This module implements various gadgets necessary for doing non-native arithmetic //! Code in this module is adapted from [bellman-bignat](https://github.com/alex-ozdemir/bellman-bignat), which is licenced under MIT us...
code_fim
hard
{ "lang": "rust", "repo": "MercysJest/NovaBreakingTheCycleAttack", "path": "/src/gadgets/nonnative/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let mut config = cmake::Config::new("glfw"); config .define("BUILD_SHARED_LIBS", "OFF") .define("GLFW_BUILD_EXAMPLES", "OFF") .define("GLFW_BUILD_TESTS", "OFF") .define("GLFW_BUILD_DOCS", "OFF") .define("GLFW_INSTALL", "OFF"); if target.contains("window...
code_fim
medium
{ "lang": "rust", "repo": "perlw/sandbox_rust", "path": "/deps/glfw-sys/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("cargo:rustc-link-lib=static=glfw3"); println!( "cargo:rustc-link-search=native={}/build/src", dest.display() ); println!("cargo:include=cargo:root/glfw/include"); }<|fim_prefix|>// repo: perlw/sandbox_rust path: /deps/glfw-sys/build.rs extern crate cmake; use st...
code_fim
hard
{ "lang": "rust", "repo": "perlw/sandbox_rust", "path": "/deps/glfw-sys/build.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: perlw/sandbox_rust path: /deps/glfw-sys/build.rs extern crate cmake; use std::env; use std::path::Path; use std::process::Command; fn main() { if !Path::new("glfw/.git").exists() { let _ = Command::new("git") .args(&["submodule", "update", "--init"]) .status...
code_fim
hard
{ "lang": "rust", "repo": "perlw/sandbox_rust", "path": "/deps/glfw-sys/build.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let epsilon = 0.0000000001f64; let output = fib_words(18); for ((output_length, output_entropy), (expected_length, expected_entropy)) in output.into_iter().zip(expected.into_iter()) { assert!(output_length == expected_length); assert!((output_entropy - expected_ent...
code_fim
hard
{ "lang": "rust", "repo": "rust-rosetta/rust-rosetta", "path": "/tasks/fibonacci-word/src/main.rs", "mode": "spm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-rosetta/rust-rosetta path: /tasks/fibonacci-word/src/main.rs extern crate entropy; use entropy::shannon_entropy; /// Returns "amount" fibonacci words as a vector of tuples /// The first value of the tuple is the length of the word /// and the second one its entropy fn fib_words(amount: us...
code_fim
hard
{ "lang": "rust", "repo": "rust-rosetta/rust-rosetta", "path": "/tasks/fibonacci-word/src/main.rs", "mode": "psm", "license": "Unlicense", "source": "the-stack-v2" }
<|fim_prefix|>// repo: valarauca/trollrun path: /src/exec/data.rs use std::iter::{FromIterator, IntoIterator, Iterator}; use std::ops::{Index, IndexMut}; use super::parser::TrollLine; /// TrollData is an opaque type that contains information prior #[derive(Clone)] pub struct TrollData { data: DataCollector, } im...
code_fim
hard
{ "lang": "rust", "repo": "valarauca/trollrun", "path": "/src/exec/data.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // now we loop over the array (in reverse order) and double check accumlation values let mut accum_total = 0.0; for i in (0..vec.len()).rev() { accum_total += vec[i].prob; vec[i].accum = accum_total; } // shove the data out the door ...
code_fim
hard
{ "lang": "rust", "repo": "valarauca/trollrun", "path": "/src/exec/data.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match self.client.get_meta(&blob_id).await { Ok(Some(blob_meta)) => { // We got the meta, time to make the item attribute. let inode = self.get_inode(&blob_id).await; let attributes = build_attributes(inode, &blob_meta, 0o764); ...
code_fim
hard
{ "lang": "rust", "repo": "menmos/menmos-fuse", "path": "/src/menmos_fs/fs/lookup.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> // If not, proceed as usual and lookup the blob. let blob_id = self .name_to_blobid .get(&(parent_inode, str_name.clone())) .await .ok_or(Error::NotFound)?; match self.client.get_meta(&blob_id).await { Ok(Some(blob_meta))...
code_fim
hard
{ "lang": "rust", "repo": "menmos/menmos-fuse", "path": "/src/menmos_fs/fs/lookup.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: menmos/menmos-fuse path: /src/menmos_fs/fs/lookup.rs use std::{ ffi::OsStr, time::{Duration, Instant}, }; use async_fuse::FileAttr; use menmos_client::{Meta, Type}; use crate::{constants, MenmosFS}; use super::{build_attributes, Error, Result}; pub struct LookupReply { pub ttl: D...
code_fim
hard
{ "lang": "rust", "repo": "menmos/menmos-fuse", "path": "/src/menmos_fs/fs/lookup.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Wowo10/rs_sprite_editor path: /src/app/mod.rs use lib::ImguiSdl2; use sdl2::image::{InitFlag}; use sdl2::pixels::Color; use sdl2::rect::Point; use config::Config; use fragment::{Doodad, Fragment, Spritesheet}; use mymath::{check_rect, rotate_rectangle}; use resource_manager::ResourceManager; u...
code_fim
hard
{ "lang": "rust", "repo": "Wowo10/rs_sprite_editor", "path": "/src/app/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Event::MouseMotion { xrel, yrel, .. } => { if self.holding_button { if self.holding_index { doodads.first_mut().unwrap().change_position(xrel, yrel); } else { ...
code_fim
hard
{ "lang": "rust", "repo": "Wowo10/rs_sprite_editor", "path": "/src/app/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let split_positions = file_utils::split_line(&split[2], "/"); //data/data/data let split_positions: Vec<&String> = split_positions .iter() .filter(|position| position.len() != 0) ...
code_fim
hard
{ "lang": "rust", "repo": "Wowo10/rs_sprite_editor", "path": "/src/app/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: KaiserY/trpl-zh-cn path: /listings/ch19-advanced-features/listing-19-27/src/main.rs fn add_one(x: i32) -> i32 { x + 1 } <|fim_suffix|> let answer = do_twice(add_one, 5); println!("The answer is: {}", answer); }<|fim_middle|>fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 { f(arg...
code_fim
medium
{ "lang": "rust", "repo": "KaiserY/trpl-zh-cn", "path": "/listings/ch19-advanced-features/listing-19-27/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let answer = do_twice(add_one, 5); println!("The answer is: {}", answer); }<|fim_prefix|>// repo: KaiserY/trpl-zh-cn path: /listings/ch19-advanced-features/listing-19-27/src/main.rs fn add_one(x: i32) -> i32 { x + 1 } fn do_twice(f: fn(i32) -> i32, arg: i32) -> i32 { <|fim_middle|> f(arg...
code_fim
easy
{ "lang": "rust", "repo": "KaiserY/trpl-zh-cn", "path": "/listings/ch19-advanced-features/listing-19-27/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> write!(f, "IME: {} | IE: {:#6x} | IF: {:#6x}", self.master, self.enable, self.requests) } } impl InterruptHandler { pub fn get_vec(&self) -> InterruptVector { for i in 0..5 { if (self.requests & 1 << i) == 1 << i { //>> match i { 0...
code_fim
hard
{ "lang": "rust", "repo": "bfsgr/rusty_gb", "path": "/src/emulator/interrupt.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> pub fn get_vec(&self) -> InterruptVector { for i in 0..5 { if (self.requests & 1 << i) == 1 << i { //>> match i { 0 => { if self.enable.test_bit(0) { return InterruptVector::VBlank; ...
code_fim
hard
{ "lang": "rust", "repo": "bfsgr/rusty_gb", "path": "/src/emulator/interrupt.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: bfsgr/rusty_gb path: /src/emulator/interrupt.rs #![allow(non_snake_case)] use super::bit_utils::BitUtils; use std::fmt::{Formatter, Result, Display}; #[derive(PartialEq)] pub enum EI { Requested, Active, Disabled, } impl Default for EI { fn default() -> Self { EI::Disabled } }...
code_fim
hard
{ "lang": "rust", "repo": "bfsgr/rusty_gb", "path": "/src/emulator/interrupt.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> map.insert(1738, &[16425]); // 1738 => [16425] map.insert(3567, &[32809]); // 3567 => [32809] map.insert(3898, &[65577]); // 3898 => [65577] map.insert(2704, &[131113]); // 2704 => [131113] map.insert(452, &[262185]); // 452 => [262185]...
code_fim
hard
{ "lang": "rust", "repo": "thomwiggers/lpn", "path": "/src/codes/golay/golay_24_12.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // 1089 => [1089] map.insert(2113, &[2113]); // 2113 => [2113] map.insert(1246, &[4161]); // 1246 => [4161] map.insert(2431, &[8257]); // 2431 => [8257] map.insert(1698, &[16449]); // 1698 => [16449] map.insert(3463, &[32833]);...
code_fim
hard
{ "lang": "rust", "repo": "thomwiggers/lpn", "path": "/src/codes/golay/golay_24_12.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: thomwiggers/lpn path: /src/codes/golay/golay_24_12.rs map.insert(1297, &[1297]); // 1297 => [1297] map.insert(2321, &[2321]); // 2321 => [2321] map.insert(1422, &[4369]); // 1422 => [4369] map.insert(2095, &[8465]); // 2095 => [8465] ...
code_fim
hard
{ "lang": "rust", "repo": "thomwiggers/lpn", "path": "/src/codes/golay/golay_24_12.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>alse, Ordering::SeqCst); }, None => {} } if !processed_item { let (lock, cvar) = &*self.sync_object; let mut _started = lock.lock().unwrap(); 'running: loop { let _result = cvar.wait...
code_fim
hard
{ "lang": "rust", "repo": "ikcore/IK.Rs.Conman", "path": "/src/processor.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ikcore/IK.Rs.Conman path: /src/processor.rs use std::sync::{Arc, Mutex, Condvar}; use std::sync::atomic::{AtomicBool, Ordering}; use std::time::Duration; use super::{ ConmanManager, ConmanItem }; pub struct ConmanWorkerProcessor { pub running: AtomicBool, pub is_busy: AtomicBool, pu...
code_fim
hard
{ "lang": "rust", "repo": "ikcore/IK.Rs.Conman", "path": "/src/processor.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn adjust(&mut self, packet_stats: &PacketStats, model_size: usize) -> bool { if packet_stats.is_same_trend() { self.shrink_factor = (0.8 + self.shrink_factor) / 2.0; } else if packet_stats.is_opposite_trend() { self.shrink_factor = (1.0 + self.shrink_factor...
code_fim
hard
{ "lang": "rust", "repo": "arapat/sparrow", "path": "/src/head/scheduler/gamma.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> pub fn value(&self) -> f32 { self.gamma } pub fn adjust(&mut self, packet_stats: &PacketStats, model_size: usize) -> bool { if packet_stats.is_same_trend() { self.shrink_factor = (0.8 + self.shrink_factor) / 2.0; } else if packet_stats.is_opposite_trend() {...
code_fim
hard
{ "lang": "rust", "repo": "arapat/sparrow", "path": "/src/head/scheduler/gamma.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: arapat/sparrow path: /src/head/scheduler/gamma.rs use super::packet_stats::PacketStats; use super::packet_stats::UpdateSpeed; #[derive(Clone, Serialize, Deserialize, Debug)] pub struct Gamma { pub gamma: f32, shrink_factor: f32, pub gamma_version: usize, min_gamma: f32, } <|fi...
code_fim
hard
{ "lang": "rust", "repo": "arapat/sparrow", "path": "/src/head/scheduler/gamma.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }