pub struct RadioButtonGroup { /* private fields */ }Expand description
Radio buton group element 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_option | 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::RadioButtonGroup;
use slack_messaging::composition_objects::{Opt, Text};
let radio = RadioButtonGroup::builder()
.action_id("radio_button_group")
.option(
Opt::builder()
.text(mrkdwn!("**Radio 1**")?)
.value("A1")
.build()?
)
.option(
Opt::builder()
.text(mrkdwn!("**Radio 2**")?)
.value("A2")
.build()?
)
.build()?;
let expected = serde_json::json!({
"type": "radio_buttons",
"action_id": "radio_button_group",
"options": [
{
"value": "A1",
"text": {
"type": "mrkdwn",
"text": "**Radio 1**"
}
},
{
"value": "A2",
"text": {
"type": "mrkdwn",
"text": "**Radio 2**"
}
}
]
});
let json = serde_json::to_value(radio).unwrap();
assert_eq!(json, expected);
// If your object has any validation errors, the build method returns Result::Err
let radio = RadioButtonGroup::builder()
.action_id("radio_button_group")
.build();
assert!(radio.is_err());Implementations§
Source§impl RadioButtonGroup
impl RadioButtonGroup
Sourcepub fn builder() -> RadioButtonGroupBuilder
pub fn builder() -> RadioButtonGroupBuilder
constract RadioButtonGroupBuilder object.
Trait Implementations§
Source§impl Clone for RadioButtonGroup
impl Clone for RadioButtonGroup
Source§fn clone(&self) -> RadioButtonGroup
fn clone(&self) -> RadioButtonGroup
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 RadioButtonGroup
impl Debug for RadioButtonGroup
Source§impl From<RadioButtonGroup> for Accessory
impl From<RadioButtonGroup> for Accessory
Source§fn from(value: RadioButtonGroup) -> Self
fn from(value: RadioButtonGroup) -> Self
Converts to this type from the input type.
Source§impl From<RadioButtonGroup> for ActionsElement
impl From<RadioButtonGroup> for ActionsElement
Source§fn from(value: RadioButtonGroup) -> Self
fn from(value: RadioButtonGroup) -> Self
Converts to this type from the input type.
Source§impl From<RadioButtonGroup> for InputElement
impl From<RadioButtonGroup> for InputElement
Source§fn from(value: RadioButtonGroup) -> Self
fn from(value: RadioButtonGroup) -> Self
Converts to this type from the input type.
Source§impl PartialEq for RadioButtonGroup
impl PartialEq for RadioButtonGroup
Source§impl Serialize for RadioButtonGroup
impl Serialize for RadioButtonGroup
impl StructuralPartialEq for RadioButtonGroup
Auto Trait Implementations§
impl Freeze for RadioButtonGroup
impl RefUnwindSafe for RadioButtonGroup
impl Send for RadioButtonGroup
impl Sync for RadioButtonGroup
impl Unpin for RadioButtonGroup
impl UnwindSafe for RadioButtonGroup
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)