AppState

Struct AppState 

Source
pub struct AppState {
Show 32 fields pub config: SerialConfig, pub message_log: MessageLog, pub display_mode: DisplayMode, pub is_connected: bool, pub config_locked: bool, pub ports: Vec<String>, pub scroll_offset: u16, pub auto_scroll: bool, pub port_list_state: ListState, pub baud_rate_options: Vec<u32>, pub baud_rate_state: ListState, pub parity_options: Vec<Parity>, pub parity_state: ListState, pub flow_control_options: Vec<FlowControl>, pub flow_control_state: ListState, pub data_bits_options: Vec<u8>, pub data_bits_state: ListState, pub stop_bits_options: Vec<u8>, pub stop_bits_state: ListState, pub tx_input: String, pub tx_mode: TxMode, pub tx_append_mode: AppendMode, pub tx_cursor: usize, pub append_mode_options: Vec<AppendMode>, pub append_mode_state: ListState, pub focused_field: FocusedField, pub notifications: VecDeque<Notification>, pub debug_mode: bool, pub last_mouse_event: String, pub menu_state: MenuState, pub language: Language, pub show_shortcuts_help: bool,
}
Expand description

Main application state

Fields§

§config: SerialConfig§message_log: MessageLog§display_mode: DisplayMode§is_connected: bool§config_locked: bool§ports: Vec<String>§scroll_offset: u16§auto_scroll: bool§port_list_state: ListState§baud_rate_options: Vec<u32>§baud_rate_state: ListState§parity_options: Vec<Parity>§parity_state: ListState§flow_control_options: Vec<FlowControl>§flow_control_state: ListState§data_bits_options: Vec<u8>§data_bits_state: ListState§stop_bits_options: Vec<u8>§stop_bits_state: ListState§tx_input: String§tx_mode: TxMode§tx_append_mode: AppendMode§tx_cursor: usize§append_mode_options: Vec<AppendMode>§append_mode_state: ListState§focused_field: FocusedField§notifications: VecDeque<Notification>§debug_mode: bool§last_mouse_event: String§menu_state: MenuState§language: Language§show_shortcuts_help: bool

Implementations§

Source§

impl AppState

Source

pub fn new() -> Self

Create a new application state with default values

Source

pub fn lock_config(&mut self)

Lock configuration (called when connecting)

Source

pub fn unlock_config(&mut self)

Unlock configuration (called when disconnecting)

Source

pub fn can_modify_config(&self) -> bool

Check if configuration can be modified

Source

pub fn add_notification(&mut self, notification: Notification)

Add a notification to the queue

Source

pub fn add_info(&mut self, msg: impl Into<String>)

Add an info notification

Source

pub fn add_warning(&mut self, msg: impl Into<String>)

Add a warning notification

Source

pub fn add_error(&mut self, msg: impl Into<String>)

Add an error notification

Source

pub fn add_success(&mut self, msg: impl Into<String>)

Add a success notification

Source

pub fn update_notifications(&mut self)

Remove expired notifications

Source

pub fn next_baud_rate(&mut self) -> bool

Select next baud rate

Source

pub fn prev_baud_rate(&mut self) -> bool

Select previous baud rate

Source

pub fn toggle_parity(&mut self) -> bool

Toggle parity setting

Source

pub fn toggle_flow_control(&mut self) -> bool

Toggle flow control setting

Source

pub fn next_data_bits(&mut self) -> bool

Select next data bits setting

Source

pub fn next_stop_bits(&mut self) -> bool

Select next stop bits setting

Source

pub fn select_port(&mut self, index: usize) -> bool

Select port (with validation)

Source

pub fn toggle_tx_mode(&mut self)

Toggle transmission mode

Source

pub fn next_append_mode(&mut self)

Cycle to next append mode

Source

pub fn prev_append_mode(&mut self)

Cycle to previous append mode

Source

pub fn toggle_display_mode(&mut self)

Toggle display mode

Source

pub fn focus_next_field(&mut self)

Focus next field

Source

pub fn focus_prev_field(&mut self)

Focus previous field

Source

pub fn save_config(&self) -> Result<(), String>

Save configuration to file

Source

pub fn load_config(&mut self)

Load configuration from file, return default if not found or error

Source

pub fn toggle_language(&mut self)

Toggle language

Source

pub fn toggle_shortcuts_help(&mut self)

Toggle shortcuts help overlay

Source

pub fn show_shortcuts_help(&mut self)

Show shortcuts help

Source

pub fn hide_shortcuts_help(&mut self)

Hide shortcuts help

Trait Implementations§

Source§

impl Default for AppState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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