pub struct VarintResult {
pub next_pos: usize,
pub varint_gar: Option<Vec<u8>>,
pub varint: Option<u64>,
pub varint_ohb: Option<u64>,
}Expand description
Result of parsing one protobuf varint from a byte slice.
Mirrors the Python Varint class in lib/varint.py.
Exactly one of varint or varint_gar is Some:
varint_garisSomewhen the varint is truncated (buffer ends before the terminator byte) or exceeds 64 bits.varintisSomefor a successfully decoded varint.varint_ohbcounts trailing non-canonical (overhung) bytes: set when the terminating byte is0x00preceded by one or more0x80bytes.
Fields§
§next_pos: usizeByte position immediately after the parsed varint.
varint_gar: Option<Vec<u8>>Some(raw_bytes) when the varint is garbage (truncated / too large).
varint: Option<u64>The decoded varint value (valid only when varint_gar is None).
varint_ohb: Option<u64>Number of non-canonical overhang bytes (valid only when varint_gar is None).
Trait Implementations§
Auto Trait Implementations§
impl Freeze for VarintResult
impl RefUnwindSafe for VarintResult
impl Send for VarintResult
impl Sync for VarintResult
impl Unpin for VarintResult
impl UnsafeUnpin for VarintResult
impl UnwindSafe for VarintResult
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