Expand description
A struct representing a full Jabber ID.
A full Jabber ID is composed of 3 components, of which one is optional:
- A node/name,
node, which is the optional part before the @. - A domain,
domain, which is the mandatory part after the @ but before the /. - A resource,
resource, which is the 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 enum.
Fields
node: Option<String>The node part of the Jabber ID, if it exists, else None.
domain: StringThe domain of the Jabber ID.
resource: StringThe resource of the Jabber ID.
Implementations
sourceimpl FullJid
impl FullJid
sourcepub fn new<NS, DS, RS>(node: NS, domain: DS, resource: RS) -> FullJid where
NS: Into<String>,
DS: Into<String>,
RS: Into<String>,
pub fn new<NS, DS, RS>(node: NS, domain: DS, resource: RS) -> FullJid where
NS: Into<String>,
DS: Into<String>,
RS: Into<String>,
Constructs a full Jabber ID containing all three components.
This is of the form node@domain/resource.
Examples
use jid::FullJid;
let jid = FullJid::new("node", "domain", "resource");
assert_eq!(jid.node, Some("node".to_owned()));
assert_eq!(jid.domain, "domain".to_owned());
assert_eq!(jid.resource, "resource".to_owned());sourcepub fn with_node<NS>(&self, node: NS) -> FullJid where
NS: Into<String>,
pub fn with_node<NS>(&self, node: NS) -> FullJid where
NS: Into<String>,
Constructs a new Jabber ID from an existing one, with the node swapped out with a new one.
Examples
use jid::FullJid;
let jid = FullJid::new("node", "domain", "resource");
assert_eq!(jid.node, Some("node".to_owned()));
let new_jid = jid.with_node("new_node");
assert_eq!(new_jid.node, Some("new_node".to_owned()));sourcepub fn with_domain<DS>(&self, domain: DS) -> FullJid where
DS: Into<String>,
pub fn with_domain<DS>(&self, domain: DS) -> FullJid where
DS: Into<String>,
Constructs a new Jabber ID from an existing one, with the domain swapped out with a new one.
Examples
use jid::FullJid;
let jid = FullJid::new("node", "domain", "resource");
assert_eq!(jid.domain, "domain".to_owned());
let new_jid = jid.with_domain("new_domain");
assert_eq!(new_jid.domain, "new_domain");sourcepub fn with_resource<RS>(&self, resource: RS) -> FullJid where
RS: Into<String>,
pub fn with_resource<RS>(&self, resource: RS) -> FullJid where
RS: Into<String>,
Constructs a full Jabber ID from a bare Jabber ID, specifying a resource.
Examples
use jid::FullJid;
let jid = FullJid::new("node", "domain", "resource");
assert_eq!(jid.resource, "resource".to_owned());
let new_jid = jid.with_resource("new_resource");
assert_eq!(new_jid.resource, "new_resource");Trait Implementations
sourceimpl FromStr for FullJid
impl FromStr for FullJid
type Err = JidParseError
type Err = JidParseError
The associated error which can be returned from parsing.
impl 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
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