| 590 | /// reasons as [`MutableBuffer::reserve`]. |
| 591 | #[inline] |
| 592 | pub fn extend_from_slice<T: ArrowNativeType>(&mut self, items: &[T]) { |
| 593 | let additional = mem::size_of_val(items); |
| 594 | self.reserve(additional); |
| 595 | unsafe { |
| 596 | // this assumes that `[ToByteSlice]` can be copied directly |
| 597 | // without calling `to_byte_slice` for each element, |
| 598 | // which is correct for all ArrowNativeType implementations. |
| 599 | let src = items.as_ptr() as *const u8; |
| 600 | let dst = self.data.as_ptr().add(self.len); |
| 601 | std::ptr::copy_nonoverlapping(src, dst, additional) |
| 602 | } |
| 603 | self.len += additional; |
| 604 | } |
| 605 | |
| 606 | /// Extends the buffer with a new item, increasing its capacity if needed. |
| 607 | /// # Example |