1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use yew::virtual_dom as vdom;
pub struct Text {
text: vdom::VText,
}
impl Text {
pub(crate) fn new(text: impl Into<vdom::AttrValue>) -> Self {
Self {
text: vdom::VText::new(text),
}
}
#[must_use]
pub fn to_vnode(self) -> vdom::VNode {
vdom::VNode::VText(self.text)
}
}
impl From<Text> for vdom::VNode {
fn from(text: Text) -> Self {
text.to_vnode()
}
}
impl From<Text> for yew::Children {
fn from(text: Text) -> Self {
yew::Children::new([text.into()].to_vec())
}
}