Vvinhnx

ratatui-0-24-to-0-30

Migrate Rust ratatui usage across major breaking changes (v0.24–v0.30): AST-backed source renames plus manual Cargo.toml follow-up

rustratatuimigrationtuibreaking-changesterminal
Public
0 executions
1 stars
How to Use
Run this codemod on your codebase using the following command

The easiest way to run this codemod without installing anything globally:

Documentation

ratatui-0-24-to-0-30

Automate the most common deterministic API renames in the ratatui TUI library migration from v0.24–v0.30.

What it does

Cargo.toml follow-up

  • Update ratatui = "0.2x.x"ratatui = "0.30.0"
  • Update ratatui = { version = "0.2x.x", ... }ratatui = { version = "0.30.0", ... }

Import path updates

  • use ratatui::terminal::{Terminal, Frame, ...}use ratatui::{Terminal, Frame, ...}
  • use ratatui::widgets::block::{Title, Position}use ratatui::widgets::TitlePosition (Title removed)
  • use ratatui::widgets::block::BlockExtuse ratatui::widgets::BlockExt
  • use ratatui::widgets::scrollbar::{Scrollbar, Set} → split into widget/symbols imports

Method renames

  • frame.size()frame.area() (v0.28)
  • Table::highlight_style(...)Table::row_highlight_style(...) (v0.29)
  • .title_on_bottom().title_bottom() (v0.27)
  • BorderType::line_symbols(...)BorderType::border_symbols(...) (v0.24)
  • .track_symbol("|").track_symbol(Some("|")) (v0.23)

Type renames

  • SpansLine (v0.24 removal)
  • Title::from(...)Line::from(...) (v0.30)
  • Position::Bottom/TopTitlePosition::Bottom/Top (v0.30)
  • symbols::line::Setsymbols::border::Set (v0.24)

Signature simplifications

  • .inner(&Margin{...}).inner(Margin{...}) (v0.27)
  • Buffer::filled(area, &Cell::new(...))Buffer::filled(area, Cell::new(...)) (v0.27)

NOT renamed

  • List::highlight_style() keeps its name (only Table was renamed)

Usage

bash

Manual follow-up

After running, you should:

  1. Update Cargo.toml to ratatui = "0.30.0" and review feature flags
  2. Clean up Title alignment/position chaining: .alignment(Alignment::Center).centered(), .position(TitlePosition::Bottom)title_bottom()
  3. Handle Flex::SpaceAroundFlex::SpaceEvenly if using the old behavior
  4. Review Backend trait implementations for the new Error associated type and clear_region method
  5. Handle Marker exhaustive match additions (add wildcard arm)
  6. Run cargo check and cargo test

Development

bash

References

License

MIT

Before

This is one example from the codemod's test cases. The codemod may handle many more cases.

Ready to contribute?

Build your own codemod and share it with the community.