pub struct Tag<'slice, 'seg>(pub &'slice [&'seg str]);
Expand description

A type usable as tag for a parser without having to create a proper Span.

Tuple Fields§

§0: &'slice [&'seg str]

A sequence of segment contents.

Implementations§

source§

impl<'slice, 'seg> Tag<'slice, 'seg>

source

pub fn len(self) -> usize

Returns the length of the tag in segments/grapheme clusters.

source

pub fn into_fn<T, E>(self) -> impl FnMut(T) -> IResult<T, T, E> + 'slice + 'segwhere T: InputTake + Compare<Self>, E: ParseError<T>, 'slice: 'seg,

Converts this tag parsed into a function (also a parser).

source

pub fn segments(self) -> SegmentContents<'slice, 'seg>

Returns an iterator over the contents of segments of this tag.

Trait Implementations§

source§

impl<'slice, 'seg> Clone for Tag<'slice, 'seg>

source§

fn clone(&self) -> Tag<'slice, 'seg>

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<'slice, 'seg, 'span> Compare<&'span Span> for Tag<'slice, 'seg>

source§

fn compare(&self, input: &'span Span) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'span Span) -> CompareResult

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

impl<'slice, 'seg, 'span> Compare<&'span SpanContent> for Tag<'slice, 'seg>

source§

fn compare(&self, input: &'span SpanContent) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'span SpanContent) -> CompareResult

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

impl<'slice, 'seg, 'tag, 'span> Compare<&'tag Tag<'slice, 'seg>> for &'span Span

source§

fn compare(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice, 'seg, 'tag, 'span> Compare<&'tag Tag<'slice, 'seg>> for &'span SpanContent

source§

fn compare(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice, 'seg, 'tag> Compare<&'tag Tag<'slice, 'seg>> for Span

source§

fn compare(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice, 'seg, 'tag> Compare<&'tag Tag<'slice, 'seg>> for SpanContent

source§

fn compare(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'tag Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice0, 'seg0, 'slice1, 'seg1, 'tag> Compare<&'tag Tag<'slice1, 'seg1>> for Tag<'slice0, 'seg0>

source§

fn compare(&self, input: &'tag Tag<'slice1, 'seg1>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'tag Tag<'slice1, 'seg1>) -> CompareResult

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

impl<'slice0, 'seg0, 'slice1, 'seg1, 'tag0, 'tag1> Compare<&'tag1 Tag<'slice1, 'seg1>> for &'tag0 Tag<'slice0, 'seg0>

source§

fn compare(&self, input: &'tag1 Tag<'slice1, 'seg1>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: &'tag1 Tag<'slice1, 'seg1>) -> CompareResult

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

impl<'slice, 'seg, 'span> Compare<Span> for Tag<'slice, 'seg>

source§

fn compare(&self, input: Span) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: Span) -> CompareResult

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

impl<'slice, 'seg, 'span> Compare<SpanContent> for Tag<'slice, 'seg>

source§

fn compare(&self, input: SpanContent) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: SpanContent) -> CompareResult

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

impl<'slice, 'seg, 'span> Compare<Tag<'slice, 'seg>> for &'span Span

source§

fn compare(&self, input: Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice, 'seg, 'span> Compare<Tag<'slice, 'seg>> for &'span SpanContent

source§

fn compare(&self, input: Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice, 'seg> Compare<Tag<'slice, 'seg>> for Span

source§

fn compare(&self, input: Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice, 'seg> Compare<Tag<'slice, 'seg>> for SpanContent

source§

fn compare(&self, input: Tag<'slice, 'seg>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: Tag<'slice, 'seg>) -> CompareResult

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

impl<'slice0, 'seg0, 'slice1, 'seg1, 'tag> Compare<Tag<'slice1, 'seg1>> for &'tag Tag<'slice0, 'seg0>

source§

fn compare(&self, input: Tag<'slice1, 'seg1>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: Tag<'slice1, 'seg1>) -> CompareResult

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

impl<'slice0, 'seg0, 'slice1, 'seg1> Compare<Tag<'slice1, 'seg1>> for Tag<'slice0, 'seg0>

source§

fn compare(&self, input: Tag<'slice1, 'seg1>) -> CompareResult

Compares self to another value for equality
source§

fn compare_no_case(&self, input: Tag<'slice1, 'seg1>) -> CompareResult

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

impl<'slice, 'seg> Debug for Tag<'slice, 'seg>

source§

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

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

impl<'slice, 'seg, 'tag, 'tok> FindToken<&'tok LocatedSegment> for &'tag Tag<'slice, 'seg>

source§

fn find_token(&self, token: &'tok LocatedSegment) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg, 'tok> FindToken<&'tok LocatedSegment> for Tag<'slice, 'seg>

source§

fn find_token(&self, token: &'tok LocatedSegment) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg, 'tag, 'tok> FindToken<&'tok str> for &'tag Tag<'slice, 'seg>

source§

fn find_token(&self, token: &'tok str) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg, 'tok> FindToken<&'tok str> for Tag<'slice, 'seg>

source§

fn find_token(&self, token: &'tok str) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg, 'tag, 'tok, 'tok_ref> FindToken<&'tok_ref &'tok str> for &'tag Tag<'slice, 'seg>

source§

fn find_token(&self, token: &'tok_ref &'tok str) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg, 'tok, 'tok_ref> FindToken<&'tok_ref &'tok str> for Tag<'slice, 'seg>

source§

fn find_token(&self, token: &'tok_ref &'tok str) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg, 'tag, 'tok> FindToken<LocatedSegment> for &'tag Tag<'slice, 'seg>

source§

fn find_token(&self, token: LocatedSegment) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg, 'tok> FindToken<LocatedSegment> for Tag<'slice, 'seg>

source§

fn find_token(&self, token: LocatedSegment) -> bool

Returns true if self contains the token
source§

impl<'slice, 'seg> Hash for Tag<'slice, 'seg>

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl<'slice, 'seg> InputIter for Tag<'slice, 'seg>

§

type Item = &'seg str

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

type Iter = Enumerate<<Tag<'slice, 'seg> as InputIter>::IterElem>

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 = SegmentContents<'slice, 'seg>

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<'slice, 'seg> InputLength for Tag<'slice, 'seg>

source§

fn input_len(&self) -> usize

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

impl<'slice, 'seg> InputTake for Tag<'slice, 'seg>

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<'slice, 'seg> InputTakeAtPosition for Tag<'slice, 'seg>

§

type Item = &'seg str

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

fn split_at_position<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<P, E>( &self, predicate: P, e: 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_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_position1_complete<P, E>( &self, predicate: P, e: 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<'slice, 'seg> IntoIterator for Tag<'slice, 'seg>

§

type Item = &'seg str

The type of the elements being iterated over.
§

type IntoIter = SegmentContents<'slice, 'seg>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<'slice, 'seg> Offset for Tag<'slice, 'seg>

source§

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

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

impl<'slice, 'seg> Ord for Tag<'slice, 'seg>

source§

fn cmp(&self, other: &Tag<'slice, 'seg>) -> 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<'slice, 'seg, T, E> Parser<T, T, E> for Tag<'slice, 'seg>where T: InputTake + Compare<Self>, E: ParseError<T>,

source§

fn parse(&mut self, input: T) -> IResult<T, T, E>

A parser takes in input type, and returns a Result containing either the remaining input and the output value, or an error
source§

fn map<G, O2>(self, g: G) -> Map<Self, G, O>where G: Fn(O) -> O2, Self: Sized,

Maps a function over the result of a parser
source§

fn flat_map<G, H, O2>(self, g: G) -> FlatMap<Self, G, O>where G: FnMut(O) -> H, H: Parser<I, O2, E>, Self: Sized,

Creates a second parser from the output of the first one, then apply over the rest of the input
source§

fn and_then<G, O2>(self, g: G) -> AndThen<Self, G, O>where G: Parser<O, O2, E>, Self: Sized,

Applies a second parser over the output of the first one
source§

fn and<G, O2>(self, g: G) -> And<Self, G>where G: Parser<I, O2, E>, Self: Sized,

Applies a second parser after the first one, return their results as a tuple
source§

fn or<G>(self, g: G) -> Or<Self, G>where G: Parser<I, O, E>, Self: Sized,

Applies a second parser over the input if the first one failed
source§

fn into<O2, E2>(self) -> Into<Self, O, O2, E, E2>where O2: From<O>, E2: From<E>, Self: Sized,

automatically converts the parser’s output and error values to another type, as long as they implement the From trait
source§

impl<'slice, 'seg, T> PartialEq<T> for Tag<'slice, 'seg>where [&'seg str]: PartialEq<T>,

source§

fn eq(&self, other: &T) -> 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<'slice, 'seg> PartialEq<Tag<'slice, 'seg>> for Tag<'slice, 'seg>

source§

fn eq(&self, other: &Tag<'slice, 'seg>) -> 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<'slice, 'seg> PartialOrd<Tag<'slice, 'seg>> for Tag<'slice, 'seg>

source§

fn partial_cmp(&self, other: &Tag<'slice, 'seg>) -> 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<'slice, 'seg, R> Slice<R> for Tag<'slice, 'seg>where R: RangeBounds<usize>,

source§

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

Slices self according to the range argument
source§

impl<'slice, 'seg> Copy for Tag<'slice, 'seg>

source§

impl<'slice, 'seg> Eq for Tag<'slice, 'seg>

source§

impl<'slice, 'seg> StructuralEq for Tag<'slice, 'seg>

source§

impl<'slice, 'seg> StructuralPartialEq for Tag<'slice, 'seg>

Auto Trait Implementations§

§

impl<'slice, 'seg> RefUnwindSafe for Tag<'slice, 'seg>

§

impl<'slice, 'seg> Send for Tag<'slice, 'seg>

§

impl<'slice, 'seg> Sync for Tag<'slice, 'seg>

§

impl<'slice, 'seg> Unpin for Tag<'slice, 'seg>

§

impl<'slice, 'seg> UnwindSafe for Tag<'slice, 'seg>

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.