pub enum FieldValue {
Text(String),
Int(i32),
Bool(bool),
Bits(u32),
List(Vec<FieldValue>),
Custom(Rc<dyn CustomValue>),
}Expand description
The typed unit of dialog data transfer (the D10 value currency).
Well-known shapes (Text/Int/
Bool/Bits/List)
are fully type-checked and interoperate with framework controls and generic
consumers. Custom is the open seam for user-invented
payloads: the framework moves it opaquely and a consumer downcasts at the edge
(runtime-checked; see value_as).
Variants§
Text(String)
A text field’s string contents, used by InputLine::value and
Memo::value. Produced during a dialog gather walk and consumed
during scatter. Replaces the raw TMemoData buffer that
TMemo::getData/setData filled in the original.
Int(i32)
A numeric value — the currency for integer inputs and scrollbar positions. Produced by numeric input controls and read by the broker when syncing a scrollbar’s current value into a scroller or list viewer.
Bool(bool)
A single toggle control’s on/off state. Contrast with Bits,
which carries a whole cluster’s bitmask (multiple check boxes or radio
buttons packed into one u32).
Bits(u32)
A packed bit word — a cluster control’s value (check boxes: a bitmask;
radio buttons: the selected index). Faithful to TCluster::value. NOT a
packed Color (Color is a 4-variant enum and rides the by-value path).
List(Vec<FieldValue>)
An ordered record — the typed image of C++ getData(void *rec)’s
offset-addressed child walk (positional, anonymous). See
Group::gather_list.
Custom(Rc<dyn CustomValue>)
Implementations§
Source§impl FieldValue
impl FieldValue
Sourcepub fn custom<T: Any + Debug>(v: T) -> Self
pub fn custom<T: Any + Debug>(v: T) -> Self
Wrap a user payload as Custom.
Recover the payload on the read side with value_as
(descriptive error on mismatch — recommended) or as_custom
(Option). See the extensibility guide
for the full open-exchange story.
Sourcepub fn value_as<T: Any>(&self) -> Result<Rc<T>, FieldTypeError>
pub fn value_as<T: Any>(&self) -> Result<Rc<T>, FieldTypeError>
Read a Custom payload as T, loudly: a type
mismatch returns a descriptive FieldTypeError (so stale producer/
consumer wiring announces itself at first execution) rather than a silent
None. This is the recommended accessor for third-party components.
Trait Implementations§
Source§impl Clone for FieldValue
impl Clone for FieldValue
Source§fn clone(&self) -> FieldValue
fn clone(&self) -> FieldValue
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FieldValue
impl Debug for FieldValue
Auto Trait Implementations§
impl !RefUnwindSafe for FieldValue
impl !Send for FieldValue
impl !Sync for FieldValue
impl !UnwindSafe for FieldValue
impl Freeze for FieldValue
impl Unpin for FieldValue
impl UnsafeUnpin for FieldValue
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.