pub struct Runtime<D: Document> { /* private fields */ }Expand description
One app instance’s frame loop. Built by App::runtime (tests, benches) or App::run.
Implementations§
Source§impl<D: Document> Runtime<D>
impl<D: Document> Runtime<D>
pub fn session(&self) -> &Session<D>
pub fn session_mut(&mut self) -> &mut Session<D>
pub fn settings(&self) -> &Settings
pub fn toasts(&self) -> &Toasts
Sourcepub fn stats(&self) -> &FrameStats
pub fn stats(&self) -> &FrameStats
Frame-time statistics (app.stats).
pub fn stats_mut(&mut self) -> &mut FrameStats
Sourcepub fn passes(&self) -> u64
pub fn passes(&self) -> u64
Passes run so far (frames, plus egui’s occasional extra layout pass).
Sourcepub fn set_file_picker(
&mut self,
picker: impl FnMut(Pick) -> Option<PathBuf> + 'static,
)
pub fn set_file_picker( &mut self, picker: impl FnMut(Pick) -> Option<PathBuf> + 'static, )
Replace the native file dialogs (tests, scripted runs).
Sourcepub fn execute(
&mut self,
id: &str,
params: Value,
) -> Result<Value, CommandError>
pub fn execute( &mut self, id: &str, params: Value, ) -> Result<Value, CommandError>
Run a command through the chokepoint now.
Sourcepub fn inject_request(&mut self, req: Request)
pub fn inject_request(&mut self, req: Request)
Hand a control request to the runtime as if it came from the control port (tests).
Sourcepub fn control_port(&self) -> Option<u16>
pub fn control_port(&self) -> Option<u16>
The control port, when one is serving.
Sourcepub fn is_closing(&self) -> bool
pub fn is_closing(&self) -> bool
Whether the app has decided to close (the window should go away).
Sourcepub fn view_error(&self) -> Option<&str>
pub fn view_error(&self) -> Option<&str>
The error that suspended the view, if one did.
Sourcepub fn logic(&mut self, ctx: &Context)
pub fn logic(&mut self, ctx: &Context)
Work that needs no drawing: control requests, finished jobs, effects, autosave, settings. eframe calls it before every frame (and while the window is hidden).
eframe runs no UI pass while the window is minimized or covered. While debugger work waits
(ui input, snapshots, waits, screenshots), run one here, after Runtime::logic: what it
draws is not presented (screenshots render off screen) and nothing raises the window, so
agents drive a covered window without taking the focus. Its window commands go to the
context; the output is returned for the caller to hand its texture changes to the renderer.
time and events are for the pass (eframe gives none: the wall clock goes on; the
headless driver passes its virtual clock and delivers its screenshots this way).
Sourcepub fn raw_input_hook(&mut self, ctx: &Context, raw: &mut RawInput)
pub fn raw_input_hook(&mut self, ctx: &Context, raw: &mut RawInput)
The start of a frame (eframe’s raw_input_hook, before Runtime::logic): credit the
frame to the wake reasons that were due. (Injected agent input is handed to egui by the
debugger’s plugin.)
Sourcepub fn shutdown(&mut self, _discarded: bool)
pub fn shutdown(&mut self, _discarded: bool)
Settle everything before the process ends: stop jobs, flush settings, end autosave.
Trait Implementations§
Auto Trait Implementations§
impl<D> !RefUnwindSafe for Runtime<D>
impl<D> !Send for Runtime<D>
impl<D> !Sync for Runtime<D>
impl<D> !UnwindSafe for Runtime<D>
impl<D> Freeze for Runtime<D>
impl<D> Unpin for Runtime<D>
impl<D> UnsafeUnpin for Runtime<D>where
Arc<Shared<D>>: UnsafeUnpin,
Session<D>: UnsafeUnpin,
Jobs<Session<D>>: UnsafeUnpin,
Option<Box<dyn FnMut(&mut Ui, &mut Cx<'_, D>)>>: UnsafeUnpin,
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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§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.Source§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.Source§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.Source§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.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§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