1use crate::chunked_array::object::extension::drop::drop_list;
2use crate::prelude::*;
34#[inline(never)]
5#[cold]
6fn drop_slow<T: PolarsDataType>(ca: &mut ChunkedArray<T>) {
7// SAFETY:
8 // guarded by the type system
9 // the transmute only convinces the type system that we are a list
10#[allow(clippy::transmute_undefined_repr)]
11unsafe {
12 drop_list(std::mem::transmute::<&mut ChunkedArray<T>, &ListChunked>(
13 ca,
14 ))
15 }
16}
1718impl<T: PolarsDataType> Drop for ChunkedArray<T> {
19fn drop(&mut self) {
20if matches!(self.dtype(), DataType::List(_)) {
21 drop_slow(self);
22 }
23 }
24}