Skip to main content

VectorTileSource

Struct VectorTileSource 

Source
pub struct VectorTileSource {
    pub data: FeatureCollection,
    pub source_layers: HashMap<String, FeatureCollection>,
    pub factory: Option<VectorTileSourceFactory>,
    pub cache_capacity: usize,
    pub selection: TileSelectionConfig,
}
Expand description

Vector-tile-like feature source.

Fields§

§data: FeatureCollection

Flattened features exposed by the source.

This remains for backward compatibility with earlier runtime code that treated vector sources as one resolved feature collection.

§source_layers: HashMap<String, FeatureCollection>

Optional source-layer partitioning for style/runtime resolution.

When present, vector style layers may select a specific source layer via their source_layer field, mirroring MapLibre’s source-layer behavior. When absent, the flattened data collection is used.

§factory: Option<VectorTileSourceFactory>

Optional streamed tile source factory.

When present, the style/runtime path builds a source-owned hidden tile manager that fetches binary vector tiles at runtime. The in-memory data and source_layers remain available for tests, fallbacks, and backward-compatible resolved-feature workflows.

§cache_capacity: usize

Maximum tile-cache capacity for the streamed vector source runtime.

§selection: TileSelectionConfig

Tile-selection policy for the streamed vector source runtime.

Implementations§

Source§

impl VectorTileSource

Source

pub fn new(data: FeatureCollection) -> Self

Create a new vector-tile-like source from resolved features.

Source

pub fn streamed( factory: impl Fn() -> Box<dyn TileSource> + Send + Sync + 'static, ) -> Self

Create a new streamed vector tile source from a tile-source factory.

Source

pub fn from_source_layers( source_layers: HashMap<String, FeatureCollection>, ) -> Self

Create a new vector-tile-like source from named source-layer feature sets.

Source

pub fn with_source_layer( self, name: impl Into<String>, data: FeatureCollection, ) -> Self

Attach a named source layer to this source.

Source

pub fn source_layer(&self, name: &str) -> Option<&FeatureCollection>

Borrow a named source layer if present.

Source

pub fn has_source_layers(&self) -> bool

Return true if this source has explicit source-layer partitioning.

Source

pub fn is_streamed(&self) -> bool

Return true if this source should fetch vector tiles at runtime.

Source

pub fn with_cache_capacity(self, cache_capacity: usize) -> Self

Set streamed tile cache capacity.

Source

pub fn with_selection(self, selection: TileSelectionConfig) -> Self

Set streamed tile-selection policy.

Source

pub fn make_tile_source(&self) -> Option<Box<dyn TileSource>>

Build a fresh runtime tile source if this vector source is streamed.

Trait Implementations§

Source§

impl Clone for VectorTileSource

Source§

fn clone(&self) -> VectorTileSource

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for VectorTileSource

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.