xmpp-parsers: Make DiscoInfoResult::features a BTreeSet
Features must never be duplicated, so we can use a BTreeSet instead of a Vec to be nicer for users. It makes the internal API for computing caps and ecaps2 a bit worse, because it was expecting a slice directly, so for now let’s collect the BTreeSet into a Vec when computing the thing. A refactor to use Iterator might make it better eventually, but I won’t work on that before profiling it.
This commit is contained in:
parent
946d96d7c8
commit
bc88134c41
6 changed files with 20 additions and 9 deletions
|
|
@ -10,6 +10,7 @@ use crate::data_forms::DataForm;
|
|||
use crate::iq::{IqGetPayload, IqResultPayload};
|
||||
use crate::ns;
|
||||
use crate::rsm::{SetQuery, SetResult};
|
||||
use alloc::collections::BTreeSet;
|
||||
use jid::Jid;
|
||||
|
||||
/// Structure representing a `<query xmlns='http://jabber.org/protocol/disco#info'/>` element.
|
||||
|
|
@ -98,7 +99,7 @@ pub struct DiscoInfoResult {
|
|||
|
||||
/// List of features supported by this entity.
|
||||
#[xml(extract(n = .., name = "feature", fields(attribute(name = "var", type_ = String))))]
|
||||
pub features: Vec<String>,
|
||||
pub features: BTreeSet<String>,
|
||||
|
||||
/// List of extensions reported by this entity.
|
||||
#[xml(child(n = ..))]
|
||||
|
|
|
|||
Loading…
Reference in a new issue