Type Alias TopSubtreeBuilder

Source
pub type TopSubtreeBuilder = TopSubtreeBuilder<SpanData<SyntaxContext>>;

Aliased Type§

struct TopSubtreeBuilder { /* private fields */ }

Implementations

§

impl<S> TopSubtreeBuilder<S>
where S: Copy,

pub fn new(top_delimiter: Delimiter<S>) -> TopSubtreeBuilder<S>

pub fn open(&mut self, delimiter_kind: DelimiterKind, open_span: S)

pub fn close(&mut self, close_span: S)

pub fn remove_last_subtree_if_invisible(&mut self)

You cannot call this consecutively, it will only work once after close.

pub fn push(&mut self, leaf: Leaf<S>)

pub fn extend(&mut self, leaves: impl IntoIterator<Item = Leaf<S>>)

pub fn extend_tt_dangerous( &mut self, tt: impl IntoIterator<Item = TokenTree<S>>, )

This does not check the token trees are valid, beware!

pub fn extend_with_tt(&mut self, tt: TokenTreesView<'_, S>)

pub fn extend_with_tt_alone(&mut self, tt: TokenTreesView<'_, S>)

Like [Self::extend_with_tt()], but makes sure the new tokens will never be joint with whatever comes after them.

pub fn expected_delimiters(&self) -> impl Iterator<Item = &Delimiter<S>>

pub fn build_skip_top_subtree(self) -> TopSubtree<S>

Builds, and remove the top subtree if it has only one subtree child.

pub fn build(self) -> TopSubtree<S>

pub fn restore_point(&self) -> SubtreeBuilderRestorePoint

pub fn restore(&mut self, restore_point: SubtreeBuilderRestorePoint)

Trait Implementations

§

impl<S> Clone for TopSubtreeBuilder<S>
where S: Clone,

§

fn clone(&self) -> TopSubtreeBuilder<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 TopSubtreeBuilder<S>
where S: Debug,

§

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

Formats the value using the given formatter. Read more
§

impl<S> Hash for TopSubtreeBuilder<S>
where S: Hash,

§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
§

impl<S> PartialEq for TopSubtreeBuilder<S>
where S: PartialEq,

§

fn eq(&self, other: &TopSubtreeBuilder<S>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
§

impl<S> Eq for TopSubtreeBuilder<S>
where S: Eq,

§

impl<S> StructuralPartialEq for TopSubtreeBuilder<S>