ErasedCosmosEntity

Trait ErasedCosmosEntity 

Source
pub trait ErasedCosmosEntity:
    CosmosEntity
    + UpcastErasedSerdeSerialize
    + ErasedCosmosEntityClone { }
Expand description

Marker trait for types that implement CosmosEntity<Entity = String>, Clone and Serialize but need to be able to be used as trait-objects. Usually trait objects are not able to implement Serialize due to it being generic. However the crate erased_serde allows for trait-objects to implement Serialize. Trait objects are also not able to implement Clone due to it requring Sized but we can get around this by using a trait for cloning a Box instead, this is done through ErasedCosmosEntityClone. This trait should be automatically implemented for any type which needs it.

Implementors§

Source§

impl<T> ErasedCosmosEntity for T
where T: CosmosEntity<Entity = String> + Serialize + Send + Sync + Clone + 'static,

We must specify Entity = String in order to implement ErasedCosmosEntityClone and UpcastErasedSerdeSerialize because the associated type of the returned object must be specified.