Skip to main content

dendryform_layout/
lib.rs

1//! # dendryform-layout
2//!
3//! Shared layout engine that produces a [`LayoutPlan`] from a [`Diagram`](dendryform_core::Diagram).
4//!
5//! The layout plan contains relative positioning, geometry, and
6//! connector routing. Format-specific renderers (HTML, SVG) consume
7//! this plan to produce output in their native coordinate systems.
8//!
9//! ## Quick Start
10//!
11//! ```no_run
12//! use dendryform_layout::compute_layout;
13//!
14//! let diagram = dendryform_parse::parse_yaml_file("examples/taproot/architecture.yaml").unwrap();
15//! let plan = compute_layout(&diagram).unwrap();
16//! println!("Layers: {}", plan.layers.len());
17//! ```
18
19mod compute;
20mod error;
21mod geometry;
22
23pub use compute::compute_layout;
24pub use error::LayoutError;
25pub use geometry::{
26    ConnectorGeometry, ContainerGeometry, FlowLabelsGeometry, HeaderGeometry, LayerGeometry,
27    LayoutPlan, LegendGeometry, NodeGeometry, TierGeometry, ViewportHint,
28};
29
30/// Returns the version of the dendryform-layout crate.
31pub fn version() -> &'static str {
32    env!("CARGO_PKG_VERSION")
33}
34
35#[cfg(test)]
36mod tests {
37    use super::*;
38
39    #[test]
40    fn test_version_is_set() {
41        assert_eq!(version(), "0.1.0");
42    }
43}