rimpiazza

Crates.iorimpiazza
lib.rsrimpiazza
version0.2.0
sourcesrc
created_at2023-07-31 21:44:08.528321
updated_at2023-08-01 19:03:44.109267
descriptionA compile time procedural macro to replace keywords in a string
homepagehttps://codeberg.org/vellu/rimpiazza
repositoryhttps://codeberg.org/vellu/rimpiazza
max_upload_size
id931234
size40,223
(velllu)

documentation

README

Rimpiazza

The simple procedural macro to replace keywords from a string.

Example

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.

Use cases

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.

Is this still being worked on?

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.

Commit count: 0

cargo fmt