pub struct RunnerEnv { /* private fields */ }Expand description
The parsed runner.env: ordered, one entry per name.
Implementations§
Source§impl RunnerEnv
impl RunnerEnv
Sourcepub fn parse(text: &str) -> Result<Self, RunnerEnvError>
pub fn parse(text: &str) -> Result<Self, RunnerEnvError>
Parses the file’s text. Blank lines and lines starting with # are
kept as text; every other line must be NAME=VALUE. The value is
everything after the first =, verbatim: no quoting, no expansion.
§Errors
The first line that is not an assignment, has an invalid or reserved name, or repeats a name.
Sourcepub fn load(path: &Path) -> Result<Self, RunnerEnvError>
pub fn load(path: &Path) -> Result<Self, RunnerEnvError>
Reads path; a file that does not exist is an empty environment.
§Errors
RunnerEnvError::Io when the file exists and cannot be read, and the
Self::parse errors.
Sourcepub fn save(&self, path: &Path) -> Result<(), RunnerEnvError>
pub fn save(&self, path: &Path) -> Result<(), RunnerEnvError>
Writes the file atomically: a reader sees the old file or the new one, never a partial one. Created owner-only where the platform has modes, since an operator may put something sensitive here regardless.
On Unix the replacement keeps the existing file’s owner and mode, and a
new file takes its directory’s owner, best effort: the daemon may run as
another account than this command (a sudo edit of a user agent’s
file), and a file it cannot read stops every native launch.
§Errors
Sourcepub fn set(&mut self, name: &str, value: &str) -> Result<bool, RunnerEnvError>
pub fn set(&mut self, name: &str, value: &str) -> Result<bool, RunnerEnvError>
Sets name, replacing its value in place if it is already set.
Returns whether it was already set.
§Errors
An invalid or reserved name, or a value with a line break.