GPU-accelerated UI toolkit (Vulkan)
git clone https://git.lucas.co/cce-ui.git
refactor(widget): dead Control subtrait deleted (6bd value-shrink rider)
Zero dyn consumers and zero control_label() callers; every one of its eight
impls routed set_label to the inherent Adapted shadow, so call sites are
untouched. 165 tests; full workspace compiles.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01N4ajhvVZtyEEEus9bodsj3
docs/rfc-core-rebuild.md | 5 +++++
src/widget/input/button.rs | 7 +------
src/widget/input/checkbox.rs | 16 +---------------
src/widget/input/dropdown.rs | 7 +------
src/widget/input/slider.rs | 12 +-----------
src/widget/input/spinbox.rs | 7 +------
src/widget/input/text_box.rs | 5 -----
src/widget/mod.rs | 41 ++++-------------------------------------
8 files changed, 14 insertions(+), 86 deletions(-)
diff --git a/docs/rfc-core-rebuild.md b/docs/rfc-core-rebuild.md
index 57b89df..e4c9222 100644
--- a/docs/rfc-core-rebuild.md
+++ b/docs/rfc-core-rebuild.md
@@ -2097,6 +2097,11 @@ Constraint respected: **each crate still builds standalone** — the new core is
baseline; TI live probe — Button/Toggle clicks, Layout
dropdown popover open, and a "Grid" selection re-laying out
the gallery through the new roster drains end-to-end.
+ RIDER: the `Control` subtrait (set_label + control_label) is
+ DELETED — zero dyn consumers, zero `control_label()` callers;
+ every impl just routed `set_label` to the inherent shadow, so
+ the deletion is call-site-invisible (compile-verified across
+ the workspace).
Former slices 4/5 fold in: the app `as_ptr_mut` dispatch sites
are rewritten by whichever of routed-events (per app) or the
phase-4 flip reaches them first; no standalone pointer-to-id
diff --git a/src/widget/input/button.rs b/src/widget/input/button.rs
index 8df5562..7acd972 100644
--- a/src/widget/input/button.rs
+++ b/src/widget/input/button.rs
@@ -8,7 +8,7 @@ use crate::colors;
use crate::scene::layout::{Rect, Size};
use crate::scene::paint::PaintCtx;
use crate::widget::{
- Adapted, Control, WidgetHost, ElementState, Event, EventCtx, Input, Justification, Layout,
+ Adapted, WidgetHost, ElementState, Event, EventCtx, Input, Justification, Layout,
MouseButton, Paint,
};
@@ -353,11 +353,6 @@ impl Input for Button {
}
}
-impl Control for Adapted<Button> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
pub enum PageButton {
Active,
diff --git a/src/widget/input/checkbox.rs b/src/widget/input/checkbox.rs
index 071dbfd..2143f04 100644
--- a/src/widget/input/checkbox.rs
+++ b/src/widget/input/checkbox.rs
@@ -12,7 +12,7 @@
use crate::colors;
use crate::scene::layout::Rect;
use crate::scene::paint::PaintCtx;
-use crate::widget::{Adapted, Control, ElementState, Event, EventCtx, Input, Layout, MouseButton, Paint};
+use crate::widget::{Adapted, ElementState, Event, EventCtx, Input, Layout, MouseButton, Paint};
fn parse_bool(val: &str) -> Option<bool> {
match val.trim().to_lowercase().as_str() {
@@ -439,20 +439,6 @@ impl Input for Toggle {
}
}
-// The `set_label` overrides route the trait entry point (e.g. `dyn Control` callers) to the
-// synced inherent version — `Control`'s default writes only the base label, which would leave
-// these self-painting labels stale.
-impl Control for Adapted<Checkbox> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
-impl Control for Adapted<Toggle> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
-
#[cfg(test)]
mod tests {
use super::*;
diff --git a/src/widget/input/dropdown.rs b/src/widget/input/dropdown.rs
index 388db80..89ab524 100644
--- a/src/widget/input/dropdown.rs
+++ b/src/widget/input/dropdown.rs
@@ -20,7 +20,7 @@ use crate::scene::layout::{Rect, Size};
use crate::scene::paint::PaintCtx;
use crate::widget::model::{Adapted, EventCtx, Input, Layout, Paint};
use crate::widget::{
- Control, WidgetHost, ElementState, Event, Key, MouseButton, NamedKey,
+ WidgetHost, ElementState, Event, Key, MouseButton, NamedKey,
};
/// Read-data stand-in for the legacy direct-write `parent` pointer (6bd — no stored widget
@@ -810,11 +810,6 @@ impl Input for Dropdown {
unsafe impl Send for Dropdown {}
unsafe impl Sync for Dropdown {}
-impl Control for Adapted<Dropdown> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
#[cfg(test)]
mod tests {
diff --git a/src/widget/input/slider.rs b/src/widget/input/slider.rs
index 3d66875..2ba6eb6 100644
--- a/src/widget/input/slider.rs
+++ b/src/widget/input/slider.rs
@@ -10,7 +10,7 @@ use crate::colors;
use crate::scene::layout::{Rect, Size};
use crate::scene::paint::PaintCtx;
use crate::widget::{
- Adapted, Control, ElementState, Event, EventCtx, Input, Key, Layout, MouseButton,
+ Adapted, ElementState, Event, EventCtx, Input, Key, Layout, MouseButton,
MouseScrollDelta, NamedKey, Paint, TextEditorState,
};
@@ -429,11 +429,6 @@ impl Input for Slider {
}
}
-impl Control for Adapted<Slider> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum ActiveThumb {
@@ -679,11 +674,6 @@ impl Input for RangeSlider {
}
}
-impl Control for Adapted<RangeSlider> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
#[cfg(test)]
mod tests {
diff --git a/src/widget/input/spinbox.rs b/src/widget/input/spinbox.rs
index 014f9e0..89766ea 100644
--- a/src/widget/input/spinbox.rs
+++ b/src/widget/input/spinbox.rs
@@ -7,7 +7,7 @@ use crate::colors;
use crate::scene::layout::{Rect, Size};
use crate::scene::paint::PaintCtx;
use crate::widget::{
- Adapted, Control, ElementState, Event, EventCtx, Input, Key, Layout, MouseButton, NamedKey,
+ Adapted, ElementState, Event, EventCtx, Input, Key, Layout, MouseButton, NamedKey,
Paint, TextEditorState,
};
@@ -431,11 +431,6 @@ impl Input for Spinbox {
}
}
-impl Control for Adapted<Spinbox> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
#[cfg(test)]
mod tests {
diff --git a/src/widget/input/text_box.rs b/src/widget/input/text_box.rs
index 2963b98..059269a 100644
--- a/src/widget/input/text_box.rs
+++ b/src/widget/input/text_box.rs
@@ -1471,11 +1471,6 @@ impl Default for Adapted<TextBox> {
unsafe impl Send for TextBox {}
unsafe impl Sync for TextBox {}
-impl Control for Adapted<TextBox> {
- fn set_label(&mut self, label: &str) {
- Adapted::set_label(self, label);
- }
-}
#[cfg(test)]
mod tests {
diff --git a/src/widget/mod.rs b/src/widget/mod.rs
index 6edc8d6..12a819d 100644
--- a/src/widget/mod.rs
+++ b/src/widget/mod.rs
@@ -524,43 +524,10 @@ pub trait WidgetHost {
}
}
-pub trait Control: WidgetHost {
- fn set_label(&mut self, label: &str) {
- self.base_mut().label = Some(label.to_string());
- }
-
- fn control_label(&self) -> Option<TextLabel> {
- let b = self.base();
- let label = b.label.as_ref()?;
- let name = self.type_name();
-
- let (_, font_size) = crate::layout::control_label_font_detached_parsed();
- let color = colors::control_label_color_detached_for_state(b.hovered, b.focused);
- if crate::layout::control_label_layout() == "side" {
- let y_pos = crate::layout::align_text_y(b.y, b.h, font_size, 0.0);
- Some(TextLabel {
- text: label.clone(),
- x: b.x + 4.0,
- y: y_pos,
- font_size,
- color,
- })
- } else {
- let x_offset = if name == "Slider" || name == "RangeSlider" {
- 0.0
- } else {
- 4.0
- };
- Some(TextLabel {
- text: label.clone(),
- x: b.x + x_offset,
- y: b.y,
- font_size,
- color,
- })
- }
- }
-}
+// The `Control` subtrait (set_label + control_label) is DELETED (6bd value shrink):
+// zero dyn consumers and zero `control_label()` callers remained; `set_label` lives on as
+// the inherent `Adapted<W>` method every call site already resolved to (it shadowed the
+// trait), and detached-label paint moved to the adapter in the Phase 5 leaf sweeps.
pub mod core;
pub mod input;