Struct glib::JoinHandle
source · pub struct JoinHandle<T> { /* private fields */ }
Expand description
A handle to a task running on a MainContext
.
Like std::thread::JoinHandle
for a task rather than a thread. The return value from the
task can be retrieved by awaiting on this object. Dropping the handle “detaches” the task,
allowing it to complete but discarding the return value.
Implementations§
source§impl<T> JoinHandle<T>
impl<T> JoinHandle<T>
sourcepub fn as_raw_source_id(&self) -> Option<u32>
pub fn as_raw_source_id(&self) -> Option<u32>
Returns the internal source ID.
Returns None
if the handle was aborted already.
sourcepub fn into_source_id(self) -> Result<SourceId, Self>
pub fn into_source_id(self) -> Result<SourceId, Self>
Safely converts the handle into a SourceId
.
Can be used to discard the return value while still retaining the ability to abort the
underlying task. Returns Err(self)
if the handle was aborted already.
Trait Implementations§
source§impl<T: Debug> Debug for JoinHandle<T>
impl<T: Debug> Debug for JoinHandle<T>
source§impl<T: 'static> FusedFuture for JoinHandle<T>
impl<T: 'static> FusedFuture for JoinHandle<T>
source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
true
if the underlying future should no longer be polled.source§impl<T: 'static> Future for JoinHandle<T>
impl<T: 'static> Future for JoinHandle<T>
impl<T: Send> Send for JoinHandle<T>
Safety: We can’t rely on the auto implementation because we are retrieving
the result as a Box<dyn Any + 'static>
from the Source
. We need to
rely on type erasure here, so we have to manually assert the Send bound too.
Auto Trait Implementations§
impl<T> !Freeze for JoinHandle<T>
impl<T> !RefUnwindSafe for JoinHandle<T>
impl<T> !Sync for JoinHandle<T>
impl<T> Unpin for JoinHandle<T>
impl<T> !UnwindSafe for JoinHandle<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> FutureExt for T
impl<T> FutureExt for T
§fn map<U, F>(self, f: F) -> Map<Self, F>
fn map<U, F>(self, f: F) -> Map<Self, F>
§fn map_into<U>(self) -> MapInto<Self, U>
fn map_into<U>(self) -> MapInto<Self, U>
§fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
fn then<Fut, F>(self, f: F) -> Then<Self, Fut, F>
f
. Read more§fn left_future<B>(self) -> Either<Self, B>
fn left_future<B>(self) -> Either<Self, B>
§fn right_future<A>(self) -> Either<A, Self>
fn right_future<A>(self) -> Either<A, Self>
§fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
fn into_stream(self) -> IntoStream<Self>where
Self: Sized,
§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
§fn flatten_stream(self) -> FlattenStream<Self>
fn flatten_stream(self) -> FlattenStream<Self>
§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 more§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
§fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
fn catch_unwind(self) -> CatchUnwind<Self>where
Self: Sized + UnwindSafe,
§fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
fn boxed<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + Send + 'a>>
§fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
fn boxed_local<'a>(self) -> Pin<Box<dyn Future<Output = Self::Output> + 'a>>where
Self: Sized + 'a,
§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 = ()
>.§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
>.