Crate fairly_unsafe_cell

Crate fairly_unsafe_cell 

Source
Expand description

A hybrid between an UnsafeCell and a RefCell: comes with a RefCell-like but unsafe API that panics in test builds (#[cfg(test)]) when mutable access is not exclusive, but has no overhead (and allows for UB) in non-test builds.

Structsยง

FairlyUnsafeCell
A cell that unsafely grants mutable access to its wrapped value. In test builds (#[cfg(test)]), it performs runtime checks to panic when mutable access is not exclusive. In non-test builds, it has no runtime overhead and silently allows for undefined behaviour.
Ref
A wrapper type for an immutably borrowed value from a FairlyUnsafeCell<T>.
RefMut
A wrapper type for a mutably borrowed value from a FairlyUnsafeCell<T>.