pub struct PyCaptures<'h> { /* private fields */ }Expand description
The capture groups of a single match.
Read eagerly at match time rather than borrowing the engine’s own captures,
so nothing here is tied to the shape of a fancy-regex type. That is what
lets the requirement on that crate move without it being a break for
consumers (#177).
Implementations§
Source§impl<'h> PyCaptures<'h>
impl<'h> PyCaptures<'h>
Sourcepub fn get(&self, index: usize) -> Option<PyMatch<'h>>
pub fn get(&self, index: usize) -> Option<PyMatch<'h>>
Group index, or None when that group did not participate in the
match. Group 0 is the whole match.
Sourcepub fn name(&self, name: &str) -> Option<PyMatch<'h>>
pub fn name(&self, name: &str) -> Option<PyMatch<'h>>
The group named name, or None when it did not participate or the
pattern has no such group.
Sourcepub fn named(&self) -> impl Iterator<Item = (&str, Option<PyMatch<'h>>)> + '_
pub fn named(&self) -> impl Iterator<Item = (&str, Option<PyMatch<'h>>)> + '_
Every named group in group order, matched or not.
Python’s groupdict() carries an unmatched named group as None rather
than dropping it, and so does this — which is what the step detail
renders.
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Whether there are no groups at all.
Never true for a match produced by PyRegex::captures — group 0
always exists — but len without is_empty is a clippy warning and the
answer is well defined.
Trait Implementations§
Source§impl<'h> Clone for PyCaptures<'h>
impl<'h> Clone for PyCaptures<'h>
Auto Trait Implementations§
impl<'h> Freeze for PyCaptures<'h>
impl<'h> RefUnwindSafe for PyCaptures<'h>
impl<'h> Send for PyCaptures<'h>
impl<'h> Sync for PyCaptures<'h>
impl<'h> Unpin for PyCaptures<'h>
impl<'h> UnsafeUnpin for PyCaptures<'h>
impl<'h> UnwindSafe for PyCaptures<'h>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.