pub trait Recognizable<'a, T, V>: MatchSize {
// Required method
fn recognize(self, scanner: &mut Scanner<'a, T>) -> ParseResult<Option<V>>;
}Expand description
A trait that defines how to recognize an object.
§Type Parameters
V- The type of the object to recognizeT- The type of the data to scan'a- The lifetime of the data to scan
Required Methods§
Sourcefn recognize(self, scanner: &mut Scanner<'a, T>) -> ParseResult<Option<V>>
fn recognize(self, scanner: &mut Scanner<'a, T>) -> ParseResult<Option<V>>
Try to recognize the object for the given scanner.
§Type Parameters
V - The type of the object to recognize
§Arguments
scanner- The scanner to recognize the object for.
§Returns
Ok(Some(V))if the object was recognized,Ok(None)if the object was not recognized,Err(ParseError)if an error occurred