Skip to main content

Job

Struct Job 

Source
pub struct Job<T> { /* private fields */ }
Expand description

A handle to a job that is running in the background.

Implementations§

Source§

impl<T> Job<T>

Source

pub fn get(self) -> T

Waits for the job to finish and returns its result.

§Panics

Panics if the job failed (e.g., the user’s function panicked) or if the system was shut down before the job could complete.

Source

pub fn peek(self) -> Option<T>

Checks if the job is finished without blocking.

Returns Some(result) if the job is done, or None if it’s still running.

§Panics

Panics if the job failed.

Source

pub fn is_done(&self) -> bool

Returns true if the job has finished (either completed or failed).

Auto Trait Implementations§

§

impl<T> !Sync for Job<T>

§

impl<T> Freeze for Job<T>
where TaskHandle<T>: Freeze,

§

impl<T> RefUnwindSafe for Job<T>

§

impl<T> Send for Job<T>
where TaskHandle<T>: Send,

§

impl<T> Unpin for Job<T>
where TaskHandle<T>: Unpin,

§

impl<T> UnsafeUnpin for Job<T>

§

impl<T> UnwindSafe for Job<T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.