pub enum Block<'a> {
Section(Section<'a>),
Divider,
Image(Image<'a>),
Actions(Actions<'a>),
Context(Context<'a>),
Input(Input<'a>),
Header(Header<'a>),
File(File<'a>),
}Expand description
§Layout Blocks
Blocks are a series of components that can be combined to create visually rich and compellingly interactive messages.
Read our guide to building block layouts 🔗 to learn where and how to use each of these components.
You can include up to 50 blocks in each message, and 100 blocks in modals or home tabs.
Variants§
Section(Section<'a>)
§Section Block
Divider
§Divider Block
A content divider, like an <hr>,
to split up different blocks inside of a message.
The divider block is nice and neat, requiring no fields.
Image(Image<'a>)
§Image Block
Actions(Actions<'a>)
§Actions Block
Context(Context<'a>)
§Context Block
Input(Input<'a>)
§Input Block
Header(Header<'a>)
§Input Block
File(File<'a>)
§File Block
Implementations§
Source§impl<'a> Block<'a>
impl<'a> Block<'a>
Sourcepub fn validate(&self) -> Result<(), ValidationErrors>
Available on crate feature validation only.
pub fn validate(&self) -> Result<(), ValidationErrors>
validation only.Validate that this block agrees with Slack’s model requirements.
use slack_blocks::{blocks, blocks::Image};
let long_string = std::iter::repeat('a').take(2001).collect::<String>();
let img = Image::builder().src("foo.com").alt(long_string).build();
assert!(matches!(img.validate(), Err(_)), "validation should fail!")Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Block<'a>
impl<'de, 'a> Deserialize<'de> for Block<'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
impl<'a> StructuralPartialEq for Block<'a>
Auto Trait Implementations§
impl<'a> Freeze for Block<'a>
impl<'a> RefUnwindSafe for Block<'a>
impl<'a> Send for Block<'a>
impl<'a> Sync for Block<'a>
impl<'a> Unpin for Block<'a>
impl<'a> UnwindSafe for Block<'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