# MyBox
[](https://docs.rs/my-box)
[](https://crates.io/crates/my-box)
A zero-dependency, educational Rust library that reimplements `Box<T>` from first principles.
## Quick Start
```rust
use my_box::MyBox;
let num = MyBox::new(42);
assert_eq!(*num, 42);
let s = MyBox::new(String::from("hello"));
println!("{}", *s);
```
## 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_new` returns `Result` instead of panicking on OOM
- **Consume to inner value** — `into_inner` extracts `T` from `MyBox<T>`
## Installation
```bash
cargo add my-box
```
## Documentation
Full API documentation is available at [docs.rs/my-box](https://docs.rs/my-box).
## License
- Apache License, Version 2.0 ([LICENSE](LICENSE))