Enum slack_blocks::Block[][src]

pub enum Block<'a> {
    Section(Section),
    Divider,
    Image(Image),
    Actions(Actions<'a>),
    Context(Context<'a>),
    Input(Input<'a>),
    File(File),
}
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)
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)
Actions(Actions<'a>)
Context(Context<'a>)
Input(Input<'a>)
File(File)

Implementations

impl<'a> Block<'a>[src]

pub fn validate(&self) -> Result<(), ValidationErrors>[src]

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::from_alt_text_and_url(long_string, "foo.com");

assert!(matches!(img.validate(), Err(_)), "validation should fail!")

Trait Implementations

impl<'a> Debug for Block<'a>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'de, 'a> Deserialize<'de> for Block<'a>[src]

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
    __D: Deserializer<'de>, 
[src]

Deserialize this value from the given Serde deserializer. Read more

impl Display for Block<'_>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<'a> From<Contents<'a>> for Block<'a>[src]

fn from(src: Actions<'a>) -> Self[src]

Performs the conversion.

impl<'a> From<Contents<'a>> for Block<'a>[src]

fn from(src: Input<'a>) -> Self[src]

Performs the conversion.

impl<'a> From<Contents<'a>> for Block<'a>[src]

fn from(src: Context<'a>) -> Self[src]

Performs the conversion.

impl From<Contents> for Block<'static>[src]

fn from(src: Section) -> Self[src]

Performs the conversion.

impl From<Contents> for Block<'static>[src]

fn from(src: Image) -> Self[src]

Performs the conversion.

impl From<Contents> for Block<'static>[src]

fn from(src: File) -> Self[src]

Performs the conversion.

impl<'a> Serialize for Block<'a>[src]

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
    __S: Serializer
[src]

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

pub default fn to_string(&self) -> String[src]

Converts the given value to a String. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]