Struct slack_blocks::text::build::TextBuilder [−][src]
pub struct TextBuilder<T, TMarker> { /* fields omitted */ }Expand description
Text Builder
Allows you to construct safely, with compile-time checks on required setter methods.
Required Methods
TextBuilder::build() is only available if these methods have been called:
textplainormrkdwn
use slack_blocks::text::Text; let foo = Text::builder().plain().text("foo").build();
Implementations
impl<T> TextBuilder<T, RequiredMethodNotCalled<text>>[src]
impl<T> TextBuilder<T, RequiredMethodNotCalled<text>>[src]pub fn text(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>[src]
pub fn text(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>[src]Set text (Required)
The text contents to render for this Text object.
For some basic formatting examples, see the docs for
the text::Mrkdwn, or Slack’s markdown docs 🔗.
There are no intrinsic length limits on this, those are usually requirements of the context the text will be used in.
pub fn child(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>[src]
This is supported on crate feature xml only.
pub fn child(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>[src]xml only.Alias of text for XML macros, allowing text
to be set as a string literal instead of an attribute.
use mox::mox; use slack_blocks::mox::*; let as_attr = mox! { <text kind=plain text="Foo" /> }; let as_child = mox! { <text kind=plain>"Foo"</text> }; assert_eq!(as_attr, as_child);
impl<M> TextBuilder<Text, M>[src]
impl<M> TextBuilder<Text, M>[src]pub fn kind<T, K>(self, kind: K) -> TextBuilder<T, M> where
T: Into<Text>,
K: TextKind<T>, [src]
This is supported on crate feature xml only.
pub fn kind<T, K>(self, kind: K) -> TextBuilder<T, M> where
T: Into<Text>,
K: TextKind<T>, [src]xml only.Set the kind of the text you’re building (Required)
Intended to be used as an XML attribute with build::kind::mrkdwn or build::kind::plain
use mox::mox; use slack_blocks::{mox::*, text}; let xml = mox! {<text kind=plain>"Foo"</text>}; let builder = text::Plain::from("Foo"); assert_eq!(xml, builder)
pub fn plain(self) -> TextBuilder<Plain, M>[src]
pub fn plain(self) -> TextBuilder<Plain, M>[src]Set the text you’re building to be plain_text (Required)
pub fn mrkdwn(self) -> TextBuilder<Mrkdwn, M>[src]
pub fn mrkdwn(self) -> TextBuilder<Mrkdwn, M>[src]Set the text you’re building to be mrkdwn (Required)
impl<M> TextBuilder<Mrkdwn, M>[src]
impl<M> TextBuilder<Mrkdwn, M>[src]pub fn verbatim(self, verbatim: bool) -> Self[src]
pub fn verbatim(self, verbatim: bool) -> Self[src]Set verbatim (Optional)
When set to false (as is default) URLs will be auto-converted into links, conversation names will be link-ified, and certain mentions will be automatically parsed.
Using a value of true will skip any preprocessing of this nature, although you can still include manual parsing strings.
impl<M> TextBuilder<Plain, M>[src]
impl<M> TextBuilder<Plain, M>[src]impl TextBuilder<Plain, Set<text>>[src]
impl TextBuilder<Plain, Set<text>>[src]pub fn build(self) -> Plain[src]
pub fn build(self) -> Plain[src]All done building, now give me a darn text object!
no method name 'build' found for struct 'TextBuilder<...>'? Make sure all required setter methods have been called. See docs forTextBuilder.
use slack_blocks::text::Text; let foo = Text::builder().build(); // Won't compile!
use slack_blocks::text::Text; let foo = Text::builder().plain() .emoji(true) .text("foo :joy:") .build();
impl TextBuilder<Mrkdwn, Set<text>>[src]
impl TextBuilder<Mrkdwn, Set<text>>[src]pub fn build(self) -> Mrkdwn[src]
pub fn build(self) -> Mrkdwn[src]All done building, now give me a darn text object!
no method name 'build' found for struct 'TextBuilder<...>'? Make sure all required setter methods have been called. See docs forTextBuilder.
use slack_blocks::text::Text; let foo = Text::builder().build(); // Won't compile!
use slack_blocks::text::Text; let foo = Text::builder().mrkdwn() .verbatim(true) .text("foo :joy:") .build();
Trait Implementations
Auto Trait Implementations
impl<T, TMarker> RefUnwindSafe for TextBuilder<T, TMarker> where
T: RefUnwindSafe,
TMarker: RefUnwindSafe,
T: RefUnwindSafe,
TMarker: RefUnwindSafe,
impl<T, TMarker> Send for TextBuilder<T, TMarker> where
T: Send,
TMarker: Send,
T: Send,
TMarker: Send,
impl<T, TMarker> Sync for TextBuilder<T, TMarker> where
T: Sync,
TMarker: Sync,
T: Sync,
TMarker: Sync,
impl<T, TMarker> Unpin for TextBuilder<T, TMarker> where
T: Unpin,
TMarker: Unpin,
T: Unpin,
TMarker: Unpin,
impl<T, TMarker> UnwindSafe for TextBuilder<T, TMarker> where
T: UnwindSafe,
TMarker: UnwindSafe,
T: UnwindSafe,
TMarker: UnwindSafe,
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]pub fn borrow_mut(&mut self) -> &mut T[src]
pub fn borrow_mut(&mut self) -> &mut T[src]Mutably borrows from an owned value. Read more