Skip to main content

StylePatch

Struct StylePatch 

Source
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>§line_spacing: Option<i8>§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

Source

pub const fn new() -> Self

Return a new empty patch (all fields None).

Source

pub fn builder() -> StylePatchBuilder

Return a builder for constructing a patch via method chaining.

Trait Implementations§

Source§

impl Clone for StylePatch

Source§

fn clone(&self) -> StylePatch

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 Copy for StylePatch

Source§

impl Debug for StylePatch

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StylePatch

Source§

fn default() -> StylePatch

Returns the “default value” for a type. Read more
Source§

impl Eq for StylePatch

Source§

impl PartialEq for StylePatch

Source§

fn eq(&self, other: &StylePatch) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for StylePatch

Auto Trait Implementations§

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.