Skip to main content

Engine

Struct Engine 

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

The Engine is the central coordinator. One Engine instance per application.

Implementations§

Source§

impl Engine

Source

pub fn new(platform: Arc<dyn PlatformBridge>) -> Self

Create a new Engine with the given platform bridge.

Source

pub fn apply_commit(&mut self, batch: &IrBatch) -> Result<(), EngineError>

Process a batch of IR commands from the reconciler. This is the main entry point — called after every React commit.

The flow:

  1. Decode IR commands (create/update/delete/move nodes)
  2. Apply to shadow tree + mark dirty
  3. Recompute layout ONLY for dirty subtrees (Taffy)
  4. Diff against previous layout
  5. Issue platform bridge calls (mount phase)
Source

pub fn enqueue_commit(&self, batch: IrBatch, priority: Priority)

Enqueue a batch via the scheduler (called from JS via JSI). The scheduler handles priority ordering and frame coalescing.

Source

pub fn process_frame(&mut self) -> Result<(), EngineError>

Process all pending scheduled work for this frame. Called by the platform’s vsync/display-link callback.

Source

pub fn navigate(&mut self, action: NavigationAction) -> Vec<NavigationEvent>

Handle a navigation action.

Source

pub fn navigator(&self) -> &Navigator

Get the navigator (for DevTools inspection).

Source

pub fn focus_manager(&mut self) -> &mut FocusManager

Get the focus manager.

Source

pub fn scheduler_stats(&self) -> FrameStats

Get scheduler stats (for DevTools).

Source

pub fn handle_event(&mut self, event: InputEvent) -> EventResult

Handle a native input event. Called by the platform bridge when the OS delivers touch/mouse/keyboard events.

Source

pub fn handle_sync(&self, call: &SyncCall) -> SyncResult

Handle a synchronous call from JS. This takes &self — compile-time guarantee that no mutation happens.

RULE: No UI mutation allowed on the sync path.

Source

pub fn handle_async(&mut self, call: AsyncCall)

Handle an asynchronous call from JS. This takes &mut self — mutations are allowed.

Source

pub fn tree(&self) -> &ShadowTree

Get the shadow tree (for DevTools inspection).

Source

pub fn layout(&self) -> &LayoutEngine

Get the layout engine (for DevTools layout overlay).

Auto Trait Implementations§

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