Skip to main content

ExecutorLocal

Struct ExecutorLocal 

pub struct ExecutorLocal<T: ExecutorTimer + 'static> { /* private fields */ }
Expand description

本地设施(local facilities)的弱访问目标;不实现Send/Sync,不能跨线程借入。 公开给框架实现者用于静态接入,不向最终运行时(runtime)用户导出其实例。 释放(drop)时在原所属线程(owner thread)完成实际退出,仍在进行的同步活动可延迟最终释放。 原任务域与来源沿自身约定清理,首次恐慌(panic)继续传播;不可把关闭请求当成功确认。

Implementations§

§

impl<T: ExecutorTimer + 'static> ExecutorLocal<T>

pub fn runtime_id(&self) -> RuntimeId

pub fn with_owner<R>(&self, action: impl FnOnce(&TaskThread) -> R) -> Result<R>

同步框架访问;不允许返回owner借用。只读Ref可跨本次调用,不持其它队列借用。

pub fn try_push( &self, task: Runnable, front: bool, ) -> RawResult<(), QueuePushError>

原线程尾插/头插,尚未接纳的create_local可排队;不在此poll或提前admit。 正常新入队用同一ExecutorState记数,拒绝返还原值。

pub fn try_push_timer( &self, deadline: T::Instant, item: T::Item, ) -> RawResult<T::Key, TimerSubmitError<T::Item>>

同源定时本地提交;不为Item添加Send/Sync,不刷新时钟。

Trait Implementations§

§

impl<T: ExecutorTimer + 'static> Drop for ExecutorLocal<T>

§

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§

§

impl<T> !Freeze for ExecutorLocal<T>

§

impl<T> !RefUnwindSafe for ExecutorLocal<T>

§

impl<T> !Send for ExecutorLocal<T>

§

impl<T> !Sync for ExecutorLocal<T>

§

impl<T> !UnwindSafe for ExecutorLocal<T>

§

impl<T> Forget for ExecutorLocal<T>

§

impl<T> Move for ExecutorLocal<T>

§

impl<T> Unpin for ExecutorLocal<T>
where RefCell<Option<T>>: Unpin,

§

impl<T> UnsafeUnpin for ExecutorLocal<T>

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.