mod reader;
mod sink;
mod writer;
use anyhow::{Result, bail};
pub use reader::MBTilesReader;
pub use sink::MBTilesTileSink;
use versatiles_core::{TileCompression, TileFormat};
pub use writer::MBTilesWriter;
pub(crate) fn required_encoding(format: TileFormat) -> Result<(&'static str, TileCompression)> {
use TileCompression::{Gzip, Uncompressed};
use TileFormat::{JPG, MVT, PNG, WEBP};
Ok(match format {
JPG => ("jpg", Uncompressed),
MVT => ("pbf", Gzip),
PNG => ("png", Uncompressed),
WEBP => ("webp", Uncompressed),
other => bail!("MBTiles cannot store {other} tiles; it supports jpg, png, webp and pbf (mvt)"),
})
}