vector_config/external/
toml.rs

1use std::cell::RefCell;
2
3use serde_json::Value;
4
5use crate::{
6    schema::{SchemaGenerator, SchemaObject},
7    Configurable, GenerateError, ToValue,
8};
9
10impl Configurable for toml::Value {
11    fn generate_schema(_: &RefCell<SchemaGenerator>) -> Result<SchemaObject, GenerateError> {
12        // `toml::Value` can be anything that it is possible to represent in TOML, and equivalently, is anything it's
13        // possible to represent in JSON, so... a default schema indicates that.
14        Ok(SchemaObject::default())
15    }
16}
17
18impl ToValue for toml::Value {
19    fn to_value(&self) -> Value {
20        serde_json::to_value(self).expect("Could not convert TOML value to JSON")
21    }
22}