Skip to main content

GeoJsonSourceDataHandle

Struct GeoJsonSourceDataHandle 

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

Owned handle for prepared GeoJSON source data.

Self::new parses one complete UTF-8 GeoJSON document and tiles or clusters it into the index a GeoJSON source consumes, which is the expensive part of a data update. It needs no runtime or map and runs on any thread, so a host prepares data on a worker thread and installs it on the map owner thread through crate::MapHandle::add_geojson_source_data or crate::MapHandle::set_geojson_source_data.

The options are baked into the prepared data and must match the options of every source the data is installed on. Installing borrows the handle, so one prepared value may be installed on any number of sources; dropping or closing it afterwards never invalidates a source, because sources keep their own reference.

Implementations§

Source§

impl GeoJsonSourceDataHandle

Source

pub fn new(data: &[u8], options: Option<&GeoJsonSourceOptions>) -> Result<Self>

Prepares GeoJSON source data. options may be None for defaults.

When options enable clustering, the data must be a feature collection whose every feature carries point geometry; anything else is rejected with an invalid-argument error naming the constraint.

Source

pub fn close(self)

Releases the prepared data. Sources it was installed on keep their own reference and stay valid. Dropping the handle releases it the same way.

Trait Implementations§

Source§

impl Debug for GeoJsonSourceDataHandle

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Drop for GeoJsonSourceDataHandle

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for GeoJsonSourceDataHandle

Source§

impl Sync for GeoJsonSourceDataHandle

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.