Skip to content

Commit

Permalink
Put Message::thread behind a Box (serenity-rs#2658)
Browse files Browse the repository at this point in the history
This trades a heap allocation for messages sent along with thread
creation for `Message`'s inline size dropping from 1176 bytes to 760
bytes,
  • Loading branch information
GnomedDev authored and arqunis committed Jan 16, 2024
1 parent 8b7a07a commit 459b96b
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/model/channel/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ pub struct Message {
/// [`Interaction`]: crate::model::application::Interaction
pub interaction: Option<Box<MessageInteraction>>,
/// The thread that was started from this message, includes thread member object.
pub thread: Option<GuildChannel>,
pub thread: Option<Box<GuildChannel>>,
/// The components of this message
#[serde(default)]
pub components: Vec<ActionRow>,
Expand Down
2 changes: 1 addition & 1 deletion src/model/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -534,7 +534,7 @@ pub struct MessageUpdateEvent {
#[serde(default, deserialize_with = "deserialize_some")]
pub interaction: Option<Option<Box<MessageInteraction>>>,
#[serde(default, deserialize_with = "deserialize_some")]
pub thread: Option<Option<GuildChannel>>,
pub thread: Option<Option<Box<GuildChannel>>>,
pub components: Option<Vec<ActionRow>>,
pub sticker_items: Option<Vec<StickerItem>>,
pub position: Option<Option<u64>>,
Expand Down

0 comments on commit 459b96b

Please sign in to comment.