pub struct CachedRegex { /* private fields */ }
Implementations§
Source§impl CachedRegex
impl CachedRegex
Sourcepub fn new(
cache: Arc<Mutex<RegexCache>>,
source: &str,
) -> Result<CachedRegex, Error>
pub fn new( cache: Arc<Mutex<RegexCache>>, source: &str, ) -> Result<CachedRegex, Error>
Create a new cached Regex
for the given source, checking the syntax is
valid.
Sourcepub fn new_unchecked(cache: Arc<Mutex<RegexCache>>, source: &str) -> CachedRegex
pub fn new_unchecked(cache: Arc<Mutex<RegexCache>>, source: &str) -> CachedRegex
Create a new cached Regex
for the given source, without checking if the
syntax is valid.
Only use this if you know that the syntax is valid or you are ready to handle potential syntax errors later on.
Sourcepub fn replace<'t, R: Replacer>(&self, text: &'t str, rep: R) -> Cow<'t, str>
pub fn replace<'t, R: Replacer>(&self, text: &'t str, rep: R) -> Cow<'t, str>
Refer to Regex::replace
.
Sourcepub fn replace_all<'t, R: Replacer>(
&self,
text: &'t str,
rep: R,
) -> Cow<'t, str>
pub fn replace_all<'t, R: Replacer>( &self, text: &'t str, rep: R, ) -> Cow<'t, str>
Refer to Regex::replace_all
.
Sourcepub fn shortest_match(&self, text: &str) -> Option<usize>
pub fn shortest_match(&self, text: &str) -> Option<usize>
Refer to Regex::shortest_match
.
pub fn captures_len(&self) -> usize
pub fn as_str(&self) -> &str
Trait Implementations§
Source§impl Clone for CachedRegex
impl Clone for CachedRegex
Source§fn clone(&self) -> CachedRegex
fn clone(&self) -> CachedRegex
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for CachedRegex
impl Debug for CachedRegex
Auto Trait Implementations§
impl Freeze for CachedRegex
impl RefUnwindSafe for CachedRegex
impl Send for CachedRegex
impl Sync for CachedRegex
impl Unpin for CachedRegex
impl UnwindSafe for CachedRegex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more