Struct unrest_tmp_synom::cursor::Cursor
[−]
[src]
pub struct Cursor<'a> { /* fields omitted */ }
A cursor into an input TokenStream
's data. This cursor holds a reference
into the immutable data which is used internally to represent a
TokenStream
, and can be efficiently manipulated and copied around.
An empty Cursor
can be created directly, or one may create a SynomBuffer
object and get a cursor to its first token with begin()
.
Two cursors are equal if they have the same location in the same input stream, and have the same scope.
Methods
impl<'a> Cursor<'a>
[src]
fn empty() -> Self
Create a cursor referencing a static empty TokenStream.
fn eof(self) -> bool
Check if the cursor is currently pointing at the end of its valid scope.
fn seq(self, seq_delim: Delimiter) -> Option<SeqInfo<'a>>
If the cursor is pointing at a Seq with the given Delimiter
, return a
cursor into that sequence, and one pointing to the next TokenTree
.
fn word(self) -> Option<(Cursor<'a>, Span, Term)>
If the cursor is pointing at a Term, return it and a cursor pointing at
the next TokenTree
.
fn op(self) -> Option<(Cursor<'a>, Span, char, Spacing)>
If the cursor is pointing at an Op, return it and a cursor pointing
at the next TokenTree
.
fn literal(self) -> Option<(Cursor<'a>, Span, Literal)>
If the cursor is pointing at a Literal, return it and a cursor pointing
at the next TokenTree
.
fn token_stream(self) -> TokenStream
Copy all remaining tokens visible from this cursor into a TokenStream
.
fn token_tree(self) -> Option<(Cursor<'a>, TokenTree)>
If the cursor is looking at a TokenTree
, returns it along with a
cursor pointing to the next token in the sequence, otherwise returns
None
.
This method does not treat None
-delimited sequences as invisible, and
will return a Group(None, ..)
if the cursor is looking at one.
Trait Implementations
impl<'a> Copy for Cursor<'a>
[src]
impl<'a> Clone for Cursor<'a>
[src]
fn clone(&self) -> Cursor<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl<'a> Eq for Cursor<'a>
[src]
impl<'a> PartialEq for Cursor<'a>
[src]
fn eq(&self, __arg_0: &Cursor<'a>) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Cursor<'a>) -> bool
This method tests for !=
.