#![allow(clippy::wildcard_imports)]
pub mod gateway;
mod dispatch;
mod kind;
pub use self::{
dispatch::{DispatchEvent, DispatchEventWithTypeDeserializer},
gateway::{GatewayEvent, GatewayEventDeserializer},
kind::EventType,
};
use super::{payload::incoming::*, CloseFrame};
use crate::id::{marker::GuildMarker, Id};
use std::error::Error;
use std::fmt::{Debug, Display, Formatter, Result as FmtResult};
#[derive(Clone, Debug, PartialEq)]
pub enum Event {
AutoModerationActionExecution(AutoModerationActionExecution),
AutoModerationRuleCreate(AutoModerationRuleCreate),
AutoModerationRuleDelete(AutoModerationRuleDelete),
AutoModerationRuleUpdate(AutoModerationRuleUpdate),
BanAdd(BanAdd),
BanRemove(BanRemove),
ChannelCreate(Box<ChannelCreate>),
ChannelDelete(Box<ChannelDelete>),
ChannelPinsUpdate(ChannelPinsUpdate),
ChannelUpdate(Box<ChannelUpdate>),
CommandPermissionsUpdate(CommandPermissionsUpdate),
EntitlementCreate(EntitlementCreate),
EntitlementDelete(EntitlementDelete),
EntitlementUpdate(EntitlementUpdate),
GatewayClose(Option<CloseFrame<'static>>),
GatewayHeartbeat(u64),
GatewayHeartbeatAck,
GatewayHello(Hello),
GatewayInvalidateSession(bool),
GatewayReconnect,
GuildAuditLogEntryCreate(Box<GuildAuditLogEntryCreate>),
GuildCreate(Box<GuildCreate>),
GuildDelete(GuildDelete),
GuildEmojisUpdate(GuildEmojisUpdate),
GuildIntegrationsUpdate(GuildIntegrationsUpdate),
GuildScheduledEventCreate(Box<GuildScheduledEventCreate>),
GuildScheduledEventDelete(Box<GuildScheduledEventDelete>),
GuildScheduledEventUpdate(Box<GuildScheduledEventUpdate>),
GuildScheduledEventUserAdd(GuildScheduledEventUserAdd),
GuildScheduledEventUserRemove(GuildScheduledEventUserRemove),
GuildStickersUpdate(GuildStickersUpdate),
GuildUpdate(Box<GuildUpdate>),
IntegrationCreate(Box<IntegrationCreate>),
IntegrationDelete(IntegrationDelete),
IntegrationUpdate(Box<IntegrationUpdate>),
InteractionCreate(Box<InteractionCreate>),
InviteCreate(Box<InviteCreate>),
InviteDelete(InviteDelete),
MemberAdd(Box<MemberAdd>),
MemberRemove(MemberRemove),
MemberUpdate(Box<MemberUpdate>),
MemberChunk(MemberChunk),
MessageCreate(Box<MessageCreate>),
MessageDelete(MessageDelete),
MessageDeleteBulk(MessageDeleteBulk),
MessagePollVoteAdd(MessagePollVoteAdd),
MessagePollVoteRemove(MessagePollVoteRemove),
MessageUpdate(Box<MessageUpdate>),
PresenceUpdate(Box<PresenceUpdate>),
ReactionAdd(Box<ReactionAdd>),
ReactionRemove(Box<ReactionRemove>),
ReactionRemoveAll(ReactionRemoveAll),
ReactionRemoveEmoji(ReactionRemoveEmoji),
Ready(Box<Ready>),
Resumed,
RoleCreate(RoleCreate),
RoleDelete(RoleDelete),
RoleUpdate(RoleUpdate),
StageInstanceCreate(StageInstanceCreate),
StageInstanceDelete(StageInstanceDelete),
StageInstanceUpdate(StageInstanceUpdate),
ThreadCreate(Box<ThreadCreate>),
ThreadDelete(ThreadDelete),
ThreadListSync(ThreadListSync),
ThreadMemberUpdate(Box<ThreadMemberUpdate>),
ThreadMembersUpdate(ThreadMembersUpdate),
ThreadUpdate(Box<ThreadUpdate>),
TypingStart(Box<TypingStart>),
UnavailableGuild(UnavailableGuild),
UserUpdate(UserUpdate),
VoiceServerUpdate(VoiceServerUpdate),
VoiceStateUpdate(Box<VoiceStateUpdate>),
WebhooksUpdate(WebhooksUpdate),
}
impl Event {
pub const fn guild_id(&self) -> Option<Id<GuildMarker>> {
match self {
Event::AutoModerationActionExecution(e) => Some(e.guild_id),
Event::AutoModerationRuleCreate(e) => Some(e.0.guild_id),
Event::AutoModerationRuleDelete(e) => Some(e.0.guild_id),
Event::AutoModerationRuleUpdate(e) => Some(e.0.guild_id),
Event::BanAdd(e) => Some(e.guild_id),
Event::BanRemove(e) => Some(e.guild_id),
Event::ChannelCreate(e) => e.0.guild_id,
Event::ChannelDelete(e) => e.0.guild_id,
Event::ChannelPinsUpdate(e) => e.guild_id,
Event::ChannelUpdate(e) => e.0.guild_id,
Event::CommandPermissionsUpdate(e) => Some(e.0.guild_id),
Event::GuildAuditLogEntryCreate(e) => e.0.guild_id,
Event::GuildCreate(e) => Some(e.id()),
Event::GuildDelete(e) => Some(e.id),
Event::GuildEmojisUpdate(e) => Some(e.guild_id),
Event::GuildIntegrationsUpdate(e) => Some(e.guild_id),
Event::GuildScheduledEventCreate(e) => Some(e.0.guild_id),
Event::GuildScheduledEventDelete(e) => Some(e.0.guild_id),
Event::GuildScheduledEventUpdate(e) => Some(e.0.guild_id),
Event::GuildScheduledEventUserAdd(e) => Some(e.guild_id),
Event::GuildScheduledEventUserRemove(e) => Some(e.guild_id),
Event::GuildStickersUpdate(e) => Some(e.guild_id),
Event::GuildUpdate(e) => Some(e.0.id),
Event::IntegrationCreate(e) => e.0.guild_id,
Event::IntegrationDelete(e) => Some(e.guild_id),
Event::IntegrationUpdate(e) => e.0.guild_id,
Event::InteractionCreate(e) => e.0.guild_id,
Event::InviteCreate(e) => Some(e.guild_id),
Event::InviteDelete(e) => Some(e.guild_id),
Event::MemberAdd(e) => Some(e.guild_id),
Event::MemberChunk(e) => Some(e.guild_id),
Event::MemberRemove(e) => Some(e.guild_id),
Event::MemberUpdate(e) => Some(e.guild_id),
Event::MessageCreate(e) => e.0.guild_id,
Event::MessageDelete(e) => e.guild_id,
Event::MessageDeleteBulk(e) => e.guild_id,
Event::MessageUpdate(e) => e.0.guild_id,
Event::MessagePollVoteAdd(e) => e.guild_id,
Event::MessagePollVoteRemove(e) => e.guild_id,
Event::PresenceUpdate(e) => Some(e.0.guild_id),
Event::ReactionAdd(e) => e.0.guild_id,
Event::ReactionRemove(e) => e.0.guild_id,
Event::ReactionRemoveAll(e) => e.guild_id,
Event::ReactionRemoveEmoji(e) => Some(e.guild_id),
Event::RoleCreate(e) => Some(e.guild_id),
Event::RoleDelete(e) => Some(e.guild_id),
Event::RoleUpdate(e) => Some(e.guild_id),
Event::StageInstanceCreate(e) => Some(e.0.guild_id),
Event::StageInstanceDelete(e) => Some(e.0.guild_id),
Event::StageInstanceUpdate(e) => Some(e.0.guild_id),
Event::ThreadCreate(e) => e.0.guild_id,
Event::ThreadDelete(e) => Some(e.guild_id),
Event::ThreadListSync(e) => Some(e.guild_id),
Event::ThreadMemberUpdate(e) => Some(e.guild_id),
Event::ThreadMembersUpdate(e) => Some(e.guild_id),
Event::ThreadUpdate(e) => e.0.guild_id,
Event::TypingStart(e) => e.guild_id,
Event::UnavailableGuild(e) => Some(e.id),
Event::VoiceServerUpdate(e) => Some(e.guild_id),
Event::VoiceStateUpdate(e) => e.0.guild_id,
Event::WebhooksUpdate(e) => Some(e.guild_id),
Event::GatewayClose(_)
| Event::EntitlementCreate(_)
| Event::EntitlementDelete(_)
| Event::EntitlementUpdate(_)
| Event::GatewayHeartbeat(_)
| Event::GatewayHeartbeatAck
| Event::GatewayHello(_)
| Event::GatewayInvalidateSession(_)
| Event::GatewayReconnect
| Event::Ready(_)
| Event::Resumed
| Event::UserUpdate(_) => None,
}
}
pub const fn kind(&self) -> EventType {
match self {
Self::AutoModerationActionExecution(_) => EventType::AutoModerationActionExecution,
Self::AutoModerationRuleCreate(_) => EventType::AutoModerationRuleCreate,
Self::AutoModerationRuleDelete(_) => EventType::AutoModerationRuleDelete,
Self::AutoModerationRuleUpdate(_) => EventType::AutoModerationRuleUpdate,
Self::BanAdd(_) => EventType::BanAdd,
Self::BanRemove(_) => EventType::BanRemove,
Self::ChannelCreate(_) => EventType::ChannelCreate,
Self::ChannelDelete(_) => EventType::ChannelDelete,
Self::ChannelPinsUpdate(_) => EventType::ChannelPinsUpdate,
Self::ChannelUpdate(_) => EventType::ChannelUpdate,
Self::CommandPermissionsUpdate(_) => EventType::CommandPermissionsUpdate,
Self::EntitlementCreate(_) => EventType::EntitlementCreate,
Self::EntitlementDelete(_) => EventType::EntitlementDelete,
Self::EntitlementUpdate(_) => EventType::EntitlementUpdate,
Self::GatewayClose(_) => EventType::GatewayClose,
Self::GatewayHeartbeat(_) => EventType::GatewayHeartbeat,
Self::GatewayHeartbeatAck => EventType::GatewayHeartbeatAck,
Self::GatewayHello(_) => EventType::GatewayHello,
Self::GatewayInvalidateSession(_) => EventType::GatewayInvalidateSession,
Self::GatewayReconnect => EventType::GatewayReconnect,
Self::GuildAuditLogEntryCreate(_) => EventType::GuildAuditLogEntryCreate,
Self::GuildCreate(_) => EventType::GuildCreate,
Self::GuildDelete(_) => EventType::GuildDelete,
Self::GuildEmojisUpdate(_) => EventType::GuildEmojisUpdate,
Self::GuildIntegrationsUpdate(_) => EventType::GuildIntegrationsUpdate,
Self::GuildScheduledEventCreate(_) => EventType::GuildScheduledEventCreate,
Self::GuildScheduledEventDelete(_) => EventType::GuildScheduledEventDelete,
Self::GuildScheduledEventUpdate(_) => EventType::GuildScheduledEventUpdate,
Self::GuildScheduledEventUserAdd(_) => EventType::GuildScheduledEventUserAdd,
Self::GuildScheduledEventUserRemove(_) => EventType::GuildScheduledEventUserRemove,
Self::GuildStickersUpdate(_) => EventType::GuildStickersUpdate,
Self::GuildUpdate(_) => EventType::GuildUpdate,
Self::IntegrationCreate(_) => EventType::IntegrationCreate,
Self::IntegrationDelete(_) => EventType::IntegrationDelete,
Self::IntegrationUpdate(_) => EventType::IntegrationUpdate,
Self::InteractionCreate(_) => EventType::InteractionCreate,
Self::InviteCreate(_) => EventType::InviteCreate,
Self::InviteDelete(_) => EventType::InviteDelete,
Self::MemberAdd(_) => EventType::MemberAdd,
Self::MemberRemove(_) => EventType::MemberRemove,
Self::MemberUpdate(_) => EventType::MemberUpdate,
Self::MemberChunk(_) => EventType::MemberChunk,
Self::MessageCreate(_) => EventType::MessageCreate,
Self::MessageDelete(_) => EventType::MessageDelete,
Self::MessageDeleteBulk(_) => EventType::MessageDeleteBulk,
Self::MessagePollVoteAdd(_) => EventType::MessagePollVoteAdd,
Self::MessagePollVoteRemove(_) => EventType::MessagePollVoteRemove,
Self::MessageUpdate(_) => EventType::MessageUpdate,
Self::PresenceUpdate(_) => EventType::PresenceUpdate,
Self::ReactionAdd(_) => EventType::ReactionAdd,
Self::ReactionRemove(_) => EventType::ReactionRemove,
Self::ReactionRemoveAll(_) => EventType::ReactionRemoveAll,
Self::ReactionRemoveEmoji(_) => EventType::ReactionRemoveEmoji,
Self::Ready(_) => EventType::Ready,
Self::Resumed => EventType::Resumed,
Self::RoleCreate(_) => EventType::RoleCreate,
Self::RoleDelete(_) => EventType::RoleDelete,
Self::RoleUpdate(_) => EventType::RoleUpdate,
Self::StageInstanceCreate(_) => EventType::StageInstanceCreate,
Self::StageInstanceDelete(_) => EventType::StageInstanceDelete,
Self::StageInstanceUpdate(_) => EventType::StageInstanceUpdate,
Self::ThreadCreate(_) => EventType::ThreadCreate,
Self::ThreadDelete(_) => EventType::ThreadDelete,
Self::ThreadListSync(_) => EventType::ThreadListSync,
Self::ThreadMemberUpdate(_) => EventType::ThreadMemberUpdate,
Self::ThreadMembersUpdate(_) => EventType::ThreadMembersUpdate,
Self::ThreadUpdate(_) => EventType::ThreadUpdate,
Self::TypingStart(_) => EventType::TypingStart,
Self::UnavailableGuild(_) => EventType::UnavailableGuild,
Self::UserUpdate(_) => EventType::UserUpdate,
Self::VoiceServerUpdate(_) => EventType::VoiceServerUpdate,
Self::VoiceStateUpdate(_) => EventType::VoiceStateUpdate,
Self::WebhooksUpdate(_) => EventType::WebhooksUpdate,
}
}
}
impl From<DispatchEvent> for Event {
fn from(event: DispatchEvent) -> Self {
match event {
DispatchEvent::AutoModerationActionExecution(v) => {
Self::AutoModerationActionExecution(v)
}
DispatchEvent::AutoModerationRuleCreate(v) => Self::AutoModerationRuleCreate(v),
DispatchEvent::AutoModerationRuleDelete(v) => Self::AutoModerationRuleDelete(v),
DispatchEvent::AutoModerationRuleUpdate(v) => Self::AutoModerationRuleUpdate(v),
DispatchEvent::BanAdd(v) => Self::BanAdd(v),
DispatchEvent::BanRemove(v) => Self::BanRemove(v),
DispatchEvent::ChannelCreate(v) => Self::ChannelCreate(v),
DispatchEvent::ChannelDelete(v) => Self::ChannelDelete(v),
DispatchEvent::ChannelPinsUpdate(v) => Self::ChannelPinsUpdate(v),
DispatchEvent::ChannelUpdate(v) => Self::ChannelUpdate(v),
DispatchEvent::CommandPermissionsUpdate(v) => Self::CommandPermissionsUpdate(v),
DispatchEvent::EntitlementCreate(v) => Self::EntitlementCreate(v),
DispatchEvent::EntitlementDelete(v) => Self::EntitlementDelete(v),
DispatchEvent::EntitlementUpdate(v) => Self::EntitlementUpdate(v),
DispatchEvent::GuildAuditLogEntryCreate(v) => Self::GuildAuditLogEntryCreate(v),
DispatchEvent::GuildCreate(v) => Self::GuildCreate(v),
DispatchEvent::GuildDelete(v) => Self::GuildDelete(v),
DispatchEvent::GuildEmojisUpdate(v) => Self::GuildEmojisUpdate(v),
DispatchEvent::GuildIntegrationsUpdate(v) => Self::GuildIntegrationsUpdate(v),
DispatchEvent::GuildScheduledEventCreate(v) => Self::GuildScheduledEventCreate(v),
DispatchEvent::GuildScheduledEventDelete(v) => Self::GuildScheduledEventDelete(v),
DispatchEvent::GuildScheduledEventUpdate(v) => Self::GuildScheduledEventUpdate(v),
DispatchEvent::GuildScheduledEventUserAdd(v) => Self::GuildScheduledEventUserAdd(v),
DispatchEvent::GuildScheduledEventUserRemove(v) => {
Self::GuildScheduledEventUserRemove(v)
}
DispatchEvent::GuildStickersUpdate(v) => Self::GuildStickersUpdate(v),
DispatchEvent::GuildUpdate(v) => Self::GuildUpdate(v),
DispatchEvent::IntegrationCreate(v) => Self::IntegrationCreate(v),
DispatchEvent::IntegrationDelete(v) => Self::IntegrationDelete(v),
DispatchEvent::IntegrationUpdate(v) => Self::IntegrationUpdate(v),
DispatchEvent::InteractionCreate(v) => Self::InteractionCreate(v),
DispatchEvent::InviteCreate(v) => Self::InviteCreate(v),
DispatchEvent::InviteDelete(v) => Self::InviteDelete(v),
DispatchEvent::MemberAdd(v) => Self::MemberAdd(v),
DispatchEvent::MemberRemove(v) => Self::MemberRemove(v),
DispatchEvent::MemberUpdate(v) => Self::MemberUpdate(v),
DispatchEvent::MemberChunk(v) => Self::MemberChunk(v),
DispatchEvent::RoleCreate(v) => Self::RoleCreate(v),
DispatchEvent::RoleDelete(v) => Self::RoleDelete(v),
DispatchEvent::RoleUpdate(v) => Self::RoleUpdate(v),
DispatchEvent::MessageCreate(v) => Self::MessageCreate(v),
DispatchEvent::MessageDelete(v) => Self::MessageDelete(v),
DispatchEvent::MessageDeleteBulk(v) => Self::MessageDeleteBulk(v),
DispatchEvent::MessagePollVoteAdd(v) => Self::MessagePollVoteAdd(v),
DispatchEvent::MessagePollVoteRemove(v) => Self::MessagePollVoteRemove(v),
DispatchEvent::MessageUpdate(v) => Self::MessageUpdate(v),
DispatchEvent::PresenceUpdate(v) => Self::PresenceUpdate(v),
DispatchEvent::ReactionAdd(v) => Self::ReactionAdd(v),
DispatchEvent::ReactionRemove(v) => Self::ReactionRemove(v),
DispatchEvent::ReactionRemoveAll(v) => Self::ReactionRemoveAll(v),
DispatchEvent::ReactionRemoveEmoji(v) => Self::ReactionRemoveEmoji(v),
DispatchEvent::Ready(v) => Self::Ready(v),
DispatchEvent::Resumed => Self::Resumed,
DispatchEvent::StageInstanceCreate(v) => Self::StageInstanceCreate(v),
DispatchEvent::StageInstanceDelete(v) => Self::StageInstanceDelete(v),
DispatchEvent::StageInstanceUpdate(v) => Self::StageInstanceUpdate(v),
DispatchEvent::ThreadCreate(v) => Self::ThreadCreate(v),
DispatchEvent::ThreadDelete(v) => Self::ThreadDelete(v),
DispatchEvent::ThreadListSync(v) => Self::ThreadListSync(v),
DispatchEvent::ThreadMemberUpdate(v) => Self::ThreadMemberUpdate(v),
DispatchEvent::ThreadMembersUpdate(v) => Self::ThreadMembersUpdate(v),
DispatchEvent::ThreadUpdate(v) => Self::ThreadUpdate(v),
DispatchEvent::TypingStart(v) => Self::TypingStart(v),
DispatchEvent::UnavailableGuild(v) => Self::UnavailableGuild(v),
DispatchEvent::UserUpdate(v) => Self::UserUpdate(v),
DispatchEvent::VoiceServerUpdate(v) => Self::VoiceServerUpdate(v),
DispatchEvent::VoiceStateUpdate(v) => Self::VoiceStateUpdate(v),
DispatchEvent::WebhooksUpdate(v) => Self::WebhooksUpdate(v),
}
}
}
impl From<GatewayEvent> for Event {
fn from(event: GatewayEvent) -> Self {
match event {
GatewayEvent::Dispatch(_, e) => Self::from(e),
GatewayEvent::Heartbeat(interval) => Self::GatewayHeartbeat(interval),
GatewayEvent::HeartbeatAck => Self::GatewayHeartbeatAck,
GatewayEvent::Hello(interval) => Self::GatewayHello(interval),
GatewayEvent::InvalidateSession(r) => Self::GatewayInvalidateSession(r),
GatewayEvent::Reconnect => Self::GatewayReconnect,
}
}
}
#[derive(Debug)]
pub struct EventConversionError {
event: Event,
}
impl EventConversionError {
pub const fn new(event: Event) -> EventConversionError {
Self { event }
}
pub const fn event_ref(&self) -> &Event {
&self.event
}
#[allow(clippy::missing_const_for_fn)]
pub fn into_event(self) -> Event {
self.event
}
}
impl Display for EventConversionError {
fn fmt(&self, f: &mut Formatter<'_>) -> FmtResult {
f.write_str("event variant failed to convert")
}
}
impl Error for EventConversionError {}
#[cfg(test)]
mod tests {
use super::{super::payload::incoming::*, Event};
use static_assertions::const_assert;
use std::mem;
#[allow(dead_code)]
const EVENT_THRESHOLD: usize = 256;
const_assert!(mem::size_of::<Event>() == EVENT_THRESHOLD);
const_assert!(mem::size_of::<ChannelCreate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<ChannelDelete>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<ChannelUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildScheduledEventCreate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildScheduledEventDelete>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildScheduledEventUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<IntegrationCreate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<IntegrationUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<InviteCreate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<InteractionCreate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<MemberAdd>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<MemberUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<MessageCreate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<MessageUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<PresenceUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<ReactionAdd>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<ReactionRemove>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<Ready>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<ThreadCreate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<ThreadMemberUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<ThreadUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<TypingStart>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<VoiceStateUpdate>() > EVENT_THRESHOLD);
const_assert!(mem::size_of::<AutoModerationRuleCreate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<AutoModerationRuleDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<AutoModerationRuleUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<AutoModerationActionExecution>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<BanAdd>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<BanRemove>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<ChannelPinsUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<CommandPermissionsUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildEmojisUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildIntegrationsUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildScheduledEventUserAdd>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<GuildScheduledEventUserRemove>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<IntegrationDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<InviteDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<MemberChunk>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<MemberRemove>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<MessageDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<MessageDeleteBulk>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<ReactionRemoveAll>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<RoleCreate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<RoleDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<RoleUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<StageInstanceCreate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<StageInstanceDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<StageInstanceUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<ThreadDelete>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<ThreadListSync>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<ThreadMembersUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<UnavailableGuild>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<UserUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<VoiceServerUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<WebhooksUpdate>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<MessagePollVoteAdd>() <= EVENT_THRESHOLD);
const_assert!(mem::size_of::<MessagePollVoteRemove>() <= EVENT_THRESHOLD);
}