pub struct Overflow<'a> { /* private fields */ }Expand description
§Overflow Menu
This is like a cross between a button and a select menu - when a user clicks on this overflow button, they will be presented with a list of options to choose from.
Unlike the select menu, there is no typeahead field, and the button always appears with an ellipsis (“…”), rather than customisable text.
Works in blocks 🔗: Section, Actions
Implementations§
Source§impl<'a> Overflow<'a>
impl<'a> Overflow<'a>
Sourcepub fn builder() -> OverflowBuilderInit<'a>
pub fn builder() -> OverflowBuilderInit<'a>
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this select element agrees with Slack’s model requirements
§Errors
- length of
action_idgreater than 255 - length of
optionsless than 2 or greater than 5 - one or more of
optionsis invalid (TODO) confirmis set and an invalidConfirm
§Example
use slack_blocks::{compose::Opt, elems::Overflow};
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_plain("foo")
.value("bar")
.no_url()
.build();
let opts: Vec<Opt<_, _>> = repeat(&opt, 6).map(|o| o.clone()).collect();
let input = Overflow::builder().action_id(long_string) // invalid
.options(opts) // also invalid
.build();
assert!(matches!(input.validate(), Err(_)))Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Overflow<'a>
impl<'de, 'a> Deserialize<'de> for Overflow<'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<Overflow<'a>> for BlockElement<'a>
impl<'a> From<Overflow<'a>> for BlockElement<'a>
Source§impl<'a> From<Overflow<'a>> for SupportedElement<'a>
impl<'a> From<Overflow<'a>> for SupportedElement<'a>
impl<'a> StructuralPartialEq for Overflow<'a>
Auto Trait Implementations§
impl<'a> Freeze for Overflow<'a>
impl<'a> RefUnwindSafe for Overflow<'a>
impl<'a> Send for Overflow<'a>
impl<'a> Sync for Overflow<'a>
impl<'a> Unpin for Overflow<'a>
impl<'a> UnwindSafe for Overflow<'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