pub struct ManualScheduler { /* private fields */ }Expand description
确定性虚拟时钟与手动步进调度器(零真睡、零线程、100% 可复现)。
Implementations§
Source§impl ManualScheduler
impl ManualScheduler
Sourcepub fn current_ms(&self) -> u64
pub fn current_ms(&self) -> u64
返回当前虚拟单调时间戳(毫秒)。
Sourcepub fn advance(&self, duration: Duration) -> usize
pub fn advance(&self, duration: Duration) -> usize
将虚拟时钟向前推进 duration,并按截止时间先后顺序唤醒全部已到期定时器,返回唤醒数量。
Sourcepub fn run_until_stalled(&self) -> usize
pub fn run_until_stalled(&self) -> usize
排空当前已就绪的后台任务队列直至全部挂起或完成,返回实际 poll 的任务次数。
Sourcepub fn drive_engine(&self, engine: &mut VeloxEngine) -> usize
pub fn drive_engine(&self, engine: &mut VeloxEngine) -> usize
交替驱动后台任务与 VeloxEngine 前景协程,直至两者均进入静默等待,返回推进轮数。
Sourcepub fn pending_timer_count(&self) -> usize
pub fn pending_timer_count(&self) -> usize
返回当前仍在等待虚拟时钟推进的定时器数量。
Sourcepub fn pending_background_count(&self) -> usize
pub fn pending_background_count(&self) -> usize
返回当前排队待执行的后台任务数量。
Sourcepub fn wake_signal(&self) -> &UiWakeSignal
pub fn wake_signal(&self) -> &UiWakeSignal
获取关联的黏性唤醒信号句柄。
Sourcepub fn notify_event(&self)
pub fn notify_event(&self)
主动触发一次异步事件循环唤醒。
Trait Implementations§
Source§impl AsyncDriver for ManualScheduler
impl AsyncDriver for ManualScheduler
Source§fn capabilities(&self) -> SchedulerCapabilities
fn capabilities(&self) -> SchedulerCapabilities
返回当前调度器的能力元信息。
Source§impl Clone for ManualScheduler
impl Clone for ManualScheduler
Source§impl SchedulerBackend for ManualScheduler
impl SchedulerBackend for ManualScheduler
Source§fn name(&self) -> &'static str
fn name(&self) -> &'static str
调度器名称(用于日志与能力诊断,如
"velox-native-std" / "velox-manual" / "tokio")。Source§fn capabilities(&self) -> SchedulerCapabilities
fn capabilities(&self) -> SchedulerCapabilities
返回当前调度器的能力描述符。
Source§fn spawn_background(&self, fut: BoxFuture<'static, ()>)
fn spawn_background(&self, fut: BoxFuture<'static, ()>)
在后台执行器中派发一个无返回值的
Send + 'static 异步任务。Auto Trait Implementations§
impl Forget for ManualScheduler
impl Freeze for ManualScheduler
impl Move for ManualScheduler
impl RefUnwindSafe for ManualScheduler
impl Send for ManualScheduler
impl Sync for ManualScheduler
impl Unpin for ManualScheduler
impl UnsafeUnpin for ManualScheduler
impl UnwindSafe for ManualScheduler
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) 时执行闭包修饰自身,否则原样返回。