Skip to content

Commit

Permalink
Move usage example to README an include it in module docs
Browse files Browse the repository at this point in the history
  • Loading branch information
pka committed Oct 24, 2024
1 parent 4586c4c commit ee0301b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,20 @@ originally created by Brandon Liu for Protomaps.

PRs welcome!

## Usage examples

### Writing a PMTiles file

```rust
use pmtiles::{PmTilesWriter, TileType};
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();
```

## Development
* This project is easier to develop with [just](https://github.com/casey/just#readme), a modern alternative to `make`. Install it with `cargo install just`.
* To get a list of available commands, run `just`.
Expand Down
17 changes: 1 addition & 16 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
//! 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();
//! ```
//!
#![cfg_attr(feature = "default", doc = include_str!("../README.md"))]
#![forbid(unsafe_code)]

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

0 comments on commit ee0301b

Please sign in to comment.