Skip to main content

tokenize_with

Function tokenize_with 

Source
pub fn tokenize_with<'a>(input: &'a str, on_token: impl FnMut(Token<'a>))
Expand description

Tokenize HTML and feed each token to a callback — zero intermediate allocation.

Fuses SIMD structural indexing, quote-aware masking, and token extraction into a single streaming pass. No Vec<BlockBitmaps> or Vec<Token> is allocated.

§Example

use fhp_tokenizer::tokenize_with;
use fhp_tokenizer::token::Token;

let mut count = 0;
tokenize_with("<div>hello</div>", |_token| { count += 1; });
assert!(count >= 3); // OpenTag, Text, CloseTag