pub struct HtmlPage { /* 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 = HtmlPage::default().with_head_element(title);
assert_eq!(format!("{}", doc), "<!DOCTYPE html>\n<HTML>\n\
<HEAD><TITLE>my page</TITLE></HEAD>\n<BODY></BODY>\n</HTML>\n");
Implementations§
source§impl HtmlPage
impl HtmlPage
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 HtmlPage
impl PartialEq for HtmlPage
impl Eq for HtmlPage
impl StructuralPartialEq for HtmlPage
Auto Trait Implementations§
impl Freeze for HtmlPage
impl RefUnwindSafe for HtmlPage
impl Send for HtmlPage
impl Sync for HtmlPage
impl Unpin for HtmlPage
impl UnwindSafe for HtmlPage
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