vortex_array/array/convert.rs
1use arrow_array::Array;
2use vortex_error::VortexResult;
3
4use crate::ArrayRef;
5
6/// Trait for converting a type into a Vortex [`ArrayRef`].
7pub trait IntoArray {
8 fn into_array(self) -> ArrayRef;
9}
10
11/// Trait for converting a type into a Vortex [`ArrayRef`], returning an error if the conversion fails.
12pub trait TryIntoArray {
13 fn try_into_array(self) -> VortexResult<ArrayRef>;
14}
15
16/// Trait for converting a type from a Vortex [`ArrayRef`], returning an error if the conversion fails.
17pub trait TryFromArray: Sized {
18 fn try_from_array(array: &dyn Array) -> VortexResult<Self>;
19}
20
21/// Trait for converting a type from a Vortex [`ArrayRef`], returning an error if the conversion fails.
22pub trait TryFromArrayRef: Sized {
23 fn try_from_array(array: ArrayRef) -> VortexResult<Self>;
24}