Skip to main content

HttpVectorTileSource

Struct HttpVectorTileSource 

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

A TileSource that fetches and decodes Mapbox Vector Tiles (PBF) over HTTP.

See the module-level documentation for the full pipeline description.

Implementations§

Source§

impl HttpVectorTileSource

Source

pub fn new(url_template: impl Into<String>, client: Box<dyn HttpClient>) -> Self

Create a new HTTP vector tile source.

The URL template should produce PBF/MVT binary responses, e.g. "https://demotiles.maplibre.org/tiles/{z}/{x}/{y}.pbf".

Source

pub fn with_deferred_decode(self, deferred: bool) -> Self

Enable deferred decoding mode.

When enabled, poll returns TileData::RawVector payloads carrying the raw PBF bytes instead of performing the MVT decode inline. The caller is responsible for submitting the decode work to a background thread and promoting the tile cache entry once complete.

Source

pub fn deferred_decode(&self) -> bool

Whether deferred decoding is enabled.

Source

pub fn with_tilejson(self, tilejson: TileJson) -> Self

Attach TileJSON metadata to configure source zoom range and bounds filtering.

Source

pub fn with_decode_options(self, options: MvtDecodeOptions) -> Self

Set MVT decode options (e.g. layer filter).

Source

pub fn with_header( self, name: impl Into<String>, value: impl Into<String>, ) -> Self

Add a default header sent with every tile request.

Source

pub fn tile_url(&self, id: &TileId) -> String

Expand the URL template for a given tile ID.

Source

pub fn url_template(&self) -> &str

The URL template this source was constructed with.

Source

pub fn pending_count(&self) -> usize

The number of requests currently in flight.

Source

pub fn tilejson(&self) -> Option<&TileJson>

Reference to the attached TileJSON metadata, if any.

Trait Implementations§

Source§

impl Debug for HttpVectorTileSource

Source§

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

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

impl TileSource for HttpVectorTileSource

Source§

fn request(&self, id: TileId)

Start fetching a tile. Returns immediately. Read more
Source§

fn request_revalidate(&self, id: TileId, hint: RevalidationHint)

Start a conditional revalidation fetch for a stale tile. Read more
Source§

fn poll(&self) -> Vec<(TileId, Result<TileResponse, TileError>)>

Poll for completed tile fetches. Read more
Source§

fn cancel(&self, id: TileId)

Cancel a previously requested tile fetch. Read more
Source§

fn request_many(&self, ids: &[TileId])

Start fetching multiple tiles. Read more
Source§

fn request_revalidate_many(&self, ids: &[(TileId, RevalidationHint)])

Start conditional revalidation for multiple tiles. Read more
Source§

fn cancel_many(&self, ids: &[TileId])

Cancel multiple previously requested tile fetches. Read more
Source§

fn diagnostics(&self) -> Option<TileSourceDiagnostics>

Optional runtime diagnostics about the source fetch pipeline.

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.