Skip to main content

LayoutRefinement

Struct LayoutRefinement 

Source
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

Source

pub fn merge(self, other: LayoutRefinement) -> Self

Source

pub fn aspect_ratio(self, ratio: f32) -> Self

Source

pub fn relative(self) -> Self

Source

pub fn absolute(self) -> Self

Source

pub fn overflow_hidden(self) -> Self

Source

pub fn overflow_visible(self) -> Self

Source

pub fn overflow_x_hidden(self) -> Self

Source

pub fn overflow_y_hidden(self) -> Self

Source

pub fn inset(self, space: Space) -> Self

Source

pub fn inset_px(self, px: Px) -> Self

Source

pub fn inset_full(self) -> Self

Shorthand for inset: 100% of the containing block (percent sizing).

Source

pub fn inset_fraction(self, fraction: f32) -> Self

Shorthand for inset: <fraction> of the containing block.

Example: inset_fraction(0.5) == 50%.

Source

pub fn inset_percent(self, percent: f32) -> Self

Shorthand for inset: <percent>% of the containing block.

Source

pub fn top(self, space: Space) -> Self

Source

pub fn top_px(self, px: Px) -> Self

Source

pub fn top_full(self) -> Self

Shorthand for top: 100% of the containing block (percent sizing).

Source

pub fn top_fraction(self, fraction: f32) -> Self

Shorthand for top: <fraction> of the containing block.

Source

pub fn top_percent(self, percent: f32) -> Self

Shorthand for top: <percent>% of the containing block.

Source

pub fn top_neg(self, space: Space) -> Self

Source

pub fn top_neg_px(self, px: impl Into<MetricRef>) -> Self

Source

pub fn right(self, space: Space) -> Self

Source

pub fn right_px(self, px: Px) -> Self

Source

pub fn right_full(self) -> Self

Shorthand for right: 100% of the containing block (percent sizing).

Source

pub fn right_fraction(self, fraction: f32) -> Self

Shorthand for right: <fraction> of the containing block.

Source

pub fn right_percent(self, percent: f32) -> Self

Shorthand for right: <percent>% of the containing block.

Source

pub fn right_neg(self, space: Space) -> Self

Source

pub fn right_neg_px(self, px: impl Into<MetricRef>) -> Self

Source

pub fn bottom(self, space: Space) -> Self

Source

pub fn bottom_px(self, px: Px) -> Self

Source

pub fn bottom_full(self) -> Self

Shorthand for bottom: 100% of the containing block (percent sizing).

Source

pub fn bottom_fraction(self, fraction: f32) -> Self

Shorthand for bottom: <fraction> of the containing block.

Source

pub fn bottom_percent(self, percent: f32) -> Self

Shorthand for bottom: <percent>% of the containing block.

Source

pub fn bottom_neg(self, space: Space) -> Self

Source

pub fn bottom_neg_px(self, px: impl Into<MetricRef>) -> Self

Source

pub fn left(self, space: Space) -> Self

Source

pub fn left_px(self, px: Px) -> Self

Source

pub fn left_full(self) -> Self

Shorthand for left: 100% of the containing block (percent sizing).

Source

pub fn left_fraction(self, fraction: f32) -> Self

Shorthand for left: <fraction> of the containing block.

Source

pub fn left_percent(self, percent: f32) -> Self

Shorthand for left: <percent>% of the containing block.

Source

pub fn left_neg(self, space: Space) -> Self

Source

pub fn left_neg_px(self, px: impl Into<MetricRef>) -> Self

Source

pub fn m(self, space: Space) -> Self

Source

pub fn m_px(self, px: Px) -> Self

Source

pub fn m_neg(self, space: Space) -> Self

Source

pub fn m_auto(self) -> Self

Source

pub fn mx(self, space: Space) -> Self

Source

pub fn mx_px(self, px: Px) -> Self

Source

pub fn mx_neg(self, space: Space) -> Self

Source

pub fn mx_auto(self) -> Self

Source

pub fn my(self, space: Space) -> Self

Source

pub fn my_px(self, px: Px) -> Self

Source

pub fn my_neg(self, space: Space) -> Self

Source

pub fn my_auto(self) -> Self

Source

pub fn mt(self, space: Space) -> Self

Source

pub fn mt_px(self, px: Px) -> Self

Source

pub fn mt_neg(self, space: Space) -> Self

Source

pub fn mt_auto(self) -> Self

Source

pub fn mr(self, space: Space) -> Self

Source

pub fn mr_px(self, px: Px) -> Self

Source

pub fn mr_neg(self, space: Space) -> Self

Source

pub fn mr_auto(self) -> Self

Source

pub fn mb(self, space: Space) -> Self

Source

pub fn mb_px(self, px: Px) -> Self

Source

pub fn mb_neg(self, space: Space) -> Self

Source

pub fn mb_auto(self) -> Self

Source

pub fn ml(self, space: Space) -> Self

Source

pub fn ml_px(self, px: Px) -> Self

Source

pub fn ml_neg(self, space: Space) -> Self

Source

pub fn ml_auto(self) -> Self

Source

pub fn min_w(self, width: impl Into<MetricRef>) -> Self

Shorthand for min-width: <px>.

Source

pub fn min_w_space(self, width: Space) -> Self

Source

pub fn min_w_full(self) -> Self

Shorthand for min-width: 100% of the containing block.

Source

pub fn min_w_fraction(self, fraction: f32) -> Self

Shorthand for min-width: <fraction> of the containing block.

Source

pub fn min_w_percent(self, percent: f32) -> Self

Shorthand for min-width: <percent>% of the containing block.

Source

pub fn min_h(self, height: impl Into<MetricRef>) -> Self

Shorthand for min-height: <px>.

Source

pub fn min_h_space(self, height: Space) -> Self

Source

pub fn min_h_full(self) -> Self

Shorthand for min-height: 100% of the containing block.

Source

pub fn min_h_fraction(self, fraction: f32) -> Self

Shorthand for min-height: <fraction> of the containing block.

Source

pub fn min_h_percent(self, percent: f32) -> Self

Shorthand for min-height: <percent>% of the containing block.

Source

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.

Source

pub fn w(self, width: LengthRefinement) -> Self

Source

pub fn h(self, height: LengthRefinement) -> Self

Source

pub fn w_px(self, width: impl Into<MetricRef>) -> Self

Source

pub fn w_space(self, width: Space) -> Self

Source

pub fn w_auto(self) -> Self

Shorthand for width: auto.

Source

pub fn h_px(self, height: impl Into<MetricRef>) -> Self

Source

pub fn h_space(self, height: Space) -> Self

Source

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).

Source

pub fn w_fraction(self, fraction: f32) -> Self

Shorthand for width: <fraction> of the containing block.

Example: w_fraction(0.5) == 50% width.

Source

pub fn w_percent(self, percent: f32) -> Self

Shorthand for width: <percent>% of the containing block.

Source

pub fn h_full(self) -> Self

Shorthand for height: 100% of the containing block (percent sizing).

Source

pub fn h_fraction(self, fraction: f32) -> Self

Shorthand for height: <fraction> of the containing block.

Example: h_fraction(0.5) == 50% height.

Source

pub fn h_percent(self, percent: f32) -> Self

Shorthand for height: <percent>% of the containing block.

Source

pub fn size_full(self) -> Self

Source

pub fn max_w(self, width: impl Into<MetricRef>) -> Self

Shorthand for max-width: <px>.

Source

pub fn max_w_space(self, width: Space) -> Self

Source

pub fn max_w_full(self) -> Self

Shorthand for max-width: 100% of the containing block.

Source

pub fn max_w_fraction(self, fraction: f32) -> Self

Shorthand for max-width: <fraction> of the containing block.

Source

pub fn max_w_percent(self, percent: f32) -> Self

Shorthand for max-width: <percent>% of the containing block.

Source

pub fn max_h(self, height: impl Into<MetricRef>) -> Self

Shorthand for max-height: <px>.

Source

pub fn max_h_space(self, height: Space) -> Self

Source

pub fn max_h_full(self) -> Self

Shorthand for max-height: 100% of the containing block.

Source

pub fn max_h_fraction(self, fraction: f32) -> Self

Shorthand for max-height: <fraction> of the containing block.

Source

pub fn max_h_percent(self, percent: f32) -> Self

Shorthand for max-height: <percent>% of the containing block.

Source

pub fn basis(self, basis: LengthRefinement) -> Self

Source

pub fn basis_fraction(self, fraction: f32) -> Self

Shorthand for flex-basis: <fraction> of the containing block size (main axis).

Source

pub fn basis_percent(self, percent: f32) -> Self

Shorthand for flex-basis: <percent>% of the containing block size (main axis).

Source

pub fn basis_px(self, basis: impl Into<MetricRef>) -> Self

Source

pub fn basis_0(self) -> Self

Source

pub fn flex_grow(self, grow: f32) -> Self

Source

pub fn flex_shrink(self, shrink: f32) -> Self

Source

pub fn flex_shrink_0(self) -> Self

Source

pub fn order(self, order: i32) -> Self

Source

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.

Source

pub fn self_start(self) -> Self

Source

pub fn self_center(self) -> Self

Source

pub fn self_end(self) -> Self

Source

pub fn self_stretch(self) -> Self

Source

pub fn justify_self(self, align: CrossAlign) -> Self

Inline-axis item alignment for grid children (justify-self).

Source

pub fn justify_self_start(self) -> Self

Source

pub fn justify_self_center(self) -> Self

Source

pub fn justify_self_end(self) -> Self

Source

pub fn justify_self_stretch(self) -> Self

Source

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

pub fn flex_none(self) -> Self

Tailwind-like flex-none shorthand: grow=0, shrink=0, basis=auto.

Source§

impl LayoutRefinement

Source

pub fn w_0(self) -> Self

Source

pub fn h_0(self) -> Self

Source

pub fn min_h_0(self) -> Self

Source

pub fn max_w_0(self) -> Self

Source

pub fn max_h_0(self) -> Self

Source

pub fn w_0p5(self) -> Self

Source

pub fn h_0p5(self) -> Self

Source

pub fn min_w_0p5(self) -> Self

Source

pub fn min_h_0p5(self) -> Self

Source

pub fn max_w_0p5(self) -> Self

Source

pub fn max_h_0p5(self) -> Self

Source

pub fn w_1(self) -> Self

Source

pub fn h_1(self) -> Self

Source

pub fn min_w_1(self) -> Self

Source

pub fn min_h_1(self) -> Self

Source

pub fn max_w_1(self) -> Self

Source

pub fn max_h_1(self) -> Self

Source

pub fn w_1p5(self) -> Self

Source

pub fn h_1p5(self) -> Self

Source

pub fn min_w_1p5(self) -> Self

Source

pub fn min_h_1p5(self) -> Self

Source

pub fn max_w_1p5(self) -> Self

Source

pub fn max_h_1p5(self) -> Self

Source

pub fn w_2(self) -> Self

Source

pub fn h_2(self) -> Self

Source

pub fn min_w_2(self) -> Self

Source

pub fn min_h_2(self) -> Self

Source

pub fn max_w_2(self) -> Self

Source

pub fn max_h_2(self) -> Self

Source

pub fn w_2p5(self) -> Self

Source

pub fn h_2p5(self) -> Self

Source

pub fn min_w_2p5(self) -> Self

Source

pub fn min_h_2p5(self) -> Self

Source

pub fn max_w_2p5(self) -> Self

Source

pub fn max_h_2p5(self) -> Self

Source

pub fn w_3(self) -> Self

Source

pub fn h_3(self) -> Self

Source

pub fn min_w_3(self) -> Self

Source

pub fn min_h_3(self) -> Self

Source

pub fn max_w_3(self) -> Self

Source

pub fn max_h_3(self) -> Self

Source

pub fn w_3p5(self) -> Self

Source

pub fn h_3p5(self) -> Self

Source

pub fn min_w_3p5(self) -> Self

Source

pub fn min_h_3p5(self) -> Self

Source

pub fn max_w_3p5(self) -> Self

Source

pub fn max_h_3p5(self) -> Self

Source

pub fn w_4(self) -> Self

Source

pub fn h_4(self) -> Self

Source

pub fn min_w_4(self) -> Self

Source

pub fn min_h_4(self) -> Self

Source

pub fn max_w_4(self) -> Self

Source

pub fn max_h_4(self) -> Self

Source

pub fn w_5(self) -> Self

Source

pub fn h_5(self) -> Self

Source

pub fn min_w_5(self) -> Self

Source

pub fn min_h_5(self) -> Self

Source

pub fn max_w_5(self) -> Self

Source

pub fn max_h_5(self) -> Self

Source

pub fn w_6(self) -> Self

Source

pub fn h_6(self) -> Self

Source

pub fn min_w_6(self) -> Self

Source

pub fn min_h_6(self) -> Self

Source

pub fn max_w_6(self) -> Self

Source

pub fn max_h_6(self) -> Self

Source

pub fn w_8(self) -> Self

Source

pub fn h_8(self) -> Self

Source

pub fn min_w_8(self) -> Self

Source

pub fn min_h_8(self) -> Self

Source

pub fn max_w_8(self) -> Self

Source

pub fn max_h_8(self) -> Self

Source

pub fn w_10(self) -> Self

Source

pub fn h_10(self) -> Self

Source

pub fn min_w_10(self) -> Self

Source

pub fn min_h_10(self) -> Self

Source

pub fn max_w_10(self) -> Self

Source

pub fn max_h_10(self) -> Self

Source

pub fn w_11(self) -> Self

Source

pub fn h_11(self) -> Self

Source

pub fn min_w_11(self) -> Self

Source

pub fn min_h_11(self) -> Self

Source

pub fn max_w_11(self) -> Self

Source

pub fn max_h_11(self) -> Self

Trait Implementations§

Source§

impl Clone for LayoutRefinement

Source§

fn clone(&self) -> LayoutRefinement

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for LayoutRefinement

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for LayoutRefinement

Source§

fn default() -> LayoutRefinement

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> UiElementA11yExt for T

Source§

fn a11y(self, decoration: SemanticsDecoration) -> UiElementWithA11y<Self>

Source§

fn a11y_role(self, role: SemanticsRole) -> UiElementWithA11y<Self>

Source§

fn a11y_label(self, label: impl Into<Arc<str>>) -> UiElementWithA11y<Self>

Source§

fn a11y_value(self, value: impl Into<Arc<str>>) -> UiElementWithA11y<Self>

Source§

fn a11y_disabled(self, disabled: bool) -> UiElementWithA11y<Self>

Source§

fn a11y_selected(self, selected: bool) -> UiElementWithA11y<Self>

Source§

fn a11y_expanded(self, expanded: bool) -> UiElementWithA11y<Self>

Source§

fn a11y_checked(self, checked: Option<bool>) -> UiElementWithA11y<Self>

Source§

impl<T> UiElementKeyContextExt for T

Source§

fn key_context( self, key_context: impl Into<Arc<str>>, ) -> UiElementWithKeyContext<Self>

Source§

impl<T> UiElementTestIdExt for T

Source§

fn test_id(self, id: impl Into<Arc<str>>) -> UiElementWithTestId<Self>

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more