Trait legion::serialize::EntitySerializer
source · [−]pub trait EntitySerializer: 'static {
fn serialize(
&self,
entity: Entity,
serialize_fn: &mut dyn FnMut(&dyn Serialize)
);
fn deserialize(
&self,
deserializer: &mut dyn Deserializer<'_>
) -> Result<Entity, Error>;
}
Expand description
Describes how to serialize and deserialize a runtime Entity
ID.
This trait is automatically implemented for types that implement CustomEntitySerializer
.
Required methods
Serializes an Entity
by constructing the serializable representation
and passing it into serialize_fn
.
fn deserialize(
&self,
deserializer: &mut dyn Deserializer<'_>
) -> Result<Entity, Error>
fn deserialize(
&self,
deserializer: &mut dyn Deserializer<'_>
) -> Result<Entity, Error>
Deserializes an Entity
.