Skip to main content

EngineControl

Struct EngineControl 

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

A cheap, cloneable handle for sending input to the engine from any thread.

Implementations§

Source§

impl EngineControl

Source

pub fn dispatch_event( &self, id: NodeId, event: EventKind, payload: EventPayload, )

Delivers an input event (and its data) to a node.

Source

pub fn scroll(&self, id: NodeId, x: f32, y: f32, applied: u32)

Reports the content offset of a scroll view or list, and how many scrolls the core asked for (MountItem::ScrollBy items and Command::ScrollTo commands for the view) were applied before it. Cheap to call on every scroll frame: offsets are coalesced per engine frame.

Source

pub fn zoom(&self, id: NodeId, scale: f32)

Reports the zoom scale of a zoomable scroll view (before the offset the zoom changed); onScroll carries it.

Source

pub fn set_component_size(&self, id: NodeId, size: Size)

A registered native component’s own size (points): it is laid out at it where its style leaves a dimension open.

Source

pub fn animations_finished(&self, finished: Vec<Finished>)

Reports native animations that finished or were interrupted.

Source

pub fn resize(&self, size: Size)

Resizes the root view.

Source

pub fn set_environment(&self, environment: Environment)

Reports a change of the surface’s environment (safe area, keyboard, appearance…).

Source

pub fn set_root_size(&self, id: NodeId, size: Size, insets: EdgeInsets)

The platform presents root id (a modal) at size, with insets of it covered by system UI.

Source

pub fn set_screen_header(&self, id: NodeId, height: Option<f32>)

The platform measured where the content of screen id starts below its header (None: let the core estimate it).

Source

pub fn hot_update(&self, update: HotUpdate)

Applies a development update in place. When it cannot be applied, MountSink::hot_update_failed asks the platform to reload.

Source

pub fn frame(&self)

A display frame began, after MountSink::request_frame: runs the requestAnimationFrame callbacks and the tasks waiting for it.

Source

pub fn set_states(&self, id: NodeId, states: u8)

Reports the interaction states of view id that the core asked to track (nsh_core::MountItem::TrackStates; bits of nsh_core::tailwind::state). Class styles that depend on them (active:, hover:, focus:) update without JS.

Source

pub fn set_perf_monitor(&self, monitor: Option<Arc<PerfMonitor>>)

Records the engine’s commits into monitor from now on (None: stops). Measuring costs nothing while no monitor is installed.

Source

pub fn set_theme(&self, theme: Option<Theme>)

Sets the embedding app’s theme, which the UI sets’ components render with instead of the app’s own (None: the app’s again; Core::set_host_theme). Sent from Engine::start_with’s setup, it is in the first frame.

Trait Implementations§

Source§

impl Clone for EngineControl

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> ParallelSend for T

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.