#maybe #maybe-uninit #no-std #unsafecell

no-std maybe-cell

An UnsafeCell optionally containing a value, with the state externally managed

1 unstable release

0.1.1 Dec 21, 2020
0.1.0 Oct 15, 2020

#1174 in Data structures

48 downloads per month
Used in suspend-channel


356 lines


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:

use maybe_cell::checked::Maybe;
use maybe_cell::unchecked::Maybe;

No runtime deps