Skip to main content

HeadlessRenderer

Struct HeadlessRenderer 

Source
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

Source

pub fn gpu_instance(&self) -> &Instance

Returns the GPU instance for resource observations across renderer lifetimes.

Source

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.

Source

pub fn graphics_work(&self) -> GraphicsWorkDiagnostics

Captures cumulative resource creation and uploads performed by pipelines.

Source

pub fn frame_graphics_work(&self) -> &GraphicsWorkDiagnostics

Returns actual resource operations performed in the last completed frame.

Source

pub fn session_id(&self) -> RuntimeSessionId

Returns the runtime identity shared by this session’s snapshots and diagnostics.

Source

pub fn run<R>(&self, work: impl FnOnce() -> R) -> R

Runs state or controller operations in this renderer’s session.

Source

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.

Source

pub fn physical_size(&self) -> PhysicalSize<u32>

Returns the current offscreen size in physical pixels.

Source

pub fn frame_index(&self) -> u64

Returns the number of frames rendered so far.

Source

pub fn diagnostics(&self) -> LayoutFrameDiagnostics

Returns the work performed by the most recently rendered frame.

Source

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.

Source

pub fn pointer_move(&mut self, pointer_id: PointerId, position: PxPosition)

Moves the given pointer to position.

Source

pub fn pointer_press( &mut self, pointer_id: PointerId, position: PxPosition, button: PressKeyEventType, )

Presses a pointer button at position.

Source

pub fn pointer_release( &mut self, pointer_id: PointerId, position: PxPosition, button: PressKeyEventType, )

Releases a pointer button at position.

Source

pub fn pointer_scroll( &mut self, pointer_id: PointerId, position: PxPosition, delta_x: f32, delta_y: f32, )

Queues a mouse-wheel scroll at position.

Source

pub fn touch_start(&mut self, touch_id: u64, position: PxPosition)

Starts a touch contact at the given window position.

Source

pub fn touch_move(&mut self, touch_id: u64, position: PxPosition)

Moves a touch contact, generating scrolling after touch slop is crossed.

Source

pub fn touch_end(&mut self, touch_id: u64)

Releases a touch contact and completes its gesture.

Source

pub fn touch_cancel(&mut self, touch_id: u64)

Cancels a touch contact without producing a tap or fling.

Source

pub fn inject_key_event(&mut self, event: impl Into<KeyboardEvent>)

Queues a native or owned keyboard sample for the next frame.

Source

pub fn press_key(&mut self, key: NamedKey)

Queues a non-repeating press of a named key for the next frame.

Source

pub fn set_key_modifiers(&mut self, modifiers: ModifiersState)

Sets the modifier state captured by subsequent keyboard events.

Source

pub fn inject_ime_event(&mut self, event: Ime)

Queues an IME event, used for synthetic text entry.

Source

pub fn inject_text(&mut self, text: &str)

Commits text as IME input for the next frame.

Source

pub fn step_frame(&mut self)

Advances the virtual clock by one frame and renders it.

Source

pub fn render_frames(&mut self, frames: u32)

Renders exactly frames frames (at least one).

Source

pub fn render_for_duration(&mut self, duration: Duration)

Renders frames until at least duration of virtual time has elapsed.

Source

pub fn read_pixels(&self) -> Result<Vec<u8>, HeadlessError>

Reads the last rendered frame back as tightly packed RGBA8 pixels.

Source

pub fn resize(&mut self, width: u32, height: u32)

Resizes the offscreen target and updates the runtime window size.

Source

pub fn work(&self) -> &FrameWork

Returns actual component, layout, and paint work in the last frame.

Source

pub fn work_totals(&self) -> &WorkTotals

Returns cumulative work for this fixture’s lifetime.

Source

pub fn frame_clock_diagnostics(&self) -> &FrameClockDiagnostics

Returns frame-clock work and remaining subscriptions for the last frame.

Source

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.

Source

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.

Source

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§

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
§

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

§

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

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &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 T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Converts 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>

Converts 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)

Converts &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)

Converts &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<T> for T

§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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.

§

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

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

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

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more