Struct tree_sitter_graph::graph::Graph
source · pub struct Graph<'tree> { /* private fields */ }
Expand description
A graph produced by executing a graph DSL file. Graphs include a lifetime parameter to ensure that they don’t outlive the tree-sitter syntax tree that they are generated from.
Implementations§
source§impl<'tree> Graph<'tree>
impl<'tree> Graph<'tree>
sourcepub fn add_syntax_node(&mut self, node: Node<'tree>) -> SyntaxNodeRef
pub fn add_syntax_node(&mut self, node: Node<'tree>) -> SyntaxNodeRef
Adds a syntax node to the graph, returning a graph DSL reference to it.
The graph won’t contain every syntax node in the parsed syntax tree; it will only contain those nodes that are referenced at some point during the execution of the graph DSL file.
sourcepub fn add_graph_node(&mut self) -> GraphNodeRef
pub fn add_graph_node(&mut self) -> GraphNodeRef
Adds a new graph node to the graph, returning a graph DSL reference to it.
sourcepub fn pretty_print<'a>(&'a self) -> impl Display + 'a
pub fn pretty_print<'a>(&'a self) -> impl Display + 'a
Pretty-prints the contents of this graph.
pub fn display_json(&self, path: Option<&Path>) -> Result<()>
pub fn iter_nodes(&self) -> impl Iterator<Item = GraphNodeRef>
pub fn node_count(&self) -> usize
Trait Implementations§
source§impl Index<GraphNodeRef> for Graph<'_>
impl Index<GraphNodeRef> for Graph<'_>
source§impl<'tree> Index<SyntaxNodeRef> for Graph<'tree>
impl<'tree> Index<SyntaxNodeRef> for Graph<'tree>
source§impl<'tree> IndexMut<GraphNodeRef> for Graph<'_>
impl<'tree> IndexMut<GraphNodeRef> for Graph<'_>
Auto Trait Implementations§
impl<'tree> RefUnwindSafe for Graph<'tree>
impl<'tree> !Send for Graph<'tree>
impl<'tree> !Sync for Graph<'tree>
impl<'tree> Unpin for Graph<'tree>
impl<'tree> UnwindSafe for Graph<'tree>
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