tui-rs
tui-rs copied to clipboard
How to build UI like use HTML tag?
Problem
Does Rust have the opportunity to use macros to build the structure of the TUI app, just like JSX in React
use crate::MyComponent1;
use crate::MyComponent2;
use crate::MyComponent3;
struct MyComponent2 {
someAttr: SomeType,
}
struct MyComponent3 {}
impl MyComponent3 {
pub fn keyHandler(event: KeyEvent) {
...
}
}
struct Root {}
impl Root {
pub fn update() {
tui!(
<MyComponent1>
<MyComponent2 attr="someAttr">Hello Rust</MyComponent2>
<MyComponent3 onKey="keyHandler">Hello TUI</MyComponent3>
</MyComponent1>
)
}
}
These are my simple and immature ideas
that would be interesting