FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    impl_untyped_binding_expression

    macro · ferroui-base · v0.5.0

    macro_rules! impl_untyped_binding_expression
    

    Implements the value entry, disposable and binding expression traits for a type that implements UntypedBindingExpression: what makes the type a binding expression class deriving from UntypedBindingExpressionBase.

    The type holds the base (UntypedBindingExpressionBase::new(this, ..), created with Rc::new_cyclic so that the base knows its expression), returns it from UntypedBindingExpression::base, and overrides description, start_core, stop_core and, where needed, the other members of that trait. It can be defined in any crate:

    pub struct ConstantExpression { base: UntypedBindingExpressionBase, value: BoxedValue }
    
    impl UntypedBindingExpression for ConstantExpression {
        fn base(&self) -> &UntypedBindingExpressionBase { &self.base }
        fn description(&self) -> String { "Constant".to_string() }
        fn start_core(&self) { self.base.publish_value(Publish::Value(Some(self.value.clone())), None, false) }
        fn stop_core(&self) {}
    }
    
    ferroui_base::impl_untyped_binding_expression!(ConstantExpression);
    

    View source

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.