[][src]Trait craftio_rs::CraftSyncWriter

pub trait CraftSyncWriter {
    pub fn write_packet<P>(&mut self, packet: P) -> WriteResult<()>
    where
        P: Packet
;
pub fn write_raw_packet<'a, P>(&mut self, packet: P) -> WriteResult<()>
    where
        P: RawPacket<'a>
; }

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]

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]

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.

Loading content...

Implementors

impl<R, W> CraftSyncWriter for CraftConnection<R, W> where
    CraftReader<R>: CraftSyncReader,
    CraftWriter<W>: CraftSyncWriter
[src]

impl<W> CraftSyncWriter for CraftWriter<W> where
    W: Write
[src]

Loading content...