pub struct HostBlock {
pub host_pattern: String,
pub raw_host_line: String,
pub directives: Vec<Directive>,
}Expand description
A parsed Host block with its directives.
Fields§
§host_pattern: StringThe host alias/pattern (the value after “Host”).
raw_host_line: StringThe original raw “Host …” line for faithful reproduction.
directives: Vec<Directive>Parsed directives inside this block.
Implementations§
Source§impl HostBlock
impl HostBlock
Extract tags from purple:tags comment in directives.
Sourcepub fn provider(&self) -> Option<(String, String)>
pub fn provider(&self) -> Option<(String, String)>
Extract provider info from purple:provider comment in directives. Returns (provider_name, server_id), e.g. (“digitalocean”, “412345678”).
Sourcepub fn set_provider(&mut self, provider_name: &str, server_id: &str)
pub fn set_provider(&mut self, provider_name: &str, server_id: &str)
Set provider on a host block. Replaces existing purple:provider comment or adds one.
Sourcepub fn askpass(&self) -> Option<String>
pub fn askpass(&self) -> Option<String>
Extract askpass source from purple:askpass comment in directives.
Sourcepub fn set_askpass(&mut self, source: &str)
pub fn set_askpass(&mut self, source: &str)
Set askpass source on a host block. Replaces existing purple:askpass comment or adds one. Pass an empty string to remove the comment.
Sourcepub fn meta(&self) -> Vec<(String, String)>
pub fn meta(&self) -> Vec<(String, String)>
Extract provider metadata from purple:meta comment in directives.
Format: # purple:meta key=value,key=value
Sourcepub fn set_meta(&mut self, meta: &[(String, String)])
pub fn set_meta(&mut self, meta: &[(String, String)])
Set provider metadata on a host block. Replaces existing purple:meta comment or adds one. Pass an empty slice to remove the comment.
Set tags on a host block. Replaces existing purple:tags comment or adds one.
Sourcepub fn to_host_entry(&self) -> HostEntry
pub fn to_host_entry(&self) -> HostEntry
Extract a convenience HostEntry view from this block.
Sourcepub fn tunnel_count(&self) -> u16
pub fn tunnel_count(&self) -> u16
Count forwarding directives (LocalForward, RemoteForward, DynamicForward).
Sourcepub fn has_tunnels(&self) -> bool
pub fn has_tunnels(&self) -> bool
Check if this block has any tunnel forwarding directives.
Sourcepub fn tunnel_directives(&self) -> Vec<TunnelRule>
pub fn tunnel_directives(&self) -> Vec<TunnelRule>
Extract tunnel rules from forwarding directives.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for HostBlock
impl RefUnwindSafe for HostBlock
impl Send for HostBlock
impl Sync for HostBlock
impl Unpin for HostBlock
impl UnsafeUnpin for HostBlock
impl UnwindSafe for HostBlock
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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