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

Create a new ImageBuilder

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.

Alias for image_url.

Set image_url (Required)

The URL of the image to be displayed.

Maximum length for this field is 3000 characters.

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.

Alias for alt_text.

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.

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

Formats the value using the given formatter. 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

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.