pub struct VarLong(pub i64);Expand description
A variable-length encoded 64-bit signed integer, occupying 1 to 10 bytes.
VarLong uses the same MSB continuation bit encoding as VarInt but
for 64-bit values. It is used in the protocol for large values like
entity UUIDs in some contexts, timestamps, and world seed. Negative
values use two’s complement and always require 10 bytes.
Tuple Fields§
§0: i64Implementations§
Trait Implementations§
Source§impl Decode for VarLong
Decodes a VarLong by reading 1-10 bytes from the buffer.
impl Decode for VarLong
Decodes a VarLong by reading 1-10 bytes from the buffer.
Same algorithm as VarInt decoding but allowing up to 10 bytes
(64 bits). Returns Error::VarIntTooLarge if more than 10 bytes
carry continuation bits, Error::BufferUnderflow if the buffer
ends mid-value.
Source§impl Encode for VarLong
Encodes the VarLong as 1-10 bytes using MSB continuation bit encoding.
impl Encode for VarLong
Encodes the VarLong as 1-10 bytes using MSB continuation bit encoding.
Same algorithm as VarInt but operating on 64-bit values. Negative
values are encoded as their unsigned two’s complement representation
and always produce 10 bytes.
Source§impl EncodedSize for VarLong
Computes the number of bytes this VarLong will occupy when encoded.
impl EncodedSize for VarLong
Computes the number of bytes this VarLong will occupy when encoded.
Returns 1-10 based on the unsigned magnitude. Small positive values
(0-127) take 1 byte, i64::MAX takes 9, and negative values always
take 10 bytes.
fn encoded_size(&self) -> usize
impl Copy for VarLong
impl Eq for VarLong
impl StructuralPartialEq for VarLong
Auto Trait Implementations§
impl Freeze for VarLong
impl RefUnwindSafe for VarLong
impl Send for VarLong
impl Sync for VarLong
impl Unpin for VarLong
impl UnsafeUnpin for VarLong
impl UnwindSafe for VarLong
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.