pub trait NodeExt: Sealed {
// Required methods
fn has_type(self, t: TypeId, ctx: &RootContext) -> bool;
fn associated_call_site(self, ctx: &RootContext) -> CallString;
fn types(self, ctx: &RootContext) -> &[TypeId];
fn describe(self, ctx: &RootContext) -> DisplayNode<'_>;
fn info(self, ctx: &RootContext) -> &NodeInfo;
fn instruction(self, ctx: &RootContext) -> &InstructionInfo;
fn successors(
self,
ctx: &RootContext,
) -> Box<dyn Iterator<Item = GlobalNode> + '_>;
fn predecessors(
self,
ctx: &RootContext,
) -> Box<dyn Iterator<Item = GlobalNode> + '_>;
fn get_location(self, ctx: &RootContext) -> &Span;
fn has_marker<C: HasDiagnosticsBase>(self, ctx: C, marker: Marker) -> bool;
fn shortest_path(
self,
to: GlobalNode,
ctx: &RootContext,
edge_selection: EdgeSelection,
) -> Option<Box<[GlobalNode]>>;
}
Expand description
Extension trait with queries for single nodes
Required Methods§
Sourcefn has_type(self, t: TypeId, ctx: &RootContext) -> bool
fn has_type(self, t: TypeId, ctx: &RootContext) -> bool
Returns true if this node has the provided type
Sourcefn associated_call_site(self, ctx: &RootContext) -> CallString
fn associated_call_site(self, ctx: &RootContext) -> CallString
Find the call string for the statement or function that produced this node.
Sourcefn types(self, ctx: &RootContext) -> &[TypeId]
fn types(self, ctx: &RootContext) -> &[TypeId]
Get the type(s) of a Node.
Sourcefn describe(self, ctx: &RootContext) -> DisplayNode<'_>
fn describe(self, ctx: &RootContext) -> DisplayNode<'_>
Returns a DisplayNode for the given Node
Sourcefn info(self, ctx: &RootContext) -> &NodeInfo
fn info(self, ctx: &RootContext) -> &NodeInfo
Retrieve metadata about a node.
Sourcefn instruction(self, ctx: &RootContext) -> &InstructionInfo
fn instruction(self, ctx: &RootContext) -> &InstructionInfo
Retrieve metadata about the instruction executed by a specific node.
Sourcefn successors(
self,
ctx: &RootContext,
) -> Box<dyn Iterator<Item = GlobalNode> + '_>
fn successors( self, ctx: &RootContext, ) -> Box<dyn Iterator<Item = GlobalNode> + '_>
Return the immediate successors of this node
Sourcefn predecessors(
self,
ctx: &RootContext,
) -> Box<dyn Iterator<Item = GlobalNode> + '_>
fn predecessors( self, ctx: &RootContext, ) -> Box<dyn Iterator<Item = GlobalNode> + '_>
Return the immediate predecessors of this node
Sourcefn get_location(self, ctx: &RootContext) -> &Span
fn get_location(self, ctx: &RootContext) -> &Span
Get the span of a node
Sourcefn has_marker<C: HasDiagnosticsBase>(self, ctx: C, marker: Marker) -> bool
fn has_marker<C: HasDiagnosticsBase>(self, ctx: C, marker: Marker) -> bool
Returns whether this Node has the marker applied to it directly or via its type.
Sourcefn shortest_path(
self,
to: GlobalNode,
ctx: &RootContext,
edge_selection: EdgeSelection,
) -> Option<Box<[GlobalNode]>>
👎Deprecated: This function is known to be buggy at the moment. Only use for debugging, don’t rely on it for policy correctness.
fn shortest_path( self, to: GlobalNode, ctx: &RootContext, edge_selection: EdgeSelection, ) -> Option<Box<[GlobalNode]>>
The shortest path between this and a target node
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.
Implementations on Foreign Types§
Source§impl<T: NodeExt + Copy> NodeExt for &T
impl<T: NodeExt + Copy> NodeExt for &T
fn has_type(self, t: TypeId, ctx: &RootContext) -> bool
fn info(self, ctx: &RootContext) -> &NodeInfo
fn types(self, ctx: &RootContext) -> &[TypeId]
fn describe(self, ctx: &RootContext) -> DisplayNode<'_>
fn has_marker<C: HasDiagnosticsBase>(self, ctx: C, marker: Marker) -> bool
fn successors( self, ctx: &RootContext, ) -> Box<dyn Iterator<Item = GlobalNode> + '_>
fn instruction(self, ctx: &RootContext) -> &InstructionInfo
fn get_location(self, ctx: &RootContext) -> &Span
fn predecessors( self, ctx: &RootContext, ) -> Box<dyn Iterator<Item = GlobalNode> + '_>
Source§fn shortest_path(
self,
to: GlobalNode,
ctx: &RootContext,
edge_selection: EdgeSelection,
) -> Option<Box<[GlobalNode]>>
fn shortest_path( self, to: GlobalNode, ctx: &RootContext, edge_selection: EdgeSelection, ) -> Option<Box<[GlobalNode]>>
👎Deprecated: This function is known to be buggy at the moment. Only use for debugging, don’t rely on it for policy correctness.