@@ -2321,7 +2321,7 @@ mod monoids {
2321
2321
use serde:: { Deserialize , Serialize } ;
2322
2322
2323
2323
/// A monoid containing a single-datum row.
2324
- #[ derive( Ord , PartialOrd , Eq , PartialEq , Debug , Clone , Serialize , Deserialize , Hash ) ]
2324
+ #[ derive( Ord , PartialOrd , Eq , PartialEq , Debug , Serialize , Deserialize , Hash ) ]
2325
2325
pub enum ReductionMonoid {
2326
2326
Min ( Row ) ,
2327
2327
Max ( Row ) ,
@@ -2336,6 +2336,35 @@ mod monoids {
2336
2336
}
2337
2337
}
2338
2338
2339
+ impl Clone for ReductionMonoid {
2340
+ fn clone ( & self ) -> Self {
2341
+ use ReductionMonoid :: * ;
2342
+ match self {
2343
+ Min ( row) => Min ( row. clone ( ) ) ,
2344
+ Max ( row) => Max ( row. clone ( ) ) ,
2345
+ }
2346
+ }
2347
+
2348
+ fn clone_from ( & mut self , source : & Self ) {
2349
+ use ReductionMonoid :: * ;
2350
+
2351
+ let mut row = std:: mem:: take ( match self {
2352
+ Min ( row) | Max ( row) => row,
2353
+ } ) ;
2354
+
2355
+ let source_row = match source {
2356
+ Min ( row) | Max ( row) => row,
2357
+ } ;
2358
+
2359
+ row. clone_from ( source_row) ;
2360
+
2361
+ match source {
2362
+ Min ( _) => * self = Min ( row) ,
2363
+ Max ( _) => * self = Max ( row) ,
2364
+ }
2365
+ }
2366
+ }
2367
+
2339
2368
impl Multiply < Diff > for ReductionMonoid {
2340
2369
type Output = Self ;
2341
2370
0 commit comments