pub struct StackAddr { /* private fields */ }Expand description
A stack address that contains a stack of protocols. The stack address can be used to represent a network address with multiple protocols.
Implementations§
Source§impl StackAddr
impl StackAddr
Sourcepub fn new(protocols: &[Protocol]) -> Self
pub fn new(protocols: &[Protocol]) -> Self
Create a new stack address with the given protocols.
Sourcepub fn with(self, p: Protocol) -> Self
pub fn with(self, p: Protocol) -> Self
Create a stack address with the given protocol. This is a convenience method for creating a stack address with builder pattern.
Sourcepub fn with_namev4(name: &str) -> Self
pub fn with_namev4(name: &str) -> Self
Create a stack address with the given DNS name. This will resolve to an IPv4 address.
Sourcepub fn with_namev6(name: &str) -> Self
pub fn with_namev6(name: &str) -> Self
Create a stack address with the given DNS name. This will resolve to an IPv6 address.
Sourcepub fn unspecified_ipv4() -> Self
pub fn unspecified_ipv4() -> Self
Create a stack address with the UNSPECIFIED IPv4 address.
Sourcepub fn unspecified_ipv6() -> Self
pub fn unspecified_ipv6() -> Self
Create a stack address with the UNSPECIFIED IPv6 address.
Sourcepub fn contains(&self, protocol: &Protocol) -> bool
pub fn contains(&self, protocol: &Protocol) -> bool
Check if the stack address contains the given protocol with inner details.
Sourcepub fn supports(&self, protocol: &Protocol) -> bool
pub fn supports(&self, protocol: &Protocol) -> bool
Check if the stack address supports the given protocol without considering the port or inner details.
Sourcepub fn replace(&mut self, old: &Protocol, new: Protocol) -> bool
pub fn replace(&mut self, old: &Protocol, new: Protocol) -> bool
Replace the first occurrence of the given protocol with a new one. Returns true if a replacement was made.
Sourcepub fn replace_all(&mut self, old: &Protocol, new: Protocol) -> usize
pub fn replace_all(&mut self, old: &Protocol, new: Protocol) -> usize
Replace all occurrences of the given protocol with the new one. Returns the number of replacements made.
Sourcepub fn remove(&mut self, target: &Protocol) -> bool
pub fn remove(&mut self, target: &Protocol) -> bool
Remove the first occurrence of the given protocol. Returns true if an element was removed.
Sourcepub fn remove_all(&mut self, target: &Protocol) -> usize
pub fn remove_all(&mut self, target: &Protocol) -> usize
Remove all occurrences of the given protocol. Returns the number of elements removed.