#[non_exhaustive]pub struct Layout {
pub nodes: Vec<NodeLayout>,
pub edges: Vec<EdgeLayout>,
pub bounds: Rect,
pub fallback: Option<String>,
}Expand description
The output half of the crate contract: positions, ranks, waypoints, bounding box, and the two honesty markers (cycle-broken edge set, fallback label).
Deterministic: the same GraphDesc and options yield an identical
Layout (golden-test-pinned). Coordinates are origin-normalized:
bounds always starts at (0, 0) and is the content size a scrolling
container should advertise.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.nodes: Vec<NodeLayout>Node placements, in input node order (minus dropped duplicates).
edges: Vec<EdgeLayout>Edge routings, in input edge order (minus edges whose endpoints
do not resolve — those drops are recorded in fallback).
bounds: RectBounding box of all cards and waypoints, anchored at (0, 0).
fallback: Option<String>Honesty label. None means the requested algorithm ran cleanly.
Some names every degradation that occurred: grid fallback past
the node cap, dropped duplicate node ids, skipped unresolvable
edges. A labeled degraded layout beats a hung or lying solver.
Implementations§
Source§impl Layout
impl Layout
Sourcepub fn new(nodes: Vec<NodeLayout>, edges: Vec<EdgeLayout>) -> Self
pub fn new(nodes: Vec<NodeLayout>, edges: Vec<EdgeLayout>) -> Self
Construct a layout from parts, computing the bounding box from the content (downstream construction path).
Sourcepub fn broken_edges(&self) -> Vec<usize>
pub fn broken_edges(&self) -> Vec<usize>
The cycle-broken edge set, as indices into GraphDesc::edges.
Derived from the per-edge EdgeLayout::broken markers (one
source of truth).
Sourcepub fn node(&self, id: &str) -> Option<&NodeLayout>
pub fn node(&self, id: &str) -> Option<&NodeLayout>
Look up a node placement by id.