pub struct NodeState { /* private fields */ }Expand description
The state every expression node has: its place in the binding path, its source and its current value.
Implementations§
Source§impl NodeState
impl NodeState
pub fn new() -> Self
Sourcepub fn locating_an_element() -> Self
pub fn locating_an_element() -> Self
The state of a node whose value is an element it locates from the target of the binding: an element of a name scope, an ancestor, the templated parent.
Such a node holds its value weakly (DEVIATIONS.md, Bindings). The element it finds is kept alive by the tree it was found in, and that tree most often owns the target of the binding, which owns the binding and its nodes: held strongly, as the managed original holds the value of every node, the element and the target keep each other alive. The value reads null once the element is gone.
Sourcepub fn owner(&self) -> Option<Rc<BindingExpression>>
pub fn owner(&self) -> Option<Rc<BindingExpression>>
The owning binding expression.
Sourcepub fn source(&self) -> Option<BoxedValue>
pub fn source(&self) -> Option<BoxedValue>
The source object from which the node reads its value.
Sourcepub fn source_object(&self) -> Option<Ref<FerroObject>>
pub fn source_object(&self) -> Option<Ref<FerroObject>>
The source viewed as an object of the class hierarchy.
Sourcepub fn value(&self) -> Option<BoxedValue>
pub fn value(&self) -> Option<BoxedValue>
The current value of the node. May be the unset marker.
Sourcepub fn clear_value(&self)
pub fn clear_value(&self)
Sets the current value to the unset marker, notifying the owner.
Sourcepub fn short_circuit_null(&self)
pub fn short_circuit_null(&self)
Called by a node which has a null-conditional operator applied to it when its source is null: the value of this and all subsequent nodes becomes null and the binding produces null rather than an error.
Sourcepub fn set_data_validation_error(&self, error: BindingError)
pub fn set_data_validation_error(&self, error: BindingError)
Notifies the owner of a data validation error.
Sourcepub fn set_error(&self, message: &str)
pub fn set_error(&self, message: &str)
Sets the current value to the unset marker and notifies the owner of the error.
Sourcepub fn set_value_or_notification(
&self,
value_or_notification: Option<BoxedValue>,
)
pub fn set_value_or_notification( &self, value_or_notification: Option<BoxedValue>, )
Sets the current value from a value that may be a boxed
BindingNotification.
Sourcepub fn set_value(
&self,
value: Option<BoxedValue>,
data_validation_error: Option<&BindingError>,
)
pub fn set_value( &self, value: Option<BoxedValue>, data_validation_error: Option<&BindingError>, )
Sets the current value, notifying the owner.
Sourcepub fn validate_non_null_source(&self, source: Option<&BoxedValue>) -> bool
pub fn validate_non_null_source(&self, source: Option<&BoxedValue>) -> bool
Validates that the source is non-null, raising a node error if it is not.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for NodeState
impl !RefUnwindSafe for NodeState
impl !Send for NodeState
impl !Sync for NodeState
impl !UnwindSafe for NodeState
impl Unpin for NodeState
impl UnsafeUnpin for NodeState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more