pub struct StaticCell<T: 'static> { /* private fields */ }
Implementations§
Source§impl<T> StaticCell<T>
impl<T> StaticCell<T>
pub fn get(&'static self) -> Option<&'static T>
pub fn set(&'static self, value: T) -> Result<(), T>
pub fn get_or_init<F>(&'static self, f: F) -> &'static Twhere
F: FnOnce() -> T,
pub fn get_or_try_init<F, E>(&'static self, f: F) -> Result<&'static T, E>
Auto Trait Implementations§
impl<T> Freeze for StaticCell<T>
impl<T> RefUnwindSafe for StaticCell<T>
impl<T> Send for StaticCell<T>
impl<T> Sync for StaticCell<T>
impl<T> Unpin for StaticCell<T>
impl<T> UnwindSafe for StaticCell<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more