Skip to main content

TextField

Struct TextField 

Source
pub struct TextField<const N: usize> { /* private fields */ }
Available on crate feature wifi and target_os=none only.
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 to flash. Can be used for device names, locations, or any other text-based configuration.

Multiple TextField instances can be created with different labels and field names to collect various pieces of information during the provisioning process.

See the wifi_auto::fields module example for usage.

Implementations§

Source§

impl<const N: usize> TextField<N>

Source

pub const fn new_static() -> TextFieldStatic<N>

Create static resources for TextField.

See the wifi_auto::fields module example for usage.

Source

pub fn new( text_field_static: &'static TextFieldStatic<N>, flash: FlashBlock, field_name: &'static str, label: &'static str, default_value: &'static str, ) -> &'static Self

Initialize a new text input field.

§Parameters
  • text_field_static: Static resources for initialization
  • flash: Flash block for persistent storage
  • field_name: HTML form field name (e.g., “device_name”, “location”)
  • label: HTML label text (e.g., “Device Name:”, “Location:”)
  • default_value: Initial value if nothing saved

The maximum length is determined by the generic parameter N.

See the wifi_auto::fields module example for usage.

Source

pub fn text(&self) -> Result<Option<String<N>>>

Load the stored text from flash.

Returns None if no text has been configured yet.

See the wifi_auto::fields module example for usage.

Source

pub fn set_text(&self, text: &String<N>) -> Result<()>

Save new text to flash.

This method allows programmatic updates to the field value, such as when the user modifies configuration via button presses or other UI interactions.

The text must not exceed the maximum length N specified in the type parameter.

Alternatively, you can access the underlying flash block directly for more control over flash operations.

Trait Implementations§

Source§

impl<const N: usize> WifiAutoField for TextField<N>

Source§

fn render(&self, page: &mut String<16384>) -> Result<()>

Render HTML form elements for this field. Read more
Source§

fn parse(&self, form: &FormData<'_>) -> Result<()>

Parse and save form data submitted by the user. Read more
Source§

fn is_satisfied(&self) -> Result<bool>

Check if this field has valid configuration. Read more
Source§

impl<const N: usize> Sync for TextField<N>

Auto Trait Implementations§

§

impl<const N: usize> !Freeze for TextField<N>

§

impl<const N: usize> !RefUnwindSafe for TextField<N>

§

impl<const N: usize> Send for TextField<N>

§

impl<const N: usize> Unpin for TextField<N>

§

impl<const N: usize> !UnwindSafe for TextField<N>

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> Az for T

Source§

fn az<Dst>(self) -> Dst
where T: Cast<Dst>,

Casts the value.
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<Src, Dst> CastFrom<Src> for Dst
where Src: Cast<Dst>,

Source§

fn cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> CheckedAs for T

Source§

fn checked_as<Dst>(self) -> Option<Dst>
where T: CheckedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> CheckedCastFrom<Src> for Dst
where Src: CheckedCast<Dst>,

Source§

fn checked_cast_from(src: Src) -> Option<Dst>

Casts the value.
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<Src, Dst> LosslessTryInto<Dst> for Src
where Dst: LosslessTryFrom<Src>,

Source§

fn lossless_try_into(self) -> Option<Dst>

Performs the conversion.
Source§

impl<Src, Dst> LossyInto<Dst> for Src
where Dst: LossyFrom<Src>,

Source§

fn lossy_into(self) -> Dst

Performs the conversion.
Source§

impl<T> OverflowingAs for T

Source§

fn overflowing_as<Dst>(self) -> (Dst, bool)
where T: OverflowingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> OverflowingCastFrom<Src> for Dst
where Src: OverflowingCast<Dst>,

Source§

fn overflowing_cast_from(src: Src) -> (Dst, bool)

Casts the value.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> SaturatingAs for T

Source§

fn saturating_as<Dst>(self) -> Dst
where T: SaturatingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> SaturatingCastFrom<Src> for Dst
where Src: SaturatingCast<Dst>,

Source§

fn saturating_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> StrictAs for T

Source§

fn strict_as<Dst>(self) -> Dst
where T: StrictCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> StrictCastFrom<Src> for Dst
where Src: StrictCast<Dst>,

Source§

fn strict_cast_from(src: Src) -> Dst

Casts the value.
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.
Source§

impl<T> UnwrappedAs for T

Source§

fn unwrapped_as<Dst>(self) -> Dst
where T: UnwrappedCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> UnwrappedCastFrom<Src> for Dst
where Src: UnwrappedCast<Dst>,

Source§

fn unwrapped_cast_from(src: Src) -> Dst

Casts the value.
Source§

impl<T> WrappingAs for T

Source§

fn wrapping_as<Dst>(self) -> Dst
where T: WrappingCast<Dst>,

Casts the value.
Source§

impl<Src, Dst> WrappingCastFrom<Src> for Dst
where Src: WrappingCast<Dst>,

Source§

fn wrapping_cast_from(src: Src) -> Dst

Casts the value.