xmpp-parsers: Replace bind::Required with an #[xml(flag)]
This makes the code simpler to read.
This commit is contained in:
parent
ca6e04f931
commit
4d6e1363db
3 changed files with 4 additions and 9 deletions
|
|
@ -11,6 +11,7 @@ XXXX-YY-ZZ RELEASER <admin@example.com>
|
||||||
used in XMPP.
|
used in XMPP.
|
||||||
- Remove the unnecessary SaslMechanisms struct, to directly extract
|
- Remove the unnecessary SaslMechanisms struct, to directly extract
|
||||||
SASL mechanisms in a Vec<String> in StreamFeatures.
|
SASL mechanisms in a Vec<String> in StreamFeatures.
|
||||||
|
- bind::BindFeature::required is now a bool, thanks to xso’s flag.
|
||||||
* Improvements:
|
* Improvements:
|
||||||
- Make Priority’s inner i8 pub, which had been broken since the
|
- Make Priority’s inner i8 pub, which had been broken since the
|
||||||
conversion to xso. (!632)
|
conversion to xso. (!632)
|
||||||
|
|
|
||||||
|
|
@ -15,15 +15,10 @@ use jid::{FullJid, Jid};
|
||||||
#[xml(namespace = ns::BIND, name = "bind")]
|
#[xml(namespace = ns::BIND, name = "bind")]
|
||||||
pub struct BindFeature {
|
pub struct BindFeature {
|
||||||
/// Present if bind is required.
|
/// Present if bind is required.
|
||||||
#[xml(child(default))]
|
#[xml(flag)]
|
||||||
required: Option<Required>,
|
required: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Notes that bind is required.
|
|
||||||
#[derive(FromXml, AsXml, Debug, Clone, PartialEq)]
|
|
||||||
#[xml(namespace = ns::BIND, name = "required")]
|
|
||||||
pub struct Required;
|
|
||||||
|
|
||||||
/// The request for resource binding, which is the process by which a client
|
/// The request for resource binding, which is the process by which a client
|
||||||
/// can obtain a full JID and start exchanging on the XMPP network.
|
/// can obtain a full JID and start exchanging on the XMPP network.
|
||||||
///
|
///
|
||||||
|
|
@ -84,7 +79,6 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_size() {
|
fn test_size() {
|
||||||
assert_size!(BindFeature, 1);
|
assert_size!(BindFeature, 1);
|
||||||
assert_size!(Required, 0);
|
|
||||||
assert_size!(BindQuery, 12);
|
assert_size!(BindQuery, 12);
|
||||||
assert_size!(BindResponse, 16);
|
assert_size!(BindResponse, 16);
|
||||||
}
|
}
|
||||||
|
|
@ -93,7 +87,6 @@ mod tests {
|
||||||
#[test]
|
#[test]
|
||||||
fn test_size() {
|
fn test_size() {
|
||||||
assert_size!(BindFeature, 1);
|
assert_size!(BindFeature, 1);
|
||||||
assert_size!(Required, 0);
|
|
||||||
assert_size!(BindQuery, 24);
|
assert_size!(BindQuery, 24);
|
||||||
assert_size!(BindResponse, 32);
|
assert_size!(BindResponse, 32);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -60,6 +60,7 @@ mod tests {
|
||||||
fn test_size() {
|
fn test_size() {
|
||||||
assert_size!(Request, 0);
|
assert_size!(Request, 0);
|
||||||
assert_size!(Proceed, 0);
|
assert_size!(Proceed, 0);
|
||||||
|
assert_size!(Failure, 0);
|
||||||
assert_size!(StartTls, 1);
|
assert_size!(StartTls, 1);
|
||||||
assert_size!(Nonza, 1);
|
assert_size!(Nonza, 1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue