pub trait ReplaceWordwhere
Self: PatternReplace,{
// Required methods
fn replace_word_bounds(
&self,
word: &str,
replacement: &str,
bounds: WordBounds,
case_insensitive: bool,
) -> Self
where Self: Sized;
fn replace_word(
&self,
word: &str,
replacement: &str,
case_insensitive: bool,
) -> Self
where Self: Sized;
fn replace_words(
&self,
pairs: &[(&str, &str)],
case_insensitive: bool,
) -> Self
where Self: Sized;
fn replace_word_sets(&self, pairs: &[(&str, &str, bool)]) -> Self
where Self: Sized;
// Provided methods
fn replace_word_ci(&self, word: &str, replacement: &str) -> Self
where Self: Sized { ... }
fn replace_word_cs(&self, word: &str, replacement: &str) -> Self
where Self: Sized { ... }
fn replace_words_ci(&self, pairs: &[(&str, &str)]) -> Self
where Self: Sized { ... }
fn replace_words_cs(&self, pairs: &[(&str, &str)]) -> Self
where Self: Sized { ... }
}
Expand description
Methods for whole or partial word replacements
Required Methods§
Sourcefn replace_word_bounds(
&self,
word: &str,
replacement: &str,
bounds: WordBounds,
case_insensitive: bool,
) -> Selfwhere
Self: Sized,
fn replace_word_bounds(
&self,
word: &str,
replacement: &str,
bounds: WordBounds,
case_insensitive: bool,
) -> Selfwhere
Self: Sized,
Replace words with boundary and case_insensitive options
Sourcefn replace_word(
&self,
word: &str,
replacement: &str,
case_insensitive: bool,
) -> Selfwhere
Self: Sized,
fn replace_word(
&self,
word: &str,
replacement: &str,
case_insensitive: bool,
) -> Selfwhere
Self: Sized,
Replace whole words with case_insensitive options
Provided Methods§
Sourcefn replace_word_ci(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
fn replace_word_ci(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
Replace whole words with in case-insensitive mode
Sourcefn replace_word_cs(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
fn replace_word_cs(&self, word: &str, replacement: &str) -> Selfwhere
Self: Sized,
Replace whole words with in case-sensitive mode
Sourcefn replace_words_ci(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
fn replace_words_ci(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
Replace one or pairs of whole words in case-insensitive mode
Sourcefn replace_words_cs(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
fn replace_words_cs(&self, pairs: &[(&str, &str)]) -> Selfwhere
Self: Sized,
Replace one or pairs of whole words in case-sensitive mode
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl ReplaceWord for String
Methods for whole or partial word replacements
impl ReplaceWord for String
Methods for whole or partial word replacements
Source§fn replace_word_bounds(
&self,
word: &str,
replacement: &str,
bounds: WordBounds,
case_insensitive: bool,
) -> String
fn replace_word_bounds( &self, word: &str, replacement: &str, bounds: WordBounds, case_insensitive: bool, ) -> String
Replace words with boundary and case_insensitive options
Source§fn replace_word(
&self,
word: &str,
replacement: &str,
case_insensitive: bool,
) -> String
fn replace_word( &self, word: &str, replacement: &str, case_insensitive: bool, ) -> String
Replace whole words with case_insensitive options