Expand description
Thread-safe handles over mln-rs’s maps, which mirror
the C API (mln-rs-c) one to one.
A Runtime owns a thread, and the file sources, cache and offline
regions of its maps. Each Map lives on its runtime’s thread, and its
handle sends commands there: they run in the order sent, across the
runtime and all its maps, and report through a Completion. A map
publishes a MapSnapshot after each command, which any thread reads
without waiting, and the events of the runtime and its maps reach one
handler in batches. A RenderSession that Map::attach creates
draws a map’s frames offscreen or onto a surface, on a thread of its own,
or on the host’s graphics thread through its DriverWork.
The synchronous, single-thread core that these handles drive is
mln_map’s; Map::with_core runs a closure on it.
Sessions render with the backends of the crate’s features: webgpu,
metal, vulkan and gl, each where its platform has it. A session’s
Device picks its backend.
In the browser (wasm32-unknown-unknown, without threads), a runtime’s
thread and its sessions’ are the one that made the runtime: their work
runs in short tasks on that thread’s event loop (mln_web_host‘s pump),
never inside the call that sent it, and nothing blocks. Sessions present
to a canvas (Surface::web_canvas) with the browser’s WebGPU or WebGL2,
and put their tiles’ workers in Web Workers.
Modules§
- registry
- The registrations that a runtime’s maps, their renderers and their tile workers share: the expression functions and the layer types.
Structs§
- Acquired
Frame - A frame of a borrowed ring that the host acquired, until it gives it
back. Dropping it gives it back as
releasewithSyncKind::CpuCompletedoes. - Applied
- What a map command left behind once it ran.
- Attach
Options - How a session attaches to its map.
- Borrowed
Ring - A ring of the host’s textures, of one backend.
- Camera
FitOptions - How a camera fits an area.
- Camera
FitUpdate - Moves the camera to fit an area:
CameraUpdate’s counterpart forMap::fit_camera. - Camera
Query - The camera, and the generation of the map that it belongs to.
- Command
Group - A command group of a map that ends when it drops.
- Completion
- The result of a command, which arrives once the command has run.
- Consumer
Sync - What the host’s reads of a frame’s texture end with, which a target
waits for before it draws into the texture again. The target takes the
sync file, or the
GLsyncthatsyncnames; dropping it closes the sync file. - Custom
Source Callbacks - The callbacks of a custom source, which run on a library thread. A map
asks for a tile with
fetch_tile, and answers come back through the source’s commands, such asMap::set_custom_geometry_source_tile_data.cancel_tilereports that the map no longer needs a tile. - Depth
Stencil Formats - A set of
DepthStencilFormats. - Device
Options - How to create a
Device. - DmaBuf
Format - A DRM format and modifier that the host imports.
- DmaBuf
Plane - Where one plane of a dmabuf keeps its data.
- Driver
Work - The graphics work of a render session that attached with
Driver::CallerThread, which runs only when the host’s graphics thread callsservice. - Error
- A failed call: its
ErrorKindand a message that says what failed. - Event
Mask - A set of event types. The bits are the C API’s
mln_runtime_event_flag:1 << typefor each type. - Export
Kinds - A set of
ExportKinds. - Exported
Ring - A ring of images that the target allocates, as the host asks for it:
depthimages, shared in a kind ofkinds. - Feature
State Selector - The features whose state to set, read or remove.
- Frame
Demand - A demand for one frame.
- Frame
Depth - The texture that holds a frame’s depth and stencil.
- Frame
Projection - Where a frame drew the map, and the depth its 3D layers wrote there.
- Frame
Result - How one frame demand finished.
- Frame
Texture - The host’s texture that an acquired frame was rendered into, of
sizepixels. - Frame
View - A view of an acquired frame, which
AcquiredFrame::viewopens, until it drops. - GeoJson
Source Options - The options of a GeoJSON source, which stay fixed for as long as the style holds it. The defaults are the style specification’s.
- GpuSync
- A point in one side’s GPU work that the other side waits for before it uses a shared texture: the object to wait on, as an integer, for the kinds that name one, and the value a timeline reaches.
- Layer
Info - A layer of the map’s style.
- Local
Target - A render target built on this thread: the backend that a renderer draws with, on the target’s device, and the frames it draws into.
- Logical
Extent - A size in logical pixels, and the physical pixels in each logical pixel.
- Map
- A handle to a map, which lives on its runtime’s thread.
- MapId
- The ID of a map, unique within its runtime.
- MapOptions
- How to create a map.
- MapSnapshot
- A map’s state at one moment.
- Offline
- The offline regions in a runtime’s cache database, from
Runtime::offline. Each call is a command of the runtime, and the regions download on the database’s thread. - Render
Session - A render session: a renderer that draws a map into a target, on a thread of its own or on the host’s.
- Render
Session Capabilities - What a render session can do.
- Render
Session Snapshot - The state of a render session at one moment.
- Rendered
Query Options - Options for query rendered features.
- Resource
Request - A network request that a
ResourceProviderserves. - Runtime
- A runtime: a thread of its own that holds maps, and the resource loading, cache and offline regions that they share.
- Runtime
Event - An event of a runtime or of one of its maps.
- Runtime
Options - Where a runtime keeps its assets and its cache, and the network status its requests follow.
- Source
Info - A source of the map’s style.
- Source
Query Options - Options for query source features
- Source
Tiles - The tiles that a source lists in the style itself, rather than at a URL.
- Surface
- What a surface session presents to.
- Sync
Kinds - A set of
SyncKinds. - Tile
Options - How the map picks the tiles to load, as its snapshot’s
TileSettingsreport it. A setting that isNonekeeps its value. - Viewport
Options - How the map orients and constrains its view. A setting that is
Nonekeeps its value.
Enums§
- Adapter
- A GPU, by what names it to a backend.
- Backend
Type - Cache
Database Operation - A maintenance action on a runtime’s cache database.
- Camera
FitArea - An area for a camera to fit in the map’s view.
- Canvas
Format - A
GPUTextureFormatthat a WebGPU canvas takes. - Clip
Depth Range - How a graphics API’s clip space holds depth.
- Demand
Mode - When a demand draws a frame.
- Depth
Stencil Format - A format of depth and stencil textures.
- Device
- A GPU that sessions on many maps and threads share: one backend’s device. Sessions on it keep working after the last handle drops, until they detach.
- Driver
- The thread that runs a render session’s graphics work.
- Error
Kind - What went wrong, as a caller would react to it.
- Event
Source - What raised an event.
- Event
Type - The type of an event. The values are the C API’s
mln_runtime_event_type. - Export
Kind - A way to share a texture’s memory with another API or process.
- Exported
Image - The shared memory of a frame’s image. The objects it names are the target’s, and stay valid until the host gives the frame back.
- Frame
Disposition - How a frame demand finished.
- Frame
Texture Kind - A
FrameTexture’s backend objects. - GlApi
- The OpenGL API that an OpenGL device renders with. By default the platform’s: desktop OpenGL on Windows, and OpenGL ES elsewhere.
- Native
Texture - A texture as the API of the device that drew into it names it.
- Render
Session State - Where a render session is in its life.
- Render
Target - What a render session renders into. The session builds it into the
backend’s objects on the thread that renders, on
device, or on a device thatDevice::newmakes when that isNone. The device’s backend is the session’s. - Rendered
Query Geometry - The screen area that a rendered feature query covers, in logical pixels from the top left corner.
- Runtime
Event Kind - What an event reports.
- Source
Kind - The kind of a style source.
- Surface
Overlay - What a host draws over each frame that a surface session presents, after
the map and before the frame is presented (and read back): the overlay
of the backend that the session presents with
(
DriverWork::set_overlay). - Surface
Type - A kind of window or layer that a session presents to.
- Sync
Kind - How one side of a shared texture waits for the other’s GPU work on it.
Traits§
- Resource
Provider - Serves a runtime’s network requests in place of the library.
Functions§
- is_
managed_ http_ header - Whether the library or the platform manages the HTTP header
name, in any letter case, so that a header transform can’t set it.
Type Aliases§
- Event
Handler - The runtime’s event handler. It runs on the runtime’s thread with each batch of events, oldest first.
- Feature
State - The state of one feature: keys and their values.
- Wake
- A callback that tells the host about something it should act on, such as frame results to drain. It runs on a library thread and must not block.