Skip to main content

TaskHandle

Struct TaskHandle 

Source
pub struct TaskHandle { /* private fields */ }
Expand description

任务句柄:drop 不会取消任务;需要取消显式调用 TaskHandle::cancel。

Implementations§

Source§

impl TaskHandle

Source

pub fn cancel(&self)

取消任务并立即丢弃 future;完成回调不会再触发。

Source

pub fn is_cancelled(&self) -> bool

Auto Trait Implementations§

§

impl !RefUnwindSafe for TaskHandle

§

impl !Send for TaskHandle

§

impl !Sync for TaskHandle

§

impl !UnwindSafe for TaskHandle

§

impl Forget for TaskHandle

§

impl Freeze for TaskHandle
where *const RcInner<RefCell<ExecutorInner>> is !null: Freeze, *const RcInner<Cell<bool>> is !null: Freeze, PhantomData<RcInner<Cell<bool>>>: Freeze,

§

impl Move for TaskHandle

§

impl Unpin for TaskHandle
where *const RcInner<RefCell<ExecutorInner>> is !null: Unpin, Rc<Cell<bool>>: Unpin,

§

impl UnsafeUnpin for TaskHandle
where *const RcInner<RefCell<ExecutorInner>> is !null: UnsafeUnpin, *const RcInner<Cell<bool>> is !null: UnsafeUnpin, PhantomData<RcInner<Cell<bool>>>: UnsafeUnpin,

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.