Use BTreeMap instead of HashMap

This commit is contained in:
Jonas Platte 2020-05-07 20:30:26 +02:00
parent f7d6cf9b3f
commit a742ef47df
No known key found for this signature in database
GPG Key ID: 7D261D771D915378
3 changed files with 9 additions and 9 deletions

View File

@ -6,7 +6,7 @@ pub mod get_protocol;
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};
@ -22,7 +22,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>,
} }
@ -36,7 +36,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,
} }
@ -58,7 +58,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.
@ -69,5 +69,5 @@ 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>,
} }

View File

@ -1,6 +1,6 @@
//! [GET /_matrix/app/v1/thirdparty/location/{protocol}](https://matrix.org/docs/spec/application_service/r0.1.2#get-matrix-app-v1-thirdparty-location-protocol) //! [GET /_matrix/app/v1/thirdparty/location/{protocol}](https://matrix.org/docs/spec/application_service/r0.1.2#get-matrix-app-v1-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/app/v1/thirdparty/user/{protocol}](https://matrix.org/docs/spec/application_service/r0.1.2#get-matrix-app-v1-thirdparty-user-protocol) //! [GET /_matrix/app/v1/thirdparty/user/{protocol}](https://matrix.org/docs/spec/application_service/r0.1.2#get-matrix-app-v1-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 {