MyBox
A zero-dependency, educational Rust library that reimplements Box<T> from first principles.
Quick Start
use MyBox;
let num = new;
assert_eq!;
let s = new;
println!;
Features
- Single-ownership heap allocation — one owner, automatic cleanup via
Drop - Zero-sized type (ZST) safe —
MyBox::new(())works correctly - Recursive data structures —
Box<List<T>>breaks infinite size cycles - Trait object support —
Box<dyn Trait>for runtime polymorphism - Full trait forwarding —
Clone,Deref,PartialEq,Hash,Display, and more - Fallible allocation —
try_newreturnsResultinstead of panicking on OOM - Consume to inner value —
into_innerextractsTfromMyBox<T>
Installation
Documentation
Full API documentation is available at docs.rs/my-box.
License
- Apache License, Version 2.0 (LICENSE)