Enum ServerName
enum ServerName<'a>
Encodes ways a client can know the expected name of the server.
This currently covers knowing the DNS name of the server, but
will be extended in the future to supporting privacy-preserving names
for the server ("ECH"). For this reason this enum is non_exhaustive.
Making one
If you have a DNS name as a &str, this type implements TryFrom<&str>,
so you can do:
# use ServerName;
try_from.expect;
If you have an owned String, you can use TryFrom directly:
# use ServerName;
let name = "example.com".to_string;
try_from.expect;
which will yield a ServerName<'static> if successful.
or, alternatively...
# use ServerName;
let x: ServerName = "example.com".try_into.expect;
Variants
-
DnsName(DnsName<'a>) The server is identified by a DNS name. The name is sent in the TLS Server Name Indication (SNI) extension.
-
IpAddress(IpAddr) The server is identified by an IP address. SNI is not done.
Implementations
impl ServerName<'_>
fn to_owned(self: &Self) -> ServerName<'static>Produce an owned
ServerNamefrom this (potentially borrowed)ServerName.fn to_str(self: &Self) -> Cow<'_, str>Return the string representation of this
ServerName.In the case of a
ServerName::DnsNameinstance, this function returns a borrowedstr. For aServerName::IpAddressinstance it returns an allocatedString.
impl Debug for ServerName<'_>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl From for ServerName<'_>
fn from(addr: IpAddr) -> Self
impl From for ServerName<'_>
fn from(v6: Ipv6Addr) -> Self
impl From for ServerName<'_>
fn from(v4: Ipv4Addr) -> Self
impl From for ServerName<'_>
fn from(v6: Ipv6Addr) -> Self
impl From for ServerName<'_>
fn from(addr: IpAddr) -> Self
impl From for ServerName<'_>
fn from(v4: Ipv4Addr) -> Self
impl TryFrom for ServerName<'static>
fn try_from(value: String) -> Result<Self, <Self as >::Error>
impl<'a> Clone for ServerName<'a>
fn clone(self: &Self) -> ServerName<'a>
impl<'a> Eq for ServerName<'a>
impl<'a> Freeze for ServerName<'a>
impl<'a> Hash for ServerName<'a>
fn hash<__H: $crate::hash::Hasher>(self: &Self, state: &mut __H)
impl<'a> PartialEq for ServerName<'a>
fn eq(self: &Self, other: &ServerName<'a>) -> bool
impl<'a> RefUnwindSafe for ServerName<'a>
impl<'a> Send for ServerName<'a>
impl<'a> StructuralPartialEq for ServerName<'a>
impl<'a> Sync for ServerName<'a>
impl<'a> TryFrom for ServerName<'a>
fn try_from(s: &'a str) -> Result<Self, <Self as >::Error>
impl<'a> TryFrom for ServerName<'a>
fn try_from(value: &'a [u8]) -> Result<Self, <Self as >::Error>
impl<'a> Unpin for ServerName<'a>
impl<'a> UnwindSafe for ServerName<'a>
impl<T> Any for ServerName<'a>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for ServerName<'a>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for ServerName<'a>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for ServerName<'a>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for ServerName<'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for ServerName<'a>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T, U> Into for ServerName<'a>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for ServerName<'a>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for ServerName<'a>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>