Skip to main content

Style

Struct Style 

Source
pub struct Style {
Show 43 fields pub display: Display, pub width: Option<Len>, pub height: Option<Len>, pub min_width: Option<Len>, pub max_width: Option<Len>, pub min_height: Option<Len>, pub max_height: Option<Len>, pub grid_columns: Vec<Track>, pub grid_rows: Vec<Track>, pub grid_column: (GridPlace, GridPlace), pub grid_row: (GridPlace, GridPlace), pub grid_auto_flow: GridFlow, pub grid_auto_rows: Vec<Track>, pub grid_auto_columns: Vec<Track>, pub grow: f32, pub shrink: f32, pub basis: Option<Len>, pub wrap: bool, pub opacity: f32, pub text_wrap: TextWrap, pub padding: Sides, pub margin: Sides, pub border: Sides, pub border_color: Option<Rgba>, pub gap: f32, pub row_gap: Option<f32>, pub column_gap: Option<f32>, pub axis: Axis, pub justify: Option<Justify>, pub align: Option<Align>, pub align_self: Option<Align>, pub justify_self: Option<Align>, pub justify_items: Option<Align>, pub align_content: Option<Justify>, pub overflow: Overflow, pub background: Option<Background>, pub radius: Corners, pub box_shadow: Option<BoxShadow>, pub transform: Option<Transform>, pub cursor: Cursor, pub position: Position, pub inset: [Option<Len>; 4], pub aspect_ratio: Option<f32>,
}
Expand description

The style subset M-series understands (a stand-in for the CSS ComputedStyle).

Fields§

§display: Display§width: Option<Len>§height: Option<Len>§min_width: Option<Len>§max_width: Option<Len>§min_height: Option<Len>§max_height: Option<Len>§grid_columns: Vec<Track>§grid_rows: Vec<Track>§grid_column: (GridPlace, GridPlace)

grid-column / grid-row placement for a grid item: (start, end).

§grid_row: (GridPlace, GridPlace)§grid_auto_flow: GridFlow

grid-auto-flow and the implicit-track sizes grid-auto-rows/-columns.

§grid_auto_rows: Vec<Track>§grid_auto_columns: Vec<Track>§grow: f32§shrink: f32

flex-shrink. CSS defaults to 1: a flex item gives up space to fit its container. 0 keeps the item’s size and lets it overflow, which is the author’s call, and what overflow: clip is for.

§basis: Option<Len>

flex-basis. None = auto (size from width/content).

§wrap: bool

flex-wrap: wrap: items that don’t fit start a new line.

§opacity: f32

opacity, 0.0–1.0. Applies to the whole subtree.

§text_wrap: TextWrap

overflow-wrap / word-break, applied to a text node’s own content.

§padding: Sides§margin: Sides§border: Sides§border_color: Option<Rgba>§gap: f32§row_gap: Option<f32>

row-gap / column-gap overrides for the shorthand gap. None keeps the shorthand (gap) value on that axis.

§column_gap: Option<f32>§axis: Axis§justify: Option<Justify>§align: Option<Align>§align_self: Option<Align>

align-self (flex/grid cross-axis) and justify-self (grid inline-axis) for this item, overriding the parent’s align-items/justify-items.

§justify_self: Option<Align>§justify_items: Option<Align>

justify-items (grid) and align-content (multi-line flex / grid).

§align_content: Option<Justify>§overflow: Overflow§background: Option<Background>§radius: Corners

border-radius, per corner (top-left, top-right, bottom-right, bottom-left).

§box_shadow: Option<BoxShadow>

box-shadow (single, outer). Drawn behind the box’s own background.

§transform: Option<Transform>

transform: an affine applied to this box and its subtree at paint time. Visual only: hit regions are not transformed.

§cursor: Cursor

cursor: the pointer shape over this box.

§position: Position

position and its inset (top, right, bottom, left). None per side = auto. Only meaningful when position: absolute.

§inset: [Option<Len>; 4]§aspect_ratio: Option<f32>

aspect-ratio (width / height).

Trait Implementations§

Source§

impl Clone for Style

Source§

fn clone(&self) -> Style

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 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

Auto Trait Implementations§

§

impl Freeze for Style

§

impl RefUnwindSafe for Style

§

impl Send for Style

§

impl Sync for Style

§

impl Unpin for Style

§

impl UnsafeUnpin 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, 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 = 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.