text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|> if let Some(block) = self.relayer.get_block(&hash) { let transactions = indexes .safe_slice() .iter() .filter_map(|i| block.commit_transactions().get(*i as usize).cloned()) .map(Into::into) .collect::<Vec<_...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/ckb", "path": "/sync/src/relayer/get_block_transactions_process.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let ret = self.nc.send(self.peer, fbb.finished_data().to_vec()); if ret.is_err() { warn!(target: "relay", "GetBlockTransactionsProcess response error {:?}", ret); } } Ok(()) } }<|fim_prefix|>// repo: isgasho/ckb path: /sync/src/rela...
code_fim
hard
{ "lang": "rust", "repo": "isgasho/ckb", "path": "/sync/src/relayer/get_block_transactions_process.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/ 1e6 ; let stderr = io : : stderr ( ) ; / / Arbitrary output format subject to change . writeln ! ( stderr . lock ( ) " time : { : > 9 . 3 } ms . \ t { } " time self . name ) . expect ( " timer write should not fail " ) ; } } } impl < ' a > Drop for Timer < ' a > { fn drop ( & mut self ) { self . print_e...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/bindgen/time.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: marco-c/gecko-dev-wordified path: /third_party/rust/bindgen/time.rs use std : : io : : { self Write } ; use std : : time : : { Duration Instant } ; / / / RAII timer to measure how long phases take . # [ derive ( Debug ) ] pub struct Timer < ' a > { output : bool name : & ' a str start : Instant ...
code_fim
hard
{ "lang": "rust", "repo": "marco-c/gecko-dev-wordified", "path": "/third_party/rust/bindgen/time.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> // linestrings with nans/infs let linestring: LineString = vec![[-1.0, 0.0], [0.0, Float::nan()], [0.0, 1.0]].into(); assert_eq!(linestring.line_interpolate_point(0.5), None); assert_eq!(linestring.line_interpolate_point(1.5), None); assert_eq!(linestring.line_inter...
code_fim
hard
{ "lang": "rust", "repo": "georust/geo", "path": "/geo/src/algorithm/line_interpolate_point.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: georust/geo path: /geo/src/algorithm/line_interpolate_point.rs use crate::coords_iter::CoordsIter; use crate::{CoordFloat, EuclideanLength, Line, LineString, Point}; use std::ops::AddAssign; /// Returns an option of the point that lies a given fraction along the line. /// /// If the given fract...
code_fim
hard
{ "lang": "rust", "repo": "georust/geo", "path": "/geo/src/algorithm/line_interpolate_point.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match *self { CommonError::InvalidParam1(_) | CommonError::InvalidParam2(_) | CommonError::InvalidParam3(_) | CommonError::InvalidParam4(_) | CommonError::InvalidParam5(_) | CommonError::InvalidParam6(_) | CommonEr...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/experimental/plugins/postgres_storage/src/errors/common.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> match *self { CommonError::InvalidParam1(_) => ErrorCode::CommonInvalidParam1, CommonError::InvalidParam2(_) => ErrorCode::CommonInvalidParam2, CommonError::InvalidParam3(_) => ErrorCode::CommonInvalidParam3, CommonError::InvalidParam4(_) => ErrorCod...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/experimental/plugins/postgres_storage/src/errors/common.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: evernym/indy-sdk path: /experimental/plugins/postgres_storage/src/errors/common.rs extern crate zmq; extern crate indy_crypto; extern crate log; use std::cell::{BorrowError, BorrowMutError}; use std::error::Error; use std::{fmt, io}; use libindy::ErrorCode; use errors::ToErrorCode; #[derive(D...
code_fim
hard
{ "lang": "rust", "repo": "evernym/indy-sdk", "path": "/experimental/plugins/postgres_storage/src/errors/common.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// This [test][NonExistentStruct<i32>] thing! //~^ ERROR unresolved link pub struct PartialErrorOnlyResolve; /// This [NonExistentStruct2<i32>] thing! //~^ ERROR unclosed HTML tag `i32` //~| ERROR unresolved link pub struct YesError; /// This [NonExistentStruct3<i32>][] thing! //~^ ERROR unclosed HTML ...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/tests/rustdoc-ui/intra-doc/html-as-generics-intra-doc.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rust-lang/rust path: /tests/rustdoc-ui/intra-doc/html-as-generics-intra-doc.rs #![deny(rustdoc::invalid_html_tags)] #![deny(rustdoc::broken_intra_doc_links)] <|fim_suffix|>/// This [test][NonExistentStruct<i32>] thing! //~^ ERROR unresolved link pub struct PartialErrorOnlyResolve; /// This [No...
code_fim
hard
{ "lang": "rust", "repo": "rust-lang/rust", "path": "/tests/rustdoc-ui/intra-doc/html-as-generics-intra-doc.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>/// A type alias for using `deadpool::Object` with `rusqlite` pub type Connection = deadpool::managed::Object<Manager>; /// The manager for creating and recyling SQLite connections pub struct Manager { config: Config, recycle_count: AtomicUsize, runtime: Runtime, } impl Manager { /// Cre...
code_fim
hard
{ "lang": "rust", "repo": "tyranron/deadpool", "path": "/sqlite/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tyranron/deadpool path: /sqlite/src/lib.rs //! # Deadpool for SQLite [![Latest Version](https://img.shields.io/crates/v/deadpool-sqlite.svg)](https://crates.io/crates/deadpool-sqlite) //! //! Deadpool is a dead simple async pool for connections and objects //! of any type. //! //! This crate imp...
code_fim
hard
{ "lang": "rust", "repo": "tyranron/deadpool", "path": "/sqlite/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> async fn recycle( &self, conn: &mut Self::Type, ) -> deadpool::managed::RecycleResult<Self::Error> { if conn.is_mutex_poisoned() { return Err(RecycleError::Message( "Mutex is poisoned. Connection is considered unusable.".to_string(), ...
code_fim
hard
{ "lang": "rust", "repo": "tyranron/deadpool", "path": "/sqlite/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if schema.lock_translations.filter(|l| *l).is_some() { rigid_body_builder = rigid_body_builder.lock_translations(); } let rbh = world.physics().build_body(entity, rigid_body_builder)?; if let Some(collider_schemas) = schema.colliders { for collider_schema in collider_schem...
code_fim
hard
{ "lang": "rust", "repo": "Bombfuse/emerald", "path": "/emerald/src/world/ent/ent_rigid_body_loader.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> if schema.lock_rotations.filter(|l| *l).is_some() { rigid_body_builder = rigid_body_builder.lock_rotations(); } if schema.lock_translations.filter(|l| *l).is_some() { rigid_body_builder = rigid_body_builder.lock_translations(); } let rbh = world.physics().build_body(e...
code_fim
hard
{ "lang": "rust", "repo": "Bombfuse/emerald", "path": "/emerald/src/world/ent/ent_rigid_body_loader.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Bombfuse/emerald path: /emerald/src/world/ent/ent_rigid_body_loader.rs use hecs::Entity; use rapier2d::{ na::Vector2, parry::shape::Cuboid, prelude::{ColliderBuilder, ColliderHandle, RigidBodyBuilder, RigidBodyHandle, RigidBodyType}, }; use serde::{Deserialize, Serialize}; use crate...
code_fim
hard
{ "lang": "rust", "repo": "Bombfuse/emerald", "path": "/emerald/src/world/ent/ent_rigid_body_loader.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl ProcessState { /// Start the Binder IPC thread pool pub fn start_thread_pool() { unsafe { // Safety: Safe FFI sys::ABinderProcess_startThreadPool(); } } /// Set the maximum number of threads that can be started in the threadpool. /// //...
code_fim
hard
{ "lang": "rust", "repo": "SuperiorOS/android_frameworks_native", "path": "/libs/binder/rust/src/state.rs", "mode": "spm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_prefix|>// repo: SuperiorOS/android_frameworks_native path: /libs/binder/rust/src/state.rs /* * Copyright (C) 2020 The Android Open Source Project * * 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...
code_fim
hard
{ "lang": "rust", "repo": "SuperiorOS/android_frameworks_native", "path": "/libs/binder/rust/src/state.rs", "mode": "psm", "license": "LicenseRef-scancode-unicode", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tgoettingen/git-vscode-demo path: /src/types.rs pub fn run(){ let x=1; // default i32 let y=2.5; // default f64 let z:i64 =3456456435636; <|fim_suffix|> println!("{},{}",x,y); println!("{}",std::i32::MAX); println!("{:?}",(x,y,z, is_active,a1,face)); }<|fim_middle|> ...
code_fim
medium
{ "lang": "rust", "repo": "tgoettingen/git-vscode-demo", "path": "/src/types.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> println!("{},{}",x,y); println!("{}",std::i32::MAX); println!("{:?}",(x,y,z, is_active,a1,face)); }<|fim_prefix|>// repo: tgoettingen/git-vscode-demo path: /src/types.rs pub fn run(){ let x=1; // default i32 let y=2.5; // default f64 <|fim_middle|> let z:i64 =3456456435636; ...
code_fim
medium
{ "lang": "rust", "repo": "tgoettingen/git-vscode-demo", "path": "/src/types.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl Storage { pub fn new (directory: &str, file: &str) -> Self { Storage { directory: directory.to_string(), file_name: file.to_string(), encoder: Encode::new(), } } pub fn persist (&self, ii: &InvertedIndex) { let file_path = Path:...
code_fim
medium
{ "lang": "rust", "repo": "johtani/rust-simple-search", "path": "/src/store/storage.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: johtani/rust-simple-search path: /src/store/storage.rs use std::io::prelude::*; use std::fs::File; use std::io::BufWriter; use std::path::Path; use index::InvertedIndex; use store::Encode; <|fim_suffix|> pub fn persist (&self, ii: &InvertedIndex) { let file_path = Path::new(&self.di...
code_fim
hard
{ "lang": "rust", "repo": "johtani/rust-simple-search", "path": "/src/store/storage.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // wait for incoming events let next_event = event.next()?; match next_event { crate::events::Event::UserInput(key) => { match key.code { KeyCode::Char(c) => { app.server.push(c); } KeyCode::Backspace => { app.server.pop(); ...
code_fim
hard
{ "lang": "rust", "repo": "sand-head/funky-chat", "path": "/src/Client/src/app/states/server_input.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sand-head/funky-chat path: /src/Client/src/app/states/server_input.rs use anyhow::Result; use crossterm::event::KeyCode; use tui::{backend::Backend, Terminal}; use crate::{app::{App, AppState}, events::EventHandler, ui::draw_server_input}; <|fim_suffix|> // wait for incoming events let ...
code_fim
hard
{ "lang": "rust", "repo": "sand-head/funky-chat", "path": "/src/Client/src/app/states/server_input.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> terminal: &mut Terminal<B>, event: &EventHandler, mut app: &mut App, ) -> Result<()> where B: Backend, { // draw the server input frame terminal.draw(|f| draw_server_input(f, app))?; // wait for incoming events let next_event = event.next()?; match next_event { ...
code_fim
medium
{ "lang": "rust", "repo": "sand-head/funky-chat", "path": "/src/Client/src/app/states/server_input.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// A Result as returned by this crate. pub type Result<T> = std::result::Result<T, Error>; /// A Type that remembers a set of live channels, and launches new /// ones on request. /// /// Use the [ChanMgr::get_or_launch] function to create a new channel, or /// get one if it exists. pub struct ChanMgr<R:...
code_fim
hard
{ "lang": "rust", "repo": "erglabs/arti", "path": "/crates/tor-chanmgr/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: erglabs/arti path: /crates/tor-chanmgr/src/lib.rs //! `tor-chanmgr`: Manage a set of channels on the Tor network. //! //! # Overview //! //! This crate is part of //! [Arti](https://gitlab.torproject.org/tpo/core/arti/), a project to //! implement [Tor](https://www.torproject.org/) in Rust. //! ...
code_fim
hard
{ "lang": "rust", "repo": "erglabs/arti", "path": "/crates/tor-chanmgr/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> &self, server: &PhabMockServer, params: &Params, request: &Request, ) -> ResponseTemplate; } struct AuthAndParse<R> { server: PhabMockServer, responder: R, } impl<R> Respond for AuthAndParse<R> where R: PhabRespond, { fn respond(&self, request: &Reques...
code_fim
hard
{ "lang": "rust", "repo": "sjoerdsimons/phabricator-rs", "path": "/phabricator-mock/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn default_priority(&self) -> Priority { let data = self.inner.data.lock().unwrap(); data.default_priority.clone() } pub fn new_user(&self, name: &str, full_name: &str) -> User { let u = user::UserDataBuilder::default() .full_name(full_name) ...
code_fim
hard
{ "lang": "rust", "repo": "sjoerdsimons/phabricator-rs", "path": "/phabricator-mock/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sjoerdsimons/phabricator-rs path: /phabricator-mock/src/lib.rs use std::collections::HashMap; use std::sync::{Arc, Mutex}; use url::Url; use wiremock::matchers::{header, method, path}; use wiremock::{Mock, MockServer, ResponseTemplate}; use wiremock::{Request, Respond}; mod param; use param::Pa...
code_fim
hard
{ "lang": "rust", "repo": "sjoerdsimons/phabricator-rs", "path": "/phabricator-mock/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let condition: Box<dyn Fn(f32) -> bool> = match cmd.message { CommandMessage::Over(amount) => Box::new(move |x| x > amount as f32), CommandMessage::Under(amount) => Box::new(move |x| x < amount as f32), CommandMessage::Between(under, over) => Box::new(move |x| {...
code_fim
hard
{ "lang": "rust", "repo": "datomo/star_pi_runner", "path": "/src/scale.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: datomo/star_pi_runner path: /src/scale.rs use std::collections::VecDeque; use std::sync::{Arc, Mutex}; use std::sync::mpsc::{channel, Receiver, Sender}; use std::thread; use std::time::Duration; use crate::blocks::Logic; use crate::hx711::Hx711; use crate::workflow::{BlueprintBlock, Command, Co...
code_fim
medium
{ "lang": "rust", "repo": "datomo/star_pi_runner", "path": "/src/scale.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let last_weight = self.last_weight.clone(); let gui_sender = self.gui_sender.clone(); let id = self.id.clone(); let sck = self.sck_pin; let d_out = self.d_out_pin; thread::spawn(move || { let mut hx711 = Hx711::new(sck, d_out, 128); h...
code_fim
hard
{ "lang": "rust", "repo": "datomo/star_pi_runner", "path": "/src/scale.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> where T: Add<Output = T> + Copy + Clone + Mul<Output = T> + PartialEq + Eq + Hash + Debug, { match self.tag { OP::VAL => return self, OP::ADD => { let ops = self.operands.as_ref().unwrap(); let e0: Expr<T> = ops.get(0).unwrap(...
code_fim
hard
{ "lang": "rust", "repo": "barrett370/PLPDI", "path": "/lecture_code/ASG/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: barrett370/PLPDI path: /lecture_code/ASG/src/main.rs use std::collections::HashMap; use std::fmt; use std::fmt::Debug; use std::hash::Hash; use std::ops::{Add, Mul}; #[derive(PartialEq, Eq, Copy, Clone, Debug)] enum OP { VAL, ADD, MUL, LET, VAR, } #[derive(Clone, Debug)] st...
code_fim
hard
{ "lang": "rust", "repo": "barrett370/PLPDI", "path": "/lecture_code/ASG/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let a1 = Expr { tag: OP::ADD, data: None, operands: Some(vec![c1, c2]), name: None, vars: None, }; let a2 = Expr { tag: OP::ADD, data: None, operands: Some(vec![a1.clone(), a1]), name: None, vars: None, }; ...
code_fim
hard
{ "lang": "rust", "repo": "barrett370/PLPDI", "path": "/lecture_code/ASG/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>; self } } #[doc = "This register is used to control the selection of the kernel clock for the ETH block. Note that changing the clock source on-the-fly is allowed, and will not generate any timing violation, however the user has to ensure that both the previous and the new clock sources are p...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/rcc/rcc_ethckselr.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: stm32-rs/stm32-rs-nightlies path: /stm32mp1/src/stm32mp157/rcc/rcc_ethckselr.rs #[doc = "Register `RCC_ETHCKSELR` reader"] pub type R = crate::R<RCC_ETHCKSELR_SPEC>; #[doc = "Register `RCC_ETHCKSELR` writer"] pub type W = crate::W<RCC_ETHCKSELR_SPEC>; #[doc = "Field `ETHSRC` reader - ETHSRC"] pu...
code_fim
hard
{ "lang": "rust", "repo": "stm32-rs/stm32-rs-nightlies", "path": "/stm32mp1/src/stm32mp157/rcc/rcc_ethckselr.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> ch.basic_ack(BasicAckArguments::new(msg.deliver.unwrap().delivery_tag(), false)).await.unwrap(); } } }); let guard = Notify::new(); guard.notified().await; Ok(()) }<|fim_prefix|>// repo: rabbitmq/rabbitmq-tutorials path: /rust-amqprs/src/bin/w...
code_fim
hard
{ "lang": "rust", "repo": "rabbitmq/rabbitmq-tutorials", "path": "/rust-amqprs/src/bin/worker.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rabbitmq/rabbitmq-tutorials path: /rust-amqprs/src/bin/worker.rs use amqprs::{ connection::{Connection, OpenConnectionArguments}, callbacks::{DefaultConnectionCallback, DefaultChannelCallback}, channel::{QueueDeclareArguments, BasicConsumeArguments, BasicAckArguments} }; use tokio::{...
code_fim
hard
{ "lang": "rust", "repo": "rabbitmq/rabbitmq-tutorials", "path": "/rust-amqprs/src/bin/worker.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: burrbull/nuc1xx-pac path: /src/can/can_ndat1.rs #[doc = "Reader of register CAN_NDAT1"] pub type R = crate::R<u32, super::CAN_NDAT1>; #[doc = "Reader of field `NewData1_16`"] pub type NEWDATA1_16_R = crate::R<u16, u16<|fim_suffix|>red by the application software."] #[inline(always)] pub ...
code_fim
hard
{ "lang": "rust", "repo": "burrbull/nuc1xx-pac", "path": "/src/can/can_ndat1.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>red by the application software."] #[inline(always)] pub fn new_data1_16(&self) -> NEWDATA1_16_R { NEWDATA1_16_R::new((self.bits & 0xffff) as u16) } }<|fim_prefix|>// repo: burrbull/nuc1xx-pac path: /src/can/can_ndat1.rs #[doc = "Reader of register CAN_NDAT1"] pub type R = crate::R<u3...
code_fim
hard
{ "lang": "rust", "repo": "burrbull/nuc1xx-pac", "path": "/src/can/can_ndat1.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ZeroTixDev/locked_box path: /src/main.rs use std::io; struct Box { locked: bool, _content: Vec<String>, } impl Box { fn new() -> Box { Box { locked: false, _content: Vec::new(), } } fn remove(&mut self, value: &str) -> String { ...
code_fim
hard
{ "lang": "rust", "repo": "ZeroTixDev/locked_box", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut game_box = Box::new(); println!( "There is a box. It is currently unlocked. Commands [add, lock, unlock, view, remove, help]" ); loop { let mut guess = String::new(); io::stdin() .read_line(&mut guess) .expect("Failed to read line"); ...
code_fim
hard
{ "lang": "rust", "repo": "ZeroTixDev/locked_box", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: benitogf/sleding path: /src/lib.rs extern crate base64; extern crate pretty_env_logger; use glob::Pattern; use futures::StreamExt; use serde::{Deserialize, Serialize}; use std::collections::HashMap; use std::sync::{ atomic::{AtomicUsize, Ordering}, Arc, Mutex, }; use std::time::{SystemTime, ...
code_fim
hard
{ "lang": "rust", "repo": "benitogf/sleding", "path": "/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // Match with two groups, first group is "http://", "https:// or the // beginning characters until the first slash, second group is the rest. let caps = RE2.captures(path).unwrap(); // match one or more slashes caps[1].to_string() + &RE3.replace_all(&caps[2], "/") } pub fn key_valid(key: &str) ...
code_fim
hard
{ "lang": "rust", "repo": "benitogf/sleding", "path": "/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> Self::file_type(project_configuration, path) == FileType::UnknownFile } fn file_type(project_configuration: &ProjectConfiguration, path: &PathBuf) -> FileType { if Self::compare_file(path, &project_configuration.application_file) { FileType::ApplicationFile } e...
code_fim
hard
{ "lang": "rust", "repo": "maco/unused", "path": "/crates/token_analysis/src/occurrence_count.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn is_unknown_file(project_configuration: &ProjectConfiguration, path: &PathBuf) -> bool { Self::file_type(project_configuration, path) == FileType::UnknownFile } fn file_type(project_configuration: &ProjectConfiguration, path: &PathBuf) -> FileType { if Self::compare_file(pat...
code_fim
hard
{ "lang": "rust", "repo": "maco/unused", "path": "/crates/token_analysis/src/occurrence_count.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: maco/unused path: /crates/token_analysis/src/occurrence_count.rs use project_configuration::{PathPrefix, ProjectConfiguration}; use serde::Serialize; use std::collections::HashMap; use std::ops::Add; use std::path::{Path, PathBuf}; use token_search::TokenSearchResult; #[derive(Clone, Copy, Seri...
code_fim
hard
{ "lang": "rust", "repo": "maco/unused", "path": "/crates/token_analysis/src/occurrence_count.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: UKCloud/vcloud-rest-openapi path: /transformer/src/parsers/doc/etc/schema.rs use crate::parsers::doc::etc::r#type::Type; use crate::parsers::doc::etc::XML_SCHEMA_NS; #[cfg(test)] use serde_json::json; use std::convert::TryFrom; use thiserror::Error; #[derive(Debug, PartialEq)] pub struct Schema...
code_fim
hard
{ "lang": "rust", "repo": "UKCloud/vcloud-rest-openapi", "path": "/transformer/src/parsers/doc/etc/schema.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let s = Schema::try_from((include_bytes!("test.xsd") as &[u8], "test")).unwrap(); let value = Vec::<openapiv3::Schema>::from(&s); assert_eq!( serde_json::to_value(value).unwrap(), json!([ { "title": "test_TestType", "description": "A simple ty...
code_fim
hard
{ "lang": "rust", "repo": "UKCloud/vcloud-rest-openapi", "path": "/transformer/src/parsers/doc/etc/schema.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn upsert_author( connection: &PgConnection, author_key: &str, ) -> Result<i32, diesel::result::Error> { diesel::insert_into(authors) .values(author.eq(author_key)) .on_conflict(on_constraint("authors_author_unique_constraint")) .do_nothing() .returning(id) ...
code_fim
hard
{ "lang": "rust", "repo": "pietgeursen/bamboo-rest-api", "path": "/src/models/authors.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pietgeursen/bamboo-rest-api path: /src/models/authors.rs use crate::schema::authors; use crate::schema::authors::dsl::*; use crate::schema::messages::dsl::*; use diesel::pg::upsert::*; use diesel::pg::PgConnection; use diesel::prelude::*; #[derive(Queryable)] pub struct Author { pub id: i32...
code_fim
hard
{ "lang": "rust", "repo": "pietgeursen/bamboo-rest-api", "path": "/src/models/authors.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>type ExtractorFn = fn(&Path) -> Result<Option<Map<String, Value>>>; fn combine(fns: &[ExtractorFn], path: &Path) -> Result<Option<Map<String, Value>>> { let mut ret: Option<Map<String, Value>> = None; for f in fns { if let Some(mut data) = f(path)? { if ret.is_none() { ...
code_fim
hard
{ "lang": "rust", "repo": "samwho/whatis", "path": "/src/whatis/extractors/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: samwho/whatis path: /src/whatis/extractors/mod.rs mod example; mod generic_image; mod jpeg; mod png; use std::path::Path; use super::FileType::{self, *}; use serde_json::{Map, Value}; type Result<T> = std::result::Result<T, Box<dyn std::error::Error>>; pub trait Extractor { fn extract(&s...
code_fim
medium
{ "lang": "rust", "repo": "samwho/whatis", "path": "/src/whatis/extractors/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nhaney/fish-game path: /src/player/states.rs use bevy::prelude::*; use std::collections::HashSet; use super::attributes::{BoostSupply, Player, PlayerStats}; use super::events::PlayerBoosted; use super::movement::move_player_from_input; use crate::shared::{ game::GameState, movement::{Si...
code_fim
hard
{ "lang": "rust", "repo": "nhaney/fish-game", "path": "/src/player/states.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// Movement system for a boosting player pub(super) fn boost_movement_system( commands: &mut Commands, time: Res<Time>, game_state: Res<GameState>, mut query: Query<(&mut BoostData, &mut PlayerState, &mut Velocity, Entity)>, ) { if !game_state.is_running() { return; } ...
code_fim
hard
{ "lang": "rust", "repo": "nhaney/fish-game", "path": "/src/player/states.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if boost_data.timer.finished() { // debug!("Boost finished!"); commands.remove_one::<BoostData>(entity); match boost_data.prev_state { PlayerStates::Idle => player_state.start_idle(), PlayerStates::Swim => player_state.start_swim(...
code_fim
hard
{ "lang": "rust", "repo": "nhaney/fish-game", "path": "/src/player/states.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> register: ::vcell::VolatileCell<u16>, } #[doc = "Backup data register 26"] pub mod data26; #[doc = "Backup data register 27"] pub struct DATA27 { register: ::vcell::VolatileCell<u16>, } #[doc = "Backup data register 27"] pub mod data27; #[doc = "Backup data register 28"] pub struct DATA28 { re...
code_fim
hard
{ "lang": "rust", "repo": "tshepang/gd32vf103-pac", "path": "/src/bkp.rs", "mode": "spm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tshepang/gd32vf103-pac path: /src/bkp.rs #[doc = r" Register block"] #[repr(C)] pub struct RegisterBlock { _reserved0: [u8; 4usize], #[doc = "0x04 - Backup data register 0"] pub data0: DATA0, _reserved1: [u8; 2usize], #[doc = "0x08 - Backup data register 1"] pub data1: DA...
code_fim
hard
{ "lang": "rust", "repo": "tshepang/gd32vf103-pac", "path": "/src/bkp.rs", "mode": "psm", "license": "ISC", "source": "the-stack-v2" }
<|fim_prefix|>// repo: shakyShane/wf2 path: /wf2_core/src/recipes/m2/output_files/mod.rs use crate::context::Context; use crate::file::File; use crate::output_files::OutputFiles; use crate::recipes::m2::services::M2RecipeOptions; use crate::recipes::m2::M2Recipe; use crate::task::Task; use db_conf::DbConf; use db_ini...
code_fim
hard
{ "lang": "rust", "repo": "shakyShane/wf2", "path": "/wf2_core/src/recipes/m2/output_files/mod.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut files = vec![ M2RuntimeEnvFile::from_ctx(&ctx)?.write_task(), UnisonFile::from_ctx(&ctx)?.write_task(), TraefikFile::from_ctx(&ctx)?.write_task(), NginxUpstream::from_ctx(&ctx)?.write_task(), NginxM2::from_ctx(&ctx)?.write_task(),...
code_fim
medium
{ "lang": "rust", "repo": "shakyShane/wf2", "path": "/wf2_core/src/recipes/m2/output_files/mod.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: roynalnaruto/plookup path: /src/lib.rs pub mod kzg10; pub mod lookup; pub mod lookup_table; pub mod multiset; pub mo<|fim_suffix|> mod quotient_poly; pub mod transcript;<|fim_middle|>d multiset_equality; pub mod proof; pub
code_fim
easy
{ "lang": "rust", "repo": "roynalnaruto/plookup", "path": "/src/lib.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> mod quotient_poly; pub mod transcript;<|fim_prefix|>// repo: roynalnaruto/plookup path: /src/lib.rs pub mod kzg10; pub mod lookup; pub mod<|fim_middle|> lookup_table; pub mod multiset; pub mod multiset_equality; pub mod proof; pub
code_fim
medium
{ "lang": "rust", "repo": "roynalnaruto/plookup", "path": "/src/lib.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tiensonqin/text-crdt-rust path: /tests/automerge.rs use smartstring::SmartString; use text_crdt_rust::{get_thread_memory_usage, get_thread_num_allocations, LocalOp}; use text_crdt_rust::automerge::DocumentState; use crdt_testdata::{load_testing_data, TestPatch}; #[test] fn txn_real_world_data()...
code_fim
medium
{ "lang": "rust", "repo": "tiensonqin/text-crdt-rust", "path": "/tests/automerge.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut state = DocumentState::new(); let id = state.get_or_create_client_id("jeremy"); let mut local_ops: Vec<LocalOp> = Vec::new(); for (_i, txn) in test_data.txns.iter().enumerate() { local_ops.clear(); local_ops.extend(txn.patches.iter().map(|TestPatch(pos, del_span, i...
code_fim
hard
{ "lang": "rust", "repo": "tiensonqin/text-crdt-rust", "path": "/tests/automerge.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>const LOG_TARGET: &str = "wallet::output_manager_service::recovery"; pub(crate) struct StandardUtxoRecoverer<TBackend: OutputManagerBackend + 'static, TKeyManagerInterface> { master_key_manager: TKeyManagerInterface, rewind_data: RewindData, factories: CryptoFactories, db: OutputManagerDa...
code_fim
hard
{ "lang": "rust", "repo": "sdbondi/tari", "path": "/base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>use crate::{ key_manager_service::KeyManagerInterface, output_manager_service::{ error::{OutputManagerError, OutputManagerStorageError}, handle::RecoveredOutput, resources::OutputManagerKeyManagerBranch, storage::{ database::{OutputManagerBackend, Output...
code_fim
hard
{ "lang": "rust", "repo": "sdbondi/tari", "path": "/base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: sdbondi/tari path: /base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs // Copyright 2021. The Tari Project // // Redistribution and use in source and binary forms, with or without modification, are permitted provided that the // following conditions are met: // /...
code_fim
hard
{ "lang": "rust", "repo": "sdbondi/tari", "path": "/base_layer/wallet/src/output_manager_service/recovery/standard_outputs_recoverer.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> /// If we hit returns a tuple of (tmin, tmax) pub fn hit(&self, r: &Ray, tmin: f32, tmax: f32) -> Option<(f32, f32)> { let mut new_tmin = tmin; let mut new_tmax = tmax; for i in 0..3 { let inv_d = 1.0 / r.direction.index(i); let mut t0 = (self.min.in...
code_fim
hard
{ "lang": "rust", "repo": "drew-y/rustracer", "path": "/src/tracer/bounding_box.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: drew-y/rustracer path: /src/tracer/bounding_box.rs use super::ray::Ray; use super::vec3::Vec3; #[derive(Copy, Clone, Debug)] pub struct BoundingBox { pub min: Vec3, pub max: Vec3, } impl BoundingBox { pub fn surrounding_box(bbox0: &BoundingBox, bbox1: &BoundingBox) -> BoundingBox {...
code_fim
hard
{ "lang": "rust", "repo": "drew-y/rustracer", "path": "/src/tracer/bounding_box.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let max = Vec3::new( bbox0.max.x.max(bbox1.max.x), bbox0.max.y.max(bbox1.max.y), bbox0.max.z.max(bbox1.max.z), ); BoundingBox { min, max } } /// If we hit returns a tuple of (tmin, tmax) pub fn hit(&self, r: &Ray, tmin: f32, tmax: f...
code_fim
hard
{ "lang": "rust", "repo": "drew-y/rustracer", "path": "/src/tracer/bounding_box.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn funcs() { // recursive function calls is legal. let m = module() .function() .signature().return_type().i32().build() .body().with_opcodes(Opcodes::new(vec![ Opcode::Call(1), Opcode::End, ])).build() .build() .function() .signature().return_type().i32().build() ....
code_fim
hard
{ "lang": "rust", "repo": "indrajithbandara/parity-wasm", "path": "/src/validation/tests.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: indrajithbandara/parity-wasm path: /src/validation/tests.rs use super::validate_module; use builder::module; use elements::{ External, GlobalEntry, GlobalType, ImportEntry, InitExpr, MemoryType, Opcode, Opcodes, TableType, ValueType, BlockType }; #[test] fn empty_is_valid() { let modul...
code_fim
hard
{ "lang": "rust", "repo": "indrajithbandara/parity-wasm", "path": "/src/validation/tests.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>rate) const PROGRAM_POINT_SIZE: types::GLenum = 0x8642; }<|fim_prefix|>// repo: hpwxf/rs-life-of-boids path: /src/glx/support.rs #[allow(clippy::all)] pub mod gl { pub use self::Gle<|fim_middle|>s2 as Gl; include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); // TODO PR to add this constant ...
code_fim
medium
{ "lang": "rust", "repo": "hpwxf/rs-life-of-boids", "path": "/src/glx/support.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: hpwxf/rs-life-of-boids path: /src/glx/support.rs #[allow(clippy::all)] pub mod gl { pub use self::Gle<|fim_suffix|>rate) const PROGRAM_POINT_SIZE: types::GLenum = 0x8642; }<|fim_middle|>s2 as Gl; include!(concat!(env!("OUT_DIR"), "/gl_bindings.rs")); // TODO PR to add this constant ...
code_fim
medium
{ "lang": "rust", "repo": "hpwxf/rs-life-of-boids", "path": "/src/glx/support.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tikv/grpc-rs path: /tests-and-examples/examples/route_guide/client.rs // Copyright 2019 TiKV Project Authors. Licensed under Apache-2.0. #[macro_use] extern crate log; #[macro_use] extern crate serde_derive; #[path = "../log_util.rs"] mod log_util; mod util; use std::sync::Arc; use std::thre...
code_fim
hard
{ "lang": "rust", "repo": "tikv/grpc-rs", "path": "/tests-and-examples/examples/route_guide/client.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>async fn async_main() -> Result<()> { let _guard = log_util::init_log(None); let env = Arc::new(Environment::new(2)); let channel = ChannelBuilder::new(env).connect("127.0.0.1:50051"); let client = RouteGuideClient::new(channel); info!("-------------- GetFeature --------------"); ...
code_fim
hard
{ "lang": "rust", "repo": "tikv/grpc-rs", "path": "/tests-and-examples/examples/route_guide/client.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let receive = async move { while let Some(note) = receiver.try_next().await? { #[cfg(feature = "protobuf-codec")] info!( "Got message {} at {}, {}", note.get_message(), note.get_location().get_latitude(), n...
code_fim
hard
{ "lang": "rust", "repo": "tikv/grpc-rs", "path": "/tests-and-examples/examples/route_guide/client.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: swc-project/swc path: /crates/swc_common/src/errors/mod.rs also /// used as the argument to panic at the moment, but that will eventually /// not be true.) #[derive(Copy, Clone, Debug)] #[must_use] pub struct FatalError; pub struct FatalErrorMarker; // // Don't implement Send on FatalError. T...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_common/src/errors/mod.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_prefix|>// repo: swc-project/swc path: /crates/swc_common/src/errors/mod.rs information, like a previous declaration of parameter. /// handler /// .struct_span_err( /// span, /// &format!("`{}` used as parameter more than once", js_word), /// ) ///...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_common/src/errors/mod.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>} impl CodeSuggestion { /// Returns the assembled code suggestions and whether they should be shown /// with an underline. pub fn splice_lines(&self, cm: &SourceMapperDyn) -> Vec<(String, Vec<SubstitutionPart>)> { use crate::syntax_pos::{CharPos, Pos}; fn push_trailing( ...
code_fim
hard
{ "lang": "rust", "repo": "swc-project/swc", "path": "/crates/swc_common/src/errors/mod.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|>impl_TCFType!(CFBundle, CFBundleRef, CFBundleGetTypeID); #[link(name = "CoreFoundation", kind = "framework")] extern { /* * CFBundle.h */ pub fn CFBundleGetBundleWithIdentifier(bundleID: CFStringRef) -> CFBundleRef; pub fn CFBundleGetFunctionPointerForName(bundle: CFBundleRef, fun...
code_fim
hard
{ "lang": "rust", "repo": "glennw/core-foundation-rs", "path": "/src/bundle.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: glennw/core-foundation-rs path: /src/bundle.rs // Copyright 2013 The Servo Project Developers. See the COPYRIGHT // file at the top-level directory of this distribution. // // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or // http://www.apache.org/licenses/LICENSE-2.0> or the ...
code_fim
medium
{ "lang": "rust", "repo": "glennw/core-foundation-rs", "path": "/src/bundle.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: VladP00/benchmarks path: /json/json.rs/src/json_struct.rs extern crate serde; #[macro_use] extern crate serde_derive; extern crate serde_json; use std::fs; use std::str; #[derive(Deserialize, Debug, PartialEq)] pub struct Coordinate { x: f64, y: f64, z: f64, } #[derive(Deserialize...
code_fim
hard
{ "lang": "rust", "repo": "VladP00/benchmarks", "path": "/json/json.rs/src/json_struct.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let right = Coordinate { x: 1.1, y: 2.2, z: 3.3, }; for v in &[ "{\"coordinates\":[{\"x\":1.1,\"y\":2.2,\"z\":3.3}]}", "{\"coordinates\":[{\"y\":2.2,\"x\":1.1,\"z\":3.3}]}", ] { let left = calc(v); if left != right { eprin...
code_fim
hard
{ "lang": "rust", "repo": "VladP00/benchmarks", "path": "/json/json.rs/src/json_struct.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: akhramov/newseek path: /src/domain/settings.rs use std::str; use serde::de::{self, Deserialize, Deserializer, Visitor, MapAccess}; use serde::ser::Serializer; use schema::{ Unit, settings, }; <|fim_suffix|>fn vec_to_str<'a, S>(bytes: &'a Vec<u8>, serializer: S) -> Result<S::Ok, S::Err...
code_fim
hard
{ "lang": "rust", "repo": "akhramov/newseek", "path": "/src/domain/settings.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match str::from_utf8(bytes) { Ok(result) => serializer.serialize_str(&result), Err(_) => serializer.serialize_unit() } }<|fim_prefix|>// repo: akhramov/newseek path: /src/domain/settings.rs use std::str; use serde::de::{self, Deserialize, Deserializer, Visitor, MapAccess}; use se...
code_fim
medium
{ "lang": "rust", "repo": "akhramov/newseek", "path": "/src/domain/settings.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cool007zqw/godwoken path: /contracts-test/src/tests/utils/shortcut.rs use crate::tests::utils::{ constants::{AGGREGATOR_REQUIRED_BALANCE, CKB_TOKEN_ID}, contract_state::ContractState, }; use crate::tests::{DUMMY_LOCK_BIN, DUMMY_LOCK_HASH, MAIN_CONTRACT_BIN, MAIN_CONTRACT_HASH}; use ckb_t...
code_fim
hard
{ "lang": "rust", "repo": "cool007zqw/godwoken", "path": "/contracts-test/src/tests/utils/shortcut.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub fn prepare_accounts(contract_state: &mut ContractState, balances: Vec<u64>) -> Vec<Index> { let i = contract_state.account_count(); let indexes: Vec<Index> = (i..(i + balances.len() as Index)).collect(); for ((i, account), balance) in indexes .iter() .zip(gen_accounts(i, ba...
code_fim
hard
{ "lang": "rust", "repo": "cool007zqw/godwoken", "path": "/contracts-test/src/tests/utils/shortcut.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dralley/RustPython path: /vm/src/builtins/weakproxy.rs use super::{PyStrRef, PyTypeRef}; use crate::{ function::OptionalArg, types::{Constructor, SetAttr}, PyClassImpl, PyContext, PyObjectRef, PyObjectWeak, PyResult, PyValue, VirtualMachine, }; #[pyclass(module = false, name = "weak...
code_fim
hard
{ "lang": "rust", "repo": "dralley/RustPython", "path": "/vm/src/builtins/weakproxy.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> fn py_new( cls: PyTypeRef, Self::Args { referent, callback }: Self::Args, vm: &VirtualMachine, ) -> PyResult { // using an internal subclass as the class prevents us from getting the generic weakref, // which would mess up the weakref count let weak_...
code_fim
hard
{ "lang": "rust", "repo": "dralley/RustPython", "path": "/vm/src/builtins/weakproxy.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: oshunter/fuchsia path: /src/sys/test_runners/src/test_lib.rs // Copyright 2020 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 { fidl_fuchsia_test::{ CaseListenerRequest::Finished, ...
code_fim
hard
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/src/sys/test_runners/src/test_lib.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|>/// Collects all the listener event as they come and return in a vector. pub async fn collect_listener_event( mut listener: RunListenerRequestStream, ) -> Result<Vec<ListenerEvent>, Error> { let mut ret = vec![]; // collect loggers so that they do not die. let mut loggers = vec![]; whi...
code_fim
hard
{ "lang": "rust", "repo": "oshunter/fuchsia", "path": "/src/sys/test_runners/src/test_lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: seb-odessa/zip-rs path: /src/zip_file_data.rs use time; use system::System; /// Structure representing a ZIP file. #[derive(Debug)] pub struct ZipFileData { /// Compatibility of the file attribute information pub system: System, /// Specification version pub version_made_by: u8,...
code_fim
hard
{ "lang": "rust", "repo": "seb-odessa/zip-rs", "path": "/src/zip_file_data.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>// CRC32 checksum pub crc32: u32, /// Size of the file in the ZIP pub compressed_size: u64, /// Size of the file when extracted pub uncompressed_size: u64, /// Name of the file pub file_name: String, /// Raw file name. To be used when file_name was incorrectly decoded. ...
code_fim
hard
{ "lang": "rust", "repo": "seb-odessa/zip-rs", "path": "/src/zip_file_data.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>e_name was incorrectly decoded. pub file_name_raw: Vec<u8>, /// File comment pub file_comment: String, /// Specifies where the local header of the file starts pub header_start: u64, /// External file attributes pub external_attributes: u32, }<|fim_prefix|>// repo: seb-odessa/zi...
code_fim
hard
{ "lang": "rust", "repo": "seb-odessa/zip-rs", "path": "/src/zip_file_data.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<'a> Agent<'a> { pub fn new(ctx: &'a Context, it: Interpreter) -> Agent { let (sender, receiver) = mpsc::channel(0); Agent { sender: sender, receiver: receiver, ctx: ctx, it: it, eos: false, } } }<|fim_prefix|>...
code_fim
hard
{ "lang": "rust", "repo": "pjkundert/statechart", "path": "/src/agent/mod.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pjkundert/statechart path: /src/agent/mod.rs use futures::{Async, Poll}; use futures::stream::Stream; use futures::sync::mpsc; use ast::Context; use interpreter::{Event, Fault, Interpreter, Status}; pub struct Agent<'a> { pub sender: mpsc::Sender<Event>, receiver: mpsc::Receiver<Event>...
code_fim
hard
{ "lang": "rust", "repo": "pjkundert/statechart", "path": "/src/agent/mod.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }