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§
fn state(&self) -> &NodeState
Sourcefn on_source_changed(
&self,
source: Option<&BoxedValue>,
data_validation_error: Option<&BindingError>,
)
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§
Sourcefn build_string(&self, _builder: &mut String)
fn build_string(&self, _builder: &mut String)
Appends a string representation of the node to builder.
Sourcefn build_string_with_nodes(
&self,
builder: &mut String,
nodes: &[Rc<dyn ExpressionNode>],
)
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.
Sourcefn unsubscribe(&self, _old_source: &BoxedValue)
fn unsubscribe(&self, _old_source: &BoxedValue)
Unsubscribes from the previous source.
fn as_settable(&self) -> Option<&dyn ISettableNode>
fn as_property_accessor_node(&self) -> Option<&dyn IPropertyAccessorNode>
fn as_source_node(&self) -> Option<&dyn SourceNode>
Sourcefn is_data_context_node(&self) -> bool
fn is_data_context_node(&self) -> bool
Whether the node reads a data context.
Implementations§
Source§impl dyn ExpressionNode
impl dyn ExpressionNode
Sourcepub fn set_owner(&self, owner: Weak<BindingExpression>, index: usize)
pub fn set_owner(&self, owner: Weak<BindingExpression>, index: usize)
Sets the owner binding. Panics if the node already has an owner.
Sourcepub fn set_source(
&self,
source: NodeSource,
data_validation_error: Option<&BindingError>,
)
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".