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
Auto Trait Implementations§
impl Freeze for BindingManager
impl RefUnwindSafe for BindingManager
impl Send for BindingManager
impl Sync for BindingManager
impl Unpin for BindingManager
impl UnwindSafe for BindingManager
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
Read this value from the supplied reader. Same as
ReadEndian::read_from_little_endian().