Skip to content

Commit

Permalink
docs: document HostVecExt trait
Browse files Browse the repository at this point in the history
Signed-off-by: Nathanael DEMACON <[email protected]>
  • Loading branch information
quantumsheep committed Feb 21, 2024
1 parent fcd06ac commit 66583f5
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ssh_config/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -199,8 +199,13 @@ impl Host {
}

pub trait HostVecExt {
/// Merges the hosts with the same entries into one host.
fn merge_same_hosts(&mut self) -> &mut Self;

/// Spreads the hosts with multiple patterns into multiple hosts with one pattern.
fn spread(&mut self) -> &mut Self;

/// Apply patterns entries to non-pattern hosts and remove the pattern hosts.
fn apply_patterns(&mut self) -> &mut Self;
}

Expand Down Expand Up @@ -245,6 +250,9 @@ impl HostVecExt for Vec<Host> {
self
}

/// Apply patterns entries to non-pattern hosts and remove the pattern hosts.
///
/// You might want to call [`HostVecExt::merge_same_hosts`] after this.
fn apply_patterns(&mut self) -> &mut Self {
let hosts = self.spread();
let mut pattern_indexes = Vec::new();
Expand Down

0 comments on commit 66583f5

Please sign in to comment.