Crate weft

source ·
Expand description

weft.

This module provides runtime support for weft templates.

Example:

   #[macro_use]
   extern crate weft_derive;
   extern crate weft;
   #[derive(WeftRenderable)]
   #[template(source = "<p>Hello {{ self.0 }}!</p>")]
   struct Greeting(String);

    fn main() {
        let s = weft::render_to_string(Greeting("world".into())).expect("render_to_string");
        println!("{}", s);
        // Should print `<p>Hello world!<p>`
    }

Structs

An attribute name and value pair.
An internal representation of a qualified name, such as a tag or attribute. Does not currently support namespaces.

Traits

Something that we can use to actually render HTML to text.
This is designed to be implemented via the weft_derive crate, but can be implemented manually for special cases.

Functions

Renders the template in widget to a new String.
Renders the template in widget to the writer out.