Trait RegexTry

Source
pub trait RegexTry<F, E> {
    // Required methods
    fn try_replacen<'t>(
        &self,
        text: &'t str,
        limit: usize,
        rep: F,
    ) -> Result<Cow<'t, str>, E>;
    fn try_replace<'t>(&self, text: &'t str, rep: F) -> Result<Cow<'t, str>, E>;
    fn try_replace_all<'t>(
        &self,
        text: &'t str,
        rep: F,
    ) -> Result<Cow<'t, str>, E>;
}
Expand description

Defines the additional methods for Regex.

The replacer is always a function of type FnMut(&Captures) -> Result<String, E>.

Required Methods§

Source

fn try_replacen<'t>( &self, text: &'t str, limit: usize, rep: F, ) -> Result<Cow<'t, str>, E>

Source

fn try_replace<'t>(&self, text: &'t str, rep: F) -> Result<Cow<'t, str>, E>

Source

fn try_replace_all<'t>(&self, text: &'t str, rep: F) -> Result<Cow<'t, str>, E>

Implementations on Foreign Types§

Source§

impl<F, E> RegexTry<F, E> for Regex
where F: FnMut(&Captures<'_>) -> Result<String, E>,

Source§

fn try_replacen<'t>( &self, text: &'t str, limit: usize, rep: F, ) -> Result<Cow<'t, str>, E>

Source§

fn try_replace<'t>(&self, text: &'t str, rep: F) -> Result<Cow<'t, str>, E>

Source§

fn try_replace_all<'t>(&self, text: &'t str, rep: F) -> Result<Cow<'t, str>, E>

Implementors§