Add PartialEq, Eq, Hash to Enums

This commit is contained in:
bitfl0wer 2023-08-02 20:23:50 +02:00
parent 9f69f57635
commit a36d691fea
4 changed files with 6 additions and 6 deletions

View File

@ -105,7 +105,7 @@ pub struct InstallParams {
} }
bitflags! { bitflags! {
#[derive(Debug, Clone, Copy, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
/// # Reference /// # Reference
/// See <https://discord.com/developers/docs/resources/application#application-object-application-flags> /// See <https://discord.com/developers/docs/resources/application#application-object-application-flags>
pub struct ApplicationFlags: u64 { pub struct ApplicationFlags: u64 {
@ -163,7 +163,7 @@ pub struct ApplicationCommandOptionChoice {
pub value: Value, pub value: Value,
} }
#[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr)] #[derive(Debug, Clone, Copy, Serialize_repr, Deserialize_repr, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))] #[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
#[repr(i32)] #[repr(i32)]
/// # Reference /// # Reference
@ -219,7 +219,7 @@ pub struct ApplicationCommandPermission {
pub permission: bool, pub permission: bool,
} }
#[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone)] #[derive(Serialize_repr, Deserialize_repr, Debug, Default, Clone, PartialEq, Eq, Hash)]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
#[repr(u8)] #[repr(u8)]
/// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type> /// See <https://discord.com/developers/docs/interactions/application-commands#application-command-permissions-object-application-command-permission-type>

View File

@ -168,7 +168,7 @@ pub struct DefaultReaction {
pub emoji_name: Option<String>, pub emoji_name: Option<String>,
} }
#[derive(Default, Clone, Copy, Debug, Serialize_repr, Deserialize_repr, PartialEq)] #[derive(Default, Clone, Copy, Debug, Serialize_repr, Deserialize_repr, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))] #[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
#[serde(rename_all = "SCREAMING_SNAKE_CASE")] #[serde(rename_all = "SCREAMING_SNAKE_CASE")]
#[repr(i32)] #[repr(i32)]

View File

@ -53,7 +53,7 @@ pub struct RoleTags {
} }
bitflags! { bitflags! {
#[derive(Debug, Default, Clone, Hash, Serialize, Deserialize)] #[derive(Debug, Default, Clone, Hash, Serialize, Deserialize, PartialEq, Eq)]
/// Permissions limit what users of certain roles can do on a Guild to Guild basis. /// Permissions limit what users of certain roles can do on a Guild to Guild basis.
/// ///
/// # Reference: /// # Reference:

View File

@ -91,7 +91,7 @@ impl From<User> for PublicUser {
const CUSTOM_USER_FLAG_OFFSET: u64 = 1 << 32; const CUSTOM_USER_FLAG_OFFSET: u64 = 1 << 32;
bitflags::bitflags! { bitflags::bitflags! {
#[derive(Debug, Clone, Copy, Serialize, Deserialize)] #[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "sqlx", derive(sqlx::Type))] #[cfg_attr(feature = "sqlx", derive(sqlx::Type))]
pub struct UserFlags: u64 { pub struct UserFlags: u64 {
const DISCORD_EMPLOYEE = 1 << 0; const DISCORD_EMPLOYEE = 1 << 0;