99//!
1010//! There are 3 types of objects: nodes, ways and relations.
1111
12+ #[ cfg( feature = "serde" ) ]
1213use serde:: { Deserialize , Serialize } ;
1314use smartstring:: alias:: String ;
1415use std:: iter:: FromIterator ;
@@ -18,7 +19,8 @@ use std::ops::{Deref, DerefMut};
1819/// [OpenStreetMap wiki page about
1920/// tags](http://wiki.openstreetmap.org/wiki/Tags) for more
2021/// information.
21- #[ derive( Debug , Default , Clone , PartialEq , Eq , PartialOrd , Ord , Hash , Serialize , Deserialize ) ]
22+ #[ derive( Debug , Default , Clone , PartialEq , Eq , PartialOrd , Ord , Hash ) ]
23+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
2224pub struct Tags ( :: flat_map:: FlatMap < String , String > ) ;
2325
2426impl Tags {
@@ -59,19 +61,23 @@ impl FromIterator<(String, String)> for Tags {
5961}
6062
6163/// A node identifier
62- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy , Serialize , Deserialize ) ]
64+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy ) ]
65+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
6366pub struct NodeId ( pub i64 ) ;
6467
6568/// A way identifier
66- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy , Serialize , Deserialize ) ]
69+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy ) ]
70+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
6771pub struct WayId ( pub i64 ) ;
6872
6973/// A relation identifier
70- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy , Serialize , Deserialize ) ]
74+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy ) ]
75+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7176pub struct RelationId ( pub i64 ) ;
7277
7378/// An OpenStreetMap object identifier
74- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy , Serialize , Deserialize ) ]
79+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Copy ) ]
80+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
7581pub enum OsmId {
7682 /// The identifier of a node
7783 Node ( NodeId ) ,
@@ -126,7 +132,8 @@ impl OsmId {
126132}
127133
128134/// An OpenStreetMap object.
129- #[ derive( Debug , PartialEq , PartialOrd , Clone , Serialize , Deserialize ) ]
135+ #[ derive( Debug , PartialEq , PartialOrd , Clone ) ]
136+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
130137pub enum OsmObj {
131138 /// A node
132139 Node ( Node ) ,
@@ -191,7 +198,8 @@ impl OsmObj {
191198/// An OpenStreetMap node. See the [OpenStreetMap wiki page about
192199/// node](http://wiki.openstreetmap.org/wiki/Node) for more
193200/// information.
194- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Serialize , Deserialize ) ]
201+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash ) ]
202+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
195203pub struct Node {
196204 /// The id of the node.
197205 pub id : NodeId ,
@@ -217,7 +225,8 @@ impl Node {
217225/// An OpenStreetMap way. See the [OpenStreetMap wiki page about
218226/// way](http://wiki.openstreetmap.org/wiki/Way) for more
219227/// information.
220- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Serialize , Deserialize ) ]
228+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash ) ]
229+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
221230pub struct Way {
222231 /// The id of the way.
223232 pub id : WayId ,
@@ -241,7 +250,8 @@ impl Way {
241250}
242251
243252/// A reference to an object with a role. Used in the relation object.
244- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Serialize , Deserialize ) ]
253+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash ) ]
254+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
245255pub struct Ref {
246256 /// Id of the member.
247257 pub member : OsmId ,
@@ -252,7 +262,8 @@ pub struct Ref {
252262/// An OpenStreetMap relation. See the [OpenStreetMap wiki page about
253263/// relation](http://wiki.openstreetmap.org/wiki/Relation) for more
254264/// information.
255- #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash , Serialize , Deserialize ) ]
265+ #[ derive( Debug , PartialEq , Eq , PartialOrd , Ord , Clone , Hash ) ]
266+ #[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
256267pub struct Relation {
257268 /// The id of the relation.
258269 pub id : RelationId ,
0 commit comments