Skip to content

Commit

Permalink
libgraphviz: add label and escaped ctors taking any `str::IntoMay…
Browse files Browse the repository at this point in the history
…beOwned`.
  • Loading branch information
pnkfelix committed Dec 15, 2014
1 parent 1b97cd3 commit c500b63
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/libgraphviz/lib.rs
Expand Up @@ -421,6 +421,14 @@ pub trait Labeller<'a,N,E> {
}

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
Expand Down

0 comments on commit c500b63

Please sign in to comment.