WorldDeserializer

Trait WorldDeserializer 

Source
pub trait WorldDeserializer {
    type TypeId: for<'de> Deserialize<'de>;

    // Required methods
    fn unmap_id(
        &self,
        type_id: &Self::TypeId,
    ) -> Result<ComponentTypeId, UnknownType>;
    fn register_component(
        &self,
        type_id: Self::TypeId,
        layout: &mut EntityLayout,
    );
    fn deserialize_component_slice<'a, 'de, D>(
        &self,
        type_id: ComponentTypeId,
        storage: UnknownComponentWriter<'a>,
        deserializer: D,
    ) -> Result<(), <D as Deserializer<'de>>::Error>
       where D: Deserializer<'de>;
    fn deserialize_component<'de, D>(
        &self,
        type_id: ComponentTypeId,
        deserializer: D,
    ) -> Result<Box<[u8]>, <D as Deserializer<'de>>::Error>
       where D: Deserializer<'de>;
}
Expand description

Describes a type which knows how to deserialize the components in a world.

Required Associated Types§

Source

type TypeId: for<'de> Deserialize<'de>

The stable type ID used to identify each component type in the serialized data.

Required Methods§

Source

fn unmap_id( &self, type_id: &Self::TypeId, ) -> Result<ComponentTypeId, UnknownType>

Converts the serialized type ID into a runtime component type ID.

Source

fn register_component(&self, type_id: Self::TypeId, layout: &mut EntityLayout)

Adds the specified component to the given entity layout.

Source

fn deserialize_component_slice<'a, 'de, D>( &self, type_id: ComponentTypeId, storage: UnknownComponentWriter<'a>, deserializer: D, ) -> Result<(), <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserializes a slice of components and inserts them into the given storage.

Source

fn deserialize_component<'de, D>( &self, type_id: ComponentTypeId, deserializer: D, ) -> Result<Box<[u8]>, <D as Deserializer<'de>>::Error>
where D: Deserializer<'de>,

Deserializes a single component and returns it as a boxed u8 slice.

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§