ferroui_controls/templates/
i_data_template.rs1use super::{IRecyclingDataTemplate, ITemplateWithParam, ITreeDataTemplate, ITypedDataTemplate};
2use crate::Control;
3use ferroui_base::{BoxedValue, Ref};
4
5pub trait IDataTemplate: ITemplateWithParam<Option<BoxedValue>, Option<Ref<Control>>> {
8 fn match_(&self, data: Option<&BoxedValue>) -> bool;
10
11 fn as_recycling_data_template(&self) -> Option<&dyn IRecyclingDataTemplate> {
13 None
14 }
15
16 fn as_typed_data_template(&self) -> Option<&dyn ITypedDataTemplate> {
18 None
19 }
20
21 fn as_tree_data_template(&self) -> Option<&dyn ITreeDataTemplate> {
23 None
24 }
25
26 fn as_any(&self) -> Option<&dyn std::any::Any> {
30 None
31 }
32}
33
34impl PartialEq for dyn IDataTemplate {
35 fn eq(&self, other: &Self) -> bool {
36 std::ptr::addr_eq(self as *const Self, other as *const Self)
37 }
38}