pub struct Node<T: NodeContent> {
pub content: T,
pub span: Option<NodeSpan>,
}
Expand description
A syntax node with span information
Fields§
§content: T
Contents of this syntax node
span: Option<NodeSpan>
Span in the input this node was parsed from
Implementations§
source§impl<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§
source§impl<T: NodeContent> Deref for Node<T>
impl<T: NodeContent> Deref for Node<T>
source§impl<T: NodeContent> DerefMut for Node<T>
impl<T: NodeContent> DerefMut for Node<T>
source§impl<'de, T> Deserialize<'de> for Node<T>where
T: Deserialize<'de> + NodeContent,
impl<'de, T> Deserialize<'de> for Node<T>where
T: Deserialize<'de> + NodeContent,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl<T: NodeContent> From<T> for Node<T>
impl<T: NodeContent> From<T> for Node<T>
source§impl<T: NodeContentDisplay + NodeContent> NodeDisplay for Node<T>
impl<T: NodeContentDisplay + NodeContent> NodeDisplay for Node<T>
source§fn display(&self) -> NodeDisplayWrapper<'_, Self>
fn display(&self) -> NodeDisplayWrapper<'_, Self>
Obtain a display wrapper for the current node
source§impl<T: NodeContent + Ord> Ord for Node<T>
impl<T: NodeContent + Ord> Ord for Node<T>
source§impl<T: NodeContent + PartialOrd> PartialOrd for Node<T>
impl<T: NodeContent + PartialOrd> PartialOrd for Node<T>
impl<T: NodeContent + Copy> Copy for Node<T>
impl<T: NodeContent + Eq> Eq for Node<T>
Auto Trait Implementations§
impl<T> Freeze for Node<T>where
T: Freeze,
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§
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)