mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
parsers: Add with_payload/with_payloads helpers on Message
Signed-off-by: Maxime “pep” Buquet <pep@bouah.net>
This commit is contained in:
parent
c8dcf5e7a7
commit
6cd4addc1a
1 changed files with 12 additions and 0 deletions
|
@ -154,6 +154,18 @@ impl Message {
|
|||
self
|
||||
}
|
||||
|
||||
/// Set a payload inside this message.
|
||||
pub fn with_payload<P: MessagePayload>(mut self, payload: P) -> Message {
|
||||
self.payloads.push(payload.into());
|
||||
self
|
||||
}
|
||||
|
||||
/// Set the payloads of this message.
|
||||
pub fn with_payloads(mut self, payloads: Vec<Element>) -> Message {
|
||||
self.payloads = payloads;
|
||||
self
|
||||
}
|
||||
|
||||
fn get_best<'a, T>(
|
||||
map: &'a BTreeMap<Lang, T>,
|
||||
preferred_langs: Vec<&str>,
|
||||
|
|
Loading…
Reference in a new issue