Crate memkit_bevy

Crate memkit_bevy 

Source
Expand description

§memkit-bevy

Bevy ECS integration for memkit.

Provides automatic frame lifecycle management, resource integration, and optional GPU memory coordination for Bevy applications.

§Features

  • Automatic frame lifecycle — Frame begin/end tied to Bevy schedule
  • Resource integrationMkAllocator as a Bevy Resource
  • System ordering — Proper allocation timing via system sets
  • Optional GPU support — Enable gpu feature for memkit-co integration
  • Prelude compatibility — Enable bevy_prelude for full Bevy prelude

§Quick Start

use bevy::prelude::*;
use memkit_bevy::MkPlugin;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_plugins(MkPlugin::default())
        .add_systems(Update, my_system)
        .run();
}

fn my_system(alloc: Res<MkAllocatorRes>) {
    // Frame automatically managed - allocations valid until frame end
    let data = alloc.frame_alloc::<[f32; 4]>();
    // ...
}

§Feature Flags

  • bevy_prelude — Enables full Bevy prelude re-exports
  • gpu — Enables GPU memory coordination via memkit-co

Re-exports§

pub use MkAllocatorRes as MkAllocatorResource;

Modules§

prelude
Prelude module for common imports.

Structs§

MkAllocatorRes
Bevy resource wrapping the memkit allocator.
MkPlugin
Memkit plugin for Bevy.

Enums§

MkSystemSet
System set for memkit frame lifecycle.