1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use serde::{Deserialize, Serialize};

use crate::impl_from_contents;

pub mod text;
use text::Text;

/// # Composition Objects
///
/// Composition objects can be used inside of [block elements 🔗] and certain message payload fields.
///
/// They are simply common JSON object patterns that you'll encounter frequently
/// when building blocks or composing messages.
#[derive(Clone, Debug, Deserialize, Hash, PartialEq, Serialize)]
pub enum Compose {
    Text(Text),
}

impl_from_contents!(Compose, Text, Text);

impl From<text::plain::Contents> for Compose {
    fn from(text: text::plain::Contents) -> Self {
        Into::<text::Text>::into(text).into()
    }
}

impl From<text::mrkdwn::Contents> for Compose {
    fn from(text: text::mrkdwn::Contents) -> Self {
        Into::<text::Text>::into(text).into()
    }
}