text
stringlengths
232
16.3k
domain
stringclasses
1 value
difficulty
stringclasses
3 values
meta
dict
<|fim_suffix|>impl<T, A, S, D> OperatorMultiInplace<S, D> for T where S: DataMut<Elem = A>, D: Dimension + RemoveAxis, for<'a> T: OperatorInplace<ViewRepr<&'a mut A>, D::Smaller>, { fn op_multi_inplace<'a>(&self, a: &'a mut ArrayBase<S, D>) -> &'a mut ArrayBase<S, D> { let n = a.ndim(); ...
code_fim
hard
{ "lang": "rust", "repo": "davenza/ndarray-linalg", "path": "/src/operator.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl<T, A, S, D> OperatorMulti<A, S, D> for T where A: Scalar, S: DataMut<Elem = A>, D: Dimension + RemoveAxis, for<'a> T: OperatorInplace<ViewRepr<&'a mut A>, D::Smaller>, { fn op_multi(&self, a: &ArrayBase<S, D>) -> Array<A, D> { let a = a.to_owned(); self.op_multi_in...
code_fim
hard
{ "lang": "rust", "repo": "davenza/ndarray-linalg", "path": "/src/operator.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: PsichiX/your-time-is-currency path: /client/crate/src/components/follow.rs use oxygengine::prelude::*; #[derive(Debug, Copy, Clone)] pub enum FollowMode { Stick, Tween(Scalar), /// (grid size, cols offset, rows offset) SnapToGrid(Vec2, i32, i32), } <|fim_suffix|>impl Component ...
code_fim
hard
{ "lang": "rust", "repo": "PsichiX/your-time-is-currency", "path": "/client/crate/src/components/follow.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Component for Follow { type Storage = VecStorage<Self>; }<|fim_prefix|>// repo: PsichiX/your-time-is-currency path: /client/crate/src/components/follow.rs use oxygengine::prelude::*; #[derive(Debug, Copy, Clone)] pub enum FollowMode { Stick, Tween(Scalar), /// (grid size, cols offse...
code_fim
hard
{ "lang": "rust", "repo": "PsichiX/your-time-is-currency", "path": "/client/crate/src/components/follow.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl Follow { pub fn new(entity: Entity) -> Self { Self { entity, mode: FollowMode::Stick, } } pub fn with_mode(entity: Entity, mode: FollowMode) -> Self { Self { entity, mode } } } impl Component for Follow { type Storage = VecStorage<...
code_fim
medium
{ "lang": "rust", "repo": "PsichiX/your-time-is-currency", "path": "/client/crate/src/components/follow.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: TomCrypto/lpc11xx path: /src/i2c/conset.rs #[doc = "Reader of register CONSET"] pub type R = crate::R<u32, super::CONSET>; #[doc = "Writer for register CONSET"] pub type W = crate::W<u32, super::CONSET>; #[doc = "Register CONSET `reset()`'s with value 0"] impl crate::ResetValue for super::CONSET...
code_fim
hard
{ "lang": "rust", "repo": "TomCrypto/lpc11xx", "path": "/src/i2c/conset.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> match variant { STO_A::SET => true, } } } #[doc = "Reader of field `STO`"] pub type STO_R = crate::R<bool, STO_A>; impl STO_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<bool, STO_A> { use crate::...
code_fim
hard
{ "lang": "rust", "repo": "TomCrypto/lpc11xx", "path": "/src/i2c/conset.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: tmplt/rtic-scope path: /rtic-apps/src/lib.rs #![no_std] use stm32f4::stm32f401::{CorePeripherals, Peripherals}; /// Enables tracing over async SWO at 115200 Bd. pub fn enable_tracing(core: &mut CorePeripherals, device: &mut Peripherals) { unsafe { // enable tracing core.DCB...
code_fim
hard
{ "lang": "rust", "repo": "tmplt/rtic-scope", "path": "/rtic-apps/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> #[rustfmt::skip] device.DBGMCU.cr.modify(|_, w| w .trace_ioen().set_bit() .trace_mode().bits(0b00) // TRACE pin assignment for async mode .dbg_sleep().clear_bit() // disable clocks i...
code_fim
hard
{ "lang": "rust", "repo": "tmplt/rtic-scope", "path": "/rtic-apps/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: nickodell/rust-tcp-example path: /src/main.rs use std::thread; use std::net::{TcpListener, TcpStream, Shutdown}; use std::io::{Read, Write}; use std::io::Error; const BUFSIZE: usize = 128; fn handle_client(mut stream: TcpStream) -> Result<(), Error> { <|fim_suffix|> println!("Closed connection...
code_fim
hard
{ "lang": "rust", "repo": "nickodell/rust-tcp-example", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn main() { let listener = TcpListener::bind("0.0.0.0:3333").unwrap(); // accept connections and process them, spawning a new thread for each one println!("Server listening on port 3333"); for stream in listener.incoming() { match stream { Ok(stream) => { println!("New connection: {}", stream...
code_fim
hard
{ "lang": "rust", "repo": "nickodell/rust-tcp-example", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: joliss/package-manager path: /server/src/package.rs use std::time::SystemTime; use schema::{packages, package_owners, package_releases}; use user::UserRecord; #[derive(Identifiable, Queryable, Insertable, Associations, Debug)] #[table_name = "packages"] #[primary_key(namespace, name)] pub stru...
code_fim
hard
{ "lang": "rust", "repo": "joliss/package-manager", "path": "/server/src/package.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Insertable, Identifiable, Queryable, Associations, Debug)] #[belongs_to(UserRecord, foreign_key = "publisher")] #[table_name = "package_releases"] #[primary_key(namespace, name, version)] pub struct Release { pub namespace: String, pub name: String, pub version: String, pub publis...
code_fim
hard
{ "lang": "rust", "repo": "joliss/package-manager", "path": "/server/src/package.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub struct Layout { pub origin: Point<f32>, pub size: Size<f32>, }<|fim_prefix|>// repo: isgasho/polyhorn path: /crates/polyhorn-layout/src/lib.rs pub mod algorithm; pub use algorithm::Algorithm; <|fim_middle|>use polyhorn_ui::geometry::{Dimension, Point, Size}; pub enum MeasureFunc { Boxe...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/polyhorn", "path": "/crates/polyhorn-layout/src/lib.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: isgasho/polyhorn path: /crates/polyhorn-layout/src/lib.rs pub mod algorithm; pub use algorithm::Algorithm; use polyhorn_ui::geometry::{Dimension, Point, Size}; <|fim_suffix|>pub struct Layout { pub origin: Point<f32>, pub size: Size<f32>, }<|fim_middle|>pub enum MeasureFunc { Boxe...
code_fim
medium
{ "lang": "rust", "repo": "isgasho/polyhorn", "path": "/crates/polyhorn-layout/src/lib.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: xieweiking/leetcode-cn path: /problems/0002_add-two-numbers/Solution.rs // Definition for singly-linked list. // #[derive(PartialEq, Eq, Clone, Debug)] // pub struct ListNode { // pub val: i32, // pub next: Option<Box<ListNode>> // } // // impl ListNode { // #[inline] // fn new(val: i32...
code_fim
hard
{ "lang": "rust", "repo": "xieweiking/leetcode-cn", "path": "/problems/0002_add-two-numbers/Solution.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>; ptr.next = Some(Box::new(ListNode::new(sum % 10))); ptr = ptr.next.as_mut()?.as_mut(); carry = (if sum >= 10 { 1 } else { 0 }); } if carry == 1 { ptr.next = Some(Box::new(ListNode::new(1))); } head.next } }<|fim_prefix|>...
code_fim
hard
{ "lang": "rust", "repo": "xieweiking/leetcode-cn", "path": "/problems/0002_add-two-numbers/Solution.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> let path_str = vault_path.display().to_string(); let msg = format!("Running '{}' with args {:?} ...", path_str, args); if verbosity > 1 { println!("{}", msg); } debug!("{}", msg); let _child = Command::new(&path_str) .args(args) .stdout(Stdio::null()) ...
code_fim
hard
{ "lang": "rust", "repo": "ravinderjangra/safe-network-launch-tool", "path": "/src/lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ravinderjangra/safe-network-launch-tool path: /src/lib.rs // Copyright 2020 MaidSafe.net limited. // // This SAFE Network Software is licensed to you under the MIT license <LICENSE-MIT // http://opensource.org/licenses/MIT> or the Modified BSD license <LICENSE-BSD // https://opensource.org/licen...
code_fim
hard
{ "lang": "rust", "repo": "ravinderjangra/safe-network-launch-tool", "path": "/src/lib.rs", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> let mut path = PathBuf::from(base_dirs.home_dir()); path.push(".safe"); path.push("vault"); path.push(SAFE_VAULT_EXECUTABLE); Ok(path) } } } fn build_vault_args<'a>( mut base_args: Vec<&'a str>, vault_dir: &'a str, contac...
code_fim
hard
{ "lang": "rust", "repo": "ravinderjangra/safe-network-launch-tool", "path": "/src/lib.rs", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: palantir/conjure-rust-runtime path: /conjure-runtime/src/user_agent.rs // Copyright 2020 Palantir Technologies, Inc. // // 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 a...
code_fim
hard
{ "lang": "rust", "repo": "palantir/conjure-rust-runtime", "path": "/conjure-runtime/src/user_agent.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> for agent in &self.informational { write!(fmt, " {}", agent)?; } Ok(()) } } impl UserAgent { /// Creates a new `UserAgent`. pub fn new(primary: Agent) -> UserAgent { UserAgent { node_id: None, primary, informatio...
code_fim
hard
{ "lang": "rust", "repo": "palantir/conjure-rust-runtime", "path": "/conjure-runtime/src/user_agent.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: DiscoBiscuit99/DiscoGB path: /src/gameboy/cpu/instructions/control/br.rs use crate::gameboy::cpu::Cpu; /// JR i8 pub fn op_18(cpu: &mut Cpu) { let offset = cpu.next_byte() as i8; cpu.pc = cpu.pc.wrapping_add(offset as u16); } /// JR NZ, i8 pub fn op_20(cpu: &mut Cpu) { let offset =...
code_fim
hard
{ "lang": "rust", "repo": "DiscoBiscuit99/DiscoGB", "path": "/src/gameboy/cpu/instructions/control/br.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>/// RET pub fn op_c9(cpu: &mut Cpu) { cpu.pc = cpu.pop_stack(); } /// CALL u16 pub fn op_cd(cpu: &mut Cpu) { let word = cpu.next_word(); cpu.push_stack(cpu.pc); cpu.pc = word; }<|fim_prefix|>// repo: DiscoBiscuit99/DiscoGB path: /src/gameboy/cpu/instructions/control/br.rs use crate::game...
code_fim
medium
{ "lang": "rust", "repo": "DiscoBiscuit99/DiscoGB", "path": "/src/gameboy/cpu/instructions/control/br.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> //整个crate可见 pub(crate) fn crate_visible_fn() { println!("inner_mod crate_visible_fn()"); } //仅在inner_mod可见 pub(self) fn inner_mod_visible_fn() { println!("inner_mod inner_mod_visible_fn()"); } } pub fn foo() { printl...
code_fim
medium
{ "lang": "rust", "repo": "smallswan/rust-by-example", "path": "/src/visible.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn bar() { outer_mod::inner_mod::crate_visible_fn(); //该函数仅outer_mod可见 //outer_mod::inner_mod::super_mod_visible_fn(); //该函数仅outer_mod可见 //outer_mod::inner_mod::outer_mod_visible_fn(); outer_mod::foo(); }<|fim_prefix|>// repo: smallswan/rust-by-example path: /src/visible.rs pu...
code_fim
hard
{ "lang": "rust", "repo": "smallswan/rust-by-example", "path": "/src/visible.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: smallswan/rust-by-example path: /src/visible.rs pub mod outer_mod { pub(self) fn outer_mod_fn() { println!("this fn only call in outer_mod"); } pub mod inner_mod { pub(in crate::visible::outer_mod) fn outer_mod_visible_fn() { println!("inner_mod outer_mod_...
code_fim
hard
{ "lang": "rust", "repo": "smallswan/rust-by-example", "path": "/src/visible.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: droessmj/rust path: /rust_ls/src/main.rs use std::fs; use std::fs::DirEntry; use std::env; use std::path::Path; fn main() { let args: Vec<String> = env::args().collect(); let path = parse_args(args); let p = path.unwrap(); let i = p.len(); let paths = fs::read_dir(p).unwrap(...
code_fim
hard
{ "lang": "rust", "repo": "droessmj/rust", "path": "/rust_ls/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[test] fn test_arg_parse1(){ let input = vec!["".to_string(),"./".to_string()]; let result = parse_args(input); assert_eq!(result.unwrap(), "./".to_string()); } #[test] #[should_panic] fn test_arg_parse2(){ let input2 = vec!["".to_string(),"12387".to_string()]; let result2 = parse_ar...
code_fim
hard
{ "lang": "rust", "repo": "droessmj/rust", "path": "/rust_ls/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: atixlabs/rust-cardano path: /chain-impl-mockchain/src/multisig/ledger.rs use imhamt::{Hamt, InsertError, RemoveError}; use std::collections::hash_map::DefaultHasher; use super::declaration::{Declaration, DeclarationError, Identifier}; use crate::accounting::account::{self, SpendingCounter}; use...
code_fim
hard
{ "lang": "rust", "repo": "atixlabs/rust-cardano", "path": "/chain-impl-mockchain/src/multisig/ledger.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>impl From<RemoveError> for LedgerError { fn from(_: RemoveError) -> Self { LedgerError::DoesntExist } } impl Ledger { /// Create a new empty account ledger pub fn new() -> Self { Ledger { accounts: account::Ledger::new(), declarations: Hamt::new(), ...
code_fim
hard
{ "lang": "rust", "repo": "atixlabs/rust-cardano", "path": "/chain-impl-mockchain/src/multisig/ledger.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: randomPoison/polygon path: /examples/add_remove.rs extern crate gl_winit; extern crate polygon; extern crate winit; use gl_winit::CreateContext; use polygon::*; use polygon::anchor::*; use polygon::camera::*; use polygon::gl::GlRender; use polygon::math::*; use polygon::mesh_instance::*; use po...
code_fim
hard
{ "lang": "rust", "repo": "randomPoison/polygon", "path": "/examples/add_remove.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let mut loop_active = true; let mut frames = 0; let mut state = State::Visible(instance_id); while loop_active { events_loop.poll_events(|event| { match event { Event::WindowEvent { event: WindowEvent::Closed, .. } => { loop_active = ...
code_fim
hard
{ "lang": "rust", "repo": "randomPoison/polygon", "path": "/examples/add_remove.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> &self, f: F, ) -> SignalHandlerId { unsafe extern "C" fn notify_alignment_mode_trampoline<P, F: Fn(&P) + 'static>( this: *mut gtk_source_sys::GtkSourceGutterRenderer, _param_spec: glib_sys::gpointer, f: glib_sys::gpointer, ) where ...
code_fim
hard
{ "lang": "rust", "repo": "john01dav/sourceview", "path": "/src/auto/gutter_renderer.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: john01dav/sourceview path: /src/auto/gutter_renderer.rs ter: &mut gtk::TextIter, area: &mut gdk::Rectangle, x: i32, y: i32, tooltip: &gtk::Tooltip, ) -> bool; fn queue_draw(&self); fn set_alignment(&self, xalign: f32, yalign: f32); fn set_alignm...
code_fim
hard
{ "lang": "rust", "repo": "john01dav/sourceview", "path": "/src/auto/gutter_renderer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: john01dav/sourceview path: /src/auto/gutter_renderer.rs ackground_set)); } if let Some(ref size) = self.size { properties.push(("size", size)); } if let Some(ref visible) = self.visible { properties.push(("visible", visible)); } ...
code_fim
hard
{ "lang": "rust", "repo": "john01dav/sourceview", "path": "/src/auto/gutter_renderer.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: EliasDeMa/exercism-exercises path: /rust/pangram/src/lib.rs /// Determine whether a sentence is a pangram. pub fn is_pangram(s<|fim_suffix|> .contains(std::char::from_u32(x).unwrap()) ) }<|fim_middle|>entence: &str) -> bool { ('a' as u32..= 'z' as u32) .all(|x| s...
code_fim
medium
{ "lang": "rust", "repo": "EliasDeMa/exercism-exercises", "path": "/rust/pangram/src/lib.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> .contains(std::char::from_u32(x).unwrap()) ) }<|fim_prefix|>// repo: EliasDeMa/exercism-exercises path: /rust/pangram/src/lib.rs /// Determine whether a sentence is a pangram. pub fn is_pangram(sentence: &str) -> bool { ('a' as u32..= 'z' as u32) <|fim_middle|>.all(|x| s...
code_fim
medium
{ "lang": "rust", "repo": "EliasDeMa/exercism-exercises", "path": "/rust/pangram/src/lib.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: renowncoder/nand2tetris-7 path: /src/vm/src/instruction.rs #[derive(Debug, Clone)] pub enum PushPop { Push, Pop, } <|fim_suffix|>#[derive(Debug, Clone)] pub enum Instruction { PushPop(PushPopInstruction), Arithmetic(String), Label(String, Option<String>), Goto(String, Op...
code_fim
medium
{ "lang": "rust", "repo": "renowncoder/nand2tetris-7", "path": "/src/vm/src/instruction.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone)] pub enum Instruction { PushPop(PushPopInstruction), Arithmetic(String), Label(String, Option<String>), Goto(String, Option<String>), IfGoto(String, Option<String>), Function(String, usize), Return(), Call(String, usize), }<|fim_prefix|>// repo: renow...
code_fim
medium
{ "lang": "rust", "repo": "renowncoder/nand2tetris-7", "path": "/src/vm/src/instruction.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn task2_body<System: Kernel, D: Driver<App<System>>>(_: usize) { let app = D::app(); app.seq.expect_and_replace(1, 2); // returns `WouldBlock` because `task1` has lock assert_matches!( app.mutex.try_lock(), Err(recursive_mutex::TryLockError::WouldBlock) ); { ...
code_fim
hard
{ "lang": "rust", "repo": "newAM/r3", "path": "/src/r3_test_suite/src/kernel_tests/sync_recursive_mutex_lock_and_dispatch.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: newAM/r3 path: /src/r3_test_suite/src/kernel_tests/sync_recursive_mutex_lock_and_dispatch.rs //! Checks miscellaneous properties of [`r3::sync::RecursiveMutex`]. use assert_matches::assert_matches; use core::cell::Cell; use r3::{ hunk::Hunk, kernel::{cfg::CfgBuilder, Task}, prelude::...
code_fim
hard
{ "lang": "rust", "repo": "newAM/r3", "path": "/src/r3_test_suite/src/kernel_tests/sync_recursive_mutex_lock_and_dispatch.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: pka/ogcapi path: /ogcapi-services/src/error.rs use axum::{ headers::HeaderMap, http::{header::CONTENT_TYPE, StatusCode}, response::{IntoResponse, Response}, Json, }; use ogcapi_types::common::{media_type::PROBLEM_JSON, Exception}; /// A common error type that can be used throug...
code_fim
hard
{ "lang": "rust", "repo": "pka/ogcapi", "path": "/ogcapi-services/src/error.rs", "mode": "psm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> let (status, message) = match self { // Self::Sqlx(ref e) => { // tracing::error!("SQLx error: {:?}", e); // (self.status_code(), self.to_string()) // } Self::NotFound => (self.status_code(), self.to_string()), Self::A...
code_fim
hard
{ "lang": "rust", "repo": "pka/ogcapi", "path": "/ogcapi-services/src/error.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> match self { Self::NotFound => StatusCode::NOT_FOUND, Self::Exception(status, _) => *status, _ => StatusCode::INTERNAL_SERVER_ERROR, } } } /// Axum allows you to return `Result` from handler functions, but the error type /// also must be some sort o...
code_fim
hard
{ "lang": "rust", "repo": "pka/ogcapi", "path": "/ogcapi-services/src/error.rs", "mode": "spm", "license": "LicenseRef-scancode-unknown-license-reference", "source": "the-stack-v2" }
<|fim_suffix|> unsafe { vk_device.destroy_fence(submit_fence, None); } } fn get_memory_type_index( pdevice: &PhysicalDevice, depth_image_memory_req: &vk::MemoryRequirements, ) -> u32 { pdevice .find_memorytype_index( &depth_imag...
code_fim
hard
{ "lang": "rust", "repo": "F3kilo/circles", "path": "/src/vulkan/render/depth_image.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn create_image(device: &ash::Device, resolution: vk::Extent2D) -> vk::Image { let depth_image_create_info = vk::ImageCreateInfo::builder() .image_type(vk::ImageType::TYPE_2D) .format(Self::get_format()) .extent(vk::Extent3D { width: resoluti...
code_fim
hard
{ "lang": "rust", "repo": "F3kilo/circles", "path": "/src/vulkan/render/depth_image.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: F3kilo/circles path: /src/vulkan/render/depth_image.rs use crate::vulkan::base::physical_device::PhysicalDevice; use crate::vulkan::base::VulkanBase; use crate::vulkan::present::VulkanPresent; use ash::version::DeviceV1_0; use ash::vk; use slog::Logger; pub struct DepthImage { image: vk::Im...
code_fim
hard
{ "lang": "rust", "repo": "F3kilo/circles", "path": "/src/vulkan/render/depth_image.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> variant as _ } } #[doc = "Reader of field `EV`"] pub type EV_R = crate::R<u8, EV_A>; impl EV_R { #[doc = r"Get enumerated values variant"] #[inline(always)] pub fn variant(&self) -> crate::Variant<u8, EV_A> { use crate::Variant::*; match self.bits { 34 =...
code_fim
hard
{ "lang": "rust", "repo": "jeandudey/cc13x2-rs", "path": "/src/event/cpuirqsel7.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: jeandudey/cc13x2-rs path: /src/event/cpuirqsel7.rs #[doc = "Reader of register CPUIRQSEL7"] pub type R = crate::R<u32, super::CPUIRQSEL7>; #[doc = "Writer for register CPUIRQSEL7"] pub type W = crate::W<u32, super::CPUIRQSEL7>; #[doc = "Register CPUIRQSEL7 `reset()`'s with value 0x22"] impl crat...
code_fim
hard
{ "lang": "rust", "repo": "jeandudey/cc13x2-rs", "path": "/src/event/cpuirqsel7.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>/// Perform the equivalent of `chmod -R g=u path`. pub fn recursive_g_equal_u<P>(path: P) -> Result<()> where P: AsRef<Path> { let path = path.as_ref().to_path_buf(); let metadata = fs::symlink_metadata(&path)?; let permissions = metadata.permissions(); let filetype = metadata.file_typ...
code_fim
hard
{ "lang": "rust", "repo": "ruizmarlon/habitat", "path": "/components/pkg-export-docker/src/chmod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let test_cases = vec![(0o00750, 0o00770), (0o00150, 0o00110), (0o00753, 0o00773), (0o40753, 0o40773), (0o02753, 0o02773), (0o42753, 0o42773), (0o0...
code_fim
hard
{ "lang": "rust", "repo": "ruizmarlon/habitat", "path": "/components/pkg-export-docker/src/chmod.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: ruizmarlon/habitat path: /components/pkg-export-docker/src/chmod.rs //! Encapsulates code to perform the equivalent of `chmod -R g=u` on a //! directory. //! //! This is needed in order to ensure that the `/hab` directory in a //! BuildRoot is constructed such that the root group has write //! p...
code_fim
hard
{ "lang": "rust", "repo": "ruizmarlon/habitat", "path": "/components/pkg-export-docker/src/chmod.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: danhper/diem path: /testsuite/smoke-test/src/test_utils.rs // Copyright (c) The Diem Core Contributors // SPDX-License-Identifier: Apache-2.0 use diem_config::config::{Identity, NodeConfig, SecureBackend}; use diem_crypto::ed25519::Ed25519PublicKey; use diem_sdk::{ client::BlockingClient, ...
code_fim
hard
{ "lang": "rust", "repo": "danhper/diem", "path": "/testsuite/smoke-test/src/test_utils.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> pub fn insert_waypoint(node_config: &mut NodeConfig, waypoint: Waypoint) { let f = |backend: &SecureBackend| { let mut storage: Storage = backend.into(); storage .set(diem_global_constants::WAYPOINT, waypoint) .expect("Unable to write way...
code_fim
hard
{ "lang": "rust", "repo": "danhper/diem", "path": "/testsuite/smoke-test/src/test_utils.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> /// Test selection across adjacent lines. /// /// 1. [ ][ ][ ][ ][ ] /// [ ][ ][ ][ ][ ] /// 2. [ ][ B][ ][ ][ ] /// [ ][ ][ ][ ][ ] /// 3. [ ][ B][XX][XX][XX] /// [XX][XE][ ][ ][ ] #[test] fn across_adjacent_lines_upward_final_...
code_fim
hard
{ "lang": "rust", "repo": "raphamorim/rio", "path": "/rio/src/selection.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raphamorim/rio path: /rio/src/selection.rs // Rotate start of selection. if (start.point.row >= range_top || range_top == 0) && start.point.row < range_bottom { start.point.row = min(start.point.row - delta, bottommost_line); // If end ...
code_fim
hard
{ "lang": "rust", "repo": "raphamorim/rio", "path": "/rio/src/selection.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: raphamorim/rio path: /rio/src/selection.rs .side == Side::Right) } SelectionType::Semantic | SelectionType::Lines => false, } } /// Check whether selection contains any point in a given range. pub fn intersects_range<R: RangeBounds<Line>>(&self, range...
code_fim
hard
{ "lang": "rust", "repo": "raphamorim/rio", "path": "/rio/src/selection.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> // print each creature's stats drop(to_rendezvous_log); for rep in from_creatures_log.iter() { println!("{}", rep); } // print the total number of creatures met println!("{}\n", Number(creatures_met)); } fn main() { let nn = std::env::args_os().nth(1) .and_the...
code_fim
hard
{ "lang": "rust", "repo": "lemire/ComputerLanguageBenchmark", "path": "/chameneosredux/chameneosredux.rust", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_prefix|>// repo: lemire/ComputerLanguageBenchmark path: /chameneosredux/chameneosredux.rust // The Computer Language Benchmarks Game // http://benchmarksgame.alioth.debian.org/ // // contributed by the Rust Project Developers // contributed by TeXitoi use self::Color::{Red, Yellow, Blue}; use std::sync::mpsc::{...
code_fim
hard
{ "lang": "rust", "repo": "lemire/ComputerLanguageBenchmark", "path": "/chameneosredux/chameneosredux.rust", "mode": "psm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> // track some statistics creatures_met += 1; if other_creature.name == name { evil_clones_met += 1; } } None => break } } // log creatures met and evil clones of self let report =...
code_fim
hard
{ "lang": "rust", "repo": "lemire/ComputerLanguageBenchmark", "path": "/chameneosredux/chameneosredux.rust", "mode": "spm", "license": "BSD-3-Clause", "source": "the-stack-v2" }
<|fim_suffix|> decoder .write_all(&buffer[..]) .expect("error writing incoming packet to decoder"); decoder.finish().expect("error decoding incoming packet") }<|fim_prefix|>// repo: atsheehan/zero-to-gamedev path: /block_peers/src/codec.rs use flate2::write::{GzDecoder, GzEncoder}; use flate2::...
code_fim
hard
{ "lang": "rust", "repo": "atsheehan/zero-to-gamedev", "path": "/block_peers/src/codec.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: atsheehan/zero-to-gamedev path: /block_peers/src/codec.rs use flate2::write::{GzDecoder, GzEncoder}; use flate2::Compression; use std::io::prelude::*; // TODO: These should really return Result's and do proper error handling pub fn gzip_encode(buffer: &[u8]) -> Vec<u8> { let mut encoder = ...
code_fim
medium
{ "lang": "rust", "repo": "atsheehan/zero-to-gamedev", "path": "/block_peers/src/codec.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>pub fn gzip_decode(buffer: &[u8]) -> Vec<u8> { let mut decoder = GzDecoder::new(Vec::new()); decoder .write_all(&buffer[..]) .expect("error writing incoming packet to decoder"); decoder.finish().expect("error decoding incoming packet") }<|fim_prefix|>// repo: atsheehan/zero-t...
code_fim
hard
{ "lang": "rust", "repo": "atsheehan/zero-to-gamedev", "path": "/block_peers/src/codec.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: togglebyte/nightmaregl path: /src/transform.rs // #![deny(missing_docs)] use std::ops::{MulAssign, Div}; use crate::{Position, Rotation, Vector}; use nalgebra::{Matrix4, Scalar, Vector as NalVector}; use num_traits::{One, Zero, NumCast}; #[derive(Debug, Copy, Clone)] pub struct Transform<T> { ...
code_fim
hard
{ "lang": "rust", "repo": "togglebyte/nightmaregl", "path": "/src/transform.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Matrix4::new_translation(&NalVector::from([ position.x, position.y, 1.0 ])) * Matrix4::new_rotation(rotation) * Matrix4::new_nonuniform_scaling(&NalVector::from([ scale.x, scale.y, 1.0 ...
code_fim
hard
{ "lang": "rust", "repo": "togglebyte/nightmaregl", "path": "/src/transform.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> pub fn transform(&self, other: &Transform<T>) -> Matrix4<f32> { self.matrix() * other.matrix() } pub fn matrix(&self) -> Matrix4<f32> { let position = self.translation.to_f32(); let rotation = self.rotation.to_f32(); let rotation = NalVector::from([0.0, 0.0, r...
code_fim
hard
{ "lang": "rust", "repo": "togglebyte/nightmaregl", "path": "/src/transform.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: wxb/rustLab path: /rust_book/ch03/variables/src/main.rs fn main() { let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value of x is: {}", x); <|fim_suffix|> // let arr: [u32; 6] = [1, 2, 3, 4, 5, 6]; let arr = [1, 2, 3, 4, 5, 6]; println!("arr...
code_fim
medium
{ "lang": "rust", "repo": "wxb/rustLab", "path": "/rust_book/ch03/variables/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> // let arr: [u32; 6] = [1, 2, 3, 4, 5, 6]; let arr = [1, 2, 3, 4, 5, 6]; println!("arr is: {}", arr[0]); }<|fim_prefix|>// repo: wxb/rustLab path: /rust_book/ch03/variables/src/main.rs fn main() { let mut x = 5; println!("The value of x is: {}", x); x = 6; println!("The value...
code_fim
medium
{ "lang": "rust", "repo": "wxb/rustLab", "path": "/rust_book/ch03/variables/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: x0rz3q/advent-of-code-2020 path: /day09/src/main.rs use itertools::Itertools; use std::time::Instant; fn silver(input: &Vec<u64>, preamble: usize) -> (u64, usize) { for i in preamble..input.len() { let found = input[i - preamble..i] .iter() .cartesian_product...
code_fim
hard
{ "lang": "rust", "repo": "x0rz3q/advent-of-code-2020", "path": "/day09/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> let input: Vec<u64> = include_str!("input") .trim() .split('\n') .map(|x| x.parse().unwrap()) .collect(); let (result, index) = silver(&input, 25); println!("Silver: {}", result); println!("Gold: {}", gold(&input[..index].to_vec(), result)); println!(...
code_fim
medium
{ "lang": "rust", "repo": "x0rz3q/advent-of-code-2020", "path": "/day09/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: blazeburgess/RustBasics path: /04-10_lifetimes/notes.rs /// # Lifetimes /// The concept of lifetimes is implemented to stop certain issues that /// borrowing and referencing creates. One example is: /// 1) A resource is created /// 2) A reference is made to that resource /// 3) The ori...
code_fim
hard
{ "lang": "rust", "repo": "blazeburgess/RustBasics", "path": "/04-10_lifetimes/notes.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>fn substr(s: &str, until: u32) -> &str; // elided fn substr<'a>(s: &'a str, until: u32) -> &'a str; // explanded fn get_str() -> &str; // ILLEGAL, no inputs fn frob(s: &str, t: &str) -> *str; // ILLEGAL, two inputs fn frob<'a, 'b>(s: &'a str, t: &'b str) -> &str // Expanded: Output // lifetime i...
code_fim
hard
{ "lang": "rust", "repo": "blazeburgess/RustBasics", "path": "/04-10_lifetimes/notes.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>impl ShadowWeights { clone!(direct, f64); clone!(local, f64); clone!(ambient, f64); clone!(transparency, f64); }<|fim_prefix|>// repo: charliejeynes/arc path: /src/img/settings/shader/shadow_weights.rs //! Shader shadow weightings settings implementation. use crate::clone; use attr::json...
code_fim
hard
{ "lang": "rust", "repo": "charliejeynes/arc", "path": "/src/img/settings/shader/shadow_weights.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: charliejeynes/arc path: /src/img/settings/shader/shadow_weights.rs //! Shader shadow weightings settings implementation. <|fim_suffix|>impl ShadowWeights { clone!(direct, f64); clone!(local, f64); clone!(ambient, f64); clone!(transparency, f64); }<|fim_middle|>use crate::clone; ...
code_fim
hard
{ "lang": "rust", "repo": "charliejeynes/arc", "path": "/src/img/settings/shader/shadow_weights.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> fn save(&mut self) -> Result<()> { Ok(()) } } impl Drop for LogKvs { fn drop(&mut self) { self.save().expect("error saving LogKvs during drop"); } } #[cfg(test)] mod tests { use super::*; generate_persistent_tests!(LogKvs); }<|fim_prefix|>// repo: roshangiyanani/...
code_fim
hard
{ "lang": "rust", "repo": "roshangiyanani/pingcap_kvs", "path": "/log_kvs/src/persistent.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> self.save().expect("error saving LogKvs during drop"); } } #[cfg(test)] mod tests { use super::*; generate_persistent_tests!(LogKvs); }<|fim_prefix|>// repo: roshangiyanani/pingcap_kvs path: /log_kvs/src/persistent.rs use std::path::Path; use core::{Error, PathType, Persistent, Res...
code_fim
hard
{ "lang": "rust", "repo": "roshangiyanani/pingcap_kvs", "path": "/log_kvs/src/persistent.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: roshangiyanani/pingcap_kvs path: /log_kvs/src/persistent.rs use std::path::Path; use core::{Error, PathType, Persistent, Result}; use crate::LogKvs; impl Persistent for LogKvs { const PATH_TYPE: PathType = PathType::Directory; fn open<P: AsRef<Path>>(path: P) -> Result<Self> { <|fim_...
code_fim
hard
{ "lang": "rust", "repo": "roshangiyanani/pingcap_kvs", "path": "/log_kvs/src/persistent.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> match hit_result { Some(hit) => println!("Hello World! {}", hit), None => println!("Hello World. No hit?"), } }<|fim_prefix|>// repo: cgibson/flux path: /src/main.rs extern crate nalgebra_glm as glm; use glm::{DVec3}; use geometry::sphere::SphereShape; use geometry::shape::Shape...
code_fim
hard
{ "lang": "rust", "repo": "cgibson/flux", "path": "/src/main.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: cgibson/flux path: /src/main.rs extern crate nalgebra_glm as glm; use glm::{DVec3}; use geometry::sphere::SphereShape; use geometry::shape::Shape; use util::math::Ray; pub mod geometry; pub mod util; fn main() { <|fim_suffix|> let hit_result = sphere.intersect(ray); match hit_result ...
code_fim
medium
{ "lang": "rust", "repo": "cgibson/flux", "path": "/src/main.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: AndrewCushing/Rust-The_book path: /src/challenges/chapter_3/fibonacci_tests.rs use crate::challenges::chapter_3::fibonacci::fibonacci; pub fn run(){ test1(); test2(); test3(); test4(); test5(); test6(); test7(); test8(); test9(); test10(); println!("L...
code_fim
medium
{ "lang": "rust", "repo": "AndrewCushing/Rust-The_book", "path": "/src/challenges/chapter_3/fibonacci_tests.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> assert_eq!(21, fibonacci(7)); } fn test9(){ assert_eq!(34, fibonacci(8)); } fn test10(){ assert_eq!(55, fibonacci(9)); }<|fim_prefix|>// repo: AndrewCushing/Rust-The_book path: /src/challenges/chapter_3/fibonacci_tests.rs use crate::challenges::chapter_3::fibonacci::fibonacci; pub fn run()...
code_fim
hard
{ "lang": "rust", "repo": "AndrewCushing/Rust-The_book", "path": "/src/challenges/chapter_3/fibonacci_tests.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>8.8.11.3 Semantics `size` is an integer gives the number of bytes of the enclosing ‘mfra’ box. This field is placed at the last of the enclosing box to assist readers scanning from the end of the file in finding the ‘mfra’ box. **/ #[derive(Debug, Clone)] pub struct Mfro { header: Header, ...
code_fim
hard
{ "lang": "rust", "repo": "OpenAnsible/rust-mp4", "path": "/src/atom/mfra.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>#[derive(Debug, Clone)] pub struct Tfra { header: Header, sequence_number: u32 } impl Tfra { pub fn parse(f: &mut Mp4File, mut header: Header) -> Result<Self, &'static str>{ header.parse_version(f); header.parse_flags(f); let curr_offset = f.offset(); // f.seek...
code_fim
hard
{ "lang": "rust", "repo": "OpenAnsible/rust-mp4", "path": "/src/atom/mfra.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: OpenAnsible/rust-mp4 path: /src/atom/mfra.rs /** mfra tfra mfro **/ use super::{Mp4File, Kind, Header, Atom}; #[derive(Debug, Clone)] pub struct Mfra { header: Header, children: Vec<Atom> } impl Mfra { pub fn parse(f: &mut Mp4File, header: Header) -> Result<Self, &'stati...
code_fim
hard
{ "lang": "rust", "repo": "OpenAnsible/rust-mp4", "path": "/src/atom/mfra.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> Ok(0) } fn write_at(&self, _offset: u64, buf: &[u8]) -> VfsResult<usize> { Ok(buf.len()) } fn truncate(&self, _size: u64) -> VfsResult { Ok(()) } axfs_vfs::impl_vfs_non_dir_default! {} }<|fim_prefix|>// repo: rcore-os/arceos path: /crates/axfs_devfs/src/...
code_fim
hard
{ "lang": "rust", "repo": "rcore-os/arceos", "path": "/crates/axfs_devfs/src/null.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_prefix|>// repo: rcore-os/arceos path: /crates/axfs_devfs/src/null.rs use axfs_vfs::{VfsNodeAttr, VfsNodeOps, VfsNodePerm, VfsNodeType, VfsResult}; /// A null device behaves like `/dev/null`. /// /// Nothing can be read and all writes are discarded. pub struct NullDev; <|fim_suffix|> Ok(VfsNodeAttr::new...
code_fim
medium
{ "lang": "rust", "repo": "rcore-os/arceos", "path": "/crates/axfs_devfs/src/null.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> fn truncate(&self, _size: u64) -> VfsResult { Ok(()) } axfs_vfs::impl_vfs_non_dir_default! {} }<|fim_prefix|>// repo: rcore-os/arceos path: /crates/axfs_devfs/src/null.rs use axfs_vfs::{VfsNodeAttr, VfsNodeOps, VfsNodePerm, VfsNodeType, VfsResult}; /// A null device behaves like `/d...
code_fim
medium
{ "lang": "rust", "repo": "rcore-os/arceos", "path": "/crates/axfs_devfs/src/null.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|>ale: Scale(scale), texture_atlas: res.0.get_texture_atlas("assets/bullet_explosion.png"), ..Default::default() } ) .with(Timer::from_seconds(0.033, true)) .with(crate::animations::OneOffAnimDespawn); }<|fim_prefix|>// repo: kakoeimon/bevynator path: /s...
code_fim
medium
{ "lang": "rust", "repo": "kakoeimon/bevynator", "path": "/src/explosion.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_prefix|>// repo: kakoeimon/bevynator path: /src/explosion.rs use bevy::prelude::*; use crate::GameRes; pub fn add(commands: &mut Commands, res: &GameRes, x:f32 , y:f32, scale: f32) <|fim_suffix|>ale: Scale(scale), texture_atlas: res.0.get_texture_atlas("assets/bullet_explosion.png"), ...
code_fim
medium
{ "lang": "rust", "repo": "kakoeimon/bevynator", "path": "/src/explosion.rs", "mode": "psm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|>default() } ) .with(Timer::from_seconds(0.033, true)) .with(crate::animations::OneOffAnimDespawn); }<|fim_prefix|>// repo: kakoeimon/bevynator path: /src/explosion.rs use bevy::prelude::*; use crate::GameRes; pub fn add(commands: &mut Commands, res: &GameRes, x:f32 , y:f3...
code_fim
medium
{ "lang": "rust", "repo": "kakoeimon/bevynator", "path": "/src/explosion.rs", "mode": "spm", "license": "unknown", "source": "the-stack-v2" }
<|fim_suffix|> if msg.get_channel_name() == "scrap" { let req = CardScrapRequest::decode(&*payload).unwrap(); if req.card_company == 0 { // TODO enum kbcard::scrap_kbcard("test", "test").await.unwrap(); } } el...
code_fim
medium
{ "lang": "rust", "repo": "dlunch/account", "path": "/scrap/src/main.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: dlunch/account path: /scrap/src/main.rs use std::process::Command; use futures::stream::StreamExt; use prost::Message; mod config; mod kbcard; mod structs; mod util; mod webdriver; <|fim_suffix|> let config = envy::from_env::<config::Config>()?; if config.start_webdriver { Com...
code_fim
medium
{ "lang": "rust", "repo": "dlunch/account", "path": "/scrap/src/main.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|> /// Execute the compare instruction with S at the top and the specified register as the next byte on the μstack Compare, /// Create an immediate value at the top of the μstack MakeImmediate(u8), /// Read a 1-byte immediate from memory at PC to the top of the μstack, incrementing PC ...
code_fim
hard
{ "lang": "rust", "repo": "LoungeCPP/pir-8-emu", "path": "/src/micro/op.rs", "mode": "spm", "license": "MIT", "source": "the-stack-v2" }
<|fim_prefix|>// repo: LoungeCPP/pir-8-emu path: /src/micro/op.rs use self::super::super::isa::instruction::{InstructionJumpCondition, AluOperation}; use self::super::super::isa::GeneralPurposeRegisterBank; use self::super::DisplayMicroOp; /// Actual μOps executable by the CPU /// /// The approach is stack-based (th...
code_fim
hard
{ "lang": "rust", "repo": "LoungeCPP/pir-8-emu", "path": "/src/micro/op.rs", "mode": "psm", "license": "MIT", "source": "the-stack-v2" }
<|fim_suffix|>pub static KEEP_GOING: std::sync::atomic::AtomicBool = std::sync::atomic::AtomicBool::new(false); // If KEEP_GOING is false then execute a 'todo!' otherwise call the function. // // Used like: // textual_todo! { w.comment("TODO: Try-Catch Block")? }; #[allow(unused)] macro_rules! textual_todo { ( $...
code_fim
hard
{ "lang": "rust", "repo": "fredemmott/hhvm", "path": "/hphp/hack/src/hackc/ir/conversions/textual/lib.rs", "mode": "spm", "license": "PHP-3.01", "source": "the-stack-v2" }
<|fim_prefix|>// repo: fredemmott/hhvm path: /hphp/hack/src/hackc/ir/conversions/textual/lib.rs // Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. //! Textual is the name of the text for...
code_fim
hard
{ "lang": "rust", "repo": "fredemmott/hhvm", "path": "/hphp/hack/src/hackc/ir/conversions/textual/lib.rs", "mode": "psm", "license": "PHP-3.01", "source": "the-stack-v2" }
<|fim_prefix|>// repo: Saravanan-Jodavula/libra path: /language/move-vm/natives/src/account.rs // Copyright (c) The Libra Core Contributors // SPDX-License-Identifier: Apache-2.0 use libra_types::{ account_address::AccountAddress, account_config, account_config::{AccountResource, BalanceResource, CORE_COD...
code_fim
medium
{ "lang": "rust", "repo": "Saravanan-Jodavula/libra", "path": "/language/move-vm/natives/src/account.rs", "mode": "psm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> context.save_under_address( &[], &account_config::EVENT_MODULE, account_config::event_handle_generator_struct_name(), event_generator, address, )?; context.save_under_address( &[], &account_config::ACCOUNT_MODULE, &AccountResource...
code_fim
hard
{ "lang": "rust", "repo": "Saravanan-Jodavula/libra", "path": "/language/move-vm/natives/src/account.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }
<|fim_suffix|> let cost = native_gas(context.cost_table(), NativeCostIndex::SAVE_ACCOUNT, 0); context.save_under_address( &[], &account_config::EVENT_MODULE, account_config::event_handle_generator_struct_name(), event_generator, address, )?; context.save_under_add...
code_fim
hard
{ "lang": "rust", "repo": "Saravanan-Jodavula/libra", "path": "/language/move-vm/natives/src/account.rs", "mode": "spm", "license": "Apache-2.0", "source": "the-stack-v2" }