Struct Capture

pub struct Capture { pub index: u32, pub name: Option<Box<str>>, pub sub: Box<Hir> }

The high-level intermediate representation for a capturing group.

A capturing group always has an index and a child expression. It may also have a name associated with it (e.g., (?P<foo>\w)), but it's not necessary.

Note that there is no explicit representation of a non-capturing group in a Hir. Instead, non-capturing grouping is handled automatically by the recursive structure of the Hir itself.

Fields

index: u32

The capture index of the capture.

name: Option<Box<str>>

The name of the capture, if it exists.

sub: Box<Hir>

The expression inside the capturing group, which may be empty.

Trait Implementations

impl Clone for Capture

fn clone(&self) -> Self

impl Debug for Capture

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

impl Eq for Capture

impl PartialEq for Capture

fn eq(&self, other: &Self) -> bool

impl StructuralPartialEq for Capture

Auto Trait Implementations

impl Freeze for Capture

impl RefUnwindSafe for Capture

impl Send for Capture

impl Sync for Capture

impl Unpin for Capture

impl UnsafeUnpin for Capture

impl UnwindSafe for Capture

Blanket Implementations

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

fn type_id(&self) -> TypeId

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

fn borrow(&self) -> &T

impl<T> BorrowMut<T> for Capture where T: ?Sized,

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

impl<T> CloneToUninit for Capture where T: Clone,

unsafe fn clone_to_uninit(&self, dest: *mut u8)

impl<T> From<T> for Capture

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> ToOwned for Capture where T: Clone,

type Owned = T;
fn to_owned(&self) -> T
fn clone_into(&self, target: &mut T)

impl<T, U> Into<U> for Capture where U: From<T>,

fn into(self) -> U

Calls U::from(self).

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

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

type Error = never;
fn try_from(value: U) -> Result<T, never>

impl<T, U> TryInto<U> for Capture where U: TryFrom<T>,

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