pub trait OutputFormat: Send {
// Required methods
fn name(&self) -> &str;
fn write_tile(
&mut self,
tile: TileCoord,
data: &[u8],
) -> Result<(), GeolithError>;
fn finalize(&mut self, metadata: &Value) -> Result<(), GeolithError>;
}Expand description
Trait for writing encoded tiles to an output archive.
Implementations include PmtilesOutput (PMTiles v3) and
MbtilesOutput (MBTiles SQLite, added in Task 6).
§Thread Safety
Implementations must be Send to allow the writer to be moved across
thread boundaries. Sync is not required — tile writing is single-threaded.
Required Methods§
Sourcefn write_tile(
&mut self,
tile: TileCoord,
data: &[u8],
) -> Result<(), GeolithError>
fn write_tile( &mut self, tile: TileCoord, data: &[u8], ) -> Result<(), GeolithError>
Writes a single encoded tile.
tile identifies the tile coordinate. data is the encoded tile
content (typically gzip-compressed MVT bytes).
§Errors
Returns an error if the write fails (I/O error, database error, etc.).
Sourcefn finalize(&mut self, metadata: &Value) -> Result<(), GeolithError>
fn finalize(&mut self, metadata: &Value) -> Result<(), GeolithError>
Finalizes the output archive.
Called once after all tiles have been written. Implementations should flush buffers, write headers/footers, and close file handles.
metadata is a JSON value containing archive metadata (name, bounds,
minzoom, maxzoom, etc.).
§Errors
Returns an error if finalization fails.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".