[][src]Struct legion::Registry

pub struct Registry<T, S = Canon> where
    T: TypeKey,
    S: CustomEntitySerializer + 'static, 
{ /* fields omitted */ }

A world (de)serializer which describes how to (de)serialize the component types in a world.

The type parameter T represents the key used in the serialized output to identify each component type. The type keys used must uniquely identify each component type, and be stable between recompiles.

See the legion_typeuuid crate for an example of a type key which is stable between compiles.

Implementations

impl<T, S> Registry<T, S> where
    T: TypeKey,
    S: CustomEntitySerializer + 'static, 
[src]

pub fn new(entity_serializer: S) -> Self[src]

Constructs a new registry.

pub fn on_unknown(&mut self, unknown: UnknownType)[src]

Sets the behavior to use when a component type is unknown.

pub fn register<C: Component + Serialize + for<'de> Deserialize<'de>>(
    &mut self,
    mapped_type_id: T
)
[src]

Registers a component type and its key with the registry.

pub fn register_auto_mapped<C: Component + Serialize + for<'de> Deserialize<'de>>(
    &mut self
) where
    T: AutoTypeKey<C>, 
[src]

Registers a component type and its key with the registry.

pub fn as_deserialize_into_world<'a>(
    &'a self,
    world: &'a mut World
) -> DeserializeIntoWorld<'a, Self>
[src]

Constructs a serde::DeserializeSeed which will deserialize into an existing world.

pub fn as_deserialize(&self) -> DeserializeNewWorld<'_, Self>[src]

Constructs a serde::DeserializeSeed which will deserialize into a new world.

Trait Implementations

impl<T, S> Default for Registry<T, S> where
    T: TypeKey,
    S: CustomEntitySerializer + Default + 'static, 
[src]

impl<T, S> WorldDeserializer for Registry<T, S> where
    T: TypeKey,
    S: CustomEntitySerializer + 'static, 
[src]

type TypeId = T

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

impl<T, S> WorldSerializer for Registry<T, S> where
    T: TypeKey,
    S: CustomEntitySerializer + 'static, 
[src]

type TypeId = T

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

Auto Trait Implementations

impl<T, S = Canon> !RefUnwindSafe for Registry<T, S>

impl<T, S> Send for Registry<T, S> where
    S: Send,
    T: Send

impl<T, S> Sync for Registry<T, S> where
    S: Send + Sync,
    T: Sync

impl<T, S> Unpin for Registry<T, S> where
    S: Unpin,
    T: Unpin

impl<T, S> UnwindSafe for Registry<T, S> where
    S: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Downcast for T where
    T: Any
[src]

impl<T> DowncastSync for T where
    T: Send + Sync + Any
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,