Type Alias Jit

Source
pub type Jit<T> = JitCore<T, Infallible>;

Aliased Type§

struct Jit<T> {
    inner: Arc<JitInner<T, Infallible>>,
}

Fields§

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

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

Source§

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

Source

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

Source

pub async fn get(&self) -> &T

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