pub struct VarInt(/* private fields */);
Expand description
An integer less than 2^62
Values of this type are suitable for encoding as QUIC variable-length integer.
Implementations§
Source§impl VarInt
impl VarInt
Sourcepub fn from_u64(x: u64) -> Result<Self, VarIntBoundsExceeded>
pub fn from_u64(x: u64) -> Result<Self, VarIntBoundsExceeded>
Succeeds iff x
< 2^62
Sourcepub const unsafe fn from_u64_unchecked(x: u64) -> Self
pub const unsafe fn from_u64_unchecked(x: u64) -> Self
Sourcepub const fn into_inner(self) -> u64
pub const fn into_inner(self) -> u64
Extract the integer value
Sourcepub fn saturating_add(self, rhs: impl Into<Self>) -> Self
pub fn saturating_add(self, rhs: impl Into<Self>) -> Self
Saturating integer addition. Computes self + rhs, saturating at the numeric bounds instead of overflowing.
Trait Implementations§
Source§impl<'arbitrary> Arbitrary<'arbitrary> for VarInt
impl<'arbitrary> Arbitrary<'arbitrary> for VarInt
Source§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<Self>
Generate an arbitrary value of
Self
from the given unstructured data. Read moreSource§fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
fn arbitrary_take_rest(u: Unstructured<'a>) -> Result<Self, Error>
Generate an arbitrary value of
Self
from the entirety of the given
unstructured data. Read moreSource§fn size_hint(depth: usize) -> (usize, Option<usize>)
fn size_hint(depth: usize) -> (usize, Option<usize>)
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§fn try_size_hint(
depth: usize,
) -> Result<(usize, Option<usize>), MaxRecursionReached>
fn try_size_hint( depth: usize, ) -> Result<(usize, Option<usize>), MaxRecursionReached>
Get a size hint for how many bytes out of an
Unstructured
this type
needs to construct itself. Read moreSource§impl From<VarInt> for IdleTimeout
impl From<VarInt> for IdleTimeout
Source§impl Ord for VarInt
impl Ord for VarInt
Source§impl PartialOrd for VarInt
impl PartialOrd for VarInt
Source§impl TryFrom<u128> for VarInt
impl TryFrom<u128> for VarInt
Source§type Error = VarIntBoundsExceeded
type Error = VarIntBoundsExceeded
The type returned in the event of a conversion error.
Source§impl TryFrom<u64> for VarInt
impl TryFrom<u64> for VarInt
Source§type Error = VarIntBoundsExceeded
type Error = VarIntBoundsExceeded
The type returned in the event of a conversion error.
Source§impl TryFrom<usize> for VarInt
impl TryFrom<usize> for VarInt
Source§type Error = VarIntBoundsExceeded
type Error = VarIntBoundsExceeded
The type returned in the event of a conversion error.
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)