Crate macro_state_macros

Source

Macrosยง

append_state
Like write_state!, but instead appends the specified value (newline-delimited) to the state file. Newlines contained in the value are automatically escaped so you can think of this as appending to a Vec<String> for all intents and purposes. Calling append_state! is also more efficient than re-writing an entire state file via write_state! since the low level append IO option is not used by write_state!.
clear_state
Clears the value for the specified key, if it exists.
has_state
Checks if an existing state value can be found for the specified key.
init_state
Returns the value for the specified key, if it exists. If it does not exist, the key is created and set to the specified default_value, and then the default_value is returned.
read_state
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.
read_state_vec
Reads the state value for the specified key and parses it as a Vec<String> where each new line is treated as a separate element in the Vec. Should be used in conjunction with append_state! to read and write lists of values from macro state storage.
write_state
Writes the specified value as the state for the specified state key. macro_state itself functions as a compile-time key-value store, and this is how you write a value to a specific key.