Trait legion::serialize::WorldSerializer [−][src]
Describes a type which knows how to deserialize the components in a world.
Associated Types
type TypeId: Serialize + Ord
[src]
The stable type ID used to identify each component type in the serialized data.
Required methods
fn map_id(&self, type_id: ComponentTypeId) -> Result<Self::TypeId, UnknownType>
[src]
Converts a runtime component type ID into the serialized type ID.
unsafe fn serialize_component<S: Serializer>(
&self,
ty: ComponentTypeId,
ptr: *const u8,
serializer: S
) -> Result<S::Ok, S::Error>
[src]
&self,
ty: ComponentTypeId,
ptr: *const u8,
serializer: S
) -> Result<S::Ok, S::Error>
Serializes a single component.
Safety
The pointer must point to a valid instance of the component type represented by the given component type ID.
unsafe fn serialize_component_slice<S: Serializer>(
&self,
ty: ComponentTypeId,
storage: &dyn UnknownComponentStorage,
archetype: ArchetypeIndex,
serializer: S
) -> Result<S::Ok, S::Error>
[src]
&self,
ty: ComponentTypeId,
storage: &dyn UnknownComponentStorage,
archetype: ArchetypeIndex,
serializer: S
) -> Result<S::Ok, S::Error>
Serializes a slice of components.
Safety
The pointer must point to a valid instance of the component type represented by the given component type ID.
Implementors
impl<T> WorldSerializer for Registry<T> where
T: TypeKey,
[src]
T: TypeKey,
type TypeId = T
unsafe fn serialize_component<Ser: Serializer>(
&self,
ty: ComponentTypeId,
ptr: *const u8,
serializer: Ser
) -> Result<Ser::Ok, Ser::Error>
[src]
&self,
ty: ComponentTypeId,
ptr: *const u8,
serializer: Ser
) -> Result<Ser::Ok, Ser::Error>
fn map_id(&self, type_id: ComponentTypeId) -> Result<Self::TypeId, UnknownType>
[src]
unsafe fn serialize_component_slice<Ser: Serializer>(
&self,
ty: ComponentTypeId,
storage: &dyn UnknownComponentStorage,
archetype: ArchetypeIndex,
serializer: Ser
) -> Result<Ser::Ok, Ser::Error>
[src]
&self,
ty: ComponentTypeId,
storage: &dyn UnknownComponentStorage,
archetype: ArchetypeIndex,
serializer: Ser
) -> Result<Ser::Ok, Ser::Error>