Skip to content

Commit b282a06

Browse files
authored
refactor!: remove items deprecated since 0.10 (#691)
Remove `Axis::title_style` and `Buffer::set_background` which are deprecated since 0.10
1 parent b8f71c0 commit b282a06

File tree

3 files changed

+9
-45
lines changed

3 files changed

+9
-45
lines changed

BREAKING-CHANGES.md

+9-20
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ github with a [breaking change] label.
1111
This is a quick summary of the sections below:
1212

1313
- Unreleased (0.24.1)
14-
- `List::start_corner` is renamed to `List::direction`
14+
- Removed `Axis::title_style` and `Buffer::set_background`
1515
- `List::new()` now accepts `IntoIterator<Item = Into<ListItem<'a>>>`
1616
- `Table::new()` now requires specifying the widths
1717
- `Table::widths()` now accepts `IntoIterator<Item = AsRef<Constraint>>`
@@ -42,28 +42,17 @@ This is a quick summary of the sections below:
4242

4343
## Unreleased (v0.24.1)
4444

45-
### `List::start_corner` is renamed to `List::direction` ([#673])
45+
### Removed `Axis::title_style` and `Buffer::set_background`
4646

47-
[#673]: https://github.com/ratatui-org/ratatui/pull/673
47+
These items were deprecated since 0.10.
4848

49-
Previously `List::start_corner` didn't communicate the intent of the method. It also used an
50-
inadequate `Corner` enum. The method is now renamed `direction` and a new enum
51-
`ListDirection` has been added.
49+
- You should use styling capabilities of [`text::Line`] given as argument of [`Axis::title`]
50+
instead of `Axis::title_style`
51+
- You should use styling capabilities of [`Buffer::set_style`] instead of `Buffer::set_background`
5252

53-
```diff
54-
- List::new(/* items */).start_corner(Corner::TopLeft);
55-
- List::new(/* items */).start_corner(Corner::TopRight);
56-
// This is not an error, BottomRight rendered top to bottom previously
57-
- List::new(/* items */).start_corner(Corner::BottomRight);
58-
// all becomes
59-
+ List::new(/* items */).direction(ListDirection::TopToBottom);
60-
```
61-
62-
```diff
63-
- List::new(/* items */).start_corner(Corner::BottomLeft);
64-
// becomes
65-
+ List::new(/* items */).direction(ListDirection::BottomToTop);
66-
```
53+
[`text::Line`]: https://docs.rs/ratatui/latest/ratatui/text/struct.Line.html
54+
[`Axis::title`]: https://docs.rs/ratatui/latest/ratatui/widgets/struct.Axis.html#method.title
55+
[`Buffer::set_style`]: https://docs.rs/ratatui/latest/ratatui/buffer/struct.Buffer.html#method.set_style
6756

6857
### `List::new()` now accepts `IntoIterator<Item = Into<ListItem<'a>>>` ([#672])
6958

src/buffer.rs

-12
Original file line numberDiff line numberDiff line change
@@ -367,18 +367,6 @@ impl Buffer {
367367
self.set_stringn(x, y, span.content.as_ref(), width as usize, span.style)
368368
}
369369

370-
#[deprecated(
371-
since = "0.10.0",
372-
note = "You should use styling capabilities of `Buffer::set_style`"
373-
)]
374-
pub fn set_background(&mut self, area: Rect, color: Color) {
375-
for y in area.top()..area.bottom() {
376-
for x in area.left()..area.right() {
377-
self.get_mut(x, y).set_bg(color);
378-
}
379-
}
380-
}
381-
382370
pub fn set_style(&mut self, area: Rect, style: Style) {
383371
for y in area.top()..area.bottom() {
384372
for x in area.left()..area.right() {

src/widgets/chart.rs

-13
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,6 @@ impl<'a> Axis<'a> {
3939
self
4040
}
4141

42-
#[deprecated(
43-
since = "0.10.0",
44-
note = "You should use styling capabilities of `text::Line` given as argument of the `title` method to apply styling to the title."
45-
)]
46-
#[must_use = "method moves the value of self and returns the modified value"]
47-
pub fn title_style(mut self, style: Style) -> Axis<'a> {
48-
if let Some(t) = self.title {
49-
let title = String::from(t);
50-
self.title = Some(TextLine::from(Span::styled(title, style)));
51-
}
52-
self
53-
}
54-
5542
#[must_use = "method moves the value of self and returns the modified value"]
5643
pub fn bounds(mut self, bounds: [f64; 2]) -> Axis<'a> {
5744
self.bounds = bounds;

0 commit comments

Comments
 (0)