Enum sauron_core::vdom::leaf::Leaf
source · pub enum Leaf<MSG> {
Text(String),
SafeHtml(String),
Comment(String),
Fragment(Vec<Node<MSG>>),
DocType(String),
}
Expand description
A leaf node value of html dom tree
Variants§
Text(String)
Text variant of a virtual node
SafeHtml(String)
A safe html variant
Comment(String)
A comment node
Fragment(Vec<Node<MSG>>)
a vec of nodes
DocType(String)
doctype: html, math, svg https://www.w3.org/QA/2002/04/valid-dtd-list.html
Implementations§
source§impl<MSG> Leaf<MSG>
impl<MSG> Leaf<MSG>
sourcepub fn is_safe_html(&self) -> bool
pub fn is_safe_html(&self) -> bool
returns true if this is a safe html text node
sourcepub fn unwrap_text(&self) -> &str
pub fn unwrap_text(&self) -> &str
unwrap the text content if this a text node, panics if it is not a text node
sourcepub fn unwrap_safe_html(&self) -> &str
pub fn unwrap_safe_html(&self) -> &str
unwrap the text content if this a text node, panics if it is not a text node
Trait Implementations§
source§impl<MSG> PartialEq<Leaf<MSG>> for Leaf<MSG>
impl<MSG> PartialEq<Leaf<MSG>> for Leaf<MSG>
source§impl<MSG> Render for Leaf<MSG>
impl<MSG> Render for Leaf<MSG>
source§fn render_with_indent(
&self,
buffer: &mut dyn Write,
indent: usize,
compressed: bool
) -> Result
fn render_with_indent( &self, buffer: &mut dyn Write, indent: usize, compressed: bool ) -> Result
render instance to a writable buffer with indention
source§fn render_compressed(&self, buffer: &mut dyn Write) -> Result
fn render_compressed(&self, buffer: &mut dyn Write) -> Result
no new_lines, no indents
source§fn render_to_string(&self) -> String
fn render_to_string(&self) -> String
render compressed html to string
source§fn render_to_string_pretty(&self) -> String
fn render_to_string_pretty(&self) -> String
render to string with nice indention
Auto Trait Implementations§
impl<MSG> !RefUnwindSafe for Leaf<MSG>
impl<MSG> !Send for Leaf<MSG>
impl<MSG> !Sync for Leaf<MSG>
impl<MSG> Unpin for Leaf<MSG>
impl<MSG> !UnwindSafe for Leaf<MSG>
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