maybe-cell 0.1.1

An UnsafeCell optionally containing a value, with the state externally managed
Documentation
  • Coverage
  • 97.96%
    48 out of 49 items documented0 out of 46 items with examples
  • Size
  • Source code size: 16.66 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.48 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • andrewwhitehead/suspend-rs
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • andrewwhitehead

maybe-cell

Use a Maybe<T> in place of an UnsafeCell<MaybeUninit<T>> for a friendlier API and optional error checking.

MaybeCopy<T> is provided for types that don't implement Drop.

This crate provides checked and unchecked variants to catch errors when working with the potentially-uninitialized cell. It is recommended to import the checked variant(s) based on a debug flag, for example:

#[cfg(debug_assertions)]
use maybe_cell::checked::Maybe;
#[cfg(not(debug_assertions))]
use maybe_cell::unchecked::Maybe;