ratatui/tests
Josh McKinney 815757fcbb
feat(widgets): implement Widget for Widget refs (#833)
Many widgets can be rendered without changing their state.

This commit implements The `Widget` trait for references to
widgets and changes their implementations to be immutable.

This allows us to render widgets without consuming them by passing a ref
to the widget when calling `Frame::render_widget()`.

```rust
// this might be stored in a struct
let paragraph = Paragraph::new("Hello world!");

let [left, right] = area.split(&Layout::horizontal([20, 20]));
frame.render_widget(&paragraph, left);
frame.render_widget(&paragraph, right); // we can reuse the widget
```

Implemented for all widgets except BarChart (which has an implementation
that modifies the internal state and requires a rewrite to fix.

Other widgets will be implemented in follow up commits.

Fixes: https://github.com/ratatui-org/ratatui/discussions/164
Replaces PRs: https://github.com/ratatui-org/ratatui/pull/122 and
https://github.com/ratatui-org/ratatui/pull/16
Enables: https://github.com/ratatui-org/ratatui/issues/132
Validated as a viable working solution by:
https://github.com/ratatui-org/ratatui/pull/836
2024-01-24 10:34:10 -08:00
..
backend_termion.rs feat(terminal)!: add inline viewport (#114) 2023-04-17 14:23:50 +02:00
border_macro.rs feat(border): add border! macro for easy bitflag manipulation (#11) 2023-05-21 15:26:39 -07:00
state_serde.rs feat: Table column calculation uses layout spacing (#824) 2024-01-16 21:51:25 -05:00
stylize.rs feat(stylize): allow all widgets to be styled (#289) 2023-07-14 08:37:30 +00:00
terminal.rs feat: Add frame count (#766) 2024-01-08 03:51:53 -05:00
widgets_barchart.rs feat(barchart): Add direction attribute. (horizontal bars support) (#325) 2023-08-24 22:26:15 +00:00
widgets_block.rs fix(title): remove default alignment and position (#323) 2023-07-17 10:27:58 +00:00
widgets_calendar.rs feat(widgets): implement Widget for Widget refs (#833) 2024-01-24 10:34:10 -08:00
widgets_canvas.rs chore: Minor lints, making Clippy happier (#189) 2023-05-21 20:45:37 -07:00
widgets_chart.rs feat(widgets): implement Widget for Widget refs (#833) 2024-01-24 10:34:10 -08:00
widgets_gauge.rs fix(gauge): fix gauge widget colors (#572) 2023-10-19 04:29:53 -07:00
widgets_list.rs feat(List)!: List::new now accepts IntoIterator<Item = Into<ListItem>> (#672) 2023-12-08 14:20:49 -08:00
widgets_paragraph.rs chore(spans): remove deprecated Spans type (#426) 2023-09-19 02:58:52 -07:00
widgets_table.rs feat: Table column calculation uses layout spacing (#824) 2024-01-16 21:51:25 -05:00
widgets_tabs.rs feat(tabs): accept Iterators of Line in constructors (#776) 2024-01-10 17:16:44 -08:00