Skip to main content

twilight_model/channel/message/component/
label.rs

1use serde::{Deserialize, Serialize};
2
3use super::Component;
4
5/// Top-level layout [`Component`].
6///
7/// Labels wrap modal components with text as a label and an optional description.
8#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)]
9pub struct Label {
10    /// The component within the label.
11    pub component: Box<Component>,
12    /// An optional description text for the label; max 100 characters.
13    #[serde(skip_serializing_if = "Option::is_none")]
14    pub description: Option<String>,
15    /// Optional identifier for the label.
16    #[serde(skip_serializing_if = "Option::is_none")]
17    pub id: Option<i32>,
18    /// The label text; max 45 characters.
19    #[allow(clippy::struct_field_names)]
20    pub label: String,
21}