Trait ExternalTaskQueue
pub trait ExternalTaskQueue:
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
外部队列(queue)接口;具体实现负责并发安全和所有权交接。
接入不可等待新任务或队列容量;允许实现已说明的短时同步成本,不允许不可预期长等待。 实现者须保证所有生产/消费均纳入同一计数协议,不能将粗略估计伪装成精确数量。
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
一次获取当前有序批次;不能循环等待未来提交来填满批次。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".