mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
Add *Jid::into_inner() returning the inner String
Thanks pep. for the suggestion!
This commit is contained in:
parent
6f304d197d
commit
11087d64f7
1 changed files with 17 additions and 0 deletions
|
@ -117,6 +117,13 @@ impl Jid {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the inner String of this JID.
|
||||
pub fn into_inner(self) -> String {
|
||||
match self {
|
||||
Jid::Bare(BareJid { inner }) | Jid::Full(FullJid { inner }) => inner.normalized,
|
||||
}
|
||||
}
|
||||
|
||||
/// Build a [`Jid`] from typed parts. This method cannot fail because it uses parts that have
|
||||
/// already been parsed and stringprepped into [`NodePart`], [`DomainPart`], and [`ResourcePart`].
|
||||
/// This method allocates and does not consume the typed parts.
|
||||
|
@ -391,6 +398,11 @@ impl FullJid {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the inner String of this JID.
|
||||
pub fn into_inner(self) -> String {
|
||||
self.inner.normalized
|
||||
}
|
||||
|
||||
/// Build a [`FullJid`] from typed parts. This method cannot fail because it uses parts that have
|
||||
/// already been parsed and stringprepped into [`NodePart`], [`DomainPart`], and [`ResourcePart`].
|
||||
/// This method allocates and does not consume the typed parts.
|
||||
|
@ -496,6 +508,11 @@ impl BareJid {
|
|||
}
|
||||
}
|
||||
|
||||
/// Returns the inner String of this JID.
|
||||
pub fn into_inner(self) -> String {
|
||||
self.inner.normalized
|
||||
}
|
||||
|
||||
/// Build a [`BareJid`] from typed parts. This method cannot fail because it uses parts that have
|
||||
/// already been parsed and stringprepped into [`NodePart`] and [`DomainPart`]. This method allocates
|
||||
/// and does not consume the typed parts.
|
||||
|
|
Loading…
Reference in a new issue