Trait BuildableValue

Source
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§

Source

fn apply( &mut self, data: Input, current_fields: &[String], ) -> Result<(), ChooseError>

Try to change the inner value using the provided input.

Source

fn get_options(&self, current_fields: &[String]) -> Options

The options to show to the user for setting this value.

Source

fn get_subfields(&self, current_fields: &[String]) -> Vec<String>

Whether this value contains itself other values (i.e. it’s a struct).

Source

fn to_node(&self) -> Node

Create the tree structure of this value.

Source

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.

Implementors§