[−][src]Struct conquer_once::doc::Lazy
A type for lazy initialization of e.g. global static variables, which
provides the same functionality as the lazy_static! macro.
Implementations
impl<T, B, F> Lazy<T, B, F>[src]
pub const fn new(init: F) -> Self[src]
Creates a new uninitialized Lazy with the given init closure.
Examples
The init argument can be a simple function pointer or any FnOnce
closure.
use conquer_once::Lazy; static LAZY_1: Lazy<Vec<i32>> = Lazy::new(|| vec![1, 2, 3, 4, 5]); static LAZY_2: Lazy<Vec<i32>> = Lazy::new(Vec::<i32>::new);
pub fn is_initialized(lazy: &Self) -> bool[src]
Returns true if the Lazy has been successfully initialized.
pub fn is_poisoned(lazy: &Self) -> bool[src]
Returns true if the Lazy has been poisoned.
impl<T, B, F> Lazy<T, B, F> where
B: Block,
F: FnOnce() -> T, [src]
B: Block,
F: FnOnce() -> T,
pub fn get_or_init(lazy: &Self) -> &T[src]
Trait Implementations
impl<T, B, F> AsRef<T> for Lazy<T, B, F> where
B: Block,
F: FnOnce() -> T, [src]
B: Block,
F: FnOnce() -> T,
impl<T, B, F> Borrow<T> for Lazy<T, B, F> where
B: Block,
F: FnOnce() -> T, [src]
B: Block,
F: FnOnce() -> T,
impl<T, B, F> Debug for Lazy<T, B, F> where
T: Debug,
B: Unblock,
F: FnOnce() -> T, [src]
T: Debug,
B: Unblock,
F: FnOnce() -> T,
impl<T, B, F> Deref for Lazy<T, B, F> where
B: Block,
F: FnOnce() -> T, [src]
B: Block,
F: FnOnce() -> T,
impl<T, B, F> Display for Lazy<T, B, F> where
T: Display,
B: Block,
F: FnOnce() -> T, [src]
T: Display,
B: Block,
F: FnOnce() -> T,
Auto Trait Implementations
impl<T, B, F = fn() -> T> !RefUnwindSafe for Lazy<T, B, F>[src]
impl<T, B, F> Send for Lazy<T, B, F> where
F: Send,
T: Send, [src]
F: Send,
T: Send,
impl<T, B, F> Sync for Lazy<T, B, F> where
F: Sync,
T: Send + Sync, [src]
F: Sync,
T: Send + Sync,
impl<T, B, F> Unpin for Lazy<T, B, F> where
B: Unpin,
F: Unpin,
T: Unpin, [src]
B: Unpin,
F: Unpin,
T: Unpin,
impl<T, B, F> UnwindSafe for Lazy<T, B, F> where
B: UnwindSafe,
F: UnwindSafe,
T: UnwindSafe, [src]
B: UnwindSafe,
F: 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,
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> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?Sized,
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(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>,