mirror of
https://gitlab.com/xmpp-rs/xmpp-rs.git
synced 2024-07-12 22:21:53 +00:00
xmpp-parsers: Use the new macro for the feature element
This commit is contained in:
parent
0e4865006c
commit
972a8427b0
1 changed files with 10 additions and 7 deletions
|
@ -30,14 +30,14 @@ pub struct DiscoInfoQuery {
|
||||||
|
|
||||||
impl IqGetPayload for DiscoInfoQuery {}
|
impl IqGetPayload for DiscoInfoQuery {}
|
||||||
|
|
||||||
generate_element!(
|
|
||||||
#[derive(Eq, Hash)]
|
|
||||||
/// Structure representing a `<feature xmlns='http://jabber.org/protocol/disco#info'/>` element.
|
/// Structure representing a `<feature xmlns='http://jabber.org/protocol/disco#info'/>` element.
|
||||||
Feature, "feature", DISCO_INFO,
|
#[derive(FromXml, IntoXml, Debug, Clone, PartialEq, Eq, Hash)]
|
||||||
attributes: [
|
#[xml(namespace = ns::DISCO_INFO, name = "feature")]
|
||||||
|
pub struct Feature {
|
||||||
/// Namespace of the feature we want to represent.
|
/// Namespace of the feature we want to represent.
|
||||||
var: Required<String> = "var",
|
#[xml(attribute)]
|
||||||
]);
|
pub var: String,
|
||||||
|
}
|
||||||
|
|
||||||
impl Feature {
|
impl Feature {
|
||||||
/// Create a new `<feature/>` with the according `@var`.
|
/// Create a new `<feature/>` with the according `@var`.
|
||||||
|
@ -381,7 +381,10 @@ mod tests {
|
||||||
FromElementError::Invalid(Error::Other(string)) => string,
|
FromElementError::Invalid(Error::Other(string)) => string,
|
||||||
_ => panic!(),
|
_ => panic!(),
|
||||||
};
|
};
|
||||||
assert_eq!(message, "Required attribute 'var' missing.");
|
assert_eq!(
|
||||||
|
message,
|
||||||
|
"Required attribute field 'var' on Feature element missing."
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
|
|
Loading…
Reference in a new issue