pub struct StrCursor<'a, Cmp = ExactCompare, Space = IgnoreSpace, Word = Wordish>{ /* private fields */ }
Expand description
Basic cursor implementation wrapping a string slice.
The Cmp
parameter can be used to control the string comparison logic used.
Implementations§
Trait Implementations§
Source§impl<'a, Cmp, Space, Word> ScanCursor<'a> for StrCursor<'a, Cmp, Space, Word>
impl<'a, Cmp, Space, Word> ScanCursor<'a> for StrCursor<'a, Cmp, Space, Word>
Source§fn try_end(self) -> Result<(), (ScanError, Self)>
fn try_end(self) -> Result<(), (ScanError, Self)>
Assert that the input has been exhausted, or that the current position is a valid place to “stop”.
Source§fn try_scan<F, Out>(self, f: F) -> Result<(Out, Self), (ScanError, Self)>
fn try_scan<F, Out>(self, f: F) -> Result<(Out, Self), (ScanError, Self)>
Scan a value from the current position. The closure will be called with 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. Read more
Source§fn try_scan_raw<F, Out>(self, f: F) -> Result<(Out, Self), (ScanError, Self)>
fn try_scan_raw<F, Out>(self, f: F) -> Result<(Out, Self), (ScanError, Self)>
Performs the same task as
try_scan
, except that it does not perform whitespace stripping.Source§impl<'a, Cmp, Space, Word> ScanInput<'a> for StrCursor<'a, Cmp, Space, Word>
impl<'a, Cmp, Space, Word> ScanInput<'a> for StrCursor<'a, Cmp, Space, Word>
Source§type ScanCursor = StrCursor<'a, Cmp, Space, Word>
type ScanCursor = StrCursor<'a, Cmp, Space, Word>
Corresponding cursor type.
Source§type StrCompare = Cmp
type StrCompare = Cmp
Marker type used to do string comparisons.
Source§fn 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. Read more
Source§fn 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.
impl<'a, Cmp, Space, Word> Copy for StrCursor<'a, Cmp, Space, Word>
Auto Trait Implementations§
impl<'a, Cmp, Space, Word> Freeze for StrCursor<'a, Cmp, Space, Word>
impl<'a, Cmp, Space, Word> RefUnwindSafe for StrCursor<'a, Cmp, Space, Word>
impl<'a, Cmp, Space, Word> Send for StrCursor<'a, Cmp, Space, Word>
impl<'a, Cmp, Space, Word> Sync for StrCursor<'a, Cmp, Space, Word>
impl<'a, Cmp, Space, Word> Unpin for StrCursor<'a, Cmp, Space, Word>
impl<'a, Cmp, Space, Word> UnwindSafe for StrCursor<'a, Cmp, Space, Word>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'a, T> IntoScanCursor<'a> for Twhere
T: 'a + ScanCursor<'a>,
impl<'a, T> IntoScanCursor<'a> for Twhere
T: 'a + ScanCursor<'a>,
Source§fn into_scan_cursor(self) -> <T as IntoScanCursor<'a>>::Output
fn into_scan_cursor(self) -> <T as IntoScanCursor<'a>>::Output
Convert this into a scannable cursor.