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
impl HostState
Sourcepub fn from_config(
ssh_config: SshConfigFile,
hosts: Vec<HostEntry>,
patterns: Vec<PatternEntry>,
display_list: Vec<HostListItem>,
) -> Self
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.
Sourcepub fn set_group_by(&mut self, by: GroupBy)
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.
Sourcepub fn toggle_view_mode(&mut self)
pub fn toggle_view_mode(&mut self)
Flip the host list between Compact and Detailed view.
Sourcepub fn toggle_multi_select(&mut self, idx: usize) -> bool
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.
pub fn ssh_config(&self) -> &SshConfigFile
pub fn ssh_config_mut(&mut self) -> &mut SshConfigFile
pub fn set_ssh_config(&mut self, config: SshConfigFile)
pub fn list(&self) -> &Vec<HostEntry>
pub fn list_mut(&mut self) -> &mut Vec<HostEntry>
pub fn patterns(&self) -> &Vec<PatternEntry>
pub fn patterns_mut(&mut self) -> &mut Vec<PatternEntry>
pub fn display_list(&self) -> &Vec<HostListItem>
pub fn display_list_mut(&mut self) -> &mut Vec<HostListItem>
pub fn render_cache(&self) -> &HostListRenderCache
pub fn render_cache_mut(&mut self) -> &mut HostListRenderCache
Sourcepub fn invalidate_render_cache(&mut self)
pub fn invalidate_render_cache(&mut self)
Invalidate the host-list render cache after a mutation.
pub fn undo_stack(&self) -> &Vec<DeletedHost>
pub fn undo_stack_mut(&mut self) -> &mut Vec<DeletedHost>
Sourcepub fn pop_undo(&mut self) -> Option<DeletedHost>
pub fn pop_undo(&mut self) -> Option<DeletedHost>
Drop the most recent deletion off the undo stack, if any.
Sourcepub fn clear_undo(&mut self)
pub fn clear_undo(&mut self)
Clear the undo stack. Positions may have shifted after a reload.
pub fn multi_select(&self) -> &HashSet<usize>
pub fn multi_select_mut(&mut self) -> &mut HashSet<usize>
Sourcepub fn clear_multi_select(&mut self)
pub fn clear_multi_select(&mut self)
Clear the multi-select set. Idempotent.
pub fn sort_mode(&self) -> SortMode
pub fn set_sort_mode(&mut self, mode: SortMode)
Sourcepub fn advance_sort_mode(&mut self)
pub fn advance_sort_mode(&mut self)
Advance the sort mode to the next variant in the cycle.
pub fn group_by(&self) -> &GroupBy
Sourcepub fn set_group_by_raw(&mut self, by: GroupBy)
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.
pub fn view_mode(&self) -> ViewMode
pub fn set_view_mode(&mut self, mode: ViewMode)
pub fn group_filter(&self) -> Option<&String>
pub fn set_group_filter(&mut self, filter: Option<String>)
pub fn group_tab_order(&self) -> &Vec<String>
pub fn group_host_counts(&self) -> &HashMap<String, usize>
Auto Trait Implementations§
impl Freeze for HostState
impl RefUnwindSafe for HostState
impl Send for HostState
impl Sync for HostState
impl Unpin for HostState
impl UnsafeUnpin for HostState
impl UnwindSafe for HostState
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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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