1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
//! Materialized diagram views over canonical MMDS payloads.
//!
//! See the crate-level [Stability](crate#stability) section for the
//! variant-addition and field-addition policy on the public types in this module.
//!
//! This module owns the read-side `ViewSpec` contract. It intentionally works
//! over `mmds::Document` rather than renderer or engine internals.
//!
//! The v1 surface is intentionally small: project a filtered MMDS payload
//! from a `ViewSpec` and emit projection events for elements that leave the view.
//! Rendering remains a runtime concern; pass the returned document to
//! [`crate::render_document`] when a text, SVG, or MMDS rendering is
//! needed.
//!
//! # Example
//!
//! ```no_run
//! use mmdflux::mmds::Document;
//! use mmdflux::views::{
//! AnchorRef, Selector, TraversalDirection, ViewSpec, ViewStatement, project,
//! };
//! use mmdflux::{OutputFormat, RenderConfig, materialize_diagram, render_document};
//!
//! let source = "\
//! graph TD
//! service_a[Service A] --> service_b[Service B]
//! external[External] --> service_a
//! service_b --> service_c[Service C]
//! service_c --> database[Database]
//! service_a --> audit[Audit]
//! ";
//!
//! let canonical: Document = materialize_diagram(source, &RenderConfig::default())?;
//! let spec = ViewSpec::new(vec![ViewStatement::Include(Selector::Traversal {
//! anchor: AnchorRef::Node("service_a".to_string()),
//! direction: TraversalDirection::Downstream,
//! hops: 2,
//! })]);
//!
//! let (view, events) = project(&canonical, &spec)?;
//! assert!(view.nodes.iter().any(|node| node.id == "service_c"));
//! assert!(events.iter().any(|event| matches!(
//! event,
//! mmdflux::views::ViewEvent::NodeLeftView { id, .. } if id == "external"
//! )));
//!
//! let text = render_document(&view, OutputFormat::Text, &RenderConfig::default())?;
//! assert!(text.contains("Service A"));
//! # Ok::<(), Box<dyn std::error::Error>>(())
//! ```
pub use ViewError;
pub use ;
pub use ;
pub use ;