RedNode

Struct RedNode 

Source
pub struct RedNode<'a, L: Language> {
    pub green: &'a GreenNode<'a, L>,
    pub offset: usize,
}
Expand description

A red node that wraps a green node with absolute offset information.

Fields§

§green: &'a GreenNode<'a, L>

The underlying green node that contains the structural information

§offset: usize

The absolute byte offset of this node in the source text

Implementations§

Source§

impl<'a, L: Language> RedNode<'a, L>

Source

pub fn new(green: &'a GreenNode<'a, L>, offset: usize) -> Self

Creates a new red node from a green node and offset.

Source

pub fn span(&self) -> Range<usize>

Returns the absolute byte span of this red node.

Source

pub fn child_at(&self, idx: usize) -> RedTree<'a, L>

Gets the child element at the specified index.

Source

pub fn children(&self) -> RedChildren<'a, L>

Returns an iterator over the child elements of this red node.

Source

pub fn child_index_at_offset(&self, offset: usize) -> Option<usize>

Finds the child element at the specified absolute byte offset.

Source

pub fn child_at_offset(&self, offset: usize) -> Option<RedTree<'a, L>>

Finds the child element at the specified absolute byte offset.

Trait Implementations§

Source§

impl<'a, L: Language> Clone for RedNode<'a, L>

Source§

fn clone(&self) -> Self

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

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

Performs copy-assignment from source. Read more
Source§

impl<'a, L: Language> Debug for RedNode<'a, L>

Source§

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

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

impl<'a, L: Language> PartialEq for RedNode<'a, L>

Source§

fn eq(&self, other: &Self) -> 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.
Source§

impl<'a, L: Language> Copy for RedNode<'a, L>

Source§

impl<'a, L: Language> Eq for RedNode<'a, L>

Auto Trait Implementations§

§

impl<'a, L> Freeze for RedNode<'a, L>

§

impl<'a, L> RefUnwindSafe for RedNode<'a, L>

§

impl<'a, L> Send for RedNode<'a, L>

§

impl<'a, L> Sync for RedNode<'a, L>

§

impl<'a, L> Unpin for RedNode<'a, L>

§

impl<'a, L> UnwindSafe for RedNode<'a, L>

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.