Trait NodeDisplay

pub trait NodeDisplay: Sized {
    // Required methods
    fn name() -> Option<&'static str>;
    fn start(&self) -> Option<TextSize>;
    fn end(&self) -> Option<TextSize>;
    fn source_id(&self) -> Option<FileId>;
    fn display(&self) -> NodeDisplayWrapper<'_, Self>;
    fn display_extra(&self, f: &mut Formatter<'_>) -> Result<(), Error>;
    fn display_children(
        &self,
        level: usize,
        f: &mut Formatter<'_>,
    ) -> Result<(), Error>;
}
Expand description

Trait for displaying a syntax node

Required Methods§

fn name() -> Option<&'static str>

Name of the syntax node’s type

fn start(&self) -> Option<TextSize>

Starting position of the node

fn end(&self) -> Option<TextSize>

Ending position of the node

fn source_id(&self) -> Option<FileId>

Source id of the node

fn display(&self) -> NodeDisplayWrapper<'_, Self>

Obtain a display wrapper for the current node

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

Display extra information for the node

§Parameters
  • f: formatter to output to

fn display_children( &self, level: usize, f: &mut Formatter<'_>, ) -> Result<(), Error>

Display the node’s children

§Parameters
  • level: current indentation level
  • f: formatter to output to

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

§

impl<T> NodeDisplay for Node<T>
where T: NodeContentDisplay + NodeContent,

§

impl<T> NodeDisplay for T
where T: NodeContentDisplay,