pub struct BackgroundExecutor { /* private fields */ }Expand description
可插拔后台异步执行器句柄(轻量 Clone,面向 CPU 密集型计算、阻塞 I/O 与跨调度器定时)。
内部持有 Arc<dyn SchedulerBackend>:默认指向 NativeStdScheduler::global,
也可通过 BackgroundExecutor::with_backend 或 crate::engine::VeloxEngine::with_scheduler 切换至任意外部调度器。
Implementations§
Source§impl BackgroundExecutor
impl BackgroundExecutor
Sourcepub fn new() -> Self
pub fn new() -> Self
创建一个绑定默认内置 NativeStdScheduler 的后台执行器句柄。
Sourcepub fn with_backend(backend: Arc<dyn SchedulerBackend>) -> Self
pub fn with_backend(backend: Arc<dyn SchedulerBackend>) -> Self
创建一个绑定指定 SchedulerBackend 的后台执行器句柄。
Sourcepub fn backend(&self) -> &Arc<dyn SchedulerBackend> ⓘ
pub fn backend(&self) -> &Arc<dyn SchedulerBackend> ⓘ
获取底层 SchedulerBackend 引用。
Sourcepub fn scheduler_name(&self) -> &'static str
pub fn scheduler_name(&self) -> &'static str
返回当前绑定的调度器名称。
Sourcepub fn capabilities(&self) -> SchedulerCapabilities
pub fn capabilities(&self) -> SchedulerCapabilities
返回当前绑定的调度器能力元信息。
Trait Implementations§
Source§impl Clone for BackgroundExecutor
impl Clone for BackgroundExecutor
Source§impl Debug for BackgroundExecutor
impl Debug for BackgroundExecutor
Auto Trait Implementations§
impl !RefUnwindSafe for BackgroundExecutor
impl !UnwindSafe for BackgroundExecutor
impl Forget for BackgroundExecutor
impl Freeze for BackgroundExecutor
impl Move for BackgroundExecutor
impl Send for BackgroundExecutor
impl Sync for BackgroundExecutor
impl Unpin for BackgroundExecutor
impl UnsafeUnpin for BackgroundExecutor
Blanket Implementations§
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
当
condition 为 true 时执行闭包修饰自身,否则原样返回。Source§fn when_else(
self,
condition: bool,
then: impl FnOnce(Self) -> Self,
else_fn: impl FnOnce(Self) -> Self,
) -> Self
fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self
根据
condition 在两个修饰分支之间二选一。Source§fn when_some<O>(
self,
option: Option<O>,
then: impl FnOnce(Self, O) -> Self,
) -> Self
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。