pub struct App { /* private fields */ }Expand description
A built application.
Implementations§
Source§impl App
impl App
Sourcepub fn builder() -> AppBuilder
pub fn builder() -> AppBuilder
Starts building an application.
Sourcepub fn census(&self) -> BTreeMap<&'static str, usize>
pub fn census(&self) -> BTreeMap<&'static str, usize>
How many things each registry holds: what removal tests compare.
Sourcepub fn dispatcher(&self) -> &KeyDispatcher
pub fn dispatcher(&self) -> &KeyDispatcher
The key dispatcher (its traces, a shortcut in progress).
Sourcepub fn debug_call(
&mut self,
collector: &str,
action: &str,
args: &Value,
) -> Feedback
pub fn debug_call( &mut self, collector: &str, action: &str, args: &Value, ) -> Feedback
Calls the debug bridge as the agent (AppHandle::debug_call);
commands.run runs at once and its result is in the feedback.
Sourcepub fn debug_call_as(
&mut self,
collector: &str,
action: &str,
args: &Value,
origin: Origin,
) -> Feedback
pub fn debug_call_as( &mut self, collector: &str, action: &str, args: &Value, origin: Origin, ) -> Feedback
Calls the debug bridge for origin (AppHandle::debug_call_as);
commands.run runs at once and its result is in the feedback.
Sourcepub fn disconnect(&mut self, plugin: &PluginId) -> Vec<PluginId>
pub fn disconnect(&mut self, plugin: &PluginId) -> Vec<PluginId>
Disconnects a plugin and those requiring it (dependents first);
everything they registered is removed. Returns the plugins
disconnected. Each leaves a plugin.disconnected event on the
journal (ADR 0028).
Sourcepub fn connect(&mut self, plugin: &PluginId) -> Result<(), PluginError>
pub fn connect(&mut self, plugin: &PluginId) -> Result<(), PluginError>
Connects a plugin that is not (its requirements first).
Sourcepub fn rebuild(&mut self)
pub fn rebuild(&mut self)
Rebuilds the derived declarations: menus, palette and settings through their hooks, and the zones. Runs after plugins come or go, never per frame.
Sourcepub fn save(&self) -> Result<(), PersistError>
pub fn save(&self) -> Result<(), PersistError>
Saves now the settings, the user’s keymap (when a directory was
given), the layout (App::save_layout) and every document
waiting in the debounced writer.
Sourcepub fn layout_document(&self) -> Option<String>
pub fn layout_document(&self) -> Option<String>
The document the layout is kept in now, as the host says
(Host::layout_document); None: the host keeps it.
Sourcepub fn load_layout(&mut self) -> Option<Outcome>
pub fn load_layout(&mut self) -> Option<Outcome>
Loads the layout from the host’s document, through the
layout.load step (an application switching workspaces calls it
once its host names the new one). None when the host keeps the
layout; a document not written yet keeps the layout as it is.
Sourcepub fn save_layout(&self) -> Option<Outcome>
pub fn save_layout(&self) -> Option<Outcome>
Saves the layout to the host’s document, through the
layout.save step. None when the host keeps the layout.
Sourcepub fn declare(
&mut self,
owner: &OwnerId,
spec: CommandSpec,
) -> Result<(), CtxError>
pub fn declare( &mut self, owner: &OwnerId, spec: CommandSpec, ) -> Result<(), CtxError>
Declares a command now (see AppHandle::declare).
Sourcepub fn undeclare(&mut self, id: &CommandId) -> bool
pub fn undeclare(&mut self, id: &CommandId) -> bool
Removes a command, its owner’s keys and menu items for it; whether it was declared.
Sourcepub fn load_keymap(
&mut self,
doc: &KeymapDoc,
layer: Layer,
) -> Result<KeymapDiff, String>
pub fn load_keymap( &mut self, doc: &KeymapDoc, layer: Layer, ) -> Result<KeymapDiff, String>
Loads a keymap document into the user’s or the workspace’s layer
now, through the keys.load step: what changed, what was skipped,
the conflicts after it.
Sourcepub fn exit(&mut self) -> Outcome
pub fn exit(&mut self) -> Outcome
The application closes: the requests still asked for after the
drawing heard (AppHandle::drain_asks), the on_exit
functions, then the app.exit step, whose default writes what is still waiting
(App::save). A vetoed exit writes nothing more: what changed was
written already, a second after it changed.
Sourcepub fn show_wrapped(&mut self, ui: &mut Ui)
pub fn show_wrapped(&mut self, ui: &mut Ui)
Draws the application, through the wrap given to the builder
when there is one.
Sourcepub fn run(&mut self, command: &CommandId, args: Value, origin: Origin) -> Reply
pub fn run(&mut self, command: &CommandId, args: Value, origin: Origin) -> Reply
Runs a command now, in the current context: its result, or a
result to come (Reply::Later, kept until it arrives).
Sourcepub fn run_in(
&mut self,
command: &CommandId,
args: Value,
origin: Origin,
cx: &WhenContext,
) -> Reply
pub fn run_in( &mut self, command: &CommandId, args: Value, origin: Origin, cx: &WhenContext, ) -> Reply
Runs a command now, in a given context, through the host.
Sourcepub fn settle(&mut self) -> usize
pub fn settle(&mut self) -> usize
Takes the results that arrived (each frame does it before drawing); returns how many.
Sourcepub fn process_requests(&mut self)
pub fn process_requests(&mut self)
Does what blocks and handlers asked for.
Sourcepub fn logic(&mut self, ctx: &Context)
pub fn logic(&mut self, ctx: &Context)
Between frames: the theme asked for, requests, declarations, and
the On::Pass handlers.
The On::Pass handlers run once per pass: a second call inside
the same egui pass (the same viewport and
Context::cumulative_pass_nr) settles again (the theme asked
for, requests, declarations) but does not run them. eframe calls
it from its logic hook and App::show calls it again, so that
an integration without that hook (plain egui, kittest’s
build_ui) still runs it; a host may also call it a second time
after changing something (a theme, a request) so the change is in
place before the pass draws. Calls between passes always run the
handlers: eframe ticks the logic alone while the window is
hidden, and those ticks share one pass number.
Sourcepub fn show(&mut self, ui: &mut Ui)
pub fn show(&mut self, ui: &mut Ui)
Draws the whole application in a Ui covering the window, after
dispatching this frame’s keys.
Runs App::logic first, which does nothing when the host
already ran it in this pass (eframe’s logic hook).
Trait Implementations§
Source§impl App for App
Available on crate feature eframe only.
impl App for App
eframe only.Source§fn clear_color(&self, _visuals: &Visuals) -> [f32; 4]
fn clear_color(&self, _visuals: &Visuals) -> [f32; 4]
Transparent where windows are built transparent for their rounded corners: what egui leaves unpainted outside a corner shows the desktop. An opaque window ignores the alpha.
Source§fn logic(&mut self, ctx: &Context, _frame: &mut Frame)
fn logic(&mut self, ctx: &Context, _frame: &mut Frame)
Self::ui],
and additionally also called when the UI is hidden, but [egui::Context::request_repaint] was called. Read moreSource§fn ui(&mut self, ui: &mut Ui, _frame: &mut Frame)
fn ui(&mut self, ui: &mut Ui, _frame: &mut Frame)
§fn save(&mut self, _storage: &mut dyn Storage)
fn save(&mut self, _storage: &mut dyn Storage)
§fn auto_save_interval(&self) -> Duration
fn auto_save_interval(&self) -> Duration
Self::save]§fn persist_egui_memory(&self) -> bool
fn persist_egui_memory(&self) -> bool
§fn raw_input_hook(&mut self, _ctx: &Context, _raw_input: &mut RawInput)
fn raw_input_hook(&mut self, _ctx: &Context, _raw_input: &mut RawInput)
Self::ui]. Read moreAuto Trait Implementations§
impl !Freeze for App
impl !RefUnwindSafe for App
impl !Send for App
impl !Sync for App
impl Unpin for App
impl UnsafeUnpin for App
impl !UnwindSafe for App
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
§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§impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
impl<F, T, S> SimdInto<T, S> for Fwhere
T: SimdFrom<F, S>,
S: Simd,
§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.