pub struct Checkboxes<'a> { /* private fields */ }Expand description
§Checkbox Group
A checkbox group that allows a user to choose multiple items from a list of possible options.
Works in blocks 🔗: Section, Actions, Input Works in app surfaces 🔗: Home tabs, Modals, Messages
Implementations§
Source§impl<'a> Checkboxes<'a>
impl<'a> Checkboxes<'a>
Sourcepub fn builder() -> CheckboxesBuilderInit<'a>
pub fn builder() -> CheckboxesBuilderInit<'a>
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this element agrees with Slack’s model requirements.
§Errors
- length of
action_idgreater than 255 - length of
optionsgreater than 10 - length of
initial_optionsgreater than 10 - one or more of
optionsis invalid // TODO - one or more of
initial_optionsis invalid // TODO initial_optionis set and an invalidOptconfirmis set and an invalidConfirm
§Example
use slack_blocks::{compose::Opt, elems::Checkboxes};
fn repeat<T: Copy>(el: T, n: usize) -> impl Iterator<Item = T> {
std::iter::repeat(el).take(n)
}
let long_string: String = repeat('a', 256).collect();
let opt = Opt::builder().text_md("foo").value("bar").build();
let opts = repeat(&opt, 11).map(|o| o.clone()).collect::<Vec<_>>();
let input = Checkboxes::builder().action_id(long_string)
.options(opts)
.build();
assert!(matches!(input.validate(), Err(_)))Trait Implementations§
Source§impl<'a> Clone for Checkboxes<'a>
impl<'a> Clone for Checkboxes<'a>
Source§fn clone(&self) -> Checkboxes<'a>
fn clone(&self) -> Checkboxes<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<'a> Debug for Checkboxes<'a>
impl<'a> Debug for Checkboxes<'a>
Source§impl<'de, 'a> Deserialize<'de> for Checkboxes<'a>
impl<'de, 'a> Deserialize<'de> for Checkboxes<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> From<Checkboxes<'a>> for BlockElement<'a>
impl<'a> From<Checkboxes<'a>> for BlockElement<'a>
Source§fn from(src: Checkboxes<'a>) -> Self
fn from(src: Checkboxes<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<Checkboxes<'a>> for SupportedElement<'a>
impl<'a> From<Checkboxes<'a>> for SupportedElement<'a>
Source§fn from(src: Checkboxes<'a>) -> Self
fn from(src: Checkboxes<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> From<Checkboxes<'a>> for SupportedElement<'a>
impl<'a> From<Checkboxes<'a>> for SupportedElement<'a>
Source§fn from(src: Checkboxes<'a>) -> Self
fn from(src: Checkboxes<'a>) -> Self
Converts to this type from the input type.
Source§impl<'a> Hash for Checkboxes<'a>
impl<'a> Hash for Checkboxes<'a>
Source§impl<'a> PartialEq for Checkboxes<'a>
impl<'a> PartialEq for Checkboxes<'a>
Source§impl<'a> Serialize for Checkboxes<'a>
impl<'a> Serialize for Checkboxes<'a>
Source§impl<'a> Validate for Checkboxes<'a>
impl<'a> Validate for Checkboxes<'a>
impl<'a> StructuralPartialEq for Checkboxes<'a>
Auto Trait Implementations§
impl<'a> Freeze for Checkboxes<'a>
impl<'a> RefUnwindSafe for Checkboxes<'a>
impl<'a> Send for Checkboxes<'a>
impl<'a> Sync for Checkboxes<'a>
impl<'a> Unpin for Checkboxes<'a>
impl<'a> UnwindSafe for Checkboxes<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more