Trait regex::Replacer [] [src]

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

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

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

Required Methods

fn reg_replace(&mut self, caps: &Captures) -> Cow<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(&mut self) -> Option<Cow<str>>

Returns a possibly owned string that never needs expansion.

Implementors