pub struct FrameEncoder { /* private fields */ }Expand description
Turns packets into wire bytes. Packets are appended to an internal output buffer;
take it with FrameEncoder::take (or let crate::io::FramedWriter flush it), so
several packets of one tick go out in a single write.
Implementations§
Source§impl FrameEncoder
impl FrameEncoder
Sourcepub fn set_compression(&mut self, threshold: i32)
pub fn set_compression(&mut self, threshold: i32)
Sets the compression threshold (negative = off), as received from the server.
Sourcepub fn enable_encryption(&mut self, secret: &[u8; 16])
pub fn enable_encryption(&mut self, secret: &[u8; 16])
Turns on encryption for everything written from now on.
Sourcepub fn write_packet<P: Packet>(&mut self, p: &P) -> Result<(), EncodeError>
pub fn write_packet<P: Packet>(&mut self, p: &P) -> Result<(), EncodeError>
Encodes and frames a typed packet.
Trait Implementations§
Source§impl Debug for FrameEncoder
impl Debug for FrameEncoder
Auto Trait Implementations§
impl Freeze for FrameEncoder
impl RefUnwindSafe for FrameEncoder
impl Send for FrameEncoder
impl Sync for FrameEncoder
impl Unpin for FrameEncoder
impl UnsafeUnpin for FrameEncoder
impl UnwindSafe for FrameEncoder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more