Macrosยง
- append_
state - Like
write_state!, but instead appends the specifiedvalue(newline-delimited) to the state file. Newlines contained in thevalueare automatically escaped so you can think of this as appending to aVec<String>for all intents and purposes. Callingappend_state!is also more efficient than re-writing an entire state file viawrite_state!since the low level append IO option is not used bywrite_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 specifieddefault_value, and then thedefault_valueis returned. - read_
state - Reads the state value for the specified
key. Sincemacro_statefunctions 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 theVec. Should be used in conjunction withappend_state!to read and write lists of values from macro state storage. - write_
state - Writes the specified
valueas the state for the specified statekey.macro_stateitself functions as a compile-time key-value store, and this is how you write a value to a specific key.