[][src]Enum dioxus::prelude::VNode

pub enum VNode {
    Element(VElement),
    Text(VText),
    Component(VComponent),
}

Variants

Element(VElement)

An element node (node type ELEMENT_NODE).

Text(VText)

A text node (node type TEXT_NODE).

Note: This wraps a VText instead of a plain String in order to enable custom methods like create_text_node() on the wrapped type.

Component(VComponent)

A User-defined componen node (node type COMPONENT_NODE)

Implementations

impl VNode[src]

pub fn element<S>(tag: S) -> VNode where
    S: Into<String>, 
[src]

Create a new virtual element node with a given tag.

These get patched into the DOM using document.createElement

let div = VNode::element("div");

pub fn text<S>(text: S) -> VNode where
    S: Into<String>, 
[src]

Create a new virtual text node with the given text.

These get patched into the DOM using document.createTextNode

let div = VNode::text("div");

pub fn as_velement_ref(&self) -> Option<&VElement>[src]

Return a VElement reference, if this is an Element variant.

pub fn as_velement_mut(&mut self) -> Option<&mut VElement>[src]

Return a mutable VElement reference, if this is an Element variant.

pub fn as_vtext_ref(&self) -> Option<&VText>[src]

Return a VText reference, if this is an Text variant.

pub fn as_vtext_mut(&mut self) -> Option<&mut VText>[src]

Return a mutable VText reference, if this is an Text variant.

pub fn insert_space_before_text(&mut self)[src]

Used by html-macro to insert space before text that is inside of a block that came after an open tag.

html! {

{world}
}

So that we end up with

world
when we're finished parsing.

pub fn insert_space_after_text(&mut self)[src]

Used by html-macro to insert space after braced text if we know that the next block is another block or a closing tag.

html! {

{Hello} {world}
} ->
Hello world
html! {
{Hello}
} ->
Hello

So that we end up with

Hello world
when we're finished parsing.

Trait Implementations

impl Debug for VNode[src]

impl Display for VNode[src]

impl<'_> From<&'_ str> for VNode[src]

impl From<String> for VNode[src]

impl From<VElement> for VNode[src]

impl From<VNode> for IterableNodes[src]

impl From<VText> for VNode[src]

impl Into<IntoIter<VNode, Global>> for VNode[src]

impl IntoIterator for VNode[src]

type Item = VNode

The type of the elements being iterated over.

type IntoIter = IntoIter<VNode, Global>

Which kind of iterator are we turning this into?

impl PartialEq<VNode> for VNode[src]

impl StructuralPartialEq for VNode[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.