Skip to main content

brokk_bifrost_python/
graph_support.rs

1//! Legacy usage-index source layered over the surviving Python source helpers.
2
3pub use crate::source_support::*;
4use crate::usage_index::PythonUsageIndex;
5use brokk_bifrost_core::analyzer::ProjectFile;
6use std::sync::Arc;
7
8/// [`PythonSource`] plus the built usage index. Everything reached from
9/// the export/importer walks needs it; the index build itself must not.
10pub trait PythonUsageSource: PythonSource {
11    fn usage_index(&self) -> Arc<PythonUsageIndex>;
12    fn module_binding_timeline(
13        &self,
14        file: &ProjectFile,
15        build: &mut dyn FnMut() -> crate::usage_index::ModuleBindingTimeline,
16    ) -> Arc<crate::usage_index::ModuleBindingTimeline>;
17    fn scope_facts(
18        &self,
19        file: &ProjectFile,
20        build: &mut dyn FnMut() -> Option<crate::usage_index::PythonScopeFacts>,
21    ) -> Option<Arc<crate::usage_index::PythonScopeFacts>>;
22
23    /// A cancelled initialization publishes no partial index.
24    fn usage_index_with_cancellation(
25        &self,
26        cancellation: &brokk_bifrost_core::CancellationToken,
27    ) -> Option<Arc<PythonUsageIndex>>;
28}