[−][src]Struct maybe_cell::unchecked::MaybeCopy
Equivalent to an UnsafeCell<MaybeUninit<T>>
, this cell may hold uninitialized data.
Unlike Maybe<T>
this structure is suited for data types with no Drop
implementation.
Implementations
impl<T> MaybeCopy<T>
[src]
pub const fn empty() -> Self
[src]
Create a new, empty MaybeCopy<T>
.
pub const fn new(data: T) -> Self
[src]
Create a new, populated MaybeCopy<T>
.
impl<T: Copy> MaybeCopy<T>
[src]
pub fn as_ptr(&self) -> *const T
[src]
Access the contained value as a constant pointer.
pub fn as_mut_ptr(&mut self) -> *mut T
[src]
Access the contained value as a mutable pointer.
pub unsafe fn as_ref(&self) -> &T
[src]
Obtain a reference to the contained value. This method is unsafe
because
the value may not have been initialized.
pub fn set_loaded(&self, _loaded: bool)
[src]
Override the loaded
flag of the cell. This method is a no-op when using the
unchecked implementation. It may be used when a value is inserted manually,
for example by assigning to the dereferenced pointer.
pub fn load(&self) -> T
[src]
Load the contained value.
pub fn store(&self, value: T)
[src]
Store a new value in the cell.
Auto Trait Implementations
impl<T> !RefUnwindSafe for MaybeCopy<T>
impl<T> Send for MaybeCopy<T> where
T: Send,
T: Send,
impl<T> !Sync for MaybeCopy<T>
impl<T> Unpin for MaybeCopy<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for MaybeCopy<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,