Module slack_blocks::blox [−][src]
blox
only.Expand description
XML macro builder support
Blocks
blocks::Actions
- <
actions_block
>
blocks::Header
- <
header_block
>
or <
h1
>
blocks::Block::Divider
- <
divider_block
>
or <
hr
>
blocks::Section
- <
section_block
>
blocks::Context
- <
context_block
>
Block Elements
elems::TextInput
- <
text_input
>
elems::Image
- <
img
>
elems::Button
- <
button
>
elems::Checkboxes
- <
checkboxes
>
elems::DatePicker
- <
date_picker
>
elems::Radio
- <
radio_buttons
>
elems::select
- <
select
>
Composition Objects
compose::text
- <
text()
>
compose::opt
- <
option
>
compose::opt_group
- <
option_group
>
Example
Using an example from Slack’s Documentation:
{
"type": "section",
"text": {
"text": "*Sally* has requested you set the deadline for the Nano launch project",
"type": "mrkdwn"
},
"accessory": {
"type": "datepicker",
"action_id": "datepicker123",
"initial_date": "1990-04-28",
"placeholder": {
"type": "plain_text",
"text": "Select a date"
}
}
}
use slack_blocks::blox::*; let pick_date = blox! { <date_picker action_id="datepicker123" placeholder="Select a date" initial_date=(28, 4, 1990) /> }; let section = blox! { <section_block accessory=pick_date> <text kind=plain>"*Sally* has requested you set the deadline for the Nano launch project"</text> </section_block> };
Re-exports
pub use elems::button::Style::Danger as btn_danger; | |
pub use elems::button::Style::Primary as btn_primary; | |
pub use elems::select::build::choose::multi; | |
pub use elems::select::build::choose::single; | |
pub use elems::select::build::data_source::conversations; | |
pub use elems::select::build::data_source::external; | |
pub use elems::select::build::data_source::public_channels; | |
pub use elems::select::build::data_source::static_; | |
pub use elems::select::build::data_source::users; | |
pub use text::build::kind::mrkdwn; | |
pub use text::build::kind::plain; |
Macros
blox | Accepts an XML-like expression and expands it to builder method calls. |
Structs
DividerBuilder | Dummy builder so blocks::Block::Divider can be built with XML macro |
Traits
IntoChild | Identity trait to appease the mox macro |
Functions
actions_block |
|
button |
|
checkboxes |
|
confirm |
|
context_block |
|
date_picker |
|
divider_block |
|
file_block |
|
h1 | Alias for |
header_block |
|
hr | Alias for |
img |
|
img_block |
|
input_block |
|
option |
|
option_group |
|
overflow |
|
radio_buttons |
|
section_block |
|
select |
|
text |
|
text_input |
|