Skip to content

Commit c500b63

Browse files
committed
libgraphviz: add label and escaped ctors taking any str::IntoMaybeOwned.
1 parent 1b97cd3 commit c500b63

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/libgraphviz/lib.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,14 @@ pub trait Labeller<'a,N,E> {
421421
}
422422

423423
impl<'a> LabelText<'a> {
424+
pub fn label<S:IntoCow<'a, String, str>>(s: S) -> LabelText<'a> {
425+
LabelStr(s.into_cow())
426+
}
427+
428+
pub fn escaped<S:IntoCow<'a, String, str>>(s: S) -> LabelText<'a> {
429+
EscStr(s.into_cow())
430+
}
431+
424432
fn escape_char<F>(c: char, mut f: F) where F: FnMut(char) {
425433
match c {
426434
// not escaping \\, since Graphviz escString needs to

0 commit comments

Comments
 (0)