maybe-cell

Crates.iomaybe-cell
lib.rsmaybe-cell
version0.1.1
sourcesrc
created_at2020-10-15 18:18:36.134092
updated_at2020-12-21 07:20:01.875164
descriptionAn UnsafeCell optionally containing a value, with the state externally managed
homepage
repositoryhttps://github.com/andrewwhitehead/suspend-rs/
max_upload_size
id300105
size17,031
Andrew Whitehead (andrewwhitehead)

documentation

README

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;
Commit count: 54

cargo fmt