Struct crackle_lib::ServerName
[−]#[repr(transparent)]pub struct ServerName(_);
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
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.
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, Global>>
) -> Result<Box<ServerName, Global>, Error>
pub fn parse_box(
s: impl AsRef<str> + Into<Box<str, Global>>
) -> Result<Box<ServerName, Global>, 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.
Trait Implementations
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<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 Debug for ServerName
impl Debug for ServerName
impl Display for ServerName
impl Display for ServerName
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 Hash for ServerName
impl Hash for ServerName
impl Ord for ServerName
impl Ord for ServerName
impl<'_> PartialEq<&'_ ServerName> for OwnedServerName
impl<'_> PartialEq<&'_ ServerName> for OwnedServerName
impl<'_> PartialEq<&'_ str> for ServerName
impl<'_> PartialEq<&'_ str> for ServerName
impl PartialEq<Box<ServerName, Global>> for ServerName
impl PartialEq<Box<ServerName, Global>> for ServerName
impl<'_> PartialEq<Box<ServerName, Global>> for &'_ ServerName
impl<'_> PartialEq<Box<ServerName, Global>> for &'_ ServerName
impl PartialEq<OwnedServerName> for ServerName
impl PartialEq<OwnedServerName> for 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 ServerName
impl PartialEq<ServerName> for ServerName
fn eq(&self, other: &ServerName) -> bool
fn eq(&self, other: &ServerName) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &ServerName) -> bool
fn ne(&self, other: &ServerName) -> bool
This method tests for !=
.
impl PartialEq<ServerName> for OwnedServerName
impl PartialEq<ServerName> for OwnedServerName
impl PartialEq<ServerName> for str
impl PartialEq<ServerName> for str
impl PartialEq<String> for ServerName
impl PartialEq<String> for ServerName
impl PartialEq<str> for ServerName
impl PartialEq<str> for ServerName
impl PartialOrd<ServerName> for ServerName
impl PartialOrd<ServerName> for ServerName
fn partial_cmp(&self, other: &ServerName) -> Option<Ordering>
fn partial_cmp(&self, other: &ServerName) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
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
sourcefn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
toowned_clone_into
)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
type Error = Error
type Error = Error
The type returned in the event of a conversion error.
fn try_from(
s: &'a str
) -> Result<&'a ServerName, <&'a ServerName as TryFrom<&'a str>>::Error>
fn try_from(
s: &'a str
) -> Result<&'a ServerName, <&'a ServerName as TryFrom<&'a str>>::Error>
Performs the conversion.
impl Eq for ServerName
impl StructuralEq for ServerName
impl StructuralPartialEq for ServerName
Auto Trait Implementations
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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.