Skip to main content

StyleExt

Struct StyleExt 

Source
pub struct StyleExt {
Show 22 fields pub margin: Edges<i16>, pub min_w: i16, pub max_w: i16, pub min_h: i16, pub max_h: i16, pub opacity: Option<u8>, pub clip_children: Option<bool>, pub scrollable_max: Option<i16>, pub scroll_dir: Option<FlexDir>, pub shadow: Option<(u8, i8, i8, Color)>, pub shadow_cleared: bool, pub cursor: Option<CursorShape>, pub transition: Option<TransitionSpec>, pub transition_cleared: bool, pub text_color: Option<Color>, pub text_size: Option<u8>, pub hover_style: Option<StyleRefinement>, pub active_style: Option<StyleRefinement>, pub focus_style: Option<StyleRefinement>, pub z_index: Option<i8>, pub align_self: Option<AlignItems>, pub items_baseline: bool, /* private fields */
}
Expand description

除 24B 核心 Style 以外的组件外层扩展修饰符集合(零堆分配、const 可构造)。

Fields§

§margin: Edges<i16>§min_w: i16§max_w: i16§min_h: i16§max_h: i16§opacity: Option<u8>§clip_children: Option<bool>§scrollable_max: Option<i16>§scroll_dir: Option<FlexDir>§shadow: Option<(u8, i8, i8, Color)>§shadow_cleared: bool§cursor: Option<CursorShape>§transition: Option<TransitionSpec>§transition_cleared: bool§text_color: Option<Color>§text_size: Option<u8>§hover_style: Option<StyleRefinement>§active_style: Option<StyleRefinement>§focus_style: Option<StyleRefinement>§z_index: Option<i8>§align_self: Option<AlignItems>§items_baseline: bool

Implementations§

Source§

impl StyleExt

Source

pub const DEFAULT: Self

空扩展样式常量(供所有组件 const fn new 零成本初始化)。

Source

pub const fn new() -> Self

构造一个未设置任何扩展修饰符的空 StyleExt。

Source

pub const fn is_empty(&self) -> bool

是否未调用过任何外层扩展修饰符(为 true 时渲染热路径零额外开销)。

Source

pub const fn resolve_width(custom: Style, fallback: i16) -> i16

便捷解析外部 Styled 宽度(若用户通过 .w(...) / .w_64() 设置了像素宽则优先使用,否则回退组件默认宽度)。

Source

pub const fn resolve_height(custom: Style, fallback: i16) -> i16

便捷解析外部 Styled 高度(若用户通过 .h(...) / .h_10() 设置了像素高则优先使用,否则回退组件默认高度)。

Source

pub fn merge_style(base: Style, custom: Style) -> Style

将用户通过 Styled 在外层显式设置的非默认 Style 属性合并到组件内部根 Style 上。

Source

pub fn apply_ext_only<'a>(self, target: Div<'a>) -> Div<'a>

仅将 StyleExt 扩展属性叠加到已构造的根 Div 上(适用于组件已自行合并 self.style 的场景)。

Source

pub fn apply_to_div<'a>(self, target: Div<'a>, custom_style: Style) -> Div<'a>

将外层 Style 与 StyleExt 一次性精准叠加到组件根 Div 上(无自定义修饰时零额外分配)。

Source

pub fn wrap_element<'a>( self, cx: &'a FrameScope, elem: Element<'a>, custom_style: Style, ) -> Element<'a>

供输出非 Div 元素(如 Element::Img / Element::Text)的原子组件使用: 未设置外层样式时零包装直接透传,设置任意外层样式时自动用 Div 包裹并完整应用。

Trait Implementations§

Source§

impl Clone for StyleExt

Source§

fn clone(&self) -> Self

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 StyleExt

Source§

impl Debug for StyleExt

Source§

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

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

impl Default for StyleExt

Source§

fn default() -> Self

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

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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

Source§

fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self

当 condition 为 true 时执行闭包修饰自身,否则原样返回。
Source§

fn when_else( self, condition: bool, then: impl FnOnce(Self) -> Self, else_fn: impl FnOnce(Self) -> Self, ) -> Self

根据 condition 在两个修饰分支之间二选一。
Source§

fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self

当 option 为 Some(value) 时执行闭包修饰自身,否则原样返回。
Source§

fn when_none<O>( self, option: &Option<O>, then: impl FnOnce(Self) -> Self, ) -> Self

当 option 为 None 时执行闭包修饰自身,否则原样返回。
Source§

fn apply<U>(self, f: impl FnOnce(Self) -> U) -> U

通用管道映射变换(避免与 Iterator::map / Option::map 重名)。
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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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 = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,