pub trait OverflowObserver {
// Required method
fn measured(&self, metrics: ContentMetrics);
// Provided method
fn overflow_pressed(&self) { ... }
}Expand description
The layout-time content-measurement seam: handed the ContentMetrics of
every layout pass, including whether the label overflowed.
Measurement only — deliberately no return value, so an observer cannot steer layout from inside it. The strategies that react to an overflow (scroll, popup, bottom sheet) are a follow-up; this is the signal they subscribe to.
Required Methods§
Sourcefn measured(&self, metrics: ContentMetrics)
fn measured(&self, metrics: ContentMetrics)
Called at the end of each of the button’s layout passes.
Provided Methods§
Sourcefn overflow_pressed(&self)
fn overflow_pressed(&self)
Called instead of firing the normal on_press when a press lands on
an overflowing button whose super::OverflowStrategy is
super::OverflowStrategy::BottomSheet — the hook an app shows its
own bottom sheet from (see that variant’s doc for why the widget
cannot do so itself). Defaulted to a no-op, mirroring
Self::measured’s own “install nothing, behave as if this trait did
not exist” shape.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".