I'm using HTML5ever, and I'm trying to put attributes into a Vec<(String, String>)
(although (&str, &str)
would work too).
Unfortunately, html5ever's attribute values are in Tendril<UTF8>
s, not String
s (or QualName
s, &str
s, etc.). How can I convert one of these Tendril
s into a String
?
Use its Deref
implementation:
extern crate tendril;
use tendril::{fmt::UTF8, Tendril};
fn example(t: &Tendril<UTF8>) -> &str {
t
}
fn main() {}