Skip to content

Commit

Permalink
Merge #209
Browse files Browse the repository at this point in the history
209: Make serde optional for 'geo'. r=frewsxcv a=frewsxcv

Fixes #207.

Co-authored-by: Corey Farwell <coreyf@rwell.org>
  • Loading branch information
bors[bot] and frewsxcv committed May 5, 2018
2 parents f629f1b + 7ef9361 commit 7068aea
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
6 changes: 3 additions & 3 deletions geo/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ travis-ci = { repository = "georust/rust-geo" }

[dependencies]
num-traits = "0.2"
serde = "1.0"
serde_derive = "1.0"
serde = { version = "1.0", optional = true, features = ["derive"] }
spade = "1.3.0"
failure = "0.1.1"
postgis = { version = "0.5", optional = true }
proj-sys = { version = "0.6.1", optional = true }
libc = { version = "0.2.39", optional = true }
geo-types = { version = "0.1.0", features = ["serde", "spade"] }
geo-types = { version = "0.1.0", features = ["spade"] }

[features]
default = []
postgis-integration = ["postgis"]
proj = ["proj-sys", "libc"]
use-serde = ["serde", "geo-types/serde"]

[dev-dependencies]
approx = "0.1.1"
Expand Down
3 changes: 2 additions & 1 deletion geo/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
extern crate geo_types;
extern crate num_traits;
#[cfg(feature = "use-serde")]
#[macro_use]
extern crate serde_derive;
extern crate serde;
extern crate spade;
#[cfg(feature = "postgis-integration")]
extern crate postgis;
Expand Down
12 changes: 8 additions & 4 deletions geo/src/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ use ::{CoordinateType, Point};
pub static COORD_PRECISION: f32 = 1e-1; // 0.1m

/// A container for the bounding box of a [`Geometry`](enum.Geometry.html)
#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "use-serde", derive(Serialize, Deserialize))]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct Bbox<T>
where
T: CoordinateType,
Expand All @@ -19,7 +20,8 @@ where
}

/// A container for indices of the minimum and maximum points of a [`Geometry`](enum.Geometry.html)
#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "use-serde", derive(Serialize, Deserialize))]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct Extremes {
pub ymin: usize,
pub xmax: usize,
Expand All @@ -39,7 +41,8 @@ impl From<Vec<usize>> for Extremes {
}

/// A container for the coordinates of the minimum and maximum points of a [`Geometry`](enum.Geometry.html)
#[derive(PartialEq, Clone, Copy, Debug, Serialize, Deserialize)]
#[cfg_attr(feature = "use-serde", derive(Serialize, Deserialize))]
#[derive(PartialEq, Clone, Copy, Debug)]
pub struct ExtremePoint<T>
where
T: CoordinateType,
Expand Down Expand Up @@ -139,7 +142,8 @@ where
}

/// The result of trying to find the closest spot on an object to a point.
#[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)]
#[cfg_attr(feature = "use-serde", derive(Serialize, Deserialize))]
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Closest<F: Float> {
/// The point actually intersects with the object.
Intersection(Point<F>),
Expand Down

0 comments on commit 7068aea

Please sign in to comment.