Skip to main content

Runtime

Struct Runtime 

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

Source

pub fn session(&self) -> &Session<D>

Source

pub fn session_mut(&mut self) -> &mut Session<D>

Source

pub fn settings(&self) -> &Settings

Source

pub fn toasts(&self) -> &Toasts

Source

pub fn stats(&self) -> &FrameStats

Frame-time statistics (app.stats).

Source

pub fn stats_mut(&mut self) -> &mut FrameStats

Source

pub fn wakes(&self) -> WakeStats

Frames and wake requests per Reason (app.stats → wakes).

Source

pub fn passes(&self) -> u64

Passes run so far (frames, plus egui’s occasional extra layout pass).

Source

pub fn set_file_picker( &mut self, picker: impl FnMut(Pick) -> Option<PathBuf> + 'static, )

Replace the native file dialogs (tests, scripted runs).

Source

pub fn execute( &mut self, id: &str, params: Value, ) -> Result<Value, CommandError>

Run a command through the chokepoint now.

Source

pub fn inject_request(&mut self, req: Request)

Hand a control request to the runtime as if it came from the control port (tests).

Source

pub fn control_port(&self) -> Option<u16>

The control port, when one is serving.

Source

pub fn is_closing(&self) -> bool

Whether the app has decided to close (the window should go away).

Source

pub fn view_error(&self) -> Option<&str>

The error that suspended the view, if one did.

Source

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

Source

pub fn hidden_pass( &mut self, ctx: &Context, time: Option<f64>, events: Vec<Event>, ) -> Option<FullOutput>

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

Source

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

Source

pub fn ui(&mut self, ui: &mut Ui)

Draw the frame.

Source

pub fn shutdown(&mut self, _discarded: bool)

Settle everything before the process ends: stop jobs, flush settings, end autosave.

Source

pub fn abandon(self)

End without any cleanup, as if the process had died: autosave files stay for the next launch to recover, settings are not flushed. For crash-recovery tests.

Source

pub fn title(&self) -> &str

The window title the runtime last set (name • — App when there are unsaved changes).

Trait Implementations§

Source§

impl<D: Document> Drop for Runtime<D>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more

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>
where Arc<Shared<D>>: Freeze, Session<D>: Freeze, Jobs<Session<D>>: Freeze, Option<Box<dyn FnMut(&mut Ui, &mut Cx<'_, D>)>>: Freeze,

§

impl<D> Unpin for Runtime<D>
where Arc<Shared<D>>: Unpin, Session<D>: Unpin, Jobs<Session<D>>: Unpin, Option<Box<dyn FnMut(&mut Ui, &mut Cx<'_, D>)>>: Unpin,

§

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> 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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

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

Source§

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

Source§

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

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

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

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

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

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

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

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

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<T> Upcast<T> for T

Source§

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

Source§

impl<T> WithSubscriber for T

Source§

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

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

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