pub trait SecondaryAlignment: Alignment {
type First: Alignment;
// Required method
fn measure(prev: Size, view_size: Size) -> Size;
}
Expand description
Secondary alignment is used to align views perpendicular to the placement axis.
For example, use horizontal::Right
to align views to the right in a vertical linear layout.
SecondaryAlignment
should be implemented by custom Alignment
types, otherwise they won’t be
compatible with LinearLayout
.
Required Associated Types§
Required Methods§
Sourcefn measure(prev: Size, view_size: Size) -> Size
fn measure(prev: Size, view_size: Size) -> Size
Return the combined Size
occupied by both Views
after they are arranged.
I.e. horizontal::Left
returns the maximum width, while horizontal::LeftToRight
returns the sum of the two widths.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.