pub struct Core<M: TextEngine> { /* private fields */ }Expand description
The shadow tree of one surface.
Feed it Ops with Core::apply, then call Core::commit once per
JS turn to get the MountBatch for the platform. Lists may then ask
the runtime to render more items (Core::take_list_binds); the engine
runs those and commits again within the same frame.
Implementations§
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
Sourcepub fn set_class_environment(&mut self, env: ClassEnvironment)
pub fn set_class_environment(&mut self, env: ClassEnvironment)
Sets the environment class variants depend on (dark:, ios:,
motion-reduce:): nodes whose classes depend on it are styled again.
Sourcepub fn set_appearance(&mut self, appearance: Appearance)
pub fn set_appearance(&mut self, appearance: Appearance)
The appearance the app asks for (nsh.json "appearance", TS
setColorScheme, crate::element::set_color_scheme): what
dark: variants and the components’ theme follow in place of the
system’s; the platform applies it to its own controls
(MountItem::Appearance).
Sourcepub fn set_states(&mut self, id: NodeId, states: u16)
pub fn set_states(&mut self, id: NodeId, states: u16)
The platform reports interaction states of view id (active:,
hover:, focus:): state bits for the states it
tracks (MountItem::TrackStates), and FOCUSED whatever it
tracks (crate::input::reported_states); see
crate::tailwind::state.
Sourcepub fn release_states_after(&mut self, id: NodeId, states: u16, hold: Duration)
pub fn release_states_after(&mut self, id: NodeId, states: u16, hold: Duration)
Reports the interaction states of view id after a short completed
press, holding state::PRESSED for hold so same-turn tap-to-click
releases still render :active feedback before settling to states.
Any subsequent state report for id (including a new press or
cancellation) supersedes the pending release.
Sourcepub fn next_state_timer(&self) -> Option<Instant>
pub fn next_state_timer(&self) -> Option<Instant>
Earliest deadline at which a short press’s held PRESSED state ends.
Sourcepub fn expire_state_timers(&mut self, now: Instant) -> bool
pub fn expire_state_timers(&mut self, now: Instant) -> bool
Releases any short-press PRESSED impulses due by now; returns
whether any state changed.
Sourcepub fn set_input_modality(&mut self, modality: InputModality)
pub fn set_input_modality(&mut self, modality: InputModality)
The platform reports what the user gave the surface input with
last (InputModality), before the focus moves it causes: a key
typed while the focus does not show makes it show, as browsers
do. A pointer leaves a focus that shows as it is: only a move of
the focus decides again (Self::focus_shows). A hint the focus
shows is decided only as the focus moves
(Self::keyboard_moves_focus): a key typed after a press shows
the focus, never the hint of the view it is on.
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
Sourcepub fn set_components(&mut self, registry: Registry)
pub fn set_components(&mut self, registry: Registry)
The components this core can render (from nsh-base and the
like), and the design tokens their sets bring
(Registry::tokens_from); set before the first op. Runs the
sets’ setup functions (Registry::setup).
Sourcepub fn extend_components(&mut self, registry: Registry)
pub fn extend_components(&mut self, registry: Registry)
Replaces the components of a running core with registry, a
superset of what it had (a UI set registered after the app started:
a web runtime’s late nsh_part_*). What is mounted from then on may
use the new components; the tokens stay the app’s, and only the
setup functions the old sets did not bring run.
Sourcepub fn set_tokens(&mut self, tokens: Tokens)
pub fn set_tokens(&mut self, tokens: Tokens)
The app’s design tokens; it is drawn with them unless the
embedding app set its own (Core::set_host_tokens).
Sourcepub fn set_translations(&mut self, translations: Translations)
pub fn set_translations(&mut self, translations: Translations)
The app’s translations (crate::i18n): what t! and TS’s t
read from now on.
Sourcepub fn take_locale_request(&mut self) -> Option<Option<Locale>>
pub fn take_locale_request(&mut self) -> Option<Option<Locale>>
The language the app asked to show in since the last call
(Some(None): the user’s again), which the engine applies to the
environment it gives the core and JS.
Sourcepub fn set_host_tokens(&mut self, tokens: Option<Tokens>)
pub fn set_host_tokens(&mut self, tokens: Option<Tokens>)
The embedding app’s design tokens (None: the app’s again): an app
embedded in a native app looks like it, whatever the app sets.
Text inherits its foreground token unless it sets its own color.
Sourcepub fn theme_tokens(&self) -> ThemeTokens
pub fn theme_tokens(&self) -> ThemeTokens
What Core::tokens become when the root’s uiTheme (the app’s
theme file) is set, with the embedding app’s tokens of now: JS reads
them in the turn that sends the theme, before it reaches the core.
Sourcepub fn tokens(&self) -> &Arc<Tokens> ⓘ
pub fn tokens(&self) -> &Arc<Tokens> ⓘ
The design tokens the app is drawn with now: the app’s, under the
embedding app’s. A new value (not the same Arc) when they change.
Sourcepub fn mount_root(&mut self, root: &Root)
pub fn mount_root(&mut self, root: &Root)
Mounts a Rust app’s root component as the content of the root view; its view is made in the next commit.
Sourcepub fn mount_opened_windows(&mut self)
pub fn mount_opened_windows(&mut self)
Mounts what renders the windows open_window opens, beside the
app’s root (desktops): a Rust app’s (Self::mount_root) or a TSX
app’s, whose built-in windows (the update prompt) open the same way.
Sourcepub fn set_environment(&mut self, environment: Environment)
pub fn set_environment(&mut self, environment: Environment)
The environment components read (crate::element::window
and the like), as the platform reports it: what read a part that
changed runs again. dark is the system’s: the app’s
appearance wins over it (Core::set_appearance).
Sourcepub fn set_perf_monitor(&mut self, enabled: bool)
pub fn set_perf_monitor(&mut self, enabled: bool)
Whether the platform’s performance monitor measures
(fpsEnabled()): what read it runs again.
Sourcepub fn set_perf_stats(&mut self, stats: Option<PerfStats>)
pub fn set_perf_stats(&mut self, stats: Option<PerfStats>)
What the performance monitor measured last (perfStats(); None
while it does not measure): what read it runs again.
Sourcepub fn set_displays(&mut self, displays: Arc<[Display]>)
pub fn set_displays(&mut self, displays: Arc<[Display]>)
The displays components read (crate::element::desktop::displays),
as the platform reports them: what read them runs again.
Sourcepub fn discard_ops(&mut self, ops: impl IntoIterator<Item = Op>)
pub fn discard_ops(&mut self, ops: impl IntoIterator<Item = Op>)
Drops ops without applying them (the script was stopped): the
calls into Rust among them are not made, and the promises waiting
for them reject (their replies are in the next events); a JS call
parked behind one is dropped.
Sourcepub fn set_posts(&mut self, posts: Posts)
pub fn set_posts(&mut self, posts: Posts)
The queue of the JS calls Rust posts: the one the engine hands the script too.
Sourcepub fn set_task_notify(&mut self, notify: Arc<dyn Fn() + Send + Sync>)
pub fn set_task_notify(&mut self, notify: Arc<dyn Fn() + Send + Sync>)
Wakes the engine when a component’s task is woken (from any
thread): it then calls Self::run_component_tasks.
Sourcepub fn set_task_runtime(&mut self, runtime: Handle)
pub fn set_task_runtime(&mut self, runtime: Handle)
The tokio runtime the components’ tasks are polled in the context of (their timers, IO and background work run on it).
Sourcepub fn next_task_timer(&self) -> Option<Instant>
pub fn next_task_timer(&self) -> Option<Instant>
When the components’ soonest timer is due (crate::element::timer):
the engine wakes then and runs their tasks.
Sourcepub fn run_component_tasks(&mut self)
pub fn run_component_tasks(&mut self)
Runs the components’ woken tasks, with the state changes they ask for, until they all wait.
Sourcepub fn has_quit_listeners(&self) -> bool
pub fn has_quit_listeners(&self) -> bool
Whether something runs as the app quits (crate::element::desktop::on_app_quit,
Application.on("quit")): the engine gives it time to.
Sourcepub fn start_quit(&mut self) -> bool
pub fn start_quit(&mut self) -> bool
The app quits: starts each quit listener’s work, oldest first, as
tasks the engine runs (Core::run_component_tasks) until
Core::quit_pending is false or
QUIT_TIMEOUT has passed.
Whether any started.
Sourcepub fn quit_pending(&self) -> bool
pub fn quit_pending(&self) -> bool
Whether the work quit listeners started is still running.
Sourcepub fn async_calls_pending(&self) -> bool
pub fn async_calls_pending(&self) -> bool
Whether a JS call of an async fn into Rust (a native module’s, a
class’s) has not answered yet: its answer comes from elsewhere (a
request made in Rust, another thread), which nothing else counts.
Sourcepub fn component_event(
&mut self,
id: NodeId,
kind: EventKind,
payload: &EventPayload,
) -> bool
pub fn component_event( &mut self, id: NodeId, kind: EventKind, payload: &EventPayload, ) -> bool
A native event on node id: true when a component handled it (its
own parts’ events never reach JS, which does not know them).
Sourcepub fn set_url_schemes(
&mut self,
schemes: impl IntoIterator<Item = impl Into<String>>,
)
pub fn set_url_schemes( &mut self, schemes: impl IntoIterator<Item = impl Into<String>>, )
The schemes the app claims (nsh.json schemes,
crate::url_scheme), from the app’s own resources: the links the
platform reports of other schemes are dropped. None by default.
Core::set_app_links sets them with the app’s web links.
Sourcepub fn set_app_links(&mut self, links: AppLinks)
pub fn set_app_links(&mut self, links: AppLinks)
The links the app claims (nsh.json schemes and links,
crate::url_scheme::AppLinks), from the app’s own resources: the
links the platform reports that are none of them (another scheme, an
https link of another host or path) are dropped. None by default.
Sourcepub fn download_deadline(&self) -> Option<Instant>
pub fn download_deadline(&self) -> Option<Instant>
When the downloads’ next deadline is due (the engine wakes then).
Sourcepub fn animations_finished(&mut self, finished: &mut Vec<Finished>)
pub fn animations_finished(&mut self, finished: &mut Vec<Finished>)
Native animations that ended: the components’ resolve their
crate::element::AnimationEnds; JS’s stay in finished.
Sourcepub fn take_url_opens(&mut self, out: &mut Vec<(u32, String)>)
pub fn take_url_opens(&mut self, out: &mut Vec<(u32, String)>)
Moves the URLs the app asked to open (openUrl, crate::element::open_url)
since the last call to out, by request id, checked and granted
(crate::open_url). The engine asks the embedding app first, then
answers each with Core::answer_open_url (the embedding app took
it) or Core::open_url_on_platform.
Sourcepub fn answer_open_url(&mut self, id: u32, opened: bool)
pub fn answer_open_url(&mut self, id: u32, opened: bool)
Answers URL request id: whether the URL opened.
Sourcepub fn open_url_on_platform(&mut self, id: u32, url: String)
pub fn open_url_on_platform(&mut self, id: u32, url: String)
Hands URL request id to the platform, which opens url and
reports whether it did (crate::EventKind::OpenUrl on the root).
Sourcepub fn take_fetches(
&mut self,
start: &mut Vec<(u32, HttpRequest)>,
abandoned: &mut Vec<u32>,
)
pub fn take_fetches( &mut self, start: &mut Vec<(u32, HttpRequest)>, abandoned: &mut Vec<u32>, )
Moves the HTTP requests tasks made (ui::fetch) since the last call
to start, by request id: the engine makes them with its network
stack and reports what happens with Core::fetch_event. Requests
nothing waits for any more (their task ended) go to abandoned, for
the engine to cancel.
Sourcepub fn fetch_event(&mut self, id: u32, event: FetchEvent) -> bool
pub fn fetch_event(&mut self, id: u32, event: FetchEvent) -> bool
What happened to the tasks’ request id; false when nothing waits
for it any more (the task ended, or the request is over): the engine
then cancels it.
Sourcepub fn fetch_refused(&mut self, id: u32, message: String, url: String)
pub fn fetch_refused(&mut self, id: u32, message: String, url: String)
Fails the tasks’ request id, which the app’s capabilities do not
grant: url is the URL refused, the request’s or a redirect’s (the
engine checks every hop), message why. A task’s
fetch fails with the message; a module
function’s call rejects with ERR_ACCESS_DENIED, permission
"network" and resource the URL, as JS’s fetch does
(registerFont).
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
Sourcepub fn set_content_culling(&mut self, enabled: bool)
pub fn set_content_culling(&mut self, enabled: bool)
Whether scroll views mount their content as it comes near
(cull.rs, the default), or all of it as it is made: what a test
driver reads (nsh test’s steps reach every view of a page, as
they always did). Turned off, what is culled is made in the next
commit.
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
Sourcepub fn measure(&self, id: NodeId) -> Option<Measurement>
pub fn measure(&self, id: NodeId) -> Option<Measurement>
Where view id is, from the last layout; None when it is not in
the tree or was never laid out.
Sourcepub fn locate_caret(&self, id: NodeId, payload: &mut EventPayload)
pub fn locate_caret(&self, id: NodeId, payload: &mut EventPayload)
Completes an input’s onCaretMove payload from its platform: adds
pageBounds, its bounds (in the input) moved by where the input is
in its root view. The platforms know the caret in their text views,
the core where the input is (ref.measure()’s pagePosition, with
the scroll views around it).
Sourcepub fn locate_selection(&self, id: NodeId, payload: &mut EventPayload)
pub fn locate_selection(&self, id: NodeId, payload: &mut EventPayload)
Completes a selectable view’s onSelectionChange payload from its
platform: adds pageBounds, its bounds (the selected text in the
view) moved by where the view is in its root view, as
Self::locate_caret does for a caret. A payload without bounds
(nothing selected, an input’s selection) stays as it is.
Sourcepub fn list_scroll_position(&self, id: NodeId) -> Option<ListScrollPosition>
pub fn list_scroll_position(&self, id: NodeId) -> Option<ListScrollPosition>
Where list id’s viewport starts among its rows, from the last
layout; None when it is no list in the tree, is not laid out or
has no items.
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
A context menu asked for on id: a secondary click goes down as a
press does, so the shown overlays it is outside of hear
onPressOutside (a menu open elsewhere closes as a new one opens).
The platforms send no touch for a secondary click; a menu asked for
by the keyboard or an assistive technology is no press, nor is a
long press, whose touch went down already.
Returns those onPressOutside events (each overlay and its payload)
for the caller to hand out before onContextMenu itself, as a
press outside comes before what the press does: a context menu open
on the view closes before the view asks for one again, which then
opens where the pointer is.
Sourcepub fn presses_on_native(
&mut self,
id: NodeId,
page: Point<Points>,
) -> Vec<(NodeId, EventPayload)>
pub fn presses_on_native( &mut self, id: NodeId, page: Point<Points>, ) -> Vec<(NodeId, EventPayload)>
A press at page that went to view id’s hosted native content
(a web view’s page takes its presses, and the platform does not
pick them through the core): the shown overlays watching presses
that id is outside of hear onPressOutside, as for a press on
any other view.
Returns those events for the caller to hand out, as
Core::context_menu_presses_outside.
Sourcepub fn presses_beyond_root(
&mut self,
page: Point<Points>,
) -> Vec<(NodeId, EventPayload)>
pub fn presses_beyond_root( &mut self, page: Point<Points>, ) -> Vec<(NodeId, EventPayload)>
A press beyond the root view, at page in its coordinates: on what
is around the surface, where the platform draws the root view’s
anchored overlays too (the web page around the player’s container,
overlays: "viewport"). It misses every view, so each shown
overlay watching presses hears onPressOutside, as a press in the
root view outside it.
Returns those events (each overlay and its payload) for the caller
to hand out, as Core::context_menu_presses_outside.
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
Sourcepub fn begin_mount_turn(&mut self)
pub fn begin_mount_turn(&mut self)
A turn of the engine begins: the commits up to the next one share one budget of views. Without it, every commit is a turn.
Sourcepub fn hold_paced_mounts(&mut self)
pub fn hold_paced_mounts(&mut self)
This turn is not a display frame’s: waiting views out of sight stay
waiting, for the next frame’s turn (what shows is still made at
once). Call after Core::begin_mount_turn. Without it, every
turn makes a slice of what waits, and the turns between two frames
(a timer, a message from the main thread) each commit one more.
Sourcepub fn has_paced_mounts(&self) -> bool
pub fn has_paced_mounts(&self) -> bool
Whether views wait to be made in a later turn: ask the platform for a display frame, and commit in it.
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
Sourcepub fn wants_frame(&self) -> bool
pub fn wants_frame(&self) -> bool
Whether a component waits for a display frame: ask the platform for
one, then call Self::run_frame when it begins.
Sourcepub fn run_frame(&mut self, at: Instant)
pub fn run_frame(&mut self, at: Instant)
A display frame began at at: the tasks waiting for it go on (at
the next Self::run_component_tasks).
Source§impl<M: TextEngine + 'static> Core<M>
impl<M: TextEngine + 'static> Core<M>
Source§impl<M: TextEngine> Core<M>
impl<M: TextEngine> Core<M>
Sourcepub fn set_header_heights(&mut self, normal: Points, large: Points)
pub fn set_header_heights(&mut self, normal: Points, large: Points)
Sets the height of the platform’s screen header bar, normal and with a large title (status bar excluded).
Sourcepub fn set_safe_area(&mut self, insets: EdgeInsets)
pub fn set_safe_area(&mut self, insets: EdgeInsets)
Sets the surface’s safe-area insets.
Sourcepub fn set_overlay_area(&mut self, area: Option<Bounds<Points>>)
pub fn set_overlay_area(&mut self, area: Option<Bounds<Points>>)
Where the root view’s anchored overlays may be placed, in its
coordinates, when the platform shows them beyond the root view: the
web’s overlays: "viewport" draws them over the browser window, so
this is the window’s rectangle (less its safe area) relative to the
container. They are placed and flipped within it, less their
margin, rather than within the root view’s safe area. None (the
default) keeps them to the root view. Overlays without an anchor
and those of modals are laid out as before.
Sourcepub fn set_snap_to_window_margin(&mut self, margin: Points)
pub fn set_snap_to_window_margin(&mut self, margin: Points)
The distance the overlays without a margin of their own (menus,
popovers, tooltips, popups) keep from the edges of the window’s
safe area (crate::element::set_snap_to_window_margin): they are placed,
flipped and shrunk within it, so none touches the window’s edge.
Sourcepub fn set_root_size(
&mut self,
id: NodeId,
size: Size<Points>,
insets: EdgeInsets,
)
pub fn set_root_size( &mut self, id: NodeId, size: Size<Points>, insets: EdgeInsets, )
The platform presents root id (a modal) at size, with insets
of it covered by system UI.
Sourcepub fn set_screen_header(&mut self, id: NodeId, height: Option<Points>)
pub fn set_screen_header(&mut self, id: NodeId, height: Option<Points>)
The platform measured where the content of screen id starts below
the header it shows (None: estimate it from the bar’s height and
the safe area). Used for screens that lay their content out below
the header (not large titles or transparent headers).
Sourcepub fn set_font_scale(&mut self, scale: f32)
pub fn set_font_scale(&mut self, scale: f32)
Sets the user’s preferred text size (1.0 is the default): text that allows font scaling is laid out again.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of live nodes, including the root.
Sourcepub fn node_id_room(&self) -> usize
pub fn node_id_room(&self) -> usize
How many node ids the core’s id table has room for: far above
Self::node_count when the ids of nodes that are gone still take
room (diagnostics).
Sourcepub fn set_access(&mut self, access: Arc<Access>)
pub fn set_access(&mut self, access: Arc<Access>)
Sets what the app may reach: remote images, canvas images, video sources, web views and the status bar are checked against it.
Sourcepub fn set_base_url(&mut self, url: Option<Arc<str>>)
pub fn set_base_url(&mut self, url: Option<Arc<str>>)
Sets the URL media sources starting with // resolve against, whose
scheme they take (the page’s on the web, as fetch’s relative
URLs). Without one such a source names no URL, and only an app
without capabilities loads it (crate::access::Access::media_url).
A base marks a page: with one, /x and relative paths are the
page’s, not local files, so only pages set one.
Sourcepub fn set_media_files(&mut self, files: Arc<MediaFiles>)
pub fn set_media_files(&mut self, files: Arc<MediaFiles>)
Sets the capabilities.fs.read roots the app’s local media files
(absolute paths, file: URLs) are read under; without them such a
source of an app with capabilities loads nothing
(crate::access::Access::media_url).
Sourcepub fn set_image_context(&mut self, context: Context)
pub fn set_image_context(&mut self, context: Context)
Sets what the core’s own image loads (an crate::element::svg’s
bytes) go through: the app’s bundled files, access policy and disk
cache. Without it they read inline bytes, files and asset:/ URIs
of no base only.
Sourcepub fn set_clipboard(&mut self, backend: Option<Arc<dyn ClipboardBackend>>)
pub fn set_clipboard(&mut self, backend: Option<Arc<dyn ClipboardBackend>>)
Serves the app’s clipboard calls from backend instead of the
platform’s clipboard (None: the platform’s, the default).
Sourcepub fn set_picker(&mut self, backend: Option<Arc<dyn PickerBackend>>)
pub fn set_picker(&mut self, backend: Option<Arc<dyn PickerBackend>>)
Answers the app’s picks (Picker.pickImages) with backend, an
embedding app’s own picker or a test’s files, instead of showing the
platform’s picker (None: the platform’s, the default).
Sourcepub fn set_quit_mode(&mut self, mode: QuitMode)
pub fn set_quit_mode(&mut self, mode: QuitMode)
Sets an explicit quit mode when the app’s last window closes
(nsh.json application.quitMode, Application.setQuitMode).
Overrides the implicit main window’s default quit-on-close behavior.
Sourcepub fn set_main_window(&mut self, options: &MainWindowOptions)
pub fn set_main_window(&mut self, options: &MainWindowOptions)
The main window’s launch-time options (nsh.json "window"): its
attributes go to the main window with the next commit, as
currentWindow().set() sends them (capabilities apply); with
restoreBounds its placement is kept from then on as the platform
reports it (the environment’s window state), for the next launch
to open it there (crate::desktop::MainWindowOptions::kept_placement).
Set it after the environment (Core::set_environment): a surface
without a window, a phone’s, takes no attributes.
Sourcepub fn set_window_backend(&mut self, backend: Option<Arc<dyn WindowBackend>>)
pub fn set_window_backend(&mut self, backend: Option<Arc<dyn WindowBackend>>)
Opens and applies the app’s windows of its own with backend, an
embedding host’s windows or a test’s fake, instead of the platform
(None: the platform’s, the default). The main window’s commands
stay with the platform.
Sourcepub fn set_audio(&mut self, backend: Option<Arc<dyn AudioBackend>>)
pub fn set_audio(&mut self, backend: Option<Arc<dyn AudioBackend>>)
Plays the app’s sound (Sound, AudioPlayer) with backend, an
embedding app’s own audio stack or a test’s fake, instead of the
platform’s (None: the platform’s, the default).
Sourcepub fn set_login_item(&mut self, backend: Option<Arc<dyn LoginItemBackend>>)
pub fn set_login_item(&mut self, backend: Option<Arc<dyn LoginItemBackend>>)
Reads and changes the app’s login item (Application.launchAtLogin)
with backend: the platform’s, which a standalone app’s runner gives,
or a test’s fake. None (the default): the app has no login item,
it does not launch at login (crate::desktop::LoginItemBackend).
Sourcepub fn set_storage(&mut self, backend: Option<Arc<dyn StorageBackend>>)
pub fn set_storage(&mut self, backend: Option<Arc<dyn StorageBackend>>)
Keeps the app’s storage (nsh/storage) in backend; None: in
memory, for the core’s life.
Sourcepub fn set_data_dir(&mut self, dir: Option<PathBuf>)
pub fn set_data_dir(&mut self, dir: Option<PathBuf>)
The app’s own data directory, what crate::element::data_dir
gives; None: it has none.
Sourcepub fn set_app_info(&mut self, info: Option<AppInfo>)
pub fn set_app_info(&mut self, info: Option<AppInfo>)
The app as it was built, what crate::element::app_info answers
(a Rust app’s root’s, crate::element::Root::app_info); None:
the runner has none (a TSX app’s is JS’s appInfo()).
Sourcepub fn set_updater(&mut self, updater: Option<Arc<dyn UpdaterHost>>)
pub fn set_updater(&mut self, updater: Option<Arc<dyn UpdaterHost>>)
What Rust code checks for updates with
(crate::runtime::prompt_for_update); None: the app does not
update. A JS app’s VM gets its own (crate::element::System).
Sourcepub fn set_max_nodes(&mut self, max: usize)
pub fn set_max_nodes(&mut self, max: usize)
Caps the number of nodes (each may hold a native view, whose memory
no JS heap limit covers): creating more is a fatal ApplyError.
Sourcepub fn set_resizing(&mut self, resizing: bool)
pub fn set_resizing(&mut self, resizing: bool)
A burst of resizes began (true) or ended. Meanwhile only text near
the screen is measured and laid out at new widths: what is far from
it keeps its height, and catches up in the commit after the end. A
window’s drag gets its frames from what the user sees; a long page
has far more text than the screen shows.
Sourcepub fn set_viewport(&mut self, viewport: Size<Points>)
pub fn set_viewport(&mut self, viewport: Size<Points>)
Changes the size of the root view.
Sourcepub fn set_scroll_offset(
&mut self,
id: NodeId,
offset: Point<Points>,
applied: u32,
)
pub fn set_scroll_offset( &mut self, id: NodeId, offset: Point<Points>, applied: u32, )
The platform scrolled a scroll view or list to (x, y), having
applied applied of the scrolls the core issued to it
(MountItem::ScrollBy and Command::ScrollTo of lists).
Sourcepub fn key_scrolled(&mut self, id: NodeId, key_move: KeyMove)
pub fn key_scrolled(&mut self, id: NodeId, key_move: KeyMove)
The user moved scroll view id with scroll key move key_move, which
the platform animates to what it knows of the content. On a list of its
own End queues an animated scrollToEnd, in order with the app’s
scroll commands, so the list follows its end and rows below that
were never rendered, sized by their estimate, do not stop it short;
a repeat while the list follows its end changes nothing. Any other
key takes back an End not resolved yet and ends the target the list
followed, as the user scrolling away does. Lists in their parent’s
viewport and inverted lists are left to the platform.
Sourcepub fn set_kept(&mut self, nodes: &[NodeId])
pub fn set_kept(&mut self, nodes: &[NodeId])
Keeps the rows of virtual lists that hold nodes rendered, out of
the render window too, until the next call: the ends of a text
selection across a list’s rows, whose texts must outlive scrolling
away (a recycled cell would show another row). Replaces the last
call’s; none releases them. The rows holding the keyboard focus or
an open overlay are kept anyway (Core::sync_kept).
Sourcepub fn set_input_scroll(
&mut self,
id: NodeId,
offset: Point<Points>,
content: Size<Points>,
viewport: Size<Points>,
)
pub fn set_input_scroll( &mut self, id: NodeId, offset: Point<Points>, content: Size<Points>, viewport: Size<Points>, )
The platform scrolled the text of multiline input id to offset,
its text content large in a viewport (reported while a built-in
bar or a scroll watch follows it, InputConfig::report_scroll).
Sourcepub fn set_zoom(&mut self, id: NodeId, scale: f32)
pub fn set_zoom(&mut self, id: NodeId, scale: f32)
The platform zoomed scroll view id to scale.
Sourcepub fn set_component_size(&mut self, id: NodeId, size: Size<Points>)
pub fn set_component_size(&mut self, id: NodeId, size: Size<Points>)
A registered native component reported its own size: it is laid out at it where its style leaves a dimension open.
Sourcepub fn scroll_listener(
&self,
id: NodeId,
) -> Option<(f32, Size<Points>, Size<Points>, f32)>
pub fn scroll_listener( &self, id: NodeId, ) -> Option<(f32, Size<Points>, Size<Points>, f32)>
What onScroll reports for scroll view id, if it listens to it:
the minimum milliseconds between events, the content size (zoomed),
the viewport size and the zoom scale.
Sourcepub fn take_list_binds(&mut self, out: &mut Vec<ListBind>)
pub fn take_list_binds(&mut self, out: &mut Vec<ListBind>)
Moves list render requests produced by the last commit into out:
what must bind before the frame shows (cells whose item moved, cells
in the viewport and just ahead of it). The rest of the overscan
waits (Core::take_paced_list_binds).
Sourcepub fn has_paced_list_binds(&self) -> bool
pub fn has_paced_list_binds(&self) -> bool
Whether lists have overscan cells waiting to bind.
Sourcepub fn take_paced_list_binds(&mut self, cells: usize, out: &mut Vec<ListBind>)
pub fn take_paced_list_binds(&mut self, cells: usize, out: &mut Vec<ListBind>)
Hands out up to cells of the overscan cells waiting to bind, one
per list in turn (a nested list is not starved by its parent), each
list’s nearest its leading edge first. What a list assigns now is
what waits: cells it left or whose items went are never handed out.
Sourcepub fn has_events(&self) -> bool
pub fn has_events(&self) -> bool
Whether events wait for Core::take_events.
Sourcepub fn take_events(&mut self, out: &mut Vec<JsEvent>)
pub fn take_events(&mut self, out: &mut Vec<JsEvent>)
Moves what the core hands JS (events it raised, such as
onLoadMore and onLayout, Rust components’ events, calls’
results) into out, in order.
Sourcepub fn has_due_answers(&self) -> bool
pub fn has_due_answers(&self) -> bool
Whether the next commit runs closures that waited for the app’s
answer to events taken already (crate::element::after_answer):
the engine commits again rather than leave them for later input.
Sourcepub fn register_font(&mut self, data: &[u8]) -> Result<(), String>
pub fn register_font(&mut self, data: &[u8]) -> Result<(), String>
Registers a custom font (TrueType, OpenType, WOFF or WOFF2 data) with the text engine. Text measured before is measured again.
Sourcepub fn fonts_changed(&mut self)
pub fn fonts_changed(&mut self)
The text engine’s fonts changed (a font the platform loads asynchronously became usable): text measured before is measured again.
Sourcepub fn remount(&mut self)
pub fn remount(&mut self)
The platform’s views must get everything again, as new views do, and text is measured again: the unit the platform converted the values with changed (Android’s density). The views stay, scrolled where they are.
Sourcepub fn limit_paste(&self, id: NodeId, payload: &mut EventPayload)
pub fn limit_paste(&self, id: NodeId, payload: &mut EventPayload)
A paste into input id (onPaste): its files larger than the
input’s pasteMaxSize go to crate::PasteEvent::too_large,
whichever platform read them, so every platform gives the app the
same files.
Sourcepub fn input_changed(&mut self, id: NodeId, text: &str, count: u32)
pub fn input_changed(&mut self, id: NodeId, text: &str, count: u32)
The user edited input id (before JS sees the edit): keeps the text
for layout and for stale-value detection.
Sourcepub fn input_composing(&mut self, id: NodeId, shown: Option<&str>)
pub fn input_composing(&mut self, id: NodeId, shown: Option<&str>)
An input method composes in input id: shown is what the input
shows meanwhile (its text with the composition at the caret), None
once the composition ends. The input is measured with it, so it
grows as the composition wraps; its value and edit count stay as
they are (the platform reports the committed text as an edit).
Sourcepub fn content_height(&self) -> Option<Points>
pub fn content_height(&self) -> Option<Points>
The bottom edge of the logical root’s in-flow children, in surface points.
Read after Self::commit for settled geometry, from the same frames
reported to layout listeners. Detached layout roots (such as overlays
and modals) and fixed or absolutely positioned children do not contribute.
None means there is no laid-out in-flow content. This does not run an
intrinsic-size pass or change the viewport.
Sourcepub fn commit(&mut self) -> Option<MountBatch>
pub fn commit(&mut self) -> Option<MountBatch>
Finishes a turn: rebuilds text, runs layout, updates lists and
returns the mount items, or None when nothing changed.
Sourcepub fn set_tree_order_tracking(&mut self, enabled: bool)
pub fn set_tree_order_tracking(&mut self, enabled: bool)
Include logical document order in mount batches for a platform’s focus traversal.
Native sibling insertions describe paint order and can differ because of zIndex.
Sourcepub fn set_projected_state_mounting(&mut self, enabled: bool)
pub fn set_projected_state_mounting(&mut self, enabled: bool)
Mount the states views show as parts of a control
(MountItem::ProjectStates: a list’s highlighted option, the
code input’s next cell) for a platform that marks them itself, as
a terminal does: elsewhere the app’s classes alone show them. Set
before the first commit.