[][src]Struct xmpp_parsers::presence::Presence

pub struct Presence {
    pub from: Option<Jid>,
    pub to: Option<Jid>,
    pub id: Option<String>,
    pub type_: Type,
    pub show: Option<Show>,
    pub statuses: BTreeMap<String, String>,
    pub priority: i8,
    pub payloads: Vec<Element>,
}

The main structure representing the <presence/> stanza.

Fields

from: Option<Jid>

The sender of this presence.

to: Option<Jid>

The recipient of this presence.

id: Option<String>

The identifier, unique on this stream, of this stanza.

type_: Type

The type of this presence stanza.

show: Option<Show>

The availability of the sender of this presence.

statuses: BTreeMap<String, String>

A localised list of statuses defined in this presence.

priority: i8

The sender’s resource priority, if negative it won’t receive messages that haven’t been directed to it.

payloads: Vec<Element>

A list of payloads contained in this presence.

Methods

impl Presence[src]

pub fn new(type_: Type) -> Presence[src]

Create a new presence of this type.

pub fn with_from(self, from: Option<Jid>) -> Presence[src]

Set the emitter of this presence, this should only be useful for servers and components, as clients can only send presences from their own resource (which is implicit).

pub fn with_to(self, to: Option<Jid>) -> Presence[src]

Set the recipient of this presence, this is only useful for directed presences.

pub fn with_id(self, id: Option<String>) -> Presence[src]

Set the identifier for this presence.

pub fn with_show(self, show: Show) -> Presence[src]

Set the availability information of this presence.

pub fn with_priority(self, priority: i8) -> Presence[src]

Set the priority of this presence.

pub fn with_payloads(self, payloads: Vec<Element>) -> Presence[src]

Set the payloads of this presence.

pub fn set_status<L, S>(&mut self, lang: L, status: S) where
    L: Into<String>,
    S: Into<String>, 
[src]

Set the availability information of this presence.

pub fn add_payload<P: PresencePayload>(&mut self, payload: P)[src]

Add a payload to this presence.

Trait Implementations

impl From<Presence> for Element[src]

impl Clone for Presence[src]

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

Performs copy-assignment from source. Read more

impl Debug for Presence[src]

impl TryFrom<Element> for Presence[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

impl Unpin for Presence

impl !Sync for Presence

impl !Send for Presence

impl !RefUnwindSafe for Presence

impl !UnwindSafe for Presence

Blanket Implementations

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

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

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.

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

impl<T> BorrowMut<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