pub struct Program<M: Model, W: Write + Send = Stdout> { /* private fields */ }Expand description
The program runtime that manages the update/view loop.
Implementations§
Source§impl<M: Model, W: Write + Send> Program<M, W>
impl<M: Model, W: Write + Send> Program<M, W>
Sourcepub fn run(&mut self) -> Result<()>
pub fn run(&mut self) -> Result<()>
Run the main event loop.
This is the main entry point. It handles:
- Initialization (terminal setup, raw mode)
- Event polling and message dispatch
- Frame rendering
- Shutdown (terminal cleanup)
Sourcepub fn last_widget_signals(&self) -> &[WidgetSignal]
pub fn last_widget_signals(&self) -> &[WidgetSignal]
Access widget scheduling signals captured on the last render.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Check if the program is running.
Sourcepub fn state_registry(&self) -> Option<&Arc<StateRegistry>>
pub fn state_registry(&self) -> Option<&Arc<StateRegistry>>
Get a reference to the state registry, if configured.
Sourcepub fn has_persistence(&self) -> bool
pub fn has_persistence(&self) -> bool
Check if state persistence is enabled.
Sourcepub fn trigger_save(&mut self) -> StorageResult<bool>
pub fn trigger_save(&mut self) -> StorageResult<bool>
Trigger a manual save of widget state.
Returns the result of the flush operation, or Ok(false) if
persistence is not configured.
Sourcepub fn trigger_load(&mut self) -> StorageResult<usize>
pub fn trigger_load(&mut self) -> StorageResult<usize>
Trigger a manual load of widget state.
Returns the number of entries loaded, or Ok(0) if persistence
is not configured.
Sourcepub fn request_redraw(&mut self)
pub fn request_redraw(&mut self)
Mark the UI as needing redraw.
Sourcepub fn request_ui_height_remeasure(&mut self)
pub fn request_ui_height_remeasure(&mut self)
Request a re-measure of inline auto UI height on next render.
Sourcepub fn start_recording(&mut self, name: impl Into<String>)
pub fn start_recording(&mut self, name: impl Into<String>)
Start recording events into a macro.
If already recording, the current recording is discarded and a new one starts. The current terminal size is captured as metadata.
Sourcepub fn stop_recording(&mut self) -> Option<InputMacro>
pub fn stop_recording(&mut self) -> Option<InputMacro>
Stop recording and return the recorded macro, if any.
Returns None if not currently recording.
Sourcepub fn is_recording(&self) -> bool
pub fn is_recording(&self) -> bool
Check if event recording is active.