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
impl StringControl
Sourcepub fn builder() -> StringControlBuilder<((), (), (), (), (), ())>
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
impl StringControl
Sourcepub fn set_value<'a>(&self, message: &'a str) -> ControlPacket<'a>
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.