pub struct Completer<T> { /* private fields */ }Expand description
The producing end of a Pending. Dropping it without completing
abandons the answer, which the receiving end observes.
Implementations§
Source§impl<T> Completer<T>
impl<T> Completer<T>
Sourcepub fn is_abandoned(&self) -> bool
pub fn is_abandoned(&self) -> bool
Whether nobody is waiting any more: the Pending was dropped —
or, through Pending::map, the mapped answer was — so the work
behind this answer may be skipped.
Sourcepub fn abandoned(&self) -> Abandoned<'_, T> ⓘ
pub fn abandoned(&self) -> Abandoned<'_, T> ⓘ
Resolves once nobody can observe the answer any more — what
Self::is_abandoned reports, as a future, so work behind the
answer can stop the moment its asker goes away instead of checking
on a timer. Runtime-agnostic: dropping the Pending (or, through
Pending::map, the mapped answer) wakes it. An answer handed to a
plain Pending::then continuation is always wanted, so this never
resolves for it.
Sourcepub fn complete(self, value: T)
pub fn complete(self, value: T)
Deliver the answer. A continuation attached with
Pending::then runs here, on the completing thread.
Trait Implementations§
Auto Trait Implementations§
impl<T> Forget for Completer<T>
impl<T> Freeze for Completer<T>
impl<T> Move for Completer<T>
impl<T> RefUnwindSafe for Completer<T>
impl<T> Send for Completer<T>
impl<T> Sync for Completer<T>
impl<T> Unpin for Completer<T>
impl<T> UnsafeUnpin for Completer<T>
impl<T> UnwindSafe for Completer<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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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