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: impl Into<Element>)
pub fn push_to_head(&mut self, e: impl Into<Element>)
Append an element to the head.
Sourcepub fn push_to_body(&mut self, e: impl Into<Element>)
pub fn push_to_body(&mut self, e: impl Into<Element>)
Append an element to the body.
Sourcepub fn with_head_element(self, e: impl Into<Element>) -> Self
pub fn with_head_element(self, e: impl Into<Element>) -> Self
Append an element to the head, when constructing.
Sourcepub fn with_body_element(self, e: impl Into<Element>) -> Self
pub fn with_body_element(self, e: impl Into<Element>) -> Self
Append an element to the body, when constructing.
Sourcepub fn with_body_text(self, text: impl Into<String>) -> Self
pub fn with_body_text(self, text: impl Into<String>) -> Self
Append text to the body, when constructing.
Sourcepub fn push_children(&mut self, e: impl Into<Element>)
pub fn push_children(&mut self, e: impl Into<Element>)
Append all children of e as to body of page.
Trait Implementations§
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