pub struct Control {
pub id: Key,
pub label: String,
pub kind: ControlKind,
pub value: Option<String>,
}Expand description
One control, as DATA — never a widget.
This is what lets an egui pane, a TUI, a robot driver and a web client render the same
set from one description. It is also what makes the guard possible: two choices can be
compared by their control ids, which is impossible if controls() were a pile of
immediate-mode calls.
The id is the stable address (see Key); label is human-facing and may change
freely.
Fields§
§id: KeyStable machine id — what a driver addresses and what a guard compares.
label: StringHuman-facing text. Free to change without breaking anything.
kind: ControlKindWhat kind of control this is.
value: Option<String>The current value, rendered as a string ("true", "12", a URL). None when the
control has no value yet — which is DIFFERENT from an empty string, and must render
differently, for the same reason empty-vs-unreadable must.
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Control
impl<'de> Deserialize<'de> for Control
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl StructuralPartialEq for Control
Auto Trait Implementations§
impl Freeze for Control
impl RefUnwindSafe for Control
impl Send for Control
impl Sync for Control
impl Unpin for Control
impl UnsafeUnpin for Control
impl UnwindSafe for Control
Blanket Implementations§
impl<T> Allocation for T
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
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