diff options
author | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 15:03:15 +0200 |
---|---|---|
committer | Titus Wormer <tituswormer@gmail.com> | 2022-07-22 15:03:15 +0200 |
commit | 41fc406af206e21014eaaba94bcf6b1854f892b3 (patch) | |
tree | 510f6e1d763643da9072f9cf7e097e777fdbd5b8 /src/construct/partial_title.rs | |
parent | 37fad739ba73d488d4c3652caee01f1ec5d0aaaa (diff) | |
download | markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.tar.gz markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.tar.bz2 markdown-rs-41fc406af206e21014eaaba94bcf6b1854f892b3.zip |
Refactor to pass ints instead of vecs around
Diffstat (limited to '')
-rw-r--r-- | src/construct/partial_title.rs | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/construct/partial_title.rs b/src/construct/partial_title.rs index 852693a..f69d609 100644 --- a/src/construct/partial_title.rs +++ b/src/construct/partial_title.rs @@ -147,9 +147,9 @@ pub fn start(tokenizer: &mut Tokenizer, code: Code, options: Options) -> StateFn tokenizer.enter(info.options.marker.clone()); tokenizer.consume(code); tokenizer.exit(info.options.marker.clone()); - (State::Fn(Box::new(|t, c| begin(t, c, info))), None) + (State::Fn(Box::new(|t, c| begin(t, c, info))), 0) } - _ => (State::Nok, None), + _ => (State::Nok, 0), } } @@ -168,7 +168,7 @@ fn begin(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult { tokenizer.consume(code); tokenizer.exit(info.options.marker.clone()); tokenizer.exit(info.options.title); - (State::Ok, None) + (State::Ok, 0) } _ => { tokenizer.enter(info.options.string.clone()); @@ -189,7 +189,7 @@ fn at_break(tokenizer: &mut Tokenizer, code: Code, mut info: Info) -> StateFnRes tokenizer.exit(info.options.string.clone()); begin(tokenizer, code, info) } - Code::None => (State::Nok, None), + Code::None => (State::Nok, 0), Code::CarriageReturnLineFeed | Code::Char('\n' | '\r') => tokenizer.go( space_or_tab_eol_with_options(EolOptions { content_type: Some(ContentType::String), @@ -233,11 +233,11 @@ fn title(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult { } Code::Char('\\') => { tokenizer.consume(code); - (State::Fn(Box::new(|t, c| escape(t, c, info))), None) + (State::Fn(Box::new(|t, c| escape(t, c, info))), 0) } _ => { tokenizer.consume(code); - (State::Fn(Box::new(|t, c| title(t, c, info))), None) + (State::Fn(Box::new(|t, c| title(t, c, info))), 0) } } } @@ -252,7 +252,7 @@ fn escape(tokenizer: &mut Tokenizer, code: Code, info: Info) -> StateFnResult { match code { Code::Char(char) if char == info.kind.as_char() => { tokenizer.consume(code); - (State::Fn(Box::new(|t, c| title(t, c, info))), None) + (State::Fn(Box::new(|t, c| title(t, c, info))), 0) } _ => title(tokenizer, code, info), } |