Skip to main content

TileCacheEntry

Enum TileCacheEntry 

Source
pub enum TileCacheEntry {
    Pending,
    Loaded(CachedTile),
    Expired(CachedTile),
    Reloading(CachedTile),
    Failed {
        error: String,
        stale: Option<CachedTile>,
    },
}
Expand description

State of a tile in the cache.

Variants§

§

Pending

A fetch has been issued but no renderable payload exists yet.

§

Loaded(CachedTile)

The tile is loaded and considered fresh.

§

Expired(CachedTile)

The tile payload is stale but still renderable while refresh is pending.

§

Reloading(CachedTile)

A refresh is in flight; the previous payload remains renderable.

§

Failed

The tile fetch failed. The optional cached tile remains renderable when the failure happened during refresh/revalidation.

Fields

§error: String

Human-readable error description.

§stale: Option<CachedTile>

Previously retained renderable payload, if any.

Implementations§

Source§

impl TileCacheEntry

Source

pub fn is_pending(&self) -> bool

Returns true if the entry is currently pending load.

Source

pub fn is_loaded(&self) -> bool

Returns true if the entry currently has a loaded or reloadable payload.

Source

pub fn is_expired(&self) -> bool

Returns true if the entry is in a stale-but-renderable expired state.

Source

pub fn is_reloading(&self) -> bool

Returns true if the entry is actively reloading while keeping old data.

Source

pub fn is_failed(&self) -> bool

Returns true if the entry is in a failed state.

Source

pub fn is_renderable(&self) -> bool

Returns true if this entry still has renderable tile data.

Source

pub fn data(&self) -> Option<&TileData>

Return the renderable tile payload, if any.

Source

pub fn cached_tile(&self) -> Option<&CachedTile>

Return the loaded payload, if any.

Source

pub fn freshness(&self) -> Option<&TileFreshness>

Return freshness metadata for renderable entries.

Source

pub fn loaded_at(&self) -> Option<SystemTime>

Return the wall-clock time when this entry was promoted to Loaded.

Returns None for entries that have no renderable payload.

Trait Implementations§

Source§

impl Debug for TileCacheEntry

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> 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.