pub struct SettingsPage {
pub id: String,
pub title: String,
pub parent: Option<String>,
pub order: i32,
pub keywords: Vec<String>,
pub description: String,
pub settings: Vec<SettingId>,
pub needs: Option<Mountable>,
/* private fields */
}Expand description
A custom page of the settings window: its place, what finds it, what it edits and what it needs.
use egui_pop_api::settings_pages::SettingsPage;
use egui_pop_model::ids::SettingId;
let page = SettingsPage::new("app.compute", "Compute")
.under("Performance")
.order(20)
.keywords(&["GPU", "OpenCL"])
.settings(&[SettingId::from_static("app.threads")]);
assert_eq!(page.parent.as_deref(), Some("Performance"));
assert!(page.has_reset());Fields§
§id: StringA stable id: what app.settings.page and
crate::settings_window::SettingsWindow::open take.
title: StringAs shown in the tree and over the page.
parent: Option<String>The section (as the tree names it) or the page (its id) it goes
under; None, or one that does not exist: a page of its own
after the generated sections.
order: i32Its order among the pages of the same parent (lower first, then by title).
keywords: Vec<String>Words the settings search finds it by, besides its title, its description and its settings.
description: StringSaid under its title, and searched.
settings: Vec<SettingId>The declared settings it edits: they leave the generated sections, the search finds the page by them, and its reset takes them back to their defaults.
needs: Option<Mountable>What its component needs, checked against the settings page
host’s offer; None: a plain widget (settings-page:<id>).
Implementations§
Source§impl SettingsPage
impl SettingsPage
pub fn new(id: &str, title: &str) -> Self
Sourcepub fn under(self, parent: &str) -> Self
pub fn under(self, parent: &str) -> Self
Under a section (as the tree names it: “Appearance”) or a page (its id).
pub fn order(self, order: i32) -> Self
pub fn keywords(self, words: &[&str]) -> Self
pub fn description(self, text: &str) -> Self
Sourcepub fn needs(self, needs: Mountable) -> Self
pub fn needs(self, needs: Mountable) -> Self
What its component needs (checked when it is mounted).
Sourcepub fn reset_with(
self,
changed: impl Fn(&AppHandle) -> bool + 'static,
reset: impl Fn(&AppHandle) + 'static,
) -> Self
pub fn reset_with( self, changed: impl Fn(&AppHandle) -> bool + 'static, reset: impl Fn(&AppHandle) + 'static, ) -> Self
Its own reset, for what it shows that is not a setting (run with its settings’ resets, in the same undo step when it writes to the store), and whether that is away from its defaults.
Sourcepub fn is_changed(&self, app: &AppHandle) -> bool
pub fn is_changed(&self, app: &AppHandle) -> bool
Whether what it edits is away from its defaults.
Trait Implementations§
Source§impl Clone for SettingsPage
impl Clone for SettingsPage
Source§fn clone(&self) -> SettingsPage
fn clone(&self) -> SettingsPage
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for SettingsPage
impl Debug for SettingsPage
Auto Trait Implementations§
impl Freeze for SettingsPage
impl !RefUnwindSafe for SettingsPage
impl !Send for SettingsPage
impl !Sync for SettingsPage
impl Unpin for SettingsPage
impl UnsafeUnpin for SettingsPage
impl !UnwindSafe for SettingsPage
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,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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