reactive_graph_reactive_service_api/property/property_string/
eq.rs

1use crate::TypedReactivePropertyImpl;
2use reactive_graph_reactive_model_api::ReactiveInstance;
3
4impl<IdType, ReactiveInstanceType> PartialEq<&str> for TypedReactivePropertyImpl<IdType, ReactiveInstanceType, String>
5where
6    IdType: Clone,
7    ReactiveInstanceType: ReactiveInstance<IdType>,
8{
9    fn eq(&self, other: &&str) -> bool {
10        self.reactive_instance.as_string(&self.property_name).map(|v| &v == other).unwrap_or_default()
11    }
12}
13
14impl<IdType, ReactiveInstanceType> PartialEq<TypedReactivePropertyImpl<IdType, ReactiveInstanceType, String>> for &str
15where
16    IdType: Clone,
17    ReactiveInstanceType: ReactiveInstance<IdType>,
18{
19    fn eq(&self, other: &TypedReactivePropertyImpl<IdType, ReactiveInstanceType, String>) -> bool {
20        other.reactive_instance.as_string(&other.property_name).map(|v| &v == self).unwrap_or_default()
21    }
22}
23
24impl<IdType, ReactiveInstanceType> PartialEq<String> for TypedReactivePropertyImpl<IdType, ReactiveInstanceType, String>
25where
26    IdType: Clone,
27    ReactiveInstanceType: ReactiveInstance<IdType>,
28{
29    fn eq(&self, other: &String) -> bool {
30        self.reactive_instance.as_string(&self.property_name).map(|v| &v == other).unwrap_or_default()
31    }
32}
33
34impl<IdType, ReactiveInstanceType> PartialEq<TypedReactivePropertyImpl<IdType, ReactiveInstanceType, String>> for String
35where
36    IdType: Clone,
37    ReactiveInstanceType: ReactiveInstance<IdType>,
38{
39    fn eq(&self, other: &TypedReactivePropertyImpl<IdType, ReactiveInstanceType, String>) -> bool {
40        other.reactive_instance.as_string(&other.property_name).map(|v| &v == self).unwrap_or_default()
41    }
42}