Skip to content

Commit

Permalink
refactor(parser): Switch to by-ref builder
Browse files Browse the repository at this point in the history
Since nothing is being moved into `Parser`, we don't get any performance
benefit with a moving builder, so switching to a by-ref builder.
  • Loading branch information
epage committed Jul 28, 2019
1 parent 3cf9d86 commit 0396643
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/tokens.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ impl ParserBuilder {
Default::default()
}

pub fn ignore_hex(mut self, yes: bool) -> Self {
pub fn ignore_hex(&mut self, yes: bool) -> &mut Self {
self.ignore_hex = yes;
self
}

pub fn build(self) -> Parser {
pub fn build(&self) -> Parser {
let pattern = r#"\b(\p{Alphabetic}|\d|_|')+\b"#;
let words_str = regex::Regex::new(pattern).unwrap();
let words_bytes = regex::bytes::Regex::new(pattern).unwrap();
Expand Down

0 comments on commit 0396643

Please # to comment.