@@ -20,6 +20,8 @@ use core::fmt;
2020use core:: hash:: Hash ;
2121use core:: marker:: PhantomData ;
2222use core:: ops:: { Add , AddAssign , Div , DivAssign , Mul , MulAssign , Neg , Sub , SubAssign } ;
23+ #[ cfg( feature = "malloc_size_of" ) ]
24+ use malloc_size_of:: { MallocSizeOf , MallocSizeOfOps } ;
2325#[ cfg( feature = "mint" ) ]
2426use mint;
2527use num_traits:: real:: Real ;
@@ -103,6 +105,13 @@ unsafe impl<T: Zeroable, U> Zeroable for Point2D<T, U> {}
103105#[ cfg( feature = "bytemuck" ) ]
104106unsafe impl < T : Pod , U : ' static > Pod for Point2D < T , U > { }
105107
108+ #[ cfg( feature = "malloc_size_of" ) ]
109+ impl < T : MallocSizeOf , U > MallocSizeOf for Point2D < T , U > {
110+ fn size_of ( & self , ops : & mut MallocSizeOfOps ) -> usize {
111+ self . x . size_of ( ops) + self . y . size_of ( ops)
112+ }
113+ }
114+
106115impl < T , U > Eq for Point2D < T , U > where T : Eq { }
107116
108117impl < T , U > PartialEq for Point2D < T , U >
@@ -896,6 +905,13 @@ unsafe impl<T: Zeroable, U> Zeroable for Point3D<T, U> {}
896905#[ cfg( feature = "bytemuck" ) ]
897906unsafe impl < T : Pod , U : ' static > Pod for Point3D < T , U > { }
898907
908+ #[ cfg( feature = "malloc_size_of" ) ]
909+ impl < T : MallocSizeOf , U > MallocSizeOf for Point3D < T , U > {
910+ fn size_of ( & self , ops : & mut MallocSizeOfOps ) -> usize {
911+ self . x . size_of ( ops) + self . y . size_of ( ops) + self . z . size_of ( ops)
912+ }
913+ }
914+
899915impl < T , U > Eq for Point3D < T , U > where T : Eq { }
900916
901917impl < T , U > PartialEq for Point3D < T , U >
0 commit comments