Skip to content

Commit 7afbb8a

Browse files
committed
Make geo-types and geojson optional
1 parent 1d2638a commit 7afbb8a

File tree

3 files changed

+30
-11
lines changed

3 files changed

+30
-11
lines changed

Cargo.toml

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
11
[package]
22
name = "sfcgal"
3-
version = "0.8.1"
3+
version = "0.8.2"
4+
edition = "2021"
5+
46
authors = ["Matthieu Viry <[email protected]>"]
57
license = "MIT/Apache-2.0"
6-
edition = "2021"
78
description = """
89
High-level bindings to SFCGAL and conversion from/to other geometry libraries.
910
"""
11+
1012
readme = "README.md"
1113
homepage = "https://github.com/mthh/sfcgal-rs"
1214
repository = "https://github.com/mthh/sfcgal-rs"
15+
documentation = "https://mthh.github.io/sfcgal-rs/sfcgal/"
16+
1317
keywords = ["geometry", "geospatial", "gis", "sfcgal"]
1418
categories = ["algorithms", "api-bindings"]
15-
documentation = "https://mthh.github.io/sfcgal-rs/sfcgal/"
1619

1720
[dependencies]
1821
sfcgal-sys = "0.8.0"
1922
anyhow = "1.0"
2023
libc = "0.2"
21-
geo-types = "0.7"
22-
enum-primitive-derive = "0.3"
2324
num-traits = "0.2"
25+
enum-primitive-derive = "0.3"
2426
approx = "0.5"
25-
geojson = ">= 0.19, <= 0.24.1"
27+
28+
geo-types = { version = "0.7", optional = true }
29+
geojson = { version = ">= 0.19, <= 0.24.1", optional = true }
30+
31+
[features]
32+
default = ["geo-types", "geojson"]
33+
geo-types = ["dep:geo-types"]
34+
geojson = ["geo-types", "dep:geojson"]

src/conversion/mod.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,15 @@
11
#[macro_use]
22
mod macros;
3+
34
mod coords;
5+
pub use coords::*;
6+
7+
#[cfg(feature = "geojson")]
48
mod geojson;
5-
mod geotypes;
9+
#[cfg(feature = "geojson")]
610
pub use self::geojson::*;
7-
pub use coords::*;
11+
12+
#[cfg(feature = "geo-types")]
13+
mod geotypes;
14+
#[cfg(feature = "geo-types")]
815
pub use geotypes::*;

src/lib.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,11 @@ mod errors;
5757
mod geometry;
5858
mod utils;
5959

60-
pub use conversion::{CoordSeq, FromGeoJSON, ToGeoJSON, TryInto};
60+
pub use conversion::CoordSeq;
61+
#[cfg(feature = "geojson")]
62+
pub use conversion::{FromGeoJSON, ToGeoJSON};
63+
#[cfg(feature = "geo-types")]
64+
pub use conversion::TryInto;
6165
pub use errors::Result;
6266
pub use geometry::{BufferType, GeomType, Orientation, SFCGeometry};
6367

@@ -97,8 +101,7 @@ mod tests {
97101
use super::version;
98102

99103
#[test]
100-
101104
fn display_version() {
102-
assert!(version().contains("2.0."));
105+
assert!(version().starts_with("2."));
103106
}
104107
}

0 commit comments

Comments
 (0)