pub struct ZStack {
pub id: Option<NodeId>,
pub children: Vec<Node>,
}Expand description
A z-axis stacking container that layers children on top of each other.
Children are painted in order: the first child is at the bottom, the last
is on top. Use Positioned children to place them
at absolute offsets within the stack.
The stack’s size is determined by its largest child.
§Example
ⓘ
ZStack {
children: vec![
Image { source: "bg.png".into(), ..Default::default() }.into_node().into(),
Positioned {
bottom: Some(16.0),
right: Some(16.0),
child: Some(Box::new(Text::new("Overlay").into_node())),
..Default::default()
}.into_node().into(),
],
..Default::default()
}Fields§
§id: Option<NodeId>Explicit node identity.
children: Vec<Node>Children painted in order (first = bottom, last = top).
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for ZStack
impl<'de> Deserialize<'de> for ZStack
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Lower for ZStack
impl Lower for ZStack
Source§fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
fn lower(&self, cx: &mut LoweringContext<'_>) -> NodeId
Lower this widget into the IR, returning the root node id.
Auto Trait Implementations§
impl Freeze for ZStack
impl !RefUnwindSafe for ZStack
impl Send for ZStack
impl Sync for ZStack
impl Unpin for ZStack
impl UnsafeUnpin for ZStack
impl !UnwindSafe for ZStack
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.