pub struct Document { /* private fields */ }Expand description
An HTML document (“page’),consisting of a head and a body element.
let title = Element::new(Tag::Title).with_text("my page");
let doc = Document::default().with_head_element(title);
assert_eq!(format!("{}", doc), "<!DOCTYPE html>\n<HTML>\n\
<HEAD><TITLE>my page</TITLE></HEAD>\n<BODY/>\n</HTML>\n");Implementations§
source§impl Document
impl Document
sourcepub fn push_to_head(&mut self, e: Element)
pub fn push_to_head(&mut self, e: Element)
Append an element to the head.
sourcepub fn push_to_body(&mut self, e: Element)
pub fn push_to_body(&mut self, e: Element)
Append an element to the body.
sourcepub fn with_head_element(self, e: Element) -> Self
pub fn with_head_element(self, e: Element) -> Self
Append an element to the head, when constructing.
sourcepub fn with_body_element(self, e: Element) -> Self
pub fn with_body_element(self, e: Element) -> Self
Append an element to the body, when constructing.
sourcepub fn with_body_text(self, text: &str) -> Self
pub fn with_body_text(self, text: &str) -> Self
Append text to the body, when constructing.
sourcepub fn push_children(&mut self, e: &Element)
pub fn push_children(&mut self, e: &Element)
Append all children of e as to body of page.
Trait Implementations§
source§impl PartialEq for Document
impl PartialEq for Document
impl Eq for Document
impl StructuralPartialEq for 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 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