pub struct Checkboxes { /* private fields */ }Expand description
Checkboxes representation.
§Fields and Validations
For more details, see the official documentation.
| Field | Type | Required | Validation |
|---|---|---|---|
| action_id | String | No | Max length 255 characters |
| options | Vec<Opt<TextContent>> | Yes | Max 10 items |
| initial_options | Vec<Opt<TextContent>> | No | N/A |
| confirm | ConfirmationDialog | No | N/A |
| focus_on_load | bool | No | N/A |
§Example
use slack_messaging::mrkdwn;
use slack_messaging::blocks::elements::Checkboxes;
use slack_messaging::composition_objects::Opt;
let checkboxes = Checkboxes::builder()
.action_id("group-0")
.option(
Opt::builder()
.text(mrkdwn!("option-0")?)
.value("value-0")
.build()?
)
.option(
Opt::builder()
.text(mrkdwn!("option-1")?)
.value("value-1")
.build()?
)
.build()?;
let expected = serde_json::json!({
"type": "checkboxes",
"action_id": "group-0",
"options": [
{
"value": "value-0",
"text": {
"type": "mrkdwn",
"text": "option-0"
}
},
{
"value": "value-1",
"text": {
"type": "mrkdwn",
"text": "option-1"
}
}
]
});
let json = serde_json::to_value(checkboxes).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let checkboxes = Checkboxes::builder()
.action_id("group-0")
.build();
assert!(checkboxes.is_err());Implementations§
Source§impl Checkboxes
impl Checkboxes
Sourcepub fn builder() -> CheckboxesBuilder
pub fn builder() -> CheckboxesBuilder
constract CheckboxesBuilder object.
Trait Implementations§
Source§impl Clone for Checkboxes
impl Clone for Checkboxes
Source§fn clone(&self) -> Checkboxes
fn clone(&self) -> Checkboxes
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Checkboxes
impl Debug for Checkboxes
Source§impl From<Checkboxes> for Accessory
impl From<Checkboxes> for Accessory
Source§fn from(value: Checkboxes) -> Self
fn from(value: Checkboxes) -> Self
Converts to this type from the input type.
Source§impl From<Checkboxes> for ActionsElement
impl From<Checkboxes> for ActionsElement
Source§fn from(value: Checkboxes) -> Self
fn from(value: Checkboxes) -> Self
Converts to this type from the input type.
Source§impl From<Checkboxes> for InputElement
impl From<Checkboxes> for InputElement
Source§fn from(value: Checkboxes) -> Self
fn from(value: Checkboxes) -> Self
Converts to this type from the input type.
Source§impl PartialEq for Checkboxes
impl PartialEq for Checkboxes
Source§impl Serialize for Checkboxes
impl Serialize for Checkboxes
impl StructuralPartialEq for Checkboxes
Auto Trait Implementations§
impl Freeze for Checkboxes
impl RefUnwindSafe for Checkboxes
impl Send for Checkboxes
impl Sync for Checkboxes
impl Unpin for Checkboxes
impl UnwindSafe for Checkboxes
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)