pub struct ReachabilityAnalyzer;Implementations§
Source§impl ReachabilityAnalyzer
impl ReachabilityAnalyzer
pub fn new() -> Self
Sourcepub fn analyze_entry_points<S, FNodeOfInterest, FProcessNode>(
&self,
graph: &CallGraph,
is_node_of_interest: &FNodeOfInterest,
process_node_of_interest: &FProcessNode,
initial_state_factory: impl Fn() -> S,
) -> HashMap<NodeId, S>
pub fn analyze_entry_points<S, FNodeOfInterest, FProcessNode>( &self, graph: &CallGraph, is_node_of_interest: &FNodeOfInterest, process_node_of_interest: &FProcessNode, initial_state_factory: impl Fn() -> S, ) -> HashMap<NodeId, S>
Performs reachability analysis starting from public/external functions.
Traverses the call graph via Call edges. For each function node visited
during this traversal, if is_node_of_interest returns true for that function node,
process_node_of_interest is called.
The process_node_of_interest function is responsible for inspecting the
current function node (e.g., its direct edges like StorageRead/StorageWrite)
and updating the state S.
§Type Parameters
S: The type of the state to be accumulated for each entry point.FNodeOfInterest: A predicateFn(&Node) -> boolthat determines if a visited function/modifier/constructor node in the call graph is of interest.FProcessNode: An actionFn(&Node, &mut S, &CallGraph)called when a node of interest is visited. It receives the node of interest, the mutable state for the current entry point, and a reference to the full graph for context (e.g., to inspect edges).
§Arguments
graph: TheCallGraphto analyze.is_node_of_interest: Predicate to identify interesting function/modifier/constructor nodes.process_node_of_interest: Action to perform on interesting nodes.initial_state_factory: A function that creates an initial stateSfor each entry point.
§Returns
A HashMap mapping the NodeId of each public/external entry point to the
accumulated state S for that entry point.
pub fn dfs_traverse<S, FNodeOfInterest, FProcessNode>( &self, current_node_id: NodeId, graph: &CallGraph, is_node_of_interest: &FNodeOfInterest, process_node_of_interest: &FProcessNode, state: &mut S, visited_functions_for_this_entry_point: &mut HashSet<NodeId>, )
Auto Trait Implementations§
impl Freeze for ReachabilityAnalyzer
impl RefUnwindSafe for ReachabilityAnalyzer
impl Send for ReachabilityAnalyzer
impl Sync for ReachabilityAnalyzer
impl Unpin for ReachabilityAnalyzer
impl UnwindSafe for ReachabilityAnalyzer
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