Struct valence_protocol::encode::PacketEncoder
source · pub struct PacketEncoder { /* private fields */ }
Implementations§
source§impl PacketEncoder
impl PacketEncoder
pub fn new() -> Self
pub fn append_bytes(&mut self, bytes: &[u8])
pub fn prepend_packet<P>(&mut self, pkt: &P) -> Result<()>
pub fn append_packet<P>(&mut self, pkt: &P) -> Result<()>
sourcepub fn take(&mut self) -> BytesMut
pub fn take(&mut self) -> BytesMut
Takes all the packets written so far and encrypts them if encryption is enabled.
pub fn clear(&mut self)
pub fn set_compression(&mut self, threshold: CompressionThreshold)
Trait Implementations§
source§impl Default for PacketEncoder
impl Default for PacketEncoder
source§fn default() -> PacketEncoder
fn default() -> PacketEncoder
Returns the “default value” for a type. Read more
source§impl WritePacket for PacketEncoder
impl WritePacket for PacketEncoder
source§fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<()>
fn write_packet_fallible<P>(&mut self, packet: &P) -> Result<()>
Writes a packet to this object. The result of encoding the packet is
returned.
source§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.
Auto Trait Implementations§
impl Freeze for PacketEncoder
impl RefUnwindSafe for PacketEncoder
impl Send for PacketEncoder
impl Sync for PacketEncoder
impl Unpin for PacketEncoder
impl UnwindSafe for PacketEncoder
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere
T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self
using data from the given [World
].