pub struct LayoutRefinement {
pub aspect_ratio: Option<f32>,
pub margin: Option<MarginRefinement>,
pub position: Option<PositionStyle>,
pub inset: Option<InsetRefinement>,
pub size: Option<SizeRefinement>,
pub flex_item: Option<FlexItemRefinement>,
pub align_self: Option<CrossAlign>,
pub justify_self: Option<CrossAlign>,
pub overflow: Option<OverflowRefinement>,
}Expand description
Layout-affecting style patches (margin, positioning, size constraints, flex/grid).
These apply only in the declarative authoring path (or via explicit wrappers). Retained widgets must not silently accept these fields, as that would create Tailwind-like APIs that appear to work but are actually no-ops.
Fields§
§aspect_ratio: Option<f32>§margin: Option<MarginRefinement>§position: Option<PositionStyle>§inset: Option<InsetRefinement>§size: Option<SizeRefinement>§flex_item: Option<FlexItemRefinement>§align_self: Option<CrossAlign>§justify_self: Option<CrossAlign>§overflow: Option<OverflowRefinement>Implementations§
Source§impl LayoutRefinement
impl LayoutRefinement
pub fn merge(self, other: LayoutRefinement) -> Self
pub fn aspect_ratio(self, ratio: f32) -> Self
pub fn relative(self) -> Self
pub fn absolute(self) -> Self
pub fn overflow_visible(self) -> Self
pub fn inset(self, space: Space) -> Self
pub fn inset_px(self, px: Px) -> Self
Sourcepub fn inset_full(self) -> Self
pub fn inset_full(self) -> Self
Shorthand for inset: 100% of the containing block (percent sizing).
Sourcepub fn inset_fraction(self, fraction: f32) -> Self
pub fn inset_fraction(self, fraction: f32) -> Self
Shorthand for inset: <fraction> of the containing block.
Example: inset_fraction(0.5) == 50%.
Sourcepub fn inset_percent(self, percent: f32) -> Self
pub fn inset_percent(self, percent: f32) -> Self
Shorthand for inset: <percent>% of the containing block.
pub fn top(self, space: Space) -> Self
pub fn top_px(self, px: Px) -> Self
Sourcepub fn top_full(self) -> Self
pub fn top_full(self) -> Self
Shorthand for top: 100% of the containing block (percent sizing).
Sourcepub fn top_fraction(self, fraction: f32) -> Self
pub fn top_fraction(self, fraction: f32) -> Self
Shorthand for top: <fraction> of the containing block.
Sourcepub fn top_percent(self, percent: f32) -> Self
pub fn top_percent(self, percent: f32) -> Self
Shorthand for top: <percent>% of the containing block.
pub fn top_neg(self, space: Space) -> Self
pub fn top_neg_px(self, px: impl Into<MetricRef>) -> Self
pub fn right(self, space: Space) -> Self
pub fn right_px(self, px: Px) -> Self
Sourcepub fn right_full(self) -> Self
pub fn right_full(self) -> Self
Shorthand for right: 100% of the containing block (percent sizing).
Sourcepub fn right_fraction(self, fraction: f32) -> Self
pub fn right_fraction(self, fraction: f32) -> Self
Shorthand for right: <fraction> of the containing block.
Sourcepub fn right_percent(self, percent: f32) -> Self
pub fn right_percent(self, percent: f32) -> Self
Shorthand for right: <percent>% of the containing block.
pub fn right_neg(self, space: Space) -> Self
pub fn right_neg_px(self, px: impl Into<MetricRef>) -> Self
pub fn bottom(self, space: Space) -> Self
pub fn bottom_px(self, px: Px) -> Self
Sourcepub fn bottom_full(self) -> Self
pub fn bottom_full(self) -> Self
Shorthand for bottom: 100% of the containing block (percent sizing).
Sourcepub fn bottom_fraction(self, fraction: f32) -> Self
pub fn bottom_fraction(self, fraction: f32) -> Self
Shorthand for bottom: <fraction> of the containing block.
Sourcepub fn bottom_percent(self, percent: f32) -> Self
pub fn bottom_percent(self, percent: f32) -> Self
Shorthand for bottom: <percent>% of the containing block.
pub fn bottom_neg(self, space: Space) -> Self
pub fn bottom_neg_px(self, px: impl Into<MetricRef>) -> Self
pub fn left(self, space: Space) -> Self
pub fn left_px(self, px: Px) -> Self
Sourcepub fn left_full(self) -> Self
pub fn left_full(self) -> Self
Shorthand for left: 100% of the containing block (percent sizing).
Sourcepub fn left_fraction(self, fraction: f32) -> Self
pub fn left_fraction(self, fraction: f32) -> Self
Shorthand for left: <fraction> of the containing block.
Sourcepub fn left_percent(self, percent: f32) -> Self
pub fn left_percent(self, percent: f32) -> Self
Shorthand for left: <percent>% of the containing block.
pub fn left_neg(self, space: Space) -> Self
pub fn left_neg_px(self, px: impl Into<MetricRef>) -> Self
pub fn m(self, space: Space) -> Self
pub fn m_px(self, px: Px) -> Self
pub fn m_neg(self, space: Space) -> Self
pub fn m_auto(self) -> Self
pub fn mx(self, space: Space) -> Self
pub fn mx_px(self, px: Px) -> Self
pub fn mx_neg(self, space: Space) -> Self
pub fn mx_auto(self) -> Self
pub fn my(self, space: Space) -> Self
pub fn my_px(self, px: Px) -> Self
pub fn my_neg(self, space: Space) -> Self
pub fn my_auto(self) -> Self
pub fn mt(self, space: Space) -> Self
pub fn mt_px(self, px: Px) -> Self
pub fn mt_neg(self, space: Space) -> Self
pub fn mt_auto(self) -> Self
pub fn mr(self, space: Space) -> Self
pub fn mr_px(self, px: Px) -> Self
pub fn mr_neg(self, space: Space) -> Self
pub fn mr_auto(self) -> Self
pub fn mb(self, space: Space) -> Self
pub fn mb_px(self, px: Px) -> Self
pub fn mb_neg(self, space: Space) -> Self
pub fn mb_auto(self) -> Self
pub fn ml(self, space: Space) -> Self
pub fn ml_px(self, px: Px) -> Self
pub fn ml_neg(self, space: Space) -> Self
pub fn ml_auto(self) -> Self
pub fn min_w_space(self, width: Space) -> Self
Sourcepub fn min_w_full(self) -> Self
pub fn min_w_full(self) -> Self
Shorthand for min-width: 100% of the containing block.
Sourcepub fn min_w_fraction(self, fraction: f32) -> Self
pub fn min_w_fraction(self, fraction: f32) -> Self
Shorthand for min-width: <fraction> of the containing block.
Sourcepub fn min_w_percent(self, percent: f32) -> Self
pub fn min_w_percent(self, percent: f32) -> Self
Shorthand for min-width: <percent>% of the containing block.
pub fn min_h_space(self, height: Space) -> Self
Sourcepub fn min_h_full(self) -> Self
pub fn min_h_full(self) -> Self
Shorthand for min-height: 100% of the containing block.
Sourcepub fn min_h_fraction(self, fraction: f32) -> Self
pub fn min_h_fraction(self, fraction: f32) -> Self
Shorthand for min-height: <fraction> of the containing block.
Sourcepub fn min_h_percent(self, percent: f32) -> Self
pub fn min_h_percent(self, percent: f32) -> Self
Shorthand for min-height: <percent>% of the containing block.
Sourcepub fn min_w_0(self) -> Self
pub fn min_w_0(self) -> Self
Shorthand for min-width: 0px.
This is especially important for text-heavy children in a horizontal flex row: without it,
the flex item may refuse to shrink (web-like min-width: auto behavior), causing overflow.
pub fn w(self, width: LengthRefinement) -> Self
pub fn h(self, height: LengthRefinement) -> Self
pub fn w_px(self, width: impl Into<MetricRef>) -> Self
pub fn w_space(self, width: Space) -> Self
pub fn h_px(self, height: impl Into<MetricRef>) -> Self
pub fn h_space(self, height: Space) -> Self
Sourcepub fn w_full(self) -> Self
pub fn w_full(self) -> Self
Shorthand for width: 100% of the containing block (percent sizing).
This is not the same as Tailwind flex-1. For “take the remaining space as a flex
item”, use Self::flex_1 (and typically Self::min_w_0 for text).
Sourcepub fn w_fraction(self, fraction: f32) -> Self
pub fn w_fraction(self, fraction: f32) -> Self
Shorthand for width: <fraction> of the containing block.
Example: w_fraction(0.5) == 50% width.
Sourcepub fn w_percent(self, percent: f32) -> Self
pub fn w_percent(self, percent: f32) -> Self
Shorthand for width: <percent>% of the containing block.
Sourcepub fn h_full(self) -> Self
pub fn h_full(self) -> Self
Shorthand for height: 100% of the containing block (percent sizing).
Sourcepub fn h_fraction(self, fraction: f32) -> Self
pub fn h_fraction(self, fraction: f32) -> Self
Shorthand for height: <fraction> of the containing block.
Example: h_fraction(0.5) == 50% height.
Sourcepub fn h_percent(self, percent: f32) -> Self
pub fn h_percent(self, percent: f32) -> Self
Shorthand for height: <percent>% of the containing block.
pub fn size_full(self) -> Self
pub fn max_w_space(self, width: Space) -> Self
Sourcepub fn max_w_full(self) -> Self
pub fn max_w_full(self) -> Self
Shorthand for max-width: 100% of the containing block.
Sourcepub fn max_w_fraction(self, fraction: f32) -> Self
pub fn max_w_fraction(self, fraction: f32) -> Self
Shorthand for max-width: <fraction> of the containing block.
Sourcepub fn max_w_percent(self, percent: f32) -> Self
pub fn max_w_percent(self, percent: f32) -> Self
Shorthand for max-width: <percent>% of the containing block.
pub fn max_h_space(self, height: Space) -> Self
Sourcepub fn max_h_full(self) -> Self
pub fn max_h_full(self) -> Self
Shorthand for max-height: 100% of the containing block.
Sourcepub fn max_h_fraction(self, fraction: f32) -> Self
pub fn max_h_fraction(self, fraction: f32) -> Self
Shorthand for max-height: <fraction> of the containing block.
Sourcepub fn max_h_percent(self, percent: f32) -> Self
pub fn max_h_percent(self, percent: f32) -> Self
Shorthand for max-height: <percent>% of the containing block.
pub fn basis(self, basis: LengthRefinement) -> Self
Sourcepub fn basis_fraction(self, fraction: f32) -> Self
pub fn basis_fraction(self, fraction: f32) -> Self
Shorthand for flex-basis: <fraction> of the containing block size (main axis).
Sourcepub fn basis_percent(self, percent: f32) -> Self
pub fn basis_percent(self, percent: f32) -> Self
Shorthand for flex-basis: <percent>% of the containing block size (main axis).
pub fn basis_px(self, basis: impl Into<MetricRef>) -> Self
pub fn basis_0(self) -> Self
pub fn flex_grow(self, grow: f32) -> Self
pub fn flex_shrink(self, shrink: f32) -> Self
pub fn flex_shrink_0(self) -> Self
pub fn order(self, order: i32) -> Self
Sourcepub fn align_self(self, align: CrossAlign) -> Self
pub fn align_self(self, align: CrossAlign) -> Self
Per-item alignment on the container cross axis.
This feeds both flex and grid align-self so first-party surfaces can express self-*
semantics without patching raw layout props after style resolution.
pub fn self_start(self) -> Self
pub fn self_center(self) -> Self
pub fn self_end(self) -> Self
pub fn self_stretch(self) -> Self
Sourcepub fn justify_self(self, align: CrossAlign) -> Self
pub fn justify_self(self, align: CrossAlign) -> Self
Inline-axis item alignment for grid children (justify-self).
pub fn justify_self_start(self) -> Self
pub fn justify_self_center(self) -> Self
pub fn justify_self_end(self) -> Self
pub fn justify_self_stretch(self) -> Self
Sourcepub fn flex_1(self) -> Self
pub fn flex_1(self) -> Self
Tailwind-like flex-1 shorthand: grow=1, shrink=1, basis=0.
Tip: combine with Self::min_w_0 when the child contains text that should be allowed to
shrink/wrap instead of overflowing.
Source§impl LayoutRefinement
impl LayoutRefinement
pub fn w_0(self) -> Self
pub fn h_0(self) -> Self
pub fn min_h_0(self) -> Self
pub fn max_w_0(self) -> Self
pub fn max_h_0(self) -> Self
pub fn w_0p5(self) -> Self
pub fn h_0p5(self) -> Self
pub fn min_w_0p5(self) -> Self
pub fn min_h_0p5(self) -> Self
pub fn max_w_0p5(self) -> Self
pub fn max_h_0p5(self) -> Self
pub fn w_1(self) -> Self
pub fn h_1(self) -> Self
pub fn min_w_1(self) -> Self
pub fn min_h_1(self) -> Self
pub fn max_w_1(self) -> Self
pub fn max_h_1(self) -> Self
pub fn w_1p5(self) -> Self
pub fn h_1p5(self) -> Self
pub fn min_w_1p5(self) -> Self
pub fn min_h_1p5(self) -> Self
pub fn max_w_1p5(self) -> Self
pub fn max_h_1p5(self) -> Self
pub fn w_2(self) -> Self
pub fn h_2(self) -> Self
pub fn min_w_2(self) -> Self
pub fn min_h_2(self) -> Self
pub fn max_w_2(self) -> Self
pub fn max_h_2(self) -> Self
pub fn w_2p5(self) -> Self
pub fn h_2p5(self) -> Self
pub fn min_w_2p5(self) -> Self
pub fn min_h_2p5(self) -> Self
pub fn max_w_2p5(self) -> Self
pub fn max_h_2p5(self) -> Self
pub fn w_3(self) -> Self
pub fn h_3(self) -> Self
pub fn min_w_3(self) -> Self
pub fn min_h_3(self) -> Self
pub fn max_w_3(self) -> Self
pub fn max_h_3(self) -> Self
pub fn w_3p5(self) -> Self
pub fn h_3p5(self) -> Self
pub fn min_w_3p5(self) -> Self
pub fn min_h_3p5(self) -> Self
pub fn max_w_3p5(self) -> Self
pub fn max_h_3p5(self) -> Self
pub fn w_4(self) -> Self
pub fn h_4(self) -> Self
pub fn min_w_4(self) -> Self
pub fn min_h_4(self) -> Self
pub fn max_w_4(self) -> Self
pub fn max_h_4(self) -> Self
pub fn w_5(self) -> Self
pub fn h_5(self) -> Self
pub fn min_w_5(self) -> Self
pub fn min_h_5(self) -> Self
pub fn max_w_5(self) -> Self
pub fn max_h_5(self) -> Self
pub fn w_6(self) -> Self
pub fn h_6(self) -> Self
pub fn min_w_6(self) -> Self
pub fn min_h_6(self) -> Self
pub fn max_w_6(self) -> Self
pub fn max_h_6(self) -> Self
pub fn w_8(self) -> Self
pub fn h_8(self) -> Self
pub fn min_w_8(self) -> Self
pub fn min_h_8(self) -> Self
pub fn max_w_8(self) -> Self
pub fn max_h_8(self) -> Self
pub fn w_10(self) -> Self
pub fn h_10(self) -> Self
pub fn min_w_10(self) -> Self
pub fn min_h_10(self) -> Self
pub fn max_w_10(self) -> Self
pub fn max_h_10(self) -> Self
pub fn w_11(self) -> Self
pub fn h_11(self) -> Self
pub fn min_w_11(self) -> Self
pub fn min_h_11(self) -> Self
pub fn max_w_11(self) -> Self
pub fn max_h_11(self) -> Self
Trait Implementations§
Source§impl Clone for LayoutRefinement
impl Clone for LayoutRefinement
Source§fn clone(&self) -> LayoutRefinement
fn clone(&self) -> LayoutRefinement
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more