@@ -96,21 +96,25 @@ pub enum SerialId {
9696    Id ( Index ,  Epoch ) , 
9797} 
9898
99+ #[ cfg( feature = "serde" ) ]  
99100impl  From < RawId >  for  SerialId  { 
100101    fn  from ( id :  RawId )  -> Self  { 
101102        let  ( index,  epoch)  = id. unzip ( ) ; 
102103        Self :: Id ( index,  epoch) 
103104    } 
104105} 
105106
107+ #[ cfg( feature = "serde" ) ]  
106108pub  struct  ZeroIdError ; 
107109
110+ #[ cfg( feature = "serde" ) ]  
108111impl  fmt:: Display  for  ZeroIdError  { 
109112    fn  fmt ( & self ,  f :  & mut  fmt:: Formatter < ' _ > )  -> fmt:: Result  { 
110113        write ! ( f,  "IDs may not be zero" ) 
111114    } 
112115} 
113116
117+ #[ cfg( feature = "serde" ) ]  
114118impl  TryFrom < SerialId >  for  RawId  { 
115119    type  Error  = ZeroIdError ; 
116120    fn  try_from ( id :  SerialId )  -> Result < Self ,  ZeroIdError >  { 
@@ -127,21 +131,24 @@ impl TryFrom<SerialId> for RawId {
127131/// 
128132/// This is used for tracing. 
129133#[ allow( dead_code) ]  
130- #[ cfg_attr ( feature = "serde" ,  derive ( serde :: Serialize ,  serde :: Deserialize ) ) ]  
131- #[ derive( Debug ) ]  
134+ #[ cfg ( feature = "serde" ) ]  
135+ #[ derive( Debug ,  serde :: Serialize ,  serde :: Deserialize ) ]  
132136pub  enum  PointerId < T :  Marker >  { 
133137    // The only variant forces RON to not ignore "Id" 
134138    PointerId ( usize ,  #[ serde( skip) ]   PhantomData < T > ) , 
135139} 
136140
141+ #[ cfg( feature = "serde" ) ]  
137142impl < T :  Marker >  Copy  for  PointerId < T >  { } 
138143
144+ #[ cfg( feature = "serde" ) ]  
139145impl < T :  Marker >  Clone  for  PointerId < T >  { 
140146    fn  clone ( & self )  -> Self  { 
141147        * self 
142148    } 
143149} 
144150
151+ #[ cfg( feature = "serde" ) ]  
145152impl < T :  Marker >  PartialEq  for  PointerId < T >  { 
146153    fn  eq ( & self ,  other :  & Self )  -> bool  { 
147154        let  PointerId :: PointerId ( this,  _)  = self ; 
@@ -150,15 +157,18 @@ impl<T: Marker> PartialEq for PointerId<T> {
150157    } 
151158} 
152159
160+ #[ cfg( feature = "serde" ) ]  
153161impl < T :  Marker >  Eq  for  PointerId < T >  { } 
154162
163+ #[ cfg( feature = "serde" ) ]  
155164impl < T :  Marker >  Hash  for  PointerId < T >  { 
156165    fn  hash < H :  core:: hash:: Hasher > ( & self ,  state :  & mut  H )  { 
157166        let  PointerId :: PointerId ( this,  _)  = self ; 
158167        this. hash ( state) ; 
159168    } 
160169} 
161170
171+ #[ cfg( feature = "serde" ) ]  
162172impl < T :  StorageItem >  From < & Arc < T > >  for  PointerId < T :: Marker >  { 
163173    fn  from ( arc :  & Arc < T > )  -> Self  { 
164174        // Since the memory representation of `Arc<T>` is just a pointer to 
0 commit comments