pub struct Node {
pub kind: NodeKind,
pub span: Span,
}Fields§
§kind: NodeKind§span: SpanImplementations§
Source§impl Node
impl Node
Sourcepub const fn new(kind: NodeKind, span: Span) -> Self
pub const fn new(kind: NodeKind, span: Span) -> Self
Creates a new node with the given kind and span.
Sourcepub const fn empty(kind: NodeKind) -> Self
pub const fn empty(kind: NodeKind) -> Self
Creates a node with an empty span (for synthetic or temporary nodes).
Sourcepub fn source_text<'a>(&self, source: &'a str) -> &'a str
pub fn source_text<'a>(&self, source: &'a str) -> &'a str
Extracts the source text for this node from the original source string.
Spans use character indices (matching Token.pos semantics).
Returns an empty string for synthetic nodes or invalid spans.
Trait Implementations§
impl StructuralPartialEq for Node
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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