Trait ExternalTaskQueue
pub trait ExternalTaskQueue:
Clone
+ Send
+ Sync
+ 'static {
// Required methods
fn try_push(&self, task: Runnable) -> Result<(), ExternalPushError>;
fn try_take_batch(&self) -> BatchAttempt;
fn len(&self) -> usize;
}Expand description
外部任务队列(external task queue)的共享访问。具体实现负责并发安全和所有权交接。
克隆(Clone)取得同一队列的共享访问,保留其原状态和权限。 接入不可等待新任务或队列容量;允许实现已说明的短时同步成本,不允许不可预期长等待。 实现者须保证所有生产/消费均纳入同一计数协议,不能将粗略估计伪装成精确数量。
Required Methods§
fn try_push(&self, task: Runnable) -> Result<(), ExternalPushError>
fn try_push(&self, task: Runnable) -> Result<(), ExternalPushError>
尝试接管一份Runnable;拒绝时返还原值,不能执行后再拒绝。
fn try_take_batch(&self) -> BatchAttempt
fn try_take_batch(&self) -> BatchAttempt
一次尝试获取当前有序批次。已取得的非空前缀以Ready交付。
若尚有在途的来源责任且本次没有可交付的任务,可返回WouldBlock。
不循环等待未来提交来填满批次。
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".