Change the T: Display
constraint on PreEscaped
to something else
#54
Labels
T: Display
constraint on PreEscaped
to something else
#54
Using
Display
here seems wrong, because semanticallyDisplay
gives a plain text representation, not an HTML representation. So in effect,PreEscaped<T: Display>
is a claim that the plain text and HTML representations of a type are the same, which doesn't really make sense in general.We can change the constraint to
T: AsRef<str>
instead. This covers what I think is the primary use case (including HTML output from an external source) without bringing in that semantic baggage. It doesn't cover fancy data structures like ropes, but I don't think they'll come up in a web app.This change will also drive users toward implementing the
Render
trait, which is the idiomatic way to customize HTML output (see #53).My question is: Are there any existing use cases of
PreEscaped
which are not either...PreEscaped("<!DOCTYPE html>")
Render
trait instead... ?
If not, then we can go ahead on this change.
The text was updated successfully, but these errors were encountered: