diff --git a/src/traits.rs b/src/traits.rs index a7fe99a6..7325012b 100644 --- a/src/traits.rs +++ b/src/traits.rs @@ -1079,6 +1079,14 @@ impl<'a, R: FromStr> ParseTo for &'a str { } } +/// Provides a parser for a given type +pub trait Parsable: Sized { + /// The associated error which can be returned from parsing. + type Err; + /// Attempt to parse this type, returning an [`IResult`] + fn parse(s: O) -> IResult; +} + impl InputLength for [u8; N] { #[inline] fn input_len(&self) -> usize {