pub(crate) struct OnceAsync<T> {
fut: Mutex<Option<SharedResult<OnceFut<T>>>>,
}Expand description
A OnceAsync runs an async closure once, where multiple calls to
OnceAsync::try_once return a OnceFut that resolves to the result of the
same computation.
This is useful for joins where the results of one child are needed to proceed with multiple output stream
For example, in a hash join, one input is buffered and shared across potentially multiple output partitions. Each output partition must wait for the hash table to be built before proceeding.
Each output partition waits on the same OnceAsync before proceeding.
Fields§
§fut: Mutex<Option<SharedResult<OnceFut<T>>>>Implementations§
Source§impl<T: 'static> OnceAsync<T>
impl<T: 'static> OnceAsync<T>
Sourcepub(crate) fn try_once<F, Fut>(&self, f: F) -> Result<OnceFut<T>>
pub(crate) fn try_once<F, Fut>(&self, f: F) -> Result<OnceFut<T>>
If this is the first call to this function on this object, will invoke
f to obtain a future and return a OnceFut referring to this. f
may fail, in which case its error is returned.
If this is not the first call, will return a OnceFut referring
to the same future as was returned by the first call - or the same
error if the initial call to f failed.
Trait Implementations§
Auto Trait Implementations§
impl<T> !Freeze for OnceAsync<T>
impl<T> !RefUnwindSafe for OnceAsync<T>
impl<T> Send for OnceAsync<T>
impl<T> Sync for OnceAsync<T>
impl<T> Unpin for OnceAsync<T>
impl<T> !UnwindSafe for OnceAsync<T>
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more