paralegal_policy

Trait NodeExt

Source
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§

Source

fn has_type(self, t: TypeId, ctx: &RootContext) -> bool

Returns true if this node has the provided type

Source

fn associated_call_site(self, ctx: &RootContext) -> CallString

Find the call string for the statement or function that produced this node.

Source

fn types(self, ctx: &RootContext) -> &[TypeId]

Get the type(s) of a Node.

Source

fn describe(self, ctx: &RootContext) -> DisplayNode<'_>

Returns a DisplayNode for the given Node

Source

fn info(self, ctx: &RootContext) -> &NodeInfo

Retrieve metadata about a node.

Source

fn instruction(self, ctx: &RootContext) -> &InstructionInfo

Retrieve metadata about the instruction executed by a specific node.

Source

fn successors( self, ctx: &RootContext, ) -> Box<dyn Iterator<Item = GlobalNode> + '_>

Return the immediate successors of this node

Source

fn predecessors( self, ctx: &RootContext, ) -> Box<dyn Iterator<Item = GlobalNode> + '_>

Return the immediate predecessors of this node

Source

fn get_location(self, ctx: &RootContext) -> &Span

Get the span of a node

Source

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.

Source

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.

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

Source§

fn has_type(self, t: TypeId, ctx: &RootContext) -> bool

Source§

fn info(self, ctx: &RootContext) -> &NodeInfo

Source§

fn types(self, ctx: &RootContext) -> &[TypeId]

Source§

fn describe(self, ctx: &RootContext) -> DisplayNode<'_>

Source§

fn has_marker<C: HasDiagnosticsBase>(self, ctx: C, marker: Marker) -> bool

Source§

fn successors( self, ctx: &RootContext, ) -> Box<dyn Iterator<Item = GlobalNode> + '_>

Source§

fn instruction(self, ctx: &RootContext) -> &InstructionInfo

Source§

fn get_location(self, ctx: &RootContext) -> &Span

Source§

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]>>

👎Deprecated: This function is known to be buggy at the moment. Only use for debugging, don’t rely on it for policy correctness.
Source§

fn associated_call_site(self, ctx: &RootContext) -> CallString

Implementors§