Skip to content

Commit

Permalink
Rename finish to finalize
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Oct 24, 2024
1 parent ee0301b commit 21e66ba
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ use std::fs::File;
let file = File::create("tiles.pmtiles").unwrap();
let mut writer = PmTilesWriter::new(TileType::Mvt).create(file).unwrap();
writer.add_tile(0, &[/*...*/]).unwrap();
writer.finish().unwrap();
writer.finalize().unwrap();
```

## Development
Expand Down
6 changes: 3 additions & 3 deletions src/writer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ impl<W: Write + Seek> PmTilesStreamWriter<W> {
}

/// Finish writing the `PMTiles` file.
pub fn finish(mut self) -> PmtResult<()> {
pub fn finalize(mut self) -> PmtResult<()> {
if let Some(last) = self.entries.last() {
self.header.data_length = last.offset + u64::from(last.length);
self.header.leaf_offset = self.header.data_offset + self.header.data_length;
Expand Down Expand Up @@ -401,7 +401,7 @@ mod tests {
let tile = tiles_in.get_tile_by_id(id).await.unwrap().unwrap();
writer.add_tile(id, &tile).unwrap();
}
writer.finish().unwrap();
writer.finalize().unwrap();

let backend = MmapBackend::try_from(&fname).await.unwrap();
let tiles_out = AsyncPmTilesReader::try_from_source(backend).await.unwrap();
Expand Down Expand Up @@ -487,6 +487,6 @@ mod tests {
assert!(writer.header.clustered);
writer.add_tile(2, &[0, 1, 2, 3]).unwrap();
assert!(!writer.header.clustered);
writer.finish().unwrap();
writer.finalize().unwrap();
}
}

0 comments on commit 21e66ba

Please sign in to comment.