miny

Crates.iominy
lib.rsminy
version2.0.3
created_at2023-07-11 14:18:46.815216+00
updated_at2025-06-03 16:05:13.271146+00
descriptionBox with small value optimization
homepagehttps://github.com/1e1001/rsutil/tree/main/miny
repositoryhttps://github.com/1e1001/rsutil/tree/main/miny
max_upload_size
id913818
size20,974
Michael (1e1001)

documentation

https://docs.rs/miny

README

miny

Repository Crates.io docs.rs MIT OR Apache-2.0

A Box<T> with T stored inline for values less than a pointer in size. Requires nightly Rust & alloc

use miny::Miny;
let small = Miny::new(1_u8);
let large = Miny::new([1_usize; 32]);
// small is stored inline on the stack
assert!(Miny::on_stack(&small));
// large is stored with an allocation
assert!(!Miny::on_stack(&large));
// consume the miny and get back a value
let original = Miny::into_inner(large);
assert_eq!(original, [1; 32]);

For more information, read the docs.

Changelog

2.0.3

  • Don't try to deallocate ZSTs when converting from a Box (thanks, Cormac!)
  • Documenting invariants more
  • rsutil merge documentation overhaul

2.0.2

  • Account for changes in ptr API's

2.0.1

  • Documentation upgrade

2.0.0

  • Redid the entire library to require qualified syntax, because I realized that that's probably a good idea

1.0.0

  • Initial release

License

MIT or Apache 2.0

(also hi please give me suggestions for more features to add, this crate feels kinda small)

Commit count: 51

cargo fmt