AnalysisStateSubscriptionBehavior

Trait AnalysisStateSubscriptionBehavior 

Source
pub trait AnalysisStateSubscriptionBehavior: AnalysisState {
    // Provided methods
    fn on_require_analysis(
        &self,
        info: &mut AnalysisStateInfo,
        current_analysis: NonNull<dyn DataFlowAnalysis>,
        dependent: ProgramPoint,
    ) { ... }
    fn on_subscribe(
        &self,
        subscriber: NonNull<dyn DataFlowAnalysis>,
        info: &AnalysisStateInfo,
    ) { ... }
    fn on_update(
        &self,
        info: &mut AnalysisStateInfo,
        worklist: &mut AnalysisQueue,
    ) { ... }
}

Provided Methods§

Source

fn on_require_analysis( &self, info: &mut AnalysisStateInfo, current_analysis: NonNull<dyn DataFlowAnalysis>, dependent: ProgramPoint, )

Called when an AnalysisState is being queried by an analysis via [DataFlowSolver::require]

This invokes state-specific logic for how to subscribe the dependent analysis to changes of that state. By default, one of two options behaviors is applied:

  • For program point anchors, the analysis is re-run at dependent on state changes
  • For value anchors, the analysis is re-run at dependent and at all uses of the value

NOTE: Subscriptions are established when an analysis is queried, if you wish to execute custom behavior when updates are being propagated, see on_update.

Source

fn on_subscribe( &self, subscriber: NonNull<dyn DataFlowAnalysis>, info: &AnalysisStateInfo, )

Called when an analysis subscribes to any changes to the current AnalysisState.

Source

fn on_update(&self, info: &mut AnalysisStateInfo, worklist: &mut AnalysisQueue)

Called when changes to an AnalysisState are being propagated. This callback has visibility into the modified state, and can use that information to modify other analysis states that may be directly/indirectly affected by the changes.

Implementors§