Skip to main content

parse

Function parse 

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

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

Both s and arena must outlive the returned Document because parsed values borrow 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 doc = toml_spanner::parse("key = 'value'", &arena).unwrap();
assert_eq!(doc["key"].as_str(), Some("value"));