pub trait Embed {
    fn embed(self) -> VDomNode;
}
Expand description

Allows for embedding into html! macro.

use vertigo::{dev::VDomNode, Embed, html};

struct Point {
    pub x: i32,
    pub y: i32,
}

impl Embed for Point {
    fn embed(self) -> VDomNode {
        VDomNode::text(format!("({}, {})", self.x, self.y))
    }
}

let x = Point { x: 1, y: 2 };

let rendered = html! {
    <div> {x} </div>
};

assert_eq!(
    format!("{:?}", rendered),
    format!("{:?}", html! {
        <div> "(1, 2)" </div>
    })
)

Required methods

Implementations on Foreign Types

Implementors