pub trait Styled: Sized {
Show 16 methods
// Required method
fn style_mut(&mut self) -> &mut Style;
// Provided methods
fn padding(self, p: f32) -> Self { ... }
fn padding_xy(self, x: f32, y: f32) -> Self { ... }
fn gap(self, g: f32) -> Self { ... }
fn grow(self, g: f32) -> Self { ... }
fn shrink(self, s: f32) -> Self { ... }
fn width(self, w: f32) -> Self { ... }
fn height(self, h: f32) -> Self { ... }
fn min_width(self, w: f32) -> Self { ... }
fn min_height(self, h: f32) -> Self { ... }
fn max_height(self, h: f32) -> Self { ... }
fn fill(self) -> Self { ... }
fn fill_width(self) -> Self { ... }
fn align(self, a: AlignItems) -> Self { ... }
fn justify(self, j: JustifyContent) -> Self { ... }
fn wrap(self) -> Self { ... }
}Expand description
Flex-layout modifiers shared by every widget that owns a Style.
Required Methods§
Provided Methods§
Sourcefn padding(self, p: f32) -> Self
fn padding(self, p: f32) -> Self
Space between the box’s edges and its children on all sides, logical px.
Sourcefn padding_xy(self, x: f32, y: f32) -> Self
fn padding_xy(self, x: f32, y: f32) -> Self
Padding of x left and right and y top and bottom, logical px.
Sourcefn grow(self, g: f32) -> Self
fn grow(self, g: f32) -> Self
Share of the parent’s spare main-axis space to take; 0 by default.
The content still sets the minimum, so see fill around a scroll().
Sourcefn shrink(self, s: f32) -> Self
fn shrink(self, s: f32) -> Self
How much to give up when the parent is too small; 1 by default, 0 keeps the size.
Sourcefn min_width(self, w: f32) -> Self
fn min_width(self, w: f32) -> Self
Lower bound on the width, logical px; min_width(0.0) lets a flex child shrink below its content.
Sourcefn min_height(self, h: f32) -> Self
fn min_height(self, h: f32) -> Self
Lower bound on the height, logical px; min_height(0.0) lets a flex child shrink below its content.
Sourcefn max_height(self, h: f32) -> Self
fn max_height(self, h: f32) -> Self
Upper bound on the height, logical px, e.g. a scroll() that grows with its content up to a point.
Sourcefn fill(self) -> Self
fn fill(self) -> Self
Takes the space left along the parent’s main axis, and no more: unlike
grow(1.0), the content’s size doesn’t push the parent. Use it on
every flex box between the window and a scroll(). In a row, siblings
that all fill get equal widths, whatever their content.
Sourcefn fill_width(self) -> Self
fn fill_width(self) -> Self
As wide as the parent’s content box, whatever the flex direction.
Sourcefn align(self, a: AlignItems) -> Self
fn align(self, a: AlignItems) -> Self
Places children on the cross axis: across a row, along a column.
Sourcefn justify(self, j: JustifyContent) -> Self
fn justify(self, j: JustifyContent) -> Self
Distributes children and spare space along the main axis.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".