pub struct MultiCheckConfig {
pub config_number: u8,
pub call: String,
pub display: String,
pub tooltip: Option<String>,
pub group: Option<String>,
pub options: Vec<MultiCheckValue>,
}Expand description
A tree of hierarchical check boxes that the user can select.
The values are passed comma-separated into the extcap command line. For
example, if the check boxes for if1, if2a, and if2b are checked in the
example below, then --multi if1,if2a,if2b will be passed in the command
line.
Typically, these configs are created in a lazy_static, and passed to
ConfigStep::list_configs.
§Example
use r_extcap::config::*;
let config = MultiCheckConfig::builder()
.config_number(3)
.call("multi")
.display("Remote Channel")
.tooltip("Remote Channel Selector")
.options([
MultiCheckValue::builder().value("if1").display("Remote1").default_value(true).build(),
MultiCheckValue::builder().value("if2").display("Remote2").children([
MultiCheckValue::builder().value("if2a").display("Remote2A").default_value(true).build(),
MultiCheckValue::builder().value("if2b").display("Remote2B").default_value(true).build(),
]).build(),
])
.build();
assert_eq!(
format!("{}", ExtcapFormatter(&config)),
concat!(
"arg {number=3}{call=--multi}{display=Remote Channel}{tooltip=Remote Channel Selector}{type=multicheck}\n",
"value {arg=3}{value=if1}{display=Remote1}{default=true}{enabled=true}\n",
"value {arg=3}{value=if2}{display=Remote2}{default=false}{enabled=true}\n",
"value {arg=3}{value=if2a}{display=Remote2A}{default=true}{enabled=true}{parent=if2}\n",
"value {arg=3}{value=if2b}{display=Remote2B}{default=true}{enabled=true}{parent=if2}\n"
)
);To parse those values as a vec, you can use the value_delimiter option
in clap.
#[arg(long, value_delimiter = ',')]
multi: Vec<String>,Fields§
§config_number: u8The config number, a unique identifier for this config.
call: StringThe command line option that will be sent to this extcap program. For
example, if this field is foobar, and the corresponding value is 42,
then --foobar 42 will be sent to this program during the extcap
capture.
display: StringThe user-friendly label for the tree of checkboxes.
tooltip: Option<String>The tooltip shown on when hovering over the UI element.
group: Option<String>The (user-visible) name of the tab which this config belongs to. If this
is None, the config will be placed in a tab called “Default”.
options: Vec<MultiCheckValue>The default list of options presented by this config. This can be refreshed by the user using via the reload field.
Implementations§
Source§impl MultiCheckConfig
impl MultiCheckConfig
Sourcepub fn builder() -> MultiCheckConfigBuilder<((), (), (), (), (), ())>
pub fn builder() -> MultiCheckConfigBuilder<((), (), (), (), (), ())>
Create a builder for building MultiCheckConfig.
On the builder, call .config_number(...), .call(...), .display(...), .tooltip(...)(optional), .group(...)(optional), .options(...) to set the values of the fields.
Finally, call .build() to create the instance of MultiCheckConfig.