Crate macro_state

source

Macros§

  • 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!.
  • Clears the value for the specified key, if it exists.
  • Checks if an existing state value can be found for the specified key.
  • 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.
  • 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.
  • 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.
  • 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.

Constants§

  • A constant that will always resolve to the directory macro_state will use to store state files. This is typically some sub-directory of the target directory for the specified build environment. You should never use this directly unless you know what you’re doing.

Functions§