Struct VarInt
pub struct VarInt(/* private fields */);Available on crate features
quic and h3 and i-implement-a-third-party-backend-and-opt-into-breaking-changes only.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 encoded_size(first: u8) -> usize
pub fn encoded_size(first: u8) -> usize
Length of an encoded value from its first byte
pub fn decode<B>(r: &mut B) -> Result<VarInt, UnexpectedEnd>where
B: Buf,
pub fn encode<B>(&self, w: &mut B)where
B: BufMut,
Trait Implementations§
§impl Ord for VarInt
impl Ord for VarInt
§impl PartialOrd for VarInt
impl PartialOrd for VarInt
§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<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