Skip to main content

CoreStyle

Trait CoreStyle 

pub trait CoreStyle {
    type CustomIdent: CheapCloneStr;

Show 16 methods // Provided methods fn box_generation_mode(&self) -> BoxGenerationMode { ... } fn is_block(&self) -> bool { ... } fn is_compressible_replaced(&self) -> bool { ... } fn box_sizing(&self) -> BoxSizing { ... } fn direction(&self) -> Direction { ... } fn overflow(&self) -> Point<Overflow> { ... } fn scrollbar_width(&self) -> f32 { ... } fn position(&self) -> Position { ... } fn inset(&self) -> Rect<LengthPercentageAuto> { ... } fn size(&self) -> Size<Dimension> { ... } fn min_size(&self) -> Size<Dimension> { ... } fn max_size(&self) -> Size<Dimension> { ... } fn aspect_ratio(&self) -> Option<f32> { ... } fn margin(&self) -> Rect<LengthPercentageAuto> { ... } fn padding(&self) -> Rect<LengthPercentage> { ... } fn border(&self) -> Rect<LengthPercentage> { ... }
}
Expand description

The core set of styles that are shared between all CSS layout nodes

Note that all methods come with a default implementation which simply returns the default value for that style property but this is a just a convenience to save on boilerplate for styles that your implementation doesn’t support. You will need to override the default implementation for each style property that your style type actually supports.

Required Associated Types§

type CustomIdent: CheapCloneStr

The type of custom identifiers used to identify named grid lines and areas

Provided Methods§

fn box_generation_mode(&self) -> BoxGenerationMode

Which box generation mode should be used

fn is_block(&self) -> bool

Is block layout?

fn is_compressible_replaced(&self) -> bool

Is it a compressible replaced element? https://drafts.csswg.org/css-sizing-3/#min-content-zero

fn box_sizing(&self) -> BoxSizing

Which box do size styles apply to

fn direction(&self) -> Direction

The direction of text, table and grid columns, and horizontal overflow.

fn overflow(&self) -> Point<Overflow>

How children overflowing their container should affect layout

fn scrollbar_width(&self) -> f32

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

fn position(&self) -> Position

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

fn inset(&self) -> Rect<LengthPercentageAuto>

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

fn size(&self) -> Size<Dimension>

Sets the initial size of the item

fn min_size(&self) -> Size<Dimension>

Controls the minimum size of the item

fn max_size(&self) -> Size<Dimension>

Controls the maximum size of the item

fn aspect_ratio(&self) -> Option<f32>

Sets the preferred aspect ratio for the item The ratio is calculated as width divided by height.

fn margin(&self) -> Rect<LengthPercentageAuto>

How large should the margin be on each side?

fn padding(&self) -> Rect<LengthPercentage>

How large should the padding be on each side?

fn border(&self) -> Rect<LengthPercentage>

How large should the border be on each side?

Implementations on Foreign Types§

§

impl<T> CoreStyle for &T
where T: CoreStyle,

Implementors§

§

impl<S> CoreStyle for Style<S>
where S: CheapCloneStr,

§

type CustomIdent = S