Skip to content

Commit

Permalink
fix?: add Default to OneOrMoreSnowflakes, GatewayRequestGuildMembers
Browse files Browse the repository at this point in the history
  • Loading branch information
kozabrada123 committed Nov 6, 2024
1 parent 85e922b commit d9e317f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/types/events/request_members.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
use crate::types::{events::WebSocketEvent, OneOrMoreSnowflakes};
use serde::{Deserialize, Serialize};

#[derive(Debug, Deserialize, Serialize, WebSocketEvent, Clone)]
#[derive(Debug, Deserialize, Default, Serialize, WebSocketEvent, Clone)]
/// Used to request members for a guild or a list of guilds.
///
/// Fires multiple [crate::types::events::GuildMembersChunk] events (each with up to 1000 members)
Expand Down
8 changes: 8 additions & 0 deletions src/types/utils/snowflake.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,14 @@ pub enum OneOrMoreSnowflakes {
More(Vec<Snowflake>)
}

// Note: allows us to have Default on the events
// that use this type
impl Default for OneOrMoreSnowflakes {
fn default() -> Self {
Snowflake::default().into()
}
}

impl Display for OneOrMoreSnowflakes {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
match self {
Expand Down

0 comments on commit d9e317f

Please sign in to comment.