Skip to main content

WeightedSerialParQueue

Struct WeightedSerialParQueue 

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

支持串行和加权并行选择的外部任务队列(external task queue)。

管理者只能按值绑定给一个独立执行器(executor)。共享句柄(shared handle) 可以跨线程提交。同一串行队列(serial queue)中,普通取出已交付的前项 要先析构(drop)原异步计算(Future),才能再取后项。结果句柄(result handle)可继续保留。

clear 每次清理有限数量,可能取到调用开始后接收的任务。清理与普通取出 可能等待当次遇到的原生发布及重试。清理取出的任务会先释放原生句柄,再析构任务。 显式 close 永久停收。清理完成后 返回错误,原因是上游原生池分配会存续到进程退出。

Implementations§

Source§

impl WeightedSerialParQueue

Source

pub fn new() -> WeightedSerialParQueue

创建空队列。每次构造会保留一份原生池分配至进程退出。

上游分配失败沿用全局分配器(global allocator)的行为。

Trait Implementations§

Source§

impl Default for WeightedSerialParQueue

Source§

fn default() -> WeightedSerialParQueue

Returns the “default value” for a type. Read more
Source§

impl Drop for WeightedSerialParQueue

Source§

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

impl ExternalQueueManager for WeightedSerialParQueue

Source§

fn close(&mut self) -> Result<QueueCleanupProgress, Report<ErrorKind>>

永久停收并推进有限清理。尚有清理责任时返回 Busy,完成后返回说明 原生池分配保留到进程退出的 Unsupported。

Source§

type Handle = WeightedSerialParQueueHandle

同一原来源的普通共享访问;不是另一队列(queue)或另一份计数。
Source§

fn handle(&self) -> <WeightedSerialParQueue as ExternalQueueManager>::Handle

取得同一来源的受限共享句柄(shared handle),不重置已关闭状态(state)。
Source§

fn clear(&mut self) -> Result<QueueCleanupProgress, Report<ErrorKind>>

有限清理本次固定范围,接收仍保持原状,不轮询(poll)业务。 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> OpaqueAttachment for T
where T: Send + Sync + 'static,

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.