Skip to main content

NodeState

Struct NodeState 

Source
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

Source

pub fn new() -> Self

Source

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.

Source

pub fn index(&self) -> usize

The index of the node in the binding path.

Source

pub fn owner(&self) -> Option<Rc<BindingExpression>>

The owning binding expression.

Source

pub fn source(&self) -> Option<BoxedValue>

The source object from which the node reads its value.

Source

pub fn source_object(&self) -> Option<Ref<FerroObject>>

The source viewed as an object of the class hierarchy.

Source

pub fn value(&self) -> Option<BoxedValue>

The current value of the node. May be the unset marker.

Source

pub fn clear_value(&self)

Sets the current value to the unset marker, notifying the owner.

Source

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.

Source

pub fn set_data_validation_error(&self, error: BindingError)

Notifies the owner of a data validation error.

Source

pub fn set_error(&self, message: &str)

Sets the current value to the unset marker and notifies the owner of the error.

Source

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.

Source

pub fn set_value( &self, value: Option<BoxedValue>, data_validation_error: Option<&BindingError>, )

Sets the current value, notifying the owner.

Source

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§

Source§

impl Default for NodeState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> ClassDefaults for T
where T: ?Sized,

Source§

fn static_constructor()

The static constructor of a type: work done once per thread, after the properties of the type are registered and before its first instance exists (class handlers, affects_render, metadata overrides). Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.