Skip to main content

Stack

Struct Stack 

Source
pub struct Stack { /* private fields */ }
Expand description

层叠容器 widget——子组件共享同一区域,按添加顺序自底向上渲染

Implementations§

Source§

impl Stack

Source

pub fn new() -> Self

Source

pub fn child(self, component: impl Component + 'static) -> Self

Source

pub fn padding(self, value: u16) -> Self

Trait Implementations§

Source§

impl Component for Stack

Source§

fn render(&self, cx: &mut RenderCx<'_>)

渲染组件内容
Source§

fn for_each_child(&self, f: &mut dyn FnMut(&Node))

遍历子节点(为焦点系统等提供统一的树遍历接口)
Source§

fn for_each_child_mut(&mut self, f: &mut dyn FnMut(&mut Node))

遍历子节点(可变版本)
Source§

fn measure(&self, constraint: Constraint, _cx: &mut MeasureCx) -> Size

测量组件在给定约束下的自适应尺寸 Read more
Source§

fn focusable(&self) -> bool

是否可聚焦(Tab 导航会跳过不可聚焦的组件)
Source§

fn event(&mut self, event: &Event, cx: &mut EventCx<'_>)

处理事件(可选实现)
Source§

fn layout(&mut self, rect: Rect, _cx: &mut LayoutCx<'_>)

布局回调——组件在此计算子节点 rect 并调用 child.layout() Read more
Source§

fn style(&self) -> Style

返回组件样式(可选实现)
Source§

fn mount(&mut self, _cx: &mut EventCx<'_>)

首次挂载(初始化后调用)
Source§

fn unmount(&mut self, _cx: &mut EventCx<'_>)

从树卸载(退出前调用)
Source§

fn update(&mut self, _cx: &mut EventCx<'_>)

每次事件分发前调用
Source§

fn type_name(&self) -> &str

组件类型名(用于样式表类型选择器匹配)
Source§

fn id(&self) -> Option<&str>

组件 ID(用于样式表 #id 选择器匹配)
Source§

fn class(&self) -> Option<&str>

组件 class(用于样式表 .class 选择器匹配)

Auto Trait Implementations§

§

impl Freeze for Stack

§

impl !RefUnwindSafe for Stack

§

impl !Send for Stack

§

impl !Sync for Stack

§

impl Unpin for Stack

§

impl UnsafeUnpin for Stack

§

impl !UnwindSafe for Stack

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<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, 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.