taffy

Struct Style

source
pub struct Style {
Show 31 fields pub display: Display, pub overflow: Point<Overflow>, pub scrollbar_width: f32, pub position: Position, pub inset: Rect<LengthPercentageAuto>, pub size: Size<Dimension>, pub min_size: Size<Dimension>, pub max_size: Size<Dimension>, pub aspect_ratio: Option<f32>, pub margin: Rect<LengthPercentageAuto>, pub padding: Rect<LengthPercentage>, pub border: Rect<LengthPercentage>, pub align_items: Option<AlignItems>, pub align_self: Option<AlignSelf>, pub justify_items: Option<AlignItems>, pub justify_self: Option<AlignSelf>, pub align_content: Option<AlignContent>, pub justify_content: Option<JustifyContent>, pub gap: Size<LengthPercentage>, pub flex_direction: FlexDirection, pub flex_wrap: FlexWrap, pub flex_basis: Dimension, pub flex_grow: f32, pub flex_shrink: f32, pub grid_template_rows: Vec<TrackSizingFunction>, pub grid_template_columns: Vec<TrackSizingFunction>, pub grid_auto_rows: Vec<NonRepeatedTrackSizingFunction>, pub grid_auto_columns: Vec<NonRepeatedTrackSizingFunction>, pub grid_auto_flow: GridAutoFlow, pub grid_row: Line<GridPlacement>, pub grid_column: Line<GridPlacement>,
}
Expand description

A typed representation of the CSS style information for a single node.

The most important idea in flexbox is the notion of a “main” and “cross” axis, which are always perpendicular to each other. The orientation of these axes are controlled via the FlexDirection field of this struct.

This struct follows the CSS equivalent directly; information about the behavior on the web should transfer directly.

Detailed information about the exact behavior of each of these fields can be found on MDN by searching for the field name. The distinction between margin, padding and border is explained well in this introduction to the box model.

If the behavior does not match the flexbox layout algorithm on the web, please file a bug!

Fields§

§display: Display

What layout strategy should be used?

§overflow: Point<Overflow>

How children overflowing their container should affect layout

§scrollbar_width: f32

How much space (in points) should be reserved for the scrollbars of Overflow::Scroll and Overflow::Auto nodes.

§position: Position

What should the position value of this struct use as a base offset?

§inset: Rect<LengthPercentageAuto>

How should the position of this element be tweaked relative to the layout defined?

§size: Size<Dimension>

Sets the initial size of the item

§min_size: Size<Dimension>

Controls the minimum size of the item

§max_size: Size<Dimension>

Controls the maximum size of the item

§aspect_ratio: Option<f32>

Sets the preferred aspect ratio for the item

The ratio is calculated as width divided by height.

§margin: Rect<LengthPercentageAuto>

How large should the margin be on each side?

§padding: Rect<LengthPercentage>

How large should the padding be on each side?

§border: Rect<LengthPercentage>

How large should the border be on each side?

§align_items: Option<AlignItems>

How this node’s children aligned in the cross/block axis?

§align_self: Option<AlignSelf>

How this node should be aligned in the cross/block axis Falls back to the parents AlignItems if not set

§justify_items: Option<AlignItems>

How this node’s children should be aligned in the inline axis

§justify_self: Option<AlignSelf>

How this node should be aligned in the inline axis Falls back to the parents JustifyItems if not set

§align_content: Option<AlignContent>

How should content contained within this item be aligned in the cross/block axis

§justify_content: Option<JustifyContent>

How should contained within this item be aligned in the main/inline axis

§gap: Size<LengthPercentage>

How large should the gaps between items in a grid or flex container be?

§flex_direction: FlexDirection

Which direction does the main axis flow in?

§flex_wrap: FlexWrap

Should elements wrap, or stay in a single line?

§flex_basis: Dimension

Sets the initial main axis size of the item

§flex_grow: f32

The relative rate at which this item grows when it is expanding to fill space

0.0 is the default value, and this value must be positive.

§flex_shrink: f32

The relative rate at which this item shrinks when it is contracting to fit into space

1.0 is the default value, and this value must be positive.

§grid_template_rows: Vec<TrackSizingFunction>

Defines the track sizing functions (widths) of the grid rows

§grid_template_columns: Vec<TrackSizingFunction>

Defines the track sizing functions (heights) of the grid columns

§grid_auto_rows: Vec<NonRepeatedTrackSizingFunction>

Defines the size of implicitly created rows

§grid_auto_columns: Vec<NonRepeatedTrackSizingFunction>

Defined the size of implicitly created columns

§grid_auto_flow: GridAutoFlow

Controls how items get placed into the grid for auto-placed items

§grid_row: Line<GridPlacement>

Defines which row in the grid the item should start and end at

§grid_column: Line<GridPlacement>

Defines which column in the grid the item should start and end at

Implementations§

source§

impl Style

source

pub const DEFAULT: Style = _

The Default layout, in a form that can be used in const functions

Trait Implementations§

source§

impl Clone for Style

source§

fn clone(&self) -> Style

Returns a copy 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 Style

source§

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

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

impl Default for Style

source§

fn default() -> Self

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

impl PartialEq for Style

source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl StructuralPartialEq for Style

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnwindSafe for Style

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, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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 = 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.