diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-06-09 14:28:59 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-06-09 14:28:59 +0200 |
commit | 344c3db875056d4aec509f24fb2dbeaf7e2a14b6 (patch) | |
tree | 88210fc3caeadccc93abf699936f78d7e6fe1396 /src/tokenizer.rs | |
parent | cba78821ed13d5a92c74d092914fbad4c842f889 (diff) | |
download | markdown-rs-344c3db875056d4aec509f24fb2dbeaf7e2a14b6.tar.gz markdown-rs-344c3db875056d4aec509f24fb2dbeaf7e2a14b6.tar.bz2 markdown-rs-344c3db875056d4aec509f24fb2dbeaf7e2a14b6.zip |
Refactor to pass more slices around
Diffstat (limited to '')
-rw-r--r-- | src/tokenizer.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/tokenizer.rs b/src/tokenizer.rs index 4239520..faee8d9 100644 --- a/src/tokenizer.rs +++ b/src/tokenizer.rs @@ -334,7 +334,7 @@ impl Tokenizer { tokenizer.point ); let result = done(ok); - tokenizer.feed(codes, result, false) + tokenizer.feed(&codes, result, false) }, ) } @@ -373,7 +373,7 @@ impl Tokenizer { tokenizer.point ); let result = done(ok); - tokenizer.feed(codes, result, false) + tokenizer.feed(&codes, result, false) }, ) } @@ -440,11 +440,11 @@ impl Tokenizer { /// When `done: true` is passed, the EOF is fed. pub fn feed( &mut self, - codes: Vec<Code>, + codes: &[Code], start: impl FnOnce(&mut Tokenizer, Code) -> StateFnResult + 'static, drain: bool, ) -> StateFnResult { - let mut codes = codes; + let codes = codes; let mut state = State::Fn(Box::new(start)); let mut index = 0; @@ -474,7 +474,7 @@ impl Tokenizer { // Yield to a higher loop if we shouldn’t feed EOFs. if !drain { - return (state, Some(codes.split_off(index))); + return (state, Some(codes[index..].to_vec())); } loop { |