Skip to main content

TaskControl

Struct TaskControl 

Source
pub struct TaskControl<N: TaskNotifier> { /* private fields */ }
Expand description

查询与控制;普通释放不取消,不交出原Future或结果。

Implementations§

Source§

impl<N: TaskNotifier> TaskControl<N>

Source

pub fn query_handle(&self) -> TaskQuery

取得只读查询持有;不授予取消、唤醒、结果领取或原值访问权限。 用于服务自身统计;保留此持有不延后原Future的合法清理。

Source

pub fn id(&self) -> TaskId

读取原服务或任务(Task)的固定身份;不创建新身份或权限。

Source

pub fn snapshot(&self) -> TaskSnapshot

读取原任务(Task)的基本事实,多个原子量不保证全局同一瞬间;不代表物理队列位置。

Source

pub fn cancel(&self)

提出原生取消并安排检查;不等待原Future清理。

Source

pub fn wake(&self)

通过原任务唤醒路径安排后续推进,不复活结束任务。

Source

pub fn waker(&self) -> Waker

取得同一原任务(Task)的标准唤醒器(Waker),可克隆并跨线程唤醒。 只安排原任务后续检查,不直接轮询(poll)或访问原异步计算(Future),不复活结束任务。

Source

pub fn cancel_and_wait(&self) -> TaskCancelWait<N> ⓘ

惰性等待;构造本身不提出取消请求。

Source

pub fn cancel_and_wait_from(&self, waiter: &ExternalWaiter) -> TaskCancelWait<N> ⓘ

使用已有可信外部等待者(external waiter)身份构造惰性取消等待,构造本身不请求取消。 受管任务(Task)内仍以实际当前任务身份为准;首次挂起(Pending)后实际等待者身份不得改变。 首次轮询(poll)沿原生身份检查决定能否登记;拒绝不冒充已发送取消请求。 释放等待只放弃本份等待,不撤销此前已记录的取消。

Trait Implementations§

Source§

impl<N: TaskNotifier> Clone for TaskControl<N>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl<N> !RefUnwindSafe for TaskControl<N>

§

impl<N> !UnwindSafe for TaskControl<N>

§

impl<N> Forget for TaskControl<N>

§

impl<N> Freeze for TaskControl<N>
where N: Freeze,

§

impl<N> Move for TaskControl<N>

§

impl<N> Send for TaskControl<N>

§

impl<N> Sync for TaskControl<N>

§

impl<N> Unpin for TaskControl<N>
where N: Unpin,

§

impl<N> UnsafeUnpin for TaskControl<N>
where N: 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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> OpaqueAttachment for T
where T: Send + Sync + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.