pub(super) struct Position {
input_len: Length,
position: Length,
depth: usize,
}Expand description
State tracker for the current position in the input.
Fields§
§input_len: LengthInput length (in bytes after Base64 decoding).
position: LengthPosition in the input buffer (in bytes after Base64 decoding).
depth: usizeNumber of nested productions encountered (i.e. depth in the call stack).
Implementations§
Source§impl Position
impl Position
Sourceconst MAX_DEPTH: usize = 64
const MAX_DEPTH: usize = 64
Maximum number of nested messages we tolerate (prevents stack exhaustion).
Sourcepub(super) fn new(input_len: Length) -> Self
pub(super) fn new(input_len: Length) -> Self
Create a new position tracker with the given overall length.
Sourcepub(super) fn advance(&mut self, amount: Length) -> Result<Length>
pub(super) fn advance(&mut self, amount: Length) -> Result<Length>
Advance the current position by the given amount.
Returns the new current position.
Sourcepub(super) fn remaining_len(&self) -> Length
pub(super) fn remaining_len(&self) -> Length
Get the remaining length.
Sourcepub(super) fn split_nested(&mut self, len: Length) -> Result<Resumption>
pub(super) fn split_nested(&mut self, len: Length) -> Result<Resumption>
Split a nested position tracker of the given size.
§Returns
A Resumption value which can be used to continue parsing the outer message.
Sourcepub(super) fn resume_nested(&mut self, resumption: Resumption)
pub(super) fn resume_nested(&mut self, resumption: Resumption)
Resume processing the rest of a message after processing a nested inner portion.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Position
impl RefUnwindSafe for Position
impl Send for Position
impl Sync for Position
impl Unpin for Position
impl UnsafeUnpin for Position
impl UnwindSafe for Position
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