pub struct HtmlBodyElement { /* private fields */ }Expand description
A structure representing HTML <body> element.
Implementations§
Source§impl HtmlBodyElement
impl HtmlBodyElement
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates new body element.
§Example
let body = HtmlBodyElement::new();
assert_eq!("<body/>", body.to_string());Sourcepub fn child(self, child: impl Into<HtmlElement>) -> Self
pub fn child(self, child: impl Into<HtmlElement>) -> Self
Adds child element into body element.
let h1 = HtmlElement::h1("hello");
let body = HtmlBodyElement::new().child(h1);
assert_eq!("<body>\n <h1>hello</h1>\n</body>", body.to_string());Sourcepub fn add_child(&mut self, child: impl Into<HtmlElement>)
pub fn add_child(&mut self, child: impl Into<HtmlElement>)
Adds child element into body element.
let h1 = HtmlElement::h1("hello");
let mut body = HtmlBodyElement::new();
body.add_child(h1);
assert_eq!("<body>\n <h1>hello</h1>\n</body>", body.to_string());Trait Implementations§
Source§impl Clone for HtmlBodyElement
impl Clone for HtmlBodyElement
Source§fn clone(&self) -> HtmlBodyElement
fn clone(&self) -> HtmlBodyElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for HtmlBodyElement
impl Debug for HtmlBodyElement
Source§impl Default for HtmlBodyElement
impl Default for HtmlBodyElement
Source§fn default() -> HtmlBodyElement
fn default() -> HtmlBodyElement
Returns the “default value” for a type. Read more
Source§impl Display for HtmlBodyElement
impl Display for HtmlBodyElement
Source§impl From<&HtmlBodyElement> for HtmlElement
impl From<&HtmlBodyElement> for HtmlElement
Source§fn from(value: &HtmlBodyElement) -> Self
fn from(value: &HtmlBodyElement) -> Self
Converts a reference to HtmlBodyElement into HtmlElement.
Source§impl From<HtmlBodyElement> for HtmlElement
impl From<HtmlBodyElement> for HtmlElement
Source§fn from(value: HtmlBodyElement) -> Self
fn from(value: HtmlBodyElement) -> Self
Converts HtmlBodyElement into HtmlElement.
Auto Trait Implementations§
impl Freeze for HtmlBodyElement
impl RefUnwindSafe for HtmlBodyElement
impl Send for HtmlBodyElement
impl Sync for HtmlBodyElement
impl Unpin for HtmlBodyElement
impl UnwindSafe for HtmlBodyElement
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