CompatibleWith

Trait CompatibleWith 

Source
pub trait CompatibleWith<Old> {
    // Required method
    fn from_old(value: Old) -> Self;
}
Expand description

This is the main type you will be using
It wraps your old and current type and provides a way to deserialize existing data that might
match either of the types
It will deserialize the old type into an deserialize impl for the old type and then convert it
to the new type

#[derive(Serialize, Deserialize)]
pub struct Current;
pub struct SomeType {
    my_var: Current,
}

The Current version of the struct is CompatibleWith<Old>

Required Methods§

Source

fn from_old(value: Old) -> Self

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.

Implementors§

Source§

impl<Old, Current> CompatibleWith<Old> for Current
where Current: From<Old>,