Skip to main content

DelayedBinding

Struct DelayedBinding 

Source
pub struct DelayedBinding;
Expand description

Provides delayed bindings for elements.

The markup engine applies its bindings in a delayed manner: bindings are only applied when an element has finished initializing. Applying bindings as soon as elements are created would mean that long-form bindings (binding objects whose properties are set one by one after creation) don’t work, as the binding would be applied to the property before the properties of the binding object are set.

Implementations§

Source§

impl DelayedBinding

Source

pub fn add( target: &StyledElement, property: &'static FerroProperty, binding: Rc<dyn BindingBase>, )

Adds a delayed binding to an element: the binding is applied to property when the element has finished initializing, or immediately if it already has.

Source

pub fn add_value( target: &StyledElement, property: Rc<dyn IPropertyInfo>, value: impl Fn(&StyledElement) -> Option<BoxedValue> + 'static, ) -> Result<(), BindingError>

Adds a delayed value to an element: value is evaluated and written to property when the element has finished initializing, or immediately if it already has.

When the value is written immediately, an error from the property setter is returned (the equivalent of the setter throwing to the caller); when it is written later, the error is logged.

Source

pub fn apply_bindings(control: &StyledElement)

Applies any delayed bindings to an element.

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.