Trait mc_core::entity::SingleEntityCodec[][src]

pub trait SingleEntityCodec {
    type Comp: Default + Component;
    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.

Associated Types

Component type, an associated type is used to allow only on implementation per codec struct.

Required methods

Implementors