Expand description
Streaming and incremental parsing — StreamParser and EarlyStopParser.
Streaming and incremental HTML parsing.
StreamParser builds a DOM tree incrementally from byte chunks,
handling encoding detection automatically. It buffers the first 1 KB
of input (matching the meta prescan limit) before detecting encoding,
then decodes and tokenizes all data into the tree.
EarlyStopParser adds predicate-based early termination — the parse
stops as soon as a matching node is found, saving work on large documents.
§Example
use fhp_tree::streaming::{StreamParser, parse_stream};
let html = b"<div><p>Hello</p></div>";
let doc = parse_stream(html.chunks(7)).unwrap();
assert_eq!(doc.root().text_content(), "Hello");Structs§
- Early
Stop Parser - A streaming parser that stops as soon as a predicate matches a node.
- Stream
Parser - A streaming HTML parser that builds a DOM tree incrementally.
Enums§
- Parse
Status - Status returned by
EarlyStopParser::feed.
Functions§
- parse_
stream - Parse an HTML document from an iterator of byte chunks.