Skip to main content

MeasureScope

Trait MeasureScope 

Source
pub trait MeasureScope {
    // Required methods
    fn density(&self) -> f32;
    fn font_scale(&self) -> f32;
}
Expand description

Scope for measurement operations.

This is Compose’s MeasureScope – the receiver MeasurePolicy.measure runs on, which is what lets a measure pass see the density of the subtree it is measuring rather than some process-wide default. There is no sensible fallback value for either method: a policy that reads density must be given the real grid, so both are required rather than defaulted.

Required Methods§

Source

fn density(&self) -> f32

Returns the current density for converting Dp to pixels.

Source

fn font_scale(&self) -> f32

Returns the current font scale for converting Sp to pixels.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§