Macros§
- Like
write_state!
, but instead appends the specifiedvalue
(newline-delimited) to the state file. Newlines contained in thevalue
are automatically escaped so you can think of this as appending to a [Vec<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!
. - 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 specifieddefault_value
, and then thedefault_value
is returned. - Reads the state value for the specified
key
. Sincemacro_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 withappend_state!
to read and write lists of values from macro state storage. - Writes the specified
value
as the state for the specified statekey
.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 thetarget
directory for the specified build environment. You should never use this directly unless you know what you’re doing.
Functions§
- An analogue for
append_state!
that should only be used within proc macros. - An analogue for
clear_state!
that should only be used within proc macros. - An analogue for
has_state!
that should only be used within proc macros. - An analogue for
clear_state!
that should only be used within proc macros. - An analogue for
read_state!
that should only be used within proc macros. - An analogue for
read_state_vec!
that should only be used within proc macros. - An analogue for
write_state!
that should only be used within proc macros. - Returns the path of the internal file that would be used to store state for the specified key, as a PathBuf. You should never use this directly unless you know what you’re doing.