Skip to main content

ManualScheduler

Struct ManualScheduler 

Source
pub struct ManualScheduler { /* private fields */ }
Expand description

确定性虚拟时钟与手动步进调度器(零真睡、零线程、100% 可复现)。

Implementations§

Source§

impl ManualScheduler

Source

pub fn new() -> Arc<Self> ⓘ

创建一个从 0ms 开始计时的确定性调度器(返回 Arc<Self> 便于同时传给引擎与测试代码)。

Source

pub fn current_ms(&self) -> u64

返回当前虚拟单调时间戳(毫秒)。

Source

pub fn now_ms(&self) -> u64

返回当前虚拟单调时间戳(毫秒,current_ms 别名,避免同时导入多个调度 trait 时的调用二义性)。

Source

pub fn advance(&self, duration: Duration) -> usize

将虚拟时钟向前推进 duration,并按截止时间先后顺序唤醒全部已到期定时器,返回唤醒数量。

Source

pub fn run_until_stalled(&self) -> usize

排空当前已就绪的后台任务队列直至全部挂起或完成,返回实际 poll 的任务次数。

Source

pub fn drive_engine(&self, engine: &mut VeloxEngine) -> usize

交替驱动后台任务与 VeloxEngine 前景协程,直至两者均进入静默等待,返回推进轮数。

Source

pub fn pending_timer_count(&self) -> usize

返回当前仍在等待虚拟时钟推进的定时器数量。

Source

pub fn pending_background_count(&self) -> usize

返回当前排队待执行的后台任务数量。

Source

pub fn wake_signal(&self) -> &UiWakeSignal

获取关联的黏性唤醒信号句柄。

Source

pub fn notify_event(&self)

主动触发一次异步事件循环唤醒。

Trait Implementations§

Source§

impl AsyncDriver for ManualScheduler

Source§

fn capabilities(&self) -> SchedulerCapabilities

返回当前调度器的能力元信息。
Source§

fn wait_for_event(&self) -> impl Future<Output = ()>

当画面静止(PlatformControlFlow::Wait)时挂起等待外部事件(输入事件、后台异步完成等)唤醒。 Read more
Source§

fn yield_now(&self) -> impl Future<Output = ()>

主动向当前异步执行器让出一次调度片。
Source§

impl Clone for ManualScheduler

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl SchedulerBackend for ManualScheduler

Source§

fn name(&self) -> &'static str

调度器名称(用于日志与能力诊断,如 "velox-native-std" / "velox-manual" / "tokio")。
Source§

fn capabilities(&self) -> SchedulerCapabilities

返回当前调度器的能力描述符。
Source§

fn spawn_background(&self, fut: BoxFuture<'static, ()>)

在后台执行器中派发一个无返回值的 Send + 'static 异步任务。
Source§

fn timer(&self, duration: Duration) -> Timer ⓘ

创建一个由当前调度器时钟驱动的非阻塞定时器 Timer。
Source§

fn now_ms(&self) -> u64

获取当前调度器单调时间戳(毫秒)。
Source§

impl SchedulerClock for ManualScheduler

Source§

fn now_ms(&self) -> u64

返回单调递增的当前时间戳(毫秒)。
Source§

fn sleep(&self, duration: Duration) -> impl Future<Output = ()>

非阻塞异步等待指定时长 duration。

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> FluentBuilder for T

Source§

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

根据 condition 在两个修饰分支之间二选一。
Source§

fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self

当 option 为 Some(value) 时执行闭包修饰自身,否则原样返回。
Source§

fn when_none<O>( self, option: &Option<O>, then: impl FnOnce(Self) -> Self, ) -> Self

当 option 为 None 时执行闭包修饰自身,否则原样返回。
Source§

fn apply<U>(self, f: impl FnOnce(Self) -> U) -> U

通用管道映射变换(避免与 Iterator::map / Option::map 重名)。
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,