pub struct TupData<D, M> { /* private fields */ }Available on crate features
unstable-features only.Expand description
Utility for saving intermediate values.
Complex parsing tools usually use several other tools to perform to perform simple
subtasks. However, dealing with many of these tools makes harder to keep consistent both
returned data and the total length of the match, which we remember should be consistent
with the number of bytes skipped by the View object.
This object keeps an instance of intermediate returned data, actual number of bytes skipped
and the last instance of View, keeping them consistent.
Implementations§
Source§impl<D, M> TupData<D, M>
impl<D, M> TupData<D, M>
Source§impl<'a, D> TupData<D, View<'a>>
impl<'a, D> TupData<D, View<'a>>
Sourcepub fn chain_replace<T>(
self,
t: &T,
) -> Result<TupData<T::Data, View<'a>>, T::Error>where
T: Tool<'a>,
pub fn chain_replace<T>(
self,
t: &T,
) -> Result<TupData<T::Data, View<'a>>, T::Error>where
T: Tool<'a>,
Match a Tool and replace stored data with returned data.
Sourcepub fn chain_nodata<T>(self, t: &T) -> Result<Self, T::Error>where
T: Tool<'a>,
pub fn chain_nodata<T>(self, t: &T) -> Result<Self, T::Error>where
T: Tool<'a>,
Match a Tool but discards returned data.
Sourcepub fn chain_save<T>(
self,
t: &T,
) -> Result<TupData<(D, T::Data), View<'a>>, T::Error>where
T: Tool<'a>,
pub fn chain_save<T>(
self,
t: &T,
) -> Result<TupData<(D, T::Data), View<'a>>, T::Error>where
T: Tool<'a>,
Match a Tool and keeps both saved and returned data.
Trait Implementations§
impl<D: Copy, M: Copy> Copy for TupData<D, M>
impl<D: Eq, M: Eq> Eq for TupData<D, M>
impl<D, M> StructuralPartialEq for TupData<D, M>
Auto Trait Implementations§
impl<D, M> Freeze for TupData<D, M>
impl<D, M> RefUnwindSafe for TupData<D, M>where
D: RefUnwindSafe,
M: RefUnwindSafe,
impl<D, M> Send for TupData<D, M>
impl<D, M> Sync for TupData<D, M>
impl<D, M> Unpin for TupData<D, M>
impl<D, M> UnsafeUnpin for TupData<D, M>where
D: UnsafeUnpin,
M: UnsafeUnpin,
impl<D, M> UnwindSafe for TupData<D, M>where
D: UnwindSafe,
M: 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