Skip to main content

TextMeasure

Trait TextMeasure 

Source
pub trait TextMeasure {
    // Required method
    fn measure_text(
        &self,
        widget_id: WidgetId,
        known_dimensions: Size<Option<f32>>,
        available_space: Size<AvailableSpace>,
    ) -> Option<Size<f32>>;
}
Expand description

Measures text for the shared layout pass (TEXT-004).

Backend inherits this trait so the shared layout can ask a lane for a widget’s natural text dimensions without widening the backend contract itself.

Required Methods§

Source

fn measure_text( &self, widget_id: WidgetId, known_dimensions: Size<Option<f32>>, available_space: Size<AvailableSpace>, ) -> Option<Size<f32>>

Measures the logical dimensions of a text-bearing widget given the available space (TEXT-004).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§