Skip to content

Commit

Permalink
Add usage example
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Oct 23, 2024
1 parent 9e10fd8 commit de00949
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ originally created by Brandon Liu for Protomaps.
- Async `mmap` (Tokio) for local files
- Async `http` and `https` (Reqwuest + Tokio) for URLs
- Async `s3` (Rust-S3 + Tokio) for S3-compatible buckets
- Creating PMTile archives

## Plans & TODOs

- [ ] Documentation and example code
- [ ] Support writing and conversion to and from MBTiles + `x/y/z`
- [ ] Support conversion to and from MBTiles + `x/y/z`
- [ ] Support additional backends (sync `mmap` and `http` at least)
- [ ] Support additional async styles (e.g., `async-std`)

Expand Down
16 changes: 16 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
//! Read and write `PMTiles` according to the [PMTiles v3 spec](https://github.com/protomaps/PMTiles/blob/master/spec/v3/spec.md).
//!
//! ## Writing a `PMTiles` file
//!
//! ```rust
//! use pmtiles::{PmTilesWriter, TileType};
//! use std::fs::File;
//!
//! # let tile_0_0_0 = vec![];
//! let file = File::create("tiles.pmtiles").unwrap();
//! let mut writer = PmTilesWriter::new(TileType::Mvt).create(file).unwrap();
//! writer.add_tile(0, &tile_0_0_0).unwrap();
//! writer.finish().unwrap();
//! ```
//!
#![forbid(unsafe_code)]

#[cfg(feature = "__async")]
Expand Down

0 comments on commit de00949

Please sign in to comment.