pub trait Platform {
// Required method
fn step_platform(
&mut self,
engine: &mut VeloxEngine,
dt_ms: u16,
) -> PlatformControlFlow;
// Provided methods
fn duration_since_start(&self) -> Duration { ... }
fn run_event_loop(self, engine: VeloxEngine)
where Self: Sized { ... }
}Expand description
核心平台抽象接口。
负责提供单调时钟源、平台输入事件收集、显示表面刷屏以及主事件循环调度。
Required Methods§
Sourcefn step_platform(
&mut self,
engine: &mut VeloxEngine,
dt_ms: u16,
) -> PlatformControlFlow
fn step_platform( &mut self, engine: &mut VeloxEngine, dt_ms: u16, ) -> PlatformControlFlow
单步执行一次平台事件采集、状态更新与按需脏区刷屏,返回下一次循环的 PlatformControlFlow 调度策略。
Provided Methods§
Sourcefn duration_since_start(&self) -> Duration
fn duration_since_start(&self) -> Duration
返回自平台启动以来的单调递增时长(桌面端默认由 Instant 提供)。
Sourcefn run_event_loop(self, engine: VeloxEngine)where
Self: Sized,
fn run_event_loop(self, engine: VeloxEngine)where
Self: Sized,
启动平台主事件循环,接管 VeloxEngine 直至收到 PlatformControlFlow::Exit。
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".