#macro #eval #string #expression #compile-time #evaluation #parser

nightly string_to_expr

Compile-time expression evaluation for strings

2 releases

Uses old Rust 2015

0.0.2 Apr 14, 2015
0.0.1 Mar 22, 2015

#28 in #eval

MIT license

7KB
140 lines

string_to_expr

Compile-time expression evaluation for strings. Inspired by trws. Check tests/tests.rs for examples.

I found this technique to be necessary to concatenate identifiers in macros. Really handy for generating structs, enums, and functions. One day, Rust will probably be able to parse macros with more flexibility. Until then, I'm using this crazy mess.

No runtime deps