pub struct Bindings { /* private fields */ }Expand description
Last-written widget property values; Ui::set_* runs only when a value
actually changed.
writes and skipped count the observed sync calls, so tests can assert
that an idle pass performs no widget writes.
Implementations§
Source§impl Bindings
impl Bindings
Sourcepub fn writes(&self) -> usize
pub fn writes(&self) -> usize
Widget writes performed since construction (or since the last
Bindings::clear, which resets the counters too).
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Forgets every cached value so the next sync writes all widgets again.
Use this after changing widgets outside the bindings; ordinary model updates do not need it because changed values are detected per call.
Sourcepub fn text<B: Backend>(
&mut self,
ui: &mut Ui<B>,
id: WidgetId,
value: &str,
) -> GuiResult<bool>
pub fn text<B: Backend>( &mut self, ui: &mut Ui<B>, id: WidgetId, value: &str, ) -> GuiResult<bool>
Syncs a widget’s text (label/button/input/…).
Returns true when the value was written, false when it was
already current.
Sourcepub fn checked<B: Backend>(
&mut self,
ui: &mut Ui<B>,
id: WidgetId,
value: bool,
) -> GuiResult<bool>
pub fn checked<B: Backend>( &mut self, ui: &mut Ui<B>, id: WidgetId, value: bool, ) -> GuiResult<bool>
Syncs a check-capable widget’s checked state.
Sourcepub fn value<B: Backend>(
&mut self,
ui: &mut Ui<B>,
id: WidgetId,
value: i32,
) -> GuiResult<bool>
pub fn value<B: Backend>( &mut self, ui: &mut Ui<B>, id: WidgetId, value: i32, ) -> GuiResult<bool>
Syncs a value-capable widget’s numeric value (slider/spin/progress).