#stringify #proc-macro #concat #no-alloc #s-expr

macro no-std stringify-inner

Translate #stringify for use in places where stringify! is not supported

2 releases

new 0.1.1 Apr 17, 2025
0.1.0 Apr 17, 2025

#280 in No standard library

25 downloads per month
Used in short-names

MIT license

9KB
166 lines

This macro translates a simple string processing expression, such as #stringify() and #concat()

Can be used in conjunction with some macros that cannot evaluate stringify!()

Examples

Is compile-fail case:

#[doc(alias = stringify!(bar))]
fn foo() {}

Change to:

use stringify_inner::sexpr_attr;

#[sexpr_attr(doc(alias = #stringify(bar)))]
fn foo() {}
use stringify_inner::sexpr;

assert_eq!(sexpr!(#stringify(foo)), "foo");
assert_eq!(sexpr!(#concat(#stringify(foo), "bar")), "foobar");

No runtime deps