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
|
|
@ -1,4 +1,5 @@
|
|||
use futures::stream::StreamExt;
|
||||
use std::collections::BTreeSet;
|
||||
use std::env::args;
|
||||
use std::fs::{create_dir_all, File};
|
||||
use std::io::{self, Write};
|
||||
|
|
@ -184,10 +185,10 @@ fn make_error(
|
|||
|
||||
fn make_disco() -> DiscoInfoResult {
|
||||
let identities = vec![Identity::new("client", "bot", "en", "tokio-xmpp")];
|
||||
let features = vec![
|
||||
let features = BTreeSet::from([
|
||||
String::from(ns::DISCO_INFO),
|
||||
format!("{}+notify", ns::AVATAR_METADATA),
|
||||
];
|
||||
]);
|
||||
DiscoInfoResult {
|
||||
node: None,
|
||||
identities,
|
||||
|
|
|
|||
Loading…
Reference in a new issue