Struct StringControl

Source
pub struct StringControl {
    pub control_number: u8,
    pub display: String,
    pub tooltip: Option<String>,
    pub placeholder: Option<String>,
    pub validation: Option<String>,
    pub default_value: Option<String>,
}
Expand description

A text field toolbar control element.

Maximum length is accepted by a StringControl is 32767 bytes.

The default string value can be set at startup, and the value can be changed dynamically while capturing. When the value changes or is different form the default, its value will be sent as a ControlPacket during capture.

Fields§

§control_number: u8

The control number, a unique identifier for this control.

§display: String

A user-visible label for this control.

§tooltip: Option<String>

An optional tooltip that is shown when hovering on the UI element.

§placeholder: Option<String>

An optional placeholder that is shown when this control is empty.

§validation: Option<String>

An optional regular expression string that validates the value on the field. If the value does not match the regular expression, the text field will appear red and its value will not be sent in a ControlPacket.

Despite what the Wireshark documentation says, back slashes in the the regular expression string do not have to be escaped, just remember to use a Rust raw string when defining them. (e.g. r“\d\d\d\d“).

§default_value: Option<String>

The default value

Implementations§

Source§

impl StringControl

Source

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

Create a builder for building StringControl. On the builder, call .control_number(...), .display(...), .tooltip(...), .placeholder(...), .validation(...), .default_value(...)(optional) to set the values of the fields. Finally, call .build() to create the instance of StringControl.

Source§

impl StringControl

Source

pub fn set_value<'a>(&self, message: &'a str) -> ControlPacket<'a>

Sets the value in the text field.

Panics: If the string is longer than 32767 bytes.

Trait Implementations§

Source§

impl Debug for StringControl

Source§

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

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

impl Default for StringControl

Source§

fn default() -> StringControl

Returns the “default value” for a type. Read more
Source§

impl PrintSentence for StringControl

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

impl ToolbarControl for StringControl

Source§

fn control_number(&self) -> u8

The control number, a unique identifier for this control.

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.