<div align="center">
# ◈ MEMKIT ASYNC ◈
### `[ TASK-LOCAL ASYNC-NATIVE ALLOCATION ]`
[](https://crates.io/crates/memkit-async)
[](https://docs.rs/memkit-async)
[](../LICENSE.md)
---
```
█████╗ ███████╗██╗ ██╗███╗ ██╗ ██████╗
██╔══██╗██╔════╝╚██╗ ██╔╝████╗ ██║██╔════╝
███████║███████╗ ╚████╔╝ ██╔██╗ ██║██║
██╔══██║╚════██║ ╚██╔╝ ██║╚██╗██║██║
██║ ██║███████║ ██║ ██║ ╚████║╚██████╗
╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═╝ ╚═══╝ ╚═════╝
```
> *"Memory that moves with your tasks, not your threads."*
**Task-local, async-native memory management for Rust. Avoid the pitfalls of crossing `.await` points with high-speed arenas and managed pools.**
[`◈ QUICK START`](#◈-quick-start) • [`◈ ADVANTAGE`](#◈-the-async-advantage) • [`◈ POLICIES`](#◈-backpressure-policies)
</div>
---
## ◈ THE ASYNC ADVANTAGE
| **Safety** | Runtime-only | **Task-local** | Thread-safe `.await` |
| **Locality** | Random | **Contiguous** | Cache efficient |
| **Pressure** | None | **Wait/Fail** | System stability |
| **Throughput** | Lock-heavy | **Lock-Free** | Optimized scaling |
---
## ◈ FEATURES
```
┌─────────────────────────────────────────────────────────────────────────┐
│ ◆ TASK-LOCAL │ Isolated arenas tied to specific async tasks. Correcly │
│ │ preserves locality even during task migration. │
├─────────────────────────────────────────────────────────────────────────┤
│ ◆ BACKPRESSURE│ Integrated semantics for memory limits: `Wait`, `Fail`, │
│ │ `Timeout`, or `Evict`. │
├─────────────────────────────────────────────────────────────────────────┤
│ ◆ ZERO-COPY │ Move entire arenas between tasks without memory moves. │
│ │ Ideal for producer-consumer pipelines. │
└─────────────────────────────────────────────────────────────────────────┘
```
---
## ◈ QUICK START
```rust
use memkit_async::{MkAsyncFrameAlloc, MkAsyncFrameConfig};
#[tokio::main]
async fn main() {
let alloc = MkAsyncFrameAlloc::new(MkAsyncFrameConfig::default());
// Begin a task-managed frame
let frame = alloc.begin_frame().await;
// Allocate high-speed data safe across .await points
let data = alloc.alloc::<BigData>().await;
do_some_io().await; // Task might move between threads here...
process(data); // ...but memory remains safe and contiguous!
}
```
---
## ◈ BACKPRESSURE POLICIES
| **`Wait`** | Suspends task until space is available. |
| **`Fail`** | Immediately returns `CapacityReached` error. |
| **`Timeout`** | Waits for duration before returning error. |
| **`Evict`** | Discards oldest entries (ideal for caches). |
---
## ◈ INTEGRATION
Enable the `tokio` feature for native runtime support.
```toml
[dependencies]
memkit-async = { version = "0.2.0-beta.1", features = ["tokio"] }
```
---
## ◈ LICENSE
Licensed under the **Mozilla Public License 2.0**.
---
<div align="center">
**[ Part of the ◈ MEMKIT ◈ Ecosystem ]**
</div>