Trait perseus::prelude::Html

pub trait Html: GenericNode<EventType = Event, PropertyType = JsValue> {
    const IS_BROWSER: bool;

    // Required method
    fn to_web_sys(&self) -> Node;
}
Expand description

Trait that is implemented by all [GenericNode] backends that render to HTML.

Required Associated Constants§

const IS_BROWSER: bool

A boolean indicating whether this node is rendered in a browser context.

A value of false does not necessarily mean that it is not being rendered in WASM or even in the browser. It only means that it does not create DOM nodes.

Required Methods§

fn to_web_sys(&self) -> Node

Convert this node into a raw web_sys::Node.

For certain backends, this is not possible (e.g. [SsrNode]). In that case, calling this will panic at runtime.

Implementors§

§

impl Html for DomNode

§

const IS_BROWSER: bool = true

§

impl Html for HydrateNode

§

const IS_BROWSER: bool = true

§

impl Html for SsrNode

§

const IS_BROWSER: bool = false