pub struct BooleanConfig {
pub config_number: u8,
pub call: String,
pub display: String,
pub tooltip: Option<String>,
pub default_value: bool,
pub group: Option<String>,
pub always_include_option: bool,
}
Expand description
A checkbox configuration with a true/false value.
Typically, these configs are created in a lazy_static
, and passed to
ConfigStep::list_configs
.
§Example
use r_extcap::config::*;
let config = BooleanConfig::builder()
.config_number(2)
.call("verify")
.display("Verify")
.tooltip("Verify package content")
.build();
assert_eq!(
format!("{}", ExtcapFormatter(&config)),
"arg {number=2}{call=--verify}{display=Verify}{tooltip=Verify package content}{type=boolflag}\n"
);
Fields§
§config_number: u8
The config number, a unique identifier for this config.
call: String
The 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: String
The user-friendly label for the check box.
tooltip: Option<String>
The tooltip shown on when hovering over the UI element.
default_value: bool
The default value for this config.
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”.
always_include_option: bool
If true, always include the command line flag (e.g. either --foo true
or --foo false
). If false (the default), the flag is provided to the
command without a value if this is checked (--foo
), or omitted from
the command line arguments if unchecked.
Implementations§
Source§impl BooleanConfig
impl BooleanConfig
Sourcepub fn builder() -> BooleanConfigBuilder<((), (), (), (), (), (), ())>
pub fn builder() -> BooleanConfigBuilder<((), (), (), (), (), (), ())>
Create a builder for building BooleanConfig
.
On the builder, call .config_number(...)
, .call(...)
, .display(...)
, .tooltip(...)
(optional), .default_value(...)
(optional), .group(...)
(optional), .always_include_option(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of BooleanConfig
.