Skip to content

Commit

Permalink
update README
Browse files Browse the repository at this point in the history
  • Loading branch information
ringsaturn committed Jun 10, 2023
1 parent 307b425 commit 759fb33
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 9 deletions.
9 changes: 5 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ version = "0.4.1"
anyhow = "1"
bytes = "1"
clap = {version = "4.3.3", features = ["color", "help", "usage", "derive"], optional = true}
lazy_static = "1.4.0"
prost = "0.11"
rand = "0.8.5"

Expand All @@ -26,12 +25,14 @@ tzf-rel = "0.0.2023-b"
# geometry-rs = { git = "http://github.com/ringsaturn/geometry-rs", tag = "v0.1.0"}
geometry-rs = "0.1.2"

# cities-json = { git = "https://github.com/ringsaturn/go-cities.json", rev = "38a818ded6dcd1759e4633a36502b693c8b14858" }
cities-json = "0.3.8"

[dev-dependencies]
lazy_static = "1.4.0"

criterion = {version = "0.5", features = ["html_reports"]}

# cities-json = { git = "https://github.com/ringsaturn/go-cities.json", rev = "38a818ded6dcd1759e4633a36502b693c8b14858" }
cities-json = "0.3.8"

[features]
default = ["clap"]

Expand Down
34 changes: 29 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,42 @@

## Build options

By default, the binary is built as well. If you don't want/need it, then build like this:
By default, the binary is built as well. If you don't want/need it, then build
like this:

```bash
> cargo build --no-default-features
cargo build --no-default-features
```

Or put in your `Cargo.toml` file:
Or add in the below way:

```toml
tzf-rs = { version = "0.4.1", default-features = false }
```bash
cargo add tzf-rs --no-default-features
```

## Best practice

It's expensive to init tzf-rs's Finder/FuzzyFinder/DefaultFinder, please
consider reuse it or as a global var. Below is a global var example:

```rust
use lazy_static::lazy_static;
use tzf_rs::DefaultFinder;

lazy_static! {
static ref FINDER: DefaultFinder = DefaultFinder::new();
}

fn main() {
print!("{:?}\n", FINDER.get_tz_name(116.3883, 39.9289));
print!("{:?}\n", FINDER.get_tz_names(116.3883, 39.9289));
}
```

For reuse it,
[`racemap/rust-tz-service`](https://github.com/racemap/rust-tz-service) is a
good example.

## Bindings

- Ruby, see [tzf-rb](https://github.com/HarlemSquirrel/tzf-rb)
Expand Down

0 comments on commit 759fb33

Please sign in to comment.