iq: Implement the Iq*Payload traits on every possible payload.

This commit is contained in:
Emmanuel Gil Peyrot 2018-05-16 15:08:17 +02:00
commit 412eafb363
11 changed files with 64 additions and 0 deletions

View file

@ -14,6 +14,7 @@ use jid::Jid;
use error::Error;
use ns;
use iq::{IqGetPayload, IqResultPayload};
use data_forms::{DataForm, DataFormType};
generate_element_with_only_attributes!(
@ -26,6 +27,8 @@ DiscoInfoQuery, "query", DISCO_INFO, [
node: Option<String> = "node" => optional,
]);
impl IqGetPayload for DiscoItemsQuery {}
generate_element_with_only_attributes!(
/// Structure representing a `<feature xmlns='http://jabber.org/protocol/disco#info'/>` element.
#[derive(PartialEq)]
@ -108,6 +111,8 @@ pub struct DiscoInfoResult {
pub extensions: Vec<DataForm>,
}
impl IqResultPayload for DiscoInfoResult {}
impl TryFrom<Element> for DiscoInfoResult {
type Err = Error;
@ -190,6 +195,8 @@ DiscoItemsQuery, "query", DISCO_ITEMS, [
node: Option<String> = "node" => optional,
]);
impl IqGetPayload for DiscoInfoResult {}
generate_element_with_only_attributes!(
/// Structure representing an `<item xmlns='http://jabber.org/protocol/disco#items'/>` element.
Item, "item", DISCO_ITEMS, [
@ -218,6 +225,8 @@ generate_element_with_children!(
]
);
impl IqResultPayload for DiscoItemsResult {}
#[cfg(test)]
mod tests {
use super::*;