lewp_html/
document.rs

1//! Document definition.
2
3use {
4    html5ever::serialize::{serialize, SerializeOpts},
5    rcdom::{RcDom, SerializableHandle},
6};
7
8/// An HTML5 document.
9pub type Document = RcDom;
10
11impl crate::DocumentExt for Document {
12    fn into_html(self) -> String {
13        let mut bytes = vec![];
14        let document: SerializableHandle = self.document.into();
15        serialize(&mut bytes, &document, SerializeOpts::default()).unwrap();
16        String::from_utf8(bytes).unwrap()
17    }
18}