TaggedCaptures

Struct TaggedCaptures 

Source
pub struct TaggedCaptures<'h, H>
where H: Sliceable + ?Sized,
{ pub captures: Captures<'h, H>, pub action: Option<Action>, }
Expand description

Represents a tagged capture group for a single match position located by a Structex.

If an action was specified at the match point in the original Structex then action will contain that action, otherwise it will be None.

Fields§

§captures: Captures<'h, H>

The match and any captures extracted from it.

§action: Option<Action>

An optional Action assigned by the match if one was specified in the Structex expression.

Implementations§

Source§

impl<'h, H> TaggedCaptures<'h, H>
where H: Sliceable + ?Sized,

Source

pub fn as_slice(&self) -> H::Slice<'_>

Returns the slice of the haystack that matched.

Source

pub fn id(&self) -> Option<usize>

Returns the action id that was associated with the match if one was specified.

Source

pub fn tag(&self) -> Option<char>

Returns the action tag that was associated with the match if one was specified.

Source

pub fn arg(&self) -> Option<&str>

Returns the argument following the action tag that was associated with the match if one was specified.

Source

pub fn has_action(&self) -> bool

Whether or not this match has an assigned Action.

Methods from Deref<Target = Captures<'h, H>>§

Source

pub fn from(&self) -> usize

The byte offset that this match starts at.

Source

pub fn to(&self) -> usize

The byte offset that this match ends at.

Source

pub fn get_match(&self) -> (usize, usize)

The start and end byte offsets of this match.

Source

pub fn get(&self, n: usize) -> Option<(usize, usize)>

The start and end byte offsets of the given submatch.

Submatch 0 is guaranteed to be Some, with get_match available as a convenience method to directly access it. All other submatches may return None if they were not present in the matched pattern.

Source

pub fn len(&self) -> usize

The length of the full match in bytes.

Source

pub fn is_empty(&self) -> bool

Whether or not this match is equal to the empty string.

Source

pub fn match_text(&self) -> H::Slice<'_>

The full text of the match in the original haystack.

Source

pub fn submatch_text(&self, n: usize) -> Option<H::Slice<'_>>

The full text of the submatch, if present, in the original haystack.

Source

pub fn iter_submatches(&self) -> impl Iterator<Item = Option<H::Slice<'_>>>

Iterate over all submatches starting with the full match.

Trait Implementations§

Source§

impl<'h, H> Debug for TaggedCaptures<'h, H>
where H: Sliceable + ?Sized + Debug,

Source§

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

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

impl<'h, H> Deref for TaggedCaptures<'h, H>
where H: Sliceable + ?Sized,

Source§

type Target = Captures<'h, H>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'h, H> PartialEq for TaggedCaptures<'h, H>
where H: Sliceable + ?Sized + PartialEq,

Source§

fn eq(&self, other: &TaggedCaptures<'h, H>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'h, H> Eq for TaggedCaptures<'h, H>
where H: Sliceable + ?Sized + Eq,

Source§

impl<'h, H> StructuralPartialEq for TaggedCaptures<'h, H>
where H: Sliceable + ?Sized,

Auto Trait Implementations§

§

impl<'h, H> Freeze for TaggedCaptures<'h, H>
where H: ?Sized,

§

impl<'h, H> RefUnwindSafe for TaggedCaptures<'h, H>
where H: RefUnwindSafe + ?Sized,

§

impl<'h, H> Send for TaggedCaptures<'h, H>
where H: Sync + ?Sized,

§

impl<'h, H> Sync for TaggedCaptures<'h, H>
where H: Sync + ?Sized,

§

impl<'h, H> Unpin for TaggedCaptures<'h, H>
where H: ?Sized,

§

impl<'h, H> UnwindSafe for TaggedCaptures<'h, H>
where H: RefUnwindSafe + ?Sized,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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 T
where 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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 T
where U: TryFrom<T>,

Source§

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.