#text-generation #template #development-tools-debuggings #tegen

tegen

tegen is a Rust library designed to generate text from a given template

5 releases

0.1.4 Mar 6, 2022
0.1.3 Mar 5, 2022
0.1.2 Mar 5, 2022
0.1.1 Mar 5, 2022
0.1.0 Mar 5, 2022

#436 in Template engine

Download history 36/week @ 2024-12-26 79/week @ 2025-01-02 65/week @ 2025-01-09 86/week @ 2025-01-16 74/week @ 2025-01-23 155/week @ 2025-01-30 159/week @ 2025-02-06 148/week @ 2025-02-13 103/week @ 2025-02-20 123/week @ 2025-02-27 103/week @ 2025-03-06 70/week @ 2025-03-13 151/week @ 2025-03-20 87/week @ 2025-03-27 124/week @ 2025-04-03 98/week @ 2025-04-10

469 downloads per month
Used in redlib

MIT/Apache

8KB
110 lines

tegen

tegen is a Rust library designed to generate fast text from a template. (heavily inspired from liderman's text generator)

Usage

use tegen::tegen::TextGenerator;

fn main() {
    let tg = TextGenerator::new();

    // Generate text from a given template
    println!("{}", tg.generate("{Hello|Greetings|Salutations}, {World|Reality}!"));

    // You can even nest templates!
    println!("{}", tg.generate("{Good {night|morning|evening|day}|Hello|Greetings|Howdy|What's up}, {friend|mate}! {How are you|How's it going}?"));
}

Features

  • Faster than cup noodles
  • Does not use regular expressions
  • Very user friendly
  • Included examples which can be run by using `cargo run --example [example_name]`

Goals

The main goal of this library is to generate text from a given template as fast as possible. Other than that, the other goals of this library are:

  • Easy to use
  • Easy to extend
  • Easy to understand
  • Easy to maintain

How to contribute

  • Create an issue for bug reports or feature suggestions
  • Create a pull request of a new feature or a bug fix describing the changes it will make

Dependencies

~335KB