Enum yew::virtual_dom::VNode

source ·
pub enum VNode {
    VTag(Box<VTag>),
    VText(VText),
    VComp(VComp),
    VList(VList),
    VPortal(VPortal),
    VRef(Node),
    VSuspense(VSuspense),
    VRaw(VRaw),
}
Expand description

Bind virtual element to a DOM reference.

Variants§

§

VTag(Box<VTag>)

A bind between VTag and Element.

§

VText(VText)

A bind between VText and TextNode.

§

VComp(VComp)

A bind between VComp and Element.

§

VList(VList)

A holder for a list of other nodes.

§

VPortal(VPortal)

A portal to another part of the document

§

VRef(Node)

A holder for any Node (necessary for replacing node).

§

VSuspense(VSuspense)

A suspendible document fragment.

§

VRaw(VRaw)

A raw HTML string, represented by AttrValue.

Also see: VNode::from_html_unchecked

Implementations§

Returns true if the VNode has a key.

Create a VNode from a string of HTML

Behavior in browser

In the browser, this function creates an element, sets the passed HTML to its innerHTML and inserts the contents of it into the DOM.

Behavior on server

When rendering on the server, the contents of HTML are directly injected into the HTML stream.

Warning

The contents are not sanitized or validated. You, as the developer, are responsible to ensure the HTML string passed to this method are valid and not malicious

Example
use yew::{html, AttrValue, Html};
let parsed = Html::from_html_unchecked(AttrValue::from("<div>content</div>"));
let _: Html = html! {
    <div>
        {parsed}
    </div>
};

Trait Implementations§

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Creates a value from an iterator. Read more
Convert self to a value of a Properties struct.
Convert self to a value of a Properties struct.
This method tests for self and other values to be equal, and is used by ==. Read more
This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
Converts to this type from the input type.

Returns the argument unchanged.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.
Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more