libgraphviz: add label and escaped ctors taking any str::IntoMaybeOwned.

This commit is contained in:
Felix S. Klock II
2014-12-15 12:32:54 +01:00
parent 1b97cd338b
commit c500b63e71
+8
View File
@@ -421,6 +421,14 @@ fn edge_label(&'a self, e: &E) -> LabelText<'a> {
}
impl<'a> LabelText<'a> {
pub fn label<S:IntoCow<'a, String, str>>(s: S) -> LabelText<'a> {
LabelStr(s.into_cow())
}
pub fn escaped<S:IntoCow<'a, String, str>>(s: S) -> LabelText<'a> {
EscStr(s.into_cow())
}
fn escape_char<F>(c: char, mut f: F) where F: FnMut(char) {
match c {
// not escaping \\, since Graphviz escString needs to