pub struct StylePatch {Show 20 fields
pub bg_color: Option<Color>,
pub border_color: Option<Color>,
pub border_width: Option<u8>,
pub alpha: Option<u8>,
pub radius: Option<u8>,
pub text_color: Option<Color>,
pub font_id: Option<FontId>,
pub letter_spacing: Option<i8>,
pub line_spacing: Option<i8>,
pub text_align: Option<TextAlign>,
pub padding_top: Option<i32>,
pub padding_bottom: Option<i32>,
pub padding_left: Option<i32>,
pub padding_right: Option<i32>,
pub margin_top: Option<i32>,
pub margin_bottom: Option<i32>,
pub margin_left: Option<i32>,
pub margin_right: Option<i32>,
pub gap_row: Option<i32>,
pub gap_col: Option<i32>,
}Expand description
A partial style entry: a per-property override record added to a node.
Each field is an Option — only fields that carry a Some value override
the lower-precedence or default value. This is the LVGL lv_style_t
analogue: a patch carries only the properties it intends to change.
Use StylePatch::builder (or set fields directly) to construct patches.
The cascade merges patches per-property — a patch that sets only bg_color
does not affect border_color, alpha, etc.
§Distinction from Style
Style (in core::style) is the resolved, fully-materialised property
bag used at draw time. StylePatch is the sparse “intent” stored in the
cascade; it is resolved into a Style by resolve.
§LPAR-10 layout fields (§5.G)
The padding_*, margin_*, gap_row, and gap_col fields are additive
extensions for layout-related style properties. They are resolved into a
crate::layout::LayoutStyle resolved struct by
crate::layout::resolve_layout_style. The frozen 5-field
crate::style::Style is NOT extended by LPAR-10.
Registration policy for new named layout properties: Standards Action (cross-phase style contracts).
Fields§
§bg_color: Option<Color>Override for Style::bg_color.
border_color: Option<Color>Override for Style::border_color.
border_width: Option<u8>Override for Style::border_width.
alpha: Option<u8>Override for Style::alpha.
alpha is the one inheritable property in v1 (§7.3). When no
patch in the cascade supplies a value, the resolved value falls back to
the InheritedContext handed down from the parent node.
radius: Option<u8>Override for Style::radius.
text_color: Option<Color>Override for TextStyle::text_color.
font_id: Option<FontId>Override for TextStyle::font_id.
letter_spacing: Option<i8>Override for TextStyle::letter_spacing.
line_spacing: Option<i8>Override for TextStyle::line_spacing.
text_align: Option<TextAlign>Override for TextStyle::text_align.
padding_top: Option<i32>Top padding in pixels (resolves to 0 when None).
padding_bottom: Option<i32>Bottom padding in pixels (resolves to 0 when None).
padding_left: Option<i32>Left padding in pixels (resolves to 0 when None).
padding_right: Option<i32>Right padding in pixels (resolves to 0 when None).
margin_top: Option<i32>Top margin in pixels (resolves to 0 when None).
margin_bottom: Option<i32>Bottom margin in pixels (resolves to 0 when None).
margin_left: Option<i32>Left margin in pixels (resolves to 0 when None).
margin_right: Option<i32>Right margin in pixels (resolves to 0 when None).
gap_row: Option<i32>Row gap (spacing between rows / cross-axis tracks) in pixels.
gap_col: Option<i32>Column gap (spacing between columns / main-axis items) in pixels.
Implementations§
Source§impl StylePatch
impl StylePatch
Sourcepub fn builder() -> StylePatchBuilder
pub fn builder() -> StylePatchBuilder
Return a builder for constructing a patch via method chaining.
Trait Implementations§
Source§impl Clone for StylePatch
impl Clone for StylePatch
Source§fn clone(&self) -> StylePatch
fn clone(&self) -> StylePatch
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more