Skip to main content

TypeCodec

Trait TypeCodec 

Source
pub trait TypeCodec {
    // Required methods
    fn encode(&self, writer: &mut impl Write) -> Result<(), CodecError>;
    fn decode(reader: &mut impl Read) -> Result<Self, CodecError>
       where Self: Sized;
}
Expand description

Encodes and decodes a value with a context-independent wire representation.

Required Methods§

Source

fn encode(&self, writer: &mut impl Write) -> Result<(), CodecError>

Encodes this value to the writer.

Source

fn decode(reader: &mut impl Read) -> Result<Self, CodecError>
where Self: Sized,

Decodes this value from the reader.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<T> TypeCodec for Box<T>
where T: TypeCodec,

Encodes a boxed protocol value using the value’s own codec.

Source§

fn encode(&self, writer: &mut impl Write) -> Result<(), CodecError>

Source§

fn decode(reader: &mut impl Read) -> Result<Self, CodecError>

Implementors§

Source§

impl TypeCodec for AdditionalTradeCostComponent

Source§

impl TypeCodec for Angle

Source§

impl TypeCodec for ApplyEffects

Source§

impl TypeCodec for ArmadilloState

Source§

impl TypeCodec for AttackRangeComponent

Source§

impl TypeCodec for AttributeModifier

Source§

impl TypeCodec for AttributeModifiersComponent

Source§

impl TypeCodec for AttributeOperation

Source§

impl TypeCodec for AttributeSlot

Source§

impl TypeCodec for AxolotlVariant

Source§

impl TypeCodec for AxolotlVariantComponent

Source§

impl TypeCodec for BannerPattern

Source§

impl TypeCodec for BannerPatternLayer

Source§

impl TypeCodec for BannerPatternsComponent

Source§

impl TypeCodec for BaseColorComponent

Source§

impl TypeCodec for Bee

Source§

impl TypeCodec for BeeDebugData

Source§

impl TypeCodec for BeeHiveDebugData

Source§

impl TypeCodec for BeesComponent

Source§

impl TypeCodec for BitSet

Source§

impl TypeCodec for BlockCrumbleParticleData

Source§

impl TypeCodec for BlockEntityDataComponent

Source§

impl TypeCodec for BlockMarkerParticleData

Source§

impl TypeCodec for BlockParticleData

Source§

impl TypeCodec for BlockPredicate

Source§

impl TypeCodec for BlockStateComponent

Source§

impl TypeCodec for BlockStateId

Source§

impl TypeCodec for BlockStateProperty

Source§

impl TypeCodec for BlockVibrationSource

Source§

impl TypeCodec for BlocksAttacksComponent

Source§

impl TypeCodec for Boolean

Source§

impl TypeCodec for BreakSoundComponent

Source§

impl TypeCodec for BreezeDebugData

Source§

impl TypeCodec for BucketEntityDataComponent
where Nbt: TypeCodec,

Source§

impl TypeCodec for BundleContentsComponent

Source§

impl TypeCodec for Byte

Source§

impl TypeCodec for CanBreakComponent

Source§

impl TypeCodec for CanPlaceOnComponent

Source§

impl TypeCodec for CatCollarComponent

Source§

impl TypeCodec for CatSoundVariantComponent

Source§

impl TypeCodec for CatSoundVariantId

Source§

impl TypeCodec for CatVariantComponent

Source§

impl TypeCodec for CatVariantId

Source§

impl TypeCodec for ChargedProjectilesComponent

Source§

impl TypeCodec for ChatDecoration

Source§

impl TypeCodec for ChatType

Source§

impl TypeCodec for ChatTypeParameter

Source§

impl TypeCodec for ChickenSoundVariantComponent

Source§

impl TypeCodec for ChickenSoundVariantId

Source§

impl TypeCodec for ChickenVariantComponent

Source§

impl TypeCodec for ChickenVariantId

Source§

impl TypeCodec for CompositeSlotDisplay

Source§

impl TypeCodec for ConsumableComponent

Source§

impl TypeCodec for ConsumeEffect

Source§

impl TypeCodec for ContainerComponent

Source§

impl TypeCodec for ContainerLootComponent
where Nbt: TypeCodec,

Source§

impl TypeCodec for CopperGolemState

Source§

impl TypeCodec for CowSoundVariantComponent

Source§

impl TypeCodec for CowSoundVariantId

Source§

impl TypeCodec for CowVariantComponent

Source§

impl TypeCodec for CowVariantId

Source§

impl TypeCodec for CraftingShapedRecipeDisplay

Source§

impl TypeCodec for CraftingShapelessRecipeDisplay

Source§

impl TypeCodec for CreativeSlotLockComponent

Source§

impl TypeCodec for CustomDataComponent
where Nbt: TypeCodec,

Source§

impl TypeCodec for CustomModelDataComponent

Source§

impl TypeCodec for CustomNameComponent

Source§

impl TypeCodec for DamageComponent

Source§

impl TypeCodec for DamageReduction

Source§

impl TypeCodec for DamageResistantComponent

Source§

impl TypeCodec for DamageTypeComponent

Source§

impl TypeCodec for DataComponent

Source§

impl TypeCodec for DataComponentType

Source§

impl TypeCodec for DeathProtectionComponent

Source§

impl TypeCodec for DebugGoalName

Source§

impl TypeCodec for DebugPathNode

Source§

impl TypeCodec for DebugPathNodeType

Source§

impl TypeCodec for DebugStickStateComponent
where Nbt: TypeCodec,

Source§

impl TypeCodec for DebugStructureInfo

Source§

impl TypeCodec for DebugStructurePiece

Source§

impl TypeCodec for DebugSubscriptionEvent

Source§

impl TypeCodec for DebugSubscriptionType

Source§

impl TypeCodec for DebugSubscriptionUpdate

Source§

impl TypeCodec for Direction

Source§

impl TypeCodec for Double

Source§

impl TypeCodec for DragonBreathParticleData

Source§

impl TypeCodec for DustColorTransitionParticleData

Source§

impl TypeCodec for DustParticleData

Source§

impl TypeCodec for DustPillarParticleData

Source§

impl TypeCodec for DyeColor

Source§

impl TypeCodec for DyeComponent

Source§

impl TypeCodec for DyedColorComponent
where Int: TypeCodec,

Source§

impl TypeCodec for DyedSlotDisplay

Source§

impl TypeCodec for EffectParticleData

Source§

impl TypeCodec for EnchantableComponent

Source§

impl TypeCodec for EnchantmentEntry

Source§

impl TypeCodec for EnchantmentGlintOverrideComponent

Source§

impl TypeCodec for EnchantmentsComponent

Source§

impl TypeCodec for EntityBlockIntersectionDebugData

Source§

impl TypeCodec for EntityBlockIntersectionState

Source§

impl TypeCodec for EntityDataComponent

Source§

impl TypeCodec for EntityEffectParticleData
where Int: TypeCodec,

Source§

impl TypeCodec for EntityMetadata

Source§

impl TypeCodec for EntityMetadataEntry

Source§

impl TypeCodec for EntityMetadataIndex

Source§

impl TypeCodec for EntityMetadataValue

Source§

impl TypeCodec for EntityMetadataValueType

Source§

impl TypeCodec for EntityPathDebugData

Source§

impl TypeCodec for EntityVibrationSource

Source§

impl TypeCodec for EquipmentSlot

Source§

impl TypeCodec for EquippableComponent

Source§

impl TypeCodec for ExactDataComponentMatcher

Source§

impl TypeCodec for FallingDustParticleData

Source§

impl TypeCodec for FireworkExplosion

Source§

impl TypeCodec for FireworkExplosionComponent

Source§

impl TypeCodec for FireworkShape

Source§

impl TypeCodec for FireworksComponent

Source§

impl TypeCodec for FlashParticleData
where Int: TypeCodec,

Source§

impl TypeCodec for Float

Source§

impl TypeCodec for FoodComponent

Source§

impl TypeCodec for FoxVariant

Source§

impl TypeCodec for FoxVariantComponent

Source§

impl TypeCodec for FrogVariantComponent

Source§

impl TypeCodec for FrogVariantId

Source§

impl TypeCodec for FurnaceRecipeDisplay

Source§

impl TypeCodec for GameEventDebugData

Source§

impl TypeCodec for GameEventListenerDebugData

Source§

impl TypeCodec for GameProfile

Source§

impl TypeCodec for GameProfileProperties

Source§

impl TypeCodec for GameProfileProperty

Source§

impl TypeCodec for GeyserBaseParticleData

Source§

impl TypeCodec for GeyserParticleData
where Int: TypeCodec,

Source§

impl TypeCodec for GeyserPlumeParticleData
where Int: TypeCodec,

Source§

impl TypeCodec for GeyserPoofParticleData

Source§

impl TypeCodec for GliderComponent

Source§

impl TypeCodec for GlobalPosition

Source§

impl TypeCodec for GoalSelectorDebugData

Source§

impl TypeCodec for HashedDataComponent

Source§

impl TypeCodec for HashedSlot

Source§

impl TypeCodec for HorseVariant

Source§

impl TypeCodec for HorseVariantComponent

Source§

impl TypeCodec for HumanoidArm

Source§

impl TypeCodec for IdSet

Source§

impl TypeCodec for Identifier

Source§

impl TypeCodec for InstantEffectParticleData

Source§

impl TypeCodec for Instrument

Source§

impl TypeCodec for InstrumentComponent

Source§

impl TypeCodec for Int

Source§

impl TypeCodec for IntangibleProjectileComponent
where Nbt: TypeCodec,

Source§

impl TypeCodec for ItemModelComponent

Source§

impl TypeCodec for ItemNameComponent

Source§

impl TypeCodec for ItemParticleData
where Slot: TypeCodec,

Source§

impl TypeCodec for ItemSlotDisplay

Source§

impl TypeCodec for ItemStackSlotDisplay
where Slot: TypeCodec,

Source§

impl TypeCodec for ItemUseAnimation

Source§

impl TypeCodec for JsonTextComponent

Source§

impl TypeCodec for JukeboxPlayableComponent

Source§

impl TypeCodec for JukeboxSong

Source§

impl TypeCodec for KineticWeaponComponent

Source§

impl TypeCodec for KineticWeaponCondition

Source§

impl TypeCodec for LightArray

Source§

impl TypeCodec for LightData

Source§

impl TypeCodec for LlamaVariant

Source§

impl TypeCodec for LlamaVariantComponent

Source§

impl TypeCodec for LockComponent

Source§

impl TypeCodec for LodestoneTrackerComponent

Source§

impl TypeCodec for Long

Source§

impl TypeCodec for LoreComponent

Source§

impl TypeCodec for LpVec3

Source§

impl TypeCodec for MapColorComponent
where Int: TypeCodec,

Source§

impl TypeCodec for MapDecorationsComponent
where Nbt: TypeCodec,

Source§

impl TypeCodec for MapIdComponent

Source§

impl TypeCodec for MapPostProcessing

Source§

impl TypeCodec for MapPostProcessingComponent

Source§

impl TypeCodec for MaxDamageComponent

Source§

impl TypeCodec for MaxStackSizeComponent

Source§

impl TypeCodec for MinimumAttackChargeComponent

Source§

impl TypeCodec for MooshroomVariant

Source§

impl TypeCodec for MooshroomVariantComponent

Source§

impl TypeCodec for Nbt

Source§

impl TypeCodec for NbtString

Source§

impl TypeCodec for NeighborUpdateDebugData

Source§

impl TypeCodec for NoteBlockSoundComponent

Source§

impl TypeCodec for OminousBottleAmplifierComponent

Source§

impl TypeCodec for OnlyWithComponentSlotDisplay

Source§

impl TypeCodec for OptionalBlockState

Source§

impl TypeCodec for OptionalGlobalPosition

Source§

impl TypeCodec for OptionalLivingEntityReference

Source§

impl TypeCodec for OptionalPosition

Source§

impl TypeCodec for OptionalTextComponent

Source§

impl TypeCodec for OptionalVarInt

Source§

impl TypeCodec for PaintingVariant

Source§

impl TypeCodec for PaintingVariantComponent

Source§

impl TypeCodec for ParrotVariant

Source§

impl TypeCodec for ParrotVariantComponent

Source§

impl TypeCodec for PartialDataComponentMatcher

Source§

impl TypeCodec for PartialMatcherType

Source§

impl TypeCodec for PartialProfile

Source§

impl TypeCodec for Particle

Source§

impl TypeCodec for Particles

Source§

impl TypeCodec for PiercingWeaponComponent

Source§

impl TypeCodec for PigSoundVariantComponent

Source§

impl TypeCodec for PigSoundVariantId

Source§

impl TypeCodec for PigVariantComponent

Source§

impl TypeCodec for PigVariantId

Source§

impl TypeCodec for PlaySound

Source§

impl TypeCodec for PointOfInterestDebugData

Source§

impl TypeCodec for Pose

Source§

impl TypeCodec for Position

Source§

impl TypeCodec for PotDecorationsComponent

Source§

impl TypeCodec for PotionContentsComponent

Source§

impl TypeCodec for PotionDurationScaleComponent

Source§

impl TypeCodec for PotionEffect

Source§

impl TypeCodec for PotionEffectDetail

Source§

impl TypeCodec for PrefixedString

Source§

impl TypeCodec for ProfileComponent

Source§

impl TypeCodec for Property

Source§

impl TypeCodec for ProvidesBannerPatternsComponent

Source§

impl TypeCodec for ProvidesTrimMaterialComponent

Source§

impl TypeCodec for Quaternion

Source§

impl TypeCodec for RabbitVariant

Source§

impl TypeCodec for RabbitVariantComponent

Source§

impl TypeCodec for RaidDebugData

Source§

impl TypeCodec for Rarity

Source§

impl TypeCodec for RarityComponent

Source§

impl TypeCodec for RecipeDisplay

Source§

impl TypeCodec for RecipesComponent
where Nbt: TypeCodec,

Source§

impl TypeCodec for RedstoneWireOrientationDebugData

Source§

impl TypeCodec for RemoveEffects

Source§

impl TypeCodec for RepairCostComponent

Source§

impl TypeCodec for RepairableComponent

Source§

impl TypeCodec for ResolvableProfile

Source§

impl TypeCodec for Rotations

Source§

impl TypeCodec for SalmonSize

Source§

impl TypeCodec for SalmonSizeComponent

Source§

impl TypeCodec for SculkChargeParticleData

Source§

impl TypeCodec for ShapedRecipeGrid

Source§

impl TypeCodec for SheepColorComponent

Source§

impl TypeCodec for Short

Source§

impl TypeCodec for ShriekParticleData

Source§

impl TypeCodec for ShulkerColorComponent

Source§

impl TypeCodec for SkinModel

Source§

impl TypeCodec for Slot

Source§

impl TypeCodec for SlotDisplay

Source§

impl TypeCodec for SmithingRecipeDisplay

Source§

impl TypeCodec for SmithingTrimSlotDisplay

Source§

impl TypeCodec for SnifferState

Source§

impl TypeCodec for SoundEvent

Source§

impl TypeCodec for StonecutterRecipeDisplay

Source§

impl TypeCodec for StoredEnchantmentsComponent

Source§

impl TypeCodec for StructureDebugData

Source§

impl TypeCodec for SulfurCubeContentComponent
where Box<Slot>: TypeCodec,

Source§

impl TypeCodec for SuspiciousStewEffect

Source§

impl TypeCodec for SuspiciousStewEffectsComponent

Source§

impl TypeCodec for SwingAnimationComponent

Source§

impl TypeCodec for SwingAnimationType

Source§

impl TypeCodec for TagSlotDisplay

Source§

impl TypeCodec for TeleportFlags

Source§

impl TypeCodec for TeleportRandomly

Source§

impl TypeCodec for TextComponent

Source§

impl TypeCodec for TintedLeavesParticleData
where Int: TypeCodec,

Source§

impl TypeCodec for ToolComponent

Source§

impl TypeCodec for ToolRule

Source§

impl TypeCodec for TooltipDisplayComponent

Source§

impl TypeCodec for TooltipStyleComponent

Source§

impl TypeCodec for TrailParticleData

Source§

impl TypeCodec for TrimComponent

Source§

impl TypeCodec for TrimMaterial

Source§

impl TypeCodec for TrimMaterialOverride

Source§

impl TypeCodec for TrimPattern

Source§

impl TypeCodec for TropicalFishBaseColorComponent

Source§

impl TypeCodec for TropicalFishPattern

Source§

impl TypeCodec for TropicalFishPatternColorComponent

Source§

impl TypeCodec for TropicalFishPatternComponent

Source§

impl TypeCodec for UnbreakableComponent

Source§

impl TypeCodec for UnsignedByte

Source§

impl TypeCodec for UnsignedShort

Source§

impl TypeCodec for UseCooldownComponent

Source§

impl TypeCodec for UseEffectsComponent

Source§

impl TypeCodec for UseRemainderComponent
where Box<Slot>: TypeCodec,

Source§

impl TypeCodec for Uuid

Source§

impl TypeCodec for VarInt

Source§

impl TypeCodec for VarLong

Source§

impl TypeCodec for Vector3

Source§

impl TypeCodec for VibrationParticleData

Source§

impl TypeCodec for VibrationSource

Source§

impl TypeCodec for VillagerBrainDebugData

Source§

impl TypeCodec for VillagerData

Source§

impl TypeCodec for VillagerProfession

Source§

impl TypeCodec for VillagerType

Source§

impl TypeCodec for VillagerVariantComponent

Source§

impl TypeCodec for WeaponComponent

Source§

impl TypeCodec for WeatheringCopperState

Source§

impl TypeCodec for WithAnyPotionSlotDisplay

Source§

impl TypeCodec for WithRemainderSlotDisplay

Source§

impl TypeCodec for WolfCollarComponent

Source§

impl TypeCodec for WolfSoundVariantComponent

Source§

impl TypeCodec for WolfSoundVariantId

Source§

impl TypeCodec for WolfVariantComponent

Source§

impl TypeCodec for WolfVariantId

Source§

impl TypeCodec for WritableBookContentComponent

Source§

impl TypeCodec for WrittenBookContentComponent

Source§

impl TypeCodec for ZombieNautilusVariantComponent

Source§

impl TypeCodec for ZombieNautilusVariantId

Source§

impl<T> TypeCodec for Filterable<T>

Source§

impl<T> TypeCodec for IdOr<T>
where T: TypeCodec,

Source§

impl<T> TypeCodec for PrefixedArray<T>
where T: TypeCodec,

Source§

impl<T> TypeCodec for PrefixedOptional<T>
where T: TypeCodec,

Source§

impl<X, Y> TypeCodec for Either<X, Y>
where X: TypeCodec, Y: TypeCodec,

Source§

impl<const MAX_UTF16_CODE_UNITS: usize> TypeCodec for GameProfileString<MAX_UTF16_CODE_UNITS>

Source§

impl<const N: usize> TypeCodec for FixedBitSet<N>