Struct ServerName
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§
§impl ServerName
impl ServerName
§impl ServerName
impl ServerName
pub fn parse(s: impl AsRef<str>) -> Result<OwnedServerName, Error>
pub fn parse(s: impl AsRef<str>) -> Result<OwnedServerName, Error>
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.
pub fn parse_box(
s: impl AsRef<str> + Into<Box<str>>,
) -> Result<Box<ServerName>, Error>
pub fn parse_box( s: impl AsRef<str> + Into<Box<str>>, ) -> Result<Box<ServerName>, Error>
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.
§impl ServerName
impl ServerName
pub fn host(&self) -> &str
pub fn host(&self) -> &str
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.
pub fn is_ip_literal(&self) -> bool
pub fn is_ip_literal(&self) -> bool
Returns true if and only if the server name is an IPv4 or IPv6 address.
Trait Implementations§
§impl AsRef<[u8]> for Box<ServerName>
impl AsRef<[u8]> for Box<ServerName>
§impl AsRef<[u8]> for ServerName
impl AsRef<[u8]> for ServerName
§impl AsRef<ServerName> for OwnedServerName
impl AsRef<ServerName> for OwnedServerName
§fn as_ref(&self) -> &ServerName
fn as_ref(&self) -> &ServerName
Converts this type into a shared reference of the (usually inferred) input type.
§impl AsRef<ServerName> for ServerName
impl AsRef<ServerName> for ServerName
§fn as_ref(&self) -> &ServerName
fn as_ref(&self) -> &ServerName
Converts this type into a shared reference of the (usually inferred) input type.
§impl AsRef<str> for Box<ServerName>
impl AsRef<str> for Box<ServerName>
§impl AsRef<str> for ServerName
impl AsRef<str> for ServerName
§impl Borrow<ServerName> for OwnedServerName
impl Borrow<ServerName> for OwnedServerName
§fn borrow(&self) -> &ServerName
fn borrow(&self) -> &ServerName
Immutably borrows from an owned value. Read more
§impl Clone for Box<ServerName>
impl Clone for Box<ServerName>
§fn clone(&self) -> Box<ServerName>
fn clone(&self) -> Box<ServerName>
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read more§impl Debug for ServerName
impl Debug for ServerName
§impl<'de> Deserialize<'de> for Box<ServerName>
impl<'de> Deserialize<'de> for Box<ServerName>
§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
§impl Display for ServerName
impl Display for ServerName
§impl From<&ServerName> for Arc<ServerName>
impl From<&ServerName> for Arc<ServerName>
§fn from(s: &ServerName) -> Arc<ServerName>
fn from(s: &ServerName) -> Arc<ServerName>
Converts to this type from the input type.
§impl From<&ServerName> for Box<ServerName>
impl From<&ServerName> for Box<ServerName>
§fn from(id: &ServerName) -> Box<ServerName>
fn from(id: &ServerName) -> Box<ServerName>
Converts to this type from the input type.
§impl From<&ServerName> for OwnedServerName
impl From<&ServerName> for OwnedServerName
§fn from(id: &ServerName) -> OwnedServerName
fn from(id: &ServerName) -> OwnedServerName
Converts to this type from the input type.
§impl From<&ServerName> for Rc<ServerName>
impl From<&ServerName> for Rc<ServerName>
§fn from(s: &ServerName) -> Rc<ServerName>
fn from(s: &ServerName) -> Rc<ServerName>
Converts to this type from the input type.
§impl From<&ServerName> for String
impl From<&ServerName> for String
§fn from(id: &ServerName) -> String
fn from(id: &ServerName) -> String
Converts to this type from the input type.
§impl From<OwnedServerName> for Box<ServerName>
impl From<OwnedServerName> for Box<ServerName>
§fn from(a: OwnedServerName) -> Box<ServerName>
fn from(a: OwnedServerName) -> Box<ServerName>
Converts to this type from the input type.
§impl FromStr for Box<ServerName>
impl FromStr for Box<ServerName>
§impl Hash for ServerName
impl Hash for ServerName
§impl Ord for ServerName
impl Ord for ServerName
§impl PartialEq<&ServerName> for Box<ServerName>
impl PartialEq<&ServerName> for Box<ServerName>
§impl PartialEq<&ServerName> for OwnedServerName
impl PartialEq<&ServerName> for OwnedServerName
§impl PartialEq<&str> for Box<ServerName>
impl PartialEq<&str> for Box<ServerName>
§impl PartialEq<&str> for ServerName
impl PartialEq<&str> for ServerName
§impl PartialEq<Box<ServerName>> for &ServerName
impl PartialEq<Box<ServerName>> for &ServerName
§impl PartialEq<Box<ServerName>> for ServerName
impl PartialEq<Box<ServerName>> for ServerName
§impl PartialEq<OwnedServerName> for &ServerName
impl PartialEq<OwnedServerName> for &ServerName
§impl PartialEq<OwnedServerName> for Box<ServerName>
impl PartialEq<OwnedServerName> for Box<ServerName>
§impl PartialEq<OwnedServerName> for ServerName
impl PartialEq<OwnedServerName> for ServerName
§impl PartialEq<ServerName> for &str
impl PartialEq<ServerName> for &str
§impl PartialEq<ServerName> for Box<ServerName>
impl PartialEq<ServerName> for Box<ServerName>
§impl PartialEq<ServerName> for OwnedServerName
impl PartialEq<ServerName> for OwnedServerName
§impl PartialEq<ServerName> for String
impl PartialEq<ServerName> for String
§impl PartialEq<ServerName> for str
impl PartialEq<ServerName> for str
§impl PartialEq<String> for Box<ServerName>
impl PartialEq<String> for Box<ServerName>
§impl PartialEq<String> for ServerName
impl PartialEq<String> for ServerName
§impl PartialEq<str> for Box<ServerName>
impl PartialEq<str> for Box<ServerName>
§impl PartialEq<str> for ServerName
impl PartialEq<str> for ServerName
§impl PartialEq for ServerName
impl PartialEq for ServerName
§impl PartialOrd for ServerName
impl PartialOrd for ServerName
§impl Serialize for ServerName
impl Serialize for ServerName
§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
§impl ToOwned for ServerName
impl ToOwned for ServerName
§type Owned = OwnedServerName
type Owned = OwnedServerName
The resulting type after obtaining ownership.
§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
§impl<'a> TryFrom<&'a str> for &'a ServerName
impl<'a> TryFrom<&'a str> for &'a ServerName
§impl TryFrom<&str> for Box<ServerName>
impl TryFrom<&str> for Box<ServerName>
§impl TryFrom<String> for Box<ServerName>
impl TryFrom<String> for Box<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.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.