pub struct Node<T: NodeContent> {
pub content: T,
pub span: Option<NodeSpan>,
}Expand description
A syntax node with span information
Fields
content: TContents of this syntax node
span: Option<NodeSpan>Span in the input this node was parsed from
Implementations
sourceimpl<T: NodeContent> Node<T>
impl<T: NodeContent> Node<T>
sourcepub fn new(content: T, span: Option<NodeSpan>) -> Self
pub fn new(content: T, span: Option<NodeSpan>) -> Self
Create a new syntax node with span information
sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Return the wrapped syntax node, discarding the span information
sourcepub fn map<U: NodeContent>(self, f: impl FnOnce(T) -> U) -> Node<U>
pub fn map<U: NodeContent>(self, f: impl FnOnce(T) -> U) -> Node<U>
Map this content of this node into a new node
sourcepub fn map_spanned<U: NodeContent>(self, f: impl FnOnce(Self) -> U) -> Node<U>
pub fn map_spanned<U: NodeContent>(self, f: impl FnOnce(Self) -> U) -> Node<U>
Map this content of this node into a new node with the same span
Trait Implementations
sourceimpl<U, T: NodeContent + AsRef<U>> AsRef<U> for Node<T>
impl<U, T: NodeContent + AsRef<U>> AsRef<U> for Node<T>
sourceimpl<T: Clone + NodeContent> Clone for Node<T>
impl<T: Clone + NodeContent> Clone for Node<T>
sourceimpl<T: Debug + NodeContent> Debug for Node<T>
impl<T: Debug + NodeContent> Debug for Node<T>
sourceimpl<T: NodeContent> Deref for Node<T>
impl<T: NodeContent> Deref for Node<T>
sourceimpl<T: NodeContent> DerefMut for Node<T>
impl<T: NodeContent> DerefMut for Node<T>
sourceimpl<T: NodeContent + Display> Display for Node<T>
impl<T: NodeContent + Display> Display for Node<T>
sourceimpl<T: NodeContent> From<T> for Node<T>
impl<T: NodeContent> From<T> for Node<T>
sourceimpl<T: NodeContent + Hash> Hash for Node<T>
impl<T: NodeContent + Hash> Hash for Node<T>
sourceimpl<T: NodeContentDisplay + NodeContent> NodeDisplay for Node<T>
impl<T: NodeContentDisplay + NodeContent> NodeDisplay for Node<T>
sourcefn display(&self) -> NodeDisplayWrapper<'_, Self>
fn display(&self) -> NodeDisplayWrapper<'_, Self>
Obtain a display wrapper for the current node
sourcefn display_extra(&self, f: &mut Formatter<'_>) -> Result
fn display_extra(&self, f: &mut Formatter<'_>) -> Result
Display extra information for the node Read more
sourceimpl<T: NodeContent + Ord> Ord for Node<T>
impl<T: NodeContent + Ord> Ord for Node<T>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<T: NodeContent + PartialEq> PartialEq<Node<T>> for Node<T>
impl<T: NodeContent + PartialEq> PartialEq<Node<T>> for Node<T>
sourceimpl<T: NodeContent + PartialOrd> PartialOrd<Node<T>> for Node<T>
impl<T: NodeContent + PartialOrd> PartialOrd<Node<T>> for Node<T>
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
This method returns an ordering between self and other values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self and other) and is used by the <=
operator. Read more
impl<T: NodeContent + Copy> Copy for Node<T>
impl<T: NodeContent + Eq> Eq for Node<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for Node<T>where
T: RefUnwindSafe,
impl<T> Send for Node<T>where
T: Send,
impl<T> Sync for Node<T>where
T: Sync,
impl<T> Unpin for Node<T>where
T: Unpin,
impl<T> UnwindSafe for Node<T>where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more