read_state!() { /* proc-macro */ }
Expand description

Reads the state value for the specified key. Since macro_state functions as a compile-time key-value store, read_state! attempts to read the state value associaed with the specified key.

The macro will expand into a string literal representing the state value in the event that a value exists for the provided key.

If no value can be found for the provided key (or in the event of any sort of IO error), the macro will raise a compile-time IO error.

Example

read_state!("my key"); // => "something"