usage/spec/data_types.rs
1use serde::Serialize;
2
3/// The type a config property's values take.
4///
5/// `Display` is the KDL spelling, so a parsed spec can be written back out — without it
6/// `data_type` was read and then silently dropped by the serializer, which is how a
7/// `data_type="integer"` came back as `Null` after one round trip.
8#[derive(Debug, Copy, Clone, PartialEq, Eq, Serialize, Default)]
9#[serde(rename_all = "snake_case")]
10pub enum SpecDataTypes {
11 #[default]
12 Null,
13 String,
14 Integer,
15 Float,
16 Boolean,
17}
18
19impl_string_enum!(SpecDataTypes {
20 SpecDataTypes::Null => "null",
21 SpecDataTypes::String => "string",
22 SpecDataTypes::Integer => "integer",
23 SpecDataTypes::Float => "float",
24 SpecDataTypes::Boolean => "boolean",
25});