slack-blocks 0.25.0

Models + clientside validation for Slack's JSON Block Kit
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use pretty_assertions::assert_eq;
use serde_json::json;
use slack_blocks::{blox::*, text};

#[test]
pub fn docs_ex_1() {
  let text: text::Text = blox! {<text kind=mrkdwn>"A message *with some bold text* and _some italicized text_."</text>}.into();
  let actual = serde_json::to_value(text).unwrap();
  let expected = json!({
    "type": "mrkdwn",
    "text": "A message *with some bold text* and _some italicized text_."
  });

  assert_eq!(actual, expected);
}