pub struct Document { /* private fields */ }Expand description
A parsed HTML document backed by an arena.
Provides access to the root node and convenience methods for querying the DOM tree.
Implementations§
Source§impl Document
impl Document
Sourcepub fn to_html(&self) -> String
pub fn to_html(&self) -> String
Serialize the entire document back to an HTML string.
This produces the outer HTML of the root node, which includes all children with proper entity escaping for text and attribute values.
§Example
use fhp_tree::parse;
let doc = parse("<p>Hello & world</p>").unwrap();
let html = doc.to_html();
assert!(html.contains("&"));Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Total number of nodes in the document.
Auto Trait Implementations§
impl Freeze for Document
impl RefUnwindSafe for Document
impl Send for Document
impl Sync for Document
impl Unpin for Document
impl UnsafeUnpin for Document
impl UnwindSafe for Document
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more