Struct ruma::ServerName
source · 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.