pub struct Style {Show 28 fields
pub display: Display,
pub item_is_table: bool,
pub box_sizing: BoxSizing,
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 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?
item_is_table: bool
Whether a child is display:table or not. This affects children of block layouts.
This should really be part of Display
, but it is currently seperate because table layout isn’t implemented
box_sizing: BoxSizing
Should size styles apply to the content box or the border box of the node
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?
grid_template_rows: Vec<TrackSizingFunction>
Defines the track sizing functions (heights) of the grid rows
grid_template_columns: Vec<TrackSizingFunction>
Defines the track sizing functions (widths) 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§
Trait Implementations§
source§impl CoreStyle for Style
impl CoreStyle for Style
source§fn box_generation_mode(&self) -> BoxGenerationMode
fn box_generation_mode(&self) -> BoxGenerationMode
source§fn box_sizing(&self) -> BoxSizing
fn box_sizing(&self) -> BoxSizing
source§fn overflow(&self) -> Point<Overflow>
fn overflow(&self) -> Point<Overflow>
source§fn scrollbar_width(&self) -> f32
fn scrollbar_width(&self) -> f32
Overflow::Scroll
and Overflow::Auto
nodes.source§fn position(&self) -> Position
fn position(&self) -> Position
position
value of this struct use as a base offset?source§fn inset(&self) -> Rect<LengthPercentageAuto>
fn inset(&self) -> Rect<LengthPercentageAuto>
source§fn aspect_ratio(&self) -> Option<f32>
fn aspect_ratio(&self) -> Option<f32>
source§fn margin(&self) -> Rect<LengthPercentageAuto>
fn margin(&self) -> Rect<LengthPercentageAuto>
source§fn padding(&self) -> Rect<LengthPercentage>
fn padding(&self) -> Rect<LengthPercentage>
source§fn border(&self) -> Rect<LengthPercentage>
fn border(&self) -> Rect<LengthPercentage>
source§impl<'de> Deserialize<'de> for Style
impl<'de> Deserialize<'de> for Style
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
source§impl GridContainerStyle for Style
impl GridContainerStyle for Style
source§type TemplateTrackList<'a> = &'a [TrackSizingFunction]
where
Self: 'a
type TemplateTrackList<'a> = &'a [TrackSizingFunction] where Self: 'a
source§type AutoTrackList<'a> = &'a [MinMax<MinTrackSizingFunction, MaxTrackSizingFunction>]
where
Self: 'a
type AutoTrackList<'a> = &'a [MinMax<MinTrackSizingFunction, MaxTrackSizingFunction>] where Self: 'a
source§fn grid_template_rows(&self) -> &[TrackSizingFunction]
fn grid_template_rows(&self) -> &[TrackSizingFunction]
source§fn grid_template_columns(&self) -> &[TrackSizingFunction]
fn grid_template_columns(&self) -> &[TrackSizingFunction]
source§fn grid_auto_rows(&self) -> &[NonRepeatedTrackSizingFunction]
fn grid_auto_rows(&self) -> &[NonRepeatedTrackSizingFunction]
source§fn grid_auto_columns(&self) -> &[NonRepeatedTrackSizingFunction]
fn grid_auto_columns(&self) -> &[NonRepeatedTrackSizingFunction]
source§fn grid_auto_flow(&self) -> GridAutoFlow
fn grid_auto_flow(&self) -> GridAutoFlow
source§fn gap(&self) -> Size<LengthPercentage>
fn gap(&self) -> Size<LengthPercentage>
source§fn align_content(&self) -> Option<AlignContent>
fn align_content(&self) -> Option<AlignContent>
source§fn justify_content(&self) -> Option<JustifyContent>
fn justify_content(&self) -> Option<JustifyContent>
source§fn align_items(&self) -> Option<AlignItems>
fn align_items(&self) -> Option<AlignItems>
source§fn justify_items(&self) -> Option<AlignItems>
fn justify_items(&self) -> Option<AlignItems>
source§fn grid_template_tracks(
&self,
axis: AbsoluteAxis,
) -> Self::TemplateTrackList<'_>
fn grid_template_tracks( &self, axis: AbsoluteAxis, ) -> Self::TemplateTrackList<'_>
source§fn grid_align_content(&self, axis: AbstractAxis) -> AlignContent
fn grid_align_content(&self, axis: AbstractAxis) -> AlignContent
source§impl GridItemStyle for &Style
impl GridItemStyle for &Style
source§fn grid_row(&self) -> Line<GridPlacement>
fn grid_row(&self) -> Line<GridPlacement>
source§fn grid_column(&self) -> Line<GridPlacement>
fn grid_column(&self) -> Line<GridPlacement>
source§fn align_self(&self) -> Option<AlignSelf>
fn align_self(&self) -> Option<AlignSelf>
AlignItems
if not setsource§fn justify_self(&self) -> Option<AlignSelf>
fn justify_self(&self) -> Option<AlignSelf>
super::JustifyItems
if not setsource§fn grid_placement(&self, axis: AbsoluteAxis) -> Line<GridPlacement>
fn grid_placement(&self, axis: AbsoluteAxis) -> Line<GridPlacement>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)