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
use crate::dot::DotString;
use std::borrow::Cow;

/// If out, then the outedges of a node, that is, edges with the node as its tail node,
/// must appear left-to-right in the same order in which they are defined in the input.
///
/// If in, then the inedges of a node must appear left-to-right in the same order in which they are
/// defined in the input.
///
/// If defined as a graph or subgraph attribute, the value is applied to all nodes in the graph
/// or subgraph.
///
/// Note that the graph attribute takes precedence over the node attribute.
pub enum Ordering {
    In,
    Out,
}

impl<'a> DotString<'a> for Ordering {
    fn dot_string(&self) -> Cow<'a, str> {
        match self {
            Ordering::In => "in".into(),
            Ordering::Out => "out".into(),
        }
    }
}