pub struct ParsedFragment { /* private fields */ }Expand description
A parsed markup chunk, bundled with the throwaway document that owns it.
The pairing is the safety property, not a convenience: a libxml Node is a
raw pointer into its owning document, so a node that outlives its owner is a
dangling FFI pointer — a failure mode this project has already taken SIGSEGVs
from, and one that bypasses catch_unwind. Document is refcounted and
Clone, so holding this handle keeps ParsedFragment::nodes valid for
exactly as long as the handle lives. That is what makes it safe to hand a
parsed chunk to an untrusted .rhai script, which controls its own lifetimes.
Implementations§
Trait Implementations§
Source§impl Clone for ParsedFragment
impl Clone for ParsedFragment
Source§impl Debug for ParsedFragment
Hand-written because libxml’s Document/Node are opaque FFI handles whose
derived form would print pointers, not markup. Report what a caller actually
wants to see: how many top-level nodes, and their names.
impl Debug for ParsedFragment
Hand-written because libxml’s Document/Node are opaque FFI handles whose
derived form would print pointers, not markup. Report what a caller actually
wants to see: how many top-level nodes, and their names.