pub struct Lazy<T, F = fn() -> T> { /* private fields */ }
Expand description
A cell which will be lazily initialized by the provided function the first time it is accessed.
This can be used as a safer alternative to static mut
.
Implementations§
Trait Implementations§
impl<T: Send, F: Send> Send for Lazy<T, F>
impl<T: Sync, F: Sync> Sync for Lazy<T, F>
Auto Trait Implementations§
impl<T, F = fn() -> T> !Freeze for Lazy<T, F>
impl<T, F = fn() -> T> !RefUnwindSafe for Lazy<T, F>
impl<T, F> Unpin for Lazy<T, F>
impl<T, F> UnwindSafe for Lazy<T, F>where
F: UnwindSafe,
T: UnwindSafe,
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