1 2 3 4 5 6 7 8 9 10 11 12 13 14
//! Parser traits.
use crate::parsers::Parser;
use crate::result::*;
/// Types that can be parsed from strings.
pub trait Parse: Sized + 'static {
/// Return a parser for this type.
fn parser() -> Parser<Self>;
/// Parse a string into this type.
fn parse(input: &str) -> Result<'_, Self> {
Self::parser().parse(input)
}
}