pub struct HeadlessRenderer { /* private fields */ }Expand description
A deterministic, non-interactive Tessera renderer session.
Frames advance on a virtual clock, so a fixed input script always produces the same output regardless of wall-clock timing.
Implementations§
Source§impl HeadlessRenderer
impl HeadlessRenderer
Sourcepub fn gpu_instance(&self) -> &Instance
pub fn gpu_instance(&self) -> &Instance
Returns the GPU instance for resource observations across renderer lifetimes.
Sourcepub fn resource_snapshot(&self) -> Result<Value, PollError>
pub fn resource_snapshot(&self) -> Result<Value, PollError>
Waits for GPU completion and reports held resource handles and allocator usage.
Allocator reservations include unused capacity and are not resident VRAM. Unsupported byte counters and allocator reports are null.
Sourcepub fn graphics_work(&self) -> GraphicsWorkDiagnostics
pub fn graphics_work(&self) -> GraphicsWorkDiagnostics
Captures cumulative resource creation and uploads performed by pipelines.
Sourcepub fn frame_graphics_work(&self) -> &GraphicsWorkDiagnostics
pub fn frame_graphics_work(&self) -> &GraphicsWorkDiagnostics
Returns actual resource operations performed in the last completed frame.
Sourcepub fn session_id(&self) -> RuntimeSessionId
pub fn session_id(&self) -> RuntimeSessionId
Returns the runtime identity shared by this session’s snapshots and diagnostics.
Sourcepub fn run<R>(&self, work: impl FnOnce() -> R) -> R
pub fn run<R>(&self, work: impl FnOnce() -> R) -> R
Runs state or controller operations in this renderer’s session.
Sourcepub fn new<Output: 'static>(
entry: Box<dyn Fn() -> Output>,
modules: Vec<Box<dyn RenderModule>>,
config: HeadlessConfig,
) -> Result<Self, HeadlessError>
pub fn new<Output: 'static>( entry: Box<dyn Fn() -> Output>, modules: Vec<Box<dyn RenderModule>>, config: HeadlessConfig, ) -> Result<Self, HeadlessError>
Creates a headless renderer for the given entry point and render modules.
Sourcepub fn physical_size(&self) -> PhysicalSize<u32>
pub fn physical_size(&self) -> PhysicalSize<u32>
Returns the current offscreen size in physical pixels.
Sourcepub fn frame_index(&self) -> u64
pub fn frame_index(&self) -> u64
Returns the number of frames rendered so far.
Sourcepub fn diagnostics(&self) -> LayoutFrameDiagnostics
pub fn diagnostics(&self) -> LayoutFrameDiagnostics
Returns the work performed by the most recently rendered frame.
Sourcepub fn inject_pointer(&mut self, change: PointerChange)
pub fn inject_pointer(&mut self, change: PointerChange)
Queues a synthetic pointer change.
Movement changes also update the tracked cursor position so hit testing observes the new location on the next frame.
Sourcepub fn pointer_move(&mut self, pointer_id: PointerId, position: PxPosition)
pub fn pointer_move(&mut self, pointer_id: PointerId, position: PxPosition)
Moves the given pointer to position.
Sourcepub fn pointer_press(
&mut self,
pointer_id: PointerId,
position: PxPosition,
button: PressKeyEventType,
)
pub fn pointer_press( &mut self, pointer_id: PointerId, position: PxPosition, button: PressKeyEventType, )
Presses a pointer button at position.
Sourcepub fn pointer_release(
&mut self,
pointer_id: PointerId,
position: PxPosition,
button: PressKeyEventType,
)
pub fn pointer_release( &mut self, pointer_id: PointerId, position: PxPosition, button: PressKeyEventType, )
Releases a pointer button at position.
Sourcepub fn pointer_scroll(
&mut self,
pointer_id: PointerId,
position: PxPosition,
delta_x: f32,
delta_y: f32,
)
pub fn pointer_scroll( &mut self, pointer_id: PointerId, position: PxPosition, delta_x: f32, delta_y: f32, )
Queues a mouse-wheel scroll at position.
Sourcepub fn touch_start(&mut self, touch_id: u64, position: PxPosition)
pub fn touch_start(&mut self, touch_id: u64, position: PxPosition)
Starts a touch contact at the given window position.
Sourcepub fn touch_move(&mut self, touch_id: u64, position: PxPosition)
pub fn touch_move(&mut self, touch_id: u64, position: PxPosition)
Moves a touch contact, generating scrolling after touch slop is crossed.
Sourcepub fn touch_cancel(&mut self, touch_id: u64)
pub fn touch_cancel(&mut self, touch_id: u64)
Cancels a touch contact without producing a tap or fling.
Sourcepub fn inject_key_event(&mut self, event: impl Into<KeyboardEvent>)
pub fn inject_key_event(&mut self, event: impl Into<KeyboardEvent>)
Queues a native or owned keyboard sample for the next frame.
Sourcepub fn press_key(&mut self, key: NamedKey)
pub fn press_key(&mut self, key: NamedKey)
Queues a non-repeating press of a named key for the next frame.
Sourcepub fn set_key_modifiers(&mut self, modifiers: ModifiersState)
pub fn set_key_modifiers(&mut self, modifiers: ModifiersState)
Sets the modifier state captured by subsequent keyboard events.
Sourcepub fn inject_ime_event(&mut self, event: Ime)
pub fn inject_ime_event(&mut self, event: Ime)
Queues an IME event, used for synthetic text entry.
Sourcepub fn inject_text(&mut self, text: &str)
pub fn inject_text(&mut self, text: &str)
Commits text as IME input for the next frame.
Sourcepub fn step_frame(&mut self)
pub fn step_frame(&mut self)
Advances the virtual clock by one frame and renders it.
Sourcepub fn render_frames(&mut self, frames: u32)
pub fn render_frames(&mut self, frames: u32)
Renders exactly frames frames (at least one).
Sourcepub fn render_for_duration(&mut self, duration: Duration)
pub fn render_for_duration(&mut self, duration: Duration)
Renders frames until at least duration of virtual time has elapsed.
Sourcepub fn read_pixels(&self) -> Result<Vec<u8>, HeadlessError>
pub fn read_pixels(&self) -> Result<Vec<u8>, HeadlessError>
Reads the last rendered frame back as tightly packed RGBA8 pixels.
Sourcepub fn resize(&mut self, width: u32, height: u32)
pub fn resize(&mut self, width: u32, height: u32)
Resizes the offscreen target and updates the runtime window size.
Sourcepub fn work(&self) -> &FrameWork
pub fn work(&self) -> &FrameWork
Returns actual component, layout, and paint work in the last frame.
Sourcepub fn work_totals(&self) -> &WorkTotals
pub fn work_totals(&self) -> &WorkTotals
Returns cumulative work for this fixture’s lifetime.
Sourcepub fn frame_clock_diagnostics(&self) -> &FrameClockDiagnostics
pub fn frame_clock_diagnostics(&self) -> &FrameClockDiagnostics
Returns frame-clock work and remaining subscriptions for the last frame.
Sourcepub fn snapshot(&self) -> Value
pub fn snapshot(&self) -> Value
Captures a semantic snapshot of the component tree as JSON.
Each node reports its component function name, role, absolute bounds and accessibility metadata (role, label, value, key and state flags), which is what an automated agent needs to locate and target widgets.
Sourcepub fn accessibility_snapshot(&self) -> Option<TreeUpdate>
pub fn accessibility_snapshot(&self) -> Option<TreeUpdate>
Returns the accessibility tree published to assistive technologies.
Use this after rendering a frame to verify semantic roles, reading order, visibility, actions, and focus independently of layout snapshots.
Sourcepub fn dispatch_accessibility_action(&mut self, request: ActionRequest) -> bool
pub fn dispatch_accessibility_action(&mut self, request: ActionRequest) -> bool
Dispatches an assistive-technology action to a published node.
Returns whether a focus target or action handler received the request. Render another frame to publish resulting state and focus changes.
Auto Trait Implementations§
impl !Freeze for HeadlessRenderer
impl !RefUnwindSafe for HeadlessRenderer
impl !Send for HeadlessRenderer
impl !Sync for HeadlessRenderer
impl !UnwindSafe for HeadlessRenderer
impl Unpin for HeadlessRenderer
impl UnsafeUnpin for HeadlessRenderer
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.