Skip to main content

LayoutProps

Struct LayoutProps 

Source
pub struct LayoutProps {
Show 22 fields pub display: Display, pub hidden: bool, pub direction: Direction, pub wrap: bool, pub grow: f32, pub shrink: f32, pub basis: Length, pub width: Length, pub height: Length, pub min_width: Length, pub min_height: Length, pub max_width: Length, pub max_height: Length, pub padding: Edges<Length>, pub margin: Edges<Length>, pub gap: Size, pub align_items: Option<Align>, pub justify_content: Option<Justify>, pub position: Position, pub inset: Edges<Length>, pub border_width: Edges<f32>, pub overflow: Overflow,
}
Expand description

The properties that take part in layout.

Every field here reaches the layout engine, so a change to any of them requires a new layout pass. A change to PaintProps alone does not.

Fields§

§display: Display

Which layout algorithm arranges this node’s children.

§hidden: bool

Whether the node and its subtree are left out of layout and paint nothing. Hiding is kept apart from LayoutProps::display, so showing the node again restores the layout algorithm it had.

§direction: Direction

The main axis of the flex layout.

§wrap: bool

Whether children that do not fit move to a new line instead of shrinking.

§grow: f32

Share of the leftover main axis space this node takes when it is a flex child. Zero keeps the node at its basis.

§shrink: f32

How readily this node gives up main axis space when flex children overflow. Zero never shrinks.

§basis: Length

The main axis size this node starts from before growing or shrinking.

§width: Length

Size on the horizontal axis.

§height: Length

Size on the vertical axis.

§min_width: Length

Lower bound for LayoutProps::width.

§min_height: Length

Lower bound for LayoutProps::height.

§max_width: Length

Upper bound for LayoutProps::width.

§max_height: Length

Upper bound for LayoutProps::height.

§padding: Edges<Length>

Space between the node’s edge and its children.

§margin: Edges<Length>

Space around the node, outside its border.

§gap: Size

Space between adjacent children.

§align_items: Option<Align>

Cross axis alignment for this node’s children. None leaves the layout engine’s default, which stretches children across the cross axis.

§justify_content: Option<Justify>

Main axis distribution of this node’s children. None leaves the layout engine’s default, which packs them against the start.

§position: Position

Whether the node stays in normal flow.

§inset: Edges<Length>

Offsets from the containing block’s edges. They position an absolutely positioned node and shift a relatively positioned one from its flow position.

§border_width: Edges<f32>

Border thickness inside the node’s edge. The border takes space away from the content and is painted in PaintProps::border_color.

§overflow: Overflow

Whether content that does not fit is clipped. This also affects the automatic minimum size of a flex item, so it is a layout property.

Trait Implementations§

Source§

impl Clone for LayoutProps

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for LayoutProps

Source§

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

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

impl Default for LayoutProps

Source§

fn default() -> LayoutProps

A flex row that is sized by its content, does not grow, shrinks freely and takes no space beyond its children. These are the layout engine’s defaults, with the exception of Position::Relative, which this crate uses so that every node is a containing block for its own children.

Source§

impl PartialEq for LayoutProps

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for LayoutProps

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, 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 = !

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

fn try_from(value: U) -> Result<T, !>

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.