Struct gidle_future::Handle[][src]

pub struct Handle<T> { /* fields omitted */ }

A handle to a running idle future.

You can use this handle to cancel the future and to retrieve the return value of a future that has finished.

If the Handle is dropped, the future will keep on running, and there will be no way to cancel it or get the return value.

Implementations

impl<T> Handle<T>[src]

pub fn cancel(self) -> Option<T>[src]

If the future has finished, it returns Some(t). If it has not finished, the future is dropped and it returns None.

pub fn has_finished(&self) -> bool[src]

Returns true if the future has finished, false otherwise. If it returns true then you can be sure that cancel will return Some(t).

pub async fn future(self) -> T[src]

Converts this handle into a future that is satisfied when the original job finishes. It returns the value returned by the original future.

Auto Trait Implementations

impl<T> !RefUnwindSafe for Handle<T>

impl<T> !Send for Handle<T>

impl<T> !Sync for Handle<T>

impl<T> Unpin for Handle<T>

impl<T> !UnwindSafe for Handle<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

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

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

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

Performs the conversion.