pub struct UnsignedConfig {
pub config_number: u8,
pub call: String,
pub display: String,
pub tooltip: Option<String>,
pub range: Option<RangeInclusive<u32>>,
pub default_value: u32,
pub group: Option<String>,
}
Expand description
This provides a field for entering a numeric value of the given data type. A default value may be provided, as well as a range.
Typically, these configs are created in a lazy_static
, and passed to
ConfigStep::list_configs
.
§Example
use r_extcap::config::*;
let config = UnsignedConfig::builder()
.config_number(0)
.call("delay")
.display("Time delay")
.tooltip("Time delay between packages")
.range(1..=15)
.default_value(0)
.build();
assert_eq!(
format!("{}", ExtcapFormatter(&config)),
"arg {number=0}{call=--delay}{display=Time delay}{tooltip=Time delay between packages}{range=1,15}{default=0}{type=unsigned}\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 numeric field.
tooltip: Option<String>
The tooltip shown on when hovering over the UI element.
range: Option<RangeInclusive<u32>>
The valid range of values for this config.
default_value: u32
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”.
Implementations§
Source§impl UnsignedConfig
impl UnsignedConfig
Sourcepub fn builder() -> UnsignedConfigBuilder<((), (), (), (), (), (), ())>
pub fn builder() -> UnsignedConfigBuilder<((), (), (), (), (), (), ())>
Create a builder for building UnsignedConfig
.
On the builder, call .config_number(...)
, .call(...)
, .display(...)
, .tooltip(...)
(optional), .range(...)
(optional), .default_value(...)
, .group(...)
(optional) to set the values of the fields.
Finally, call .build()
to create the instance of UnsignedConfig
.