[][src]Struct xmpp_parsers::FullJid

pub struct FullJid {
    pub node: Option<String>,
    pub domain: String,
    pub resource: String,
}

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: String

The domain of the Jabber ID.

resource: String

The resource of the Jabber ID.

Methods

impl FullJid[src]

pub fn new<NS, DS, RS>(node: NS, domain: DS, resource: RS) -> FullJid where
    DS: Into<String>,
    NS: Into<String>,
    RS: Into<String>, 
[src]

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());

pub fn with_node<NS>(&self, node: NS) -> FullJid where
    NS: Into<String>, 
[src]

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()));

pub fn with_domain<DS>(&self, domain: DS) -> FullJid where
    DS: Into<String>, 
[src]

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");

pub fn with_resource<RS>(&self, resource: RS) -> FullJid where
    RS: Into<String>, 
[src]

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

impl Eq for FullJid[src]

impl IntoAttributeValue for FullJid[src]

impl IntoElements for FullJid[src]

impl PartialEq<FullJid> for FullJid[src]

impl Display for FullJid[src]

impl Into<BareJid> for FullJid[src]

impl Debug for FullJid[src]

impl Hash for FullJid[src]

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl FromStr for FullJid[src]

type Err = JidParseError

The associated error which can be returned from parsing.

impl Clone for FullJid[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

Auto Trait Implementations

impl Send for FullJid

impl Unpin for FullJid

impl Sync for FullJid

impl UnwindSafe for FullJid

impl RefUnwindSafe for FullJid

Blanket Implementations

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> IntoElements for T where
    T: Into<Element>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self