3 releases
0.1.2 | Apr 1, 2022 |
---|---|
0.1.1 | Feb 27, 2020 |
0.1.0 | Feb 27, 2020 |
#5 in #text-node
331 downloads per month
Used in 5 crates
(2 directly)
220KB
366 lines
markup5ever_arcdom
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–6.5MB
~35K SLoC