edo 0.3.0

A super simple templating library for Rust
Documentation
  • Coverage
  • 100%
    10 out of 10 items documented6 out of 8 items with examples
  • Size
  • Source code size: 16.71 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 1.87 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 10s Average build duration of successful builds.
  • all releases: 10s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • giodamelio/edo
    3 2 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • giodamelio

Edo

Crates.io Version Build Status Dependency Status

A super simple templating library for Rust.

Documentation

Examples

You can use a simple static replacement.

use edo::Edo;

let mut template = Edo::new("Hello {name}").unwrap();
template.register_static("name", "World!");
let output = template.render();
assert_eq!(output, "Hello World!");

You can also use a handler function to calculate the value.

use edo::Edo;

let mut template = Edo::new("Hello {name}").unwrap();
template.register_handler("name", |_| Ok("World!".to_string()));
let output = template.render();
assert_eq!(output, "Hello World!");

Your handlers can also take arguments (As a Vec<str>).

use edo::Edo;

let mut template = Edo::new("{say_hello(World)}").unwrap();
template.register_handler("say_hello", |args| Ok(format!("Hello {}", args[0])));
let output = template.render();
assert_eq!(output, "Hello World");

License

This code is distributed under the MIT license