summaryrefslogtreecommitdiffstats
path: root/grep-regex
diff options
context:
space:
mode:
authorAndrew Gallant <jamslam@gmail.com>2018-09-07 11:57:47 -0400
committerAndrew Gallant <jamslam@gmail.com>2018-09-07 12:06:05 -0400
commit3b5cdea862e3c4d6346bbef2449523e8c3790b4e (patch)
tree47602c45ca479da54ab810ae15bbcb9e52fa3cd1 /grep-regex
parent54b3e9eb10bebb33de799bc14616a0d72165583a (diff)
doc: minor touchups to API docs
Diffstat (limited to 'grep-regex')
-rw-r--r--grep-regex/src/matcher.rs11
1 files changed, 9 insertions, 2 deletions
diff --git a/grep-regex/src/matcher.rs b/grep-regex/src/matcher.rs
index 5589508c..831d573b 100644
--- a/grep-regex/src/matcher.rs
+++ b/grep-regex/src/matcher.rs
@@ -323,8 +323,15 @@ impl RegexMatcher {
/// Create a new matcher from the given pattern using the default
/// configuration, but matches lines terminated by `\n`.
///
- /// This returns an error if the given pattern contains a literal `\n`.
- /// Other uses of `\n` (such as in `\s`) are removed transparently.
+ /// This is meant to be a convenience constructor for using a
+ /// `RegexMatcherBuilder` and setting its
+ /// [`line_terminator`](struct.RegexMatcherBuilder.html#method.line_terminator)
+ /// to `\n`. The purpose of using this constructor is to permit special
+ /// optimizations that help speed up line oriented search. These types of
+ /// optimizations are only appropriate when matches span no more than one
+ /// line. For this reason, this constructor will return an error if the
+ /// given pattern contains a literal `\n`. Other uses of `\n` (such as in
+ /// `\s`) are removed transparently.
pub fn new_line_matcher(pattern: &str) -> Result<RegexMatcher, Error> {
RegexMatcherBuilder::new()
.line_terminator(Some(b'\n'))