ferroui_base/data/
binding_operations.rs1use crate::data::BindingExpressionBase;
2use crate::{BoxedValue, DoNothingType, FerroObject, FerroProperty};
3use std::rc::Rc;
4
5pub struct BindingOperations;
7
8impl BindingOperations {
9 pub fn do_nothing() -> BoxedValue {
12 crate::ferro_thread_local! {
13 static DO_NOTHING: BoxedValue = Rc::new(DoNothingType);
14 }
15 DO_NOTHING.with(Rc::clone)
16 }
17
18 #[inline]
20 pub fn is_do_nothing(value: Option<&BoxedValue>) -> bool {
21 value.is_some_and(|v| v.is::<DoNothingType>())
22 }
23
24 #[inline]
26 pub fn is_unset(value: Option<&BoxedValue>) -> bool {
27 value.is_some_and(|v| v.is::<crate::UnsetValueType>())
28 }
29
30 pub fn get_binding_expression_base(
33 target: &FerroObject,
34 property: &'static FerroProperty,
35 ) -> Option<Rc<dyn BindingExpressionBase>> {
36 target.get_expression(property)
37 }
38}