From 459a75e33c7b106b1643bca3acc53b50eb0b2a36 Mon Sep 17 00:00:00 2001 From: Gnome! Date: Sat, 9 Dec 2023 22:23:49 +0000 Subject: [PATCH] Put `Message::thread` behind a `Box` (#2658) This trades a heap allocation for messages sent along with thread creation for `Message`'s inline size dropping from 1176 bytes to 760 bytes, --- src/model/channel/message.rs | 2 +- src/model/event.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/model/channel/message.rs b/src/model/channel/message.rs index c8dc8495510..6a4b39a3125 100644 --- a/src/model/channel/message.rs +++ b/src/model/channel/message.rs @@ -117,7 +117,7 @@ pub struct Message { #[cfg(feature = "unstable_discord_api")] pub interaction_metadata: Option>, /// The thread that was started from this message, includes thread member object. - pub thread: Option, + pub thread: Option>, /// The components of this message #[serde(default)] pub components: Vec, diff --git a/src/model/event.rs b/src/model/event.rs index 0096c2f1220..c29923815be 100644 --- a/src/model/event.rs +++ b/src/model/event.rs @@ -534,7 +534,7 @@ pub struct MessageUpdateEvent { #[cfg(feature = "unstable_discord_api")] pub interaction_metadata: Option>>, #[serde(default, deserialize_with = "deserialize_some")] - pub thread: Option>, + pub thread: Option>>, pub components: Option>, pub sticker_items: Option>, pub position: Option>,