Type Alias TokenTreesView

Source
pub type TokenTreesView<'a> = TokenTreesView<'a, SpanData<SyntaxContext>>;

Aliased Type§

struct TokenTreesView<'a>(/* private fields */);

Implementations

§

impl<'a, S> TokenTreesView<'a, S>
where S: Copy,

pub fn new(tts: &'a [TokenTree<S>]) -> TokenTreesView<'a, S>

pub fn iter(&self) -> TtIter<'a, S>

pub fn cursor(&self) -> Cursor<'a, S>

pub fn len(&self) -> usize

pub fn is_empty(&self) -> bool

pub fn try_into_subtree(self) -> Option<SubtreeView<'a, S>>

pub fn strip_invisible(self) -> TokenTreesView<'a, S>

pub fn flat_tokens(&self) -> &'a [TokenTree<S>]

This returns a flat structure of tokens (subtrees will be represented by a single node preceding their children), so it isn’t suited for most use cases, only for matching leaves at the beginning/end with no subtrees before them. If you need a structured pass, use [TtIter].

pub fn split( self, split_fn: impl FnMut(TtElement<'a, S>) -> bool, ) -> impl Iterator<Item = TokenTreesView<'a, S>>

Trait Implementations

§

impl<'a, S> Clone for TokenTreesView<'a, S>
where S: Clone,

§

fn clone(&self) -> TokenTreesView<'a, S>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
§

impl<S> Debug for TokenTreesView<'_, S>
where S: Debug + Copy,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<S> Display for TokenTreesView<'_, S>
where S: Copy,

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
Source§

impl ToTokenTree for TokenTreesView<'_, SpanData<SyntaxContext>>

Source§

fn to_tokens( self, _: SpanData<SyntaxContext>, builder: &mut TopSubtreeBuilder<SpanData<SyntaxContext>>, )

§

impl<'a, S> Copy for TokenTreesView<'a, S>
where S: Copy,