pub struct LocalizationController { /* private fields */ }Expand description
Reactive application language state with asynchronous preference persistence. The controller retains at most one pending choice while a storage request runs.
Implementations§
Source§impl LocalizationController
impl LocalizationController
Sourcepub fn preference(&self) -> LanguagePreference
pub fn preference(&self) -> LanguagePreference
The current saved language choice. Reading it subscribes this component.
Sourcepub fn application(&self) -> &Localization
pub fn application(&self) -> &Localization
The shared handle for worker messages and native services.
Sourcepub fn is_busy(&self) -> bool
pub fn is_busy(&self) -> bool
Whether initial preferences or a selected choice await storage completion.
Sourcepub fn error(&self) -> Option<String>
pub fn error(&self) -> Option<String>
The latest preference-storage error, if a request failed.
Sourcepub fn select(&self, preference: LanguagePreference)
pub fn select(&self, preference: LanguagePreference)
Saves a language asynchronously, then updates all subscribed components. If a request is active, only the most recent additional choice is retained.
Trait Implementations§
Source§impl Clone for LocalizationController
impl Clone for LocalizationController
Auto Trait Implementations§
impl !RefUnwindSafe for LocalizationController
impl !UnwindSafe for LocalizationController
impl Freeze for LocalizationController
impl Send for LocalizationController
impl Sync for LocalizationController
impl Unpin for LocalizationController
impl UnsafeUnpin for LocalizationController
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> ErasedDestructor for Twhere
T: 'static,
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> ⓘ
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 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> ⓘ
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