pub struct Preferences { /* private fields */ }Expand description
The shared preferences as one application sees them, from Family::preferences.
use qframe::i18n::I18n;
use qframe::storage::{Family, Source};
// An application calls `Family::QUVYTA.preferences("code", &i18n)`; the example keeps to a
// folder of its own.
let prefs = Family::QUVYTA.preferences_in(&folder, "code", &I18n::builtin());
let theme = prefs.theme();
assert_eq!((theme.value.as_str(), theme.source), ("monochrome", Source::Detected), "never detected");
assert!(folder.join("quvyta.conf").is_file(), "the first start writes the shared file");Implementations§
Source§impl Preferences
impl Preferences
Sourcepub fn update_notice(&self) -> bool
pub fn update_notice(&self) -> bool
Whether the family’s applications say when a newer version of themselves is out; see
Family::update_notice. One switch for the whole family, on unless it was turned off.
Sourcepub fn diagnostics(&self) -> &[Diagnostic]
pub fn diagnostics(&self) -> &[Diagnostic]
Problems found on the way: a broken line in the shared file, a shared file that could not
be written. Each is located where a file is to blame; the key it concerns fell back to the
detected value. Problems in the application’s own file are reported by the application’s
own Settings load and are not repeated here.
Sourcepub fn apply<Msg: Send + 'static>(&self) -> Command<Msg>
pub fn apply<Msg: Send + 'static>(&self) -> Command<Msg>
Commands that switch the running application to the resolved language, theme and icons,
for use after a change in update. At start give the preferences to
Runtime::preferences instead, so the first
frame is already drawn with them.
Trait Implementations§
Source§impl Clone for Preferences
impl Clone for Preferences
Source§impl Debug for Preferences
impl Debug for Preferences
Source§impl PartialEq for Preferences
impl PartialEq for Preferences
impl StructuralPartialEq for Preferences
Auto Trait Implementations§
impl Freeze for Preferences
impl RefUnwindSafe for Preferences
impl Send for Preferences
impl Sync for Preferences
impl Unpin for Preferences
impl UnsafeUnpin for Preferences
impl UnwindSafe for Preferences
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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