From 972a8427b061db05840bc2a1cf3b55467ee3dc2c Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Sun, 30 Jun 2024 21:42:50 +0200 Subject: [PATCH] xmpp-parsers: Use the new macro for the feature element --- parsers/src/disco.rs | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/parsers/src/disco.rs b/parsers/src/disco.rs index eb2191c..45455f9 100644 --- a/parsers/src/disco.rs +++ b/parsers/src/disco.rs @@ -30,14 +30,14 @@ pub struct DiscoInfoQuery { impl IqGetPayload for DiscoInfoQuery {} -generate_element!( -#[derive(Eq, Hash)] /// Structure representing a `` element. -Feature, "feature", DISCO_INFO, -attributes: [ +#[derive(FromXml, IntoXml, Debug, Clone, PartialEq, Eq, Hash)] +#[xml(namespace = ns::DISCO_INFO, name = "feature")] +pub struct Feature { /// Namespace of the feature we want to represent. - var: Required = "var", -]); + #[xml(attribute)] + pub var: String, +} impl Feature { /// Create a new `` with the according `@var`. @@ -381,7 +381,10 @@ mod tests { FromElementError::Invalid(Error::Other(string)) => string, _ => panic!(), }; - assert_eq!(message, "Required attribute 'var' missing."); + assert_eq!( + message, + "Required attribute field 'var' on Feature element missing." + ); } #[test]