pub struct StyleExt {Show 28 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,
pub corner_radii: Option<CornerRadii>,
pub blend_mode: BlendMode,
pub isolate: bool,
pub filter: LayerFilter,
pub backdrop_filter: BackdropFilter,
pub transform: Option<Transform2D>,
/* 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§corner_radii: Option<CornerRadii>§blend_mode: BlendMode§isolate: bool§filter: LayerFilter§backdrop_filter: BackdropFilter§transform: Option<Transform2D>Implementations§
Source§impl StyleExt
impl StyleExt
Sourcepub const fn resolve_width(custom: Style, fallback: i16) -> i16
pub const fn resolve_width(custom: Style, fallback: i16) -> i16
便捷解析外部 Styled 宽度(若用户通过 .w(...) / .w_64() 设置了像素宽则优先使用,否则回退组件默认宽度)。
Sourcepub const fn resolve_height(custom: Style, fallback: i16) -> i16
pub const fn resolve_height(custom: Style, fallback: i16) -> i16
便捷解析外部 Styled 高度(若用户通过 .h(...) / .h_10() 设置了像素高则优先使用,否则回退组件默认高度)。
Sourcepub fn merge_style(base: Style, custom: Style) -> Style
pub fn merge_style(base: Style, custom: Style) -> Style
Sourcepub fn apply_ext_only<'a>(self, target: Div<'a>) -> Div<'a>
pub fn apply_ext_only<'a>(self, target: Div<'a>) -> Div<'a>
仅将 StyleExt 扩展属性叠加到已构造的根 Div 上(适用于组件已自行合并 self.style 的场景)。
Sourcepub fn apply_to_div<'a>(self, target: Div<'a>, custom_style: Style) -> Div<'a>
pub fn apply_to_div<'a>(self, target: Div<'a>, custom_style: Style) -> Div<'a>
Sourcepub fn wrap_element<'a>(
self,
cx: &'a FrameScope,
elem: Element<'a>,
custom_style: Style,
) -> Element<'a>
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§
Auto Trait Implementations§
impl Forget for StyleExt
impl Freeze for StyleExt
impl Move for StyleExt
impl RefUnwindSafe for StyleExt
impl Send for StyleExt
impl Sync for StyleExt
impl Unpin for StyleExt
impl UnsafeUnpin for StyleExt
impl UnwindSafe for StyleExt
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
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FluentBuilder for T
impl<T> FluentBuilder for T
Source§fn when(self, condition: bool, then: impl FnOnce(Self) -> Self) -> Self
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
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
fn when_some<O>( self, option: Option<O>, then: impl FnOnce(Self, O) -> Self, ) -> Self
当
option 为 Some(value) 时执行闭包修饰自身,否则原样返回。