BindingManager

Struct BindingManager 

Source
pub struct BindingManager { /* private fields */ }
Expand description

Manages bindings between application state and widget properties.

The BindingManager provides:

  • Registration of two-way bindings
  • Automatic propagation of state changes to widgets
  • Handling of widget changes back to state
  • Debouncing support for frequent updates

Implementations§

Source§

impl BindingManager

Source

pub fn new() -> Self

Create a new binding manager.

Source

pub fn with_debounce(self, ms: u32) -> Self

Set debounce delay in milliseconds.

Source

pub fn register( &mut self, widget_id: impl Into<String>, config: BindingConfig, ) -> BindingId

Register a binding between state and widget.

Source

pub fn unregister(&mut self, id: BindingId)

Unregister a binding.

Source

pub fn bindings_for_widget(&self, widget_id: &str) -> Vec<&ActiveBinding>

Get bindings for a widget.

Source

pub fn bindings_for_path(&self, path: &PropertyPath) -> Vec<&ActiveBinding>

Get bindings for a state path.

Source

pub fn on_state_change( &mut self, path: &PropertyPath, value: &str, ) -> Vec<WidgetUpdate>

Handle state change, propagate to widgets.

Source

pub fn on_widget_change( &mut self, widget_id: &str, property: &str, value: &str, ) -> Vec<StateUpdate>

Handle widget change, propagate to state.

Source

pub fn queue_update( &mut self, source: UpdateSource, path: PropertyPath, value: String, )

Queue an update (for debouncing).

Source

pub fn flush(&mut self) -> (Vec<WidgetUpdate>, Vec<StateUpdate>)

Flush pending updates.

Source

pub fn active_count(&self) -> usize

Get number of active bindings.

Source

pub fn clear(&mut self)

Clear all bindings.

Trait Implementations§

Source§

impl Debug for BindingManager

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for BindingManager

Source§

fn default() -> BindingManager

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> 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 = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.