Skip to main content

Admin

Struct Admin 

Source
pub struct Admin { /* private fields */ }
Expand description

The administration app’s state, manifests, hooks, widget kinds and value layers.

Need (dialog): a settings or admin page declared as a manifest.

Implementations§

Source§

impl Admin

Source

pub fn open_detail( &self, app: &AppHandle, records: &Records, row: &Json, ) -> Result<u64, String>

Opens the detail sheet of row, one of records’ rows, over the window drawn (or the one whose command opened it): the sheet Records::detail declares, its title the row’s, each line a label over its value. Returns the dialog’s id; refused when the records declare no sheet or there are no dialogs.

Source§

impl Admin

Source

pub fn set_foci(&self, foci: impl SettingsFoci)

Gives the Settings the host’s foci (see the module’s docs).

Source

pub fn foci(&self, app: &AppHandle) -> Vec<SettingsFocus>

The host’s foci open now (none without Admin::set_foci).

Source

pub fn edited_focus(&self) -> Option<String>

The focus the Settings edit, once one was chosen.

Source

pub fn edit_focus(&self, app: &AppHandle, id: &str) -> Result<(), String>

Makes the Settings edit a focus of the host’s.

§Errors

No such focus, or the host cannot edit it.

Source§

impl Admin

Source

pub fn note_changed<'a>(&self, ids: impl IntoIterator<Item = &'a str>, at: f64)

Notes that the person changed settings (their ids) at at (seconds since the epoch): offered among the recent ones in the quick settings until RECENT_SECONDS later.

Source

pub fn quick_settings(&self, app: &AppHandle) -> Vec<String>

The settings marked quick that exist, in order.

Source

pub fn recent_settings(&self, app: &AppHandle, now: f64) -> Vec<String>

The settings changed lately at now, the latest first, without the quick ones, at most RECENT_MAX.

Source

pub fn quick_open_in(&self, group: ViewportId) -> bool

Whether the quick settings are open in a window group.

Source

pub fn toggle_quick(&self, group: ViewportId) -> bool

Opens or closes them in a window group; whether they are open.

Source

pub fn quick_window_in(&self, group: ViewportId) -> Option<ViewportId>

The window they are shown in, in a window group, once drawn.

Source§

impl Admin

Source

pub fn attach_store(&self, store: impl SettingsStore + 'static)

Gives the Settings app the host’s store: its scopes are read at the next pass (a host scope once offered), what changes is saved to it, and its changes made elsewhere are followed. Replaces a store attached before.

Source

pub fn has_store(&self) -> bool

Whether the host gave a store.

Source

pub fn reload(&self, scope: ValueScope)

Reads a scope from the store again at the next pass (the host opened another library): what it holds replaces the layer.

Source

pub fn store_errors(&self) -> Vec<(Option<ValueScope>, String)>

The store’s errors to show: a failed load or save, by scope, and its other problems (a setting two handlers claim).

Source

pub fn saving(&self) -> bool

Whether saves are on their way to the store.

Source

pub fn session_only(&self, app: &AppHandle) -> bool

Whether the values changed here last only the session: no store, and neither the application’s settings file nor the host’s own layer handling keeps them.

Source§

impl Admin

Source

pub fn obsolete(&self, id: &str, note: &str)

Names a setting the application retired, with what replaced it: an imported file’s value for it is flagged obsolete, not applied.

Source

pub fn export_settings( &self, app: &AppHandle, selection: &Selection, ) -> Result<SettingsFile, String>

The settings file of a selection: the values, the shortcuts, the sensitive settings left out.

Source

pub fn import_plan( &self, app: &AppHandle, file: &SettingsFile, scope: ValueScope, ) -> Vec<Row>

What importing a file into a value scope would do, row by row.

Source

pub fn import_settings( &self, app: &AppHandle, file: &SettingsFile, scope: ValueScope, keys: Option<&[String]>, ) -> Result<Json, String>

Applies a file’s changes into a value scope: those keys names (None: every change), as one undo step. What is not applied is said, with its reason.

Source

pub fn undo_import(&self, app: &AppHandle) -> Result<Json, String>

Takes the last import back: its undo step (refused when the settings changed since: undo those first), the layer and the shortcuts as they were.

Source

pub fn can_undo_import(&self) -> bool

Whether an import can be undone.

Source§

impl Admin

Source

pub fn wizard_flow(&self) -> Option<Flow>

The wizard running, if any.

Source

pub fn open_wizard( &self, app: &AppHandle, id: &str, step: Option<&str>, values: Values, ) -> Result<Json, String>

Opens a wizard declared in a manifest, on its first step (or on step, if the steps before it are valid), its draft the defaults with values over them. The Settings app opens with it.

Source

pub fn open_focus_wizard( &self, app: &AppHandle, id: &str, step: Option<&str>, values: Values, ) -> Result<Json, String>

Opens a wizard as Admin::open_wizard does, as a focus screen: the main window’s whole page, whatever the app’s window setting (pop.admin.window), with the shell’s menus, status bar and centre hidden until it ends; the title bar stays, to move or quit. For a setup run before anything else (a first launch).

Source

pub fn open_sheet_wizard( &self, app: &AppHandle, id: &str, step: Option<&str>, values: Values, ) -> Result<Json, String>

Opens a wizard as Admin::open_wizard does, as a sheet: a window-modal dialog over the window it is opened from (the window drawn, or the one whose command opened it), which blocks that window alone; the other windows keep working. For a short wizard of one to three steps of form fields. The Settings app does not open. Finishing runs the wizard’s command, its answer to whatever opened it, and closes the sheet; Cancel, Escape, or the window closing end it with nothing run. Refused while another wizard runs.

Source

pub fn focus_screen(&self) -> bool

Whether a wizard opened as a focus screen is running.

Source

pub fn wizard_set( &self, app: &AppHandle, values: Values, ) -> Result<Json, String>

Sets draft values.

Source

pub fn wizard_next(&self, app: &AppHandle) -> Result<Json, String>

Next: refused with the step’s first blocking problem.

Source

pub fn wizard_back(&self, app: &AppHandle) -> Result<Json, String>

Source

pub fn wizard_skip(&self, app: &AppHandle) -> Result<Json, String>

Source

pub fn wizard_go(&self, app: &AppHandle, step: &str) -> Result<Json, String>

Goes to a step: lands on the first invalid one before it, if any, and says why.

Source

pub fn wizard_finish(&self, app: &AppHandle) -> Result<Json, String>

Finishes: runs the wizard’s command with the draft, then closes it. Refused (and landed on the step) while a step is not valid.

Source

pub fn wizard_cancel( &self, app: &AppHandle, force: bool, ) -> Result<Json, String>

Cancels: asks first when anything was entered (unless force), through the dialogs; without them, refused.

Source

pub fn wizard_state(&self, app: &AppHandle) -> Json

The flow’s state, for its commands’ answers and the collector: the step, the steps and their state, the draft, the problems.

Source

pub fn last_finished(&self) -> Option<Json>

What the last finish ran (the wizard, the command, its arguments).

Source§

impl Admin

Source

pub fn is_open(&self) -> bool

Source

pub fn open(&self, app: &AppHandle, place: Option<&str>) -> Result<(), String>

Opens it on a place: scope, scope/section, scope/section/key or a setting id (None: where it was). Asked in a window of one of the host’s foci, it edits that focus (focus).

Source

pub fn close(&self, app: &AppHandle)

Closes it, and the wizard running with it. In its window, it is the window’s close (pop.window.close, the app asking): the app closes in that call, its window’s listeners after it.

Source

pub fn shown(&self) -> (Option<String>, Option<String>, String)

The scope, section and search shown.

Source

pub fn manifest(&self, manifest: Manifest)

Adds a manifest (checked when the tree is built: what does not resolve is left out and reported).

Source

pub fn texts(&self, keys: &[StrKey])

Registers the strings a manifest’s texts are, so they show in the interface’s language: a declared text (a section’s title, a group’s, a column’s, an action’s, a confirmation’s, an empty state’s, a row field’s and its choices’) equal to a key’s English fallback is shown translated. A text with no key shows as declared.

Source

pub fn hook(&self, name: &str, hook: Hook) -> bool

Registers a hook a manifest names; false when the name is taken.

Source

pub fn widget_kind( &self, id: &str, draw: impl Fn(&mut Ui, &AppHandle, &Json) + Send + Sync + 'static, )

Registers a widget kind: draws a node of its kind with its options (shortcuts, gestures, fonts and settings-page are egui-pop’s own). One that edits settings names them in its options’ settings, so the generated pages leave them out.

Registers a widget kind’s search, so the Settings app’s search finds the items inside a node of that kind (the shortcuts editor’s commands, by name and by key). The settings a widget names in its options’ settings are searched without it.

Source

pub fn marked(&self) -> Option<String>

The item a deep link or a search hit landed on, marked while its section shows: a setting id, or a widget’s item key.

Source

pub fn take_key(&self, key: &str) -> bool

Whether key is the item to scroll to, taken once: the widget that draws it scrolls to it.

Source

pub fn diagnostics(&self) -> Diagnostics

The diagnostics of the last tree built.

Source

pub fn tree(&self, app: &AppHandle) -> Tree

The resolved tree: the declared settings’ pages (less the settings a manifest places), then every manifest, checked.

Source

pub fn layers(&self) -> Layers

The value layers.

Source

pub fn declare_scope(&self, extra: ExtraScope)

Declares a host value scope above those declared before it: a value set for it wins over theirs and app’s. Declare them in order, lowest first, before offering them; declaring one again changes its label and about.

Source

pub fn extra_scopes(&self) -> Vec<ExtraScope>

The host’s value scopes, lowest first.

Source

pub fn extra_scope(&self, scope: ValueScope) -> Option<ExtraScope>

A declared scope’s declaration.

Source

pub fn offer(&self, scope: ValueScope, on: bool)

Offers a host value scope for editing (the application opened its library, its workspace…), or takes it back.

Source

pub fn offered(&self) -> Vec<ValueScope>

The editable value scopes offered (app always).

Source

pub fn load_layer( &self, app: &AppHandle, scope: ValueScope, values: BTreeMap<String, Json>, )

👎Deprecated: attach a store::SettingsStore with Admin::attach_store

Replaces a layer’s values (setting id to JSON), as the application keeps them with its library or workspace; the effective values change at once.

Source

pub fn export_layer(&self, scope: ValueScope) -> BTreeMap<String, Json>

👎Deprecated: attach a store::SettingsStore with Admin::attach_store

A layer’s values, by setting id: what the application saves.

Source

pub fn set_run( &self, app: &AppHandle, id: &SettingId, value: Json, ) -> Result<(), String>

A command line override (--set key=value): shown as the command line origin, never edited.

Source

pub fn set_in( &self, app: &AppHandle, scope: ValueScope, id: &SettingId, value: Json, ) -> Result<(), String>

Sets a setting’s value in a value scope; app writes the store as the settings form does (an undo step) unless a layer above holds it.

Source

pub fn allows(&self, app: &AppHandle, id: &SettingId, scope: ValueScope) -> bool

Whether a setting opted into a host scope: in its declaration (Descriptor::scopes) or on a field of a manifest placing it.

Source

pub fn clear_in( &self, app: &AppHandle, scope: ValueScope, id: &SettingId, ) -> Result<(), String>

Takes a value scope’s value of a setting back: app goes back to the default, a layer above to what is under it.

Source

pub fn read( &self, app: &AppHandle, command: &str, args: &Json, ) -> Option<Result<Json, String>>

A read_only command’s answer: None while it is read for the first time (the command is asked for, run before the next frame; its result is taken from the runs). Read again after a refresh, it answers what it answered before until the new answer comes (Admin::refreshing says so meanwhile).

Source

pub fn refreshing(&self, command: &str, args: &Json) -> bool

Whether the read of command with args shows its last answer while a new one is read (after a refresh): a page marks it “Refreshing…” and keeps its rows.

Source

pub fn attach_reads(&self, kernel: Arc<ReadKernel>)

Reads the commands kernel’s transport serves through it: a status or a list shows at once what the kernel holds, read again in the background (crate::reads); the events the page looks at reach the kernel’s policies, and a refresh makes its values out of date without dropping them. Other commands are run as before.

Source

pub fn reads(&self) -> Option<Arc<ReadKernel>>

The read kernel attached, if any.

Source

pub fn refresh(&self)

Sets the answers read aside and forgets the reads still in flight (their answer may predate the change): they are read again when shown, each showing its last answer until the new one comes.

Trait Implementations§

Source§

impl Debug for Admin

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Admin

Source§

fn default() -> Admin

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Freeze for Admin

§

impl RefUnwindSafe for Admin

§

impl Send for Admin

§

impl Sync for Admin

§

impl Unpin for Admin

§

impl UnsafeUnpin for Admin

§

impl UnwindSafe for Admin

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
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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>

Convert 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)

Convert &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)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for T
where T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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
§

impl<T> NoneValue for T
where T: Default,

§

type NoneType = T

§

fn null_value() -> T

The none-equivalent value.
§

impl<T, S> SimdFrom<T, S> for T
where S: Simd,

§

fn simd_from(_simd: S, value: T) -> T

§

impl<F, T, S> SimdInto<T, S> for F
where T: SimdFrom<F, S>, S: Simd,

§

fn simd_into(self, simd: S) -> T

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.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

§

impl<T> WasmNotSend for T
where T: Send,

§

impl<T> WasmNotSendSync for T
where T: WasmNotSend + WasmNotSync,

§

impl<T> WasmNotSync for T
where T: Sync,