Skip to main content

HostState

Struct HostState 

Source
pub struct HostState { /* private fields */ }
Expand description

Host, group, sort and view state grouped off the App god-struct. Holds the parsed ~/.ssh/config, the resolved host + pattern entries, the display list built from them, the render cache, the undo stack for deletions, the multi-select set for bulk snippet runs and all sort / group / view UI-state. Pure state container.

Implementations§

Source§

impl HostState

Source

pub fn from_config( ssh_config: SshConfigFile, hosts: Vec<HostEntry>, patterns: Vec<PatternEntry>, display_list: Vec<HostListItem>, ) -> Self

Construct from a loaded config and pre-resolved host/pattern lists.

Source

pub fn set_group_by(&mut self, by: GroupBy)

Change the group-by mode and reset any active group filter in lockstep. Callers that change group_by directly would leave a stale group_filter referring to a group that no longer exists.

Source

pub fn toggle_view_mode(&mut self)

Flip the host list between Compact and Detailed view.

Source

pub fn toggle_multi_select(&mut self, idx: usize) -> bool

Toggle multi-select membership for the host at idx. Returns true when idx is now selected (was inserted) and false when it is now unselected (was removed) so the caller can react without re-reading the set.

Source

pub fn ssh_config(&self) -> &SshConfigFile

Source

pub fn ssh_config_mut(&mut self) -> &mut SshConfigFile

Source

pub fn set_ssh_config(&mut self, config: SshConfigFile)

Source

pub fn list(&self) -> &Vec<HostEntry>

Source

pub fn list_mut(&mut self) -> &mut Vec<HostEntry>

Source

pub fn patterns(&self) -> &Vec<PatternEntry>

Source

pub fn patterns_mut(&mut self) -> &mut Vec<PatternEntry>

Source

pub fn display_list(&self) -> &Vec<HostListItem>

Source

pub fn display_list_mut(&mut self) -> &mut Vec<HostListItem>

Source

pub fn render_cache(&self) -> &HostListRenderCache

Source

pub fn render_cache_mut(&mut self) -> &mut HostListRenderCache

Source

pub fn invalidate_render_cache(&mut self)

Invalidate the host-list render cache after a mutation.

Source

pub fn undo_stack(&self) -> &Vec<DeletedHost>

Source

pub fn undo_stack_mut(&mut self) -> &mut Vec<DeletedHost>

Source

pub fn pop_undo(&mut self) -> Option<DeletedHost>

Drop the most recent deletion off the undo stack, if any.

Source

pub fn clear_undo(&mut self)

Clear the undo stack. Positions may have shifted after a reload.

Source

pub fn multi_select(&self) -> &HashSet<usize>

Source

pub fn multi_select_mut(&mut self) -> &mut HashSet<usize>

Source

pub fn clear_multi_select(&mut self)

Clear the multi-select set. Idempotent.

Source

pub fn sort_mode(&self) -> SortMode

Source

pub fn set_sort_mode(&mut self, mode: SortMode)

Source

pub fn advance_sort_mode(&mut self)

Advance the sort mode to the next variant in the cycle.

Source

pub fn group_by(&self) -> &GroupBy

Source

pub fn set_group_by_raw(&mut self, by: GroupBy)

Set the group-by mode without touching the active group filter. Use when restoring saved state. set_group_by resets the filter.

Source

pub fn view_mode(&self) -> ViewMode

Source

pub fn set_view_mode(&mut self, mode: ViewMode)

Source

pub fn group_filter(&self) -> Option<&String>

Source

pub fn set_group_filter(&mut self, filter: Option<String>)

Source

pub fn group_tab_order(&self) -> &Vec<String>

Source

pub fn group_host_counts(&self) -> &HashMap<String, usize>

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

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V