A struct representing a Jabber ID.
A Jabber ID is composed of 3 components, of which 2 are 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 optional part after the /.
The node part of the Jabber ID, if it exists, else None.
domain: String
The domain of the Jabber ID.
The resource of the Jabber ID, if it exists, else None.
Constructs a Jabber ID containing all three components.
This is of the form node
@domain
/resource
.
use jid::Jid;
let jid = Jid::full("node", "domain", "resource");
assert_eq!(jid.node, Some("node".to_owned()));
assert_eq!(jid.domain, "domain".to_owned());
assert_eq!(jid.resource, Some("resource".to_owned()));
Constructs a Jabber ID containing only the node
and domain
components.
This is of the form node
@domain
.
use jid::Jid;
let jid = Jid::bare("node", "domain");
assert_eq!(jid.node, Some("node".to_owned()));
assert_eq!(jid.domain, "domain".to_owned());
assert_eq!(jid.resource, None);
Returns a new Jabber ID from the current one with only node and domain.
This is of the form node
@domain
.
use jid::Jid;
let jid = Jid::full("node", "domain", "resource").into_bare_jid();
assert_eq!(jid.node, Some("node".to_owned()));
assert_eq!(jid.domain, "domain".to_owned());
assert_eq!(jid.resource, None);
pub fn domain<DS>(domain: DS) -> Jid where DS: Into<String>, | [src] |
Constructs a Jabber ID containing only a domain
.
This is of the form domain
.
use jid::Jid;
let jid = Jid::domain("domain");
assert_eq!(jid.node, None);
assert_eq!(jid.domain, "domain".to_owned());
assert_eq!(jid.resource, None);
Returns a new Jabber ID from the current one with only domain.
This is of the form domain
.
use jid::Jid;
let jid = Jid::full("node", "domain", "resource").into_domain_jid();
assert_eq!(jid.node, None);
assert_eq!(jid.domain, "domain".to_owned());
assert_eq!(jid.resource, None);
pub fn domain_with_resource<DS, RS>(domain: DS, resource: RS) -> Jid where DS: Into<String>, RS: Into<String>, | [src] |
Constructs a Jabber ID containing the domain
and resource
components.
This is of the form domain
/resource
.
use jid::Jid;
let jid = Jid::domain_with_resource("domain", "resource");
assert_eq!(jid.node, None);
assert_eq!(jid.domain, "domain".to_owned());
assert_eq!(jid.resource, Some("resource".to_owned()));
Constructs a new Jabber ID from an existing one, with the node swapped out with a new one.
use jid::Jid;
let jid = Jid::domain("domain");
assert_eq!(jid.node, None);
let new_jid = jid.with_node("node");
assert_eq!(new_jid.node, Some("node".to_owned()));
pub fn with_domain<S>(&self, domain: S) -> Jid where S: Into<String>, | [src] |
Constructs a new Jabber ID from an existing one, with the domain swapped out with a new one.
use jid::Jid;
let jid = Jid::domain("domain");
assert_eq!(jid.domain, "domain");
let new_jid = jid.with_domain("new_domain");
assert_eq!(new_jid.domain, "new_domain");
Constructs a new Jabber ID from an existing one, with the resource swapped out with a new one.
use jid::Jid;
let jid = Jid::domain("domain");
assert_eq!(jid.resource, None);
let new_jid = jid.with_resource("resource");
assert_eq!(new_jid.resource, Some("resource".to_owned()));
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Formats the value using the given formatter. Read more
Feeds this value into the given [Hasher
]. Read more
Feeds a slice of this type into the given [Hasher
]. Read more
The associated error which can be returned from parsing.
Parses a string s
to return a value of this type. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
Converts the given value to a String
. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static