diff --git a/scylla-cql/src/types/serialize/row.rs b/scylla-cql/src/types/serialize/row.rs index cd0388c86..3888a122b 100644 --- a/scylla-cql/src/types/serialize/row.rs +++ b/scylla-cql/src/types/serialize/row.rs @@ -179,6 +179,22 @@ impl SerializeRow for Vec { impl_serialize_row_for_slice!(); } +impl SerializeRow for Box { + #[inline] + fn serialize( + &self, + ctx: &RowSerializationContext<'_>, + writer: &mut RowWriter, + ) -> Result<(), SerializationError> { + self.as_ref().serialize(ctx, writer) + } + + #[inline] + fn is_empty(&self) -> bool { + self.as_ref().is_empty() + } +} + macro_rules! impl_serialize_row_for_map { () => { fn serialize( @@ -1544,4 +1560,14 @@ mod tests { assert_eq!(reference, row); } + + #[test] + fn test_row_serialization_with_boxed_tuple() { + let spec = [col("a", ColumnType::Int), col("b", ColumnType::Int)]; + + let reference = do_serialize((42i32, 42i32), &spec); + let row = do_serialize(Box::new((42i32, 42i32)), &spec); + + assert_eq!(reference, row); + } }