Render a template by replacing `{key}` placeholders with values
(template: &str, vars: &[(&str, &str)])
| 587 | |
| 588 | /// Render a template by replacing `{key}` placeholders with values |
| 589 | pub fn render(template: &str, vars: &[(&str, &str)]) -> String { |
| 590 | let mut result = template.to_string(); |
| 591 | for (key, value) in vars { |
| 592 | result = result.replace(&format!("{{{}}}", key), value); |
| 593 | } |
| 594 | result |
| 595 | } |
| 596 | |
| 597 | #[cfg(test)] |
| 598 | mod tests { |
no outgoing calls