pub trait Element {
// Required methods
fn measure(&self, ctx: MeasureCtx<'_>) -> ElementSize;
fn draw(&self, ctx: DrawCtx<'_, '_>) -> ElementSize;
// Provided methods
fn first_location_usage(
&self,
ctx: FirstLocationUsageCtx<'_>,
) -> FirstLocationUsage { ... }
fn with_padding_top(self, padding: f32) -> Padding<Self>
where Self: Sized { ... }
fn with_vertical_padding(self, padding: f32) -> Padding<Self>
where Self: Sized { ... }
fn debug(self, color: u8) -> Debug<Self>
where Self: Sized { ... }
}Expand description
Rules: Width returned from measure has to be matched in draw given the same constraint (even if there’s some preferred height).