mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-21 17:52:12 +03:00
libgraphviz: add label and escaped ctors taking any str::IntoMaybeOwned.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user