[−][src]Trait craftio_rs::CraftSyncWriter
This trait is the interface by which you can write packets to some underlying implementor of
std::io::Write
.
If you construct a CraftWriter
by wrapping a std::io::Write
implementor then CraftWriter
will implement this trait.
Required methods
pub fn write_packet<P>(&mut self, packet: P) -> WriteResult<()> where
P: Packet,
[src]
P: Packet,
Attempts to serialize, and then write a packet struct to the wrapped stream.
pub fn write_raw_packet<'a, P>(&mut self, packet: P) -> WriteResult<()> where
P: RawPacket<'a>,
[src]
P: RawPacket<'a>,
Attempts to write a serialized packet to the wrapped stream
This function is most useful when forwarding packets from a reader. You can read raw packets from the reader, then match on the enum variant to conditionally deserialize only certain packet types to implement behavior, and leave other packets that are irrelevant to your application in their raw form.
Implementors
impl<R, W> CraftSyncWriter for CraftConnection<R, W> where
CraftReader<R>: CraftSyncReader,
CraftWriter<W>: CraftSyncWriter,
[src]
CraftReader<R>: CraftSyncReader,
CraftWriter<W>: CraftSyncWriter,
pub fn write_packet<P>(&mut self, packet: P) -> WriteResult<()> where
P: Packet,
[src]
P: Packet,
pub fn write_raw_packet<'a, P>(&mut self, packet: P) -> WriteResult<()> where
P: RawPacket<'a>,
[src]
P: RawPacket<'a>,
impl<W> CraftSyncWriter for CraftWriter<W> where
W: Write,
[src]
W: Write,
pub fn write_packet<P>(&mut self, packet: P) -> WriteResult<()> where
P: Packet,
[src]
P: Packet,
pub fn write_raw_packet<'a, P>(&mut self, packet: P) -> WriteResult<()> where
P: RawPacket<'a>,
[src]
P: RawPacket<'a>,