slack-blocks
This crate brings Slack's terrific Block Kit 🔗 to the Rust ecosystem.
Inside, you'll find models for all of Slack's Layout Blocks, Block Elements, and Composition Objects. Each structure has Slack's API documentation copied in-place so you don't have to leave your editor to remember the details of the block kit API.
Every model has builders that leverage Rust's type system to help you provide every required field, so you can be confident in your app.
Troubleshooting common compiler errors
Method build not found for ...Builder
- Dig into the error message,
you'll find something like RequiredMethodNotCalled<method::foo>
,
meaning you need to call .foo()
before you can call .build()
!
Example
Using an example from Slack's Documentation:
You can use raw Builders like so:
use ;
let section = builder
.text
.accessory
.build;
Or enable the unstable
feature and use xml macros:
use *;
let pick_date = blox! ;
let section = blox! ;
License
Licensed under either of
- Apache License, Version 2.0, (LICENSE-APACHE or https://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or https://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.