#[repr(transparent)]pub struct VarInt(pub i32);Expand description
An i32 encoded with variable length.
Tuple Fields§
§0: i32Implementations§
Source§impl VarInt
impl VarInt
Sourcepub const MAX_SIZE: usize = 5
pub const MAX_SIZE: usize = 5
The maximum number of bytes a VarInt could occupy when read from and
written to the Minecraft protocol.
Sourcepub const fn written_size(self) -> usize
pub const fn written_size(self) -> usize
Returns the exact number of bytes this varint will write when
Encode::encode is called, assuming no error occurs.
This is the size of “canonical” (non-padded) encoding for this
value, not necessarily the number of bytes that were consumed
while decoding it. Minecraft VarInts may be padded by using
more continuation bytes than the value requires, so callers that
need the decoded wire length should compare the input slice length
before and after decoding instead.
pub fn decode_partial<R: Read>(r: R) -> Result<i32, VarIntDecodeError>
Trait Implementations§
Source§impl<'de> Deserialize<'de> for VarInt
impl<'de> Deserialize<'de> for VarInt
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for VarInt
impl Ord for VarInt
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialOrd for VarInt
impl PartialOrd for VarInt
impl Copy for VarInt
impl Eq for VarInt
impl StructuralPartialEq for VarInt
Auto Trait Implementations§
impl Freeze for VarInt
impl RefUnwindSafe for VarInt
impl Send for VarInt
impl Sync for VarInt
impl Unpin for VarInt
impl UnsafeUnpin for VarInt
impl UnwindSafe for VarInt
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.