pub struct FileSelectConfig {
pub config_number: u8,
pub call: String,
pub display: String,
pub tooltip: Option<String>,
pub group: Option<String>,
pub must_exist: bool,
pub file_extension_filter: Option<String>,
}Expand description
Lets the user provide a file path.
Typically, these configs are created in a lazy_static, and passed to
ConfigStep::list_configs.
§Example
use r_extcap::config::*;
let config = FileSelectConfig::builder()
.config_number(3)
.call("logfile")
.display("Logfile")
.tooltip("A file for log messages")
.must_exist(false)
.build();
assert_eq!(
format!("{}", ExtcapFormatter(&config)),
"arg {number=3}{call=--logfile}{display=Logfile}{tooltip=A file for log messages}{type=fileselect}{mustexist=false}\n"
);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 file selector.
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”.
must_exist: boolIf true is provided, the GUI shows the user a dialog for selecting an existing file. If false, the GUI shows a file dialog for saving a file.
file_extension_filter: Option<String>If set, provide a filter for the file extension selectable by this
config. The format of the filter string is the same as qt’s
QFileDialog.
For example, the filter Text files (*.txt);;XML files (*.xml) will
limit to .txt and .xml files:
If None, any file can be selected (equivalent to All Files (*)).
This feature is currnetly not documented in the Wireshark docs, but a high level detail can be found in this commit: https://gitlab.com/wireshark/wireshark/-/commit/0d47113ddc53714ecd6d3c1b58b694321649d89e
Implementations§
Source§impl FileSelectConfig
impl FileSelectConfig
Sourcepub fn builder() -> FileSelectConfigBuilder<((), (), (), (), (), (), ())>
pub fn builder() -> FileSelectConfigBuilder<((), (), (), (), (), (), ())>
Create a builder for building FileSelectConfig.
On the builder, call .config_number(...), .call(...), .display(...), .tooltip(...)(optional), .group(...)(optional), .must_exist(...)(optional), .file_extension_filter(...)(optional) to set the values of the fields.
Finally, call .build() to create the instance of FileSelectConfig.