pub struct FullJid { /* private fields */ }
Expand description
A struct representing a full Jabber ID, with a resource part.
A full JID is composed of 3 components, of which only the node is optional:
- the (optional) node part is the part before the (optional)
@
. - the domain part is the mandatory part between the (optional)
@
and before the/
. - the resource part after the
/
.
Unlike a BareJid
, it always contains a resource, and should only be used when you are
certain there is no case where a resource can be missing. Otherwise, use a Jid
or
BareJid
.
Implementations§
source§impl FullJid
impl FullJid
sourcepub fn new(s: &str) -> Result<FullJid, Error>
pub fn new(s: &str) -> Result<FullJid, Error>
Constructs a full Jabber ID containing all three components. This is of the form
node@domain/resource
, where node part is optional.
If you want a non-fallible version, use FullJid::from_parts
instead.
Examples
use jid::FullJid;
let jid = FullJid::new("node@domain/resource")?;
assert_eq!(jid.node_str(), Some("node"));
assert_eq!(jid.domain_str(), "domain");
assert_eq!(jid.resource_str(), "resource");
sourcepub fn into_inner(self) -> String
pub fn into_inner(self) -> String
Returns the inner String of this JID.
sourcepub fn from_parts(
node: Option<&NodePart>,
domain: &DomainPart,
resource: &ResourcePart
) -> FullJid
pub fn from_parts( node: Option<&NodePart>, domain: &DomainPart, resource: &ResourcePart ) -> FullJid
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.
sourcepub fn node_str(&self) -> Option<&str>
pub fn node_str(&self) -> Option<&str>
The optional node part of the JID, as a stringy reference
sourcepub fn domain(&self) -> DomainPart
pub fn domain(&self) -> DomainPart
The domain part of the JID, as a DomainPart
sourcepub fn domain_str(&self) -> &str
pub fn domain_str(&self) -> &str
The domain part of the JID, as a stringy reference
sourcepub fn resource(&self) -> ResourcePart
pub fn resource(&self) -> ResourcePart
The optional resource part of the JID, as a ResourcePart
. Since this is a full JID it
is always present.
sourcepub fn resource_str(&self) -> &str
pub fn resource_str(&self) -> &str
The optional resource of the Jabber ID. Since this is a full JID it is always present.
Trait Implementations§
source§impl From<BindResponse> for FullJid
impl From<BindResponse> for FullJid
source§fn from(bind: BindResponse) -> FullJid
fn from(bind: BindResponse) -> FullJid
source§impl IntoAttributeValue for FullJid
impl IntoAttributeValue for FullJid
source§fn into_attribute_value(self) -> Option<String>
fn into_attribute_value(self) -> Option<String>
source§impl Ord for FullJid
impl Ord for FullJid
source§impl PartialEq<FullJid> for Jid
impl PartialEq<FullJid> for Jid
source§impl PartialEq for FullJid
impl PartialEq for FullJid
source§impl PartialOrd for FullJid
impl PartialOrd for FullJid
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Eq for FullJid
impl StructuralEq for FullJid
impl StructuralPartialEq for FullJid
Auto Trait Implementations§
impl RefUnwindSafe for FullJid
impl Send for FullJid
impl Sync for FullJid
impl Unpin for FullJid
impl UnwindSafe for FullJid
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.