Expand description
Arena-based DOM tree with cache-line aligned nodes.
This crate builds on fhp-tokenizer to construct an in-memory DOM tree
using an arena allocator. Each node occupies exactly 64 bytes (one cache
line) for optimal traversal performance.
§Quick Start
use fhp_tree::parse;
let doc = parse("<div><p>Hello</p></div>").unwrap();
let root = doc.root();
assert!(root.children().count() > 0);Modules§
- arena
- Arena allocator for
Nodes, text, and attributes. Arena allocator for DOM nodes, text, and attributes. - builder
- Tree builder — converts a
Tokenstream into a DOM tree. Tree construction from a token stream. - node
- Cache-line aligned
Nodelayout. Cache-line aligned node layout and supporting types. - streaming
- Streaming and incremental parsing —
StreamParserandEarlyStopParser. Streaming and incremental HTML parsing. - traverse
- Allocation-free traversal iterators (uses
VecDequefor BFS). Allocation-free tree traversal iterators.
Structs§
- Document
- A parsed HTML document backed by an arena.
- NodeRef
- A borrowed reference to a node inside the document.
Enums§
- Html
Error - Error type for HTML parsing.
Functions§
- parse
- Parse an HTML string into a
Document. - parse_
bytes - Parse raw bytes into a
Document, auto-detecting the encoding. - parse_
owned - Parse an owned
Stringinto aDocument, transferring the allocation.