Skip to content

Commit

Permalink
Struct variant
Browse files Browse the repository at this point in the history
  • Loading branch information
gatesn committed Jul 17, 2024
1 parent eb8a8d2 commit 66f5660
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions vortex-array/src/variants.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,65 @@ pub trait ArrayVariants {
None
}

fn as_null_array_unchecked(&self) -> &dyn NullArrayTrait {
self.as_null_array().expect("Expected NullArray")
}

fn as_bool_array(&self) -> Option<&dyn BoolArrayTrait> {
None
}

fn as_bool_array_unchecked(&self) -> &dyn BoolArrayTrait {
self.as_bool_array().expect("Expected BoolArray")
}

fn as_primitive_array(&self) -> Option<&dyn PrimitiveArrayTrait> {
None
}

fn as_primitive_array_unchecked(&self) -> &dyn PrimitiveArrayTrait {
self.as_primitive_array().expect("Expected PrimitiveArray")
}

fn as_utf8_array(&self) -> Option<&dyn Utf8ArrayTrait> {
None
}

fn as_utf8_array_unchecked(&self) -> &dyn Utf8ArrayTrait {
self.as_utf8_array().expect("Expected Utf8Array")
}

fn as_binary_array(&self) -> Option<&dyn BinaryArrayTrait> {
None
}

fn as_binary_array_unchecked(&self) -> &dyn BinaryArrayTrait {
self.as_binary_array().expect("Expected BinaryArray")
}

fn as_struct_array(&self) -> Option<&dyn StructArrayTrait> {
None
}

fn as_struct_array_unchecked(&self) -> &dyn StructArrayTrait {
self.as_struct_array().expect("Expected StructArray")
}

fn as_list_array(&self) -> Option<&dyn ListArrayTrait> {
None
}

fn as_list_array_unchecked(&self) -> &dyn ListArrayTrait {
self.as_list_array().expect("Expected ListArray")
}

fn as_extension_array(&self) -> Option<&dyn ExtensionArrayTrait> {
None
}

fn as_extension_array_unchecked(&self) -> &dyn ExtensionArrayTrait {
self.as_extension_array().expect("Expected ExtensionArray")
}
}

pub trait NullArrayTrait: ArrayTrait {}
Expand Down

0 comments on commit 66f5660

Please sign in to comment.