[][src]Module specs::saveload

Save and load entities from various formats with serde.

WorldSerialize / WorldDeserialize

This module provides two SystemData implementors:

Reading those makes it very easy to serialize or deserialize components.

SerializeComponents implements Serialize and DeserializeComponents implements DeserializeOwned, so serializing / deserializing should be very easy.

Markers

Because you usually don't want to serialize everything, we use markers to say which entities we're interested in. However, these markers aren't just boolean values; we also have id spaces which allow us to identify entities even if local ids are different. The allocation of these ids is what MarkerAllocators are responsible for. For an example, see the docs for the Marker trait.

Structs

EntityData

A struct used for deserializing entity data.

SimpleMarker

Basic marker implementation usable for saving and loading, uses u64 as identifier

SimpleMarkerAllocator

Basic marker allocator, uses u64 as identifier

UuidMarker

Basic marker uuid implementation usable for saving and loading.

UuidMarkerAllocator

Basic marker allocator for uuid.

Traits

ConvertSaveload

Converts a data type (usually a Component) into its serializable form and back to actual data from it's deserialized form.

DeserializeComponents

A trait which allows to deserialize entities and their components.

MarkedBuilder

A common trait for EntityBuilder and LazyBuilder with a marker function, allowing either to be used.

Marker

This trait should be implemented by a component which is going to be used as marker. This marker should be set to entity that should be serialized. If serialization strategy needs to set marker to some entity then it should use newly allocated marker from Marker::Allocator.

MarkerAllocator

This allocator is used with the Marker trait. It provides a method for allocating new Markers. It should also provide a Marker -> Entity mapping. The maintain method can be implemented for cleanup and actualization. See docs for Marker for an example.

SerializeComponents

A trait which allows to serialize entities and their components.