nuit_core/compose/view/widget/
text.rs1use nuit_derive::Bind;
2
3use crate::{View, Node, Context, Event, IdPath};
4
5#[derive(Debug, Clone, PartialEq, Eq, Bind)]
7pub struct Text {
8 content: String,
9}
10
11impl Text {
12 pub fn new(content: impl Into<String>) -> Self {
13 Self {
14 content: content.into()
15 }
16 }
17}
18
19impl View for Text {
20 fn fire(&self, _event: &Event, _id_path: &IdPath, _context: &Context) {}
21
22 fn render(&self, _context: &Context) -> Node {
23 Node::Text { content: self.content.clone() }
24 }
25}