Neutral TS is a safe, modular, language-agnostic template engine built in Rust. It works as a native Rust library or via IPC for other languages like Python and PHP. With Neutral TS you can reuse the same template across multiple languages with consistent results.
Examples for Rust, Python, PHP, Node.js and Go here: download. All PWA examples use the same template: Neutral templates.
The documentation of the web template engine is here: template engine doc and Rust documentation here: Rust doc.
use neutralipcrs::NeutralIpcTemplate;
use serde_json::json;
let schema = json!({
"data": {
"hello": "Hello World"
}
});
let template = Template::from_file_value("file.ntpl", schema).unwrap();
let contents = template.render().unwrap();
// e.g.: 200
let status_code: &str = template.get_status_code();
// e.g.: OK
let status_text: &str = template.get_status_text();
// empty if no error
let status_param: &str = template.get_status_param();
// act accordingly at this point according to your framework
- Requires the IPC server: Neutral TS IPC Server
- Requires the Rust IPC client: Neutral TS Rust IPC Client