Crate memkit_async

Crate memkit_async 

Source
Expand description

§memkit-async

Async-aware memory allocators for memkit.

§Features

  • Task-local allocators: Each async task gets its own allocation context
  • Backpressure-aware pools: Configurable behavior when pools are exhausted
  • Zero-copy channels: Transfer ownership between tasks without copying
  • Safe across .await: Allocations tracked per-task, not per-thread

§Example

use memkit_async::{MkAsyncFrameAlloc, MkAsyncPool, MkBackpressure};

async fn process_data() {
    let alloc = MkAsyncFrameAlloc::new(Default::default());
     
    let frame = alloc.begin_frame().await;
    let data = alloc.alloc::<[f32; 1024]>().await;
    // ... process data ...
    drop(frame); // End frame
}

Re-exports§

pub use allocator::MkAsyncFrameAlloc;
pub use allocator::MkAsyncFrameGuard;
pub use backpressure::MkBackpressure;
pub use channel::MkAsyncChannel;
pub use channel::MkAsyncSender;
pub use channel::MkAsyncReceiver;
pub use pool::MkAsyncPool;
pub use pool::MkPoolGuard;
pub use task_local::MkTaskLocal;
pub use sync::MkAsyncBarrier;
pub use sync::MkAsyncSemaphore;
pub use container::MkAsyncBox;
pub use container::MkAsyncVec;

Modules§

allocator
Async-aware frame allocator.
backpressure
Backpressure policies for async allocators.
channel
Zero-copy async channels.
container
Async-safe container types.
pool
Async object pool.
runtime
Runtime integration modules.
sync
Async synchronization primitives.
task_local
Task-local allocation context.