Skip to main content

Crate fhp_tree

Crate fhp_tree 

Source
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 Token stream into a DOM tree. Tree construction from a token stream.
node
Cache-line aligned Node layout. Cache-line aligned node layout and supporting types.
streaming
Streaming and incremental parsing — StreamParser and EarlyStopParser. Streaming and incremental HTML parsing.
traverse
Allocation-free traversal iterators (uses VecDeque for 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§

HtmlError
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 String into a Document, transferring the allocation.