pub struct OfflineDatabase { /* private fields */ }Implementations§
Source§impl OfflineDatabase
impl OfflineDatabase
Sourcepub fn new(path: impl Into<String>) -> Self
pub fn new(path: impl Into<String>) -> Self
The database at path, which it creates or migrates to the current
schema. A database it can’t open, it opens again at its next use.
Sourcepub fn get(&mut self, resource: &Resource) -> Option<Response>
pub fn get(&mut self, resource: &Resource) -> Option<Response>
The stored copy of resource, if any.
Sourcepub fn put(&mut self, resource: &Resource, response: &Response) -> (bool, u64)
pub fn put(&mut self, resource: &Resource, response: &Response) -> (bool, u64)
put(const Resource&, const Response&): (inserted, stored size). The ambient cache doesn’t
keep a tile the tileset doesn’t have (Response::tile_not_found), since it would read back as
an empty tile.
Sourcepub fn invalidate_region(&mut self, region_id: i64) -> Result<(), DatabaseError>
pub fn invalidate_region(&mut self, region_id: i64) -> Result<(), DatabaseError>
Makes the region’s copies stale, so maps revalidate them when they
next use them and its next download refreshes them. See invalidate.
Sourcepub fn list_regions(&mut self) -> Result<OfflineRegions, DatabaseError>
pub fn list_regions(&mut self) -> Result<OfflineRegions, DatabaseError>
Every region whose definition can be read.
Sourcepub fn get_region(
&mut self,
region_id: i64,
) -> Result<Option<OfflineRegion>, DatabaseError>
pub fn get_region( &mut self, region_id: i64, ) -> Result<Option<OfflineRegion>, DatabaseError>
The region region_id, or None when the database has none.
Sourcepub fn create_region(
&mut self,
definition: &OfflineRegionDefinition,
metadata: &OfflineRegionMetadata,
) -> Result<OfflineRegion, DatabaseError>
pub fn create_region( &mut self, definition: &OfflineRegionDefinition, metadata: &OfflineRegionMetadata, ) -> Result<OfflineRegion, DatabaseError>
Creates a region without resources.
Sourcepub fn get_region_expiry(
&mut self,
region_id: i64,
) -> Result<OfflineRegionExpiry, DatabaseError>
pub fn get_region_expiry( &mut self, region_id: i64, ) -> Result<OfflineRegionExpiry, DatabaseError>
How long the region’s stored resources stay usable.
pub fn merge_database( &mut self, side_database_path: &str, ) -> Result<OfflineRegions, DatabaseError>
pub fn update_metadata( &mut self, region_id: i64, metadata: &OfflineRegionMetadata, ) -> Result<OfflineRegionMetadata, DatabaseError>
pub fn delete_region( &mut self, region: &OfflineRegion, ) -> Result<(), DatabaseError>
Sourcepub fn get_region_resource(
&mut self,
resource: &Resource,
) -> Option<(Response, u64)>
pub fn get_region_resource( &mut self, resource: &Resource, ) -> Option<(Response, u64)>
The stored copy of resource, with its stored size, whether or not
the ambient cache is enabled.
Sourcepub fn check_region_resource(
&mut self,
resource: &Resource,
) -> Option<(u64, Caching)>
pub fn check_region_resource( &mut self, resource: &Resource, ) -> Option<(u64, Caching)>
The stored size and caching rules of the copy of resource; None
without one, or for a copy without data.
pub fn put_region_resource( &mut self, region_id: i64, resource: &Resource, response: &Response, ) -> u64
pub fn put_region_resources( &mut self, region_id: i64, resources: &[(Resource, Response)], status: &mut OfflineRegionStatus, )
Sourcepub fn get_region_completed_status(
&mut self,
region_id: i64,
) -> Result<OfflineRegionStatus, DatabaseError>
pub fn get_region_completed_status( &mut self, region_id: i64, ) -> Result<OfflineRegionStatus, DatabaseError>
The number and size of the resources that the region holds, tiles included, and of its tiles.
pub fn mark_used_resources(&mut self, region_id: i64, resources: &[Resource])
Trait Implementations§
Source§impl Drop for OfflineDatabase
impl Drop for OfflineDatabase
Auto Trait Implementations§
impl !Freeze for OfflineDatabase
impl !RefUnwindSafe for OfflineDatabase
impl !Sync for OfflineDatabase
impl !UnwindSafe for OfflineDatabase
impl Forget for OfflineDatabase
impl Move for OfflineDatabase
impl Send for OfflineDatabase
impl Unpin for OfflineDatabase
impl UnsafeUnpin for OfflineDatabase
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
impl<T> ErasedDestructor for Twhere
T: 'static,
Source§impl<T> FmtForward for T
impl<T> FmtForward for T
Source§fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
fn fmt_binary(self) -> FmtBinary<Self>where
Self: Binary,
self to use its Binary implementation when Debug-formatted.Source§fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
fn fmt_display(self) -> FmtDisplay<Self>where
Self: Display,
self to use its Display implementation when
Debug-formatted.Source§fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
fn fmt_lower_exp(self) -> FmtLowerExp<Self>where
Self: LowerExp,
self to use its LowerExp implementation when
Debug-formatted.Source§fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
fn fmt_lower_hex(self) -> FmtLowerHex<Self>where
Self: LowerHex,
self to use its LowerHex implementation when
Debug-formatted.Source§fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
fn fmt_octal(self) -> FmtOctal<Self>where
Self: Octal,
self to use its Octal implementation when Debug-formatted.Source§fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
fn fmt_pointer(self) -> FmtPointer<Self>where
Self: Pointer,
self to use its Pointer implementation when
Debug-formatted.Source§fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
fn fmt_upper_exp(self) -> FmtUpperExp<Self>where
Self: UpperExp,
self to use its UpperExp implementation when
Debug-formatted.Source§fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
fn fmt_upper_hex(self) -> FmtUpperHex<Self>where
Self: UpperHex,
self to use its UpperHex implementation when
Debug-formatted.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pipe for Twhere
T: ?Sized,
impl<T> Pipe for Twhere
T: ?Sized,
Source§fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
fn pipe<R>(self, func: impl FnOnce(Self) -> R) -> Rwhere
Self: Sized,
Source§fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref<'a, R>(&'a self, func: impl FnOnce(&'a Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
fn pipe_ref_mut<'a, R>(&'a mut self, func: impl FnOnce(&'a mut Self) -> R) -> Rwhere
R: 'a,
self and passes that borrow into the pipe function. Read moreSource§fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
fn pipe_borrow<'a, B, R>(&'a self, func: impl FnOnce(&'a B) -> R) -> R
Source§fn pipe_borrow_mut<'a, B, R>(
&'a mut self,
func: impl FnOnce(&'a mut B) -> R,
) -> R
fn pipe_borrow_mut<'a, B, R>( &'a mut self, func: impl FnOnce(&'a mut B) -> R, ) -> R
Source§fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
fn pipe_as_ref<'a, U, R>(&'a self, func: impl FnOnce(&'a U) -> R) -> R
self, then passes self.as_ref() into the pipe function.Source§fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
fn pipe_as_mut<'a, U, R>(&'a mut self, func: impl FnOnce(&'a mut U) -> R) -> R
self, then passes self.as_mut() into the pipe
function.Source§fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
fn pipe_deref<'a, T, R>(&'a self, func: impl FnOnce(&'a T) -> R) -> R
self, then passes self.deref() into the pipe function.Source§impl<T> Tap for T
impl<T> Tap for T
Source§fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow<B>(self, func: impl FnOnce(&B)) -> Self
Borrow<B> of a value. Read moreSource§fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut<B>(self, func: impl FnOnce(&mut B)) -> Self
BorrowMut<B> of a value. Read moreSource§fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref<R>(self, func: impl FnOnce(&R)) -> Self
AsRef<R> view of a value. Read moreSource§fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut<R>(self, func: impl FnOnce(&mut R)) -> Self
AsMut<R> view of a value. Read moreSource§fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref<T>(self, func: impl FnOnce(&T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
fn tap_deref_mut<T>(self, func: impl FnOnce(&mut T)) -> Self
Deref::Target of a value. Read moreSource§fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
fn tap_dbg(self, func: impl FnOnce(&Self)) -> Self
.tap() only in debug builds, and is erased in release builds.Source§fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
fn tap_mut_dbg(self, func: impl FnOnce(&mut Self)) -> Self
.tap_mut() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
fn tap_borrow_dbg<B>(self, func: impl FnOnce(&B)) -> Self
.tap_borrow() only in debug builds, and is erased in release
builds.Source§fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
fn tap_borrow_mut_dbg<B>(self, func: impl FnOnce(&mut B)) -> Self
.tap_borrow_mut() only in debug builds, and is erased in release
builds.Source§fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
fn tap_ref_dbg<R>(self, func: impl FnOnce(&R)) -> Self
.tap_ref() only in debug builds, and is erased in release
builds.Source§fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
fn tap_ref_mut_dbg<R>(self, func: impl FnOnce(&mut R)) -> Self
.tap_ref_mut() only in debug builds, and is erased in release
builds.Source§fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
fn tap_deref_dbg<T>(self, func: impl FnOnce(&T)) -> Self
.tap_deref() only in debug builds, and is erased in release
builds.