Captures

Struct Captures 

Source
pub struct Captures<'a>(/* private fields */);
Expand description

Implementations§

Source§

impl<'a> Captures<'a>

Source

pub fn new<'b: 'a>(regex: &'a Regex, s: &'b str) -> Result<Captures<'a>>

Collect captures on a regex

Source

pub fn get<A: From<&'a str>>(&'a self, n: usize) -> Result<A>

Convert a numeric capture group using From<&str>.

Source

pub fn parse_get<A>(&'a self, n: usize) -> Result<A>
where A: FromStr, A::Err: ToString,

Attempt parsing a numeric capture group using FromStr.

Source

pub fn try_get<A>(&'a self, n: usize) -> Result<A>
where A: TryFrom<&'a str>, A::Error: ToString,

Try converting a numeric capture group using TryFrom<&str>.

Source

pub fn name<'b, A: From<&'a str>>(&'a self, name: &'b str) -> Result<A>

Convert a named capture group using From<&str>.

Source

pub fn parse_name<'b, A>(&'a self, name: &'b str) -> Result<A>
where A: FromStr, A::Err: Display,

Attempt parsing a named capture group using FromStr.

Source

pub fn try_name<'b, A>(&'a self, name: &'b str) -> Result<A>
where A: TryFrom<&'a str>, A::Error: Display,

Try converting a named capture group using TryFrom<&str>.

Auto Trait Implementations§

§

impl<'a> Freeze for Captures<'a>

§

impl<'a> RefUnwindSafe for Captures<'a>

§

impl<'a> Send for Captures<'a>

§

impl<'a> Sync for Captures<'a>

§

impl<'a> Unpin for Captures<'a>

§

impl<'a> UnwindSafe for Captures<'a>

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<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.