charming_fork_zephyr/element/
formatter.rs

1use serde::Serialize;
2
3use super::RawString;
4
5#[derive(Serialize)]
6#[serde(untagged)]
7pub enum Formatter {
8    String(String),
9    Function(RawString),
10}
11
12impl From<&str> for Formatter {
13    fn from(s: &str) -> Self {
14        Formatter::String(s.to_string())
15    }
16}
17
18impl From<RawString> for Formatter {
19    fn from(s: RawString) -> Self {
20        Formatter::Function(s)
21    }
22}