File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed
scylla-cql/src/types/serialize Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -179,6 +179,22 @@ impl<T: SerializeValue> SerializeRow for Vec<T> {
179179 impl_serialize_row_for_slice ! ( ) ;
180180}
181181
182+ impl < T : SerializeRow > SerializeRow for Box < T > {
183+ #[ inline]
184+ fn serialize (
185+ & self ,
186+ ctx : & RowSerializationContext < ' _ > ,
187+ writer : & mut RowWriter ,
188+ ) -> Result < ( ) , SerializationError > {
189+ self . as_ref ( ) . serialize ( ctx, writer)
190+ }
191+
192+ #[ inline]
193+ fn is_empty ( & self ) -> bool {
194+ self . as_ref ( ) . is_empty ( )
195+ }
196+ }
197+
182198macro_rules! impl_serialize_row_for_map {
183199 ( ) => {
184200 fn serialize(
@@ -1544,4 +1560,14 @@ mod tests {
15441560
15451561 assert_eq ! ( reference, row) ;
15461562 }
1563+
1564+ #[ test]
1565+ fn test_row_serialization_with_boxed_tuple ( ) {
1566+ let spec = [ col ( "a" , ColumnType :: Int ) , col ( "b" , ColumnType :: Int ) ] ;
1567+
1568+ let reference = do_serialize ( ( 42i32 , 42i32 ) , & spec) ;
1569+ let row = do_serialize ( Box :: new ( ( 42i32 , 42i32 ) ) , & spec) ;
1570+
1571+ assert_eq ! ( reference, row) ;
1572+ }
15471573}
You can’t perform that action at this time.
0 commit comments