Map to JavaScript in HTML
This is a library for serializing a (hash) map to JavaScript code in HTML, usually for dynamically generating strings on web pages.
Example
In your HTML or templates to generate HTML, such as Handlebars, for instance,
Then, you can use this crate to insert your text into JavaScript code in HTML,
extern crate map_to_javascript_html;
use hash_map_to_javascript_html;
use HashMap;
let mut map = new;
map.insert;
map.insert;
map.insert;
let text = hash_map_to_javascript_html;
After Handlebars replaces {{{text}}} with your text, the HTML will be,
The key and the value used in a map must implement the Display
trait.
Crates.io
https://crates.io/crates/map-to-javascript-html
Documentation
https://docs.rs/map-to-javascript-html