Trait valence_protocol::encode::WritePacket

source ·
pub trait WritePacket {
    // Required methods
    fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<()>
       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§

source

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

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

source

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§

source

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§

source§

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

source§

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

source§

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

source§

impl<W: WritePacket> WritePacket for &mut W

source§

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

source§

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

Implementors§

source§

impl WritePacket for PacketEncoder

source§

impl WritePacket for PacketWriter<'_>

impl WritePacket for Client

impl WritePacket for ChunkLayer

impl WritePacket for ExceptWriter<'_>

impl WritePacket for RadiusExceptWriter<'_>

impl WritePacket for RadiusWriter<'_>

impl WritePacket for ViewExceptWriter<'_>

impl WritePacket for ViewWriter<'_>

impl WritePacket for EntityLayer

impl WritePacket for ExceptWriter<'_>

impl WritePacket for RadiusExceptWriter<'_>

impl WritePacket for RadiusWriter<'_>

impl WritePacket for ViewExceptWriter<'_>

impl<'a> WritePacket for ViewWriter<'a>