pub struct TextField<const N: usize> { /* private fields */ }Expand description
A generic text input field for collecting user input during WiFi provisioning.
Presents a customizable text input box in the captive portal that validates and stores user-provided text in memory or flash.
Multiple TextField instances can be created with different labels and field names
to collect additional configuration beyond WiFi credentials.
See the wifi_auto::fields module example for usage.
Implementations§
Source§impl<const N: usize> TextField<N>
impl<const N: usize> TextField<N>
Sourcepub const fn new_static() -> TextFieldStatic<N>
pub const fn new_static() -> TextFieldStatic<N>
Create static resources for TextField.
See the wifi_auto::fields module example for usage.
Sourcepub fn new_in_memory(
text_field_static: &'static TextFieldStatic<N>,
field_name: &'static str,
label: &'static str,
default_value: &'static str,
) -> &'static Self
pub fn new_in_memory( text_field_static: &'static TextFieldStatic<N>, field_name: &'static str, label: &'static str, default_value: &'static str, ) -> &'static Self
Initialize a text field backed by in-memory state.
The maximum text length is determined by the generic parameter N.
Parameters:
text_field_static: Static resources for initialization.field_name: HTML form field name (for example,device_name).label: HTML label text shown in the captive portal form.default_value: Initial value if nothing has been configured yet.
See the wifi_auto::fields module example for usage.
Sourcepub fn new_with_flash(
text_field_static: &'static TextFieldStatic<N>,
text_flash_block: FlashBlockEsp,
field_name: &'static str,
label: &'static str,
default_value: &'static str,
) -> &'static Self
pub fn new_with_flash( text_field_static: &'static TextFieldStatic<N>, text_flash_block: FlashBlockEsp, field_name: &'static str, label: &'static str, default_value: &'static str, ) -> &'static Self
Initialize a text field backed by a flash block.
The maximum text length is determined by the generic parameter N.
Parameters:
text_field_static: Static resources for initialization.text_flash_block: Flash block for persistent storage.field_name: HTML form field name (for example,device_name).label: HTML label text shown in the captive portal form.default_value: Initial value if nothing has been configured yet.
See the wifi_auto::fields module example for usage.
Sourcepub fn text(&self) -> Result<Option<String<N>>, Error>
pub fn text(&self) -> Result<Option<String<N>>, Error>
Return the current text, if present.
Returns None when no text has been configured yet.
See the wifi_auto::fields module example for usage.
Source§impl<const N: usize> TextField<N>
impl<const N: usize> TextField<N>
Sourcepub fn new(
text_field_static: &'static TextFieldStatic<N>,
text_flash_block: FlashBlockEsp,
field_name: &'static str,
label: &'static str,
default_value: &'static str,
) -> &'static Self
pub fn new( text_field_static: &'static TextFieldStatic<N>, text_flash_block: FlashBlockEsp, field_name: &'static str, label: &'static str, default_value: &'static str, ) -> &'static Self
Initialize a text field backed by a flash block.
See the WifiAutoEsp struct example for usage.