Use new with_* naming scheme

All builder-like functions are now named with_*. There is also now a way
to set each property imperatively with only a mutable reference.

The only widgets I haven't yet converted to this style are the Join*
widgets; they're a bit harder to figure out an appropriate API for.
This commit is contained in:
Joscha 2023-02-20 15:53:49 +01:00
parent cb483431cc
commit 607c11fea4
11 changed files with 125 additions and 90 deletions

View file

@ -11,14 +11,14 @@ fn widget() -> impl Widget<io::Error> {
.then("Press any key to exit", Style::new().on_dark_blue());
Text::new(styled)
.padding()
.horizontal(1)
.with_horizontal(1)
.border()
.look(BorderLook::LINE_DOUBLE)
.style(Style::new().dark_red())
.with_look(BorderLook::LINE_DOUBLE)
.with_style(Style::new().dark_red())
.background()
.style(Style::new().on_yellow().opaque())
.with_style(Style::new().on_yellow().opaque())
.float()
.all(0.5)
.with_all(0.5)
}
fn render_frame(term: &mut Terminal) {