Struct nom8::input::Located

source ·
pub struct Located<I> { /* private fields */ }
Expand description

Allow collecting the span of a parsed token

See Parser::span and Parser::with_span for more details

Implementations§

source§

impl<I> Located<I>where I: Clone + IntoOutput + Offset,

source

pub fn new(input: I) -> Self

Wrap another Input with span tracking

Trait Implementations§

source§

impl<I> AsBytes for Located<I>where I: AsBytes,

source§

fn as_bytes(&self) -> &[u8]

Casts the input type to a byte slice
source§

impl<I> AsRef<I> for Located<I>

source§

fn as_ref(&self) -> &I

Converts this type into a shared reference of the (usually inferred) input type.
source§

impl<I: Clone> Clone for Located<I>

source§

fn clone(&self) -> Located<I>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<I, U> Compare<U> for Located<I>where I: Compare<U>,

source§

fn compare(&self, other: U) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, other: U) -> CompareResult

Compares self to another value for equality independently of the case. Read more
source§

impl<I: Debug> Debug for Located<I>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<I: Default> Default for Located<I>

source§

fn default() -> Located<I>

Returns the “default value” for a type. Read more
source§

impl<I> Deref for Located<I>

§

type Target = I

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<I> ExtendInto for Located<I>where I: ExtendInto,

§

type Item = <I as ExtendInto>::Item

The current input type is a sequence of that Item type. Read more
§

type Extender = <I as ExtendInto>::Extender

The type that will be produced
source§

fn new_builder(&self) -> Self::Extender

Create a new Extend of the correct type
source§

fn extend_into(&self, extender: &mut Self::Extender)

Accumulate the input into an accumulator
source§

impl<I, T> FindSubstring<T> for Located<I>where I: FindSubstring<T>,

source§

fn find_substring(&self, substr: T) -> Option<usize>

Returns the byte position of the substring if it is found
source§

impl<I> HexDisplay for Located<I>where I: HexDisplay,

source§

fn to_hex(&self, chunk_size: usize) -> String

Converts the value of self to a hex dump, returning the owned String.
source§

fn to_hex_from(&self, chunk_size: usize, from: usize) -> String

Converts the value of self to a hex dump beginning at from address, returning the owned String.
source§

impl<I> InputIsStreaming<false> for Located<I>where I: InputIsStreaming<false>,

§

type Complete = Located<I>

Complete counterpart Read more
§

type Streaming = Located<<I as InputIsStreaming<false>>::Streaming>

Streaming counterpart Read more
source§

fn into_complete(self) -> Self::Complete

Convert to complete counterpart
source§

fn into_streaming(self) -> Self::Streaming

Convert to streaming counterpart
source§

impl<I> InputIsStreaming<true> for Located<I>where I: InputIsStreaming<true>,

§

type Complete = Located<<I as InputIsStreaming<true>>::Complete>

Complete counterpart Read more
§

type Streaming = Located<I>

Streaming counterpart Read more
source§

fn into_complete(self) -> Self::Complete

Convert to complete counterpart
source§

fn into_streaming(self) -> Self::Streaming

Convert to streaming counterpart
source§

impl<I> InputIter for Located<I>where I: InputIter,

§

type Item = <I as InputIter>::Item

The current input type is a sequence of that Item type. Read more
§

type Iter = <I 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 character
§

type IterElem = <I as InputIter>::IterElem

An iterator over the input type, producing the item
source§

fn iter_indices(&self) -> Self::Iter

Returns an iterator over the elements and their byte offsets
source§

fn iter_elements(&self) -> Self::IterElem

Returns an iterator over the elements
source§

fn position<P>(&self, predicate: P) -> Option<usize>where P: Fn(Self::Item) -> bool,

Finds the byte position of the element
source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

Get the byte offset from the element’s position in the stream
source§

impl<I> InputLength for Located<I>where I: InputLength,

source§

fn input_len(&self) -> usize

Calculates the input length, as indicated by its name, and the name of the trait itself
source§

impl<I> InputTake for Located<I>where I: InputTake + Clone,

source§

fn take(&self, count: usize) -> Self

Returns a slice of count bytes. panics if count > length
source§

fn take_split(&self, count: usize) -> (Self, Self)

Split the stream at the count byte offset. panics if count > length
source§

impl<I> InputTakeAtPosition for Located<I>where I: InputTakeAtPosition + Clone,

§

type Item = <I as InputTakeAtPosition>::Item

The current input type is a sequence of that Item type. Read more
source§

fn split_at_position_complete<P, E>( &self, predicate: P ) -> IResult<Self, Self, E>where P: Fn(Self::Item) -> bool, E: ParseError<Self>,

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_streaming<P, E>( &self, predicate: P ) -> IResult<Self, Self, E>where P: Fn(Self::Item) -> bool, E: ParseError<Self>,

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_streaming<P, E>( &self, predicate: P, kind: ErrorKind ) -> IResult<Self, Self, E>where P: Fn(Self::Item) -> bool, E: ParseError<Self>,

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>( &self, predicate: P, kind: ErrorKind ) -> IResult<Self, Self, E>where P: Fn(Self::Item) -> bool, E: ParseError<Self>,

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§

impl<I> IntoOutput for Located<I>where I: IntoOutput,

§

type Output = <I as IntoOutput>::Output

Output type
source§

fn into_output(self) -> Self::Output

Convert an Input into an appropriate Output type
source§

fn merge_output(self, inner: Self::Output) -> Self

Convert an Output type to be used as Input
source§

impl<I> Location for Located<I>where I: Clone + IntoOutput + Offset,

source§

fn location(&self) -> usize

Number of indices input has advanced since start of parsing
source§

impl<I> Offset for Located<I>where I: Offset,

source§

fn offset(&self, other: &Self) -> usize

Offset between the first byte of self and the first byte of the argument
source§

impl<I: Ord> Ord for Located<I>

source§

fn cmp(&self, other: &Located<I>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · source§

fn max(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · source§

fn min(self, other: Self) -> Selfwhere Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · source§

fn clamp(self, min: Self, max: Self) -> Selfwhere Self: Sized + PartialOrd<Self>,

Restrict a value to a certain interval. Read more
source§

impl<I, R> ParseTo<R> for Located<I>where I: ParseTo<R>,

source§

fn parse_to(&self) -> Option<R>

Succeeds if parse() succeeded. The byte slice implementation will first convert it to a &str, then apply the parse() function
source§

impl<I: PartialEq> PartialEq<Located<I>> for Located<I>

source§

fn eq(&self, other: &Located<I>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<I: PartialOrd> PartialOrd<Located<I>> for Located<I>

source§

fn partial_cmp(&self, other: &Located<I>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · source§

fn lt(&self, other: &Rhs) -> bool

This method tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · source§

fn le(&self, other: &Rhs) -> bool

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · source§

fn gt(&self, other: &Rhs) -> bool

This method tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · source§

fn ge(&self, other: &Rhs) -> bool

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more
source§

impl<I, R> Slice<R> for Located<I>where I: Slice<R> + Clone,

source§

fn slice(&self, range: R) -> Self

Slices self according to the range argument
source§

impl<I: Copy> Copy for Located<I>

source§

impl<I: Eq> Eq for Located<I>

source§

impl<I> StructuralEq for Located<I>

source§

impl<I> StructuralPartialEq for Located<I>

Auto Trait Implementations§

§

impl<I> RefUnwindSafe for Located<I>where I: RefUnwindSafe,

§

impl<I> Send for Located<I>where I: Send,

§

impl<I> Sync for Located<I>where I: Sync,

§

impl<I> Unpin for Located<I>where I: Unpin,

§

impl<I> UnwindSafe for Located<I>where I: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.