mln-rs-runtime
Warning: this is an internal crate of mln-rs. It is published only because mln-rs depends on it, and its API can change in any release without notice. Depend on
mln-rsinstead: it re-exports this crate's types at its root.
Thread-safe handles over mln-rs's maps, which mirror mln-rs's C API (ffi/c)
one to one. A Runtime owns a thread, and the file sources, cache and offline
regions that its maps share. A Map handle sends commands to the map on that
thread: they run in the order they were sent, and each reports through a
Completion, which is a future, can be waited for, or calls back. A map
publishes a snapshot of its state after each command, which any thread reads
without waiting, and the events of a runtime and its maps reach one handler in
batches. A RenderSession that a map attaches renders the map's frames
offscreen or onto a window's surface: the host demands frames and drains their
results, reads offscreen pixels back, and queries the features drawn. A session
renders on a thread of its own, or on the host's graphics thread, which runs the
session's work through its DriverWork.
In the browser (wasm32-unknown-unknown, no threads), everything of a runtime
runs on the thread that made it, in short tasks on the browser's event loop
(mln_runtime::web's pump), and nothing waits: a command runs after the call
that sent it returns. Sessions present to a canvas with the browser's WebGPU or
WebGL2, one backend per build, and put their tiles' workers in Web Workers, as
examples/web does.
Part of mln-rs, a MapLibre map renderer written in Rust. All its crates are released together, at the same version.