Expand description
§source-mesh-core
Dependency graphs, cycle reports, and outgoing dependency limits for Rust projects.
Exports DOT, Mermaid, and GraphML. The source-mesh package provides the CLI.
use std::path::PathBuf;
use source_mesh_core::Input;
use source_mesh_core::Request;
use source_mesh_core::export::Format;
fn main() -> anyhow::Result<()> {
let index = PathBuf::from(env!("CARGO_MANIFEST_DIR"))
.join("src").join("fixtures").join("dependency-graph.scip");
let request = Request::builder()
.input(Input::ScipFile(index))
.format(Format::Mermaid)
.build()?;
let mut diagram = Vec::new();
source_mesh_core::run(&request, &mut diagram)?;
assert!(!diagram.is_empty());
Ok(())
}Input::Project(Project::new(project_path, configuration)) requires a Rust toolchain with rust-analyzer and rust-src.
configuration is an optional path to rust-analyzer JSON configuration.
Input::ScipFile loads the index during request construction and reuses it on subsequent runs. It cannot be combined with
save_scip.
Request options (boolean flags default to false):
.cycles(...):CycleOptions::builder()configures highlighting, reports, and failure on cycles. Each report defaults to at mostDEFAULT_CYCLE_LIMITsimple cycles..outgoing_dependencies(...):OutgoingDependencyOptions::builder().maximum(5).build()sets a dependency limit. The default scope is folders;.mode(outgoing_dependencies::Mode::Files)selects files, and.output(path)adds a Markdown report..exclusions(...):Exclusions::new(...)compiles project-relative glob patterns for all graphs and checks. An empty filtered graph is an error..analyzer(analyzer_options::Options::new(true))enables verbose diagnostics..protected_inputs(...):InputFilevalues protect additional input files and their aliases from output overwrites.
Counting and filtering rules are described under outgoing dependency limits and file exclusions.
run writes requested outputs before returning cycle or dependency-limit failures. Validation and analysis errors preserve
existing outputs; output I/O errors can leave partial results. Input files remain protected against output overwrites through
renames and aliases.
See the changelog and development guide.
Modules§
Structs§
- Cycle
Options - Exclusions
- Input
File - Outgoing
Dependency Options - Project
- Request
- Source
Path - Validation is lexical only, not a guarantee of existence, file type, or accessibility. The supplied path spelling is preserved.