Skip to main content

Crate maplibre_native_ffi

Crate maplibre_native_ffi 

Source
Expand description

Safe Rust binding for the MapLibre Native C API.

This crate owns Rust-specific ergonomics and safety policy: thread-affine public handles, parent retention, owner-thread Drop, Rust errors, callback closure APIs, and lifetime-scoped render resources. Shared C ABI adaptation lives in maplibre-native-ffi-core.

Structs§

AnimationOptions
Optional animation controls for camera transitions.
BoundOptions
Optional map camera constraint fields.
ByteRange
Byte range requested for a network resource.
CameraFitOptions
Optional fitting controls for camera-for-viewport queries.
CameraOptions
Camera fields used for snapshots and camera commands.
CameraTransitionFinishedEvent
Camera transition-finished event payload.
CanonicalTileId
Canonical tile identity used by custom geometry source callbacks.
CustomGeometrySourceOptions
Options used when adding a custom geometry source.
DetachedRenderSessionHandle
Render session after backend resources have been detached.
EdgeInsets
Screen-space inset in logical map pixels.
EglContextDescriptor
Error
FeatureStateSelector
Source, feature, and state-key selector for render-session feature state.
FrameNativePointer
Borrowed opaque native address whose validity is tied to an active texture frame. It does not own, retain, dereference, or validate the pointed-to object.
FrameOpenGLTextureName
Borrowed OpenGL texture object name tied to an active texture frame.
FreeCameraOptions
Free camera position and orientation in MapLibre Native camera space.
GeoJsonSourceDataHandle
Owned handle for prepared GeoJSON source data.
GeoJsonSourceOptions
Options for GeoJSON sources. Fixed when the source is created; updating the source’s URL or data keeps the options it was added with.
HandleOperationError
Error returned by consuming one-shot handle operations when the handle remains live and the operation can be retried.
HttpHeader
One owned outgoing HTTP request header.
HttpHeaderTransformRequest
Copied request passed to an outgoing HTTP header transform callback.
ImageContent
Content-box insets in image pixels, measured from the image’s top-left.
ImageStretch
One stretchable interval along an image axis, in image pixels.
LatLng
Geographic coordinate in degrees.
LatLngBounds
Geographic bounds in degrees.
LogRecord
Copied MapLibre Native log record.
LogSeverityMask
Mask of log severities that MapLibre Native may dispatch asynchronously.
MapAttachRef
A reference to a map for the sole purpose of attaching a render session, produced by MapHandle::attach_ref. Attaching is the one map operation that runs on the render session’s thread instead of the map’s.
MapDebugOptions
MapLibre debug overlay mask bits.
MapHandle
Owner-thread map handle bound to a retained runtime.
MapId
Identity for a map owned by a runtime. The value is the map’s native handle, which names one map for the life of the process. It carries no ownership; map operations go through MapHandle.
MapOptions
Options used when creating a map.
MapProjectionHandle
Standalone projection snapshot created from a map transform.
MapTileOptions
Tile prefetch and LOD tuning controls.
MapViewportOptions
Live map viewport and render-transform controls.
MetalBorrowedTextureDescriptor
MetalContextDescriptor
MetalOwnedTextureDescriptor
MetalOwnedTextureFrame
Copied metadata for an acquired Metal session-owned texture frame.
MetalOwnedTextureFrameHandle
RAII guard for an acquired Metal session-owned texture frame.
MetalSurfaceDescriptor
NativeHandleLeak
A native handle a destructor attempted to destroy and could not. The handle stays live.
NativePointer
Borrowed opaque native address used for backend interop handles. It does not own, retain, dereference, or validate the pointed-to object, and passing it to MapLibre Native transfers no ownership.
OfflineOperationCompletedEvent
Offline operation-completion event payload.
OfflineOperationHandle
Owner-thread offline database operation token that must be taken or discarded.
OfflineRegionInfo
Offline region snapshot copied from native storage.
OfflineRegionResponseErrorEvent
Offline region response-error event payload.
OfflineRegionStatus
Offline region status copied from native event payloads.
OfflineRegionStatusEvent
Offline region status-change event payload.
OfflineRegionTileCountLimitEvent
Offline region tile-count-limit event payload.
OpenGLBorrowedTextureDescriptor
OpenGLContextProviderMask
OpenGL context providers compiled into the linked native library.
OpenGLOwnedTextureDescriptor
OpenGLOwnedTextureFrame
Copied metadata for an acquired OpenGL session-owned texture frame.
OpenGLOwnedTextureFrameHandle
RAII guard for an acquired OpenGL session-owned texture frame.
OpenGLSurfaceDescriptor
PremultipliedRgba8Image
ProjectedMeters
Lower-level Spherical Mercator projected-meter coordinate.
ProjectionMode
Axonometric rendering options for the live map render transform.
Quaternion
Quaternion stored as x, y, z, w components.
QueriedFeature
One copied feature query hit.
RenderBackendMask
Render backends compiled into the linked native library.
RenderFrameEvent
Render-frame event payload.
RenderMapEvent
Render-map event payload.
RenderSessionHandle
Render session handle bound to the thread that attached it.
RenderTargetExtent
RenderUpdate
Outcome of a successful RenderSessionHandle::render_update call.
RenderedFeatureQueryOptions
Options for rendered feature queries.
RenderingStats
Rendering statistics copied from a render-frame event payload.
ResourceRequest
Copied request passed to a runtime-scoped resource provider callback.
ResourceRequestHandle
Owned handle for a resource provider request selected for handling.
ResourceResponse
Response used to complete a handled resource request.
ResourceTransformRequest
Copied request passed to a runtime-scoped resource transform callback.
RuntimeEvent
Owned runtime event copied out of a drained batch.
RuntimeEventBatch
Batch of runtime events borrowed from runtime-owned storage.
RuntimeEventMask
Event types a map or a runtime queues.
RuntimeEventRef
One event of a RuntimeEventBatch, read from runtime-owned storage.
RuntimeHandle
Owner-thread runtime handle for MapLibre Native work and event draining.
RuntimeOptions
Options used when creating a runtime.
ScreenBox
Screen-space box in logical map pixels. Corners may be given in any order and may extend past the viewport; rendered queries normalize and clip them.
ScreenPoint
Screen-space point in logical map pixels.
SourceFeatureQueryOptions
Options for source feature queries.
SourceInfo
Copied retained metadata for one style source.
StyleImage
Copied runtime style image pixels with style-specific metadata.
StyleImageInfo
Copied fixed metadata for one runtime style image.
StyleImageOptions
Options for adding or replacing a runtime style image.
StyleTransitionOptions
The style’s global transition options, controlling how paint property changes animate and whether symbol placement changes cross-fade.
TextureImageInfo
TileActionEvent
Tile-action event payload. The event message carries the source ID.
TileId
Overscaled tile identity copied from a tile event payload.
TileJsonInfo
Copied fields from an inline TileJSON source description.
TileSourceOptions
Options for vector, raster, and raster DEM tile sources.
UnitBezier
Cubic easing curve for animated camera transitions.
UnknownRuntimeEventPayload
Payload of a type this version does not define, preserved for forward compatibility.
Vec3
Three-component vector used by free camera options.
VulkanBorrowedTextureDescriptor
VulkanContextDescriptor
VulkanOwnedTextureDescriptor
VulkanOwnedTextureFrame
Copied metadata for an acquired Vulkan session-owned texture frame.
VulkanOwnedTextureFrameHandle
RAII guard for an acquired Vulkan session-owned texture frame.
VulkanSurfaceDescriptor
WakeSource
Releases a runtime owner thread parked in RuntimeHandle::pump.
WebGlContextDescriptor
Browser WebGL context a session renders into.
WebGpuBorrowedTextureDescriptor
WebGpuContextDescriptor
Browser WebGPU device a session renders with.
WebGpuOwnedTextureDescriptor
WebGpuOwnedTextureFrame
Copied metadata for an acquired WebGPU session-owned texture frame.
WebGpuOwnedTextureFrameHandle
RAII guard for an acquired WebGPU session-owned texture frame.
WebGpuSurfaceDescriptor
WebGPU native surface session attachment options.
WglContextDescriptor

Enums§

AmbientCacheOperation
Ambient cache maintenance operation for a runtime.
BoundsConstraint
Geographic constraint applied to the map camera center.
CameraChangeMode
Camera change kind carried in the code of camera will-change and did-change events. Decode it with CameraChangeMode::from_raw(event.code as u32).
ConstrainMode
Map constraint modes used by viewport options.
ErrorKind
LocationIndicatorImageKind
Image-name property slots for location indicator layers.
LogEvent
Category for a MapLibre Native log record.
LogSeverity
Severity for a MapLibre Native log record.
MapMode
Map rendering mode used when creating a map.
NetworkStatus
Process-global network reachability state used by MapLibre Native.
NorthOrientation
Map north orientation values used by viewport options.
OfflineOperationKind
Offline database operation kind reported by completion events.
OfflineOperationResultKind
Offline database operation result kind reported by completion events.
OfflineOperationTakeError
Error returned by offline operation result transfers.
OfflineRegionDefinition
Region descriptor used to create or inspect offline regions.
OfflineRegionDownloadState
Offline region download state copied from event payloads.
OpenGLClientApi
OpenGL client API a dedicated EGL session creates its context for.
OpenGLContextDescriptor
OpenGL platform context a render session draws through.
OpenGLContextOwnership
How a session’s OpenGL context relates to the thread that attached it.
RasterDemEncoding
DEM raster encoding for raster DEM style sources.
RenderMode
Render mode reported by render observer events.
RenderResult
Outcome of a successful render-update call.
RenderedQueryGeometry
Screen-space geometry used for rendered feature queries.
ResourceErrorReason
Resource error reason copied from event payloads and used in resource responses.
ResourceKind
Network resource kind passed to resource callbacks.
ResourceLoadingMethod
Resource loading method requested by MapLibre Native.
ResourcePriority
Resource request priority.
ResourceProviderDecision
Decision returned by a resource provider callback.
ResourceResponseStatus
Status for a resource provider response.
ResourceStoragePolicy
Resource cache storage policy.
ResourceUsage
Resource request usage.
RuntimeEventPayload
Event payload decoded from the payload union that every event carries.
RuntimeEventSource
Source object that emitted a runtime event.
RuntimeEventType
Runtime event type.
SourceType
Style source type values returned by native style source metadata.
StyleImageTextFit
How a stretchable style image fits text along one axis.
StyleLayerVisibility
Whether a style layer draws.
TileLodMode
Tile LOD algorithms used by map tile options.
TileOperation
Tile operation reported by tile observer events.
TileScheme
Tile URL coordinate scheme for vector, raster, and raster DEM sources.
VectorTileEncoding
Vector tile encoding for vector style sources.
ViewportMode
Viewport orientation modes used by viewport options.

Functions§

c_version
Returns the native C ABI contract version.
clear_log_callback
Clears the process-global MapLibre Native log callback.
lat_lng_for_projected_meters
Converts Spherical Mercator projected meters to a geographic coordinate.
network_status
Reads MapLibre Native’s process-global network status.
projected_meters_for_lat_lng
Converts a geographic coordinate to Spherical Mercator projected meters.
set_async_log_severity_mask
Configures severities that MapLibre Native may dispatch asynchronously.
set_leak_reporter
Installs the process-wide reporter for handles a destructor could not destroy, replacing any previous one, and returns whether one was installed. Explicit close reports the same failure through the normal error path.
set_log_callback
Installs or replaces the process-global MapLibre Native log callback.
set_network_status
Sets MapLibre Native’s process-global network status.
supported_opengl_context_providers
Returns the OpenGL context providers compiled into the linked native library.
supported_render_backends
Returns the render backends compiled into the linked native library.

Type Aliases§

Result