pub struct VarInt(/* private fields */);Expand description
Variable-length integer.
A non-negative integer value, less than 2^62.
Implementations§
Source§impl VarInt
impl VarInt
Sourcepub const fn try_from_u64(value: u64) -> Result<Self, VarIntBoundsExceeded>
pub const fn try_from_u64(value: u64) -> Result<Self, VarIntBoundsExceeded>
Tries to construct a VarInt from u64.
Sourcepub const unsafe fn from_u64_unchecked(value: u64) -> Self
pub const unsafe fn from_u64_unchecked(value: u64) -> Self
Sourcepub const fn into_inner(self) -> u64
pub const fn into_inner(self) -> u64
Extracts the integer value as u64.
Sourcepub const fn size(self) -> usize
pub const fn size(self) -> usize
Returns how many bytes it would take to encode this value as a variable-length integer.
This value cannot be larger than Self::MAX_SIZE.
Sourcepub const fn parse_size(first: u8) -> usize
pub const fn parse_size(first: u8) -> usize
Returns how long the variable-length integer is, given its first byte.
Trait Implementations§
Source§impl Ord for VarInt
impl Ord for VarInt
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 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