Skip to main content

mcproto_types/
lib.rs

1//! Minecraft protocol types and their wire-codec interface.
2//!
3//! The crate models protocol values and provides their encoding and decoding
4//! through [`TypeCodec`].
5
6pub mod basic;
7pub mod component;
8pub mod json_text_component;
9pub mod nbt;
10pub mod text_component;
11
12pub trait TypeCodec {
13    fn encode(
14        &self,
15        writer: &mut impl std::io::Write,
16    ) -> Result<(), mcproto_codec::error::CodecError>;
17    fn decode(reader: &mut impl std::io::Read) -> Result<Self, mcproto_codec::error::CodecError>
18    where
19        Self: Sized;
20}