VersionizeSlice

Trait VersionizeSlice 

Source
pub trait VersionizeSlice: Sized {
    type VersionedSlice<'vers>: Serialize
       where Self: 'vers;

    // Required method
    fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>;
}
Expand description

This trait is used as a proxy to be more flexible when deriving Versionize for Vec<T>.

This way, we can chose to skip versioning Vec<T> if T is a native types but still versionize in a loop if T is a custom type. This is used as a workaround for feature(specialization) and to bypass the orphan rule.

Required Associated Types§

Source

type VersionedSlice<'vers>: Serialize where Self: 'vers

Required Methods§

Source

fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>

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.

Implementations on Foreign Types§

Source§

impl<'a, T: VersionizeSlice> VersionizeSlice for &'a [T]

Source§

type VersionedSlice<'vers> = Vec<<T as VersionizeSlice>::VersionedSlice<'vers>> where T: 'vers, 'a: 'vers

Source§

fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>

Source§

impl<T: Versionize, U: Versionize> VersionizeSlice for (T, U)

Source§

type VersionedSlice<'vers> = Vec<(<T as Versionize>::Versioned<'vers>, <U as Versionize>::Versioned<'vers>)> where T: 'vers, U: 'vers

Source§

fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>

Source§

impl<T: Versionize, U: Versionize, V: Versionize> VersionizeSlice for (T, U, V)

Source§

type VersionedSlice<'vers> = Vec<(<T as Versionize>::Versioned<'vers>, <U as Versionize>::Versioned<'vers>, <V as Versionize>::Versioned<'vers>)> where T: 'vers, U: 'vers, V: 'vers

Source§

fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>

Source§

impl<T: VersionizeSlice> VersionizeSlice for Box<[T]>

Source§

type VersionedSlice<'vers> = Vec<<T as VersionizeSlice>::VersionedSlice<'vers>> where T: 'vers

Source§

fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>

Source§

impl<T: VersionizeSlice> VersionizeSlice for Vec<T>

Source§

type VersionedSlice<'vers> = Vec<<T as VersionizeSlice>::VersionedSlice<'vers>> where T: 'vers

Source§

fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>

Source§

impl<const N: usize, T: VersionizeSlice> VersionizeSlice for [T; N]

Source§

type VersionedSlice<'vers> = Vec<<T as VersionizeSlice>::VersionedSlice<'vers>> where T: 'vers

Source§

fn versionize_slice(slice: &[Self]) -> Self::VersionedSlice<'_>

Implementors§

Source§

impl<T: NotVersioned + Serialize + DeserializeOwned + Clone> VersionizeSlice for T

Source§

type VersionedSlice<'vers> = &'vers [T] where T: 'vers