Liquid filter for Rust to reverse a string
The liquid crate, the Rust implementation of the liquid template system has many filters to manipulate the data in the template, but AFAIK there is no filter to reverse a string.
This crate was originally developed as a demo on how to add a filter to liquid.
Usage:
Cargo.toml
:
[]
= "0.26"
= "0.1"
src/main.rs
:
use ReverseStr;
The important pieces:
The use
statement:
use liquid_filter_reverse_string::ReverseStr;
The use of the reversestr
filter in the template
let template = "reversed: {{text | reversestr}}";
- adding the filter to the engine:
.filter
Release
- update the
version
number inCargo.toml
cargo publish
git tag -a v0.1.0 -m v0.1.0
git push --tags