Trait valence::protocol::encode::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>
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.
fn 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§
fn 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.
Object Safety§
This trait is not object safe.
Implementations on Foreign Types§
§impl<W> WritePacket for &mut Wwhere
W: WritePacket,
impl<W> WritePacket for &mut Wwhere
W: WritePacket,
Implementors§
impl WritePacket for Client
Writes packets into this client’s packet buffer. The buffer is flushed at the end of the tick.