memkit_async/
lib.rs

1//! # memkit-async
2//!
3//! Async-aware memory allocators for memkit.
4//!
5//! ## Features
6//!
7//! - **Task-local allocators**: Each async task gets its own allocation context
8//! - **Backpressure-aware pools**: Configurable behavior when pools are exhausted
9//! - **Zero-copy channels**: Transfer ownership between tasks without copying
10//! - **Safe across .await**: Allocations tracked per-task, not per-thread
11//!
12//! ## Example
13//!
14//! ```rust,ignore
15//! use memkit_async::{MkAsyncFrameAlloc, MkAsyncPool, MkBackpressure};
16//!
17//! async fn process_data() {
18//!     let alloc = MkAsyncFrameAlloc::new(Default::default());
19//!     
20//!     let frame = alloc.begin_frame().await;
21//!     let data = alloc.alloc::<[f32; 1024]>().await;
22//!     // ... process data ...
23//!     drop(frame); // End frame
24//! }
25//! ```
26
27pub mod allocator;
28pub mod backpressure;
29pub mod channel;
30pub mod pool;
31pub mod task_local;
32pub mod sync;
33pub mod container;
34pub mod runtime;
35
36// Re-exports
37pub use allocator::{MkAsyncFrameAlloc, MkAsyncFrameGuard};
38pub use backpressure::MkBackpressure;
39pub use channel::{MkAsyncChannel, MkAsyncSender, MkAsyncReceiver};
40pub use pool::{MkAsyncPool, MkPoolGuard};
41pub use task_local::MkTaskLocal;
42pub use sync::{MkAsyncBarrier, MkAsyncSemaphore};
43pub use container::{MkAsyncBox, MkAsyncVec};
44
45#[cfg(feature = "tokio")]
46pub use runtime::{with_allocator, current_allocator, try_current_allocator, mk_spawn};