ferroui_reactiveui_controls/
navigation_target.rs1use crate::view_model_value::same_view_model_object;
4use std::any::Any;
5use std::fmt;
6use std::rc::Rc;
7
8#[derive(Clone)]
11pub struct NavigationTarget {
12 pub view_model: Option<Rc<dyn Any>>,
14 pub contract: Option<String>,
16}
17
18impl NavigationTarget {
19 pub fn new(view_model: Option<Rc<dyn Any>>, contract: Option<String>) -> Self {
21 Self { view_model, contract }
22 }
23}
24
25impl PartialEq for NavigationTarget {
27 fn eq(&self, other: &Self) -> bool {
28 same_view_model_object(self.view_model.as_ref(), other.view_model.as_ref()) && self.contract == other.contract
29 }
30}
31
32impl fmt::Debug for NavigationTarget {
33 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
34 f.debug_struct("NavigationTarget")
35 .field("view_model", &self.view_model.as_ref().map(|view_model| Rc::as_ptr(view_model) as *const ()))
36 .field("contract", &self.contract)
37 .finish()
38 }
39}