pub struct Deferred<T> { /* private fields */ }Implementations§
Source§impl<T: Copy> Deferred<T>
impl<T: Copy> Deferred<T>
pub const fn new() -> Self
Sourcepub fn wait(&self) -> impl Future<Output = Option<T>> + Send + '_
pub fn wait(&self) -> impl Future<Output = Option<T>> + Send + '_
The code once it is in, fetching it if no fetch is running; None if that
fails or no loader is registered.
pub fn wake_on_arrival(&self, waker: Waker)
Sourcepub fn get(&self) -> Option<T>
pub fn get(&self) -> Option<T>
The code, or None while it is still to come; a miss starts a fetch.
pub fn fetching(&self) -> bool
Sourcepub fn generation(&self) -> u64
pub fn generation(&self) -> u64
Bumped when the code arrives, so what was made without it is made again.
Sourcepub fn defer(&self, load: fn())
pub fn defer(&self, load: fn())
How the program fetches the code: load starts the fetch, then calls
Self::install or Self::load_failed.
pub fn install(&self, value: T)
Sourcepub fn load_failed(&self)
pub fn load_failed(&self)
The fetch failed: the next use fetches again.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for Deferred<T>
impl<T> Forget for Deferred<T>
impl<T> Move for Deferred<T>
impl<T> RefUnwindSafe for Deferred<T>where
OnceLock<T>: RefUnwindSafe,
impl<T> Send for Deferred<T>
impl<T> Sync for Deferred<T>
impl<T> Unpin for Deferred<T>
impl<T> UnsafeUnpin for Deferred<T>where
OnceLock<T>: UnsafeUnpin,
impl<T> UnwindSafe for Deferred<T>where
OnceLock<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