pub trait WritePacket {
// Required methods
fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<(), Error>
where P: Packet + Encode;
fn write_packet_bytes(&mut self, bytes: &[u8]);
// Provided method
fn write_packet<P>(&mut self, packet: &P)
where P: Packet + Encode { ... }
}
Expand description
Types that can have packets written to them.
Required Methods§
Sourcefn write_packet_fallible<P>(&mut self, packet: &P) -> Result<(), Error>
fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<(), Error>
Writes a packet to this object. The result of encoding the packet is returned.
Sourcefn write_packet_bytes(&mut self, bytes: &[u8])
fn write_packet_bytes(&mut self, bytes: &[u8])
Copies raw packet data directly into this object. Don’t use this unless you know what you’re doing.
Provided Methods§
Sourcefn write_packet<P>(&mut self, packet: &P)
fn write_packet<P>(&mut self, packet: &P)
Writes a packet to this object. Encoding errors are typically logged and discarded.
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.
Implementations on Foreign Types§
Source§impl<W> WritePacket for &mut Wwhere
W: WritePacket,
impl<W> WritePacket for &mut Wwhere
W: WritePacket,
Implementors§
impl WritePacket for valence::layer::chunk::ExceptWriter<'_>
impl WritePacket for valence::layer::chunk::RadiusExceptWriter<'_>
impl WritePacket for valence::layer::chunk::RadiusWriter<'_>
impl WritePacket for valence::layer::chunk::ViewExceptWriter<'_>
impl WritePacket for valence::layer::chunk::ViewWriter<'_>
impl WritePacket for valence::layer::entity::ExceptWriter<'_>
impl WritePacket for valence::layer::entity::RadiusExceptWriter<'_>
impl WritePacket for valence::layer::entity::RadiusWriter<'_>
impl WritePacket for valence::layer::entity::ViewExceptWriter<'_>
impl WritePacket for valence::layer::entity::ViewWriter<'_>
impl WritePacket for Client
Writes packets into this client’s packet buffer. The buffer is flushed at the end of the tick.