Struct VarInt
pub struct VarInt(/* private fields */);Expand description
noq types that are used in the public iroh API.
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 const MAX_SIZE: usize = 8usize
Available on crate feature qlog only.
pub const MAX_SIZE: usize = 8usize
qlog only.The largest encoded value length
pub const fn from_u32(x: u32) -> VarInt
Available on crate feature qlog only.
pub const fn from_u32(x: u32) -> VarInt
qlog only.Construct a VarInt infallibly
pub fn from_u64(x: u64) -> Result<VarInt, VarIntBoundsExceeded>
Available on crate feature qlog only.
pub fn from_u64(x: u64) -> Result<VarInt, VarIntBoundsExceeded>
qlog only.Succeeds iff x < 2^62
pub const unsafe fn from_u64_unchecked(x: u64) -> VarInt
Available on crate feature qlog only.
pub const unsafe fn from_u64_unchecked(x: u64) -> VarInt
qlog only.pub const fn into_inner(self) -> u64
Available on crate feature qlog only.
pub const fn into_inner(self) -> u64
qlog only.Extract the integer value
pub fn saturating_add(self, rhs: impl Into<VarInt>) -> VarInt
Available on crate feature qlog only.
pub fn saturating_add(self, rhs: impl Into<VarInt>) -> VarInt
qlog only.Saturating integer addition. Computes self + rhs, saturating at the numeric bounds instead of overflowing.
Trait Implementations§
§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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
Compare self to
key and return true if they are equal.§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<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