Struct Stateful
struct Stateful<I, S> { ... }
Thread global state through your parsers
Use cases
- Recursion checks
- Error recovery
- Debugging
Example
# use Cell;
# use *;
# use Stateful;
# use alpha1;
# type Error = ;
;
type Stream<'is> = ;
let data = "Hello";
let mut state = 0;
let input = Stream ;
let output = word.parse.unwrap;
assert_eq!;
Fields
input: IInner input being wrapped in state
state: SUser-provided state
Implementations
impl<I, S> AsBStr for Stateful<I, S>
fn as_bstr(self: &Self) -> &[u8]
impl<I, S> AsBytes for Stateful<I, S>
fn as_bytes(self: &Self) -> &[u8]
impl<I, S> AsRef for Stateful<I, S>
fn as_ref(self: &Self) -> &I
impl<I, S> Deref for Stateful<I, S>
fn deref(self: &Self) -> &<Self as >::Target
impl<I, S> Freeze for Stateful<I, S>
impl<I, S> Location for Stateful<I, S>
fn previous_token_end(self: &Self) -> usizefn current_token_start(self: &Self) -> usize
impl<I, S> Offset for Stateful<I, S>
fn offset_from(self: &Self, other: &<Stateful<I, S> as Stream>::Checkpoint) -> usize
impl<I, S> Offset for Stateful<I, S>
fn offset_from(self: &Self, start: &Self) -> usize
impl<I, S> RefUnwindSafe for Stateful<I, S>
impl<I, S> Send for Stateful<I, S>
impl<I, S> SliceLen for Stateful<I, S>
fn slice_len(self: &Self) -> usize
impl<I, S> StreamIsPartial for Stateful<I, S>
fn complete(self: &mut Self) -> <Self as >::PartialStatefn restore_partial(self: &mut Self, state: <Self as >::PartialState)fn is_partial_supported() -> boolfn is_partial(self: &Self) -> bool
impl<I, S> StructuralPartialEq for Stateful<I, S>
impl<I, S> Sync for Stateful<I, S>
impl<I, S> Unpin for Stateful<I, S>
impl<I, S> UnsafeUnpin for Stateful<I, S>
impl<I, S> UnwindSafe for Stateful<I, S>
impl<I, S> UpdateSlice for Stateful<I, S>
fn update_slice(self: Self, inner: <Self as >::Slice) -> Self
impl<I, S, T> FindSlice for Stateful<I, S>
fn find_slice(self: &Self, substr: T) -> Option<Range<usize>>
impl<I, S, U> Compare for Stateful<I, S>
fn compare(self: &Self, other: U) -> CompareResult
impl<I: $crate::clone::Clone, S: $crate::clone::Clone> Clone for Stateful<I, S>
fn clone(self: &Self) -> Stateful<I, S>
impl<I: $crate::cmp::Eq, S: $crate::cmp::Eq> Eq for Stateful<I, S>
impl<I: $crate::cmp::PartialEq, S: $crate::cmp::PartialEq> PartialEq for Stateful<I, S>
fn eq(self: &Self, other: &Stateful<I, S>) -> bool
impl<I: $crate::default::Default, S: $crate::default::Default> Default for Stateful<I, S>
fn default() -> Stateful<I, S>
impl<I: $crate::fmt::Debug, S: $crate::fmt::Debug> Debug for Stateful<I, S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<I: $crate::marker::Copy, S: $crate::marker::Copy> Copy for Stateful<I, S>
impl<I: Stream, S: crate::lib::std::fmt::Debug> Stream for Stateful<I, S>
fn iter_offsets(self: &Self) -> <Self as >::IterOffsetsfn eof_offset(self: &Self) -> usizefn next_token(self: &mut Self) -> Option<<Self as >::Token>fn peek_token(self: &Self) -> Option<<Self as >::Token>fn offset_for<P>(self: &Self, predicate: P) -> Option<usize> where P: Fn(<Self as >::Token) -> boolfn offset_at(self: &Self, tokens: usize) -> Result<usize, Needed>fn next_slice(self: &mut Self, offset: usize) -> <Self as >::Sliceunsafe fn next_slice_unchecked(self: &mut Self, offset: usize) -> <Self as >::Slicefn peek_slice(self: &Self, offset: usize) -> <Self as >::Sliceunsafe fn peek_slice_unchecked(self: &Self, offset: usize) -> <Self as >::Slicefn checkpoint(self: &Self) -> <Self as >::Checkpointfn reset(self: &mut Self, checkpoint: &<Self as >::Checkpoint)fn raw(self: &Self) -> &dyn Debugfn trace(self: &Self, f: &mut Formatter<'_>) -> Result
impl<I: crate::lib::std::fmt::Display, S> Display for Stateful<I, S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<P, T> Receiver for Stateful<I, S>
impl<T> Any for Stateful<I, S>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Stateful<I, S>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Stateful<I, S>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Stateful<I, S>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Stateful<I, S>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into for Stateful<I, S>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Stateful<I, S>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Stateful<I, S>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>