pub trait ToTomlValue {
// Required method
fn to_toml_value(&self) -> Result<Value, Error>;
}
Required Methods§
Sourcefn to_toml_value(&self) -> Result<Value, Error>
fn to_toml_value(&self) -> Result<Value, Error>
Convert to toml string.
use serde::Serialize;
use serde_valid::toml::ToTomlValue;
use serde_valid::Validate;
#[derive(Debug, Validate, Serialize)]
struct TestStruct {
#[validate(maximum = 100)]
val: i32,
}
let s = TestStruct { val: 10 };
assert!(s.to_toml_value().is_ok());