Enum slack_blocks::Block[][src]

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>)
Divider

Divider Block

slack api docs 🔗

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>)
Actions(Actions<'a>)
Context(Context<'a>)
Input(Input<'a>)
Header(Header<'a>)
File(File<'a>)

Implementations

This is supported on crate feature 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

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

This is supported on crate feature blox only.

Identity function

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.