pub trait Value: Sized {
type Error: Debug + Error + Error;
// Required methods
fn from_typed<V: Serialize>(value: &V) -> Result<Self, Self::Error>;
fn to_typed<'a, T: Deserialize<'a>>(&'a self) -> Result<T, Self::Error>;
}Expand description
An abstraction over different value types, such as JSON or CBOR.
Required Associated Types§
Required Methods§
Sourcefn from_typed<V: Serialize>(value: &V) -> Result<Self, Self::Error>
fn from_typed<V: Serialize>(value: &V) -> Result<Self, Self::Error>
Serialize a value to the value type.
Sourcefn to_typed<'a, T: Deserialize<'a>>(&'a self) -> Result<T, Self::Error>
fn to_typed<'a, T: Deserialize<'a>>(&'a self) -> Result<T, Self::Error>
Deserialize a value from the value type.
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.