1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
use crate::{View, Primitive, Bind, Context, Id};

#[derive(Debug, Clone, PartialEq, Eq)]
pub struct ZStack<T> {
    wrapped: T,
}

impl<T> ZStack<T> {
    pub fn new(wrapped: T) -> Self {
        Self {
            wrapped
        }
    }
}

impl<T> Bind for ZStack<T> where T: Bind {}

impl<T> View for ZStack<T> where T: View {
    fn render(&mut self, context: &Context) -> Id<Primitive> {
        context.identify(Primitive::ZStack { wrapped: Box::new(self.wrapped.render(&context.child(0))) })
    }
}