Skip to main content

MpscTaskQueueHandle

Struct MpscTaskQueueHandle 

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

同一默认MPSC来源的受限共享句柄(shared handle),支持Clone + Send + Sync。

提交及获取通过ExternalTaskQueue,另提供单项获取和空数量查询。 克隆(Clone)不创建新来源、不复制任务(Task)、不取得clear/close管理权限。 管理对象释放后,本句柄(handle)仍可合法查询或拒绝迟到提交,不会重新开放来源。

Implementations§

§

impl MpscTaskQueueHandle

pub fn try_take_one(&self) -> MpscTake

一次非等待获取原Runnable,不为单项建立批次容器(batch container)。

Ready保留原身份和线程归属。Empty只说明本次未取到任务。 WouldBlock表示本次未取到任务且仍有来源责任,例如发布未完成或清理未结清。 消费者(Consumer)占用为Busy,停收后为Closed。 不轮询(poll)、绑定或改变原任务(Task)语义。

pub fn is_empty(&self) -> bool

O(1)查询本次逻辑数量是否为零;与len口径相同,不推进业务或清理。 不与其它读取组成全局同一瞬间,也不证明来源关闭完成。

Trait Implementations§

§

impl Clone for MpscTaskQueueHandle

§

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
§

impl ExternalTaskQueue for MpscTaskQueueHandle

§

fn try_push(&self, task: Runnable) -> RawResult<(), ExternalPushError>

尝试接管同一原Runnable;拒绝返回原值,不取消(cancel)或隐式接纳任务(Task)。

缺链接(link)为LinkMissing;停收为Closed;数量上限为CountOverflow; 接收登记竞争预算耗尽为Busy。只报告本次实际检查出的原因,不承诺并发错误优先级。 不新增每任务分配、锁(lock)或强引用(strong reference),登记成功后只发布一次。

§

fn try_take_batch(&self) -> BatchAttempt

一次取得开始时数量上界内的有限业务批次,保持原生获取顺序。

一次Consumer,不等发布或后来提交;非空前缀保持Ready,未取到才分别判断其它分类。 结果在返回前已独立拥有原值,不携带来源借用。批次空间先于取出准备,成本与上界相关。

§

fn len(&self) -> usize

O(1)取得本来源已接收尚未交付或合法清理的数量样本。 包括已登记未发布和内部待清理原值,不含stub、终点或已经交出的独立结果。

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