Struct UiValues
pub struct UiValues { /* private fields */ }Expand description
A graph’s text and checked values, by each control’s value_path, and
which buttons were clicked, by each button’s on_click_path.
The values are view state, never written to the document: every input
naming one path shows and edits the same value, and the app reads them
when it acts on them, submitting its own resource actions. A path the app
routes (Self::route) instead shows the app’s own value, and each edit
of it is the app’s action. A clicked button is reported the same way: the
app takes the click (Self::take_click) and acts on it.
Implementations§
§impl UiValues
impl UiValues
pub fn text(&self, path: &str) -> LocalState<String>
pub fn text(&self, path: &str) -> LocalState<String>
The value inputs naming path edit, starting empty.
pub fn route(
&self,
path: &str,
shown: LocalState<String>,
action: ActionBinding<String>,
)
pub fn route( &self, path: &str, shown: LocalState<String>, action: ActionBinding<String>, )
Route the inputs naming path through the app: they show shown,
which the app keeps current, and each edit invokes action with the
whole new text, so it is checked, attributed and undone like every
other edit of the app.
pub fn boolean(&self, path: &str) -> LocalState<bool>
pub fn boolean(&self, path: &str) -> LocalState<bool>
The shared view value checked controls naming path edit, starting false.
pub fn route_bool(
&self,
path: &str,
shown: LocalState<bool>,
action: ActionBinding<bool>,
)
pub fn route_bool( &self, path: &str, shown: LocalState<bool>, action: ActionBinding<bool>, )
Route checked controls through the resource’s typed action. The app keeps
shown current, including refused edits, undo and remote changes.
pub fn checkbox(&self, path: &str) -> Checkbox
pub fn checkbox(&self, path: &str) -> Checkbox
A checkbox over the shared view value, invoking the app’s action when routed.
pub fn toggle(&self, path: &str) -> Toggle
pub fn toggle(&self, path: &str) -> Toggle
A toggle over the shared view value, invoking the app’s action when routed.
pub fn click(&self, path: &str, value: &str)
pub fn click(&self, path: &str, value: &str)
Record a click of a button naming path, carrying value. Only the
latest click per path is kept until the app takes it.
pub fn take_click(&self, path: &str) -> Option<String>
pub fn take_click(&self, path: &str) -> Option<String>
The latest unhandled click of a button naming path: its
click_value, or "true" when it names none. Taking it clears it,
so each click is acted on once.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for UiValues
impl !RefUnwindSafe for UiValues
impl !Send for UiValues
impl !Sync for UiValues
impl Unpin for UiValues
impl UnsafeUnpin for UiValues
impl !UnwindSafe for UiValues
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more