[][src]Crate mimi

This crate provides run-time string interpolation using key/value pairs, oriented towards support for terminal applications. For documentation on the format of mimi strings, see the README.md.

Examples

use std::collections::HashMap;
let formatter: mimi::Formatter = "foo is %[red]{$foo}".parse().unwrap();
let mut values = HashMap::new();
values.insert("foo", "value".to_owned());
println!("{}", formatter.ansi(&values));

Structs

Formatter

A Formatter takes a bunch of key/value pairs and interpolates them into a mimi format string.

ParseFormatterError

An error that occurred while parsing a format string. The std::fmt::Display implementation for ParseFormatterError is guaranteed to produce something human-readable (i.e., not just dump a struct), but the format may change. Currently it uses pest's errors.

Style

Describes the foreground color, background color, and any additional modifications (inverse, bold, etc).

Enums

Color

Foreground or background color. Colors are parsed as snake_case, so light_red becomes LightRed, etc.

Modifier

Any formatting information that isn't foreground or background color.