minparser/
parsable.rs

1//! Module for the [`Parsable`] trait in order to match and parse custom objects.
2use crate::view::View;
3
4/// Trait for parsable objects, which can be built from a string.
5pub trait Parsable<'a, F> : Sized{
6    /// Error type.
7    type Error;
8
9    /// Parses the object from a string.
10    ///
11    /// # Errors
12    /// If match doesn't happen then [``Self::Error``] is returned.
13    fn parse(st : View<'a, F>) -> Result<(Self, View<'a, F>), Self::Error>;
14}