pub struct VarInt(pub u64);
Expand description
A variable-length unsigned integer
Tuple Fields
0: u64
Implementations
sourceimpl VarInt
impl VarInt
sourcepub fn encoded_length(&self) -> u64
pub fn encoded_length(&self) -> u64
Gets the length of this VarInt when encoded. Returns 1 for 0…0xFC, 3 for 0xFD…(2^16-1), 5 for 0x10000…(2^32-1), and 9 otherwise.
Trait Implementations
sourceimpl<D: SimpleDecoder> ConsensusDecodable<D> for VarInt
impl<D: SimpleDecoder> ConsensusDecodable<D> for VarInt
sourceimpl<S: SimpleEncoder> ConsensusEncodable<S> for VarInt
impl<S: SimpleEncoder> ConsensusEncodable<S> for VarInt
sourceimpl Ord for VarInt
impl Ord for VarInt
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl PartialOrd<VarInt> for VarInt
impl PartialOrd<VarInt> for VarInt
sourcefn partial_cmp(&self, other: &VarInt) -> Option<Ordering>
fn partial_cmp(&self, other: &VarInt) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for VarInt
impl StructuralEq for VarInt
impl StructuralPartialEq for VarInt
Auto Trait Implementations
impl RefUnwindSafe for VarInt
impl Send for VarInt
impl Sync for VarInt
impl Unpin for VarInt
impl UnwindSafe for VarInt
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more