pub struct Spanned<T> { /* private fields */ }
Expand description
You can wrap your input in this struct with Spanned::new
Implementations§
Source§impl<T> Spanned<T>
impl<T> Spanned<T>
pub fn new(data: T, handle_utf8: bool) -> Self
pub fn new_for_ut8(data: T) -> Self
pub fn new_for_ascii(data: T) -> Self
Sourcepub fn byte_offset(&self) -> usize
pub fn byte_offset(&self) -> usize
Get the current byte offset
Trait Implementations§
Source§impl<T, Comp> Compare<Comp> for Spanned<T>where
T: Compare<Comp>,
impl<T, Comp> Compare<Comp> for Spanned<T>where
T: Compare<Comp>,
Source§fn compare(&self, t: Comp) -> CompareResult
fn compare(&self, t: Comp) -> CompareResult
Compares self to another value for equality
Source§fn compare_no_case(&self, t: Comp) -> CompareResult
fn compare_no_case(&self, t: Comp) -> CompareResult
Compares self to another value for equality
independently of the case. Read more
Source§impl<T> ExtendInto for Spanned<T>where
T: ExtendInto,
impl<T> ExtendInto for Spanned<T>where
T: ExtendInto,
Source§type Item = <T as ExtendInto>::Item
type Item = <T as ExtendInto>::Item
The current input type is a sequence of that
Item
type. Read moreSource§type Extender = <T as ExtendInto>::Extender
type Extender = <T as ExtendInto>::Extender
The type that will be produced
Source§fn new_builder(&self) -> Self::Extender
fn new_builder(&self) -> Self::Extender
Create a new
Extend
of the correct typeSource§fn extend_into(&self, acc: &mut Self::Extender)
fn extend_into(&self, acc: &mut Self::Extender)
Accumulate the input into an accumulator
Source§impl<T> FindSubstring<T> for Spanned<T>where
T: FindSubstring<T>,
impl<T> FindSubstring<T> for Spanned<T>where
T: FindSubstring<T>,
Source§fn find_substring(&self, substr: T) -> Option<usize>
fn find_substring(&self, substr: T) -> Option<usize>
Returns the byte position of the substring if it is found
Source§impl<T, Token> FindToken<Token> for Spanned<T>where
T: FindToken<Token>,
impl<T, Token> FindToken<Token> for Spanned<T>where
T: FindToken<Token>,
Source§fn find_token(&self, token: Token) -> bool
fn find_token(&self, token: Token) -> bool
Returns true if self contains the token
Source§impl<T> InputIter for Spanned<T>where
T: InputIter,
impl<T> InputIter for Spanned<T>where
T: InputIter,
Source§type Item = <T as InputIter>::Item
type Item = <T as InputIter>::Item
The current input type is a sequence of that
Item
type. Read moreSource§type Iter = <T as InputIter>::Iter
type Iter = <T as InputIter>::Iter
An iterator over the input type, producing the item and its position
for use with Slice. If we’re iterating over
&str
, the position
corresponds to the byte index of the characterSource§type IterElem = <T as InputIter>::IterElem
type IterElem = <T as InputIter>::IterElem
An iterator over the input type, producing the item
Source§fn iter_indices(&self) -> Self::Iter
fn iter_indices(&self) -> Self::Iter
Returns an iterator over the elements and their byte offsets
Source§fn iter_elements(&self) -> Self::IterElem
fn iter_elements(&self) -> Self::IterElem
Returns an iterator over the elements
Source§impl<T> InputLength for Spanned<T>where
T: InputLength,
impl<T> InputLength for Spanned<T>where
T: InputLength,
Source§impl<T> InputTakeAtPosition for Spanned<T>where
T: InputTakeAtPosition + InputLength + InputIter,
Self: Slice<RangeFrom<usize>> + Slice<RangeTo<usize>> + Clone,
impl<T> InputTakeAtPosition for Spanned<T>where
T: InputTakeAtPosition + InputLength + InputIter,
Self: Slice<RangeFrom<usize>> + Slice<RangeTo<usize>> + Clone,
Source§type Item = <T as InputIter>::Item
type Item = <T as InputIter>::Item
The current input type is a sequence of that
Item
type. Read moreSource§fn split_at_position<P, E: ParseError<Self>>(
&self,
predicate: P,
) -> IResult<Self, Self, E>
fn split_at_position<P, E: ParseError<Self>>( &self, predicate: P, ) -> IResult<Self, Self, E>
Looks for the first element of the input type for which the condition returns true,
and returns the input up to this position. Read more
Source§fn split_at_position1<P, E: ParseError<Self>>(
&self,
predicate: P,
_e: ErrorKind,
) -> IResult<Self, Self, E>
fn split_at_position1<P, E: ParseError<Self>>( &self, predicate: P, _e: ErrorKind, ) -> IResult<Self, Self, E>
Looks for the first element of the input type for which the condition returns true
and returns the input up to this position. Read more
Source§fn split_at_position_complete<P, E: ParseError<Self>>(
&self,
predicate: P,
) -> IResult<Self, Self, E>
fn split_at_position_complete<P, E: ParseError<Self>>( &self, predicate: P, ) -> IResult<Self, Self, E>
Looks for the first element of the input type for which the condition returns true,
and returns the input up to this position. Read more
Source§fn split_at_position1_complete<P, E: ParseError<Self>>(
&self,
predicate: P,
e: ErrorKind,
) -> IResult<Self, Self, E>
fn split_at_position1_complete<P, E: ParseError<Self>>( &self, predicate: P, e: ErrorKind, ) -> IResult<Self, Self, E>
Looks for the first element of the input type for which the condition returns true
and returns the input up to this position. Read more
impl<T: Copy> Copy for Spanned<T>
impl<T: Eq> Eq for Spanned<T>
impl<T> StructuralPartialEq for Spanned<T>
Auto Trait Implementations§
impl<T> Freeze for Spanned<T>where
T: Freeze,
impl<T> RefUnwindSafe for Spanned<T>where
T: RefUnwindSafe,
impl<T> Send for Spanned<T>where
T: Send,
impl<T> Sync for Spanned<T>where
T: Sync,
impl<T> Unpin for Spanned<T>where
T: Unpin,
impl<T> UnwindSafe for Spanned<T>where
T: UnwindSafe,
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