Skip to main content

CancelRequestStatus

Enum CancelRequestStatus 

pub enum CancelRequestStatus {
    NotRecorded,
    Recorded,
}
Expand description

描述目标任务(Task)是否已经记录取消请求(cancellation request)。

本值描述目标已经发生的事实,不描述调用者是否尝试发送请求, 也不说明任务(Task)最终是否因取消(cancellation)退出。 任务(Task)可能在记录请求后,仍从已开始的轮询(poll)返回完成就绪(Ready)。 同一目标已记录的事实不会被后续状态(state)撤销;本值只是历史描述,不会自行更新。

§使用示例(Usage)

use pi_async_task::definitions::CancelRequestStatus;

let description = CancelRequestStatus::Recorded;
assert_eq!(description, CancelRequestStatus::Recorded);

构造本值不会向任何任务(Task)发送请求,也不能证明实际目标已记录请求。 本类型(type)不持有目标、不提供实时查询,也不授予执行或控制权限。

§成本与安全(Cost and safety)

普通构造、复制(copy)及相等比较均为 O(1),无需堆分配、锁(lock)、 异步等待(await)或用户回调(callback),不改变实际任务(Task)。 本值可跨线程转移(Send)或通过共享引用在线程(thread)间读取(Sync)。 调试(debug)输出取决于格式化(formatting)目标;不保证其固定成本或无失败。 不保证内存布局(memory layout)、判别值(discriminant)数值或稳定外部编码。

Variants§

§

NotRecorded

目标尚未记录取消请求(cancellation request)。

不代表外部没有尝试发送,也不代表目标此后一定会接收。

§

Recorded

目标确已记录取消请求(cancellation request)。

不保证当前轮询(poll)已经退出、后续取消(cancellation)必定成功, 或原异步计算(Future)已经完成析构(drop)。

Trait Implementations§

Source§

impl Clone for CancelRequestStatus

Source§

fn clone(&self) -> CancelRequestStatus

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
Source§

impl Copy for CancelRequestStatus

Source§

impl Debug for CancelRequestStatus

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl Eq for CancelRequestStatus

Source§

impl PartialEq for CancelRequestStatus

Source§

fn eq(&self, other: &CancelRequestStatus) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for CancelRequestStatus

Auto Trait Implementations§

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<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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.