pub struct Style {
pub layout: LayoutStyle,
pub spacing: SpacingStyle,
pub sizing: SizingStyle,
pub visual: VisualStyle,
}Expand description
Style properties for a widget
Contains all CSS-like properties that can be applied to a widget. Properties are organized into logical groups:
layout: Display mode, flexbox, and grid propertiesspacing: Padding, margin, and position offsetssizing: Width, height, and min/max constraintsvisual: Colors, border, opacity, and visibility
For backward compatibility, individual properties can still be accessed
directly (e.g., style.display instead of style.layout.display).
Fields§
§layout: LayoutStyleLayout properties (display, flex, grid)
spacing: SpacingStyleSpacing properties (padding, margin, offsets)
sizing: SizingStyleSizing properties (width, height, min/max)
visual: VisualStyleVisual properties (colors, border, opacity)
Implementations§
Source§impl Style
impl Style
Sourcepub fn position(&self) -> Position
pub fn position(&self) -> Position
Position mode (static, relative, absolute, fixed) - non-inherited
Sourcepub fn flex_direction(&self) -> FlexDirection
pub fn flex_direction(&self) -> FlexDirection
Flex direction (row, column) - non-inherited
Sourcepub fn justify_content(&self) -> JustifyContent
pub fn justify_content(&self) -> JustifyContent
Main axis alignment - non-inherited
Sourcepub fn align_items(&self) -> AlignItems
pub fn align_items(&self) -> AlignItems
Cross axis alignment - non-inherited
Sourcepub fn column_gap(&self) -> Option<u16>
pub fn column_gap(&self) -> Option<u16>
Column gap for grid - non-inherited
Sourcepub fn grid_template_columns(&self) -> &GridTemplate
pub fn grid_template_columns(&self) -> &GridTemplate
Grid template columns - non-inherited
Sourcepub fn grid_template_rows(&self) -> &GridTemplate
pub fn grid_template_rows(&self) -> &GridTemplate
Grid template rows - non-inherited
Sourcepub fn grid_column(&self) -> GridPlacement
pub fn grid_column(&self) -> GridPlacement
Grid column placement - non-inherited
Sourcepub fn grid_row(&self) -> GridPlacement
pub fn grid_row(&self) -> GridPlacement
Grid row placement - non-inherited
Sourcepub fn min_height(&self) -> Size
pub fn min_height(&self) -> Size
Minimum height - non-inherited
Sourcepub fn max_height(&self) -> Size
pub fn max_height(&self) -> Size
Maximum height - non-inherited
Sourcepub fn border_style(&self) -> BorderStyle
pub fn border_style(&self) -> BorderStyle
Border style - non-inherited
Sourcepub fn border_color(&self) -> Color
pub fn border_color(&self) -> Color
Border color - non-inherited
Sourcepub fn background(&self) -> Color
pub fn background(&self) -> Color
Background color - non-inherited
Source§impl Style
impl Style
Sourcepub fn inherit(parent: &Style) -> Self
pub fn inherit(parent: &Style) -> Self
Inherit inheritable properties from parent style
CSS Inherited Properties:
color- text coloropacity- visual opacityvisible- visibility
Non-inherited properties are reset to their defaults.
Sourcepub fn with_inheritance(&self, parent: &Style) -> Self
pub fn with_inheritance(&self, parent: &Style) -> Self
Inherit from parent, then apply own rules
This is the main method for computing inherited styles:
- Start with inherited values from parent
- Apply this style’s explicitly set values
Trait Implementations§
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§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().