Struct legion::serialize::Registry [−][src]
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> Registry<T> where
T: TypeKey,
[src]
T: TypeKey,
pub fn new() -> 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]
&mut self,
mapped_type_id: T
)
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]
&mut self
) where
T: AutoTypeKey<C>,
Registers a component type and its key with the registry.
pub fn as_deserialize_into_world<'a, E: EntitySerializer>(
&'a self,
world: &'a mut World,
entity_serializer: &'a E
) -> DeserializeIntoWorld<'a, Self, E>
[src]
&'a self,
world: &'a mut World,
entity_serializer: &'a E
) -> DeserializeIntoWorld<'a, Self, E>
Constructs a serde::DeserializeSeed which will deserialize into an existing world.
pub fn as_deserialize<'a, E: EntitySerializer>(
&'a self,
entity_serializer: &'a E
) -> DeserializeNewWorld<'a, Self, E>
[src]
&'a self,
entity_serializer: &'a E
) -> DeserializeNewWorld<'a, Self, E>
Constructs a serde::DeserializeSeed which will deserialize into a new world.
Trait Implementations
impl<T> Default for Registry<T> where
T: TypeKey,
[src]
T: TypeKey,
impl<T> WorldDeserializer for Registry<T> where
T: TypeKey,
[src]
T: TypeKey,
type TypeId = T
The stable type ID used to identify each component type in the serialized data.
fn unmap_id(
&self,
type_id: &Self::TypeId
) -> Result<ComponentTypeId, UnknownType>
[src]
&self,
type_id: &Self::TypeId
) -> Result<ComponentTypeId, UnknownType>
fn register_component(&self, type_id: Self::TypeId, layout: &mut EntityLayout)
[src]
fn deserialize_component_slice<'a, 'de, D: Deserializer<'de>>(
&self,
type_id: ComponentTypeId,
storage: UnknownComponentWriter<'a>,
deserializer: D
) -> Result<(), D::Error>
[src]
&self,
type_id: ComponentTypeId,
storage: UnknownComponentWriter<'a>,
deserializer: D
) -> Result<(), D::Error>
fn deserialize_component<'de, D: Deserializer<'de>>(
&self,
type_id: ComponentTypeId,
deserializer: D
) -> Result<Box<[u8]>, D::Error>
[src]
&self,
type_id: ComponentTypeId,
deserializer: D
) -> Result<Box<[u8]>, D::Error>
impl<T> WorldSerializer for Registry<T> where
T: TypeKey,
[src]
T: TypeKey,
type TypeId = T
The stable type ID used to identify each component type in the serialized data.
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>
Auto Trait Implementations
impl<T> RefUnwindSafe for Registry<T> where
T: RefUnwindSafe,
T: RefUnwindSafe,
impl<T> Send for Registry<T> where
T: Send,
T: Send,
impl<T> Sync for Registry<T> where
T: Sync,
T: Sync,
impl<T> Unpin for Registry<T> where
T: Unpin,
T: Unpin,
impl<T> UnwindSafe for Registry<T> where
T: UnwindSafe,
T: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Downcast for T where
T: Any,
[src]
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
[src]
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
[src]
pub fn as_any(&self) -> &(dyn Any + 'static)
[src]
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
[src]
impl<T> DowncastSync for T where
T: Send + Sync + Any,
[src]
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
pub const ALIGN: usize
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
pub unsafe fn drop(ptr: usize)
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,