Crates.io | rimpiazza |
lib.rs | rimpiazza |
version | 0.2.0 |
source | src |
created_at | 2023-07-31 21:44:08.528321 |
updated_at | 2023-08-01 19:03:44.109267 |
description | A compile time procedural macro to replace keywords in a string |
homepage | https://codeberg.org/vellu/rimpiazza |
repository | https://codeberg.org/vellu/rimpiazza |
max_upload_size | |
id | 931234 |
size | 40,223 |
The simple procedural macro to replace keywords from a string.
Standard replacing:
println!(
"{}",
replace!("I like Gelato", "Gelato" => "ice cream, a lot!", "like" => "hate")
);
Replace contents from a file:
println!(
"{}",
replace!(:"./gelato.txt", "Gelato" => "ice cream, a lot!", "like" => "hate")
// Notice the : character
);
That's it, it does not have any more fancy features.
I created this because Internet Explorer 11 has no support for css variables, with this macro, I can add them to my css from my rust backend. Previously I just used a function, but this is much more fast as it is compile-time.
This is such a simple thing it does not need much support.
If I find a bug I will fix it, but it's a very small macro and does not need a lot of development.