pub trait Packet: Debug {
const ID: i32;
const NAME: &'static str;
const SIDE: PacketSide;
const STATE: PacketState;
// Provided method
fn encode_with_id(&self, w: impl Write) -> Result<()>
where Self: Encode { ... }
}Expand description
Types considered to be Minecraft packets.
In serialized form, a packet begins with a VarInt packet ID followed by
the body of the packet. If present, the implementations of [Encode] and
[chunkedge_binary::Decode] on Self are expected to only encode/decode the
body of this packet without the leading ID.
Required Associated Constants§
Sourceconst SIDE: PacketSide
const SIDE: PacketSide
The side this packet is intended for.
Sourceconst STATE: PacketState
const STATE: PacketState
The state in which this packet is used.
Provided Methods§
Sourcefn encode_with_id(&self, w: impl Write) -> Result<()>where
Self: Encode,
fn encode_with_id(&self, w: impl Write) -> Result<()>where
Self: Encode,
Encodes this packet’s VarInt ID first, followed by the packet’s body.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.