pub struct DefaultEntityCodec<T>(/* private fields */);
Expand description
A useful structure that implements the method EntityCodec::default
and add to the given
builder the Default:default()
value of the generic type T
. Actually, EntityCodec
is
only implemented when your type T
is Default + Component
. This bound cannot be defined
in the structure definition for now because it would not be possible to define it statically.
Implementations§
Source§impl<T> DefaultEntityCodec<T>
impl<T> DefaultEntityCodec<T>
Trait Implementations§
Source§impl<T> EntityCodec for DefaultEntityCodec<T>
impl<T> EntityCodec for DefaultEntityCodec<T>
Source§fn encode(
&self,
src: &EntityRef<'_>,
dst: &mut CompoundTag,
) -> Result<(), String>
fn encode( &self, src: &EntityRef<'_>, dst: &mut CompoundTag, ) -> Result<(), String>
Encode components stored accessible from the given entity reference into given destination
compound tag.
Source§fn decode(
&self,
src: &CompoundTag,
dst: &mut EntityBuilder,
) -> Result<(), String>
fn decode( &self, src: &CompoundTag, dst: &mut EntityBuilder, ) -> Result<(), String>
Decode given source compound tag and add decoded components into the given entity builder.
Source§fn default(&self, dst: &mut EntityBuilder)
fn default(&self, dst: &mut EntityBuilder)
Add default components to the given entity builder.
impl<T> Send for DefaultEntityCodec<T>
impl<T> Sync for DefaultEntityCodec<T>
Auto Trait Implementations§
impl<T> Freeze for DefaultEntityCodec<T>
impl<T> RefUnwindSafe for DefaultEntityCodec<T>where
T: RefUnwindSafe,
impl<T> Unpin for DefaultEntityCodec<T>
impl<T> UnwindSafe for DefaultEntityCodec<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more