OptionCell: OnceCell but derivable from Option
This library provides an equivalent of OnceCell, but it guarantees layout compatibility with Option<T>
, providing additional transmute helpers.
Known use-cases
- Implementing the unification algorithm without exposing the interior mutability to the user or unnecessarily cloning the value.
Usage
cargo add option-cell
use OptionCell;
let mut options = vec!;
let cells = from_mut_slice;
cells.set.unwrap;
Development
Check with MIRI:
cargo +nightly miri test