pub struct ServerName(/* private fields */);
Expand description
A Matrix-spec compliant server name.
It consists of a host and an optional port (separated by a colon if present).
Implementations§
Source§impl ServerName
impl ServerName
Source§impl ServerName
impl ServerName
Sourcepub fn parse(s: impl AsRef<str>) -> Result<OwnedServerName, Error>
Available on crate feature events
only.
pub fn parse(s: impl AsRef<str>) -> Result<OwnedServerName, Error>
events
only.Try parsing a &str
into an OwnedServerName
.
The same can also be done using FromStr
, TryFrom
or TryInto
.
This function is simply more constrained and thus useful in generic contexts.
Sourcepub fn parse_box(
s: impl AsRef<str> + Into<Box<str>>,
) -> Result<Box<ServerName>, Error>
Available on crate feature events
only.
pub fn parse_box( s: impl AsRef<str> + Into<Box<str>>, ) -> Result<Box<ServerName>, Error>
events
only.Try parsing a &str
into a Box<ServerName>
.
The same can also be done using FromStr
, TryFrom
or TryInto
.
This function is simply more constrained and thus useful in generic contexts.
Source§impl ServerName
impl ServerName
Sourcepub fn host(&self) -> &str
Available on crate feature events
only.
pub fn host(&self) -> &str
events
only.Returns the host of the server name.
That is: Return the part of the server name before :<port>
or the full server name if
there is no port.
Sourcepub fn port(&self) -> Option<u16>
Available on crate feature events
only.
pub fn port(&self) -> Option<u16>
events
only.Returns the port of the server name, if any.
Sourcepub fn is_ip_literal(&self) -> bool
Available on crate feature events
only.
pub fn is_ip_literal(&self) -> bool
events
only.Returns true if and only if the server name is an IPv4 or IPv6 address.
Trait Implementations§
Source§impl AsRef<[u8]> for ServerName
impl AsRef<[u8]> for ServerName
Source§impl AsRef<ServerName> for OwnedServerName
impl AsRef<ServerName> for OwnedServerName
Source§fn as_ref(&self) -> &ServerName
fn as_ref(&self) -> &ServerName
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<ServerName> for ServerName
impl AsRef<ServerName> for ServerName
Source§fn as_ref(&self) -> &ServerName
fn as_ref(&self) -> &ServerName
Converts this type into a shared reference of the (usually inferred) input type.
Source§impl AsRef<str> for ServerName
impl AsRef<str> for ServerName
Source§impl Borrow<ServerName> for OwnedServerName
impl Borrow<ServerName> for OwnedServerName
Source§fn borrow(&self) -> &ServerName
fn borrow(&self) -> &ServerName
Immutably borrows from an owned value. Read more
Source§impl Clone for Box<ServerName>
impl Clone for Box<ServerName>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for ServerName
impl Debug for ServerName
Source§impl<'de> Deserialize<'de> for Box<ServerName>
impl<'de> Deserialize<'de> for Box<ServerName>
Source§fn deserialize<D>(
deserializer: D,
) -> Result<Box<ServerName>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<Box<ServerName>, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ServerName
impl Display for ServerName
Source§impl From<&ServerName> for Arc<ServerName>
impl From<&ServerName> for Arc<ServerName>
Source§fn from(s: &ServerName) -> Arc<ServerName>
fn from(s: &ServerName) -> Arc<ServerName>
Converts to this type from the input type.
Source§impl From<&ServerName> for Box<ServerName>
impl From<&ServerName> for Box<ServerName>
Source§fn from(id: &ServerName) -> Box<ServerName>
fn from(id: &ServerName) -> Box<ServerName>
Converts to this type from the input type.
Source§impl From<&ServerName> for OwnedServerName
impl From<&ServerName> for OwnedServerName
Source§fn from(id: &ServerName) -> OwnedServerName
fn from(id: &ServerName) -> OwnedServerName
Converts to this type from the input type.
Source§impl From<&ServerName> for Rc<ServerName>
impl From<&ServerName> for Rc<ServerName>
Source§fn from(s: &ServerName) -> Rc<ServerName>
fn from(s: &ServerName) -> Rc<ServerName>
Converts to this type from the input type.
Source§impl From<&ServerName> for String
impl From<&ServerName> for String
Source§fn from(id: &ServerName) -> String
fn from(id: &ServerName) -> String
Converts to this type from the input type.
Source§impl From<OwnedServerName> for Box<ServerName>
impl From<OwnedServerName> for Box<ServerName>
Source§fn from(a: OwnedServerName) -> Box<ServerName>
fn from(a: OwnedServerName) -> Box<ServerName>
Converts to this type from the input type.
Source§impl FromStr for Box<ServerName>
impl FromStr for Box<ServerName>
Source§impl Hash for ServerName
impl Hash for ServerName
Source§impl Ord for ServerName
impl Ord for ServerName
Source§impl PartialEq<&ServerName> for Box<ServerName>
impl PartialEq<&ServerName> for Box<ServerName>
Source§impl PartialEq<&ServerName> for OwnedServerName
impl PartialEq<&ServerName> for OwnedServerName
Source§impl PartialEq<&str> for ServerName
impl PartialEq<&str> for ServerName
Source§impl PartialEq<Box<ServerName>> for &ServerName
impl PartialEq<Box<ServerName>> for &ServerName
Source§impl PartialEq<Box<ServerName>> for ServerName
impl PartialEq<Box<ServerName>> for ServerName
Source§impl PartialEq<OwnedServerName> for &ServerName
impl PartialEq<OwnedServerName> for &ServerName
Source§impl PartialEq<OwnedServerName> for Box<ServerName>
impl PartialEq<OwnedServerName> for Box<ServerName>
Source§impl PartialEq<OwnedServerName> for ServerName
impl PartialEq<OwnedServerName> for ServerName
Source§impl PartialEq<ServerName> for &str
impl PartialEq<ServerName> for &str
Source§impl PartialEq<ServerName> for Box<ServerName>
impl PartialEq<ServerName> for Box<ServerName>
Source§impl PartialEq<ServerName> for OwnedServerName
impl PartialEq<ServerName> for OwnedServerName
Source§impl PartialEq<ServerName> for str
impl PartialEq<ServerName> for str
Source§impl PartialEq<String> for ServerName
impl PartialEq<String> for ServerName
Source§impl PartialEq<str> for ServerName
impl PartialEq<str> for ServerName
Source§impl PartialEq for ServerName
impl PartialEq for ServerName
Source§impl PartialOrd for ServerName
impl PartialOrd for ServerName
Source§impl Serialize for ServerName
impl Serialize for ServerName
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl ToOwned for ServerName
impl ToOwned for ServerName
Source§type Owned = OwnedServerName
type Owned = OwnedServerName
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> <ServerName as ToOwned>::Owned
fn to_owned(&self) -> <ServerName as ToOwned>::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more
Source§impl<'a> TryFrom<&'a str> for &'a ServerName
impl<'a> TryFrom<&'a str> for &'a ServerName
impl Eq for ServerName
impl StructuralPartialEq for ServerName
Auto Trait Implementations§
impl Freeze for ServerName
impl RefUnwindSafe for ServerName
impl Send for ServerName
impl !Sized for ServerName
impl Sync for ServerName
impl Unpin for ServerName
impl UnwindSafe for ServerName
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
Mutably borrows from an owned value. Read more
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.