Struct SyntaxTreeBuf

Source
pub struct SyntaxTreeBuf<C> { /* private fields */ }
Expand description

SyntaxTreeBuf owns the syntax tree allocation. To construct a tree, see SyntaxBuilder. To access its contents, see SyntaxTree’s methods.

Implementations§

Source§

impl<C> SyntaxTreeBuf<C>

Source

pub fn as_tree(&self) -> &SyntaxTree<C>

Returns a reference to the contained syntax tree data.

Methods from Deref<Target = SyntaxTree<C>>§

Source

pub fn root(&self) -> SyntaxNode<C>

Returns the root node of this tree.

Source

pub fn events(&self) -> impl Iterator<Item = Event<C>> + '_

Returns an iterator over the events stored in this tree.

The difference between this method and SyntaxTree::raw_events is that this method returns SyntaxNodes and SyntaxTokens, while SyntaxTree::raw_events returns the data actually stored in the tree.

Source

pub fn raw_events(&self) -> impl Iterator<Item = RawEvent<C>> + '_

Returns an iterator over the raw events stored in this tree.

As compared to SyntaxTree::events, this method emits the data actually stored in the tree, as opposed to handles to that data (SyntaxNodes and SyntaxTokens).

This method does not compute any more information than what is stored in the tree. The only difference between the RawEvents returned by this method and what is stored inside the tree is that the events returned by this method are fixed-length and typed, while the tree’s internal storage is variable-length and untyped.

Trait Implementations§

Source§

impl<C: TreeConfig> Debug for SyntaxTreeBuf<C>

Source§

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

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

impl<C> Deref for SyntaxTreeBuf<C>

Source§

type Target = SyntaxTree<C>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.

Auto Trait Implementations§

§

impl<C> Freeze for SyntaxTreeBuf<C>

§

impl<C> RefUnwindSafe for SyntaxTreeBuf<C>
where C: RefUnwindSafe,

§

impl<C> Send for SyntaxTreeBuf<C>
where C: Send,

§

impl<C> Sync for SyntaxTreeBuf<C>
where C: Sync,

§

impl<C> Unpin for SyntaxTreeBuf<C>

§

impl<C> UnwindSafe for SyntaxTreeBuf<C>
where C: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.