Struct ThreadHandle
pub struct ThreadHandle<T> { /* private fields */ }Expand description
A handle to a thread running on a ThreadPool.
Like std::thread::JoinHandle for a GLib thread. The return value from the task can be
retrieved by calling ThreadHandle::join. Dropping the handle “detaches” the thread,
allowing it to complete but discarding the return value.
Implementations§
§impl<T> ThreadHandle<T>
impl<T> ThreadHandle<T>
pub fn join(self) -> Result<T, Box<dyn Any + Send>>
pub fn join(self) -> Result<T, Box<dyn Any + Send>>
Waits for the associated thread to finish.
Blocks until the associated thread returns. Returns Ok with the value returned from the
thread, or Err if the thread panicked. This function will return immediately if the
associated thread has already finished.
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for ThreadHandle<T>
impl<T> RefUnwindSafe for ThreadHandle<T>
impl<T> Send for ThreadHandle<T>where
T: Send,
impl<T> !Sync for ThreadHandle<T>
impl<T> Unpin for ThreadHandle<T>
impl<T> UnwindSafe for ThreadHandle<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
Mutably borrows from an owned value. Read more
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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> ⓘ
Converts
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> ⓘ
Converts
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