diff options
author | seancarroll <seanc28@gmail.com> | 2020-12-07 22:30:38 -0600 |
---|---|---|
committer | seancarroll <seanc28@gmail.com> | 2020-12-07 22:30:38 -0600 |
commit | a65bbf2d1b5cc0075ec9082c5e7e129d9ec8745e (patch) | |
tree | 34d3e8e0a58a5008ac4a13b528c097f9a9bde37b | |
parent | 2a923cfd3cd74ab0a6048882ac2604c0f56551da (diff) | |
download | dotavious-a65bbf2d1b5cc0075ec9082c5e7e129d9ec8745e.zip |
bit of clean up
-rw-r--r-- | src/lib.rs | 57 |
1 files changed, 2 insertions, 55 deletions
@@ -168,6 +168,7 @@ pub trait GraphType { fn is_directed() -> bool; // TODO: maybe this doesnt below here + // dont love the name fn as_slice() -> &'static str; fn edge_slice() -> &'static str; @@ -275,18 +276,6 @@ impl<'a> Dot<'a> { } } -// impl fmt::Display for Dot { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// self.render(&self.graph, f) -// } -// } - -// impl fmt::Debug for Dot { -// fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { -// self.render(&self.graph, f) -// } -// } - /// `Dot` configuration. /// /// This enum does not have an exhaustive definition (will be expanded) @@ -346,34 +335,6 @@ pub enum Directed {} pub enum Undirected {} -/// A graph's edge type determines whether it has directed edges or not. -pub trait EdgeType { - fn is_directed() -> bool; - - // TODO: maybe this doesnt below here - fn as_slice() -> &'static str; -} - -impl EdgeType for Directed { - fn is_directed() -> bool { - true - } - - fn as_slice() -> &'static str { - "->" - } -} - -impl EdgeType for Undirected { - fn is_directed() -> bool { - false - } - - fn as_slice() -> &'static str { - "--" - } -} - pub type DiGraph<'a> = Graph<'a, Directed>; pub type UnGraph<'a> = Graph<'a, Undirected>; @@ -442,14 +403,11 @@ where Ty: GraphType Ty::is_directed() } - // pub fn edge_type(&self) -> &'static str { - // Ty::as_slice() - // } - pub fn as_slice(&self) -> &'static str { Ty::as_slice() } + // graphviz calls this edgeop pub fn edge_type(&self) -> &'static str { Ty::edge_slice() } @@ -555,17 +513,6 @@ impl<'a> Node<'a> { return dot_string.to_string(); } - - // /// Renders text as string suitable for a label in a .dot file. - // /// This includes quotes or suitable delimiters. - // pub fn to_dot_string(&self) -> String { - // match *self { - // LabelStr(ref s) => format!("\"{}\"", s.escape_default()), - // EscStr(ref s) => format!("\"{}\"", LabelText::escape_str(&s)), - // HtmlStr(ref s) => format!("<{}>", s), - // } - // } - } #[derive(Copy, Clone, PartialEq, Eq, Debug)] |