Skip to content

Commit 066d678

Browse files
authored
Implement Value for slice[T] (#410)
Adds the ability to serialize slices of T: Value. Used to prevent having to use Vec<T> and saves allocations.
1 parent f3d9d1f commit 066d678

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

scylla/src/frame/value.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -550,6 +550,12 @@ impl<T: Value> Value for Vec<T> {
550550
}
551551
}
552552

553+
impl<T: Value> Value for &[T] {
554+
fn serialize(&self, buf: &mut Vec<u8>) -> Result<(), ValueTooBig> {
555+
serialize_list_or_set(self.iter(), self.len(), buf)
556+
}
557+
}
558+
553559
fn serialize_tuple<V: Value>(
554560
elem_iter: impl Iterator<Item = V>,
555561
buf: &mut Vec<u8>,

0 commit comments

Comments
 (0)