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
impl BindingManager
Sourcepub fn with_debounce(self, ms: u32) -> Self
pub fn with_debounce(self, ms: u32) -> Self
Set debounce delay in milliseconds.
Sourcepub fn register(
&mut self,
widget_id: impl Into<String>,
config: BindingConfig,
) -> BindingId
pub fn register( &mut self, widget_id: impl Into<String>, config: BindingConfig, ) -> BindingId
Register a binding between state and widget.
Sourcepub fn unregister(&mut self, id: BindingId)
pub fn unregister(&mut self, id: BindingId)
Unregister a binding.
Sourcepub fn bindings_for_widget(&self, widget_id: &str) -> Vec<&ActiveBinding>
pub fn bindings_for_widget(&self, widget_id: &str) -> Vec<&ActiveBinding>
Get bindings for a widget.
Sourcepub fn bindings_for_path(&self, path: &PropertyPath) -> Vec<&ActiveBinding>
pub fn bindings_for_path(&self, path: &PropertyPath) -> Vec<&ActiveBinding>
Get bindings for a state path.
Sourcepub fn on_state_change(
&mut self,
path: &PropertyPath,
value: &str,
) -> Vec<WidgetUpdate>
pub fn on_state_change( &mut self, path: &PropertyPath, value: &str, ) -> Vec<WidgetUpdate>
Handle state change, propagate to widgets.
Sourcepub fn on_widget_change(
&mut self,
widget_id: &str,
property: &str,
value: &str,
) -> Vec<StateUpdate>
pub fn on_widget_change( &mut self, widget_id: &str, property: &str, value: &str, ) -> Vec<StateUpdate>
Handle widget change, propagate to state.
Sourcepub fn queue_update(
&mut self,
source: UpdateSource,
path: PropertyPath,
value: String,
)
pub fn queue_update( &mut self, source: UpdateSource, path: PropertyPath, value: String, )
Queue an update (for debouncing).
Sourcepub fn flush(&mut self) -> (Vec<WidgetUpdate>, Vec<StateUpdate>)
pub fn flush(&mut self) -> (Vec<WidgetUpdate>, Vec<StateUpdate>)
Flush pending updates.
Sourcepub fn active_count(&self) -> usize
pub fn active_count(&self) -> usize
Get number of active bindings.
Trait Implementations§
Source§impl Debug for BindingManager
impl Debug for BindingManager
Source§impl Default for BindingManager
impl Default for BindingManager
Source§fn default() -> BindingManager
fn default() -> BindingManager
Returns the “default value” for a type. Read more