Type Alias JitTryAnyhow

Source
pub type JitTryAnyhow<T> = JitCore<T, Error>;

Aliased Type§

struct JitTryAnyhow<T> {
    inner: Arc<JitInner<T, Error>>,
}

Fields§

§inner: Arc<JitInner<T, Error>>

Implementations

Source§

impl<T, E> JitCore<T, E>
where T: MaybeSend + 'static, E: MaybeSend + 'static + Display,

Source

pub fn new_try<Fut>(f: impl FnOnce() -> Fut + 'static + MaybeSend) -> Self
where Fut: Future<Output = Result<T, E>> + 'static + MaybeSend,

Create JitTry value, and spawn a future f that computes its value

Unlike normal Rust futures, the f executes eagerly (is spawned as a tokio task).

Source

pub async fn get_try(&self) -> Result<&T, OneTimeError<E>>

Get the reference to the value, potentially blocking for the initialization future to complete

Trait Implementations

Source§

impl<T, E> Clone for JitCore<T, E>
where T: Clone,

Source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug, E: Debug> Debug for JitCore<T, E>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more