Skip to main content

twilight_model/channel/message/component/
checkbox.rs

1use serde::{Deserialize, Serialize};
2
3/// A component allowing a checkbox in a modal.
4///
5/// checkboxes are only available in modals and must be placed inside a label.
6///
7/// Fields' default values may be used by setting them to [`None`].
8#[derive(Clone, Debug, Eq, Hash, PartialEq, Deserialize, Serialize)]
9pub struct Checkbox {
10    /// Developer defined identifier.
11    ///
12    /// Must be between 1-100 characters
13    pub custom_id: String,
14    /// Whether the checkbox is selected by default.
15    ///
16    /// Set to false if None is given
17    #[serde(skip_serializing_if = "Option::is_none")]
18    pub default: Option<bool>,
19    /// Optional identifier for the component.
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub id: Option<i32>,
22}