replacer

Creating compilable Rust source code templates.

Build Status Version Rust Documentation License

Example

Rust source template:

```rust fn main() { println!("Hello $$replacewithstring$$!");

let some_type = <replacer::rust_type!(replace_with_type; String;)>::new();

} ```

Rust script to parse the template:

```rust use replacer::{Rule, StringRule, TemplateBuilder};

fn main() { let template = TemplateBuilder::new() .rule(StringRule::new("replacewithstring", "world").unwrap()) .rule(TypeRule::new("replacewithtype", "Vec").unwrap()) .build();

println!(template.apply(include_str!(SOURCE_TEMPLATE_FROM_ABOVE)).unwrap());

} ```

Rust template that will be printed:

```rust fn main() { prinln!("Hello world!");

let some_type = <Vec>::new();

} ```