pub struct UInt<U: UPrim>(pub U);Expand description
An ergonomic wrapper to allow for encoding and decoding of primitive unsigned integers as varints rather than the default fixed-width integers.
Tuple Fields§
§0: UTrait Implementations§
Source§impl<U: UPrim> EncodeSize for UInt<U>
impl<U: UPrim> EncodeSize for UInt<U>
Source§fn encode_size(&self) -> usize
fn encode_size(&self) -> usize
Returns the encoded size of this value (in bytes).
Source§fn encode_inline_size(&self) -> usize
fn encode_inline_size(&self) -> usize
Returns the encoded size excluding bytes passed to
BufsMut::push
during Write::write_bufs. Used to size the working buffer for inline
writes. Override alongside Write::write_bufs for types where large
Bytes fields go via push; failing to do so will over-allocate.Source§impl<U: Ord + UPrim> Ord for UInt<U>
impl<U: Ord + UPrim> Ord for UInt<U>
Source§impl<U: PartialOrd + UPrim> PartialOrd for UInt<U>
impl<U: PartialOrd + UPrim> PartialOrd for UInt<U>
Source§impl<U: UPrim> Read for UInt<U>
impl<U: UPrim> Read for UInt<U>
Source§impl<U: UPrim> Write for UInt<U>
impl<U: UPrim> Write for UInt<U>
Source§fn write_bufs(&self, buf: &mut impl BufsMut)
fn write_bufs(&self, buf: &mut impl BufsMut)
Writes to a
BufsMut, allowing existing Bytes chunks to be
appended via BufsMut::push instead of written inline. Must encode
to the same format as Write::write. Defaults to Write::write.impl<U: Eq + UPrim> Eq for UInt<U>
impl<U: UPrim> StructuralPartialEq for UInt<U>
Auto Trait Implementations§
impl<U> Freeze for UInt<U>where
U: Freeze,
impl<U> RefUnwindSafe for UInt<U>where
U: RefUnwindSafe,
impl<U> Send for UInt<U>where
U: Send,
impl<U> Sync for UInt<U>where
U: Sync,
impl<U> Unpin for UInt<U>where
U: Unpin,
impl<U> UnsafeUnpin for UInt<U>where
U: UnsafeUnpin,
impl<U> UnwindSafe for UInt<U>where
U: UnwindSafe,
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