Replace HashMap with BTreeMap

This commit is contained in:
Jonas Platte 2020-04-19 16:48:20 +02:00
parent 6452401add
commit c5689f3da5
No known key found for this signature in database
GPG Key ID: CC154DE0E30B7C67
21 changed files with 64 additions and 61 deletions

View File

@ -60,7 +60,7 @@ Organize your imports into three groups separated by blank lines:
For example, For example,
```rust ```rust
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -71,7 +71,7 @@ Also, group imports by module. For example, do this:
```rust ```rust
use std::{ use std::{
collections::HashMap, collections::BTreeMap,
convert::TryFrom, convert::TryFrom,
fmt::{Debug, Display, Error as FmtError, Formatter}, fmt::{Debug, Display, Error as FmtError, Formatter},
}; };
@ -80,7 +80,7 @@ use std::{
as opposed to: as opposed to:
```rust ```rust
use std::collections::HashMap; use std::collections::BTreeMap;
use std::convert::TryFrom; use std::convert::TryFrom;
use std::fmt::{Debug, Display, Error as FmtError, Formatter}; use std::fmt::{Debug, Display, Error as FmtError, Formatter};
``` ```

View File

@ -3,7 +3,7 @@
use ruma_api::ruma_api; use ruma_api::ruma_api;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use serde_json::Value; use serde_json::Value;
use std::collections::HashMap; use std::collections::BTreeMap;
ruma_api! { ruma_api! {
metadata { metadata {
@ -39,7 +39,7 @@ pub struct Capabilities {
/// Any other custom capabilities that the server supports outside of the specification, /// Any other custom capabilities that the server supports outside of the specification,
/// labeled using the Java package naming convention and stored as arbitrary JSON values. /// labeled using the Java package naming convention and stored as arbitrary JSON values.
#[serde(flatten)] #[serde(flatten)]
pub custom_capabilities: HashMap<String, Value>, pub custom_capabilities: BTreeMap<String, Value>,
} }
/// Information about the m.change_password capability /// Information about the m.change_password capability
@ -56,7 +56,7 @@ pub struct RoomVersionsCapability {
pub default: String, pub default: String,
/// A detailed description of the room versions the server supports. /// A detailed description of the room versions the server supports.
pub available: HashMap<String, RoomVersionStability>, pub available: BTreeMap<String, RoomVersionStability>,
} }
/// The stability of a room version /// The stability of a room version

View File

@ -12,8 +12,9 @@ use serde::{
}; };
pub mod send_event_to_device; pub mod send_event_to_device;
/// Represents one or all of a user's devices. /// Represents one or all of a user's devices.
#[derive(Clone, Debug, Hash, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord)]
pub enum DeviceIdOrAllDevices { pub enum DeviceIdOrAllDevices {
/// Represents a device Id for one of a user's devices. /// Represents a device Id for one of a user's devices.
DeviceId(DeviceId), DeviceId(DeviceId),

View File

@ -1,6 +1,6 @@
//! [PUT /_matrix/client/r0/sendToDevice/{eventType}/{txnId}](https://matrix.org/docs/spec/client_server/r0.6.0#put-matrix-client-r0-sendtodevice-eventtype-txnid) //! [PUT /_matrix/client/r0/sendToDevice/{eventType}/{txnId}](https://matrix.org/docs/spec/client_server/r0.6.0#put-matrix-client-r0-sendtodevice-eventtype-txnid)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_events::{collections::all, EventResult}; use ruma_events::{collections::all, EventResult};
@ -29,7 +29,7 @@ ruma_api! {
/// device. Individual message events can be sent to devices, but all /// device. Individual message events can be sent to devices, but all
/// events must be of the same type. /// events must be of the same type.
#[wrap_incoming(all::Event with EventResult)] #[wrap_incoming(all::Event with EventResult)]
pub messages: HashMap<UserId, HashMap<DeviceIdOrAllDevices, all::Event>> pub messages: BTreeMap<UserId, BTreeMap<DeviceIdOrAllDevices, all::Event>>
} }
response {} response {}

View File

@ -1,7 +1,7 @@
//! Endpoints for key management //! Endpoints for key management
use std::{ use std::{
collections::HashMap, collections::BTreeMap,
convert::TryFrom, convert::TryFrom,
fmt::{Debug, Display, Error as FmtError, Formatter}, fmt::{Debug, Display, Error as FmtError, Formatter},
}; };
@ -19,7 +19,7 @@ pub mod get_keys;
pub mod upload_keys; pub mod upload_keys;
/// The basic key algorithms in the specification /// The basic key algorithms in the specification
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize)]
pub enum KeyAlgorithm { pub enum KeyAlgorithm {
/// The Ed25519 signature algorithm. /// The Ed25519 signature algorithm.
#[serde(rename = "ed25519")] #[serde(rename = "ed25519")]
@ -59,7 +59,7 @@ impl TryFrom<&'_ str> for KeyAlgorithm {
} }
/// A key algorithm and a device id, combined with a ':' /// A key algorithm and a device id, combined with a ':'
#[derive(Debug, Clone, Hash, PartialEq, Eq)] #[derive(Debug, Clone, PartialEq, Eq, PartialOrd, Ord)]
pub struct AlgorithmAndDeviceId(pub KeyAlgorithm, pub DeviceId); pub struct AlgorithmAndDeviceId(pub KeyAlgorithm, pub DeviceId);
impl Serialize for AlgorithmAndDeviceId { impl Serialize for AlgorithmAndDeviceId {
@ -116,9 +116,9 @@ pub struct DeviceKeys {
/// The encryption algorithms supported by this device. /// The encryption algorithms supported by this device.
pub algorithms: Vec<Algorithm>, pub algorithms: Vec<Algorithm>,
/// Public identity keys. /// Public identity keys.
pub keys: HashMap<AlgorithmAndDeviceId, String>, pub keys: BTreeMap<AlgorithmAndDeviceId, String>,
/// Signatures for the device key object. /// Signatures for the device key object.
pub signatures: HashMap<UserId, HashMap<AlgorithmAndDeviceId, String>>, pub signatures: BTreeMap<UserId, BTreeMap<AlgorithmAndDeviceId, String>>,
/// Additional data added to the device key information by intermediate servers, and /// Additional data added to the device key information by intermediate servers, and
/// not covered by the signatures. /// not covered by the signatures.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
@ -138,7 +138,7 @@ pub struct SignedKey {
/// Base64-encoded 32-byte Curve25519 public key. /// Base64-encoded 32-byte Curve25519 public key.
pub key: String, pub key: String,
/// Signatures for the key object. /// Signatures for the key object.
pub signatures: HashMap<UserId, HashMap<AlgorithmAndDeviceId, String>>, pub signatures: BTreeMap<UserId, BTreeMap<AlgorithmAndDeviceId, String>>,
} }
/// A one-time public key for "pre-key" messages. /// A one-time public key for "pre-key" messages.

View File

@ -1,6 +1,6 @@
//! [POST /_matrix/client/r0/keys/claim](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-keys-claim) //! [POST /_matrix/client/r0/keys/claim](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-keys-claim)
use std::collections::HashMap; use std::collections::BTreeMap;
use std::time::Duration; use std::time::Duration;
@ -31,16 +31,16 @@ ruma_api! {
pub timeout: Option<Duration>, pub timeout: Option<Duration>,
/// The keys to be claimed. /// The keys to be claimed.
pub one_time_keys: HashMap<UserId, HashMap<DeviceId, KeyAlgorithm>>, pub one_time_keys: BTreeMap<UserId, BTreeMap<DeviceId, KeyAlgorithm>>,
} }
response { response {
/// If any remote homeservers could not be reached, they are recorded here. /// If any remote homeservers could not be reached, they are recorded here.
/// The names of the properties are the names of the unreachable servers. /// The names of the properties are the names of the unreachable servers.
pub failures: HashMap<String, Value>, pub failures: BTreeMap<String, Value>,
/// One-time keys for the queried devices. /// One-time keys for the queried devices.
pub one_time_keys: HashMap<UserId, HashMap<DeviceId, HashMap<AlgorithmAndDeviceId, OneTimeKey>>>, pub one_time_keys: BTreeMap<UserId, BTreeMap<DeviceId, BTreeMap<AlgorithmAndDeviceId, OneTimeKey>>>,
} }
error: crate::Error error: crate::Error

View File

@ -1,6 +1,6 @@
//! [POST /_matrix/client/r0/keys/query](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-keys-query) //! [POST /_matrix/client/r0/keys/query](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-keys-query)
use std::{collections::HashMap, time::Duration}; use std::{collections::BTreeMap, time::Duration};
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::{DeviceId, UserId}; use ruma_identifiers::{DeviceId, UserId};
@ -29,7 +29,7 @@ ruma_api! {
pub timeout: Option<Duration>, pub timeout: Option<Duration>,
/// The keys to be downloaded. An empty list indicates all devices for the corresponding user. /// The keys to be downloaded. An empty list indicates all devices for the corresponding user.
pub device_keys: HashMap<UserId, Vec<DeviceId>>, pub device_keys: BTreeMap<UserId, Vec<DeviceId>>,
/// If the client is fetching keys as a result of a device update received in a sync request, /// If the client is fetching keys as a result of a device update received in a sync request,
/// this should be the 'since' token of that sync request, or any later sync token. /// this should be the 'since' token of that sync request, or any later sync token.
@ -41,10 +41,10 @@ ruma_api! {
response { response {
/// If any remote homeservers could not be reached, they are recorded here. /// If any remote homeservers could not be reached, they are recorded here.
/// The names of the properties are the names of the unreachable servers. /// The names of the properties are the names of the unreachable servers.
pub failures: HashMap<String, Value>, pub failures: BTreeMap<String, Value>,
/// Information on the queried devices. /// Information on the queried devices.
pub device_keys: HashMap<UserId, HashMap<DeviceId, DeviceKeys>>, pub device_keys: BTreeMap<UserId, BTreeMap<DeviceId, DeviceKeys>>,
} }
error: crate::Error error: crate::Error

View File

@ -1,6 +1,6 @@
//! [POST /_matrix/client/r0/keys/upload](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-keys-upload) //! [POST /_matrix/client/r0/keys/upload](https://matrix.org/docs/spec/client_server/r0.6.0#post-matrix-client-r0-keys-upload)
use std::collections::HashMap; use std::collections::BTreeMap;
use js_int::UInt; use js_int::UInt;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -24,13 +24,13 @@ ruma_api! {
/// One-time public keys for "pre-key" messages. /// One-time public keys for "pre-key" messages.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub one_time_keys: Option<HashMap<AlgorithmAndDeviceId, OneTimeKey>>, pub one_time_keys: Option<BTreeMap<AlgorithmAndDeviceId, OneTimeKey>>,
} }
response { response {
/// For each key algorithm, the number of unclaimed one-time keys of that /// For each key algorithm, the number of unclaimed one-time keys of that
/// type currently held on the server for this device. /// type currently held on the server for this device.
pub one_time_key_counts: HashMap<KeyAlgorithm, UInt> pub one_time_key_counts: BTreeMap<KeyAlgorithm, UInt>
} }
error: crate::Error error: crate::Error

View File

@ -12,7 +12,7 @@ pub mod kick_user;
pub mod leave_room; pub mod leave_room;
pub mod unban_user; pub mod unban_user;
use std::collections::HashMap; use std::collections::BTreeMap;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -27,7 +27,7 @@ pub struct ThirdPartySigned {
/// The Matrix ID of the user who issued the invite. /// The Matrix ID of the user who issued the invite.
pub sender: String, pub sender: String,
/// A signatures object containing a signature of the entire signed object. /// A signatures object containing a signature of the entire signed object.
pub signatures: HashMap<String, HashMap<String, String>>, pub signatures: BTreeMap<String, BTreeMap<String, String>>,
/// The state key of the m.third_party_invite event. /// The state key of the m.third_party_invite event.
pub token: String, pub token: String,
} }

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/rooms/{roomId}/joined_members](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-rooms-roomid-joined-members) //! [GET /_matrix/client/r0/rooms/{roomId}/joined_members](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-rooms-roomid-joined-members)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::{RoomId, UserId}; use ruma_identifiers::{RoomId, UserId};
@ -25,7 +25,7 @@ ruma_api! {
response { response {
/// A list of the rooms the user is in, i.e. /// A list of the rooms the user is in, i.e.
/// the ID of each room in which the user has joined membership. /// the ID of each room in which the user has joined membership.
pub joined: HashMap<UserId, RoomMember>, pub joined: BTreeMap<UserId, RoomMember>,
} }
error: crate::Error error: crate::Error

View File

@ -27,7 +27,9 @@ pub mod set_pushrule_actions;
pub mod set_pushrule_enabled; pub mod set_pushrule_enabled;
/// The kinds of push rules that are available /// The kinds of push rules that are available
#[derive(Clone, Copy, Debug, Eq, PartialEq, Hash, Serialize, Deserialize, Display, EnumString)] #[derive(
Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Serialize, Deserialize, Display, EnumString,
)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
#[strum(serialize_all = "snake_case")] #[strum(serialize_all = "snake_case")]
pub enum RuleKind { pub enum RuleKind {

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/pushrules/](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-pushrules) //! [GET /_matrix/client/r0/pushrules/](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-pushrules)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -20,7 +20,7 @@ ruma_api! {
response { response {
/// The global ruleset /// The global ruleset
pub global: HashMap<RuleKind, Vec<PushRule>> pub global: BTreeMap<RuleKind, Vec<PushRule>>
} }
error: crate::Error error: crate::Error

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/pushrules/global/](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-pushrules) //! [GET /_matrix/client/r0/pushrules/global/](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-pushrules)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -21,7 +21,7 @@ ruma_api! {
response { response {
/// The global ruleset. /// The global ruleset.
#[ruma_api(body)] #[ruma_api(body)]
pub global: HashMap<RuleKind, Vec<PushRule>>, pub global: BTreeMap<RuleKind, Vec<PushRule>>,
} }
error: crate::Error error: crate::Error

View File

@ -1,6 +1,6 @@
//! [POST /_matrix/client/r0/search](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-search) //! [POST /_matrix/client/r0/search](https://matrix.org/docs/spec/client_server/r0.4.0.html#post-matrix-client-r0-search)
use std::collections::HashMap; use std::collections::BTreeMap;
use js_int::UInt; use js_int::UInt;
use ruma_api::{ruma_api, Outgoing}; use ruma_api::{ruma_api, Outgoing};
@ -102,7 +102,7 @@ pub struct EventContextResult {
/// The historic profile information of the users that sent the events returned. /// The historic profile information of the users that sent the events returned.
// TODO: Not sure this is right. https://github.com/matrix-org/matrix-doc/issues/773 // TODO: Not sure this is right. https://github.com/matrix-org/matrix-doc/issues/773
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub profile_info: Option<HashMap<UserId, UserProfile>>, pub profile_info: Option<BTreeMap<UserId, UserProfile>>,
/// Pagination token for the start of the chunk. /// Pagination token for the start of the chunk.
pub start: String, pub start: String,
} }
@ -115,7 +115,7 @@ pub struct Grouping {
} }
/// The key within events to use for this grouping. /// The key within events to use for this grouping.
#[derive(Clone, Copy, Debug, Deserialize, Eq, Hash, PartialEq, Serialize)] #[derive(Clone, Copy, Debug, Deserialize, PartialEq, Eq, PartialOrd, Ord, Serialize)]
#[serde(rename_all = "snake_case")] #[serde(rename_all = "snake_case")]
pub enum GroupingKey { pub enum GroupingKey {
/// `room_id` /// `room_id`
@ -172,7 +172,7 @@ pub struct RoomEventResults {
pub count: UInt, pub count: UInt,
/// Any groups that were requested. /// Any groups that were requested.
// TODO: Not sure this is right. https://github.com/matrix-org/matrix-doc/issues/773 // TODO: Not sure this is right. https://github.com/matrix-org/matrix-doc/issues/773
pub groups: HashMap<GroupingKey, HashMap<RoomId, ResultGroup>>, pub groups: BTreeMap<GroupingKey, BTreeMap<RoomId, ResultGroup>>,
/// Token that can be used to get the next batch of results, by passing as the `next_batch` /// Token that can be used to get the next batch of results, by passing as the `next_batch`
/// parameter to the next call. If this field is absent, there are no more results. /// parameter to the next call. If this field is absent, there are no more results.
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/admin/whois/{userId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-admin-whois-userid) //! [GET /_matrix/client/r0/admin/whois/{userId}](https://matrix.org/docs/spec/client_server/r0.4.0.html#get-matrix-client-r0-admin-whois-userid)
use std::{collections::HashMap, time::SystemTime}; use std::{collections::BTreeMap, time::SystemTime};
use ruma_api::ruma_api; use ruma_api::ruma_api;
use ruma_identifiers::UserId; use ruma_identifiers::UserId;
@ -26,7 +26,7 @@ ruma_api! {
/// The Matrix user ID of the user. /// The Matrix user ID of the user.
pub user_id: UserId, pub user_id: UserId,
/// A map of the user's device identifiers to information about that device. /// A map of the user's device identifiers to information about that device.
pub devices: HashMap<String, DeviceInfo>, pub devices: BTreeMap<String, DeviceInfo>,
} }
error: crate::Error error: crate::Error

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/sync](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-sync) //! [GET /_matrix/client/r0/sync](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-sync)
use std::{collections::HashMap, time::Duration}; use std::{collections::BTreeMap, time::Duration};
use js_int::UInt; use js_int::UInt;
use ruma_api::{ruma_api, Outgoing}; use ruma_api::{ruma_api, Outgoing};
@ -79,8 +79,8 @@ ruma_api! {
pub device_lists: Option<DeviceLists>, pub device_lists: Option<DeviceLists>,
/// For each key algorithm, the number of unclaimed one-time keys /// For each key algorithm, the number of unclaimed one-time keys
/// currently held on the server for a device. /// currently held on the server for a device.
#[serde(default, skip_serializing_if = "HashMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub device_one_time_keys_count: HashMap<KeyAlgorithm, UInt>, pub device_one_time_keys_count: BTreeMap<KeyAlgorithm, UInt>,
} }
error: crate::Error error: crate::Error
@ -131,13 +131,13 @@ pub enum Filter {
pub struct Rooms { pub struct Rooms {
/// The rooms that the user has left or been banned from. /// The rooms that the user has left or been banned from.
#[wrap_incoming(LeftRoom)] #[wrap_incoming(LeftRoom)]
pub leave: HashMap<RoomId, LeftRoom>, pub leave: BTreeMap<RoomId, LeftRoom>,
/// The rooms that the user has joined. /// The rooms that the user has joined.
#[wrap_incoming(JoinedRoom)] #[wrap_incoming(JoinedRoom)]
pub join: HashMap<RoomId, JoinedRoom>, pub join: BTreeMap<RoomId, JoinedRoom>,
/// The rooms that the user has been invited to. /// The rooms that the user has been invited to.
#[wrap_incoming(InvitedRoom)] #[wrap_incoming(InvitedRoom)]
pub invite: HashMap<RoomId, InvitedRoom>, pub invite: BTreeMap<RoomId, InvitedRoom>,
} }
/// Historical updates to left rooms. /// Historical updates to left rooms.

View File

@ -7,7 +7,7 @@ pub mod get_protocols;
pub mod get_user_for_protocol; pub mod get_user_for_protocol;
pub mod get_user_for_user_id; pub mod get_user_for_user_id;
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_identifiers::{RoomAliasId, UserId}; use ruma_identifiers::{RoomAliasId, UserId};
@ -23,7 +23,7 @@ pub struct Protocol {
/// A content URI representing an icon for the third party protocol. /// A content URI representing an icon for the third party protocol.
pub icon: String, pub icon: String,
/// The type definitions for the fields defined in `user_fields` and `location_fields`. /// The type definitions for the fields defined in `user_fields` and `location_fields`.
pub field_types: HashMap<String, FieldType>, pub field_types: BTreeMap<String, FieldType>,
/// A list of objects representing independent instances of configuration. /// A list of objects representing independent instances of configuration.
pub instances: Vec<ProtocolInstance>, pub instances: Vec<ProtocolInstance>,
} }
@ -37,7 +37,7 @@ pub struct ProtocolInstance {
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub icon: Option<String>, pub icon: Option<String>,
/// Preset values for `fields` the client may use to search by. /// Preset values for `fields` the client may use to search by.
pub fields: HashMap<String, String>, pub fields: BTreeMap<String, String>,
/// A unique identifier across all instances. /// A unique identifier across all instances.
pub network_id: String, pub network_id: String,
} }
@ -59,7 +59,7 @@ pub struct Location {
/// The protocol ID that the third party location is a part of. /// The protocol ID that the third party location is a part of.
pub protocol: String, pub protocol: String,
/// Information used to identify this third party location. /// Information used to identify this third party location.
pub fields: HashMap<String, String>, pub fields: BTreeMap<String, String>,
} }
/// A third party network user. /// A third party network user.
@ -70,7 +70,7 @@ pub struct User {
/// The protocol ID that the third party user is a part of. /// The protocol ID that the third party user is a part of.
pub protocol: String, pub protocol: String,
/// Information used to identify this third party user. /// Information used to identify this third party user.
pub fields: HashMap<String, String>, pub fields: BTreeMap<String, String>,
} }
/// The medium of a third party identifier. /// The medium of a third party identifier.

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/thirdparty/location/{protocol}](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-thirdparty-location-protocol) //! [GET /_matrix/client/r0/thirdparty/location/{protocol}](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-thirdparty-location-protocol)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -23,7 +23,7 @@ ruma_api! {
/// One or more custom fields to help identify the third party location. /// One or more custom fields to help identify the third party location.
// The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352. // The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352.
#[ruma_api(query_map)] #[ruma_api(query_map)]
pub fields: HashMap<String, String>, pub fields: BTreeMap<String, String>,
} }
response { response {

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/thirdparty/protocols](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-thirdparty-protocols) //! [GET /_matrix/client/r0/thirdparty/protocols](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-thirdparty-protocols)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -21,7 +21,7 @@ ruma_api! {
response { response {
/// Metadata about protocols supported by the homeserver. /// Metadata about protocols supported by the homeserver.
#[ruma_api(body)] #[ruma_api(body)]
pub protocols: HashMap<String, Protocol>, pub protocols: BTreeMap<String, Protocol>,
} }
error: crate::Error error: crate::Error

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/r0/thirdparty/user/{protocol}](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-thirdparty-user-protocol) //! [GET /_matrix/client/r0/thirdparty/user/{protocol}](https://matrix.org/docs/spec/client_server/r0.6.0#get-matrix-client-r0-thirdparty-user-protocol)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -23,7 +23,7 @@ ruma_api! {
/// One or more custom fields that are passed to the AS to help identify the user. /// One or more custom fields that are passed to the AS to help identify the user.
// The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352. // The specification is incorrect for this parameter. See matrix-org/matrix-doc#2352.
#[ruma_api(query_map)] #[ruma_api(query_map)]
pub fields: HashMap<String, String>, pub fields: BTreeMap<String, String>,
} }
response { response {

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/client/versions](https://matrix.org/docs/spec/client_server/r0.6.0.html#get-matrix-client-versions) //! [GET /_matrix/client/versions](https://matrix.org/docs/spec/client_server/r0.6.0.html#get-matrix-client-versions)
use std::collections::HashMap; use std::collections::BTreeMap;
use ruma_api::ruma_api; use ruma_api::ruma_api;
@ -20,8 +20,8 @@ ruma_api! {
/// A list of Matrix client API protocol versions supported by the homeserver. /// A list of Matrix client API protocol versions supported by the homeserver.
pub versions: Vec<String>, pub versions: Vec<String>,
/// Experimental features supported by the server. /// Experimental features supported by the server.
#[serde(default, skip_serializing_if = "HashMap::is_empty")] #[serde(default, skip_serializing_if = "BTreeMap::is_empty")]
pub unstable_features: HashMap<String, bool> pub unstable_features: BTreeMap<String, bool>
} }
error: crate::Error error: crate::Error