summaryrefslogtreecommitdiff
path: root/src/attributes/pack_mode.rs
blob: 3fb086e902def0dc348b0e350c0052d4bf1f96e5 (plain)
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
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(),
        }
    }
}