pub type MeasureFn<'a> = Box<dyn Fn(Option<f32>, Option<f32>) -> Size + 'a>;Expand description
A constrained measurement for a leaf whose size depends on the space
offered — wrapping text, custom-painted content. It receives the maximum
width and height (None = unconstrained) and returns the content’s size. Taffy
calls it during layout, including for intrinsic sizes (min-content gives a
width of Some(0.0), max-content gives None).
The lifetime is what lets a measurement borrow: a text’s closure owns everything
it needs and is 'static, but a crate::Layout built for a widget tree can hold a
closure that borrows the tree, which is how a box whose content is built from the
space offered gets measured at all.
Aliased Type§
pub struct MeasureFn<'a>(/* private fields */);