Struct slack_blocks::blocks::image::build::ImageBuilder[][src]

pub struct ImageBuilder<'a, Url, Alt> { /* fields omitted */ }
Expand description

Build an Image block

Allows you to construct safely, with compile-time checks on required setter methods.

Required Methods

ImageBuilder::build() is only available if these methods have been called:

  • external_id
  • source

Example

use slack_blocks::{blocks::Image, text::ToSlackPlaintext};

let block = Image::builder().image_url("https://foo.com/bar.png")
                            .alt_text("pic of bar")
                            .build();

Implementations

impl<'a, Url, Alt> ImageBuilder<'a, Url, Alt>[src]

pub fn new() -> Self[src]

Create a new ImageBuilder

pub fn title<T>(self, text: T) -> Self where
    T: Into<Plain>, 
[src]

Set title (Optional)

An optional title for the image in the form of a Plaintext text object 🔗.

Maximum length for the text in this field is 2000 characters.

pub fn image_url<S>(self, image_url: S) -> ImageBuilder<'a, Set<url>, Alt> where
    S: Into<Cow<'a, str>>, 
[src]

Set image_url (Required)

The URL of the image to be displayed.

Maximum length for this field is 3000 characters.

pub fn alt_text<S>(self, alt_text: S) -> ImageBuilder<'a, Url, Set<alt>> where
    S: Into<Cow<'a, str>>, 
[src]

Set alt_text (Required)

A plain-text summary of the image.

This should not contain any markup.

Maximum length for this field is 2000 characters.

pub fn block_id<S>(self, block_id: S) -> Self where
    S: Into<Cow<'a, str>>, 
[src]

Set block_id (Optional)

A string acting as a unique identifier for a block.

You can use this block_id when you receive an interaction payload to identify the source of the action 🔗.

If not specified, a block_id will be generated.

Maximum length for this field is 255 characters.

impl<'a> ImageBuilder<'a, Set<url>, Set<alt>>[src]

pub fn build(self) -> Image<'a>[src]

All done building, now give me a darn actions block!

no method name 'build' found for struct 'ImageBuilder<...>'? Make sure all required setter methods have been called. See docs for ImageBuilder.

use slack_blocks::blocks::Image;

let foo = Image::builder().build(); // Won't compile!
use slack_blocks::{blocks::Image, compose::text::ToSlackPlaintext};

let block = Image::builder().image_url("https://foo.com/bar.png")
                            .alt_text("pic of bar")
                            .build();

Trait Implementations

impl<'a, Url: Debug, Alt: Debug> Debug for ImageBuilder<'a, Url, Alt>[src]

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

Formats the value using the given formatter. Read more

Auto Trait Implementations

impl<'a, Url, Alt> RefUnwindSafe for ImageBuilder<'a, Url, Alt> where
    Alt: RefUnwindSafe,
    Url: RefUnwindSafe

impl<'a, Url, Alt> Send for ImageBuilder<'a, Url, Alt> where
    Alt: Send,
    Url: Send

impl<'a, Url, Alt> Sync for ImageBuilder<'a, Url, Alt> where
    Alt: Sync,
    Url: Sync

impl<'a, Url, Alt> Unpin for ImageBuilder<'a, Url, Alt> where
    Alt: Unpin,
    Url: Unpin

impl<'a, Url, Alt> UnwindSafe for ImageBuilder<'a, Url, Alt> where
    Alt: UnwindSafe,
    Url: UnwindSafe

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, 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.