diff --git a/arrow-array/src/cast.rs b/arrow-array/src/cast.rs index 8c7cc2a12f62..501e85ced22a 100644 --- a/arrow-array/src/cast.rs +++ b/arrow-array/src/cast.rs @@ -778,19 +778,14 @@ pub trait AsArray: private::Sealed { self.as_bytes_opt().expect("binary array") } - /// Downcast this to a [`StringViewArray`] returning `None` if not possible - fn as_string_view(&self) -> &StringViewArray { - self.as_byte_view_opt().expect("string view array") - } - /// Downcast this to a [`StringViewArray`] returning `None` if not possible fn as_string_view_opt(&self) -> Option<&StringViewArray> { self.as_byte_view_opt() } - /// Downcast this to a [`StringViewArray`] returning `None` if not possible - fn as_binary_view(&self) -> &BinaryViewArray { - self.as_byte_view_opt().expect("binary view array") + /// Downcast this to a [`StringViewArray`] panicking if not possible + fn as_string_view(&self) -> &StringViewArray { + self.as_byte_view_opt().expect("string view array") } /// Downcast this to a [`BinaryViewArray`] returning `None` if not possible @@ -798,14 +793,19 @@ pub trait AsArray: private::Sealed { self.as_byte_view_opt() } - /// Downcast this to a [`GenericByteViewArray`] returning `None` if not possible - fn as_byte_view(&self) -> &GenericByteViewArray { - self.as_byte_view_opt().expect("byte view array") + /// Downcast this to a [`BinaryViewArray`] panicking if not possible + fn as_binary_view(&self) -> &BinaryViewArray { + self.as_byte_view_opt().expect("binary view array") } /// Downcast this to a [`GenericByteViewArray`] returning `None` if not possible fn as_byte_view_opt(&self) -> Option<&GenericByteViewArray>; + /// Downcast this to a [`GenericByteViewArray`] panicking if not possible + fn as_byte_view(&self) -> &GenericByteViewArray { + self.as_byte_view_opt().expect("byte view array") + } + /// Downcast this to a [`StructArray`] returning `None` if not possible fn as_struct_opt(&self) -> Option<&StructArray>;