Enum lazy_mut::LazyMut
[−]
[src]
pub enum LazyMut<T> { Init(fn() -> T), Value(T), }
A mutable lazy value with either an initializer or a value
See the module-level documentation for more information on usage.
Variants
Init(fn() -> T)
An initializer that will be run to obtain the first value
Value(T)
The value from the initializer
Methods
impl<T> LazyMut<T>
[src]
pub fn unwrap(self) -> T
[src]
Returns the wrapped value, initializing if needed
pub fn init(&mut self) -> &mut LazyMut<T>
[src]
Initializes the wrapped value if it is uninitialized
pub fn init_once(&mut self) -> &mut LazyMut<T>
[src]
Initializes the wrapped value, panicking if it was already initialized
pub fn get(this: &LazyMut<T>) -> Option<&T>
[src]
Tries to get a reference to the value, returns None
if the value is uninitialized
Uses associated function syntax (LazyMut::get(&VAL)
)
pub fn get_mut(this: &mut LazyMut<T>) -> Option<&mut T>
[src]
Tries to get a mutable reference the value, returns None
if the value is uninitialized
Uses associated function syntax (LazyMut::get_mut(&mut VAL)
)
pub fn is_initialized(&self) -> bool
[src]
Returns true
if the wrapped value has been initialized
Trait Implementations
impl<T: Clone> Clone for LazyMut<T>
[src]
fn clone(&self) -> LazyMut<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl<T: Debug> Debug for LazyMut<T>
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more
impl<T> Deref for LazyMut<T>
[src]
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
Dereferences the value.
impl<T> DerefMut for LazyMut<T>
[src]
impl<T> Display for LazyMut<T> where
T: Display,
[src]
T: Display,