pub enum SubjectNameRef<'a> {
    DnsName(DnsNameRef<'a>),
    IpAddress(IpAddrRef<'a>),
}
Expand description

A DNS name or IP address, which borrows its text representation.

Variants§

§

DnsName(DnsNameRef<'a>)

A valid DNS name

§

IpAddress(IpAddrRef<'a>)

A valid IP address

Implementations§

Attempts to decode an encodingless string as either an IPv4 address, IPv6 address or DNS name; in that order. In practice this space is non-overlapping because DNS name components are separated by periods but cannot be wholly numeric (so cannot overlap with a valid IPv4 address), and IPv6 addresses are separated by colons but cannot contain periods.

The IPv6 address encoding supported here is extremely simplified; it does not support compression, all leading zeroes must be present in each 16-bit word, etc. Generally this is not suitable as a parse for human-provided addresses for this reason. Instead: consider parsing these with std::net::IpAddr and then using IpAddr::from<std::net::IpAddr>.

Constructs a SubjectNameRef from the given input if the input is a syntactically-valid DNS name or IP address.

Trait Implementations§

Converts this type into a shared reference of the (usually inferred) input type.
Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Converts to this type from the input type.
Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.