Frequently asked questions
What is the origin of the name "Maud"?
Maud is named after a character from My Little Pony: Friendship is Magic. It does not refer to the poem by Alfred Tennyson, though other people have brought that up in the past.
Here are some reasons why I chose this name:
"Maud" shares three letters with "markup";
The library is efficient and austere, like the character;
Google used to maintain a site called "HTML5 Rocks", and Maud (the character) is a geologist.
html! always allocate a
String? Wouldn't it be more efficient if it wrote to a handle directly?
Good question! In fact, Maud did work this way in the past.
Sadly, that kind of thing didn't work out that well in practice. Having to pass the handle around made templates hard to compose, which is important in any non-trivial project. Furthermore, Iron (and other middleware frameworks) likes to take ownership of the response body, so we'd need to do some closure gymnastics to get everything to work together. To put the nail in the coffin, benchmarks showed that a
String based solution is actually faster than one which avoids allocations.
For these reasons, I changed
html! to return a
String in version 0.11.
Why is Maud written as a procedural macro? Can't it use
This is certainly possible, and in fact the Horrorshow library works this way.
I use procedural macros because they are more flexible. There are some syntax constructs in Maud that cannot be parsed with
Maud has had a lot of releases so far. When will it reach 1.0?
macro_rules!; better diagnostics are a bonus as well.
I plan to make a 1.0 release when the library can be used on stable Rust.
Why doesn't Maud implement
Google uses context-aware escaping because it has a large, decades-old code base, much of it written before these best practices were well known. Any project that uses Maud is neither large nor decades-old, and so should not have the need for this feature.