Skip to main content

Prefs

Struct Prefs 

Source
pub struct Prefs(/* private fields */);
Expand description

The handle Preferences::install returns: Copy, so pages and the nav take it by value.

Implementations§

Source§

impl Prefs

Source

pub fn open(&self) -> bool

Open-or-focus the surface: the window on desktop; on mobile, select the nav item when one is mounted, else present the navigation presentation as a cover.

Source

pub fn open_at(&self, route: &str) -> bool

Open and select a group ("updates"), optionally a row ("updates/check").

Source

pub fn in_nav(&self) -> bool

Whether the app should place a Settings entry in its own navigation: true where the platform gives no app menu to reach the surface from (the phones); false on the desktops and on the web, whose menu button carries Settings… and About.

Source

pub fn nav_item<K>(&self, key: impl Into<K>) -> Option<NavItem<K>>

The Settings entry for the app’s navigation, titled with the platform’s word and opening page: Some where Self::in_nav, None where the platform’s application menu already carries Settings. Goes straight into a nav’s items: nav(sel).items((…, prefs.nav_item(Section::Settings))).

Source

pub fn nav_item_everywhere<K>(&self, key: impl Into<K>) -> NavItem<K>

The Settings entry on every platform, menu or not: for an app that wants Settings in its sidebar on the desktop too. Most apps want nav_item.

Source

pub fn page(&self) -> AnyPiece

The navigation presentation as a piece: the destination of the nav item, or any place the app embeds settings.

Source

pub fn group_page(&self, id: &str) -> AnyPiece

One group’s page alone (an in-reader sheet, a sidebar pane).

Source

pub fn group_body(&self, id: &str) -> AnyPiece

One group’s sections without a scroll, for a sheet that stacks several groups and owns the scrolling itself: put the bodies in one scroll. The phones keep their native shape, sized to its rows.

Source

pub fn about_page(&self) -> AnyPiece

The composed About page.

Source

pub fn title(&self) -> String

The surface’s title.

Trait Implementations§

Source§

impl Clone for Prefs

Source§

fn clone(&self) -> Prefs

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

Auto Trait Implementations§

§

impl !RefUnwindSafe for Prefs

§

impl !Send for Prefs

§

impl !Sync for Prefs

§

impl !UnwindSafe for Prefs

§

impl Freeze for Prefs

§

impl Unpin for Prefs

§

impl UnsafeUnpin for Prefs

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> 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<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

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<T> IntoReactive<T, StaticMark> for T
where T: Clone + 'static,

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.