Struct grep::GrepBuilder
[−]
[src]
pub struct GrepBuilder { /* fields omitted */ }
A builder for a grep searcher.
Methods
impl GrepBuilder
[src]
fn new(pattern: &str) -> GrepBuilder
[src]
Create a new builder for line searching.
The pattern given should be a regular expression. The precise syntax supported is documented on the regex crate.
fn line_terminator(self, ascii_byte: u8) -> GrepBuilder
[src]
Set the line terminator.
The line terminator can be any ASCII character and serves to delineate the match boundaries in the text searched.
This panics if ascii_byte
is greater than 0x7F
(i.e., not ASCII).
fn case_insensitive(self, yes: bool) -> GrepBuilder
[src]
Set the case sensitive flag (i
) on the regex.
fn case_smart(self, yes: bool) -> GrepBuilder
[src]
Whether to enable smart case search or not (disabled by default).
Smart case uses case insensitive search if the regex is contains all lowercase literal characters. Otherwise, a case sensitive search is used instead.
Enabling the case_insensitive flag overrides this.
fn size_limit(self, limit: usize) -> GrepBuilder
[src]
Set the approximate size limit of the compiled regular expression.
This roughly corresponds to the number of bytes occupied by a single compiled program. If the program exceeds this number, then a compilation error is returned.
fn dfa_size_limit(self, limit: usize) -> GrepBuilder
[src]
Set the approximate size of the cache used by the DFA.
This roughly corresponds to the number of bytes that the DFA will use while searching.
Note that this is a per thread limit. There is no way to set a global limit. In particular, if a regex is used from multiple threads simulanteously, then each thread may use up to the number of bytes specified here.
fn build(self) -> Result<Grep>
[src]
Create a line searcher.
If there was a problem parsing or compiling the regex with the given options, then an error is returned.
Trait Implementations
impl Clone for GrepBuilder
[src]
fn clone(&self) -> GrepBuilder
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more