Enum distant_core::Host
source · [−]Expand description
Represents the host of a destination
Variants
Ipv4(Ipv4Addr)
Ipv6(Ipv6Addr)
Name(String)
Represents a hostname that follows the DoD Internet Host Table Specification:
- Hostname can be a maximum of 253 characters including ‘.’
- Each label is a-zA-Z0-9 alongside hyphen (‘-’) and a maximum size of 63 characters
- Labels can be segmented by periods (‘.’)
Implementations
Trait Implementations
sourceimpl<'de> Deserialize<'de> for Host
impl<'de> Deserialize<'de> for Host
sourcefn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl FromStr for Host
impl FromStr for Host
sourcefn from_str(s: &str) -> Result<Self, Self::Err>
fn from_str(s: &str) -> Result<Self, Self::Err>
Parses a host from a str
Examples
// IPv4 address
assert_eq!("127.0.0.1".parse(), Ok(Host::Ipv4(Ipv4Addr::new(127, 0, 0, 1))));
// IPv6 address
assert_eq!("::1".parse(), Ok(Host::Ipv6(Ipv6Addr::new(0, 0, 0, 0, 0, 0, 0, 1))));
// Valid hostname
assert_eq!("localhost".parse(), Ok(Host::Name("localhost".to_string())));
// Invalid hostname
assert!("local_host".parse::<Host>().is_err());
type Err = HostParseError
type Err = HostParseError
The associated error which can be returned from parsing.
sourceimpl<'a> PartialEq<&'a str> for Host
impl<'a> PartialEq<&'a str> for Host
sourceimpl PartialEq<Host> for Host
impl PartialEq<Host> for Host
sourceimpl PartialEq<str> for Host
impl PartialEq<str> for Host
impl Eq for Host
impl StructuralEq for Host
impl StructuralPartialEq for Host
Auto Trait Implementations
impl RefUnwindSafe for Host
impl Send for Host
impl Sync for Host
impl Unpin for Host
impl UnwindSafe for Host
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more