Skip to main content

zintl_ui_state/
lib.rs

1use zintl_ui_render::RenderObject;
2use zintl_ui_view::{Context, Storage, View};
3
4pub struct State<T> {
5    value: T,
6}
7
8#[derive(Debug)]
9pub struct StatefulView<T> {
10    context: Context,
11    key: String,
12    state: T,
13}
14
15impl<T> StatefulView<T> {
16    pub fn new(key: String, initial: T) -> Self {
17        StatefulView {
18            context: Context::default(),
19            key,
20            state: initial,
21        }
22    }
23}
24
25impl<T> View for StatefulView<T> {
26    fn get_context(&self) -> &Context {
27        &self.context
28    }
29
30    fn render(&mut self, _storage: &mut Storage) -> RenderObject {
31        unimplemented!()
32    }
33}