@@ -135,6 +135,8 @@ macro_rules! impl_data_simple {
135135 } ;
136136}
137137
138+ // Standard library impls
139+
138140impl_data_simple ! ( i8 ) ;
139141impl_data_simple ! ( i16 ) ;
140142impl_data_simple ! ( i32 ) ;
@@ -161,6 +163,17 @@ impl_data_simple!(std::num::NonZeroU32);
161163impl_data_simple ! ( std:: num:: NonZeroU64 ) ;
162164impl_data_simple ! ( std:: num:: NonZeroU128 ) ;
163165impl_data_simple ! ( std:: num:: NonZeroUsize ) ;
166+ impl_data_simple ! ( std:: time:: SystemTime ) ;
167+ impl_data_simple ! ( std:: time:: Instant ) ;
168+ impl_data_simple ! ( std:: time:: Duration ) ;
169+ impl_data_simple ! ( std:: io:: ErrorKind ) ;
170+ impl_data_simple ! ( std:: net:: Ipv4Addr ) ;
171+ impl_data_simple ! ( std:: net:: Ipv6Addr ) ;
172+ impl_data_simple ! ( std:: net:: SocketAddrV4 ) ;
173+ impl_data_simple ! ( std:: net:: SocketAddrV6 ) ;
174+ impl_data_simple ! ( std:: net:: IpAddr ) ;
175+ impl_data_simple ! ( std:: net:: SocketAddr ) ;
176+ impl_data_simple ! ( std:: ops:: RangeFull ) ;
164177impl_data_simple ! ( druid:: piet:: InterpolationMode ) ;
165178//TODO: remove me!?
166179impl_data_simple ! ( String ) ;
@@ -189,12 +202,24 @@ impl<T: ?Sized + 'static> Data for Arc<T> {
189202 }
190203}
191204
205+ impl < T : ?Sized + ' static > Data for std:: sync:: Weak < T > {
206+ fn same ( & self , other : & Self ) -> bool {
207+ std:: sync:: Weak :: ptr_eq ( self , other)
208+ }
209+ }
210+
192211impl < T : ?Sized + ' static > Data for Rc < T > {
193212 fn same ( & self , other : & Self ) -> bool {
194213 Rc :: ptr_eq ( self , other)
195214 }
196215}
197216
217+ impl < T : ?Sized + ' static > Data for std:: rc:: Weak < T > {
218+ fn same ( & self , other : & Self ) -> bool {
219+ std:: rc:: Weak :: ptr_eq ( self , other)
220+ }
221+ }
222+
198223impl < T : Data > Data for Option < T > {
199224 fn same ( & self , other : & Self ) -> bool {
200225 match ( self , other) {
@@ -269,6 +294,75 @@ impl<T0: Data, T1: Data, T2: Data, T3: Data, T4: Data, T5: Data> Data for (T0, T
269294 }
270295}
271296
297+ impl < T : ' static + ?Sized > Data for std:: marker:: PhantomData < T > {
298+ fn same ( & self , _other : & Self ) -> bool {
299+ // zero-sized types
300+ true
301+ }
302+ }
303+
304+ impl < T : ' static > Data for std:: mem:: Discriminant < T > {
305+ fn same ( & self , other : & Self ) -> bool {
306+ * self == * other
307+ }
308+ }
309+
310+ impl < T : ' static + ?Sized + Data > Data for std:: mem:: ManuallyDrop < T > {
311+ fn same ( & self , other : & Self ) -> bool {
312+ ( & * * self ) . same ( & * * other)
313+ }
314+ }
315+
316+ impl < T : Data > Data for std:: num:: Wrapping < T > {
317+ fn same ( & self , other : & Self ) -> bool {
318+ self . 0 . same ( & other. 0 )
319+ }
320+ }
321+
322+ impl < T : Data > Data for std:: ops:: Range < T > {
323+ fn same ( & self , other : & Self ) -> bool {
324+ self . start . same ( & other. start ) && self . end . same ( & other. end )
325+ }
326+ }
327+
328+ impl < T : Data > Data for std:: ops:: RangeFrom < T > {
329+ fn same ( & self , other : & Self ) -> bool {
330+ self . start . same ( & other. start )
331+ }
332+ }
333+
334+ impl < T : Data > Data for std:: ops:: RangeInclusive < T > {
335+ fn same ( & self , other : & Self ) -> bool {
336+ self . start ( ) . same ( other. start ( ) ) && self . end ( ) . same ( other. end ( ) )
337+ }
338+ }
339+
340+ impl < T : Data > Data for std:: ops:: RangeTo < T > {
341+ fn same ( & self , other : & Self ) -> bool {
342+ self . end . same ( & other. end )
343+ }
344+ }
345+
346+ impl < T : Data > Data for std:: ops:: RangeToInclusive < T > {
347+ fn same ( & self , other : & Self ) -> bool {
348+ self . end . same ( & other. end )
349+ }
350+ }
351+
352+ impl < T : Data > Data for std:: ops:: Bound < T > {
353+ fn same ( & self , other : & Self ) -> bool {
354+ use std:: ops:: Bound :: * ;
355+ match ( self , other) {
356+ ( Included ( t1) , Included ( t2) ) if t1. same ( t2) => true ,
357+ ( Excluded ( t1) , Excluded ( t2) ) if t1. same ( t2) => true ,
358+ ( Unbounded , Unbounded ) => true ,
359+ _ => false ,
360+ }
361+ }
362+ }
363+
364+ // druid & deps impls
365+
272366impl Data for Scale {
273367 fn same ( & self , other : & Self ) -> bool {
274368 self == other
0 commit comments