pub struct Once<T> { /* private fields */ }Expand description
Wrapper presenting an async interface to a OnceCell.
Implementations§
Source§impl<T> Once<T>
impl<T> Once<T>
Sourcepub async fn get_or_init<'a, F>(&'a self, f: F) -> &'a Twhere
F: AsyncFnOnce() -> T,
pub async fn get_or_init<'a, F>(&'a self, f: F) -> &'a Twhere
F: AsyncFnOnce() -> T,
Async wrapper around OnceCell’s get_or_init.
Sourcepub async fn get_or_try_init<'a, F, E>(&'a self, f: F) -> Result<&'a T, E>where
F: AsyncFnOnce() -> Result<T, E>,
pub async fn get_or_try_init<'a, F, E>(&'a self, f: F) -> Result<&'a T, E>where
F: AsyncFnOnce() -> Result<T, E>,
Async wrapper around OnceCell’s get_or_try_init.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Once<T>
impl<T> !RefUnwindSafe for Once<T>
impl<T> Send for Once<T>where
T: Send,
impl<T> Sync for Once<T>
impl<T> Unpin for Once<T>where
T: Unpin,
impl<T> UnsafeUnpin for Once<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for Once<T>where
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