pub trait BuildableValue: Debug {
// Required methods
fn apply(
&mut self,
data: Input,
current_fields: &[String],
) -> Result<(), ChooseError>;
fn get_options(&self, current_fields: &[String]) -> Options;
fn get_subfields(&self, current_fields: &[String]) -> Vec<String>;
fn to_node(&self) -> Node;
fn get_value_any(&self) -> Option<Box<dyn Any>>;
}
Expand description
The interactive builder for a base type.
Required Methods§
Sourcefn apply(
&mut self,
data: Input,
current_fields: &[String],
) -> Result<(), ChooseError>
fn apply( &mut self, data: Input, current_fields: &[String], ) -> Result<(), ChooseError>
Try to change the inner value using the provided input.
Sourcefn get_options(&self, current_fields: &[String]) -> Options
fn get_options(&self, current_fields: &[String]) -> Options
The options to show to the user for setting this value.
Sourcefn get_subfields(&self, current_fields: &[String]) -> Vec<String>
fn get_subfields(&self, current_fields: &[String]) -> Vec<String>
Whether this value contains itself other values (i.e. it’s a struct).
Sourcefn get_value_any(&self) -> Option<Box<dyn Any>>
fn get_value_any(&self) -> Option<Box<dyn Any>>
Get the inner value, if present, as an Any
.
It’s very important that the returned Any
internal type matches the type that this
builder is used for. The Builder
will downcast this Any
to the types it’s expecting,
panicking in case of mismatched type.