Struct regex::internal::ExecBuilder [−][src]
pub struct ExecBuilder { options: RegexOptions, match_type: Option<MatchType>, bytes: bool, only_utf8: bool, }
Facilitates the construction of an executor by exposing various knobs to control how a regex is executed and what kinds of resources it's permitted to use.
Fields
options: RegexOptions
match_type: Option<MatchType>
bytes: bool
only_utf8: bool
Methods
impl ExecBuilder
[src]
impl ExecBuilder
pub fn new(re: &str) -> Self
[src]
pub fn new(re: &str) -> Self
Create a regex execution builder.
This uses default settings for everything except the regex itself,
which must be provided. Further knobs can be set by calling methods,
and then finally, build
to actually create the executor.
pub fn new_many<I, S>(res: I) -> Self where
S: AsRef<str>,
I: IntoIterator<Item = S>,
[src]
pub fn new_many<I, S>(res: I) -> Self where
S: AsRef<str>,
I: IntoIterator<Item = S>,
Like new, but compiles the union of the given regular expressions.
Note that when compiling 2 or more regular expressions, capture groups
are completely unsupported. (This means both find
and captures
wont work.)
pub fn new_options(opts: RegexOptions) -> Self
[src]
pub fn new_options(opts: RegexOptions) -> Self
Create a regex execution builder.
pub fn automatic(self) -> Self
[src]
pub fn automatic(self) -> Self
Set the matching engine to be automatically determined.
This is the default state and will apply whatever optimizations are possible, such as running a DFA.
This overrides whatever was previously set via the nfa
or
bounded_backtracking
methods.
pub fn nfa(self) -> Self
[src]
pub fn nfa(self) -> Self
Sets the matching engine to use the NFA algorithm no matter what optimizations are possible.
This overrides whatever was previously set via the automatic
or
bounded_backtracking
methods.
pub fn bounded_backtracking(self) -> Self
[src]
pub fn bounded_backtracking(self) -> Self
Sets the matching engine to use a bounded backtracking engine no matter what optimizations are possible.
One must use this with care, since the bounded backtracking engine
uses memory proportion to len(regex) * len(text)
.
This overrides whatever was previously set via the automatic
or
nfa
methods.
pub fn bytes(self, yes: bool) -> Self
[src]
pub fn bytes(self, yes: bool) -> Self
Compiles byte based programs for use with the NFA matching engines.
By default, the NFA engines match on Unicode scalar values. They can be made to use byte based programs instead. In general, the byte based programs are slower because of a less efficient encoding of character classes.
Note that this does not impact DFA matching engines, which always execute on bytes.
pub fn only_utf8(self, yes: bool) -> Self
[src]
pub fn only_utf8(self, yes: bool) -> Self
When disabled, the program compiled may match arbitrary bytes.
When enabled (the default), all compiled programs exclusively match valid UTF-8 bytes.
pub fn unicode(self, yes: bool) -> Self
[src]
pub fn unicode(self, yes: bool) -> Self
Set the Unicode flag.
fn parse(&self) -> Result<Parsed, Error>
[src]
fn parse(&self) -> Result<Parsed, Error>
Parse the current set of patterns into their AST and extract literals.
pub fn build(self) -> Result<Exec, Error>
[src]
pub fn build(self) -> Result<Exec, Error>
Build an executor that can run a regular expression.
Auto Trait Implementations
impl Send for ExecBuilder
impl Send for ExecBuilder
impl Sync for ExecBuilder
impl Sync for ExecBuilder