Skip to main content

try_value_from

Function try_value_from 

Source
fn try_value_from<'a, T>(
    layer: &str,
) -> impl Parser<Input<'a>, T, ErrMode<ParseStack<'a>>>
where T: FromStr, T::Err: Error + Send + Sync + 'static,
Expand description

A parser helper, which returns a FromStr-style parser for types that don’t implement their own parser.

Parses until the end of the current line. The line ending itself is not consumed. Wraps the returned parser in a named layer.

§Errors

Returns an error if the next token cannot be parsed into T. The error message of T::from_str is preserved as external error.