From c95ff86e2c8fbdd8e0cf6550aadc7ffc676dcc16 Mon Sep 17 00:00:00 2001 From: seancarroll Date: Wed, 6 Jan 2021 21:11:57 -0600 Subject: trying to organize files and use declarations --- src/attributes/pack_mode.rs | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 src/attributes/pack_mode.rs (limited to 'src/attributes/pack_mode.rs') diff --git a/src/attributes/pack_mode.rs b/src/attributes/pack_mode.rs new file mode 100644 index 0000000..3fb086e --- /dev/null +++ b/src/attributes/pack_mode.rs @@ -0,0 +1,30 @@ +use crate::dot::DotString; +use std::borrow::Cow; + +/// The modes "node", "clust" or "graph" specify that the components should be packed together +/// tightly, using the specified granularity. +pub enum PackMode { + /// causes packing at the node and edge level, with no overlapping of these objects. + /// This produces a layout with the least area, but it also allows interleaving, + /// where a node of one component may lie between two nodes in another component. + Node, + + /// guarantees that top-level clusters are kept intact. + /// What effect a value has also depends on the layout algorithm. + Cluster, + + /// does a packing using the bounding box of the component. + /// Thus, there will be a rectangular region around a component free of elements of any other component. + Graph, + // TODO: array - "array(_flags)?(%d)?" +} + +impl<'a> DotString<'a> for PackMode { + fn dot_string(&self) -> Cow<'a, str> { + match self { + PackMode::Node => "node".into(), + PackMode::Cluster => "clust".into(), + PackMode::Graph => "graph".into(), + } + } +} -- cgit v1.2.3