parse

Function parse 

Source
pub fn parse<Ctx, T: Parsable<Ctx>>(
    input: &str,
    ctx: Ctx,
) -> Result<T, ParseError<'_>>
Expand description

Parsers a Parsable value from an input string

This function takes an input string slice as an input and a context, and returns a value parsed from the input or an error. parse ensures that all tokens from the input string were consumed, and the input is valid.

ยงExample:

use kmdparse::parse;

let value: (u64, String) = parse("42 fourty-two", ())?;
assert_eq!(value, (42, "fourty-two".to_string()));