pub struct SingleCpuExecutor { /* private fields */ }Expand description
单CPU异步执行器
Implementations§
Source§impl SingleCpuExecutor
impl SingleCpuExecutor
Sourcepub fn with_timeout(timeout: Duration) -> Self
pub fn with_timeout(timeout: Duration) -> Self
使用自定义超时时间创建执行器
Sourcepub fn spawn<F, T>(&self, future: F) -> TaskHandle
pub fn spawn<F, T>(&self, future: F) -> TaskHandle
生成异步任务
Sourcepub fn wake_by_id(&self, task_id: TaskId) -> bool
pub fn wake_by_id(&self, task_id: TaskId) -> bool
唤醒指定任务
Sourcepub fn run_until_completion(&self)
pub fn run_until_completion(&self)
运行直到所有任务完成
Sourcepub fn has_pending_tasks(&self) -> bool
pub fn has_pending_tasks(&self) -> bool
检查是否有待处理的任务
Sourcepub fn task_count(&self) -> usize
pub fn task_count(&self) -> usize
获取当前任务数量
Sourcepub fn queued_task_count(&self) -> usize
pub fn queued_task_count(&self) -> usize
获取队列中的任务数量
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
检查执行器是否正在运行
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for SingleCpuExecutor
impl !RefUnwindSafe for SingleCpuExecutor
impl Send for SingleCpuExecutor
impl Sync for SingleCpuExecutor
impl Unpin for SingleCpuExecutor
impl !UnwindSafe for SingleCpuExecutor
Blanket Implementations§
Source§impl<T> Background for T
impl<T> Background for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more