From 67fc639e0cf84aab9d1555356a99a70ae51a5b10 Mon Sep 17 00:00:00 2001 From: Makoto Onuki Date: Tue, 27 Sep 2016 10:56:45 -0700 Subject: [PATCH] Make matches()/exec() work with non-mut pcre --- src/lib.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 9a8215b..4525f7e 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -390,7 +390,7 @@ impl Pcre { /// If a regular expression will be used often, it might be worth studying it to possibly /// speed up matching. See the [study()](#method.study) method. #[inline] - pub fn exec<'a, 'p>(&'p mut self, subject: &'a str) -> Option> { + pub fn exec<'a, 'p>(&'p self, subject: &'a str) -> Option> { self.exec_from(subject, 0) } @@ -411,7 +411,7 @@ impl Pcre { /// If a regular expression will be used often, it might be worth studying it to possibly /// speed up matching. See the [study()](#method.study) method. #[inline] - pub fn exec_from<'a, 'p>(&'p mut self, subject: &'a str, startoffset: usize) -> Option> { + pub fn exec_from<'a, 'p>(&'p self, subject: &'a str, startoffset: usize) -> Option> { let no_options: EnumSet = EnumSet::new(); self.exec_from_with_options(subject, startoffset, &no_options) } @@ -436,7 +436,7 @@ impl Pcre { /// If a regular expression will be used often, it might be worth studying it to possibly /// speed up matching. See the [study()](#method.study) method. #[inline] - pub fn exec_from_with_options<'a, 'p>(&'p mut self, subject: &'a str, startoffset: usize, options: &EnumSet) -> Option> { + pub fn exec_from_with_options<'a, 'p>(&'p self, subject: &'a str, startoffset: usize, options: &EnumSet) -> Option> { let ovecsize = (self.capture_count_ + 1) * 3; let mut ovector = vec![0 as c_int; ovecsize as usize]; @@ -496,7 +496,7 @@ impl Pcre { /// # Argument /// * `subject` - The subject string. #[inline] - pub fn matches<'a, 'p>(&'p mut self, subject: &'a str) -> MatchIterator<'a, 'p> { + pub fn matches<'a, 'p>(&'p self, subject: &'a str) -> MatchIterator<'a, 'p> { let no_options: EnumSet = EnumSet::new(); self.matches_with_options(subject, &no_options) } @@ -509,7 +509,7 @@ impl Pcre { /// * `options` - Bitwise-OR'd matching options. See the libpcre manpages, `man 3 pcre_exec`, /// for more information. #[inline] - pub fn matches_with_options<'a, 'p>(&'p mut self, subject: &'a str, options: &EnumSet) -> MatchIterator<'a, 'p> { + pub fn matches_with_options<'a, 'p>(&'p self, subject: &'a str, options: &EnumSet) -> MatchIterator<'a, 'p> { unsafe { let ovecsize = (self.capture_count_ + 1) * 3; MatchIterator {