pub trait SerializeComponents<E, M> where
    M: Marker
{ type Data: Serialize; fn serialize_entity<F>(&self, entity: Entity, ids: F) -> Result<Self::Data, E>
    where
        F: FnMut(Entity) -> Option<M>
; fn serialize<S>(
        &self,
        entities: &EntitiesRes,
        markers: &ReadStorage<'_, M>,
        serializer: S
    ) -> Result<S::Ok, S::Error>
    where
        E: Display,
        S: Serializer
, { ... } fn serialize_recursive<S>(
        &self,
        entities: &EntitiesRes,
        markers: &mut WriteStorage<'_, M>,
        allocator: &mut M::Allocator,
        serializer: S
    ) -> Result<S::Ok, S::Error>
    where
        E: Display,
        M: Marker,
        S: Serializer
, { ... } }
Expand description

A trait which allows to serialize entities and their components.

Required Associated Types

The data representation of the components.

Required Methods

Serialize the components of a single entity using a entity -> marker mapping.

Provided Methods

Serialize components from specified storages of all marked entities with provided serializer. When the component gets serialized the closure passed in ids argument returns None for unmarked Entity. In this case serialization of this component may perform workaround or fail. So the function doesn’t recursively mark referenced entities. For recursive marking see serialize_recursive

Serialize components from specified storages of all marked entities with provided serializer. When the component gets serialized the closure passed in ids argument marks unmarked Entity (the marker of which was requested) and it will get serialized recursively. For serializing without such recursion see serialize function.

Implementations on Foreign Types

Implementors