@@ -5,10 +5,8 @@ use serde::Serialize;
55use crate :: model:: prelude:: * ;
66
77#[ derive( Clone , Debug ) ]
8- #[ cfg( feature = "unstable" ) ]
98struct StaticU8 < const VAL : u8 > ;
109
11- #[ cfg( feature = "unstable" ) ]
1210impl < const VAL : u8 > Serialize for StaticU8 < VAL > {
1311 fn serialize < S : serde:: Serializer > ( & self , ser : S ) -> Result < S :: Ok , S :: Error > {
1412 ser. serialize_u8 ( VAL )
@@ -67,8 +65,7 @@ impl serde::Serialize for CreateActionRow<'_> {
6765/// To send V2 components, you must set [`MessageFlags::IS_COMPONENTS_V2`].
6866///
6967/// ### Limitations
70- /// - You can include a maximum of **10 top-level components** per message.
71- /// - The total number of **nested components** is limited to **30**.
68+ /// - The total number of components is limited to **40**..
7269/// - The maximum character count for text within components is **4000**.
7370/// - The ability to set the `content` and `embeds` field will be disabled
7471/// - No support for audio files
@@ -77,7 +74,6 @@ impl serde::Serialize for CreateActionRow<'_> {
7774#[ derive( Clone , Debug , Serialize ) ]
7875#[ must_use]
7976#[ serde( untagged) ]
80- #[ cfg( feature = "unstable" ) ]
8177pub enum CreateComponent < ' a > {
8278 /// Represents an action row component (V1).
8379 ///
@@ -115,7 +111,6 @@ pub enum CreateComponent<'a> {
115111/// accessory.
116112#[ derive( Clone , Debug , Serialize ) ]
117113#[ must_use]
118- #[ cfg( feature = "unstable" ) ]
119114pub struct CreateSection < ' a > {
120115 #[ serde( rename = "type" ) ]
121116 kind : StaticU8 < 9 > ,
@@ -124,7 +119,6 @@ pub struct CreateSection<'a> {
124119 accessory : CreateSectionAccessory < ' a > ,
125120}
126121
127- #[ cfg( feature = "unstable" ) ]
128122impl < ' a > CreateSection < ' a > {
129123 /// Creates a new builder with the specified components and accessory.
130124 ///
@@ -171,22 +165,18 @@ impl<'a> CreateSection<'a> {
171165#[ derive( Clone , Debug , Serialize ) ]
172166#[ must_use]
173167#[ serde( untagged) ]
174- #[ cfg( feature = "unstable" ) ]
175168pub enum CreateSectionComponent < ' a > {
176169 TextDisplay ( CreateTextDisplay < ' a > ) ,
177170}
178171
179172/// A builder to create a text display component.
180173#[ derive( Clone , Debug , Serialize ) ]
181- #[ must_use]
182- #[ cfg( feature = "unstable" ) ]
183174pub struct CreateTextDisplay < ' a > {
184175 #[ serde( rename = "type" ) ]
185176 kind : StaticU8 < 10 > ,
186177 content : Cow < ' a , str > ,
187178}
188179
189- #[ cfg( feature = "unstable" ) ]
190180impl < ' a > CreateTextDisplay < ' a > {
191181 /// Creates a new text display component.
192182 ///
@@ -202,6 +192,7 @@ impl<'a> CreateTextDisplay<'a> {
202192 /// [`Self::new`].
203193 ///
204194 /// Note: All components on a message shares the same **4000** character limit.
195+ #[ must_use]
205196 pub fn content ( mut self , content : impl Into < Cow < ' a , str > > ) -> Self {
206197 self . content = content. into ( ) ;
207198 self
@@ -212,7 +203,6 @@ impl<'a> CreateTextDisplay<'a> {
212203#[ derive( Clone , Debug , Serialize ) ]
213204#[ must_use]
214205#[ serde( untagged) ]
215- #[ cfg( feature = "unstable" ) ]
216206pub enum CreateSectionAccessory < ' a > {
217207 Thumbnail ( CreateThumbnail < ' a > ) ,
218208 Button ( CreateButton < ' a > ) ,
@@ -221,7 +211,6 @@ pub enum CreateSectionAccessory<'a> {
221211/// A builder to create a thumbnail for a section.
222212#[ derive( Clone , Debug , Serialize ) ]
223213#[ must_use]
224- #[ cfg( feature = "unstable" ) ]
225214pub struct CreateThumbnail < ' a > {
226215 #[ serde( rename = "type" ) ]
227216 kind : StaticU8 < 11 > ,
@@ -232,7 +221,6 @@ pub struct CreateThumbnail<'a> {
232221 spoiler : Option < bool > ,
233222}
234223
235- #[ cfg( feature = "unstable" ) ]
236224impl < ' a > CreateThumbnail < ' a > {
237225 /// Creates a new thumbnail with a media item.
238226 pub fn new ( media : CreateUnfurledMediaItem < ' a > ) -> Self {
@@ -266,12 +254,10 @@ impl<'a> CreateThumbnail<'a> {
266254/// A builder to create a media item.
267255#[ derive( Clone , Debug , Serialize , Default ) ]
268256#[ must_use]
269- #[ cfg( feature = "unstable" ) ]
270257pub struct CreateUnfurledMediaItem < ' a > {
271258 url : Cow < ' a , str > ,
272259}
273260
274- #[ cfg( feature = "unstable" ) ]
275261impl < ' a > CreateUnfurledMediaItem < ' a > {
276262 /// Creates a new media item.
277263 pub fn new ( url : impl Into < Cow < ' a , str > > ) -> Self {
@@ -292,14 +278,12 @@ impl<'a> CreateUnfurledMediaItem<'a> {
292278/// Note: May contain up to **10** items.
293279#[ derive( Clone , Debug , Serialize ) ]
294280#[ must_use]
295- #[ cfg( feature = "unstable" ) ]
296281pub struct CreateMediaGallery < ' a > {
297282 #[ serde( rename = "type" ) ]
298283 kind : StaticU8 < 12 > ,
299284 items : Cow < ' a , [ CreateMediaGalleryItem < ' a > ] > ,
300285}
301286
302- #[ cfg( feature = "unstable" ) ]
303287impl < ' a > CreateMediaGallery < ' a > {
304288 /// Creates a new media gallery with up to **10** items.
305289 pub fn new ( items : impl Into < Cow < ' a , [ CreateMediaGalleryItem < ' a > ] > > ) -> Self {
@@ -330,7 +314,6 @@ impl<'a> CreateMediaGallery<'a> {
330314/// Builder to create individual media gallery items.
331315#[ derive( Clone , Debug , Serialize , Default ) ]
332316#[ must_use]
333- #[ cfg( feature = "unstable" ) ]
334317pub struct CreateMediaGalleryItem < ' a > {
335318 media : CreateUnfurledMediaItem < ' a > ,
336319 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -339,7 +322,6 @@ pub struct CreateMediaGalleryItem<'a> {
339322 spoiler : Option < bool > ,
340323}
341324
342- #[ cfg( feature = "unstable" ) ]
343325impl < ' a > CreateMediaGalleryItem < ' a > {
344326 /// Create a new media gallery item.
345327 pub fn new ( media : CreateUnfurledMediaItem < ' a > ) -> Self {
@@ -389,7 +371,6 @@ impl<'a> CreateMediaGalleryItem<'a> {
389371/// refer to the [Discord Documentation](https://discord.com/developers/docs/reference#uploading-files).
390372#[ derive( Clone , Debug , Serialize ) ]
391373#[ must_use]
392- #[ cfg( feature = "unstable" ) ]
393374pub struct CreateFile < ' a > {
394375 #[ serde( rename = "type" ) ]
395376 kind : StaticU8 < 13 > ,
@@ -398,7 +379,6 @@ pub struct CreateFile<'a> {
398379 spoiler : Option < bool > ,
399380}
400381
401- #[ cfg( feature = "unstable" ) ]
402382impl < ' a > CreateFile < ' a > {
403383 /// Create a new builder for the file component. Refer to this builders documentation for
404384 /// limits.
@@ -427,7 +407,6 @@ impl<'a> CreateFile<'a> {
427407/// A builder for creating a separator.
428408#[ derive( Clone , Debug , Serialize ) ]
429409#[ must_use]
430- #[ cfg( feature = "unstable" ) ]
431410pub struct CreateSeparator {
432411 #[ serde( rename = "type" ) ]
433412 kind : StaticU8 < 14 > ,
@@ -436,7 +415,6 @@ pub struct CreateSeparator {
436415 spacing : Option < Spacing > ,
437416}
438417
439- #[ cfg( feature = "unstable" ) ]
440418impl CreateSeparator {
441419 /// Creates a new separator, with or without a divider.
442420 pub fn new ( divider : bool ) -> Self {
@@ -464,7 +442,6 @@ impl CreateSeparator {
464442/// A builder to create a container, which acts similarly to embeds.
465443#[ derive( Clone , Debug , Serialize ) ]
466444#[ must_use]
467- #[ cfg( feature = "unstable" ) ]
468445pub struct CreateContainer < ' a > {
469446 #[ serde( rename = "type" ) ]
470447 kind : StaticU8 < 17 > ,
@@ -475,7 +452,6 @@ pub struct CreateContainer<'a> {
475452 components : Cow < ' a , [ CreateComponent < ' a > ] > ,
476453}
477454
478- #[ cfg( feature = "unstable" ) ]
479455impl < ' a > CreateContainer < ' a > {
480456 /// Create a new container, with an array of components inside. This component may contain any
481457 /// other component except another container!
0 commit comments