Skip to main content

parse_toml

Function parse_toml 

Source
pub fn parse_toml<T: DeserializeOwned>(
    text: &str,
    source: &str,
) -> Result<T, Error>
Expand description

Parse a TOML file, expanding environment references in its string values.

This is how every app-directory file is read, so $VAR works the same in main.toml, in a model and in a function’s config.

A file with no $ in it is deserialized straight from its text rather than through toml::Value, which keeps the line and column in a parse error. That is the overwhelmingly common case, so the diagnostics an author sees for a typo are unchanged by this feature existing.