Closed jonahlund closed 8 months ago
I explicitly didn't add this previously, because a &String
is generally not something you want to have anywhere, and it dereferences to a &str
. What's your usecase for this?
Currently, this code gives an error:
let foo = String::new();
let bar = html!(
<div>{&foo}</div>
);
error[E0277]: the trait bound `&String: HtmlContent` is not satisfied
and to solve it you need to use either foo.as_str()
, &foo as &str
or &*foo
, which is somewhat inconvenient to use
Fair enough.
This PR implements
HtmlContent
for&String
to make working with strings more convenient