Skip to main content

Job

Struct Job 

Source
pub struct Job<'a> {
    pub id: MaaId,
    /* private fields */
}
Expand description

An asynchronous operation handle.

Use this to track the status of controller, resource, and tasker operations.

Fields§

§id: MaaId

Implementations§

Source§

impl<'a> Job<'a>

Source

pub fn new(id: MaaId, status_fn: StatusFn<'a>, wait_fn: WaitFn<'a>) -> Self

Create a new Job with custom status/wait functions.

Source

pub fn for_tasker(tasker: &Tasker, id: MaaId) -> Job<'static>

Create a Job for a Tasker operation.

Source

pub fn for_controller(controller: &Controller, id: MaaId) -> Job<'static>

Create a Job for a Controller operation.

Source

pub fn for_resource(resource: &Resource, id: MaaId) -> Job<'static>

Create a Job for a Resource operation.

Source

pub fn wait(&self) -> MaaStatus

Block until the operation completes.

Source

pub fn status(&self) -> MaaStatus

Get the current status without blocking.

Source

pub fn succeeded(&self) -> bool

Returns true if the operation succeeded.

Source

pub fn failed(&self) -> bool

Returns true if the operation failed.

Source

pub fn running(&self) -> bool

Returns true if the operation is running.

Source

pub fn pending(&self) -> bool

Returns true if the operation is pending.

Source

pub fn done(&self) -> bool

Returns true if the operation has completed (success or failure).

Auto Trait Implementations§

§

impl<'a> Freeze for Job<'a>

§

impl<'a> !RefUnwindSafe for Job<'a>

§

impl<'a> Send for Job<'a>

§

impl<'a> Sync for Job<'a>

§

impl<'a> Unpin for Job<'a>

§

impl<'a> !UnwindSafe for Job<'a>

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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.