Skip to main content

DriveScope

Struct DriveScope 

pub struct DriveScope { /* private fields */ }
Expand description

本线程的一次活动推进范围,包含轮询(poll)、同步钩子(hook)和必要退出收尾。 不同于公共服务选择和原服务的全局推进状态,不授予队列或任务(Task)访问权限。 释放(drop)恢复原活动标记;正常返回和恐慌(panic)展开均配对处理。

Implementations§

§

impl DriveScope

pub fn enter() -> Self

已有活动推进或原生当前Task时,在首次新根poll前panic。

pub fn is_active() -> bool

只读当前线程活动标记,不取得推进权,也不查询某服务的全局is_driving。 线程局部存储(TLS)不可访问时保守返回禁止新推进的结果。

Trait Implementations§

§

impl Drop for DriveScope

§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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> 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.