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

macro no-std stringify-inner

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

7 releases

new 0.3.2 May 7, 2025
0.3.1 May 6, 2025
0.2.1 Apr 27, 2025
0.1.2 Apr 27, 2025

#583 in No standard library

Download history 280/week @ 2025-04-15 272/week @ 2025-04-22 57/week @ 2025-04-29

609 downloads per month
Used in short-names

MIT license

6KB
85 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");

Dependencies

~23KB