PrintSentence

Trait PrintSentence 

Source
pub trait PrintSentence {
    // Required method
    fn format_sentence(&self, f: &mut Formatter<'_>) -> Result;

    // Provided method
    fn print_sentence(&self) { ... }
}
Expand description

Elements that has a printable extcap sentence. See the documentation for ExtcapFormatter for details.

Required Methods§

Source

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

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

extcap {version=1.0}{help=Some help url}

This function writes to the formatter f in that format.

Provided Methods§

Source

fn print_sentence(&self)

Prints the extcap sentence to stdout.

Implementations on Foreign Types§

Source§

impl PrintSentence for (&ConfigOptionValue, u8)

Source§

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

Source§

impl PrintSentence for (&MultiCheckValue, u8, Option<&MultiCheckValue>)

Source§

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

Implementors§

Source§

impl PrintSentence for BooleanConfig

Source§

impl PrintSentence for DoubleConfig

Source§

impl PrintSentence for FileSelectConfig

Source§

impl PrintSentence for IntegerConfig

Source§

impl PrintSentence for LongConfig

Source§

impl PrintSentence for MultiCheckConfig

Source§

impl PrintSentence for PasswordConfig

Source§

impl PrintSentence for RadioConfig

Source§

impl PrintSentence for SelectorConfig

Source§

impl PrintSentence for StringConfig

Source§

impl PrintSentence for TimestampConfig

Source§

impl PrintSentence for UnsignedConfig

Source§

impl PrintSentence for BooleanControl

Source§

impl PrintSentence for ButtonControl

Source§

impl PrintSentence for HelpButtonControl

Source§

impl PrintSentence for LoggerControl

Source§

impl PrintSentence for RestoreButtonControl

Source§

impl PrintSentence for SelectorControl

Source§

impl PrintSentence for StringControl

Source§

impl PrintSentence for Dlt

Print the configuration line suitable for use with --extcap-dlts.

§Example
use r_extcap::config::ExtcapFormatter;
use r_extcap::interface::{DataLink, Dlt};

let dlt = Dlt {
    data_link_type: DataLink::ETHERNET,
    name: "ETHERNET".into(),
    display: "IEEE 802.3 Ethernet".into(),
};
assert_eq!(
    ExtcapFormatter(&dlt).to_string(),
    "dlt {number=1}{name=ETHERNET}{display=IEEE 802.3 Ethernet}\n",
);
Source§

impl PrintSentence for Interface

use r_extcap::config::ExtcapFormatter;
use r_extcap::interface::{DataLink, Dlt, Interface};
assert_eq!(
    ExtcapFormatter(&Interface{ value: "MyInterface".into(), display: "My interface".into(), dlt }).to_string(),
    "interface {value=MyInterface}{display=My interface}\n",
);
Source§

impl PrintSentence for Metadata

§Example
use r_extcap::interface::Metadata;

let metadata = Metadata {
    version: "3.2.1-test".into(),
    help_url: "http://www.wireshark.org".into(),
    display_description: "Just for testing".into(),
};
assert_eq!(
    format!("{}", ExtcapFormatter(&metadata)),
    "extcap {version=3.2.1-test}{help=http://www.wireshark.org}{display=Just for testing}\n"
)