Skip to main content

parse

Function parse 

Source
pub fn parse<'de>(
    document: &'de str,
    arena: &'de Arena,
) -> Result<Root<'de>, Error>
Expand description

Parses a TOML document and returns a Root containing the parsed tree.

Both s and arena must outlive the returned Root because parsed values borrow directly from the input string and allocate escaped strings into the arena.

§Errors

Returns an Error on the first syntax error encountered.

§Examples

let arena = toml_spanner::Arena::new();
let root = toml_spanner::parse("key = 'value'", &arena)?;
assert_eq!(root["key"].as_str(), Some("value"));