Rename WidgetPtr to Wrapper and give it a builder
Bryan's call, 2026-09-16: a length and an alignment are properties of one widget, so a widget cannot both be 100 wide and take two shares of a row -- that needs two widgets, and the second one should do as little as possible. `WidgetPtr` already was that widget: it draws its child in the whole of its box and reports what the child said. It only lacked a name that says so and a way to make one around an existing widget. `Wrapper` rather than `Wrap` so it cannot be read as the text setting, and `.wrapper()` rather than `.wrapped()` for the same reason. Its child stays optional, since being a swappable slot is what it was written for and what the tab bar still uses it as. `set_ptr` is deleted rather than renamed. It had no caller, and putting a widget into an existing wrapper is what `Wrapper::set` already does. `tabs` draws its centred square again: `.sized((100, 100)).center() .wrapper().width(leftover(2))` is two widgets where the chain without `.wrapper()` was one, and `.width` was overwriting what `.sized` set. That was the last of the three ways `tabs` had drifted from canonical `main` unnoticed; what is left between them is the truncated multiply's antialiased edges and the widget count itself. `widget_trait!` takes no attributes, so `.wrapper()` carries an ordinary comment and the explanation lives on `Wrapper`. Checked: fmt, clippy, 83 suite tests, 17 core unit tests, the release oracle at 100 seeds, and `tabs` rendered at 1920x1200 against `main`'s own. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e166e005dc
commit
d21a21524f
4 files changed
+26
-10
No files matched your search
+2
-2
@@ -1,15 +1,15 @@
|
||||
mod image;
|
||||
mod mask;
|
||||
mod position;
|
||||
mod ptr;
|
||||
mod rect;
|
||||
mod text;
|
||||
mod trait_fns;
|
||||
mod wrapper;
|
||||
|
||||
pub use image::*;
|
||||
pub use mask::*;
|
||||
pub use position::*;
|
||||
pub use ptr::*;
|
||||
pub use rect::*;
|
||||
pub use text::*;
|
||||
pub use trait_fns::*;
|
||||
pub use wrapper::*;
|
||||
Reference in new issue
Block a user