Trait valence::protocol::WritePacket

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§

fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<(), Error>
where P: Packet + Encode,

Writes a packet to this object. The result of encoding the packet is returned.

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§

fn write_packet<P>(&mut self, packet: &P)
where P: Packet + Encode,

Writes a packet to this object. Encoding errors are typically logged and discarded.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

§

impl<W> WritePacket for &mut W
where W: WritePacket,

§

fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<(), Error>
where P: Packet + Encode,

§

fn write_packet_bytes(&mut self, bytes: &[u8])

Implementors§

source§

impl WritePacket for Client

Writes packets into this client’s packet buffer. The buffer is flushed at the end of the tick.

source§

impl WritePacket for valence::layer::chunk::ExceptWriter<'_>

source§

impl WritePacket for valence::layer::chunk::RadiusExceptWriter<'_>

source§

impl WritePacket for valence::layer::chunk::RadiusWriter<'_>

source§

impl WritePacket for valence::layer::chunk::ViewExceptWriter<'_>

source§

impl WritePacket for valence::layer::chunk::ViewWriter<'_>

source§

impl WritePacket for valence::layer::entity::ExceptWriter<'_>

source§

impl WritePacket for valence::layer::entity::RadiusExceptWriter<'_>

source§

impl WritePacket for valence::layer::entity::RadiusWriter<'_>

source§

impl WritePacket for valence::layer::entity::ViewExceptWriter<'_>

source§

impl WritePacket for ChunkLayer

source§

impl WritePacket for EntityLayer

§

impl WritePacket for PacketWriter<'_>

§

impl WritePacket for PacketEncoder

source§

impl<'a> WritePacket for valence::layer::entity::ViewWriter<'a>

§

impl<T> WritePacket for Mut<'_, T>
where T: WritePacket,