Struct slack_blocks::blocks::context::build::ContextBuilder [−][src]
pub struct ContextBuilder<'a, Elements> { /* fields omitted */ }
Expand description
Build an Context block
Allows you to construct safely, with compile-time checks on required setter methods.
Required Methods
ContextBuilder::build()
is only available if these methods have been called:
element
Example
use slack_blocks::{blocks::Context, elems::Image, text::ToSlackPlaintext}; let block = Context::builder().element("foo".plaintext()) .element(Image::builder().image_url("foo.png") .alt_text("pic of foo") .build()) .build();
Implementations
pub fn child<El>(self, element: El) -> ContextBuilder<'a, Set<elements>> where
El: Into<ImageOrText<'a>>,
[src]This is supported on crate feature blox
only.
pub fn child<El>(self, element: El) -> ContextBuilder<'a, Set<elements>> where
El: Into<ImageOrText<'a>>,
[src]blox
only.Alias of element
for appending an element with an XML child.
pub fn element<El>(self, element: El) -> ContextBuilder<'a, Set<elements>> where
El: Into<ImageOrText<'a>>,
[src]
pub fn element<El>(self, element: El) -> ContextBuilder<'a, Set<elements>> where
El: Into<ImageOrText<'a>>,
[src]Add an element
(Required, can be called many times)
A composition object; Must be image elements or text objects.
Maximum number of items is 10.
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 'ContextBuilder<...>'
? Make sure all required setter methods have been called. See docs forContextBuilder
.
use slack_blocks::blocks::Context; let foo = Context::builder().build(); // Won't compile!
use slack_blocks::{blocks::Context, compose::text::ToSlackPlaintext, elems::Image}; let block = Context::builder().element("foo".plaintext()) .element(Image::builder().image_url("foo.png") .alt_text("pic of foo") .build()) .build();
Trait Implementations
Auto Trait Implementations
impl<'a, Elements> RefUnwindSafe for ContextBuilder<'a, Elements> where
Elements: RefUnwindSafe,
impl<'a, Elements> Send for ContextBuilder<'a, Elements> where
Elements: Send,
impl<'a, Elements> Sync for ContextBuilder<'a, Elements> where
Elements: Sync,
impl<'a, Elements> Unpin for ContextBuilder<'a, Elements> where
Elements: Unpin,
impl<'a, Elements> UnwindSafe for ContextBuilder<'a, Elements> where
Elements: UnwindSafe,