Trait regex::Replacer [] [src]

pub trait Replacer {
    fn reg_replace<'a>(&'a mut self, caps: &Captures) -> Cow<'a, str>;

    fn no_expand<'a>(&'a mut self) -> Option<Cow<'a, str>> { ... }
}

Replacer describes types that can be used to replace matches in a string.

Required Methods

fn reg_replace<'a>(&'a mut self, caps: &Captures) -> Cow<'a, str>

Returns a possibly owned string that is used to replace the match corresponding to the caps capture group.

The 'a lifetime refers to the lifetime of a borrowed string when a new owned string isn't needed (e.g., for NoExpand).

Provided Methods

fn no_expand<'a>(&'a mut self) -> Option<Cow<'a, str>>

Returns a possibly owned string that never needs expansion.

Implementors