Trait scan_rules::input::ScanInput
[−]
[src]
pub trait ScanInput<'a>: 'a + Sized + Clone { type ScanCursor: ScanCursor<'a>; type StrCompare: StrCompare; fn as_str(&self) -> &'a str; fn from_subslice(&self, subslice: &'a str) -> Self; fn to_cursor(&self) -> Self::ScanCursor; }
This trait is the interface scanners use to access the input being scanned.
Associated Types
type ScanCursor: ScanCursor<'a>
Corresponding cursor type.
type StrCompare: StrCompare
Marker type used to do string comparisons.
Required Methods
fn as_str(&self) -> &'a str
Get the contents of the input as a string slice.
fn from_subslice(&self, subslice: &'a str) -> Self
Create a new input from a subslice of this input's contents.
This should be used to ensure that additional state and settings (such as the string comparison marker) are preserved.
fn to_cursor(&self) -> Self::ScanCursor
Turn the input into an independent cursor, suitable for feeding back into a user-facing scanning macro.
Implementors
impl<'a, Cmp, Space, Word> ScanInput<'a> for StrCursor<'a, Cmp, Space, Word> where
Cmp: StrCompare,
Space: SkipSpace,
Word: SliceWord,impl<'a> ScanInput<'a> for &'a str