File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -135,7 +135,7 @@ mod container {
135135 // The clone implementation moves out of the `Bytes` variant into `Align`.
136136 // This is optional and non-optimal, as the bytes clone is relatively free.
137137 // But, we don't want to leak the uses of `Bytes`, is why we do this I think.
138- impl < C : Clone > Clone for Column < C > where C : Clone {
138+ impl < C : columnar :: Container > Clone for Column < C > where C : Clone {
139139 fn clone ( & self ) -> Self {
140140 match self {
141141 Column :: Typed ( t) => Column :: Typed ( t. clone ( ) ) ,
@@ -148,6 +148,18 @@ mod container {
148148 Column :: Align ( a) => Column :: Align ( a. clone ( ) ) ,
149149 }
150150 }
151+ fn clone_from ( & mut self , other : & Self ) {
152+ match ( self , other) {
153+ ( Column :: Typed ( t0) , Column :: Typed ( t1) ) => {
154+ // Derived `Clone` implementations for e.g. tuples cannot be relied on to call `clone_from`.
155+ let t1 = t1. borrow ( ) ;
156+ t0. clear ( ) ;
157+ t0. extend_from_self ( t1, 0 ..t1. len ( ) ) ;
158+ }
159+ ( Column :: Align ( a0) , Column :: Align ( a1) ) => { a0. clone_from ( a1) ; }
160+ ( x, y) => { * x = y. clone ( ) ; }
161+ }
162+ }
151163 }
152164
153165 use columnar:: { Len , Index , FromBytes } ;
You can’t perform that action at this time.
0 commit comments