Struct s2n_quic_core::varint::VarInt
source · pub struct VarInt(/* private fields */);
Implementations§
source§impl VarInt
impl VarInt
pub const MAX: Self = _
pub const ZERO: Self = _
pub fn new(v: u64) -> Result<Self, VarIntError>
sourcepub const unsafe fn new_unchecked(value: u64) -> Self
pub const unsafe fn new_unchecked(value: u64) -> Self
Returns a VarInt
without validating the value is less than VarInt::MAX
§Safety
Callers need to ensure the value is less than or equal to VarInt::MAX
pub const fn from_u8(v: u8) -> Self
pub const fn from_u16(v: u16) -> Self
pub const fn from_u32(v: u32) -> Self
pub const fn as_u64(self) -> u64
pub fn checked_add(self, value: Self) -> Option<Self>
pub fn checked_add_usize(self, value: usize) -> Option<Self>
pub fn saturating_add(self, value: Self) -> Self
pub fn checked_sub(self, value: Self) -> Option<Self>
pub fn saturating_sub(self, value: Self) -> Self
pub fn checked_mul(self, value: Self) -> Option<Self>
pub fn saturating_mul(self, value: Self) -> Self
pub fn checked_div(self, value: Self) -> Option<Self>
sourcepub fn encode_updated<E: Encoder>(self, replacement: Self, encoder: &mut E)
pub fn encode_updated<E: Encoder>(self, replacement: Self, encoder: &mut E)
Re-encodes a replacement value where self
was used as a placeholder.
Methods from Deref<Target = u64>§
pub const MIN: u64 = 0u64
pub const MAX: u64 = 18_446_744_073_709_551_615u64
pub const BITS: u32 = 64u32
Trait Implementations§
source§impl AddAssign<usize> for VarInt
impl AddAssign<usize> for VarInt
source§fn add_assign(&mut self, rhs: usize)
fn add_assign(&mut self, rhs: usize)
Performs the
+=
operation. Read moresource§impl AddAssign for VarInt
impl AddAssign for VarInt
source§fn add_assign(&mut self, rhs: Self)
fn add_assign(&mut self, rhs: Self)
Performs the
+=
operation. Read moresource§impl<'a> DecoderValue<'a> for VarInt
impl<'a> DecoderValue<'a> for VarInt
fn decode(buffer: DecoderBuffer<'a>) -> DecoderBufferResult<'a, Self>
source§impl<'a> DecoderValueMut<'a> for VarInt
impl<'a> DecoderValueMut<'a> for VarInt
fn decode_mut(buffer: DecoderBufferMut<'a>) -> DecoderBufferMutResult<'a, Self>
source§impl DivAssign<usize> for VarInt
impl DivAssign<usize> for VarInt
source§fn div_assign(&mut self, rhs: usize)
fn div_assign(&mut self, rhs: usize)
Performs the
/=
operation. Read moresource§impl DivAssign for VarInt
impl DivAssign for VarInt
source§fn div_assign(&mut self, rhs: Self)
fn div_assign(&mut self, rhs: Self)
Performs the
/=
operation. Read moresource§impl EncoderValue for VarInt
impl EncoderValue for VarInt
source§fn encoding_size(&self) -> usize
fn encoding_size(&self) -> usize
Returns the encoding size with no buffer constrains
source§fn encoding_size_for_encoder<E: Encoder>(&self, encoder: &E) -> usize
fn encoding_size_for_encoder<E: Encoder>(&self, encoder: &E) -> usize
Returns the encoding size for the given encoder’s capacity
source§fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
fn encode_mut<E>(&mut self, encoder: &mut E)where
E: Encoder,
Encodes the value into the encoder, while potentially mutating the value itself
source§fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
fn encode_with_len_prefix<Len, E>(&self, encoder: &mut E)
Encodes the value into the encoder with a prefix of
Len
fn encode_to_vec(&self) -> Vec<u8>
source§impl IntervalBound for VarInt
impl IntervalBound for VarInt
source§impl MulAssign<usize> for VarInt
impl MulAssign<usize> for VarInt
source§fn mul_assign(&mut self, rhs: usize)
fn mul_assign(&mut self, rhs: usize)
Performs the
*=
operation. Read moresource§impl MulAssign for VarInt
impl MulAssign for VarInt
source§fn mul_assign(&mut self, rhs: Self)
fn mul_assign(&mut self, rhs: Self)
Performs the
*=
operation. Read moresource§impl Ord for VarInt
impl Ord for VarInt
source§impl PartialEq<VarInt> for ActiveConnectionIdLimit
impl PartialEq<VarInt> for ActiveConnectionIdLimit
source§impl PartialEq<VarInt> for InitialMaxData
impl PartialEq<VarInt> for InitialMaxData
source§impl PartialEq<VarInt> for InitialMaxStreamDataBidiLocal
impl PartialEq<VarInt> for InitialMaxStreamDataBidiLocal
source§impl PartialEq<VarInt> for InitialMaxStreamDataBidiRemote
impl PartialEq<VarInt> for InitialMaxStreamDataBidiRemote
source§impl PartialEq<VarInt> for InitialMaxStreamDataUni
impl PartialEq<VarInt> for InitialMaxStreamDataUni
source§impl PartialEq<VarInt> for InitialMaxStreamsBidi
impl PartialEq<VarInt> for InitialMaxStreamsBidi
source§impl PartialEq<VarInt> for InitialMaxStreamsUni
impl PartialEq<VarInt> for InitialMaxStreamsUni
source§impl PartialEq<VarInt> for MaxAckDelay
impl PartialEq<VarInt> for MaxAckDelay
source§impl PartialEq<VarInt> for MaxDatagramFrameSize
impl PartialEq<VarInt> for MaxDatagramFrameSize
source§impl PartialEq<VarInt> for MaxIdleTimeout
impl PartialEq<VarInt> for MaxIdleTimeout
source§impl PartialEq<VarInt> for MaxUdpPayloadSize
impl PartialEq<VarInt> for MaxUdpPayloadSize
source§impl PartialEq<usize> for VarInt
impl PartialEq<usize> for VarInt
source§impl PartialEq for VarInt
impl PartialEq for VarInt
source§impl PartialOrd<VarInt> for ActiveConnectionIdLimit
impl PartialOrd<VarInt> for ActiveConnectionIdLimit
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for InitialMaxData
impl PartialOrd<VarInt> for InitialMaxData
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for InitialMaxStreamDataBidiLocal
impl PartialOrd<VarInt> for InitialMaxStreamDataBidiLocal
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for InitialMaxStreamDataBidiRemote
impl PartialOrd<VarInt> for InitialMaxStreamDataBidiRemote
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for InitialMaxStreamDataUni
impl PartialOrd<VarInt> for InitialMaxStreamDataUni
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for InitialMaxStreamsBidi
impl PartialOrd<VarInt> for InitialMaxStreamsBidi
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for InitialMaxStreamsUni
impl PartialOrd<VarInt> for InitialMaxStreamsUni
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for MaxAckDelay
impl PartialOrd<VarInt> for MaxAckDelay
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for MaxDatagramFrameSize
impl PartialOrd<VarInt> for MaxDatagramFrameSize
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for MaxIdleTimeout
impl PartialOrd<VarInt> for MaxIdleTimeout
1.0.0 · source§fn 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 moresource§impl PartialOrd<VarInt> for MaxUdpPayloadSize
impl PartialOrd<VarInt> for MaxUdpPayloadSize
1.0.0 · source§fn 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 moresource§impl PartialOrd<u64> for VarInt
impl PartialOrd<u64> for VarInt
1.0.0 · source§fn 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 moresource§impl PartialOrd<usize> for VarInt
impl PartialOrd<usize> for VarInt
1.0.0 · source§fn 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 moresource§impl PartialOrd for VarInt
impl PartialOrd for VarInt
1.0.0 · source§fn 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 moresource§impl RemAssign<usize> for VarInt
impl RemAssign<usize> for VarInt
source§fn rem_assign(&mut self, rhs: usize)
fn rem_assign(&mut self, rhs: usize)
Performs the
%=
operation. Read moresource§impl RemAssign for VarInt
impl RemAssign for VarInt
source§fn rem_assign(&mut self, rhs: Self)
fn rem_assign(&mut self, rhs: Self)
Performs the
%=
operation. Read moresource§impl SubAssign<usize> for VarInt
impl SubAssign<usize> for VarInt
source§fn sub_assign(&mut self, rhs: usize)
fn sub_assign(&mut self, rhs: usize)
Performs the
-=
operation. Read moresource§impl SubAssign for VarInt
impl SubAssign for VarInt
source§fn sub_assign(&mut self, rhs: Self)
fn sub_assign(&mut self, rhs: Self)
Performs the
-=
operation. Read moresource§impl TryFrom<VarInt> for ActiveConnectionIdLimit
impl TryFrom<VarInt> for ActiveConnectionIdLimit
source§impl TryFrom<VarInt> for InitialMaxData
impl TryFrom<VarInt> for InitialMaxData
source§impl TryFrom<VarInt> for InitialMaxStreamDataUni
impl TryFrom<VarInt> for InitialMaxStreamDataUni
source§impl TryFrom<VarInt> for InitialMaxStreamsBidi
impl TryFrom<VarInt> for InitialMaxStreamsBidi
source§impl TryFrom<VarInt> for InitialMaxStreamsUni
impl TryFrom<VarInt> for InitialMaxStreamsUni
source§impl TryFrom<VarInt> for MaxAckDelay
impl TryFrom<VarInt> for MaxAckDelay
source§impl TryFrom<VarInt> for MaxDatagramFrameSize
impl TryFrom<VarInt> for MaxDatagramFrameSize
source§impl TryFrom<VarInt> for MaxIdleTimeout
impl TryFrom<VarInt> for MaxIdleTimeout
source§impl TryFrom<VarInt> for MaxUdpPayloadSize
impl TryFrom<VarInt> for MaxUdpPayloadSize
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> PacketPayloadEncoder for Twhere
T: EncoderValue,
impl<T> PacketPayloadEncoder for Twhere
T: EncoderValue,
source§fn encoding_size_hint<E>(&mut self, encoder: &E, minimum_len: usize) -> usizewhere
E: Encoder,
fn encoding_size_hint<E>(&mut self, encoder: &E, minimum_len: usize) -> usizewhere
E: Encoder,
Returns an estimate of the encoding size of the payload. This
may be inaccurate from what actually is encoded. Estimates should
be less than or equal to what is actually written.
Implementations can return 0 to skip encoding.