pub trait ScanInput<'a>:
'a
+ Sized
+ Clone {
type ScanCursor: ScanCursor<'a>;
type StrCompare: StrCompare;
// Required methods
fn as_str(&self) -> &'a str;
fn from_subslice(&self, subslice: &'a str) -> Self;
fn to_cursor(&self) -> Self::ScanCursor;
}
Expand description
This trait is the interface scanners use to access the input being scanned.
Required Associated Types§
Sourcetype ScanCursor: ScanCursor<'a>
type ScanCursor: ScanCursor<'a>
Corresponding cursor type.
Sourcetype StrCompare: StrCompare
type StrCompare: StrCompare
Marker type used to do string comparisons.
Required Methods§
Sourcefn from_subslice(&self, subslice: &'a str) -> Self
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.
Sourcefn to_cursor(&self) -> Self::ScanCursor
fn to_cursor(&self) -> Self::ScanCursor
Turn the input into an independent cursor, suitable for feeding back into a user-facing scanning macro.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'a> ScanInput<'a> for &'a str
This implementation is provided to allow scanners to be used manually with a minimum of fuss.
impl<'a> ScanInput<'a> for &'a str
This implementation is provided to allow scanners to be used manually with a minimum of fuss.
It only supports direct, exact equality comparison.