pub trait SingleEntityCodec {
type Comp: Default + Component;
// Required methods
fn encode(&self, src: &Self::Comp, dst: &mut CompoundTag);
fn decode(&self, src: &CompoundTag) -> Self::Comp;
}Expand description
This trait is a simpler specification of EntityCodec with the restriction of allowing only
one component (implementing hecs::Component) to be encoded or decoded. The component type
also have to implement Default to provide a default EntityCodec::default implementation.
Implementing this trait automatically means that you are implementing EntityCodec on Self,
with encode, decode and default automatically defined to delegate to this trait.
Required Associated Types§
Required Methods§
fn encode(&self, src: &Self::Comp, dst: &mut CompoundTag)
fn decode(&self, src: &CompoundTag) -> Self::Comp
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".