memkit 0.2.0-beta.1

Deterministic, intent-driven memory allocation for systems requiring predictable performance
Documentation
use memkit::{MkAllocator, MkConfig};
use std::time::Duration;

fn main() {
    let alloc = MkAllocator::new(MkConfig::default());
    
    println!("Starting multi-phase frame demonstration...");
    
    alloc.begin_frame();
    
    // Phase 1: Physics
    {
        let _phase = alloc.begin_phase("Physics");
        println!("Running Physics...");
        let _ = alloc.frame_vec::<[f32; 3]>(1000).unwrap();
        std::thread::sleep(Duration::from_millis(16));
        // phase dropped here
    }
    
    // Phase 2: AI
    {
        let phase = alloc.begin_phase("AI");
        println!("Running AI...");
        let _ = alloc.frame_box(42).unwrap();
        std::thread::sleep(Duration::from_millis(8));
        let report = phase.end();
        println!("Phase '{}' took {:?} with {} allocations ({} bytes)", 
                 report.name, report.duration, report.alloc_count, report.bytes_allocated);
    }
    
    // Phase 3: Rendering
    {
        let _phase = alloc.begin_phase("Rendering");
        println!("Running Rendering...");
        let _ = alloc.frame_slice::<u8>(1024 * 1024).unwrap();
        std::thread::sleep(Duration::from_millis(4));
    }
    
    alloc.end_frame();
    
    let stats = alloc.stats();
    println!("Total frame allocations: {} ({} bytes)", stats.allocation_count, stats.total_allocated);
}