[][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.

Implementations

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 Clone for FullJid[src]

impl Debug for FullJid[src]

impl Display for FullJid[src]

impl Eq for FullJid[src]

impl From<BindResponse> for FullJid[src]

impl From<FullJid> for Jid[src]

impl FromStr for FullJid[src]

type Err = JidParseError

The associated error which can be returned from parsing.

impl Hash for FullJid[src]

impl Into<BareJid> for FullJid[src]

impl Into<Node> for FullJid[src]

impl IntoAttributeValue for FullJid[src]

impl PartialEq<FullJid> for FullJid[src]

impl PartialEq<FullJid> for Jid[src]

impl PartialEq<Jid> for FullJid[src]

impl StructuralEq for FullJid[src]

impl StructuralPartialEq for FullJid[src]

impl TryFrom<Jid> for FullJid[src]

type Error = JidParseError

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

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

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

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

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

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

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.