Skip to main content

parse

Function parse 

Source
pub fn parse(input: &str) -> Result<Value>
Expand description

Parse a structprop document from input and return the top-level Value::Object.

§Errors

Returns Error::Parse if the input contains unexpected tokens or violates the structprop grammar. The error message includes the 1-indexed line number where the problem was detected.

§Examples

use serde_structprop::parse::{parse, Value};

let v = parse("port = 8080\n").unwrap();
if let Value::Object(map) = v {
    assert_eq!(map["port"].as_i64(), Some(8080));
}