pub struct TimezoneField { /* private fields */ }wifi and target_os=none only.Expand description
A timezone selection field for WiFi provisioning.
Allows users to select their timezone from a dropdown during the captive portal setup. The selected offset (in minutes from UTC) is persisted to flash and can be retrieved later.
See the wifi_auto::fields module example for usage.
Implementations§
Source§impl TimezoneField
impl TimezoneField
Sourcepub const fn new_static() -> TimezoneFieldStatic
pub const fn new_static() -> TimezoneFieldStatic
Create static resources for TimezoneField.
See the wifi_auto::fields module example for usage.
Sourcepub fn new(
timezone_field_static: &'static TimezoneFieldStatic,
flash: FlashBlock,
) -> &'static Self
pub fn new( timezone_field_static: &'static TimezoneFieldStatic, flash: FlashBlock, ) -> &'static Self
Initialize a new timezone field.
See the wifi_auto::fields module example for usage.
Sourcepub fn offset_minutes(&self) -> Result<Option<i32>>
pub fn offset_minutes(&self) -> Result<Option<i32>>
Load the stored timezone offset in minutes from UTC.
Returns None if no timezone has been configured yet.
See the wifi_auto::fields module example for usage.
Sourcepub fn set_offset_minutes(&self, offset: i32) -> Result<()>
pub fn set_offset_minutes(&self, offset: i32) -> Result<()>
Save a new timezone offset in minutes from UTC to flash.
This method allows programmatic updates to the timezone, such as when the user adjusts the timezone via button presses or other UI interactions.
Only writes to flash if the value has changed, avoiding unnecessary flash wear.
Alternatively, you can access the underlying flash block directly for more control over flash operations.
Trait Implementations§
Source§impl WifiAutoField for TimezoneField
impl WifiAutoField for TimezoneField
impl Sync for TimezoneField
Auto Trait Implementations§
impl !Freeze for TimezoneField
impl !RefUnwindSafe for TimezoneField
impl Send for TimezoneField
impl Unpin for TimezoneField
impl !UnwindSafe for TimezoneField
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
Source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
Source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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