pub struct FileTileCache { /* private fields */ }Expand description
Stores tiles in a slippy-map directory tree on disk
({root}/{z}/{x}/{y}.{ext}). Compatible with every common tile
bundle layout (the OSM standard, MapTiler exports, Mapbox tile
downloads). The bundled sample-tiles/ is one of these.
Implementations§
Trait Implementations§
Source§impl TileCache for FileTileCache
impl TileCache for FileTileCache
Source§fn get(&self, key: TileKey) -> Option<Image>
fn get(&self, key: TileKey) -> Option<Image>
Look up the cached tile, decoded as a
slint::Image. Returns
None if the tile isn’t cached (or if its bytes failed to
decode). Implementations should be cheap on the miss path.Source§fn put(&self, key: TileKey, bytes: &[u8]) -> Result<(), CacheError>
fn put(&self, key: TileKey, bytes: &[u8]) -> Result<(), CacheError>
Store raw bytes (typically a PNG payload exactly as the source
served it — the cache is encoding-agnostic). Errors here are
returned but a fetching source will typically just log and
keep going.
Source§fn contains(&self, key: TileKey) -> bool
fn contains(&self, key: TileKey) -> bool
Quick existence check that avoids the decode cost of
get.
Default implementation falls back to get(key).is_some() —
override on backends where existence is cheaper to test.Source§fn get_bytes(&self, key: TileKey) -> Option<Vec<u8>>
fn get_bytes(&self, key: TileKey) -> Option<Vec<u8>>
Read the raw bytes for a tile, if cached. Used by sources that
want to do their own (off-UI-thread) decoding rather than the
in-thread decode that
get performs. Default returns None —
backends that store raw bytes (FileTileCache) should override.Auto Trait Implementations§
impl Freeze for FileTileCache
impl RefUnwindSafe for FileTileCache
impl Send for FileTileCache
impl Sync for FileTileCache
impl Unpin for FileTileCache
impl UnsafeUnpin for FileTileCache
impl UnwindSafe for FileTileCache
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