RadioConfig

Struct RadioConfig 

Source
pub struct RadioConfig {
    pub config_number: u8,
    pub call: String,
    pub display: String,
    pub tooltip: Option<String>,
    pub group: Option<String>,
    pub options: Vec<ConfigOptionValue>,
}
Expand description

A list of radio buttons for the user to choose one value from. The list of options should have exactly one item with default=true.

Typically, these configs are created in a lazy_static, and passed to ConfigStep::list_configs.

§Example

use r_extcap::config::*;

let radio = RadioConfig::builder()
    .config_number(3)
    .call("remote")
    .display("Remote Channel")
    .tooltip("Remote Channel Selector")
    .options([
        ConfigOptionValue::builder().value("if1").display("Remote1").default(true).build(),
        ConfigOptionValue::builder().value("if2").display("Remote2").build(),
    ])
    .build();
assert_eq!(
    format!("{}", ExtcapFormatter(&radio)),
    concat!(
        "arg {number=3}{call=--remote}{display=Remote Channel}{tooltip=Remote Channel Selector}{type=radio}\n",
        "value {arg=3}{value=if1}{display=Remote1}{default=true}\n",
        "value {arg=3}{value=if2}{display=Remote2}{default=false}\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 radio button.

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

The default list of options presented by this config.

Implementations§

Source§

impl RadioConfig

Source

pub fn builder() -> RadioConfigBuilder<((), (), (), (), (), ())>

Create a builder for building RadioConfig. 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 RadioConfig.

Trait Implementations§

Source§

impl ConfigTrait for RadioConfig

Source§

fn call(&self) -> &str

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

fn as_any(&self) -> &dyn Any

Returns this trait as an Any type.
Source§

impl Debug for RadioConfig

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PrintSentence for RadioConfig

Source§

fn format_sentence(&self, f: &mut Formatter<'_>) -> Result

The extcap interface expects certain output “sentences” to stdout to communicate with Wireshark, like Read more
Source§

fn print_sentence(&self)

Prints the extcap sentence to stdout.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.