pub struct TextBuilder<T, TMarker> { /* private fields */ }Expand description
Implementations§
Source§impl<T> TextBuilder<T, RequiredMethodNotCalled<text>>
impl<T> TextBuilder<T, RequiredMethodNotCalled<text>>
Sourcepub fn text(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>
pub fn text(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>
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.
Sourcepub fn child(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>
Available on crate feature blox only.
pub fn child(self, t: impl AsRef<str>) -> TextBuilder<T, Set<text>>
blox only.Alias of text for XML macros, allowing text
to be set as a string literal instead of an attribute.
use slack_blocks::blox::*;
let as_attr = blox! {
<text kind=plain text="Foo" />
};
let as_child = blox! {
<text kind=plain>"Foo"</text>
};
assert_eq!(as_attr, as_child);Source§impl<M> TextBuilder<Text, M>
impl<M> TextBuilder<Text, M>
Sourcepub fn kind<T, K>(self, kind: K) -> TextBuilder<T, M>
Available on crate feature blox only.
pub fn kind<T, K>(self, kind: K) -> TextBuilder<T, M>
blox 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 slack_blocks::{blox::*, text};
let xml = blox! {<text kind=plain>"Foo"</text>};
let builder = text::Plain::from("Foo");
assert_eq!(xml, builder)Sourcepub fn plain(self) -> TextBuilder<Plain, M>
pub fn plain(self) -> TextBuilder<Plain, M>
Set the text you’re building to be plain_text (Required)
Sourcepub fn mrkdwn(self) -> TextBuilder<Mrkdwn, M>
pub fn mrkdwn(self) -> TextBuilder<Mrkdwn, M>
Set the text you’re building to be mrkdwn (Required)
Source§impl<M> TextBuilder<Mrkdwn, M>
impl<M> TextBuilder<Mrkdwn, M>
Sourcepub fn verbatim(self, verbatim: bool) -> Self
pub fn verbatim(self, verbatim: bool) -> Self
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.
Source§impl<M> TextBuilder<Plain, M>
impl<M> TextBuilder<Plain, M>
Source§impl TextBuilder<Plain, Set<text>>
impl TextBuilder<Plain, Set<text>>
Sourcepub fn build(self) -> Plain
pub fn build(self) -> Plain
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();Source§impl TextBuilder<Mrkdwn, Set<text>>
impl TextBuilder<Mrkdwn, Set<text>>
Sourcepub fn build(self) -> Mrkdwn
pub fn build(self) -> Mrkdwn
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();