Skip to content

Commit df59d03

Browse files
committed
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,
1 parent 3bf3651 commit df59d03

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/model/channel/message.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ pub struct Message {
112112
/// [`Interaction`]: crate::model::application::Interaction
113113
pub interaction: Option<Box<MessageInteraction>>,
114114
/// The thread that was started from this message, includes thread member object.
115-
pub thread: Option<GuildChannel>,
115+
pub thread: Option<Box<GuildChannel>>,
116116
/// The components of this message
117117
#[serde(default)]
118118
pub components: Vec<ActionRow>,

src/model/event.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ pub struct MessageUpdateEvent {
534534
#[serde(default, deserialize_with = "deserialize_some")]
535535
pub interaction: Option<Option<Box<MessageInteraction>>>,
536536
#[serde(default, deserialize_with = "deserialize_some")]
537-
pub thread: Option<Option<GuildChannel>>,
537+
pub thread: Option<Option<Box<GuildChannel>>>,
538538
pub components: Option<Vec<ActionRow>>,
539539
pub sticker_items: Option<Vec<StickerItem>>,
540540
pub position: Option<Option<u64>>,

0 commit comments

Comments
 (0)