pub struct HeadlessHost<S: Spec, A: App<Spec = S>> {
pub caps: HostCaps,
pub dpr: f64,
pub ctx: RecordingRenderContext,
/* private fields */
}Expand description
A runtime driven by hand: no event loop, no wall clock, no GPU.
Fields§
§caps: HostCapsCapabilities reported in every Created echo.
dpr: f64Device pixel ratio reported for auto-answered spawned windows.
ctx: RecordingRenderContextThe paint recorder of the last advance (draw ops are inspectable
through it; it is reused, so it accumulates — call
RecordingRenderContext accessors per test section).
Implementations§
Source§impl<S: Spec, A: App<Spec = S>> HeadlessHost<S, A>
impl<S: Spec, A: App<Spec = S>> HeadlessHost<S, A>
Sourcepub fn new(app: A, cfg: RuntimeConfig) -> (Self, Handle<S>)
pub fn new(app: A, cfg: RuntimeConfig) -> (Self, Handle<S>)
A host and the app’s handle, with a no-op waker (design §9.1).
Sourcepub fn open_window(&mut self, size: SizePx, dpr: f64) -> WindowId
pub fn open_window(&mut self, size: SizePx, dpr: f64) -> WindowId
Open a window and run the ticks that settle its creation (the
Spawn command is auto-answered with a Created echo carrying
size and dpr). Returns the engine-assigned id.
Sourcepub fn input(&mut self, win: WindowId, event: InputEvent)
pub fn input(&mut self, win: WindowId, event: InputEvent)
Queue one input event for the next tick (hop 1 of §4.4).
Sourcepub fn advance(&mut self, dt: f64) -> &TickOutput
pub fn advance(&mut self, dt: f64) -> &TickOutput
Move the host clock by dt seconds, run one tick (plus one
settling tick when the tick’s host-bound commands needed an echo
answer), and paint every due frame request. The output of the whole
advance is kept for HeadlessHost::window_commands.
Sourcepub fn snapshot(&self) -> Arc<VisualSnapshot<S>> ⓘ
pub fn snapshot(&self) -> Arc<VisualSnapshot<S>> ⓘ
The last published snapshot.
Sourcepub fn window_commands(&self) -> &[(WindowId, WindowCommand)]
pub fn window_commands(&self) -> &[(WindowId, WindowCommand)]
The host-bound window commands of the last advance.
Sourcepub fn command_log(&self) -> &[(WindowId, WindowCommand)]
pub fn command_log(&self) -> &[(WindowId, WindowCommand)]
Every host-bound window command since construction, in order (the executor’s own log — assertions over a whole script read this, not the last tick’s slice).
Sourcepub fn runtime_mut(&mut self) -> &mut Runtime<S, A>
pub fn runtime_mut(&mut self) -> &mut Runtime<S, A>
The runtime, mutably.