Crate tagger[−][src]
This crate provides primitives to build up a html/xml/svg document programatically. Instead of using a templating engine, write data/markup that ‘looks like’ rust.
Why so many closures?
Unlike Drop, passing closures can be used to force the user to handle errors when something goes out of scope. If we put the writing of end tags in a Drop method it could silently fail, which is not ideal. This can be worked around by adding an explicit function to write the end tag, but there is no way to guarantee that this function gets called at compile time. The best you can do is a runtime panic if the finalizer function isn’t called in order to handle the error case. With closures, you can force a compile-time error.
Examples
See it in use in the poloto crate. Also check out the examples at github.
Modules
prelude | The prelude to import the element manipulation convenience macros. |
svg | svg related building blocks |
tag_types | Common tags to be used in |
Macros
wr | Convenience macro to reduce code. Shorthand for ’move |w|write!(w,…)` Create a closure that will use write!() with the formatting arguments. |
write_ret | Just like the regular |
Structs
AttributeWriter | Builder to write out attributes to an element. |
Element | An element. |
ElementHeaderWriter | Used by |
WriterAdaptor | Used by |
Traits
WriteAttr | Functions the user can call to add attributes.
|
Functions
upgrade | Upgrade a |
write_fmt_ret |
|