Skip to main content

HostState

Struct HostState 

Source
pub struct HostState {
Show 13 fields pub ssh_config: SshConfigFile, pub list: Vec<HostEntry>, pub patterns: Vec<PatternEntry>, pub display_list: Vec<HostListItem>, pub render_cache: HostListRenderCache, pub undo_stack: Vec<DeletedHost>, pub multi_select: HashSet<usize>, pub sort_mode: SortMode, pub group_by: GroupBy, pub view_mode: ViewMode, pub group_filter: Option<String>, pub group_tab_order: Vec<String>, pub group_host_counts: HashMap<String, usize>,
}
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.

Fields§

§ssh_config: SshConfigFile§list: Vec<HostEntry>§patterns: Vec<PatternEntry>§display_list: Vec<HostListItem>§render_cache: HostListRenderCache§undo_stack: Vec<DeletedHost>§multi_select: HashSet<usize>

Host indices selected for multi-host snippet execution (space to toggle).

§sort_mode: SortMode§group_by: GroupBy§view_mode: ViewMode§group_filter: Option<String>

Currently active group filter. None = show all groups.

§group_tab_order: Vec<String>

Ordered list of group names from the current display list.

§group_host_counts: HashMap<String, usize>

Host/pattern counts per group (computed before group filtering).

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.

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