Struct html_builder::Node
source · pub struct Node<'a> { /* private fields */ }
Expand description
An HTML element.
An open-tag is written to the buffer when a Node
is created, and a
close-tag is written when the Node
is dropped. You can set attributes
on a newly-created node using attr()
, create child nodes
with child()
, and write text into the node using the
Write
impl.
Escaping
Text written into a node using its Write
impl is transformed to make it
render correctly in an HTML-context. By default, the following characters
are escaped: &
, <
, and >
. The escaping can be strengthened or
weakened using the safe()
and raw()
methods respectively.
Implementations§
source§impl<'a> Node<'a>
impl<'a> Node<'a>
pub fn child<'b>(&'b mut self, tag: Cow<'static, str>) -> Node<'b>
pub fn void_child<'b>(&'b mut self, tag: Cow<'static, str>) -> Void<'b>
pub fn comment<'b>(&'b mut self) -> Comment<'b>
pub fn attr(self, attr: &str) -> Node<'a>
Trait Implementations§
source§impl<'a> Html5 for Node<'a>
impl<'a> Html5 for Node<'a>
source§fn address(&mut self) -> Node<'_>
fn address(&mut self) -> Node<'_>
Defines contact information for the author/owner of a document
source§fn base(&mut self) -> Void<'_>
fn base(&mut self) -> Void<'_>
Specifies the base URL/target for all relative URLs in a document
source§fn bdi(&mut self) -> Node<'_>
fn bdi(&mut self) -> Node<'_>
Isolates a part of text that might be formatted in a different direction from other text outside it
source§fn blockquote(&mut self) -> Node<'_>
fn blockquote(&mut self) -> Node<'_>
Defines a section that is quoted from another source
Defines a clickable button
source§fn canvas(&mut self) -> Node<'_>
fn canvas(&mut self) -> Node<'_>
Used to draw graphics, on the fly, via scripting (usually JavaScript)
Defines a table caption
source§fn col(&mut self) -> Void<'_>
fn col(&mut self) -> Void<'_>
Specifies column properties for each column within a <colgroup>
element
source§fn colgroup(&mut self) -> Node<'_>
fn colgroup(&mut self) -> Node<'_>
Specifies a group of one or more columns in a table for formatting
Defines a caption for a <figure>
element
Defines a footer for a document or section
source§fn link(&mut self) -> Void<'_>
fn link(&mut self) -> Void<'_>
Defines the relationship between a document and an external resource (most used to link to style sheets)
Defines navigation links
source§fn noscript(&mut self) -> Node<'_>
fn noscript(&mut self) -> Node<'_>
Defines an alternate content for users that do not support client-side scripts
source§fn rp(&mut self) -> Node<'_>
fn rp(&mut self) -> Node<'_>
Defines what to show in browsers that do not support ruby annotations
source§fn rt(&mut self) -> Node<'_>
fn rt(&mut self) -> Node<'_>
Defines an explanation/pronunciation of characters (for East Asian typography)
source§fn source(&mut self) -> Void<'_>
fn source(&mut self) -> Void<'_>
Defines multiple media resources for media elements (<video>
and <audio>
)
source§fn template(&mut self) -> Node<'_>
fn template(&mut self) -> Node<'_>
Defines a container for content that should be hidden when the page loads