Skip to main content

ContainerWithContentExt

Trait ContainerWithContentExt 

pub trait ContainerWithContentExt: 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§

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

Set the axis children are stacked along. See Direction.

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

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

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

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

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

Set the gap inserted between adjacent children, in pixels.

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

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

fn center(self) -> Self

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

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

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

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

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

fn vertical(self) -> Self

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

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§