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

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

Image Element builder

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:

  • image_url
  • alt_text

Example

use slack_blocks::{blocks::{Block, Context},
                   elems::Image};

let img = Image::builder().image_url("foo").alt_text("bar").build();

let block: Block = Context::builder().element(img).build().into();

// <send block to slack API>

Implementations

Construct a new builder

Set image_url (Required)

The URL of the image to be displayed.

Alias of image_url.

Set alt_text (Required)

A plain-text summary of the image.

This should not contain any markup.

Alias of alt_text.

All done building, now give me a darn image element!

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

use slack_blocks::elems::Image;

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

let foo = 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.