Function jsmn_rs::jsmn_parse[][src]

pub fn jsmn_parse(
    parser: &mut JsmnParser,
    js: &str,
    tokens: &mut [JsmnTok]
) -> Result<usize, JsmnErr>

This function is the core parsing function. It wraps the underlying jsmn_parse function in a more Rustic interface by taking a slice of JsmnTokens, and returning a Result instead of using sentinal values.

Simply provide a JsmnParser, a string, and a slice of JsmnTokens, and the tokens will point to the locations of each JSON object within the string.

If the function succeeds, it will return a usize giving how many tokens were parsed, and on error it will return an JsmnErr describing the problem encountered while parsing.