Struct VarInt
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§
§impl VarInt
impl VarInt
pub fn from_u64(x: u64) -> Result<VarInt, VarIntBoundsExceeded>
pub fn from_u64(x: u64) -> Result<VarInt, VarIntBoundsExceeded>
Succeeds iff x < 2^62
pub const unsafe fn from_u64_unchecked(x: u64) -> VarInt
pub const unsafe fn from_u64_unchecked(x: u64) -> VarInt
pub const fn into_inner(self) -> u64
pub const fn into_inner(self) -> u64
Extract the integer value
pub fn saturating_add(self, rhs: impl Into<VarInt>) -> VarInt
pub fn saturating_add(self, rhs: impl Into<VarInt>) -> VarInt
Saturating integer addition. Computes self + rhs, saturating at the numeric bounds instead of overflowing.
Trait Implementations§
§impl<'arbitrary> Arbitrary<'arbitrary> for VarInt
impl<'arbitrary> Arbitrary<'arbitrary> for VarInt
§fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<VarInt, Error>
fn arbitrary(u: &mut Unstructured<'arbitrary>) -> Result<VarInt, Error>
Generate an arbitrary value of
Self from the given unstructured data. Read more§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 more§impl From<VarInt> for IdleTimeout
impl From<VarInt> for IdleTimeout
§fn from(inner: VarInt) -> IdleTimeout
fn from(inner: VarInt) -> IdleTimeout
Converts to this type from the input type.
§impl Ord for VarInt
impl Ord for VarInt
§impl PartialOrd for VarInt
impl PartialOrd for VarInt
§impl TryFrom<u128> for VarInt
impl TryFrom<u128> for VarInt
§type Error = VarIntBoundsExceeded
type Error = VarIntBoundsExceeded
The type returned in the event of a conversion error.
§impl TryFrom<u64> for VarInt
impl TryFrom<u64> for VarInt
§type Error = VarIntBoundsExceeded
type Error = VarIntBoundsExceeded
The type returned in the event of a conversion error.
§impl TryFrom<usize> for VarInt
impl TryFrom<usize> for VarInt
§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,
§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more