Skip to main content

ContainerWithContentExt

Trait ContainerWithContentExt 

Source
pub trait ContainerWithContentExt
where Self: LayoutExt,
{ // Provided methods fn direction(self, direction: Direction) -> Self { ... } fn main_align(self, main_align: Alignment) -> Self { ... } fn cross_align(self, cross_align: Alignment) -> Self { ... } fn spacing(self, spacing: impl Into<f32>) -> Self { ... } fn content(self, content: Content) -> Self { ... } fn center(self) -> Self { ... } fn offset_x(self, offset_x: impl Into<f32>) -> Self { ... } fn offset_y(self, offset_y: impl Into<f32>) -> Self { ... } fn vertical(self) -> Self { ... } fn horizontal(self) -> Self { ... } }
Expand description

Layout methods for containers that arrange children along a direction axis.

Provided Methods§

Source

fn direction(self, direction: Direction) -> Self

Set the axis children are stacked along. See [Direction].

Source

fn main_align(self, main_align: Alignment) -> Self

Set how children are aligned along the direction axis. See [Alignment].

Source

fn cross_align(self, cross_align: Alignment) -> Self

Set how children are aligned across the direction axis. See [Alignment].

Source

fn spacing(self, spacing: impl Into<f32>) -> Self

Set the gap inserted between adjacent children, in pixels.

Source

fn content(self, content: Content) -> Self

Set how children share the available space along the direction axis. See [Content].

Source

fn center(self) -> Self

Center children on both axes. Shorthand for main_align and cross_align set to [Alignment::Center].

Source

fn offset_x(self, offset_x: impl Into<f32>) -> Self

Shift the element’s children horizontally by the given pixels.

Source

fn offset_y(self, offset_y: impl Into<f32>) -> Self

Shift the element’s children vertically by the given pixels.

Source

fn vertical(self) -> Self

Stack children vertically. Shorthand for direction set to [Direction::Vertical].

Source

fn horizontal(self) -> Self

Stack children horizontally. Shorthand for direction set to [Direction::Horizontal].

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.

Implementors§