pub struct PaneHeadless { /* private fields */ }Expand description
A Pane UI instance with no GPU or window — logic, state, and actions only.
Useful for automated testing, server-side UI state machines, or any context where rendering is not needed. All widget state is maintained and actions are emitted normally; draw calls are discarded.
Implementations§
Source§impl PaneHeadless
impl PaneHeadless
Sourcepub fn update(&mut self, dt: f32) -> Vec<PaneAction>
pub fn update(&mut self, dt: f32) -> Vec<PaneAction>
Advance the UI by dt seconds and return any actions emitted this tick.
Call at a fixed or variable rate. dt is in seconds; typical values are
1.0 / 60.0 for a 60 Hz simulation tick.
Sourcepub fn press(&mut self, id: &str)
pub fn press(&mut self, id: &str)
Simulate pressing a button by id.
Only works if headless_accessible: true is set in the root definition.
Fires the button’s action as if the user clicked it.
Sourcepub fn active_root(&self) -> Option<&str>
pub fn active_root(&self) -> Option<&str>
Returns the name of the currently active root, or None if none has been set.
Sourcepub fn read(&self, id: &str) -> Option<(&UiItem, WidgetState)>
pub fn read(&self, id: &str) -> Option<(&UiItem, WidgetState)>
Returns the item data and its current visual state for any widget by id.
Same as PaneOverlay::read — pattern-match on UiItem to get widget fields.
Sourcepub fn write(&mut self, id: &str, value: &WriteValue)
pub fn write(&mut self, id: &str, value: &WriteValue)
Set a widget’s value programmatically.
See WriteValue for the supported widget types and their matching variants.
Mismatched types and unknown ids are logged and ignored.
Sourcepub fn create(&mut self, root: &str, builder: impl WidgetBuilder) -> bool
pub fn create(&mut self, root: &str, builder: impl WidgetBuilder) -> bool
Add a code-built widget to a named root. Returns false if the id is already
in use or the root doesn’t exist.
Sourcepub fn destroy(&mut self, id: &str) -> bool
pub fn destroy(&mut self, id: &str) -> bool
Remove a widget by id from any root. Returns true if a widget was removed.
Sourcepub fn create_root(&mut self, name: impl Into<String>)
pub fn create_root(&mut self, name: impl Into<String>)
Create an empty root that can be populated with Self::create.
Sourcepub fn style_id(&self, name: &str) -> Option<StyleId>
pub fn style_id(&self, name: &str) -> Option<StyleId>
Resolve a style name to its StyleId for use with builders.
Sourcepub fn default_style(&self) -> Option<&str>
pub fn default_style(&self) -> Option<&str>
Returns the name of the current default style, if one is set.
Sourcepub fn set_default_style(&mut self, name: &str) -> bool
pub fn set_default_style(&mut self, name: &str) -> bool
Switch the default style by name. Returns false if the name is not registered.
Sourcepub const fn set_debug(&mut self, on: bool)
pub const fn set_debug(&mut self, on: bool)
Enable or disable debug message logging (no-op in headless mode, but
kept for API symmetry with PaneOverlay::set_debug).
Sourcepub fn push_toast(
&mut self,
message: impl Into<String>,
duration: f32,
x: f32,
y: f32,
width: f32,
height: f32,
)
pub fn push_toast( &mut self, message: impl Into<String>, duration: f32, x: f32, y: f32, width: f32, height: f32, )
Spawn a transient toast notification.
In headless mode toasts are tracked but not rendered.
Sourcepub fn actor_move_to(&mut self, id: &str, x: f32, y: f32, speed: f32)
pub fn actor_move_to(&mut self, id: &str, x: f32, y: f32, speed: f32)
Programmatically send an actor to a fixed position, overriding its RON behaviours.
Sourcepub fn actor_follow_cursor(&mut self, id: &str, speed: f32, trail: f32)
pub fn actor_follow_cursor(&mut self, id: &str, speed: f32, trail: f32)
Programmatically make an actor follow the cursor, overriding its RON behaviours.
Sourcepub fn actor_reset(&mut self, id: &str)
pub fn actor_reset(&mut self, id: &str)
Clear any programmatic override on an actor, returning it to its RON behaviours.
Sourcepub fn actor_set_pos(&mut self, id: &str, x: f32, y: f32)
pub fn actor_set_pos(&mut self, id: &str, x: f32, y: f32)
Teleport an actor to a position instantly, without lerping.
Auto Trait Implementations§
impl !Freeze for PaneHeadless
impl !RefUnwindSafe for PaneHeadless
impl Send for PaneHeadless
impl !Sync for PaneHeadless
impl Unpin for PaneHeadless
impl UnsafeUnpin for PaneHeadless
impl !UnwindSafe for PaneHeadless
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more