vector_config/external/
tz.rs

1use std::cell::RefCell;
2
3use serde_json::Value;
4
5use crate::{
6    schema::{generate_string_schema, SchemaGenerator, SchemaObject},
7    Configurable, GenerateError, Metadata, ToValue,
8};
9
10impl Configurable for chrono_tz::Tz {
11    fn metadata() -> Metadata {
12        let mut metadata = Metadata::default();
13        metadata.set_description("An IANA timezone.");
14        metadata
15    }
16
17    fn generate_schema(_: &RefCell<SchemaGenerator>) -> Result<SchemaObject, GenerateError> {
18        Ok(generate_string_schema())
19    }
20}
21
22impl ToValue for chrono_tz::Tz {
23    fn to_value(&self) -> Value {
24        Value::String(self.to_string())
25    }
26}