GitHunt
JA

JarredAllen/string-literal-const-replace

Procedural macro in Rust for compile-time find/replace on string literals

string-literal-const-replace

This is a proc macro which allows you to, at compile time, perform find/replace on string literals.
This macro is intended to be called by other macros, to do processing on inputs provided to the
macro.

Note that this macro is nightly-only as it relies on the
proc_macro_expand unstable feature.

Example of use:

assert_eq!(
    string_literal_replace!("hello, world!" ("hello" -> "goodbye")),
    "goodbye, world!"
);

Languages

Rust100.0%

Contributors

Apache License 2.0
Created February 12, 2025
Updated March 30, 2025