Skip to main content

ExpressionNode

Trait ExpressionNode 

Source
pub trait ExpressionNode: Any {
    // Required methods
    fn state(&self) -> &NodeState;
    fn on_source_changed(
        &self,
        source: Option<&BoxedValue>,
        data_validation_error: Option<&BindingError>,
    );

    // Provided methods
    fn build_string(&self, _builder: &mut String) { ... }
    fn build_string_with_nodes(
        &self,
        builder: &mut String,
        nodes: &[Rc<dyn ExpressionNode>],
    ) { ... }
    fn unsubscribe(&self, _old_source: &BoxedValue) { ... }
    fn as_settable(&self) -> Option<&dyn ISettableNode> { ... }
    fn as_property_accessor_node(&self) -> Option<&dyn IPropertyAccessorNode> { ... }
    fn as_source_node(&self) -> Option<&dyn SourceNode> { ... }
    fn is_data_context_node(&self) -> bool { ... }
}
Expand description

A node in a binding path: reads a value from its source and passes it to the next node (or, for the last node, to the binding expression).

Required Methods§

Source

fn state(&self) -> &NodeState

Source

fn on_source_changed( &self, source: Option<&BoxedValue>, data_validation_error: Option<&BindingError>, )

Subscribes to the new source and updates the current value.

Provided Methods§

Source

fn build_string(&self, _builder: &mut String)

Appends a string representation of the node to builder.

Source

fn build_string_with_nodes( &self, builder: &mut String, nodes: &[Rc<dyn ExpressionNode>], )

Builds a string representation of the binding path up to this node.

Source

fn unsubscribe(&self, _old_source: &BoxedValue)

Unsubscribes from the previous source.

Source

fn as_settable(&self) -> Option<&dyn ISettableNode>

Source

fn as_property_accessor_node(&self) -> Option<&dyn IPropertyAccessorNode>

Source

fn as_source_node(&self) -> Option<&dyn SourceNode>

Source

fn is_data_context_node(&self) -> bool

Whether the node reads a data context.

Implementations§

Source§

impl dyn ExpressionNode

Source

pub fn set_owner(&self, owner: Weak<BindingExpression>, index: usize)

Sets the owner binding. Panics if the node already has an owner.

Source

pub fn set_source( &self, source: NodeSource, data_validation_error: Option<&BindingError>, )

Sets the source from which the node reads its value and updates the current value, notifying the owner if the value changes.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§