pub struct StandardTileProvider { /* private fields */ }Expand description
Standard tile provider with caching.
fetch_tile routes on the configured TileSource:
TileSource::Httpdelegates to the suppliedTileProtocol.TileSource::FileSystemreads tiles from disk via an internalFileSystemTileProtocol(the supplied protocol is not used).TileSource::Generatorcalls theTileGeneratorregistered withSelf::with_generator; if none is set, an honest typed error is returned rather than silently falling back to the supplied protocol.
Implementations§
Source§impl StandardTileProvider
impl StandardTileProvider
Sourcepub fn new(source: TileSource, protocol: Arc<dyn TileProtocol>) -> Self
pub fn new(source: TileSource, protocol: Arc<dyn TileProtocol>) -> Self
Create a new tile provider.
For TileSource::FileSystem the protocol argument is unused (disk
reads are handled internally); pass any protocol (e.g. a placeholder) or
prefer routing through the source directly. For TileSource::Generator
register a generator with Self::with_generator.
Sourcepub fn with_cache(self, cache: Arc<TileCache>) -> Self
pub fn with_cache(self, cache: Arc<TileCache>) -> Self
Enable caching.
Sourcepub fn with_generator(self, generator: Arc<dyn TileGenerator>) -> Self
pub fn with_generator(self, generator: Arc<dyn TileGenerator>) -> Self
Register an in-memory tile generator, used when the source is
TileSource::Generator.
Trait Implementations§
Source§impl TileProvider for StandardTileProvider
impl TileProvider for StandardTileProvider
Source§fn get_tile<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TileRequest,
) -> Pin<Box<dyn Future<Output = Result<TileResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_tile<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 TileRequest,
) -> Pin<Box<dyn Future<Output = Result<TileResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Get a tile.
Source§fn prefetch_tiles<'life0, 'async_trait>(
&'life0 self,
requests: Vec<TileRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TileResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn prefetch_tiles<'life0, 'async_trait>(
&'life0 self,
requests: Vec<TileRequest>,
) -> Pin<Box<dyn Future<Output = Result<Vec<TileResponse>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Prefetch multiple tiles.
Auto Trait Implementations§
impl !RefUnwindSafe for StandardTileProvider
impl !UnwindSafe for StandardTileProvider
impl Freeze for StandardTileProvider
impl Send for StandardTileProvider
impl Sync for StandardTileProvider
impl Unpin for StandardTileProvider
impl UnsafeUnpin for StandardTileProvider
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more