Struct Completer
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§
§impl<T> Completer<T>
impl<T> Completer<T>
pub 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.
pub 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.
pub 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> Freeze for Completer<T>
impl<T> RefUnwindSafe for Completer<T>
impl<T> Send for Completer<T>where
T: Send,
impl<T> Sync for Completer<T>where
T: Send,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for 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