Trait parsa::Parsable

source ·
pub trait Parsable: Sized {
    type Err;

    // Required method
    fn parse(s: &mut ParserString) -> Result<Self, Self::Err>;

    // Provided method
    fn try_parse(s: &mut ParserString) -> Result<Self, Self::Err> { ... }
}
Expand description

Parse an instance of this type, Similar to [FromStr].

Required Associated Types§

source

type Err

The error type this parser can return

Required Methods§

source

fn parse(s: &mut ParserString) -> Result<Self, Self::Err>

Run this parser, using a ParserString.

Provided Methods§

source

fn try_parse(s: &mut ParserString) -> Result<Self, Self::Err>

Run this parser without affecting the string on failure. In other words, the string will be “rewinded” on failure.

Object Safety§

This trait is not object safe.

Implementors§