Trait scan_rules::input::ScanInput [] [src]

pub trait ScanInput<'a>: Sized {
    fn try_end(self) -> Result<()(ScanError<'a>, Self)>;
    fn try_scan<F, Out>(self, f: F) -> Result<(Out, Self)(ScanError<'a>, Self)> where F: FnOnce(&'a str) -> Result<(Out, usize)ScanErrorKind>;
    fn try_scan_raw<F, Out>(self, f: F) -> Result<(Out, Self)(ScanError<'a>, Self)> where F: FnOnce(&'a str) -> Result<(Out, usize)ScanErrorKind>;
    fn try_match_literal(self, lit: &str) -> Result<Self, (ScanError<'a>, Self)>;
}

This trait defines the interface to input values that can be scanned.

Required Methods

fn try_end(self) -> Result<()(ScanError<'a>, Self)>

Assert that the input has been exhausted, or that the current position is a valid place to "stop".

fn try_scan<F, Out>(self, f: F) -> Result<(Out, Self)(ScanError<'a>, Self)> where F: FnOnce(&'a str) -> Result<(Out, usize)ScanErrorKind>

Scan a value from the current position. The closure will be called with a string slice of all available input, and is expected to return either the scanned value, and the number of bytes of input consumed, or a reason why scanning failed.

The input will have all leading whitespace removed, if applicable.

fn try_scan_raw<F, Out>(self, f: F) -> Result<(Out, Self)(ScanError<'a>, Self)> where F: FnOnce(&'a str) -> Result<(Out, usize)ScanErrorKind>

Performs the same task as try_scan, except that it does not perform whitespace stripping.

fn try_match_literal(self, lit: &str) -> Result<Self, (ScanError<'a>, Self)>

Match the provided literal term against the input.

Implementations are free to interpret "match" as they please.

Implementors