Skip to main content

RenderSessionHandle

Struct RenderSessionHandle 

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

Owner-thread render session handle bound to a retained map.

Implementations§

Source§

impl RenderSessionHandle

Source

pub fn set_feature_state( &self, selector: &FeatureStateSelector, state: &JsonValue, ) -> Result<()>

Sets per-feature state on a render source for this session.

Source

pub fn get_feature_state( &self, selector: &FeatureStateSelector, ) -> Result<JsonValue>

Copies per-feature state from a render source in this session.

Source

pub fn remove_feature_state( &self, selector: &FeatureStateSelector, ) -> Result<()>

Removes per-feature state selected for this session.

Source

pub fn query_rendered_features( &self, geometry: &RenderedQueryGeometry, options: Option<&RenderedFeatureQueryOptions>, ) -> Result<Vec<QueriedFeature>>

Queries rendered features from the latest render session state.

Source

pub fn query_source_features( &self, source_id: &str, options: Option<&SourceFeatureQueryOptions>, ) -> Result<Vec<QueriedFeature>>

Queries source features from the latest render session state.

Source

pub fn query_feature_extension( &self, source_id: &str, feature: &Feature, extension: &str, extension_field: &str, arguments: Option<&JsonValue>, ) -> Result<FeatureExtensionResult>

Queries a feature extension from the latest render session state.

The supercluster extension reads the cluster_id feature property and the limit and offset arguments as JsonValue::UInt. Other numeric types are treated as absent: a cluster_id that is not JsonValue::UInt returns FeatureExtensionResult::Value holding JsonValue::Null instead of a feature collection, and a limit or offset that is not JsonValue::UInt leaves leaves at the native defaults of ten leaves at offset zero. Queried feature properties keep their JSON value type, so a queried cluster feature can be passed back unmodified.

Source§

impl RenderSessionHandle

Source

pub fn close(self) -> Result<(), HandleOperationError<Self>>

Explicitly destroys the render session.

Native destruction errors are returned. When destruction fails, the underlying native handle remains live so a later close can retry.

Source

pub fn resize(&self, width: u32, height: u32, scale_factor: f64) -> Result<()>

Resizes this attached render session.

Surface and owned-texture sessions resize in place. Borrowed texture targets are sized by their owner and report an unsupported-feature error: close this session, recreate the texture, and attach a new session. A map holds at most one attached session, so close before attaching the replacement.

Resizing discards the session renderer, so renderer-held state such as feature state does not survive. Map state such as camera, style, and sources lives on the map and survives both resize and reattach.

Source

pub fn render_update(&self) -> Result<bool>

Processes the latest map render update for this render target.

The map retains its latest update, so repeated calls re-render it and return true again; use this to redraw on demand after resize or surface expose, and gate frame loops on render-update-available events instead of the return value. Returns false when no frame was rendered, because the map has not published an update yet or the renderer skipped the frame; both are normal during startup, so keep pumping the runtime until an update is reported.

Source

pub fn detach( self, ) -> Result<DetachedRenderSessionHandle, HandleOperationError<Self>>

Detaches backend-bound render resources from the map.

The native session remains live only for destruction, so successful detach consumes this handle and returns a detached close-only handle.

Detach also releases this session’s retention of the parent map, so a detached session leaves the map free to close. Close the detached session whenever it suits the host; it stays destroyable after the map closes because a detached session no longer reaches its map.

Source

pub fn reduce_memory_use(&self) -> Result<()>

Asks the session renderer to release cached resources where possible.

Source

pub fn clear_data(&self) -> Result<()>

Clears renderer data for the session.

Source

pub fn dump_debug_logs(&self) -> Result<()>

Dumps renderer debug logs through MapLibre Native logging.

Source

pub fn texture_image_info(&self) -> Result<TextureImageInfo>

Returns CPU readback metadata for the most recently rendered texture frame.

Source

pub fn read_premultiplied_rgba8_into( &self, data: &mut [u8], ) -> Result<TextureImageInfo>

Reads the most recently rendered texture frame as premultiplied RGBA8.

Source

pub fn acquire_metal_owned_texture_frame( &self, ) -> Result<MetalOwnedTextureFrameHandle>

Acquires a borrowed Metal frame from a session-owned texture target.

Source

pub fn acquire_vulkan_owned_texture_frame( &self, ) -> Result<VulkanOwnedTextureFrameHandle>

Acquires a borrowed Vulkan frame from a session-owned texture target.

Source

pub fn acquire_opengl_owned_texture_frame( &self, ) -> Result<OpenGLOwnedTextureFrameHandle>

Acquires a borrowed OpenGL frame from a session-owned texture target.

Trait Implementations§

Source§

impl Debug for RenderSessionHandle

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.