Struct cargo::util::LazyCell
[−]
[src]
pub struct LazyCell<T> { /* fields omitted */ }
Methods
impl<T> LazyCell<T>
[src]
fn new() -> LazyCell<T>
Creates a new empty lazy cell.
fn fill(&self, t: T) -> Result<(), T>
Put a value into this cell.
This function will fail if the cell has already been filled.
fn borrow(&self) -> Option<&T>
Borrows the contents of this lazy cell for the duration of the cell itself.
This function will return Some
if the cell has been previously
initialized, and None
if it has not yet been initialized.
fn into_inner(self) -> Option<T>
Consumes this LazyCell
, returning the underlying value.
fn get_or_try_init<Error, F>(&self, init: F) -> Result<&T, Error> where
F: FnOnce() -> Result<T, Error>,
F: FnOnce() -> Result<T, Error>,
Borrows the contents of this lazy cell, initializing it if necessary.