parsers: port some elements with children to derive macros

This commit is contained in:
Jonas Schäfer 2024-06-29 16:14:12 +02:00
commit 5d284bbd3a
11 changed files with 106 additions and 117 deletions

View file

@ -117,22 +117,23 @@ impl From<Query> for Element {
}
}
generate_element!(
/// The wrapper around forwarded stanzas.
Result_, "result", MAM,
attributes: [
/// The stanza-id under which the archive stored this stanza.
id: Required<String> = "id",
/// The wrapper around forwarded stanzas.
#[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
#[xml(namespace = ns::MAM, name = "result")]
pub struct Result_ {
/// The stanza-id under which the archive stored this stanza.
#[xml(attribute)]
pub id: String,
/// The same queryid as the one requested in the
/// [query](struct.Query.html).
queryid: Option<QueryId> = "queryid",
],
children: [
/// The actual stanza being forwarded.
forwarded: Required<Forwarded> = ("forwarded", FORWARD) => Forwarded
]
);
/// The same queryid as the one requested in the
/// [query](struct.Query.html).
#[xml(attribute(default))]
pub queryid: Option<QueryId>,
/// The actual stanza being forwarded.
#[xml(child)]
pub forwarded: Forwarded,
}
impl MessagePayload for Result_ {}