pub struct FieldCursor<'de> { /* private fields */ }Expand description
An independent, borrowed cursor over field tags and values.
At a field boundary, read a tag with next_tag, then
consume its value with the appropriate read method. Value reads require
the cursor to be at the start of a value. The caller determines each
field’s encoding; the cursor does not detect calls from mid-value.
Copies advance independently and never consume the original deserializer.
A read returns None when input is exhausted, malformed, or truncated;
stop scanning when that happens.
Implementations§
Source§impl<'de> FieldCursor<'de>
impl<'de> FieldCursor<'de>
Sourcepub fn next_tag(&mut self) -> Option<TagNum>
pub fn next_tag(&mut self) -> Option<TagNum>
Read the next tag, including any tag pushed back before this cursor
was created. Call only at a field boundary, after consuming the
preceding value. Returns None at EOF or for malformed tag syntax.
Sourcepub fn read_delimited(&mut self) -> Option<&'de [u8]>
pub fn read_delimited(&mut self) -> Option<&'de [u8]>
Read bytes up to SOH without validating their contents. Returns None
if the delimiter is absent; an empty delimited value is valid here.
Sourcepub fn read_length(&mut self) -> Option<Length>
pub fn read_length(&mut self) -> Option<Length>
Read a positive Length and its SOH delimiter. Returns None for
zero, overflow, malformed contents, or a missing delimiter.