rab/tui/components/
dynamic_lines.rs1use crate::tui::Component;
2
3pub struct DynamicLines {
6 lines: Vec<String>,
7}
8
9impl DynamicLines {
10 pub fn new() -> Self {
11 Self { lines: Vec::new() }
12 }
13
14 pub fn set_lines(&mut self, new_lines: Vec<String>) {
16 self.lines = new_lines;
17 }
18
19 pub fn clear(&mut self) {
21 self.lines.clear();
22 }
23}
24
25impl Default for DynamicLines {
26 fn default() -> Self {
27 Self::new()
28 }
29}
30
31impl Component for DynamicLines {
32 fn render(&mut self, _width: usize) -> Vec<String> {
33 self.lines.clone()
34 }
35
36 fn invalidate(&mut self) {
37 }
39}