pub struct AppState {
pub persistent: PersistentState,
pub transient: TransientUiState,
pub runtime: RuntimeState,
/* private fields */
}Expand description
Full application state.
This is the single source of truth for all UI-visible data.
Fields§
§persistent: PersistentState§transient: TransientUiState§runtime: RuntimeStateImplementations§
Source§impl AppState
impl AppState
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Construct default state with localhost webserver settings.
Sourcepub fn push_intent(&mut self, intent: UserIntent)
pub fn push_intent(&mut self, intent: UserIntent)
Queue one user intent.
Sourcepub fn drain_intents(&mut self) -> Vec<UserIntent>
pub fn drain_intents(&mut self) -> Vec<UserIntent>
Drain queued intents in FIFO order.
Sourcepub fn push_event(&mut self, message: impl Into<String>)
pub fn push_event(&mut self, message: impl Into<String>)
Append one event line to runtime history.
Sourcepub fn push_frame(&mut self, bytes: &[u8])
pub fn push_frame(&mut self, bytes: &[u8])
Record one received frame and update stream counters/history.
Sourcepub fn base_http_url(&self) -> String
pub fn base_http_url(&self) -> String
Build HTTP base URL from host/port fields.
Sourcepub fn base_ws_url(&self) -> String
pub fn base_ws_url(&self) -> String
Build WebSocket stream URL from host/port fields.
Sourcepub fn apply_device_config(&mut self, config: DeviceConfig) -> usize
pub fn apply_device_config(&mut self, config: DeviceConfig) -> usize
Apply server config payload into local persistent state fields.
Returns the number of fields that were actually applied; callers use a zero return to detect an empty server cache.
Sourcepub fn apply_control_status(&mut self, status: ControlStatus)
pub fn apply_control_status(&mut self, status: ControlStatus)
Apply a /api/control/status payload to runtime state.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for AppState
impl RefUnwindSafe for AppState
impl Send for AppState
impl Sync for AppState
impl Unpin for AppState
impl UnsafeUnpin for AppState
impl UnwindSafe for AppState
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
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.Source§fn as_any(&self) -> &(dyn Any + 'static)
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.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
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.