Struct StepCursor
pub struct StepCursor<'c, 'a> { /* private fields */ }
Cursor state associated with speculative parsing.
This type is the input of the closure provided to ParseStream::step.
Example
use TokenTree;
use Result;
use ParseStream;
// This function advances the stream past the next occurrence of `@`. If
// no `@` is present in the stream, the stream position is unchanged and
// an error is returned.
#
#
#
# use Parser;
# let remainder = remainder_after_skipping_past_next_at
# .parse_str
# .unwrap;
# assert_eq!;
Implementations
impl<'c, 'a> StepCursor<'c, 'a>
fn error<T: Display>(self, message: T) -> ErrorTriggers an error at the current position of the parse stream.
The
ParseStream::stepinvocation will return this same error without advancing the stream state.
Trait Implementations
impl<'c, 'a> Clone for StepCursor<'c, 'a>
fn clone(&self) -> Self
impl<'c, 'a> Copy for StepCursor<'c, 'a>
impl<'c, 'a> Deref for StepCursor<'c, 'a>
type Target = Cursor<'c>;fn deref(&self) -> &Self::Target
Auto Trait Implementations
impl<'c, 'a> !Send for StepCursor<'c, 'a>
impl<'c, 'a> !Sync for StepCursor<'c, 'a>
impl<'c, 'a> Freeze for StepCursor<'c, 'a>
impl<'c, 'a> RefUnwindSafe for StepCursor<'c, 'a>
impl<'c, 'a> Unpin for StepCursor<'c, 'a>
impl<'c, 'a> UnsafeUnpin for StepCursor<'c, 'a>
impl<'c, 'a> UnwindSafe for StepCursor<'c, 'a>
Blanket Implementations
impl<P, T> Receiver for StepCursor<'c, 'a>
where
P: Deref<Target = T> + ?Sized,
T: ?Sized,
type Target = T;
impl<T> Any for StepCursor<'c, 'a>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for StepCursor<'c, 'a>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for StepCursor<'c, 'a>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for StepCursor<'c, 'a>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for StepCursor<'c, 'a>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for StepCursor<'c, 'a>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for StepCursor<'c, 'a>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for StepCursor<'c, 'a>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for StepCursor<'c, 'a>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>