fix: remove indexmap from models

This commit is contained in:
Paul Makles
2023-08-27 15:43:57 +01:00
parent 7a31da4189
commit da231ae390

View File

@@ -1,8 +1,10 @@
use std::time::SystemTime; use std::{
collections::{HashMap, HashSet},
time::SystemTime,
};
use revolt_config::config; use revolt_config::config;
use indexmap::{IndexMap, IndexSet};
use iso8601_timestamp::Timestamp; use iso8601_timestamp::Timestamp;
use super::{Embed, File, MessageWebhook, User, Webhook}; use super::{Embed, File, MessageWebhook, User, Webhook};
@@ -45,8 +47,8 @@ auto_derived_partial!(
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]
pub replies: Option<Vec<String>>, pub replies: Option<Vec<String>>,
/// Hashmap of emoji IDs to array of user IDs /// Hashmap of emoji IDs to array of user IDs
#[serde(skip_serializing_if = "IndexMap::is_empty", default)] #[serde(skip_serializing_if = "HashMap::is_empty", default)]
pub reactions: IndexMap<String, IndexSet<String>>, pub reactions: HashMap<String, HashSet<String>>,
/// Information about how this message should be interacted with /// Information about how this message should be interacted with
#[serde(skip_serializing_if = "Interactions::is_default", default)] #[serde(skip_serializing_if = "Interactions::is_default", default)]
pub interactions: Interactions, pub interactions: Interactions,
@@ -105,7 +107,7 @@ auto_derived!(
pub struct Interactions { pub struct Interactions {
/// Reactions which should always appear and be distinct /// Reactions which should always appear and be distinct
#[serde(skip_serializing_if = "Option::is_none", default)] #[serde(skip_serializing_if = "Option::is_none", default)]
pub reactions: Option<IndexSet<String>>, pub reactions: Option<HashSet<String>>,
/// Whether reactions should be restricted to the given list /// Whether reactions should be restricted to the given list
/// ///
/// Can only be set to true if reactions list is of at least length 1 /// Can only be set to true if reactions list is of at least length 1