Struct xtra::SendFuture
source · pub struct SendFuture<F, S> { /* private fields */ }
Expand description
A Future
that represents the state of sending a message to an actor.
By default, a SendFuture
will resolve to the return value of the handler (see Handler::Return
).
This behaviour can be changed by calling detach
.
A detached SendFuture
will resolve once the message is successfully queued into the actor’s mailbox and resolve to the Receiver
.
The Receiver
itself is a future that will resolve to the return value of the Handler
.
In other words, detaching a SendFuture
allows the current task to continue while the corresponding Handler
of the actor processes the message.
In case an actor’s mailbox is bounded, SendFuture
will yield Pending
until the message is queued successfully.
This allows an actor to exercise backpressure on its users.
Implementations§
source§impl<F, R> SendFuture<F, ResolveToHandlerReturn<R>>where
F: Future,
impl<F, R> SendFuture<F, ResolveToHandlerReturn<R>>where
F: Future,
sourcepub fn detach(self) -> SendFuture<F, ResolveToReceiver<R>> ⓘ
pub fn detach(self) -> SendFuture<F, ResolveToReceiver<R>> ⓘ
Detaches this future from receiving the response of the handler.
Awaiting a detached SendFuture
will queue the message in the actor’s mailbox and return you another Future
for receiving the response.
Trait Implementations§
source§impl<F> Future for SendFuture<F, Broadcast>
impl<F> Future for SendFuture<F, Broadcast>
source§impl<R, F> Future for SendFuture<F, ResolveToHandlerReturn<R>>
impl<R, F> Future for SendFuture<F, ResolveToHandlerReturn<R>>
source§impl<R, F> Future for SendFuture<F, ResolveToReceiver<R>>
impl<R, F> Future for SendFuture<F, ResolveToReceiver<R>>
Auto Trait Implementations§
impl<F, S> RefUnwindSafe for SendFuture<F, S>where
F: RefUnwindSafe,
S: RefUnwindSafe,
impl<F, S> Send for SendFuture<F, S>
impl<F, S> Sync for SendFuture<F, S>
impl<F, S> Unpin for SendFuture<F, S>
impl<F, S> UnwindSafe for SendFuture<F, S>where
F: UnwindSafe,
S: UnwindSafe,
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<F> FutureExt for F
impl<F> FutureExt for F
§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
source§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
source§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read moresource§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
source§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
source§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
source§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
poll
will never again be called once it has
completed. This method can be used to turn any Future
into a
FusedFuture
. Read moresource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
source§fn unit_error(self) -> UnitError<Self>where
Self: Sized,
fn unit_error(self) -> UnitError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = ()
>.source§fn never_error(self) -> NeverError<Self>where
Self: Sized,
fn never_error(self) -> NeverError<Self>where
Self: Sized,
Future<Output = T>
into a
TryFuture<Ok = T, Error = Never
>.