rajac_base/value.rs
1use serde::{Deserialize, Serialize};
2use speedy::Writable;
3use std::fmt::{Display, Formatter};
4
5#[derive(Writable, Serialize, Deserialize)]
6pub enum Value {
7 String(String),
8}
9
10impl Value {
11 pub fn string(string: impl Into<String>) -> Self {
12 Self::String(string.into())
13 }
14}
15
16impl Display for Value {
17 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
18 match self {
19 Value::String(string) => write!(f, "\"{string}\""),
20 }
21 }
22}