Skip to content

Commit 80c657e

Browse files
authored
feat: Make FullEvent serializable (#3010)
1 parent 450f36d commit 80c657e

File tree

5 files changed

+8
-8
lines changed

5 files changed

+8
-8
lines changed

src/gateway/client/event_handler.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ macro_rules! event_handler {
4949

5050
/// This enum stores every possible event that an [`EventHandler`] can receive.
5151
#[cfg_attr(not(feature = "unstable"), non_exhaustive)]
52-
#[derive(Clone, Debug, VariantNames, IntoStaticStr, EnumCount)]
52+
#[derive(Clone, Debug, VariantNames, IntoStaticStr, EnumCount, Serialize)]
5353
#[strum(serialize_all = "SCREAMING_SNAKE_CASE")]
5454
pub enum FullEvent {
5555
$(

src/gateway/sharding/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ pub struct ShardRunnerInfo {
845845
///
846846
/// This might happen when a shard changes from [`ConnectionStage::Identifying`] to
847847
/// [`ConnectionStage::Connected`].
848-
#[derive(Clone, Debug)]
848+
#[derive(Clone, Debug, Serialize)]
849849
pub struct ShardStageUpdateEvent {
850850
/// The new connection stage.
851851
pub new: ConnectionStage,
@@ -858,7 +858,7 @@ pub struct ShardStageUpdateEvent {
858858
/// Indicates the current connection stage of a [`Shard`].
859859
///
860860
/// This can be useful for knowing which shards are currently "down"/"up".
861-
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd)]
861+
#[derive(Clone, Copy, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Serialize)]
862862
#[non_exhaustive]
863863
pub enum ConnectionStage {
864864
/// Indicator that the [`Shard`] is normally connected and is not in, e.g., a resume phase.

src/http/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ impl CacheHttp for Http {
125125
/// An method used for ratelimiting special routes.
126126
///
127127
/// This is needed because [`reqwest`]'s [`Method`] enum does not derive Copy.
128-
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq)]
128+
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, Serialize)]
129129
pub enum LightMethod {
130130
/// Indicates that a route is for the `DELETE` method only.
131131
Delete,

src/http/ratelimiting.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ use crate::internal::prelude::*;
5454

5555
/// Passed to the [`Ratelimiter::set_ratelimit_callback`] callback. If using Client, that callback
5656
/// is initialized to call the `EventHandler::ratelimit()` method.
57-
#[derive(Clone, Debug)]
57+
#[derive(Clone, Debug, Serialize)]
5858
#[non_exhaustive]
5959
pub struct RatelimitInfo {
6060
pub timeout: std::time::Duration,

src/model/id.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,10 +336,10 @@ id_u64! {
336336

337337
/// An identifier for a Shard.
338338
///
339-
/// This identifier is special, it simply models internal IDs for type safety,
340-
/// and therefore cannot be [`Serialize`]d or [`Deserialize`]d.
339+
/// This identifier is special, it simply models internal IDs for type safety and therefore cannot
340+
/// be deserialized
341341
#[cfg_attr(feature = "typesize", derive(typesize::derive::TypeSize))]
342-
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord)]
342+
#[derive(Clone, Copy, Debug, Eq, Hash, PartialEq, PartialOrd, Ord, Serialize)]
343343
pub struct ShardId(pub u16);
344344

345345
impl ShardId {

0 commit comments

Comments
 (0)