[−][src]Struct xmpp_parsers::message::Message
The main structure representing the <message/>
stanza.
Fields
from: Option<Jid>
The JID emitting this stanza.
to: Option<Jid>
The recipient of this stanza.
id: Option<String>
The @id attribute of this stanza, which is required in order to match a request with its response.
type_: MessageType
The type of this message.
bodies: BTreeMap<String, Body>
A list of bodies, sorted per language. Use get_best_body() to access them on reception.
subjects: BTreeMap<String, Subject>
A list of subjects, sorted per language. Use get_best_subject() to access them on reception.
thread: Option<Thread>
An optional thread identifier, so that other people can reply directly to this message.
payloads: Vec<Element>
A list of the extension payloads contained in this stanza.
Methods
impl Message
[src]
pub fn new(to: Option<Jid>) -> Message
[src]
Creates a new <message/>
stanza for the given recipient.
pub fn get_best_body(
&self,
preferred_langs: Vec<&str>
) -> Option<(String, &Body)>
[src]
&self,
preferred_langs: Vec<&str>
) -> Option<(String, &Body)>
Returns the best matching body from a list of languages.
For instance, if a message contains both an xml:lang='de', an xml:lang='fr' and an English
body without an xml:lang attribute, and you pass ["fr", "en"] as your preferred languages,
Some(("fr", the_second_body))
will be returned.
If no body matches, an undefined body will be returned.
pub fn get_best_subject(
&self,
preferred_langs: Vec<&str>
) -> Option<(String, &Subject)>
[src]
&self,
preferred_langs: Vec<&str>
) -> Option<(String, &Subject)>
Returns the best matching subject from a list of languages.
For instance, if a message contains both an xml:lang='de', an xml:lang='fr' and an English
subject without an xml:lang attribute, and you pass ["fr", "en"] as your preferred
languages, Some(("fr", the_second_subject))
will be returned.
If no subject matches, an undefined subject will be returned.
Trait Implementations
impl From<Message> for Element
[src]
impl Clone for Message
[src]
fn clone(&self) -> Message
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Debug for Message
[src]
impl TryFrom<Element> for Message
[src]
Auto Trait Implementations
impl Unpin for Message
impl !Sync for Message
impl !Send for Message
impl !RefUnwindSafe for Message
impl !UnwindSafe for Message
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> IntoElements for T where
T: Into<Element>,
[src]
T: Into<Element>,
fn into_elements(self, emitter: &mut ElementEmitter)
[src]
impl<T> Same<T> for T
type Output = T
Should always be Self