Struct futures_util::future::RemoteHandle
source · pub struct RemoteHandle<T> {
rx: Receiver<Result<T>>,
keep_running: Arc<AtomicBool>,
}
Expand description
The handle to a remote future returned by
remote_handle
. When you drop this,
the remote future will be woken up to be dropped by the executor.
§Unwind safety
When the remote future panics, Remote will catch the unwind and transfer it to
the thread where RemoteHandle
is being awaited. This is good for the common
case where Remote is spawned on a threadpool. It is unlikely that other code
in the executor working thread shares mutable data with the spawned future and we
preserve the executor from losing its working threads.
If you run the future locally and send the handle of to be awaited elsewhere, you must be careful with regard to unwind safety because the thread in which the future is polled will keep running after the panic and the thread running the RemoteHandle will unwind.
Fields§
§rx: Receiver<Result<T>>
§keep_running: Arc<AtomicBool>
Implementations§
source§impl<T> RemoteHandle<T>
impl<T> RemoteHandle<T>
Trait Implementations§
source§impl<T: Debug> Debug for RemoteHandle<T>
impl<T: Debug> Debug for RemoteHandle<T>
source§impl<T: 'static> Future for RemoteHandle<T>
impl<T: 'static> Future for RemoteHandle<T>
Auto Trait Implementations§
impl<T> Freeze for RemoteHandle<T>
impl<T> !RefUnwindSafe for RemoteHandle<T>
impl<T> Send for RemoteHandle<T>where
T: Send,
impl<T> Sync for RemoteHandle<T>where
T: Send,
impl<T> Unpin for RemoteHandle<T>
impl<T> !UnwindSafe for RemoteHandle<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> 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 catch_unwind(self) -> CatchUnwind<Self> ⓘwhere
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self> ⓘwhere
Self: Sized + UnwindSafe,
source§fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
fn remote_handle(self) -> (Remote<Self>, RemoteHandle<Self::Output>)where
Self: Sized,
()
on completion and sends
its output to another future on a separate task. Read moresource§fn boxed<'a>(self) -> BoxFuture<'a, Self::Output>
fn boxed<'a>(self) -> BoxFuture<'a, Self::Output>
source§fn boxed_local<'a>(self) -> LocalBoxFuture<'a, Self::Output>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> LocalBoxFuture<'a, Self::Output>where
Self: Sized + 'a,
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
>.