pub trait FromTomlSlice<'de>where
Self: Sized,{
// Required method
fn from_toml_slice(slice: &'de [u8]) -> Result<Self, Error<Error>>;
}
Required Methods§
Sourcefn from_toml_slice(slice: &'de [u8]) -> Result<Self, Error<Error>>
fn from_toml_slice(slice: &'de [u8]) -> Result<Self, Error<Error>>
Convert from toml slice.
use serde::Deserialize;
use serde_valid::Validate;
use serde_valid::toml::FromTomlSlice;
#[derive(Debug, Validate, Deserialize)]
struct TestStruct {
#[validate(min_length = 1)]
val: String,
}
let s = TestStruct::from_toml_slice(br#"val= "abcde""#);
s.unwrap();
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.