#thread-safe #node #version #dom #document #children #weak

markup5ever_arcdom

Thread safe version of RcDom from html5ever project

3 releases

0.1.2 Apr 1, 2022
0.1.1 Feb 27, 2020
0.1.0 Feb 27, 2020

#13 in #children

Download history 140/week @ 2024-07-21 156/week @ 2024-07-28 111/week @ 2024-08-04 111/week @ 2024-08-11 69/week @ 2024-08-18 86/week @ 2024-08-25 63/week @ 2024-09-01 266/week @ 2024-09-08 90/week @ 2024-09-15 273/week @ 2024-09-22 262/week @ 2024-09-29 53/week @ 2024-10-06 70/week @ 2024-10-13 56/week @ 2024-10-20 82/week @ 2024-10-27 67/week @ 2024-11-03

280 downloads per month
Used in 5 crates (2 directly)

MIT/Apache

220KB
366 lines

markup5ever_arcdom

CI Crates.io docs.rs

Thread safe version of markup5ever_rcdom.


lib.rs:

A simple reference-counted DOM.

This is sufficient as a static parse tree, but don't build a web browser using it. :)

A DOM is a tree structure with ordered children that can be represented in an XML-like format. For example, the following graph

div
 +- "text node"
 +- span

in HTML would be serialized as

<div>text node<span></span></div>

See the document object model article on wikipedia for more information.

This implementation stores the information associated with each node once, and then hands out refs to children. The nodes themselves are reference-counted to avoid copying - you can create a new ref and then a node will outlive the document. Nodes own their children, but only have weak references to their parents.

Dependencies

~1.2–6MB
~35K SLoC