[−][src]Struct core::lazy::Lazy
A value which is initialized on the first access.
Examples
#![feature(once_cell)] use std::lazy::Lazy; let lazy: Lazy<i32> = Lazy::new(|| { println!("initializing"); 92 }); println!("ready"); println!("{}", *lazy); println!("{}", *lazy); // Prints: // ready // initializing // 92 // 92Run
Implementations
impl<T, F> Lazy<T, F>
[src]
impl<T, F: FnOnce() -> T> Lazy<T, F>
[src]
Trait Implementations
impl<T: Debug, F> Debug for Lazy<T, F>
[src]
impl<T: Default> Default for Lazy<T>
[src]
impl<T, F: FnOnce() -> T> Deref for Lazy<T, F>
[src]
Auto Trait Implementations
impl<T, F> Send for Lazy<T, F> where
F: Send,
T: Send,
[src]
F: Send,
T: Send,
impl<T, F = fn() -> T> !Sync for Lazy<T, F>
[src]
impl<T, F> Unpin for Lazy<T, F> where
F: Unpin,
T: Unpin,
[src]
F: Unpin,
T: Unpin,
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,
pub 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.
pub fn try_from(U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,