fui_core 0.1.0

Core library of FUI MVVM UI Framework
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use std::{cell::RefCell, rc::Rc, rc::Weak};
use crate::WindowService;

pub struct Services {
    window_service: Weak<RefCell<dyn WindowService>>, 
}

impl Services {
    pub fn new(window_service: &Rc<RefCell<dyn WindowService>>) -> Self {
        Self {
            window_service: Rc::downgrade(window_service)
        }
    }

    pub fn get_window_service(&self) -> Option<Rc<RefCell<dyn WindowService>>> {
        self.window_service.upgrade()
    }
}