parsers: port version to derive macros

We can *finally* do it!
This commit is contained in:
Jonas Schäfer 2024-08-04 15:12:25 +02:00
parent c7c180feb6
commit f466b18622

View file

@ -19,23 +19,25 @@ pub struct VersionQuery;
impl IqGetPayload for VersionQuery {} impl IqGetPayload for VersionQuery {}
generate_element!( /// Represents the answer about the software version we are using.
/// Represents the answer about the software version we are using. ///
/// /// It should only be used in an `<iq type='result'/>`, as it can only
/// It should only be used in an `<iq type='result'/>`, as it can only /// represent the result, and not a request.
/// represent the result, and not a request. #[derive(FromXml, AsXml, PartialEq, Debug, Clone)]
VersionResult, "query", VERSION, #[xml(namespace = ns::VERSION, name = "query")]
children: [ pub struct VersionResult {
/// The name of this client. /// The name of this client.
name: Required<String> = ("name", VERSION) => String, #[xml(extract(fields(text)))]
pub name: String,
/// The version of this client. /// The version of this client.
version: Required<String> = ("version", VERSION) => String, #[xml(extract(fields(text)))]
pub version: String,
/// The OS this client is running on. /// The OS this client is running on.
os: Option<String> = ("os", VERSION) => String #[xml(extract(default, fields(text(type_ = String))))]
] pub os: Option<String>,
); }
impl IqResultPayload for VersionResult {} impl IqResultPayload for VersionResult {}