pub struct GreenNode<'a, L: Language> {
pub kind: L::ElementType,
pub text_len: u32,
pub children: &'a [GreenTree<'a, L>],
}Expand description
A green node that contains child elements.
Green nodes are allocated in a SyntaxArena and hold a slice reference
to their children. They are POD (Plain Old Data) and strictly immutable.
Fields§
§kind: L::ElementTypeThe element type (kind) of this node.
text_len: u32The total text length of this node (sum of children’s lengths).
children: &'a [GreenTree<'a, L>]The children of this node.
Implementations§
Source§impl<'a, L: Language> GreenNode<'a, L>
impl<'a, L: Language> GreenNode<'a, L>
Sourcepub fn new(kind: L::ElementType, children: &'a [GreenTree<'a, L>]) -> Self
pub fn new(kind: L::ElementType, children: &'a [GreenTree<'a, L>]) -> Self
Creates a new green node from child elements.
This function assumes the children slice is already allocated in the arena.
Sourcepub fn kind(&self) -> L::ElementType
pub fn kind(&self) -> L::ElementType
Returns the kind of this node.
Trait Implementations§
impl<'a, L: Language> Eq for GreenNode<'a, L>
Auto Trait Implementations§
impl<'a, L> Freeze for GreenNode<'a, L>
impl<'a, L> RefUnwindSafe for GreenNode<'a, L>
impl<'a, L> Send for GreenNode<'a, L>
impl<'a, L> Sync for GreenNode<'a, L>
impl<'a, L> Unpin for GreenNode<'a, L>
impl<'a, L> UnwindSafe for GreenNode<'a, L>where
<L as Language>::ElementType: UnwindSafe + RefUnwindSafe,
<L as Language>::TokenType: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more